fase 1: jail i game a c++ idiomàtic (raii, info::ctx, cheats arreglats)

This commit is contained in:
2026-04-15 18:03:46 +02:00
parent 2c833d086e
commit 7f85b50c63
18 changed files with 834 additions and 804 deletions

View File

@@ -26,7 +26,7 @@ Mapa::~Mapa(void) {
}
void Mapa::draw() {
if (info::num_piramide != 4) {
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);
@@ -88,7 +88,7 @@ bool Mapa::novaMomia() {
void Mapa::preparaFondoEstatic() {
// Prepara el fondo est<73>tic de l'habitaci<63>
this->fondo = JD8_NewSurface();
if (info::num_piramide == 6) {
if (info::ctx.num_piramide == 6) {
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"
@@ -96,12 +96,12 @@ void Mapa::preparaFondoEstatic() {
}
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::diners >= 200) JD8_BlitToSurface(175, 3, this->gfx, 60, 193, 7, 6, this->fondo);
if (info::ctx.diners >= 200) JD8_BlitToSurface(175, 3, this->gfx, 60, 193, 7, 6, this->fondo);
// Pinta taulells
for (int y = 0; y < 11; y++) {
for (int x = 0; x < 19; x++) {
switch (info::num_piramide) {
switch (info::ctx.num_piramide) {
case 1:
JD8_BlitToSurface(20 + (x * 15), 30 + (y * 15), this->gfx, 0, 80, 15, 15, this->fondo);
break;
@@ -145,7 +145,7 @@ void Mapa::preparaFondoEstatic() {
// Pinta la porta
JD8_BlitCKToSurface(150, 18, this->gfx, 0, 143, 15, 12, this->fondo, 255);
if (info::num_piramide == 2) {
if (info::ctx.num_piramide == 2) {
JD8_BlitToSurface(5, 100, this->gfx, 30, 140, 15, 15, this->fondo);
}
}
@@ -157,9 +157,9 @@ void swap(Uint8& a, Uint8& b) {
}
void Mapa::preparaTombes() {
const Uint8 contingut = info::num_piramide == 6 ? CONTE_DIAMANT : CONTE_RES;
int cx = info::num_piramide == 6 ? 270 : 0;
int cy = info::num_piramide == 6 ? 50 : 0;
const Uint8 contingut = info::ctx.num_piramide == 6 ? CONTE_DIAMANT : CONTE_RES;
int cx = info::ctx.num_piramide == 6 ? 270 : 0;
int cy = info::ctx.num_piramide == 6 ? 50 : 0;
for (int i = 0; i < 16; i++) {
this->tombes[i].contingut = contingut;
@@ -171,7 +171,7 @@ void Mapa::preparaTombes() {
this->tombes[i].x = cx;
this->tombes[i].y = cy;
}
if (info::num_piramide == 6) return;
if (info::ctx.num_piramide == 6) return;
this->tombes[0].contingut = CONTE_FARAO;
this->tombes[1].contingut = CONTE_CLAU;
this->tombes[2].contingut = CONTE_PERGAMI;
@@ -241,7 +241,7 @@ void Mapa::comprovaCaixa(Uint8 num) {
break;
case CONTE_TRESOR:
this->tombes[num].x = 100;
info::diners++;
info::ctx.diners++;
break;
case CONTE_FARAO:
this->tombes[num].x = 150;
@@ -261,9 +261,9 @@ void Mapa::comprovaCaixa(Uint8 num) {
break;
case CONTE_DIAMANT:
this->tombes[num].y = 70;
info::diamants++;
info::diners += VALOR_DIAMANT;
if (info::diamants == 16) this->farao = this->clau = true;
info::ctx.diamants++;
info::ctx.diners += VALOR_DIAMANT;
if (info::ctx.diamants == 16) this->farao = this->clau = true;
break;
}