Add Trapper class new animation sheet. Change XP data size from holding 32 bit integers to 64 bit integers due to higher level EXP numbers overflowing the XP counter. Release Build 10172.

mac-build
sigonasr2 4 months ago
parent 7f4b949627
commit 2907fc9865
  1. 28
      Adventures in Lestoria/Animation.cpp
  2. 18
      Adventures in Lestoria/Player.cpp
  3. 22
      Adventures in Lestoria/Player.h
  4. 8
      Adventures in Lestoria/SaveFile.cpp
  5. 16
      Adventures in Lestoria/Trapper.cpp
  6. 2
      Adventures in Lestoria/Version.h
  7. 14
      Adventures in Lestoria/assets/config/Player.txt
  8. 1
      Adventures in Lestoria/assets/config/gfx/gfx.txt
  9. BIN
      Adventures in Lestoria/assets/gamepack.pak
  10. BIN
      Adventures in Lestoria/assets/nico-trapper.png
  11. BIN
      Adventures in Lestoria/assets/nico-trapper.xcf
  12. 3
      Adventures in Lestoria/cpp.hint
  13. 12
      Adventures in Lestoria/olcUTIL_DataFile.h
  14. BIN
      x64/Release/Adventures in Lestoria.exe

@ -39,6 +39,7 @@ All rights reserved.
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "safemap.h"
#include <ranges>
INCLUDE_game
INCLUDE_ANIMATION_DATA
@ -239,6 +240,33 @@ void sig::Animation::InitializeAnimations(){
ANIMATION_DATA["THIEF_DEADLYDASH_E"]=pl_thief_deadlydash_e;
ANIMATION_DATA["THIEF_DEADLYDASH_S"]=pl_thief_deadlydash_s;
ANIMATION_DATA["THIEF_DEADLYDASH_W"]=pl_thief_deadlydash_w;
//Trapper animations
SetupClassWalkIdleAnimations(GFX["nico-trapper.png"],"TRAPPER");
Animate2D::FrameSequence pl_trapper_shoot_s,pl_trapper_shoot_n,pl_trapper_shoot_e,pl_trapper_shoot_w;
Animate2D::FrameSequence pl_trapper_setTrap_s,pl_trapper_setTrap_n,pl_trapper_setTrap_e,pl_trapper_setTrap_w;
for(int i=0;i<3;i++){
pl_trapper_shoot_s.AddFrame({&GFX["nico-trapper.png"],{vi2d{3+i,0}*24,{24,24}}});
pl_trapper_shoot_n.AddFrame({&GFX["nico-trapper.png"],{vi2d{3+i,1}*24,{24,24}}});
pl_trapper_shoot_e.AddFrame({&GFX["nico-trapper.png"],{vi2d{3+i,3}*24,{24,24}}});
pl_trapper_shoot_w.AddFrame({&GFX["nico-trapper.png"],{vi2d{3+i,2}*24,{24,24}}});
}
for(int i:std::ranges::iota_view(0,5)){
pl_trapper_setTrap_s.AddFrame({&GFX["nico-trapper.png"],{vi2d{1+i,4}*24,{24,24}}});
pl_trapper_setTrap_n.AddFrame({&GFX["nico-trapper.png"],{vi2d{1+i,5}*24,{24,24}}});
int frameInd{i};
if(i==4)frameInd--; //One less frame for East and West facing sprites.
pl_trapper_setTrap_e.AddFrame({&GFX["nico-trapper.png"],{vi2d{1+frameInd,6}*24,{24,24}}});
pl_trapper_setTrap_w.AddFrame({&GFX["nico-trapper.png"],{vi2d{1+frameInd,7}*24,{24,24}}});
}
ANIMATION_DATA["TRAPPER_SHOOT_S"]=pl_trapper_shoot_s;
ANIMATION_DATA["TRAPPER_SHOOT_N"]=pl_trapper_shoot_n;
ANIMATION_DATA["TRAPPER_SHOOT_E"]=pl_trapper_shoot_e;
ANIMATION_DATA["TRAPPER_SHOOT_W"]=pl_trapper_shoot_w;
ANIMATION_DATA["TRAPPER_SETTRAP_S"]=pl_trapper_setTrap_s;
ANIMATION_DATA["TRAPPER_SETTRAP_N"]=pl_trapper_setTrap_n;
ANIMATION_DATA["TRAPPER_SETTRAP_E"]=pl_trapper_setTrap_e;
ANIMATION_DATA["TRAPPER_SETTRAP_W"]=pl_trapper_setTrap_w;
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});

@ -1395,7 +1395,7 @@ const float Player::GetDamageReductionPct()const{
return modDmgReductionPct;
}
void Player::AddXP(const uint32_t xpGain){
void Player::AddXP(const uint64_t xpGain){
currentLevelXP+=xpGain;
totalXPEarned+=xpGain;
if(Level()<LevelCap()){
@ -1408,12 +1408,12 @@ void Player::AddXP(const uint32_t xpGain){
Component<ProgressBar>(MenuType::CHARACTER_MENU,"XP Bar")->ResetProgressBar(game->GetPlayer()->CurrentXP(),game->GetPlayer()->NextLevelXPRequired());
}
void Player::SetXP(const uint32_t xp){
void Player::SetXP(const uint64_t xp){
currentLevelXP=xp;
Component<ProgressBar>(MenuType::CHARACTER_MENU,"XP Bar")->ResetProgressBar(game->GetPlayer()->CurrentXP(),game->GetPlayer()->NextLevelXPRequired());
}
void Player::SetTotalXPEarned(const uint32_t totalXP){
void Player::SetTotalXPEarned(const uint64_t totalXP){
totalXPEarned=totalXP;
}
@ -1445,16 +1445,16 @@ void Player::SetLevel(uint8_t newLevel){
Component<MenuLabel>(CHARACTER_MENU,"Level Class Display")->SetLabel(std::format("Lv{} {}",game->GetPlayer()->Level(),game->GetPlayer()->GetClassName()));
Component<MenuLabel>(LEVEL_COMPLETE,"Level Display")->SetLabel(std::format("Lv{}",game->GetPlayer()->Level()));
}
const uint32_t Player::CurrentXP()const{
const uint64_t Player::CurrentXP()const{
return currentLevelXP;
}
const uint32_t Player::TotalXP()const{
const uint64_t Player::TotalXP()const{
return totalXPEarned;
}
const uint32_t Player::NextLevelXPRequired()const{
const uint64_t Player::NextLevelXPRequired()const{
if(Level()<LevelCap()){
return DATA.GetProperty(std::format("PlayerXP.LEVEL[{}]",Level()+1)).GetInt();
return DATA.GetProperty(std::format("PlayerXP.LEVEL[{}]",Level()+1)).GetBigInt();
}
return 0;
}
@ -1463,11 +1463,11 @@ const uint32_t Player::NextLevelXPRequired()const{
void Player::ResetAccumulatedXP(){
accumulatedXP=0;
}
void Player::AddAccumulatedXP(const uint32_t xpGain){
void Player::AddAccumulatedXP(const uint64_t xpGain){
accumulatedXP+=xpGain;
}
const uint32_t Player::GetAccumulatedXP()const{
const uint64_t Player::GetAccumulatedXP()const{
return accumulatedXP;
}

@ -246,27 +246,27 @@ public:
static void AddMoneyListener(std::weak_ptr<MenuComponent>component);
uint32_t GetMoney()const;
void SetMoney(uint32_t newMoney);
void AddXP(const uint32_t xpGain);
void AddXP(const uint64_t xpGain);
void OnLevelUp();
const uint8_t LevelCap()const;
const uint8_t Level()const;
const uint32_t CurrentXP()const;
const uint32_t TotalXP()const;
const uint32_t NextLevelXPRequired()const;
const uint64_t CurrentXP()const;
const uint64_t TotalXP()const;
const uint64_t NextLevelXPRequired()const;
void CancelCast();
const ItemAttributable&GetStats()const;
const ItemAttributable&GetBaseStats()const;
void ResetAccumulatedXP();
const uint32_t GetAccumulatedXP()const;
void AddAccumulatedXP(const uint32_t xpGain);
const uint64_t GetAccumulatedXP()const;
void AddAccumulatedXP(const uint64_t xpGain);
//Knockup the player for duration amount of seconds, and Zamt pixels.
void Knockup(float duration);
static const bool INVERTED,USE_WALK_DIR;
const vf2d GetAimingLocation(bool useWalkDir=false,bool invert=false);
const vf2d GetWorldAimingLocation(bool useWalkDir=false,bool invert=false);
void SetXP(const uint32_t xp);
void SetTotalXPEarned(const uint32_t totalXP);
void SetXP(const uint64_t xp);
void SetTotalXPEarned(const uint64_t totalXP);
void SetLevel(uint8_t newLevel);
void SetInvisible(const bool invisibleState);
const bool IsInvisible()const;
@ -295,9 +295,9 @@ private:
vf2d pos;
uint8_t level=1;
uint8_t levelCap=1;
uint32_t totalXPEarned=0;
uint32_t currentLevelXP=0;
uint32_t accumulatedXP=0;
uint64_t totalXPEarned=0;
uint64_t currentLevelXP=0;
uint64_t accumulatedXP=0;
float z=0;
float size=1.0f;
float spin_attack_timer=0;

@ -109,8 +109,8 @@ const void SaveFile::SaveGame(){
saveFile["Player"]["Class"].SetString(game->GetPlayer()->GetClassName());
saveFile["Player"]["Level"].SetInt(game->GetPlayer()->Level());
saveFile["Player"]["Money"].SetInt(game->GetPlayer()->GetMoney());
saveFile["Player"]["Current EXP"].SetInt(game->GetPlayer()->CurrentXP());
saveFile["Player"]["Total EXP"].SetInt(game->GetPlayer()->TotalXP());
saveFile["Player"]["Current EXP"].SetBigInt(game->GetPlayer()->CurrentXP());
saveFile["Player"]["Total EXP"].SetBigInt(game->GetPlayer()->TotalXP());
for(const auto&[attr,val]:game->GetPlayer()->GetBaseStats()){
saveFile["Player"]["Base Stats"][std::string(attr.ActualName())].SetReal(val);
}
@ -371,8 +371,8 @@ void SaveFile::LoadFile(){
game->ChangePlayerClass(classutils::StringToClass(loadFile["Player"]["Class"].GetString()));
game->GetPlayer()->SetLevel(loadFile["Player"]["Level"].GetInt());
game->GetPlayer()->SetMoney(loadFile["Player"]["Money"].GetInt());
game->GetPlayer()->SetXP(loadFile["Player"]["Current EXP"].GetInt());
game->GetPlayer()->SetTotalXPEarned(loadFile["Player"]["Total EXP"].GetInt());
game->GetPlayer()->SetXP(loadFile["Player"]["Current EXP"].GetBigInt());
game->GetPlayer()->SetTotalXPEarned(loadFile["Player"]["Total EXP"].GetBigInt());
for(auto&[key,data]:loadFile["Player"]["Base Stats"].GetOrderedKeys()){
game->GetPlayer()->SetBaseStat(key,data.GetReal());
}

@ -48,14 +48,14 @@ INCLUDE_game
void Trapper::Initialize(){
READFROMCONFIG(Trapper,TRAPPER);
Trapper::idle_n="WARRIOR_IDLE_N";
Trapper::idle_e="WARRIOR_IDLE_E";
Trapper::idle_s="WARRIOR_IDLE_S";
Trapper::idle_w="WARRIOR_IDLE_W";
Trapper::walk_n="WARRIOR_WALK_N";
Trapper::walk_e="WARRIOR_WALK_E";
Trapper::walk_s="WARRIOR_WALK_S";
Trapper::walk_w="WARRIOR_WALK_W";
Trapper::idle_n="TRAPPER_IDLE_N";
Trapper::idle_e="TRAPPER_IDLE_E";
Trapper::idle_s="TRAPPER_IDLE_S";
Trapper::idle_w="TRAPPER_IDLE_W";
Trapper::walk_n="TRAPPER_WALK_N";
Trapper::walk_e="TRAPPER_WALK_E";
Trapper::walk_s="TRAPPER_WALK_S";
Trapper::walk_w="TRAPPER_WALK_W";
}
SETUP_CLASS(Trapper)

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 10166
#define VERSION_BUILD 10172
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -82,11 +82,15 @@ Player
PLAYER_ANIMATION[8] = WIZARD_IDLE_ATTACK
PLAYER_ANIMATION[9] = WIZARD_ATTACK
PLAYER_ANIMATION[10] = WIZARD_CAST
PLAYER_ANIMATION[11] = WIZARD_IDLE
PLAYER_ANIMATION[12] = THIEF_IDLE
PLAYER_ANIMATION[13] = THIEF_WALK
PLAYER_ANIMATION[14] = THIEF_SWINGSWORD
PLAYER_ANIMATION[15] = THIEF_DEADLYDASH
PLAYER_ANIMATION[11] = WIZARD_IDLE
PLAYER_ANIMATION[12] = THIEF_IDLE
PLAYER_ANIMATION[13] = THIEF_WALK
PLAYER_ANIMATION[14] = THIEF_SWINGSWORD
PLAYER_ANIMATION[15] = THIEF_DEADLYDASH
PLAYER_ANIMATION[16] = TRAPPER_IDLE
PLAYER_ANIMATION[17] = TRAPPER_WALK
PLAYER_ANIMATION[18] = TRAPPER_SHOOT
PLAYER_ANIMATION[19] = TRAPPER_SETTRAP
}
PlayerXP

@ -111,6 +111,7 @@ Images
GFX_Shine = shine.png
GFX_Thief_Sheet = nico-thief.png
GFX_Trapper_Sheet = nico-trapper.png
# Ability Icons
GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

@ -8,7 +8,8 @@
#define INCLUDE_MONSTER_LIST
#define INCLUDE_MONSTER_DATA
#define INCLUDE_EMITTER_LIST
#define SETUP_CLASS(class) class::class() :Player::Player(){} class::class(Player*player) :Player::Player(player){} Class class::GetClass(){return cl;} std::string class::GetClassName(){return name;} Ability&class::GetRightClickAbility(){return rightClickAbility;}; Ability&class::GetAbility1(){return ability1;}; Ability&class::GetAbility2(){return ability2;}; Ability&class::GetAbility3(){return ability3;}; Ability&class::GetAbility4(){return ability4;}; std::string&class::GetWalkNAnimation(){return walk_n;}; std::string&class::GetWalkEAnimation(){return walk_e;}; std::string&class::GetWalkSAnimation(){return walk_s;}; std::string&class::GetWalkWAnimation(){return walk_w;}; std::string&class::GetIdleNAnimation(){return idle_n;}; std::string&class::GetIdleEAnimation(){return idle_e;}; std::string&class::GetIdleSAnimation(){return idle_s;}; std::string&class::GetIdleWAnimation(){return idle_w;}; std::string class::name=""; Class class::cl=ANY; Ability class::rightClickAbility=Ability(); Ability class::ability1=Ability(); Ability class::ability2=Ability(); Ability class::ability3=Ability(); Ability class::ability4=Ability(); std::string class::idle_n="WARRIOR_IDLE_N"; std::string class::idle_e="WARRIOR_IDLE_E"; std::string class::idle_s="WARRIOR_IDLE_S"; std::string class::idle_w="WARRIOR_IDLE_W"; std::string class::walk_n="WARRIOR_WALK_N"; std::string class::walk_e="WARRIOR_WALK_E"; std::string class::walk_s="WARRIOR_WALK_S"; std::string class::walk_w="WARRIOR_WALK_W";
#define SETUP_CLASS(class) class::class() :Player::Player(){} class::class(Player*player) :Player::Player(player){} Class class::GetClass(){return cl;} std::string class::GetClassName(){return name;} Ability&class::GetRightClickAbility(){return rightClickAbility;}; Ability&class::GetAbility1(){return ability1;}; Ability&class::GetAbility2(){return ability2;}; Ability&class::GetAbility3(){return ability3;}; Ability&class::GetAbility4(){return ability4;}; std::string&class::GetWalkNAnimation(){return walk_n;}; std::string&class::GetWalkEAnimation(){return walk_e;}; std::string&class::GetWalkSAnimation(){return walk_s;}; std::string&class::GetWalkWAnimation(){return walk_w;}; std::string&class::GetIdleNAnimation(){return idle_n;}; std::string&class::GetIdleEAnimation(){return idle_e;}; std::string&class::GetIdleSAnimation(){return idle_s;}; std::string&class::GetIdleWAnimation(){return idle_w;}; std::string class::name=""; Class class::cl=ANY; Ability class::rightClickAbility=Ability(); Ability class::ability1=Ability(); Ability class::ability2=Ability(); Ability class::ability3=Ability(); Ability class::ability4=Ability(); std::string class::idle_n="
_N"; std::string class::idle_e="WARRIOR_IDLE_E"; std::string class::idle_s="WARRIOR_IDLE_S"; std::string class::idle_w="WARRIOR_IDLE_W"; std::string class::walk_n="WARRIOR_WALK_N"; std::string class::walk_e="WARRIOR_WALK_E"; std::string class::walk_s="WARRIOR_WALK_S"; std::string class::walk_w="WARRIOR_WALK_W";
#define INCLUDE_BULLET_LIST
#define INCLUDE_DATA
#define INCLUDE_MONSTER_NAME_DATA

@ -123,6 +123,12 @@ namespace olc::utils
SetString(std::to_string(d), nItem);
}
// Retrieves the Integer Value of a Property (for a given index) or 0
inline const int64_t GetBigInt(const size_t nItem = 0) const
{
return std::stoll(GetString(nItem).c_str());
}
// Retrieves the Integer Value of a Property (for a given index) or 0
inline const int32_t GetInt(const size_t nItem = 0) const
{
@ -153,6 +159,12 @@ namespace olc::utils
SetString(std::to_string(n), nItem);
}
// Sets the Long Integer Value of a Property (for a given index)
inline void SetBigInt(const int64_t n, const size_t nItem = 0)
{
SetString(std::to_string(n), nItem);
}
inline Pixel GetPixel(const size_t nItem = 0){
return {uint8_t(GetInt(nItem)),uint8_t(GetInt(nItem+1)),uint8_t(GetInt(nItem+2)),uint8_t(GetInt(nItem+3))};
}

Loading…
Cancel
Save