Fixed most of GFX bugs in Pachi

This commit is contained in:
pelya
2010-10-28 17:22:28 +03:00
parent 7c1e6d0c62
commit e4cbc99367
8 changed files with 97 additions and 78 deletions

View File

@@ -16,7 +16,7 @@ AppHandlesJoystickSensitivity=n
AppUsesMultitouch=n
NonBlockingSwapBuffers=n
RedefinedKeys="SPACE RETURN"
AppTouchscreenKeyboardKeysAmount=2
AppTouchscreenKeyboardKeysAmount=1
AppTouchscreenKeyboardKeysAmountAutoFire=0
MultiABI=n
AppVersionCode=101

View File

@@ -6,50 +6,52 @@ SDL_Rect fadingpos; // posicion del objeto que esta desvaneciendose
SDL_Rect realfadingpos; // posicion del objeto que esta desvaneciendose en el area de juego
float fade_y;
float scanpos_y=R_gamearea_y - (P_h*P_h);
int scanpos_y=0;
void respawn() // rutina que hace reaparecer a Pachi
{
int scanspeed=1500;
SDL_Rect P_oldscansrect[P_h];
SDL_Rect P_scansrect[P_h];
SDL_Rect P_srcscan[P_h];
SDL_Rect P_scansrect;
SDL_Rect P_srcscan;
//imprimimos los scans
for(int a=P_h-1;a>=0;a--)
{
P_scansrect[a].x=int(mplayer[dificulty].x+R_gamearea_x);P_scansrect[a].w=mplayer[dificulty].w;P_scansrect[a].h=1;
P_scansrect[a].y=int(scanpos_y+(a*P_h));
P_srcscan[a].h=1;P_srcscan[a].w=mplayer[dificulty].w;P_srcscan[a].x=(mplayer[dificulty].w*(mplayer[dificulty].frame));P_srcscan[a].y=0+a;
P_oldscansrect[a]=P_scansrect[a];
SDL_BlitSurface(background,NULL,screen,NULL);
print_room();
if((P_scansrect[a].y<mplayer[dificulty].y+R_gamearea_y+P_h-(P_h-a))&&(P_scansrect[a].y>R_gamearea_y))
{
SDL_BlitSurface(player,&P_srcscan[a],screen,&P_scansrect[a]);
//SDL_UpdateRect(screen,P_scansrect[a].x,P_scansrect[a].y,P_scansrect[a].w,P_scansrect[a].h);
}
P_srcscan.h=1;
P_srcscan.y=P_h - scanpos_y;
P_srcscan.w=mplayer[dificulty].w;
P_srcscan.x=(mplayer[dificulty].w*(mplayer[dificulty].frame));
P_scansrect.x=mplayer[dificulty].start_x+R_gamearea_x;
P_scansrect.w=mplayer[dificulty].w;
P_scansrect.h=1;
for(int a=0;a<=R_gamearea_y + mplayer[dificulty].start_y + P_h - scanpos_y;a++)
{
P_scansrect.y=a;
SDL_BlitSurface(player,&P_srcscan,screen,&P_scansrect);
}
if(scanpos_y<mplayer[dificulty].y+P_h)
scanpos_y+=scanspeed*imove;
P_srcscan.h=scanpos_y;
P_srcscan.y=P_h - scanpos_y;
P_scansrect.h=scanpos_y;
P_scansrect.y=R_gamearea_y + mplayer[dificulty].start_y + P_h - scanpos_y;
SDL_BlitSurface(player,&P_srcscan,screen,&P_scansrect);
SDL_Flip(screen);
SDL_Delay(1);
if(scanpos_y<P_h)
scanpos_y+=1;
else
{
scanpos_y=R_gamearea_y - (P_h*P_h);
scanpos_y=0;
respawned=1;
imove=0.01;
SDL_Flip(screen);
}
//borramos los scans recuperando el fondo que habia antes
SDL_Rect bakscansrect[P_h];
for(int a=P_h-1;a>=0;a--)
{
bakscansrect[a]=P_oldscansrect[a];
P_oldscansrect[a].x-=R_gamearea_x;
P_oldscansrect[a].y-=R_gamearea_y;
SDL_BlitSurface(screenbak,&P_oldscansrect[a],screen,&bakscansrect[a]);
}
}
@@ -74,15 +76,15 @@ float fade_object(float alpha)
SDL_SetAlpha(fadeobject,SDL_SRCALPHA,fadealpha);
realfadingpos.x=R_gamearea_x+fadingpos.x;realfadingpos.y=R_gamearea_y+fadingpos.y;realfadingpos.w=fadingpos.w;realfadingpos.h=fadingpos.h;
SDL_BlitSurface(screenbak,&fadingpos,screen,&realfadingpos);
//SDL_BlitSurface(screenbak,&fadingpos,screen,&realfadingpos);
SDL_BlitSurface(fadeobject,NULL,screen,&realfadingpos);
//SDL_UpdateRect(screen,realfadingpos.x,realfadingpos.y,realfadingpos.w,realfadingpos.h+2);
if(fadealpha<5)
{
fadingobject=0;
SDL_BlitSurface(screenbak,&fadingpos,screen,&realfadingpos);
print_room();
SDL_Flip(screen);
//SDL_BlitSurface(screenbak,&fadingpos,screen,&realfadingpos);
//print_room();
//SDL_Flip(screen);
}
else
{
@@ -107,10 +109,10 @@ void screen_fx()
{
Mix_PlayChannel(7,storm,0);
blinkscreen(220,220,255,128);
load_room();
print_room();
}
}
//load_room();
//print_room();
}
}
}
}
@@ -137,7 +139,7 @@ void bright_obj(int bright_x, int bright_y)
objdstreal.y=bright_y*R_tileside+R_gamearea_y;
objdstreal.w=R_tileside;objdst.h=R_tileside;
SDL_BlitSurface(screenbak,&brdst,screen,&brdstreal);
//SDL_BlitSurface(screenbak,&brdst,screen,&brdstreal);
// SDL_BlitSurface(tiles,&objsrc,screen,&objdstreal);
SDL_BlitSurface(bright,&brsrc,screen,&brdstreal);
//SDL_UpdateRect(screen,brdstreal.x,brdstreal.y,brdstreal.w,brdstreal.h);
@@ -156,8 +158,8 @@ void show_arrow(int arrow, int show)
src.x=dst.x-R_gamearea_x;
if(show==1)
SDL_BlitSurface(left, NULL, screen, &dst);
else
SDL_BlitSurface(screenbak, &src, screen, &dst);
//else
//SDL_BlitSurface(screenbak, &src, screen, &dst);
//SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
break;
@@ -166,8 +168,8 @@ void show_arrow(int arrow, int show)
src.x=dst.x-R_gamearea_x;
if(show==1)
SDL_BlitSurface(right, NULL, screen, &dst);
else
SDL_BlitSurface(screenbak, &src, screen, &dst);
//else
//SDL_BlitSurface(screenbak, &src, screen, &dst);
//SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
break;

View File

@@ -344,6 +344,7 @@ void chk_sequence()
void game_loop()
{
SDL_BlitSurface(background,NULL,screen,NULL);
print_room();
delta_time();
do_gametimer(); // esta rutina decrementa e imprime el timer

View File

@@ -56,58 +56,65 @@ void intro()
int n=1;
while(escape_exit==0)
{
if(n<=4) // 4 son los pasos a realizar en la primer parte de la intro
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,0,0,0));
//if(n<=4) // 4 son los pasos a realizar en la primer parte de la intro
{
if(title_alpha<255)
{
switch(n)
{
case 1:
title_alpha=intro_blit(dragontech, 160, 100, 480, 170, title_alpha, 80, 1);
break;
default:
if(n==3)
title_alpha=intro_blit(line2, 160, 350, 600, 40, title_alpha, 80, 1);
else
intro_blit(line2, 160, 350, 600, 40, 255, 80, 1);
case 2:
title_alpha=intro_blit(line1, 60, 300, 600, 40, title_alpha, 80, 1);
break;
case 3:
title_alpha=intro_blit(line2, 160, 350, 600, 40, title_alpha, 80, 1);
break;
case 4:
if(introtime>15)
title_alpha=intro_blit(black, 0,0,800,600, title_alpha, 80, 0);
break;
if(n==2)
title_alpha=intro_blit(line1, 60, 300, 600, 40, title_alpha, 80, 1);
else
intro_blit(line1, 60, 300, 600, 40, 255, 80, 1);
case 1:
if(n==1)
title_alpha=intro_blit(dragontech, 160, 100, 480, 170, title_alpha, 80, 1);
else
intro_blit(dragontech, 160, 100, 480, 170, 255, 80, 1);
}
}
else
if(title_alpha>=255)
{
title_alpha=0;
n++;
}
}
SDL_Flip(screen);
credits_events();
delta_time();
introtime+=imove;
SDL_Delay(1);
if(introtime>20)
if(introtime>15)
escape_exit=1;
}
escape_exit=0; n=1; title_alpha=0; introtime=0;
while(escape_exit==0)
{
if(title_alpha<255)
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,0,0,0));
{
title_alpha=intro_blit(comic_01, 0, 0, 800, 600, title_alpha, 60, 0);
if(n == 1)
title_alpha=intro_blit(comic_01, 0, 0, 800, 600, title_alpha, 60, 0);
else
intro_blit(comic_01, 0, 0, 800, 600, 255, 60, 0);
}
else
if(title_alpha>=255)
{
title_alpha=0;
n++;
}
SDL_Flip(screen);
credits_events();
delta_time();
introtime+=imove;
SDL_Delay(1);
if(introtime>25)
if(introtime>15)
escape_exit=1;
}

View File

@@ -102,7 +102,7 @@ void do_menu()
if(menuvalue == 7) font = menufont1; else font = menufont;
print_text(font, screen, 32, 32 ,305, menustartpos+(6*40), " EXIT");
SDL_UpdateRect(screen, 300, 160, 240, 300);
//SDL_UpdateRect(screen, 300, 160, 240, 300);
}
void menu_loop()
@@ -119,15 +119,18 @@ void menu()
float alpha=0;
while(alpha<255)
{
alpha=intro_blit(background,0,0,800,600,alpha,200,0);
delta_time();
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,0,0,0));
alpha=intro_blit(background,0,0,800,600,alpha,200,0);
SDL_Flip(screen);
delta_time();
}
SDL_Flip(screen);
menuvalue=1;
while(gameexit==0 && startgame==0 && help==0 && hiscores==0)
{
SDL_BlitSurface(background, NULL, screen, NULL);
menu_events();
menu_loop();
menu_loop();
SDL_Flip(screen);
}
unload_menudata();
stop_music();

View File

@@ -206,7 +206,7 @@ void print_monsters()
monsterposreal.x = monsterpos.x + R_gamearea_x;
monsterposreal.y = monsterpos.y + R_gamearea_y;
SDL_BlitSurface(screenbak, &oldmonsterpos, screen, &oldmonsterposreal);
//SDL_BlitSurface(screenbak, &oldmonsterpos, screen, &oldmonsterposreal);
SDL_BlitSurface(monsters, &monstersrc, screen, &monsterposreal);
//SDL_UpdateRect(screen,oldmonsterposreal.x,oldmonsterposreal.y,M_w,M_h);
//SDL_UpdateRect(screen,monsterposreal.x,monsterposreal.y,M_w,M_h);

View File

@@ -20,12 +20,12 @@ void screen_mode()
{
if(fullscreen)
{
screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp,0);
screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp, SDL_HWSURFACE|SDL_DOUBLEBUF /* SDL_SWSURFACE */);
fullscreen = 0;
}
else
{
screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp,SDL_FULLSCREEN);
screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp, SDL_SWSURFACE);
fullscreen = 1;
}
}
@@ -148,8 +148,8 @@ void blinkscreen(int R,int G, int B, int A)
{
SDL_FillRect(screen,NULL,SDL_MapRGBA(screen->format,R,G,B,A));
SDL_Flip(screen);
setback();
SDL_Flip(screen);
//setback();
//SDL_Flip(screen);
}
void print_room()
@@ -213,6 +213,10 @@ void print_room()
void showcode(char *str)
{
escape_exit=0;
while(escape_exit==0)
{
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,0,0,0));
SDL_Rect code;
code.x=280; code.y=220;code.w=240;code.h=50;
SDL_FillRect(screen,&code,SDL_MapRGB(screen->format,255,255,255));
@@ -223,9 +227,6 @@ void showcode(char *str)
print_text(scorefont1,screen,16,16,code.x+90,code.y+27,"%s",str);
//SDL_UpdateRect(screen, code.x, code.y, code.w, code.h);
SDL_Flip(screen);
escape_exit=0;
while(escape_exit==0)
{
credits_events();
SDL_Delay(1);
}
@@ -244,13 +245,14 @@ void fadesurface(SDL_Surface *surface, int x, int y, int speed)
float alpha=0;
while(alpha<255)
{
//SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,0,0,0));
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,0,0,0));
delta_time();
SDL_SetAlpha(surface, SDL_SRCALPHA, int(alpha));
SDL_BlitSurface(surface, NULL, screen, &dst);
SDL_Flip(screen);
alpha+=(speed*imove);
}
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,0,0,0));
SDL_SetAlpha(surface, 0, 0);
SDL_BlitSurface(surface, NULL, screen, &dst);
SDL_Flip(screen);
@@ -266,7 +268,8 @@ float intro_blit(SDL_Surface *surface, int x, int y, int w, int h, float blit_al
SDL_SetAlpha(surface, SDL_SRCALPHA, alpha);
blit_alpha+=(speed*imove);
SDL_BlitSurface(surface, NULL, screen, &dst);
SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
//SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
/*
if(back==1)
{
if(blit_alpha<255)
@@ -281,11 +284,13 @@ float intro_blit(SDL_Surface *surface, int x, int y, int w, int h, float blit_al
{
SDL_SetAlpha(surface, 0, 0);
SDL_BlitSurface(surface, NULL, screen, &dst);
SDL_Flip(screen);
//SDL_Flip(screen);
}
*/
return(blit_alpha);
}
/*
float fade(SDL_Surface *surface, int x, int y, int w, int h, int R, int G, int B, int speed, float blit_alpha)
{
SDL_Rect dst;
@@ -298,6 +303,7 @@ float fade(SDL_Surface *surface, int x, int y, int w, int h, int R, int G, int B
SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
return(blit_alpha);
}
*/
void showposter(int num)
{

View File

@@ -335,7 +335,7 @@ void clean_player()
oldplayerposreal.x = oldplayerpos.x + R_gamearea_x;
oldplayerposreal.y = oldplayerpos.y + R_gamearea_y;
SDL_BlitSurface(screenbak,&oldplayerpos,screen, &oldplayerposreal);
//SDL_BlitSurface(screenbak,&oldplayerpos,screen, &oldplayerposreal);
}
void print_player()
{