Fixed missing operator= for the InputEngageGroup class. Add scaling damage number size based on relative damage multiplier. Release build 6264.

This commit is contained in:
2024-01-22 18:49:40 -06:00
parent 553baa5945
commit b8da4fbbbe
14 changed files with 33 additions and 9 deletions
@@ -1351,7 +1351,7 @@ void AiL::RenderWorld(float fElapsedTime){
case HEALTH_LOSS:{ case HEALTH_LOSS:{
std::string text=std::to_string(dn->damage); std::string text=std::to_string(dn->damage);
if(!dn->friendly){ if(!dn->friendly){
view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,DARK_RED); view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2.f*dn->size,text,DARK_RED,dn->size);
}else{ }else{
view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,RED,VERY_DARK_GREY); view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,RED,VERY_DARK_GREY);
} }
@@ -1379,7 +1379,7 @@ void AiL::RenderWorld(float fElapsedTime){
case CRIT:{ case CRIT:{
std::string text=std::to_string(dn->damage); std::string text=std::to_string(dn->damage);
if(!dn->friendly){ if(!dn->friendly){
view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,YELLOW,DARK_YELLOW); view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2.f*dn->size,text,YELLOW,DARK_YELLOW,dn->size);
}else{ }else{
view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,BLACK); view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,BLACK);
} }
-1
View File
@@ -83,7 +83,6 @@ struct ChargedArrow:public Bullet{
struct FrogTongue:public Bullet{ struct FrogTongue:public Bullet{
vf2d targetPos; vf2d targetPos;
float tongueLength; float tongueLength;
float tongueSpd;
float duration; float duration;
float knockbackStrength; float knockbackStrength;
FrogTongue(vf2d pos,vf2d targetPos,float lifetime,int damage,bool upperLevel,float knockbackStrength=1.0f,bool friendly=false,Pixel col=WHITE); FrogTongue(vf2d pos,vf2d targetPos,float lifetime,int damage,bool upperLevel,float knockbackStrength=1.0f,bool friendly=false,Pixel col=WHITE);
+17
View File
@@ -36,6 +36,9 @@ All rights reserved.
*/ */
#pragma endregion #pragma endregion
#include "DamageNumber.h" #include "DamageNumber.h"
#include "AdventuresInLestoria.h"
INCLUDE_game
const float DamageNumber::MOVE_UP_TIME=0.4f; const float DamageNumber::MOVE_UP_TIME=0.4f;
@@ -46,4 +49,18 @@ DamageNumber::DamageNumber()
DamageNumber::DamageNumber(vf2d pos,int damage,bool friendly,DamageNumberType type): DamageNumber::DamageNumber(vf2d pos,int damage,bool friendly,DamageNumberType type):
pos(pos),damage(damage),friendly(friendly),type(type),invertedDirection(type==INTERRUPT),riseSpd(20.f){ pos(pos),damage(damage),friendly(friendly),type(type),invertedDirection(type==INTERRUPT),riseSpd(20.f){
if(type==INTERRUPT||type==MANA_GAIN)riseSpd=40.f; if(type==INTERRUPT||type==MANA_GAIN)riseSpd=40.f;
originalRiseSpd=riseSpd;
RecalculateSize();
}
void DamageNumber::RecalculateSize(){
float damageMultRatio=damage/game->GetPlayer()->GetBaseStat("Attack")/2.f;
riseSpd=originalRiseSpd;
if(!friendly){
float newSize=std::clamp(round(damageMultRatio),1.0f,4.0f);
if(type==HEALTH_LOSS||type==CRIT)riseSpd*=newSize;
size=vf2d{newSize,newSize};
}
} }
+3
View File
@@ -52,10 +52,13 @@ struct DamageNumber{
float lifeTime=0; float lifeTime=0;
float pauseTime=0; float pauseTime=0;
float riseSpd=0.f; float riseSpd=0.f;
vf2d size{1.f,1.f};
bool friendly=false; bool friendly=false;
bool invertedDirection=false; bool invertedDirection=false;
DamageNumberType type=HEALTH_LOSS; DamageNumberType type=HEALTH_LOSS;
const static float MOVE_UP_TIME; const static float MOVE_UP_TIME;
float originalRiseSpd=0.f;
DamageNumber(); DamageNumber();
DamageNumber(vf2d pos,int damage,bool friendly=false,DamageNumberType type=HEALTH_LOSS); DamageNumber(vf2d pos,int damage,bool friendly=false,DamageNumberType type=HEALTH_LOSS);
void RecalculateSize();
}; };
+1 -1
View File
@@ -45,7 +45,7 @@ INCLUDE_MONSTER_LIST
INCLUDE_GFX INCLUDE_GFX
FrogTongue::FrogTongue(vf2d pos,vf2d targetPos,float lifetime,int damage,bool upperLevel,float knockbackStrength,bool friendly,Pixel col) FrogTongue::FrogTongue(vf2d pos,vf2d targetPos,float lifetime,int damage,bool upperLevel,float knockbackStrength,bool friendly,Pixel col)
:Bullet(pos,{},0,damage,upperLevel,friendly,col),targetPos(targetPos),tongueSpd(tongueSpd),tongueLength(0.f),knockbackStrength(knockbackStrength){ :Bullet(pos,{},0,damage,upperLevel,friendly,col),targetPos(targetPos),tongueLength(0.f),knockbackStrength(knockbackStrength){
this->lifetime=lifetime; this->lifetime=lifetime;
duration=lifetime; duration=lifetime;
} }
+4
View File
@@ -464,3 +464,7 @@ const InputEngageGroup::EngageType InputEngageGroup::GetEngageType()const{
InputGroup&InputEngageGroup::GetGroup()const{ InputGroup&InputEngageGroup::GetGroup()const{
return group; return group;
} }
const InputEngageGroup InputEngageGroup::operator=(const InputEngageGroup&rhs){
return InputEngageGroup{rhs.group,rhs.type};
}
+1
View File
@@ -107,6 +107,7 @@ public:
InputEngageGroup(InputGroup&group,EngageType type=Released); InputEngageGroup(InputGroup&group,EngageType type=Released);
const EngageType GetEngageType()const; const EngageType GetEngageType()const;
InputGroup&GetGroup()const; InputGroup&GetGroup()const;
const InputEngageGroup operator=(const InputEngageGroup&rhs);
}; };
class GenericKey{ class GenericKey{
+1
View File
@@ -440,6 +440,7 @@ bool Monster::Hurt(int damage,bool onUpperLevel,float z){
if(lastHitTimer>0){ if(lastHitTimer>0){
damageNumberPtr.get()->damage+=int(mod_dmg); damageNumberPtr.get()->damage+=int(mod_dmg);
damageNumberPtr.get()->pauseTime=0.4f; damageNumberPtr.get()->pauseTime=0.4f;
damageNumberPtr.get()->RecalculateSize();
} else { } else {
damageNumberPtr=std::make_shared<DamageNumber>(pos,int(mod_dmg)); damageNumberPtr=std::make_shared<DamageNumber>(pos,int(mod_dmg));
DAMAGENUMBER_LIST.push_back(damageNumberPtr); DAMAGENUMBER_LIST.push_back(damageNumberPtr);
+1
View File
@@ -718,6 +718,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
if(lastHitTimer>0){ if(lastHitTimer>0){
damageNumberPtr.get()->damage+=int(mod_dmg); damageNumberPtr.get()->damage+=int(mod_dmg);
damageNumberPtr.get()->pauseTime=0.4f; damageNumberPtr.get()->pauseTime=0.4f;
damageNumberPtr.get()->RecalculateSize();
} else { } else {
damageNumberPtr=std::make_shared<DamageNumber>(pos,int(mod_dmg),true); damageNumberPtr=std::make_shared<DamageNumber>(pos,int(mod_dmg),true);
DAMAGENUMBER_LIST.push_back(damageNumberPtr); DAMAGENUMBER_LIST.push_back(damageNumberPtr);
@@ -199,7 +199,7 @@ void State_OverworldMap::Draw(AiL*game){
using AngleTotal=float; using AngleTotal=float;
using Count=uint8_t; using Count=uint8_t;
using MedianAngle=std::pair<AngleTotal,Count>; using MedianAngle=std::pair<AngleTotal,Count>;
using ConnectionPointIndex=float; using ConnectionPointIndex=int;
auto GetAngle=[](MedianAngle angle){ auto GetAngle=[](MedianAngle angle){
return angle.first/angle.second; return angle.first/angle.second;
-2
View File
@@ -31,8 +31,6 @@ Story proofreading/correcting/storyboarding
- Add Death screen (Zoom in on fatal blow, slow time down... Display some game over text... Allow retry or return to world map.) - Add Death screen (Zoom in on fatal blow, slow time down... Display some game over text... Allow retry or return to world map.)
- Auto targeting for controller / keyboard.
A "Debug" version of the game that simply outputs all std::cout to a file as well (debug.log). A "Debug" version of the game that simply outputs all std::cout to a file as well (debug.log).
ERR messages become just output messages in release build and won't crash the game. ERR messages become just output messages in release build and won't crash the game.
+1 -1
View File
@@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 6261 #define VERSION_BUILD 6264
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a
@@ -78,7 +78,7 @@ bgm_config = audio/bgm.txt
event_config = audio/events.txt event_config = audio/events.txt
# Path to interface configuration # Path to interface configuration
interface_config = interface.txt interface_config = Interface.txt
# Path to character images # Path to character images
character_image_location = characters/ character_image_location = characters/
Binary file not shown.