fix: tidy director/jdraw8/jinput/jfile (locals UPPER_CASE, file_*→Jf::)
This commit is contained in:
+16
-16
@@ -117,9 +117,9 @@ void Jd8::setScreenPalette(Jd8::Palette palette) {
|
||||
}
|
||||
|
||||
void Jd8::fillSquare(int ini, int height, Uint8 color) {
|
||||
const int offset = ini * 320;
|
||||
const int size = height * 320;
|
||||
memset(&screen[offset], color, size);
|
||||
const int OFFSET = ini * 320;
|
||||
const int SIZE = height * 320;
|
||||
memset(&screen[OFFSET], color, SIZE);
|
||||
}
|
||||
|
||||
void Jd8::fillRect(int x, int y, int w, int h, Uint8 color) {
|
||||
@@ -265,25 +265,25 @@ void Jd8::setPaletteColor(Uint8 index, Uint8 r, Uint8 g, Uint8 b) {
|
||||
namespace {
|
||||
|
||||
enum class FadeType : std::uint8_t {
|
||||
None = 0,
|
||||
Out,
|
||||
ToPal,
|
||||
NONE = 0,
|
||||
OUT,
|
||||
TO_PAL,
|
||||
};
|
||||
|
||||
constexpr int FADE_STEPS = 32;
|
||||
|
||||
FadeType fade_type = FadeType::None;
|
||||
FadeType fade_type = FadeType::NONE;
|
||||
Color fade_target[256];
|
||||
int fade_step = 0;
|
||||
|
||||
void apply_fade_step() {
|
||||
if (fade_type == FadeType::Out) {
|
||||
void applyFadeStep() {
|
||||
if (fade_type == FadeType::OUT) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
main_palette[i].r = main_palette[i].r >= 8 ? main_palette[i].r - 8 : 0;
|
||||
main_palette[i].g = main_palette[i].g >= 8 ? main_palette[i].g - 8 : 0;
|
||||
main_palette[i].b = main_palette[i].b >= 8 ? main_palette[i].b - 8 : 0;
|
||||
}
|
||||
} else if (fade_type == FadeType::ToPal) {
|
||||
} else if (fade_type == FadeType::TO_PAL) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
main_palette[i].r = main_palette[i].r <= int(fade_target[i].r) - 8
|
||||
? main_palette[i].r + 8
|
||||
@@ -301,30 +301,30 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
void Jd8::fadeStartOut() {
|
||||
fade_type = FadeType::Out;
|
||||
fade_type = FadeType::OUT;
|
||||
fade_step = 0;
|
||||
}
|
||||
|
||||
void Jd8::fadeStartToPal(const Color* pal) {
|
||||
fade_type = FadeType::ToPal;
|
||||
fade_type = FadeType::TO_PAL;
|
||||
memcpy(fade_target, pal, sizeof(Color) * 256);
|
||||
fade_step = 0;
|
||||
}
|
||||
|
||||
auto Jd8::fadeIsActive() -> bool {
|
||||
return fade_type != FadeType::None;
|
||||
return fade_type != FadeType::NONE;
|
||||
}
|
||||
|
||||
auto Jd8::fadeTickStep() -> bool {
|
||||
if (fade_type == FadeType::None) {
|
||||
if (fade_type == FadeType::NONE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
apply_fade_step();
|
||||
applyFadeStep();
|
||||
fade_step++;
|
||||
|
||||
if (fade_step >= FADE_STEPS) {
|
||||
fade_type = FadeType::None;
|
||||
fade_type = FadeType::NONE;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user