- Jo que se, arreglaos per ací i per allà
This commit is contained in:
12
grafix.cpp
12
grafix.cpp
@@ -228,9 +228,9 @@ namespace draw
|
||||
for (int j=0; j<256; ++j)
|
||||
{
|
||||
getColor(j, &rr, &gg, &bb);
|
||||
if (rr>r) { rr--; done = false; }
|
||||
if (gg>g) { gg--; done = false; }
|
||||
if (bb>b) { bb--; done = false; }
|
||||
if (rr>r+4) { rr-=4; done = false; }
|
||||
if (gg>g+4) { gg-=4; done = false; }
|
||||
if (bb>b+4) { bb-=4; done = false; }
|
||||
setColor(j, rr, gg, bb);
|
||||
}
|
||||
render();
|
||||
@@ -248,9 +248,9 @@ namespace draw
|
||||
for (int j=0; j<256; ++j)
|
||||
{
|
||||
getColor(j, &r, &g, &b);
|
||||
if (paleta[j*3]>r) { r++; done = false; }
|
||||
if (paleta[j*3+1]>g) { g++; done = false; }
|
||||
if (paleta[j*3+2]>b) { b++; done = false; }
|
||||
if (paleta[j*3]>r+4) { r+=4; done = false; } else { r=paleta[j*3]; }
|
||||
if (paleta[j*3+1]>g+4) { g+=4; done = false; } else { g=paleta[j*3+1]; }
|
||||
if (paleta[j*3+2]>b+4) { b+=4; done = false; } else { b=paleta[j*3+2]; }
|
||||
setColor(j, r, g, b);
|
||||
}
|
||||
render();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
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"
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "jinput.h"
|
||||
//#include "pepe_vell.h"
|
||||
#include "midiplay.h"
|
||||
#include <string.h>
|
||||
|
||||
// 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
|
||||
{
|
||||
// [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++;
|
||||
for (int i = 0; i < 6; ++i)
|
||||
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);
|
||||
}
|
||||
|
||||
/*──────────────────────────────────────────────────────────────────────────*/
|
||||
// [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)
|
||||
{
|
||||
// [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++;
|
||||
for (int i = 0; i < 9; ++i)
|
||||
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)
|
||||
{
|
||||
// [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++;
|
||||
for (int i = 0; i < 9; ++i)
|
||||
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)
|
||||
{
|
||||
// [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++;
|
||||
for (int i = 0; i < 9 * zoom; ++i)
|
||||
for (int j = 0; j < 9 * zoom; ++j)
|
||||
@@ -669,7 +657,7 @@ void retard(int centesimes)
|
||||
{
|
||||
uint32_t t = SDL_GetTicks() + centesimes * 10;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1942,7 +1930,8 @@ var i,j : word;
|
||||
else
|
||||
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
|
||||
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);
|
||||
b = (rand()%29);
|
||||
} while (pantalla[a][b] == es_una_paret);
|
||||
|
||||
a++; b++;
|
||||
rellontge.i = (a*6)+4;
|
||||
rellontge.j = (b+1)*6;
|
||||
rellontge.viu = true;
|
||||
@@ -2547,7 +2536,7 @@ void naix_malo(uint8_t numero)
|
||||
malo[numero].j = b;
|
||||
//so_de(naiximent_del_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:
|
||||
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;
|
||||
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;
|
||||
}
|
||||
else
|
||||
@@ -2575,10 +2564,10 @@ void mou_malo(uint8_t numero, uint8_t direccio)
|
||||
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)) )
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
else
|
||||
@@ -2592,10 +2581,10 @@ void mou_malo(uint8_t numero, uint8_t direccio)
|
||||
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)) )
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
else
|
||||
@@ -2614,10 +2603,10 @@ void mou_malo(uint8_t numero, uint8_t direccio)
|
||||
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)) )
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
else
|
||||
@@ -2640,13 +2629,13 @@ void moure_malos()
|
||||
switch (malo[i].sentit)
|
||||
{
|
||||
case horitzontalment:
|
||||
if ( ((malo[i].i*6)+4)>x )
|
||||
if ( (((malo[i].i+1)*6)+4)>x )
|
||||
{
|
||||
mou_malo(i, esquerra);
|
||||
malo[i].sentit = rand()%(2+dificultat);
|
||||
}
|
||||
else
|
||||
if ( ((malo[i].i*6)+4)<x )
|
||||
if ( (((malo[i].i+1)*6)+4)<x )
|
||||
{
|
||||
mou_malo(i, dreta);
|
||||
malo[i].sentit = rand()%(2+dificultat);
|
||||
@@ -2656,13 +2645,13 @@ void moure_malos()
|
||||
break;
|
||||
|
||||
case verticalment:
|
||||
if ( ((malo[i].j+1)*6)>y )
|
||||
if ( ((malo[i].j+2)*6)>y )
|
||||
{
|
||||
mou_malo(i, amunt);
|
||||
malo[i].sentit = rand()%(2+dificultat);
|
||||
}
|
||||
else
|
||||
if ( ((malo[i].j+1)*6)<y )
|
||||
if ( ((malo[i].j+2)*6)<y )
|
||||
{
|
||||
mou_malo(i, avall);
|
||||
malo[i].sentit = rand()%(2+dificultat);
|
||||
@@ -2776,7 +2765,7 @@ void story_mode()
|
||||
ini_vars(num_fase);
|
||||
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);
|
||||
ini_pantalla();
|
||||
eixir = false;
|
||||
@@ -2834,13 +2823,13 @@ void story_mode()
|
||||
}
|
||||
|
||||
/*---------*/
|
||||
/* if input::keyPressed(KeyN) then
|
||||
begin
|
||||
final_fase:=true;
|
||||
num_fase:=9;
|
||||
end;
|
||||
if (input::keyPressed(SDL_SCANCODE_N))
|
||||
{
|
||||
final_fase = true;
|
||||
num_fase = 9;
|
||||
}
|
||||
|
||||
if input::keyPressed(KeyB) then final_fase:=true;*/
|
||||
if (input::keyPressed(SDL_SCANCODE_B)) final_fase = true;
|
||||
/*---------*/
|
||||
|
||||
if (input::keyPressed(SDL_SCANCODE_1))
|
||||
|
||||
Reference in New Issue
Block a user