- [NEW] Res, comentaris i reestructuració d'un cacho de codi
This commit is contained in:
2
main.cpp
2
main.cpp
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
int main( int argc, char* args[] ) {
|
int main( int argc, char* args[] ) {
|
||||||
|
|
||||||
file_setresourcefilename("data.jrf");
|
//file_setresourcefilename("data.jrf");
|
||||||
/*#ifdef WIN32
|
/*#ifdef WIN32
|
||||||
JF_SetResourceFile("data.jrf");
|
JF_SetResourceFile("data.jrf");
|
||||||
#else
|
#else
|
||||||
|
|||||||
33
mapa.cpp
33
mapa.cpp
@@ -95,7 +95,7 @@ bool Mapa::novaMomia() {
|
|||||||
|
|
||||||
void Mapa::preparaFondoEstatic() {
|
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();
|
this->fondo = JD8_NewSurface();
|
||||||
if (info->num_piramide == 6) {
|
if (info->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"
|
||||||
@@ -202,7 +202,7 @@ void Mapa::comprovaUltimCami() {
|
|||||||
Uint8 col_aux = abs( this->vertex.columna - this->ultim_vertex.columna );
|
Uint8 col_aux = abs( this->vertex.columna - this->ultim_vertex.columna );
|
||||||
Uint8 fil_aux = abs( this->vertex.fila - this->ultim_vertex.fila );
|
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_fila = this->vertex.fila;
|
||||||
Uint8 cami_columna = minim( this->vertex.columna, this->ultim_vertex.columna );
|
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->tombes[caixa_amunt].costat[2] = true;
|
||||||
this->comprovaCaixa( caixa_amunt );
|
this->comprovaCaixa( caixa_amunt );
|
||||||
}
|
}
|
||||||
} else { // Cam<61> vertical
|
} else { // Cam<61> vertical
|
||||||
Uint8 cami_columna = this->vertex.columna;
|
Uint8 cami_columna = this->vertex.columna;
|
||||||
Uint8 cami_fila = minim( this->vertex.fila, this->ultim_vertex.fila );
|
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;
|
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 ) {
|
// Comprobem el premi del kinder sorpresa
|
||||||
int x = num % 4;
|
switch( this->tombes[num].contingut )
|
||||||
int y = num / 4;
|
{
|
||||||
switch( this->tombes[num].contingut ) {
|
|
||||||
case CONTE_RES:
|
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;
|
this->tombes[num].x = 50;
|
||||||
break;
|
break;
|
||||||
case CONTE_TRESOR:
|
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;
|
this->tombes[num].x = 100;
|
||||||
info->diners++;
|
info->diners++;
|
||||||
break;
|
break;
|
||||||
case CONTE_FARAO:
|
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->tombes[num].x = 150;
|
||||||
this->farao = true;
|
this->farao = true;
|
||||||
break;
|
break;
|
||||||
case CONTE_CLAU:
|
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->tombes[num].x = 200;
|
||||||
this->clau = true;
|
this->clau = true;
|
||||||
break;
|
break;
|
||||||
case CONTE_MOMIA:
|
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->tombes[num].y = 175;
|
||||||
this->nova_momia = true;
|
this->nova_momia = true;
|
||||||
break;
|
break;
|
||||||
case CONTE_PERGAMI:
|
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->tombes[num].x = 250;
|
||||||
this->sam->pergami = true;
|
this->sam->pergami = true;
|
||||||
break;
|
break;
|
||||||
case CONTE_DIAMANT:
|
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;
|
this->tombes[num].y = 70;
|
||||||
info->diamants++;
|
info->diamants++;
|
||||||
info->diners += VALOR_DIAMANT;
|
info->diners += VALOR_DIAMANT;
|
||||||
@@ -285,8 +282,6 @@ void Mapa::comprovaCaixa( Uint8 num ) {
|
|||||||
|
|
||||||
this->comprovaPorta();
|
this->comprovaPorta();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapa::comprovaPorta() {
|
void Mapa::comprovaPorta() {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user