diff --git a/main.cpp b/main.cpp index 5050f10..135dc8a 100644 --- a/main.cpp +++ b/main.cpp @@ -16,7 +16,7 @@ int main( int argc, char* args[] ) { - file_setresourcefilename("data.jrf"); + //file_setresourcefilename("data.jrf"); /*#ifdef WIN32 JF_SetResourceFile("data.jrf"); #else diff --git a/mapa.cpp b/mapa.cpp index 845ccbc..1f730cf 100644 --- a/mapa.cpp +++ b/mapa.cpp @@ -95,7 +95,7 @@ bool Mapa::novaMomia() { void Mapa::preparaFondoEstatic() { - // Prepara el fondo estàtic de l'habitació + // Prepara el fondo est�tic de l'habitaci� this->fondo = JD8_NewSurface(); if (info->num_piramide == 6) { JD8_BlitToSurface(9, 2, this->gfx, 227, 185, 92, 7, this->fondo); // Text "SECRETA" @@ -202,7 +202,7 @@ void Mapa::comprovaUltimCami() { Uint8 col_aux = abs( this->vertex.columna - this->ultim_vertex.columna ); Uint8 fil_aux = abs( this->vertex.fila - this->ultim_vertex.fila ); - if( col_aux > fil_aux ) { // Camí horitzontal + if( col_aux > fil_aux ) { // Cam� horitzontal Uint8 cami_fila = this->vertex.fila; Uint8 cami_columna = minim( this->vertex.columna, this->ultim_vertex.columna ); @@ -217,7 +217,7 @@ void Mapa::comprovaUltimCami() { this->tombes[caixa_amunt].costat[2] = true; this->comprovaCaixa( caixa_amunt ); } - } else { // Camí vertical + } else { // Cam� vertical Uint8 cami_columna = this->vertex.columna; Uint8 cami_fila = minim( this->vertex.fila, this->ultim_vertex.fila ); @@ -235,57 +235,52 @@ void Mapa::comprovaUltimCami() { } } -void Mapa::comprovaCaixa( Uint8 num ) { +void Mapa::comprovaCaixa( Uint8 num ) +{ + // Si la tomba ja està oberta, no hi ha res que mirar + if( this->tombes[num].oberta ) return; - if( !this->tombes[num].oberta ) { - this->tombes[num].oberta = true; - for( int i = 0; i < 4; i++ ) if( !this->tombes[num].costat[i] ) this->tombes[num].oberta = false; + // Si algun costat encara no està passat, no hi ha res que fer + for( int i = 0; i < 4; i++ ) if( !this->tombes[num].costat[i] ) return; - if( this->tombes[num].oberta ) { - int x = num % 4; - int y = num / 4; - switch( this->tombes[num].contingut ) { - case CONTE_RES: - //JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 50, 0, 50, 20, this->fondo, 255 ); - this->tombes[num].x = 50; - break; - case CONTE_TRESOR: - //JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 100, 0, 50, 20, this->fondo, 255 ); - this->tombes[num].x = 100; - info->diners++; - break; - case CONTE_FARAO: - //JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 150, 0, 50, 20, this->fondo, 255 ); - this->tombes[num].x = 150; - this->farao = true; - break; - case CONTE_CLAU: - //JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 200, 0, 50, 20, this->fondo, 255 ); - this->tombes[num].x = 200; - this->clau = true; - break; - case CONTE_MOMIA: - //JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 0, 175, 50, 20, this->fondo, 255 ); - this->tombes[num].y = 175; - this->nova_momia = true; - break; - case CONTE_PERGAMI: - //JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 250, 0, 50, 20, this->fondo, 255 ); - this->tombes[num].x = 250; - this->sam->pergami = true; - break; - case CONTE_DIAMANT: - //JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 270, 70, 50, 20, this->fondo, 255 ); - this->tombes[num].y = 70; - info->diamants++; - info->diners += VALOR_DIAMANT; - if (info->diamants == 16) this->farao = this->clau = true; - break; - } + // Sinó, pos la acabem d'obrir + this->tombes[num].oberta = true; - this->comprovaPorta(); - } + // Comprobem el premi del kinder sorpresa + switch( this->tombes[num].contingut ) + { + case CONTE_RES: + this->tombes[num].x = 50; + break; + case CONTE_TRESOR: + this->tombes[num].x = 100; + info->diners++; + break; + case CONTE_FARAO: + this->tombes[num].x = 150; + this->farao = true; + break; + case CONTE_CLAU: + this->tombes[num].x = 200; + this->clau = true; + break; + case CONTE_MOMIA: + this->tombes[num].y = 175; + this->nova_momia = true; + break; + case CONTE_PERGAMI: + this->tombes[num].x = 250; + this->sam->pergami = true; + break; + case CONTE_DIAMANT: + this->tombes[num].y = 70; + info->diamants++; + info->diners += VALOR_DIAMANT; + if (info->diamants == 16) this->farao = this->clau = true; + break; } + + this->comprovaPorta(); } void Mapa::comprovaPorta() {