<commit_before>#include <cassert>
#include <map>

#include "WeaponAnimation.h"

#include "../Items/WeaponType.h"
#include "../Utilities/Debug.h"

namespace
{
	// Mappings of weapon types to .CIF filenames.
	const std::map<WeaponType, std::string> WeaponTypeFilenames =
	{
		{ WeaponType::BattleAxe, "AXE" },
		{ WeaponType::Broadsword, "SWORD" },
		{ WeaponType::Claymore, "SWORD" },
		{ WeaponType::Dagger, "SWORD" },
		{ WeaponType::DaiKatana, "SWORD" },
		{ WeaponType::Fists, "HAND" },
		{ WeaponType::Flail, "STAR" },
		{ WeaponType::Katana, "SWORD" },
		{ WeaponType::LongBow, "" }, // Bows have no animations.
		{ WeaponType::Longsword, "SWORD" },
		{ WeaponType::Mace, "MACE" },
		{ WeaponType::Saber, "SWORD" },
		{ WeaponType::ShortBow, "" }, // Bows have no animations.
		{ WeaponType::Shortsword, "SWORD" },
		{ WeaponType::Staff, "STAFF" },
		{ WeaponType::Tanto, "SWORD" },
		{ WeaponType::Wakizashi, "SWORD" },
		{ WeaponType::WarAxe, "AXE" },
		{ WeaponType::Warhammer, "HAMMER" }
	};

	// Mappings of weapon animation states to ranges of frame indices, excluding fists.
	const std::map<WeaponAnimation::State, std::vector<int>> WeaponAnimationRanges =
	{
		{ WeaponAnimation::State::Sheathed, { } },
		{ WeaponAnimation::State::Unsheathing, { 30, 31, 32 } },
		{ WeaponAnimation::State::Idle, { 32 } },
		{ WeaponAnimation::State::Forward, { 25, 26, 27, 28, 29 } },
		{ WeaponAnimation::State::Down, { 0, 1, 2, 3, 4 } },
		{ WeaponAnimation::State::Right, { 15, 16, 17, 18, 19 } },
		{ WeaponAnimation::State::Left, { 10, 11, 12, 13, 14 } },
		{ WeaponAnimation::State::DownRight, { 20, 21, 22, 23, 24 } },
		{ WeaponAnimation::State::DownLeft, { 5, 6, 7, 8, 9 } },
		{ WeaponAnimation::State::Sheathing, { 32, 31, 30 } }
	};

	// Mappings of fists animation states to ranges of frame indices.
	const std::map<WeaponAnimation::State, std::vector<int>> FistsAnimationRanges =
	{
		{ WeaponAnimation::State::Sheathed, { } },
		{ WeaponAnimation::State::Unsheathing, { 10, 11, 12 } },
		{ WeaponAnimation::State::Idle, { 12 } },
		{ WeaponAnimation::State::Forward, { 5, 6, 7, 8, 9 } },
		{ WeaponAnimation::State::Down, { 0, 1, 2, 3, 4 } },
		{ WeaponAnimation::State::Right, { 5, 6, 7, 8, 9 } },
		{ WeaponAnimation::State::Left, { 0, 1, 2, 3, 4 } },
		{ WeaponAnimation::State::DownRight, { 5, 6, 7, 8, 9 } },
		{ WeaponAnimation::State::DownLeft, { 0, 1, 2, 3, 4 } },
		{ WeaponAnimation::State::Sheathing, { 12, 11, 10 } }
	};
}

const double WeaponAnimation::DEFAULT_TIME_PER_FRAME = 1.0 / 18.0;

WeaponAnimation::WeaponAnimation(WeaponType weaponType)
{
	// Bows are not allowed because they have no animation.
	DebugAssert((weaponType != WeaponType::LongBow) && (weaponType != WeaponType::ShortBow),
		"Bows do not have weapon animations.");

	this->state = WeaponAnimation::State::Sheathed;
	this->weaponType = weaponType;
	this->currentTime = 0.0;
	this->timePerFrame = WeaponAnimation::DEFAULT_TIME_PER_FRAME;
	this->rangeIndex = 0;
}

WeaponAnimation::~WeaponAnimation()
{
<commit_msg>Slowed swinging speed to match original.<commit_after>#include <cassert>
#include <map>

#include "WeaponAnimation.h"

#include "../Items/WeaponType.h"
#include "../Utilities/Debug.h"

namespace
{
	// Mappings of weapon types to .CIF filenames.
	const std::map<WeaponType, std::string> WeaponTypeFilenames =
	{
		{ WeaponType::BattleAxe, "AXE" },
		{ WeaponType::Broadsword, "SWORD" },
		{ WeaponType::Claymore, "SWORD" },
		{ WeaponType::Dagger, "SWORD" },
		{ WeaponType::DaiKatana, "SWORD" },
		{ WeaponType::Fists, "HAND" },
		{ WeaponType::Flail, "STAR" },
		{ WeaponType::Katana, "SWORD" },
		{ WeaponType::LongBow, "" }, // Bows have no animations.
		{ WeaponType::Longsword, "SWORD" },
		{ WeaponType::Mace, "MACE" },
		{ WeaponType::Saber, "SWORD" },
		{ WeaponType::ShortBow, "" }, // Bows have no animations.
		{ WeaponType::Shortsword, "SWORD" },
		{ WeaponType::Staff, "STAFF" },
		{ WeaponType::Tanto, "SWORD" },
		{ WeaponType::Wakizashi, "SWORD" },
		{ WeaponType::WarAxe, "AXE" },
		{ WeaponType::Warhammer, "HAMMER" }
	};

	// Mappings of weapon animation states to ranges of frame indices, excluding fists.
	const std::map<WeaponAnimation::State, std::vector<int>> WeaponAnimationRanges =
	{
		{ WeaponAnimation::State::Sheathed, { } },
		{ WeaponAnimation::State::Unsheathing, { 30, 31, 32 } },
		{ WeaponAnimation::State::Idle, { 32 } },
		{ WeaponAnimation::State::Forward, { 25, 26, 27, 28, 29 } },
		{ WeaponAnimation::State::Down, { 0, 1, 2, 3, 4 } },
		{ WeaponAnimation::State::Right, { 15, 16, 17, 18, 19 } },
		{ WeaponAnimation::State::Left, { 10, 11, 12, 13, 14 } },
		{ WeaponAnimation::State::DownRight, { 20, 21, 22, 23, 24 } },
		{ WeaponAnimation::State::DownLeft, { 5, 6, 7, 8, 9 } },
		{ WeaponAnimation::State::Sheathing, { 32, 31, 30 } }
	};

	// Mappings of fists animation states to ranges of frame indices.
	const std::map<WeaponAnimation::State, std::vector<int>> FistsAnimationRanges =
	{
		{ WeaponAnimation::State::Sheathed, { } },
		{ WeaponAnimation::State::Unsheathing, { 10, 11, 12 } },
		{ WeaponAnimation::State::Idle, { 12 } },
		{ WeaponAnimation::State::Forward, { 5, 6, 7, 8, 9 } },
		{ WeaponAnimation::State::Down, { 0, 1, 2, 3, 4 } },
		{ WeaponAnimation::State::Right, { 5, 6, 7, 8, 9 } },
		{ WeaponAnimation::State::Left, { 0, 1, 2, 3, 4 } },
		{ WeaponAnimation::State::DownRight, { 5, 6, 7, 8, 9 } },
		{ WeaponAnimation::State::DownLeft, { 0, 1, 2, 3, 4 } },
		{ WeaponAnimation::State::Sheathing, { 12, 11, 10 } }
	};
}

const double WeaponAnimation::DEFAULT_TIME_PER_FRAME = 1.0 / 16.0;

WeaponAnimation::WeaponAnimation(WeaponType weaponType)
{
	// Bows are not allowed because they have no animation.
	DebugAssert((weaponType != WeaponType::LongBow) && (weaponType != WeaponType::ShortBow),
		"Bows do not have weapon animations.");

	this->state = WeaponAnimation::State::Sheathed;
	this->weaponType = weaponType;
	this->currentTime = 0.0;
	this->timePerFrame = WeaponAnimation::DEFAULT_TIME_PER_FRAME;
	this->rangeIndex = 0;
}

WeaponAnimation::~WeaponAnimation()
{

{'fraction_non_alphanumeric': 0.18664242023474956, 'fraction_numerical': 0.038353446850719126, 'mean_word_length': 4.723746452223273, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5704711', 'n_tokens_mistral': 2574, 'n_tokens_neox': 2216, 'n_words': 459}