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
+36 -36
View File
@@ -6,7 +6,7 @@
#include "core/jail/jgame.hpp"
#include "core/jail/jinput.hpp"
Mapa::Mapa(JD8_Surface gfx, Prota* sam) {
Mapa::Mapa(Jd8::Surface gfx, Prota* sam) {
this->gfx = gfx;
this->sam = sam;
@@ -23,42 +23,42 @@ Mapa::Mapa(JD8_Surface gfx, Prota* sam) {
}
Mapa::~Mapa() {
JD8_FreeSurface(this->fondo);
Jd8::freeSurface(this->fondo);
}
void Mapa::draw() {
if (info::ctx.num_piramide != 4) {
switch (sam->o) {
case 0: // Down
JD8_BlitCKToSurface(sam->x, sam->y, this->gfx, 15, 125 + sam->frame_pejades, 15, 1, this->fondo, 255);
Jd8::blitCKToSurface(sam->x, sam->y, this->gfx, 15, 125 + sam->frame_pejades, 15, 1, this->fondo, 255);
break;
case 1: // Up
JD8_BlitCKToSurface(sam->x, sam->y + 15, this->gfx, 0, 125 + (14 - sam->frame_pejades), 15, 1, this->fondo, 255);
Jd8::blitCKToSurface(sam->x, sam->y + 15, this->gfx, 0, 125 + (14 - sam->frame_pejades), 15, 1, this->fondo, 255);
break;
case 2: // Right
JD8_BlitCKToSurface(sam->x + 7, sam->y, this->gfx, 30 + sam->frame_pejades, 125, 1, 15, this->fondo, 255);
Jd8::blitCKToSurface(sam->x + 7, sam->y, this->gfx, 30 + sam->frame_pejades, 125, 1, 15, this->fondo, 255);
break;
case 3: // Left
JD8_BlitCKToSurface(sam->x + 8, sam->y, this->gfx, 45 + (14 - sam->frame_pejades), 125, 1, 15, this->fondo, 255);
Jd8::blitCKToSurface(sam->x + 8, sam->y, this->gfx, 45 + (14 - sam->frame_pejades), 125, 1, 15, this->fondo, 255);
break;
default:
break;
}
}
JD8_Blit(this->fondo);
Jd8::blit(this->fondo);
// Pinta tombes
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 4; x++) {
JD8_BlitCK(35 + (x * 65), 45 + (y * 35), this->gfx, this->tombes[x + (y * 4)].x, this->tombes[x + (y * 4)].y, 50, 20, 255);
Jd8::blitCK(35 + (x * 65), 45 + (y * 35), this->gfx, this->tombes[x + (y * 4)].x, this->tombes[x + (y * 4)].y, 50, 20, 255);
}
}
JD8_BlitCK(45, 15, this->gfx, 30 + (this->frame_torxes * 25), 80, 25, 15, 255);
JD8_BlitCK(95, 15, this->gfx, 30 + (this->frame_torxes * 25), 80, 25, 15, 255);
JD8_BlitCK(195, 15, this->gfx, 30 + (this->frame_torxes * 25), 80, 25, 15, 255);
JD8_BlitCK(245, 15, this->gfx, 30 + (this->frame_torxes * 25), 80, 25, 15, 255);
Jd8::blitCK(45, 15, this->gfx, 30 + (this->frame_torxes * 25), 80, 25, 15, 255);
Jd8::blitCK(95, 15, this->gfx, 30 + (this->frame_torxes * 25), 80, 25, 15, 255);
Jd8::blitCK(195, 15, this->gfx, 30 + (this->frame_torxes * 25), 80, 25, 15, 255);
Jd8::blitCK(245, 15, this->gfx, 30 + (this->frame_torxes * 25), 80, 25, 15, 255);
};
void Mapa::update() {
@@ -92,17 +92,17 @@ auto Mapa::novaMomia() -> bool {
void Mapa::preparaFondoEstatic() {
// Prepara el fondo esttic de l'habitaci
this->fondo = JD8_NewSurface();
this->fondo = Jd8::newSurface();
if (info::ctx.num_piramide == 6) {
JD8_BlitToSurface(9, 2, this->gfx, 227, 185, 92, 7, this->fondo); // Text "SECRETA"
Jd8::blitToSurface(9, 2, this->gfx, 227, 185, 92, 7, this->fondo); // Text "SECRETA"
} else {
JD8_BlitToSurface(9, 2, this->gfx, 60, 185, 39, 7, this->fondo); // Text "NIVELL"
JD8_BlitToSurface(72, 6, this->gfx, 153, 189, 3, 1, this->fondo); // Ralleta entre num piramide i num habitacio
Jd8::blitToSurface(9, 2, this->gfx, 60, 185, 39, 7, this->fondo); // Text "NIVELL"
Jd8::blitToSurface(72, 6, this->gfx, 153, 189, 3, 1, this->fondo); // Ralleta entre num piramide i num habitacio
}
JD8_BlitToSurface(130, 2, this->gfx, 225, 192, 19, 8, this->fondo); // Montonet de monedes + signe '='
JD8_BlitToSurface(220, 2, this->gfx, 160, 185, 48, 7, this->fondo); // Text "ENERGIA"
Jd8::blitToSurface(130, 2, this->gfx, 225, 192, 19, 8, this->fondo); // Montonet de monedes + signe '='
Jd8::blitToSurface(220, 2, this->gfx, 160, 185, 48, 7, this->fondo); // Text "ENERGIA"
if (info::ctx.diners >= 200) {
JD8_BlitToSurface(175, 3, this->gfx, 60, 193, 7, 6, this->fondo);
Jd8::blitToSurface(175, 3, this->gfx, 60, 193, 7, 6, this->fondo);
}
// Pinta taulells
@@ -110,22 +110,22 @@ void Mapa::preparaFondoEstatic() {
for (int x = 0; x < 19; x++) {
switch (info::ctx.num_piramide) {
case 1:
JD8_BlitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 0, 80, 15, 15, this->fondo);
Jd8::blitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 0, 80, 15, 15, this->fondo);
break;
case 2:
JD8_BlitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 25, 95, 15, 15, this->fondo);
Jd8::blitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 25, 95, 15, 15, this->fondo);
break;
case 3:
JD8_BlitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 40, 95, 15, 15, this->fondo);
Jd8::blitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 40, 95, 15, 15, this->fondo);
break;
case 4:
JD8_BlitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 175 + ((rand() % 3) * 15), 80, 15, 15, this->fondo);
Jd8::blitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 175 + ((rand() % 3) * 15), 80, 15, 15, this->fondo);
break;
case 5:
JD8_BlitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 130, 80, 15, 15, this->fondo);
Jd8::blitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 130, 80, 15, 15, this->fondo);
break;
case 6:
JD8_BlitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 145, 80, 15, 15, this->fondo);
Jd8::blitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 145, 80, 15, 15, this->fondo);
break;
default:
break;
@@ -134,28 +134,28 @@ void Mapa::preparaFondoEstatic() {
}
// Pinta vores de les parets
JD8_BlitCKToSurface(5, 15, this->gfx, 30, 110, 15, 15, this->fondo, 255);
JD8_BlitCKToSurface(295, 15, this->gfx, 45, 110, 15, 15, this->fondo, 255);
JD8_BlitCKToSurface(5, 180, this->gfx, 0, 155, 15, 20, this->fondo, 255);
JD8_BlitCKToSurface(295, 180, this->gfx, 15, 155, 15, 20, this->fondo, 255);
Jd8::blitCKToSurface(5, 15, this->gfx, 30, 110, 15, 15, this->fondo, 255);
Jd8::blitCKToSurface(295, 15, this->gfx, 45, 110, 15, 15, this->fondo, 255);
Jd8::blitCKToSurface(5, 180, this->gfx, 0, 155, 15, 20, this->fondo, 255);
Jd8::blitCKToSurface(295, 180, this->gfx, 15, 155, 15, 20, this->fondo, 255);
// Pinta parets verticals
for (int i = 0; i < 10; i++) {
JD8_BlitToSurface(5, 30 + (i * 15), this->gfx, 0, 110, 15, 15, this->fondo);
JD8_BlitToSurface(295, 30 + (i * 15), this->gfx, 15, 110, 15, 15, this->fondo);
Jd8::blitToSurface(5, 30 + (i * 15), this->gfx, 0, 110, 15, 15, this->fondo);
Jd8::blitToSurface(295, 30 + (i * 15), this->gfx, 15, 110, 15, 15, this->fondo);
}
// Pinta parets hortzintals
for (int i = 0; i < 11; i++) {
JD8_BlitToSurface(20 + (i * 25), 185, this->gfx, 0, 95, 25, 15, this->fondo);
JD8_BlitToSurface(20 + (i * 25), 15, this->gfx, 0, 95, 25, 15, this->fondo);
Jd8::blitToSurface(20 + (i * 25), 185, this->gfx, 0, 95, 25, 15, this->fondo);
Jd8::blitToSurface(20 + (i * 25), 15, this->gfx, 0, 95, 25, 15, this->fondo);
}
// Pinta la porta
JD8_BlitCKToSurface(150, 18, this->gfx, 0, 143, 15, 12, this->fondo, 255);
Jd8::blitCKToSurface(150, 18, this->gfx, 0, 143, 15, 12, this->fondo, 255);
if (info::ctx.num_piramide == 2) {
JD8_BlitToSurface(5, 100, this->gfx, 30, 140, 15, 15, this->fondo);
Jd8::blitToSurface(5, 100, this->gfx, 30, 140, 15, 15, this->fondo);
}
}
@@ -296,7 +296,7 @@ void Mapa::comprovaCaixa(Uint8 num) {
void Mapa::comprovaPorta() {
if (this->clau && this->farao) {
JD8_BlitCKToSurface(150, 18, this->gfx, 15, 143, 15, 12, this->fondo, 255);
Jd8::blitCKToSurface(150, 18, this->gfx, 15, 143, 15, 12, this->fondo, 255);
porta_oberta = true;
}
}