@ -91,26 +91,26 @@ void MonsterData::InitializeMonsterData(){
if ( ! DATA [ " Monsters " ] [ MonsterName ] . HasProperty ( " Animations " ) ) ERR ( std : : format ( " WARNING! Could not find any animations to load for monster {}! Please check the Monsters.txt configuration file! " , MonsterName ) ) ;
if ( DATA [ " Monsters " ] [ MonsterName ] [ " Animations " ] . GetKeys ( ) . size ( ) < 4 ) ERR ( std : : format ( " WARNING! Monster {} does not have at least 4 animations. The animations should be defined in this order: a standing, walking, attack, and death animation " , MonsterName ) ) ;
for ( size_t animationRow = 0 ; auto & [ animationName , size ] : DATA [ " Monsters " ] [ MonsterName ] [ " Animations " ] ) {
for ( size_t animationRow = 0 ; auto & [ animationName , data ] : DATA [ " Monsters " ] [ MonsterName ] [ " Animations " ] . GetOrderedKeys ( ) ) {
Animate2D : : Style style = Animate2D : : Style : : Repeat ;
if ( DATA [ " Monsters " ] [ MonsterName ] [ " Animations " ] [ animationName ] . GetString ( 2 ) = = " Repeat " ) {
if ( data . GetString ( 2 ) = = " Repeat " ) {
style = Animate2D : : Style : : Repeat ;
} else
if ( DATA [ " Monsters " ] [ MonsterName ] [ " Animations " ] [ animationName ] . GetString ( 2 ) = = " OneShot " ) {
if ( data . GetString ( 2 ) = = " OneShot " ) {
style = Animate2D : : Style : : OneShot ;
} else
if ( DATA [ " Monsters " ] [ MonsterName ] [ " Animations " ] [ animationName ] . GetString ( 2 ) = = " PingPong " ) {
if ( data . GetString ( 2 ) = = " PingPong " ) {
style = Animate2D : : Style : : PingPong ;
} else
if ( DATA [ " Monsters " ] [ MonsterName ] [ " Animations " ] [ animationName ] . GetString ( 2 ) = = " Reverse " ) {
if ( data . GetString ( 2 ) = = " Reverse " ) {
style = Animate2D : : Style : : Reverse ;
} else {
ERR ( std : : format ( " WARNING! Invalid Animation Style specified: {} " , int ( style ) ) ) ;
}
int frameCount = DATA [ " Monsters " ] [ MonsterName ] [ " Animations " ] [ animationName ] . GetInt ( 0 ) ;
int frameCount = data . GetInt ( 0 ) ;
vf2d frameSize = vf2d { float ( DATA [ " Monsters " ] [ MonsterName ] [ " SheetFrameSize " ] . GetInt ( 0 ) ) , float ( DATA [ " Monsters " ] [ MonsterName ] [ " SheetFrameSize " ] . GetInt ( 1 ) ) } ;
CreateHorizontalAnimationSequence ( * MonsterData : : imgs [ MonsterName ] , frameCount , frameSize , std : : format ( " {}_{} " , MonsterName , animationName ) , animationRow , AnimationData { float ( DATA [ " Monsters " ] [ MonsterName ] [ " Animations " ] [ animationName ] . GetReal ( 1 ) ) , style } ) ;
CreateHorizontalAnimationSequence ( * MonsterData : : imgs [ MonsterName ] , frameCount , frameSize , std : : format ( " {}_{} " , MonsterName , animationName ) , animationRow , AnimationData { float ( data . GetReal ( 1 ) ) , style } ) ;
animations . push_back ( animationName ) ;
@ -218,26 +218,26 @@ void MonsterData::InitializeNPCData(){
if ( ! DATA [ " NPCs " ] [ NPCName ] . HasProperty ( " Animations " ) ) ERR ( std : : format ( " WARNING! Could not find any animations to load for monster {}! Please check the Monsters.txt configuration file! " , NPCName ) ) ;
if ( DATA [ " NPCs " ] [ NPCName ] [ " Animations " ] . GetKeys ( ) . size ( ) < 4 ) ERR ( std : : format ( " WARNING! Monster {} does not have at least 4 animations. The animations should be defined in this order: a standing, walking, attack, and death animation " , NPCName ) ) ;
for ( size_t animationRow = 0 ; auto & [ animationName , size ] : DATA [ " NPCs " ] [ NPCName ] [ " Animations " ] ) {
for ( size_t animationRow = 0 ; auto & [ animationName , data ] : DATA [ " NPCs " ] [ NPCName ] [ " Animations " ] . GetOrderedKeys ( ) ) {
Animate2D : : Style style = Animate2D : : Style : : Repeat ;
if ( DATA [ " NPCs " ] [ NPCName ] [ " Animations " ] [ animationName ] . GetString ( 2 ) = = " Repeat " ) {
if ( data . GetString ( 2 ) = = " Repeat " ) {
style = Animate2D : : Style : : Repeat ;
} else
if ( DATA [ " NPCs " ] [ NPCName ] [ " Animations " ] [ animationName ] . GetString ( 2 ) = = " OneShot " ) {
if ( data . GetString ( 2 ) = = " OneShot " ) {
style = Animate2D : : Style : : OneShot ;
} else
if ( DATA [ " NPCs " ] [ NPCName ] [ " Animations " ] [ animationName ] . GetString ( 2 ) = = " PingPong " ) {
if ( data . GetString ( 2 ) = = " PingPong " ) {
style = Animate2D : : Style : : PingPong ;
} else
if ( DATA [ " NPCs " ] [ NPCName ] [ " Animations " ] [ animationName ] . GetString ( 2 ) = = " Reverse " ) {
if ( data . GetString ( 2 ) = = " Reverse " ) {
style = Animate2D : : Style : : Reverse ;
} else {
ERR ( std : : format ( " WARNING! Invalid Animation Style specified: {} " , int ( style ) ) ) ;
}
int frameCount = DATA [ " NPCs " ] [ NPCName ] [ " Animations " ] [ animationName ] . GetInt ( 0 ) ;
int frameCount = data . GetInt ( 0 ) ;
vf2d frameSize = vf2d { float ( DATA [ " NPCs " ] [ NPCName ] [ " SheetFrameSize " ] . GetInt ( 0 ) ) , float ( DATA [ " NPCs " ] [ NPCName ] [ " SheetFrameSize " ] . GetInt ( 1 ) ) } ;
CreateHorizontalAnimationSequence ( * MonsterData : : imgs [ NPCName ] , frameCount , frameSize , std : : format ( " {}_{} " , NPCName , animationName ) , animationRow , AnimationData { float ( DATA [ " NPCs " ] [ NPCName ] [ " Animations " ] [ animationName ] . GetReal ( 1 ) ) , style } ) ;
CreateHorizontalAnimationSequence ( * MonsterData : : imgs [ NPCName ] , frameCount , frameSize , std : : format ( " {}_{} " , NPCName , animationName ) , animationRow , AnimationData { float ( data . GetReal ( 1 ) ) , style } ) ;
animations . push_back ( animationName ) ;