This repository has been archived by the owner on Mar 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
270 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
namespace Beatmap { | ||
|
||
class Difficulty { | ||
public: | ||
static double Range(double difficulty, double min, double mid, double max) { | ||
if (difficulty > 5) | ||
return mid + (max - mid) * (difficulty - 5.0) / 5.0; | ||
if (difficulty < 5) | ||
return mid - (mid - min) * (5.0 - difficulty) / 5.0; | ||
return mid; | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#pragma once | ||
|
||
#include <cmath> | ||
#include "../Beatmap/Difficulty.h" | ||
#include "../Scoring/HitResult.h" | ||
|
||
using namespace Scoring; | ||
using namespace Beatmap; | ||
|
||
namespace Object { | ||
|
||
class HitWindows { | ||
protected: | ||
double Great; | ||
double Good; | ||
double Meh; | ||
double Miss; | ||
|
||
public: | ||
void SetDifficulty(double difficulty) { | ||
Great = Difficulty::Range(difficulty, 160, 100, 40); | ||
Good = Difficulty::Range(difficulty, 280, 200, 120); | ||
Meh = Difficulty::Range(difficulty, 400, 300, 200); | ||
Miss = Difficulty::Range(difficulty, 400, 400, 400); | ||
} | ||
|
||
HitResult ResultFor(double timeOffset) { | ||
timeOffset = std::abs(timeOffset); | ||
|
||
if (timeOffset <= HalfWindowFor(HitResult::Great)) | ||
return HitResult::Great; | ||
if (timeOffset <= HalfWindowFor(HitResult::Good)) | ||
return HitResult::Good; | ||
if (timeOffset <= HalfWindowFor(HitResult::Meh)) | ||
return HitResult::Meh; | ||
if (timeOffset <= HalfWindowFor(HitResult::Miss)) | ||
return HitResult::Miss; | ||
|
||
return HitResult::None; | ||
} | ||
|
||
double HalfWindowFor(HitResult result) { | ||
switch (result) { | ||
case HitResult::Great: | ||
return Great / 2; | ||
case HitResult::Good: | ||
return Good / 2; | ||
case HitResult::Meh: | ||
return Meh / 2; | ||
case HitResult::Miss: | ||
return Miss / 2; | ||
} | ||
} | ||
|
||
bool CanBeHit(double timeOffset) { | ||
return timeOffset <= HalfWindowFor(HitResult::Meh); | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
namespace Scoring { | ||
|
||
enum HitResult { | ||
None, | ||
Miss, | ||
Meh, | ||
Good, | ||
Great, | ||
Perfect | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.