- [NEW] Res, comentaris i reestructuració d'un cacho de codi

This commit is contained in:
2025-07-02 13:14:19 +02:00
parent a95c9bd65c
commit d7c965ff0b
2 changed files with 46 additions and 51 deletions

View File

@@ -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

View File

@@ -95,7 +95,7 @@ bool Mapa::novaMomia() {
void Mapa::preparaFondoEstatic() {
// Prepara el fondo est<73>tic de l'habitaci<63>
// Prepara el fondo est<73>tic de l'habitaci<63>
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<61> horitzontal
if( col_aux > fil_aux ) { // Cam<61> 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<61> vertical
} else { // Cam<61> vertical
Uint8 cami_columna = this->vertex.columna;
Uint8 cami_fila = minim( this->vertex.fila, this->ultim_vertex.fila );
@@ -235,47 +235,44 @@ 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 ) {
// 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;
// Sinó, pos la acabem d'obrir
this->tombes[num].oberta = true;
for( int i = 0; i < 4; i++ ) if( !this->tombes[num].costat[i] ) this->tombes[num].oberta = false;
if( this->tombes[num].oberta ) {
int x = num % 4;
int y = num / 4;
switch( this->tombes[num].contingut ) {
// Comprobem el premi del kinder sorpresa
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;
@@ -285,8 +282,6 @@ void Mapa::comprovaCaixa( Uint8 num ) {
this->comprovaPorta();
}
}
}
void Mapa::comprovaPorta() {