- Jo que se, arreglaos per ací i per allà

This commit is contained in:
2025-02-07 14:06:22 +01:00
parent eb4910b3e3
commit cbe7d36299
2 changed files with 37 additions and 48 deletions

View File

@@ -228,9 +228,9 @@ namespace draw
for (int j=0; j<256; ++j) for (int j=0; j<256; ++j)
{ {
getColor(j, &rr, &gg, &bb); getColor(j, &rr, &gg, &bb);
if (rr>r) { rr--; done = false; } if (rr>r+4) { rr-=4; done = false; }
if (gg>g) { gg--; done = false; } if (gg>g+4) { gg-=4; done = false; }
if (bb>b) { bb--; done = false; } if (bb>b+4) { bb-=4; done = false; }
setColor(j, rr, gg, bb); setColor(j, rr, gg, bb);
} }
render(); render();
@@ -248,9 +248,9 @@ namespace draw
for (int j=0; j<256; ++j) for (int j=0; j<256; ++j)
{ {
getColor(j, &r, &g, &b); getColor(j, &r, &g, &b);
if (paleta[j*3]>r) { r++; done = false; } if (paleta[j*3]>r+4) { r+=4; done = false; } else { r=paleta[j*3]; }
if (paleta[j*3+1]>g) { g++; done = false; } if (paleta[j*3+1]>g+4) { g+=4; done = false; } else { g=paleta[j*3+1]; }
if (paleta[j*3+2]>b) { b++; done = false; } if (paleta[j*3+2]>b+4) { b+=4; done = false; } else { b=paleta[j*3+2]; }
setColor(j, r, g, b); setColor(j, r, g, b);
} }
render(); render();

View File

@@ -5,7 +5,7 @@
Versió 1.70 Build 3 Març 2000 (Windows2000) Versió 1.70 Build 3 Març 2000 (Windows2000)
Port a C/Windows per Raimon Zamora Chanzà (Gener 2024) Port a C per Raimon Zamora Chanzà (Gener 2024)
──────────────────────────────────────────────────────────────────────────*/ ──────────────────────────────────────────────────────────────────────────*/
#include "grafix.h" #include "grafix.h"
@@ -13,6 +13,7 @@
#include "jinput.h" #include "jinput.h"
//#include "pepe_vell.h" //#include "pepe_vell.h"
#include "midiplay.h" #include "midiplay.h"
#include <string.h>
// const // const
@@ -598,7 +599,7 @@ var aux : boolean; intents : word;
/*──────────────────────────────────────────────────────────────────────────*/ /*──────────────────────────────────────────────────────────────────────────*/
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/2024] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve
x++; 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)
@@ -608,25 +609,12 @@ var aux : boolean; intents : word;
draw::putPixel(x+i, y+j, vaddrSP->pixels[offset + i + (j * 320)], where); draw::putPixel(x+i, y+j, vaddrSP->pixels[offset + i + (j * 320)], where);
} }
/*──────────────────────────────────────────────────────────────────────────*/
// [RZC 24/01/0224] [NOTA] Esta funció i l'anterior son exactament iguals!
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
x++; y++;
for (int i = 0; i < 6; ++i)
for (int j = 0; j < 6; ++j)
if (color != 255)
draw::putPixel(x+i, y+j, color, where);
else if (vaddrSP->pixels[offset + i + (j * 320)] != 255)
draw::putPixel(x+i, y+j, vaddrSP->pixels[offset + i + (j * 320)], where);
}
/*──────────────────────────────────────────────────────────────────────────*/ /*──────────────────────────────────────────────────────────────────────────*/
// [RZC 24/01/0224] [NOTA] Esta es igual pero els bucles van de 0 a 8 en compte de de 0 a 5 // [RZC 24/01/2024] [NOTA] Esta es igual pero els bucles van de 0 a 8 en compte de de 0 a 5
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/2024] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve
x++; 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)
@@ -639,7 +627,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/2024] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve
x++; 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)
@@ -654,7 +642,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/2024] [NOTA] No entenc perqué s'incrementa 1 a les coordenades on anem a pintar. Per ara ho lleve
x++; 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)
@@ -669,7 +657,7 @@ void retard(int centesimes)
{ {
uint32_t t = SDL_GetTicks() + centesimes * 10; uint32_t t = SDL_GetTicks() + centesimes * 10;
while ((SDL_GetTicks() < t) && (!input::keyPressed(SDL_SCANCODE_SPACE))) {}; while ((SDL_GetTicks() < t) && (!input::keyPressed(SDL_SCANCODE_SPACE))) {};
// [RZC 24/01/0224] [NOTA] Açò del midi estaba dins del bucle este anterior. Crec que és perque necessita anar omplint el buffer // [RZC 24/01/2024] [NOTA] Açò del midi estaba dins del bucle este anterior. Crec que és perque necessita anar omplint el buffer
// if (not(audio::musicPlaying())) and (midi) then audio::playMusic; // if (not(audio::musicPlaying())) and (midi) then audio::playMusic;
} }
@@ -1942,7 +1930,8 @@ var i,j : word;
else else
load_mif(path[14], vaddr2); load_mif(path[14], vaddr2);
if ((num_fase==ultima_fase) && !mode_nocturne) load_mif(path[12], vaddr2); if ((num_fase==ultima_fase) && !mode_nocturne)
load_mif(path[12], vaddr2);
// pinta numero de fase // pinta numero de fase
if ( (num_fase>0) && (num_fase<10) ) pinta_number(numero_G[num_fase], 255, 1, 1, vaddr2); if ( (num_fase>0) && (num_fase<10) ) pinta_number(numero_G[num_fase], 255, 1, 1, vaddr2);
@@ -2516,7 +2505,7 @@ void ini_rellontge()
a = (rand()%38); a = (rand()%38);
b = (rand()%29); b = (rand()%29);
} while (pantalla[a][b] == es_una_paret); } while (pantalla[a][b] == es_una_paret);
a++; b++;
rellontge.i = (a*6)+4; rellontge.i = (a*6)+4;
rellontge.j = (b+1)*6; rellontge.j = (b+1)*6;
rellontge.viu = true; rellontge.viu = true;
@@ -2547,7 +2536,7 @@ void naix_malo(uint8_t numero)
malo[numero].j = b; malo[numero].j = b;
//so_de(naiximent_del_malo); //so_de(naiximent_del_malo);
//Play_WAV(sample[so_malo]); //Play_WAV(sample[so_malo]);
pinta(malo[numero].dibuix, 255, (malo[numero].i*6)+4, (malo[numero].j+1)*6, vaddr); pinta(malo[numero].dibuix, 255, ((malo[numero].i+1)*6)+4, (malo[numero].j+2)*6, vaddr);
} }
/*──────────────────────────────────────────────────────────────────────────*/ /*──────────────────────────────────────────────────────────────────────────*/
@@ -2558,10 +2547,10 @@ void mou_malo(uint8_t numero, uint8_t direccio)
case amunt: case amunt:
if ( (pantalla[malo[numero].i][malo[numero].j-1] == es_un_bloc_pintat) && (!(pantalla[malo[numero].i][malo[numero].j-1] == es_un_bicho)) ) if ( (pantalla[malo[numero].i][malo[numero].j-1] == es_un_bloc_pintat) && (!(pantalla[malo[numero].i][malo[numero].j-1] == es_un_bicho)) )
{ {
pinta(malo[numero].dibuix, color_pintura, (malo[numero].i*6)+4, (malo[numero].j+1)*6, vaddr); pinta(malo[numero].dibuix, color_pintura, ((malo[numero].i+1)*6)+4, (malo[numero].j+2)*6, vaddr);
pantalla[malo[numero].i][malo[numero].j] = es_un_bloc_pintat; pantalla[malo[numero].i][malo[numero].j] = es_un_bloc_pintat;
malo[numero].j--; malo[numero].j--;
pinta(malo[numero].dibuix, 255, (malo[numero].i*6)+4, (malo[numero].j+1)*6, vaddr); pinta(malo[numero].dibuix, 255, ((malo[numero].i+1)*6)+4, (malo[numero].j+2)*6, vaddr);
pantalla[malo[numero].i][malo[numero].j] = es_un_bicho; pantalla[malo[numero].i][malo[numero].j] = es_un_bicho;
} }
else else
@@ -2575,10 +2564,10 @@ void mou_malo(uint8_t numero, uint8_t direccio)
case avall: case avall:
if ( (pantalla[malo[numero].i][malo[numero].j+1] == es_un_bloc_pintat) && (!(pantalla[malo[numero].i][malo[numero].j+1] == es_un_bicho)) ) if ( (pantalla[malo[numero].i][malo[numero].j+1] == es_un_bloc_pintat) && (!(pantalla[malo[numero].i][malo[numero].j+1] == es_un_bicho)) )
{ {
pinta(malo[numero].dibuix, color_pintura, (malo[numero].i*6)+4, (malo[numero].j+1)*6, vaddr); pinta(malo[numero].dibuix, color_pintura, ((malo[numero].i+1)*6)+4, (malo[numero].j+2)*6, vaddr);
pantalla[malo[numero].i][malo[numero].j] = es_un_bloc_pintat; pantalla[malo[numero].i][malo[numero].j] = es_un_bloc_pintat;
malo[numero].j++; malo[numero].j++;
pinta(malo[numero].dibuix, 255, (malo[numero].i*6)+4, (malo[numero].j+1)*6, vaddr); pinta(malo[numero].dibuix, 255, ((malo[numero].i+1)*6)+4, (malo[numero].j+2)*6, vaddr);
pantalla[malo[numero].i][malo[numero].j] = es_un_bicho; pantalla[malo[numero].i][malo[numero].j] = es_un_bicho;
} }
else else
@@ -2592,10 +2581,10 @@ void mou_malo(uint8_t numero, uint8_t direccio)
case dreta: case dreta:
if ( (pantalla[malo[numero].i+1][malo[numero].j] == es_un_bloc_pintat) && (!(pantalla[malo[numero].i+1][malo[numero].j] == es_un_bicho)) && (!((malo[numero].i+1) == 39)) ) if ( (pantalla[malo[numero].i+1][malo[numero].j] == es_un_bloc_pintat) && (!(pantalla[malo[numero].i+1][malo[numero].j] == es_un_bicho)) && (!((malo[numero].i+1) == 39)) )
{ {
pinta(malo[numero].dibuix, color_pintura, (malo[numero].i*6)+4, (malo[numero].j+1)*6, vaddr); pinta(malo[numero].dibuix, color_pintura, ((malo[numero].i+1)*6)+4, (malo[numero].j+2)*6, vaddr);
pantalla[malo[numero].i][malo[numero].j] = es_un_bloc_pintat; pantalla[malo[numero].i][malo[numero].j] = es_un_bloc_pintat;
malo[numero].i++; malo[numero].i++;
pinta(malo[numero].dibuix,255, (malo[numero].i*6)+4, (malo[numero].j+1)*6, vaddr); pinta(malo[numero].dibuix, 255, ((malo[numero].i+1)*6)+4, (malo[numero].j+2)*6, vaddr);
pantalla[malo[numero].i][malo[numero].j] = es_un_bicho; pantalla[malo[numero].i][malo[numero].j] = es_un_bicho;
} }
else else
@@ -2614,10 +2603,10 @@ void mou_malo(uint8_t numero, uint8_t direccio)
case esquerra: case esquerra:
if ( (pantalla[malo[numero].i-1][malo[numero].j] == es_un_bloc_pintat) && (!(pantalla[malo[numero].i-1][malo[numero].j] == es_un_bicho)) ) if ( (pantalla[malo[numero].i-1][malo[numero].j] == es_un_bloc_pintat) && (!(pantalla[malo[numero].i-1][malo[numero].j] == es_un_bicho)) )
{ {
pinta(malo[numero].dibuix, color_pintura, (malo[numero].i*6)+4, (malo[numero].j+1)*6, vaddr); pinta(malo[numero].dibuix, color_pintura, ((malo[numero].i+1)*6)+4, (malo[numero].j+2)*6, vaddr);
pantalla[malo[numero].i][malo[numero].j] = es_un_bloc_pintat; pantalla[malo[numero].i][malo[numero].j] = es_un_bloc_pintat;
malo[numero].i--; malo[numero].i--;
pinta(malo[numero].dibuix, 255, (malo[numero].i*6)+4, (malo[numero].j+1)*6, vaddr); pinta(malo[numero].dibuix, 255, ((malo[numero].i+1)*6)+4, (malo[numero].j+2)*6, vaddr);
pantalla[malo[numero].i][malo[numero].j] = es_un_bicho; pantalla[malo[numero].i][malo[numero].j] = es_un_bicho;
} }
else else
@@ -2640,13 +2629,13 @@ void moure_malos()
switch (malo[i].sentit) switch (malo[i].sentit)
{ {
case horitzontalment: case horitzontalment:
if ( ((malo[i].i*6)+4)>x ) if ( (((malo[i].i+1)*6)+4)>x )
{ {
mou_malo(i, esquerra); mou_malo(i, esquerra);
malo[i].sentit = rand()%(2+dificultat); malo[i].sentit = rand()%(2+dificultat);
} }
else else
if ( ((malo[i].i*6)+4)<x ) if ( (((malo[i].i+1)*6)+4)<x )
{ {
mou_malo(i, dreta); mou_malo(i, dreta);
malo[i].sentit = rand()%(2+dificultat); malo[i].sentit = rand()%(2+dificultat);
@@ -2656,13 +2645,13 @@ void moure_malos()
break; break;
case verticalment: case verticalment:
if ( ((malo[i].j+1)*6)>y ) if ( ((malo[i].j+2)*6)>y )
{ {
mou_malo(i, amunt); mou_malo(i, amunt);
malo[i].sentit = rand()%(2+dificultat); malo[i].sentit = rand()%(2+dificultat);
} }
else else
if ( ((malo[i].j+1)*6)<y ) if ( ((malo[i].j+2)*6)<y )
{ {
mou_malo(i, avall); mou_malo(i, avall);
malo[i].sentit = rand()%(2+dificultat); malo[i].sentit = rand()%(2+dificultat);
@@ -2776,7 +2765,7 @@ void story_mode()
ini_vars(num_fase); ini_vars(num_fase);
const char *musica_fase = num_fase==10 ? musica_fase10 : ( num_fase%2==0 ? musica_fase02 : musica_fase01 ); const char *musica_fase = num_fase==10 ? musica_fase10 : ( num_fase%2==0 ? musica_fase02 : musica_fase01 );
if (num_fase = 1) punts = 0; if (num_fase == 1) punts = 0;
// if not(mode_nocturne) then pantalla_presentacio(num_fase); // if not(mode_nocturne) then pantalla_presentacio(num_fase);
ini_pantalla(); ini_pantalla();
eixir = false; eixir = false;
@@ -2834,13 +2823,13 @@ void story_mode()
} }
/*---------*/ /*---------*/
/* if input::keyPressed(KeyN) then if (input::keyPressed(SDL_SCANCODE_N))
begin {
final_fase:=true; final_fase = true;
num_fase:=9; num_fase = 9;
end; }
if input::keyPressed(KeyB) then final_fase:=true;*/ if (input::keyPressed(SDL_SCANCODE_B)) final_fase = true;
/*---------*/ /*---------*/
if (input::keyPressed(SDL_SCANCODE_1)) if (input::keyPressed(SDL_SCANCODE_1))