- un commit d'eixos

This commit is contained in:
2024-01-29 13:21:46 +01:00
parent 3832fdf5e4
commit eb4910b3e3

View File

@@ -562,6 +562,7 @@ var aux : boolean; intents : word;
void save_records() void save_records()
{ {
// [RZC 24/01/2024] [TODO] Llevar tota esta monserga i que guarde en un arxiu normal (i en el futur en JailScore) // [RZC 24/01/2024] [TODO] Llevar tota esta monserga i que guarde en un arxiu normal (i en el futur en JailScore)
/*
FILE *fich = fopen("datos/story.dat", "w"); FILE *fich = fopen("datos/story.dat", "w");
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
{ {
@@ -591,13 +592,14 @@ var aux : boolean; intents : word;
fputc(mode_hard_r, fich); fputc(mode_hard_r, fich);
fputc(mode_dream_tour, fich); fputc(mode_dream_tour, fich);
fclose(fich); fclose(fich);
*/
} }
/*──────────────────────────────────────────────────────────────────────────*/ /*──────────────────────────────────────────────────────────────────────────*/
void pinta(uint16_t offset, uint8_t color, uint16_t x, uint16_t y, draw::surface *where) // offset es on comença el dibuixet en el "bitmap" de sprites, where la surface void pinta(uint16_t offset, uint8_t color, uint16_t x, uint16_t y, draw::surface *where) // offset es on comença el dibuixet en el "bitmap" de sprites, where la surface
{ {
// [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve // [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve
// inc(x); inc(y); x++; y++;
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
for (int j = 0; j < 6; ++j) for (int j = 0; j < 6; ++j)
if (color != 255) if (color != 255)
@@ -611,7 +613,7 @@ var aux : boolean; intents : word;
void pinta_zoom(uint8_t zoom, uint16_t offset, uint8_t color, uint16_t x, uint16_t y, draw::surface *where) void pinta_zoom(uint8_t zoom, uint16_t offset, uint8_t color, uint16_t x, uint16_t y, draw::surface *where)
{ {
// [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve // [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve
// inc(x); inc(y); x++; y++;
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
for (int j = 0; j < 6; ++j) for (int j = 0; j < 6; ++j)
if (color != 255) if (color != 255)
@@ -625,7 +627,7 @@ void pinta_zoom(uint8_t zoom, uint16_t offset, uint8_t color, uint16_t x, uint1
void pinta_number(uint16_t offset, uint8_t color, uint16_t x, uint16_t y, draw::surface *where) void pinta_number(uint16_t offset, uint8_t color, uint16_t x, uint16_t y, draw::surface *where)
{ {
// [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve // [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve
// inc(x); inc(y); x++; y++;
for (int i = 0; i < 9; ++i) for (int i = 0; i < 9; ++i)
for (int j = 0; j < 9; ++j) for (int j = 0; j < 9; ++j)
if (color != 255) if (color != 255)
@@ -638,7 +640,7 @@ void pinta_number(uint16_t offset, uint8_t color, uint16_t x, uint16_t y, draw::
void pinta_number2(uint16_t offset, uint8_t color, uint8_t color_determinat, uint16_t x, uint16_t y, draw::surface *where) void pinta_number2(uint16_t offset, uint8_t color, uint8_t color_determinat, uint16_t x, uint16_t y, draw::surface *where)
{ {
// [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve // [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve
// inc(x); inc(y); x++; y++;
for (int i = 0; i < 9; ++i) for (int i = 0; i < 9; ++i)
for (int j = 0; j < 9; ++j) for (int j = 0; j < 9; ++j)
if (color != 255) if (color != 255)
@@ -653,7 +655,7 @@ void pinta_number2(uint16_t offset, uint8_t color, uint8_t color_determinat, uin
void pinta_number_zoom(uint8_t zoom, uint16_t offset, uint8_t color, uint16_t x, uint16_t y, draw::surface *where) void pinta_number_zoom(uint8_t zoom, uint16_t offset, uint8_t color, uint16_t x, uint16_t y, draw::surface *where)
{ {
// [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve // [RZC 24/01/0224] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve
// inc(x); inc(y); x++; y++;
for (int i = 0; i < 9 * zoom; ++i) for (int i = 0; i < 9 * zoom; ++i)
for (int j = 0; j < 9 * zoom; ++j) for (int j = 0; j < 9 * zoom; ++j)
if (color != 255) if (color != 255)
@@ -1253,16 +1255,18 @@ void titol_del_joc()
{ {
if ( !audio::musicPlaying() && midi ) audio::playMusic(); if ( !audio::musicPlaying() && midi ) audio::playMusic();
int j = 0; int j = 0;
while ( j<100 ) while ( j<100 && !salta_intro )
{ {
if (input::anyKey()) salta_intro = true;
draw::waitVsync(); draw::waitVsync();
j++; j++;
} }
draw::waitVsync(); draw::waitVsync();
draw::draw(vaddr2, VGA); draw::draw(vaddr2, VGA);
j = 0; j = 0;
while ( j<100 ) while ( j<100 && !salta_intro )
{ {
if (input::anyKey()) salta_intro = true;
draw::waitVsync(); draw::waitVsync();
j++; j++;
} }
@@ -1921,7 +1925,7 @@ var i,j : word;
vaddrFase : Word; vaddrFase : Word;
*/ */
{ {
draw::surface *vaddrFase = draw::createSurface(320, 20); //(uint8_t*)malloc(6400); // 6400??? draw::surface *vaddrFase = draw::createSurface(160, 40); //(uint8_t*)malloc(6400); // 6400???
load_mif(FASES,vaddr); load_mif(FASES,vaddr);
draw::cls(0, vaddrFase); draw::cls(0, vaddrFase);
@@ -1946,7 +1950,7 @@ var i,j : word;
// pinta les pareds // pinta les pareds
for (int i=0; i<38; ++i) for (int i=0; i<38; ++i)
for (int j=0; j<29; ++j) for (int j=0; j<29; ++j)
if (pantalla[i][j]==es_una_paret) pinta(dib_pared, 255, (i*6)+4, (j+1)*6, vaddr2); if (pantalla[i][j]==es_una_paret) pinta(dib_pared, 255, ((i+1)*6)+4, (j+2)*6, vaddr2);
// pinta a Rosita i a la presó // pinta a Rosita i a la presó
if (num_fase==ultima_fase) if (num_fase==ultima_fase)
@@ -2060,7 +2064,7 @@ void volcat_de_pantalla()
fletxa_final_fase = true; fletxa_final_fase = true;
for (int i=0; i<38; ++i) for (int i=0; i<38; ++i)
for (int j=0; j<29; ++j) for (int j=0; j<29; ++j)
if (pantalla[i,j] == es_un_bloc_per_pintar) fletxa_final_fase = false; if (pantalla[i][j] == es_un_bloc_per_pintar) fletxa_final_fase = false;
// pinta el rellontge // pinta el rellontge
@@ -2182,7 +2186,7 @@ void omplir_pot()
if (!final_fase) if (!final_fase)
{ {
pinta(pepe, color_pintura, x, y, vaddr); pinta(pepe, color_pintura, x, y, vaddr);
pantalla[x/6][(y/6)-1] = es_un_bloc_pintat; pantalla[(x/6)-1][(y/6)-2] = es_un_bloc_pintat;
x = pos_ini_x_pepe; x = pos_ini_x_pepe;
y = pos_ini_y_pepe; y = pos_ini_y_pepe;
if (mode_nocturne) if (mode_nocturne)
@@ -2222,7 +2226,7 @@ void pinta_un_bloc(uint8_t color, uint8_t queda_pintura)
//if amb_so then so_de(pot_ple); //if amb_so then so_de(pot_ple);
if (!rosita_selected) pintura--; if (!rosita_selected) pintura--;
pinta(pepe, color, x, y, vaddr); pinta(pepe, color, x, y, vaddr);
pantalla[x/6][(y/6)-1] = es_un_bloc_pintat; pantalla[(x/6)-1][(y/6)-2] = es_un_bloc_pintat;
if (el_que_hi_havia == es_un_bloc_per_pintar) if (el_que_hi_havia == es_un_bloc_per_pintar)
{ {
blocs_per_pintar--; blocs_per_pintar--;
@@ -2252,13 +2256,13 @@ void pinta_un_bloc(uint8_t color, uint8_t queda_pintura)
{ {
// if amb_so then so_de(pot_buit); // if amb_so then so_de(pot_buit);
pinta(pepe, color, x, y, vaddr); pinta(pepe, color, x, y, vaddr);
pantalla[x/6][(y/6)-1] = es_un_bloc_pintat; pantalla[(x/6)-1][(y/6)-2] = es_un_bloc_pintat;
} }
else else
if (el_que_hi_havia == es_un_bloc_per_pintar) if (el_que_hi_havia == es_un_bloc_per_pintar)
{ {
//if amb_so then so_de(pot_buit); //if amb_so then so_de(pot_buit);
pantalla[x/6][(y/6)-1] = es_un_bloc_per_pintar; pantalla[(x/6)-1][(y/6)-2] = es_un_bloc_per_pintar;
} }
antiga_direccio = cap_on_va_Pepe; antiga_direccio = cap_on_va_Pepe;
} }
@@ -2297,7 +2301,7 @@ void animacio_alegria()
{ {
if (mode_nocturne && !rosita_selected && !amic_selected) if (mode_nocturne && !rosita_selected && !amic_selected)
{ {
que_hi_ha = pantalla[(x-max_m_x) / 6][((y-max_m_y) / 6)-1]; que_hi_ha = pantalla[((x-max_m_x) / 6)-1][((y-max_m_y) / 6)-2];
if (que_hi_ha == es_un_bloc_pintat) if (que_hi_ha == es_un_bloc_pintat)
pinta(gorro, color_pintura, x-6, y-6, VGA); pinta(gorro, color_pintura, x-6, y-6, VGA);
else else
@@ -2355,7 +2359,7 @@ void mort()
//so_de(mos_a_pepe); //so_de(mos_a_pepe);
//Play_WAV(sample[so_mort]); //Play_WAV(sample[so_mort]);
animacio_mort(); animacio_mort();
pantalla[x/6][(y/6)-1] = el_que_hi_havia; //es_un_bloc_pintat pantalla[(x/6)-1][(y/6)-2] = el_que_hi_havia; //es_un_bloc_pintat
x = pos_ini_x_pepe; x = pos_ini_x_pepe;
y = pos_ini_y_pepe; y = pos_ini_y_pepe;
en_casa = true; en_casa = true;
@@ -2376,10 +2380,10 @@ void mira_el_que_hi_ha(uint8_t cap_on_vaig)
el_que_hi_havia = que_hi_ha; el_que_hi_havia = que_hi_ha;
switch (cap_on_vaig) switch (cap_on_vaig)
{ {
case amunt: que_hi_ha = pantalla[x/6][((y-max_m_y)/6)-1]; break; case amunt: que_hi_ha = pantalla[(x/6)-1][((y-max_m_y)/6)-2]; break;
case dreta: que_hi_ha = pantalla[(x+max_m_x)/6][(y/6)-1]; break; case dreta: que_hi_ha = pantalla[((x+max_m_x)/6)-1][(y/6)-2]; break;
case avall: que_hi_ha = pantalla[x/6][((y+max_m_y)/6)-1]; break; case avall: que_hi_ha = pantalla[(x/6)-1][((y+max_m_y)/6)-2]; break;
case esquerra: que_hi_ha = pantalla[(x-max_m_x)/6][(y/6)-1]; break; case esquerra: que_hi_ha = pantalla[((x-max_m_x)/6)-1][(y/6)-2]; break;
} }
} }
@@ -2427,7 +2431,7 @@ void moure(uint8_t direccio)
switch (direccio) switch (direccio)
{ {
case amunt: case amunt:
if ( ((y-max_m_y)>=l0) && (!en_casa) && (!(pantalla[x/6][((y-max_m_y) / 6)-1] == es_una_paret)) ) if ( ((y-max_m_y)>=l0) && (!en_casa) && (!(pantalla[(x/6)-1][((y-max_m_y) / 6)-2] == es_una_paret)) )
{ {
mira_el_que_hi_ha(direccio); mira_el_que_hi_ha(direccio);
if (que_hi_ha == es_un_bicho) if (que_hi_ha == es_un_bicho)
@@ -2440,12 +2444,12 @@ void moure(uint8_t direccio)
// if not(amb_so) then *//*retard(velocitat_joc); // if not(amb_so) then *//*retard(velocitat_joc);
retard_pepe = velocitat_pepe; retard_pepe = velocitat_pepe;
menejant = true; menejant = true;
pantalla[x/6][(y/6)-1] = es_pepe; pantalla[(x/6)-1][(y/6)-2] = es_pepe;
} }
} }
break; break;
case dreta: case dreta:
if (!en_casa && !(pantalla[(x+max_m_x)/6][(y/6)-1] == es_una_paret)) if (!en_casa && !(pantalla[((x+max_m_x)/6)-1][(y/6)-2] == es_una_paret))
if ( (x+max_m_x) <= l1 ) if ( (x+max_m_x) <= l1 )
{ {
mira_el_que_hi_ha(direccio); mira_el_que_hi_ha(direccio);
@@ -2458,17 +2462,17 @@ void moure(uint8_t direccio)
//if not(amb_so) then retard(velocitat_joc); //if not(amb_so) then retard(velocitat_joc);
retard_pepe = velocitat_pepe; retard_pepe = velocitat_pepe;
menejant = true; menejant = true;
pantalla[x/6][(y/6)-1] = es_pepe; pantalla[(x/6)-1][(y/6)-2] = es_pepe;
} }
} }
else else
if ( (x==232) && (y==96) ) omplir_pot(); if ( (x==232) && (y==96) ) omplir_pot();
break; break;
case avall: case avall:
if ( ((y+max_m_y) <= l2) && !en_casa && !(pantalla[x/6][((y+max_m_y)/6)-1] == es_una_paret) ) if ( ((y+max_m_y) <= l2) && !en_casa && !(pantalla[(x/6)-1][((y+max_m_y)/6)-2] == es_una_paret) )
{ {
mira_el_que_hi_ha(direccio); mira_el_que_hi_ha(direccio);
if (que_hi_ha = es_un_bicho) if (que_hi_ha == es_un_bicho)
mort(); mort();
else else
{ {
@@ -2477,12 +2481,12 @@ void moure(uint8_t direccio)
//if not(amb_so) then retard(velocitat_joc); //if not(amb_so) then retard(velocitat_joc);
retard_pepe = velocitat_pepe; retard_pepe = velocitat_pepe;
menejant = true; menejant = true;
pantalla[x/6][(y/6)-1] = es_pepe; pantalla[(x/6)-1][(y/6)-2] = es_pepe;
} }
} }
break; break;
case esquerra: case esquerra:
if ( ((x-max_m_x) >= l3) && !(pantalla[(x-max_m_x)/6][(y/6)-1] == es_una_paret) ) if ( ((x-max_m_x) >= l3) && !(pantalla[((x-max_m_x)/6)-1][(y/6)-2] == es_una_paret) )
{ {
mira_el_que_hi_ha(direccio); mira_el_que_hi_ha(direccio);
if (en_casa && (que_hi_ha == es_un_bicho)) ja_no_pots_eixir(); if (en_casa && (que_hi_ha == es_un_bicho)) ja_no_pots_eixir();
@@ -2494,7 +2498,7 @@ void moure(uint8_t direccio)
x = x - max_m_x; x = x - max_m_x;
retard_pepe = velocitat_pepe; retard_pepe = velocitat_pepe;
menejant = true; menejant = true;
pantalla[x/6][(y/6)-1] = es_pepe; pantalla[(x/6)-1][(y/6)-2] = es_pepe;
} }
en_casa = false; en_casa = false;
} }
@@ -2823,7 +2827,9 @@ void story_mode()
if (input::keyPressed(SDL_SCANCODE_M)) if (input::keyPressed(SDL_SCANCODE_M))
{ {
map = !map; //map = !map;
final_fase=true;
num_fase=9;
do {} while (input::keyPressed(SDL_SCANCODE_M)); do {} while (input::keyPressed(SDL_SCANCODE_M));
} }