refactor: JD8_* a namespace Jd8::

This commit is contained in:
2026-05-16 14:24:22 +02:00
parent 1ce0d9c56c
commit f37308a5f0
41 changed files with 394 additions and 396 deletions
+70 -70
View File
@@ -55,9 +55,9 @@ namespace {
void drawWordmark(const Uint8* gfx) {
if (Options::game.use_new_logo) {
// Centrat: (320 188) / 2 = 66 (IntroNewLogoScene usa la mateixa x).
JD8_Blit(66, 78, gfx, 60, 158, 188, 28);
Jd8::blit(66, 78, gfx, 60, 158, 188, 28);
} else {
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
Jd8::blit(43, 78, gfx, 43, 155, 231, 45);
}
}
@@ -79,70 +79,70 @@ namespace {
// =========================================================================
void v0_walk_right(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(i, 150, gfx, fr1[(i / 5) % 13], 0, 15, 15, 0);
Jd8::blitCK(i, 150, gfx, fr1[(i / 5) % 13], 0, 15, 15, 0);
}
void v0_pull_map_right(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(200, 150, gfx, fr3[std::min(i / 5, 10)], 30, 15, 15, 0);
Jd8::blitCK(200, 150, gfx, fr3[std::min(i / 5, 10)], 30, 15, 15, 0);
}
void v0_walk_left_to_80(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(i, 150, gfx, fr2[(i / 5) % 13], 15, 15, 15, 0);
Jd8::blitCK(i, 150, gfx, fr2[(i / 5) % 13], 15, 15, 15, 0);
}
void v0_pull_map_left(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(80, 150, gfx, fr4[std::min(i / 5, 10)], 45, 15, 15, 0);
Jd8::blitCK(80, 150, gfx, fr4[std::min(i / 5, 10)], 45, 15, 15, 0);
}
void v0_momia_left(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(i, 150, gfx, fr6[(i / 5) % 8], 60, 15, 15, 0);
JD8_BlitCK(80, 150, gfx, fr4[10], 45, 15, 15, 0);
Jd8::blitCK(i, 150, gfx, fr6[(i / 5) % 8], 60, 15, 15, 0);
Jd8::blitCK(80, 150, gfx, fr4[10], 45, 15, 15, 0);
}
void v0_turn(const Uint8* gfx, int /*i*/) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(80, 150, gfx, fr1[1], 0, 15, 15, 0);
JD8_BlitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
JD8_BlitCK(80, 133, gfx, 0, INTERROGANT, 15, 15, 0);
Jd8::blitCK(80, 150, gfx, fr1[1], 0, 15, 15, 0);
Jd8::blitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
Jd8::blitCK(80, 133, gfx, 0, INTERROGANT, 15, 15, 0);
}
void v0_jump1(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(80, 150 - ((i % 50) / 5), gfx, fr5[std::min(i / 5, 19)], 45, 15, 15, 0);
JD8_BlitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
Jd8::blitCK(80, 150 - ((i % 50) / 5), gfx, fr5[std::min(i / 5, 19)], 45, 15, 15, 0);
Jd8::blitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
}
void v0_jump2(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(80, 140 + ((i % 50) / 5), gfx, fr5[std::min(i / 5, 19)], 45, 15, 15, 0);
JD8_BlitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
Jd8::blitCK(80, 140 + ((i % 50) / 5), gfx, fr5[std::min(i / 5, 19)], 45, 15, 15, 0);
Jd8::blitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
}
void v0_walk_final(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(i, 150, gfx, fr2[(i / 5) % 13], 15, 15, 15, 0);
JD8_BlitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
Jd8::blitCK(i, 150, gfx, fr2[(i / 5) % 13], 15, 15, 15, 0);
Jd8::blitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
}
void v0_final(const Uint8* gfx, int /*i*/) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
JD8_BlitCK(95, 133, gfx, 0, INTERROGANT, 15, 15, 0);
Jd8::blitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0);
Jd8::blitCK(95, 133, gfx, 0, INTERROGANT, 15, 15, 0);
}
constexpr SpritePhase variant_0[] = {
@@ -164,63 +164,63 @@ namespace {
// =========================================================================
void v1_walk_right(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
JD8_BlitCK(i, 150, gfx, fr1[(i / 5) % 13], 0, 15, 15, 255);
Jd8::blitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
Jd8::blitCK(i, 150, gfx, fr1[(i / 5) % 13], 0, 15, 15, 255);
}
void v1_pull_map(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
JD8_BlitCK(200, 150, gfx, fr3[std::min(i / 5, 10)], 30, 15, 15, 255);
Jd8::blitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
Jd8::blitCK(200, 150, gfx, fr3[std::min(i / 5, 10)], 30, 15, 15, 255);
}
void v1_interrogant(const Uint8* gfx, int /*i*/) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
JD8_BlitCK(200, 134, gfx, 0, INTERROGANT, 15, 15, 255);
JD8_BlitCK(200, 150, gfx, fr3[10], 30, 15, 15, 255);
Jd8::blitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
Jd8::blitCK(200, 134, gfx, 0, INTERROGANT, 15, 15, 255);
Jd8::blitCK(200, 150, gfx, fr3[10], 30, 15, 15, 255);
}
void v1_drop_map(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
Jd8::blitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
const int idx = std::min(i / 5, 28);
// fr7 té 29 frames dividits en dos grups: paper (idx 0..13, src_y=75)
// i sombra (idx 14..28, src_y=105). El vell feia una branca al bucle.
if (idx <= 13) {
JD8_BlitCK(200, 150, gfx, fr7[idx], 75, 15, 15, 255);
Jd8::blitCK(200, 150, gfx, fr7[idx], 75, 15, 15, 255);
} else {
JD8_BlitCK(200, 150, gfx, fr7[idx], 105, 15, 15, 255);
Jd8::blitCK(200, 150, gfx, fr7[idx], 105, 15, 15, 255);
}
}
void v1_stone_fall(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
JD8_BlitCK(200, 150, gfx, fr7[28], 105, 15, 15, 255);
JD8_BlitCK(200, i * 2, gfx, fr8[0], 75, 15, 15, 255);
Jd8::blitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
Jd8::blitCK(200, 150, gfx, fr7[28], 105, 15, 15, 255);
Jd8::blitCK(200, i * 2, gfx, fr8[0], 75, 15, 15, 255);
}
void v1_stone_break(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
JD8_BlitCK(200, 150, gfx, fr8[i / 10], 75, 15, 15, 255);
Jd8::blitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
Jd8::blitCK(200, 150, gfx, fr8[i / 10], 75, 15, 15, 255);
}
void v1_final(const Uint8* gfx, int /*i*/) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
JD8_BlitCK(200, 150, gfx, fr8[1], 75, 15, 15, 255);
JD8_BlitCK(185, 150, gfx, fr8[2], 75, 15, 15, 255);
JD8_BlitCK(215, 150, gfx, fr8[3], 75, 15, 15, 255);
Jd8::blitCK(200, 155, gfx, 0, CREU, 15, 15, 255);
Jd8::blitCK(200, 150, gfx, fr8[1], 75, 15, 15, 255);
Jd8::blitCK(185, 150, gfx, fr8[2], 75, 15, 15, 255);
Jd8::blitCK(215, 150, gfx, fr8[3], 75, 15, 15, 255);
}
constexpr SpritePhase variant_1[] = {
@@ -238,33 +238,33 @@ namespace {
// =========================================================================
void v2_approach(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(i, 150, gfx, fr1[(i / 5) % 13], 0, 15, 15, 255);
JD8_BlitCK(304 - i, 150, gfx, fr6[(i / 10) % 8], 60, 15, 15, 255);
Jd8::blitCK(i, 150, gfx, fr1[(i / 5) % 13], 0, 15, 15, 255);
Jd8::blitCK(304 - i, 150, gfx, fr6[(i / 10) % 8], 60, 15, 15, 255);
}
void v2_still(const Uint8* gfx, int /*i*/) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(145, 150, gfx, fr1[1], 0, 15, 15, 255);
JD8_BlitCK(160, 150, gfx, fr6[1], 60, 15, 15, 255);
Jd8::blitCK(145, 150, gfx, fr1[1], 0, 15, 15, 255);
Jd8::blitCK(160, 150, gfx, fr6[1], 60, 15, 15, 255);
}
void v2_horn(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(125, 150, gfx, fr11[(i / 10) % 2], 90, 15, 15, 255);
JD8_BlitCK(145, 150, gfx, fr1[1], 0, 15, 15, 255);
JD8_BlitCK(160, 150, gfx, fr6[1], 60, 15, 15, 255);
Jd8::blitCK(125, 150, gfx, fr11[(i / 10) % 2], 90, 15, 15, 255);
Jd8::blitCK(145, 150, gfx, fr1[1], 0, 15, 15, 255);
Jd8::blitCK(160, 150, gfx, fr6[1], 60, 15, 15, 255);
}
void v2_ball(const Uint8* gfx, int i) {
JD8_ClearScreen(0);
Jd8::clearScreen(0);
drawWordmark(gfx);
JD8_BlitCK(145, 150, gfx, fr9[(i / 10) % 16], 120, 15, 15, 255);
JD8_BlitCK(160, 150, gfx, fr10[(i / 10) % 16], 135, 15, 15, 255);
JD8_BlitCK(125, 150, gfx, fr11[((i / 5) % 4) + 2], 90, 15, 15, 255);
Jd8::blitCK(145, 150, gfx, fr9[(i / 10) % 16], 120, 15, 15, 255);
Jd8::blitCK(160, 150, gfx, fr10[(i / 10) % 16], 135, 15, 15, 255);
Jd8::blitCK(125, 150, gfx, fr11[((i / 5) % 4) + 2], 90, 15, 15, 255);
}
constexpr SpritePhase variant_2[] = {
@@ -330,7 +330,7 @@ namespace scenes {
done_ = false;
// Renderitzem ja el primer frame (step 0 de la primera fase) perquè
// el JD8_Flip del mini-loop del fiber el pinte al primer cicle.
// el Jd8::flip del mini-loop del fiber el pinte al primer cicle.
const SpritePhase* phases = variant_table(variant_);
phases[0].render(gfx_.get(), phase_current_i(phases[0], 0));
}