Pachi: HW accelerated with numerous GFX bugs

This commit is contained in:
pelya
2010-10-28 13:56:29 +03:00
parent cd9ec9a024
commit 7c1e6d0c62
7 changed files with 26 additions and 17 deletions

View File

@@ -26,7 +26,7 @@ void respawn() // rutina que hace reaparecer a Pachi
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);
//SDL_UpdateRect(screen,P_scansrect[a].x,P_scansrect[a].y,P_scansrect[a].w,P_scansrect[a].h);
}
}
if(scanpos_y<mplayer[dificulty].y+P_h)
@@ -76,7 +76,7 @@ float fade_object(float alpha)
SDL_BlitSurface(screenbak,&fadingpos,screen,&realfadingpos);
SDL_BlitSurface(fadeobject,NULL,screen,&realfadingpos);
SDL_UpdateRect(screen,realfadingpos.x,realfadingpos.y,realfadingpos.w,realfadingpos.h+2);
//SDL_UpdateRect(screen,realfadingpos.x,realfadingpos.y,realfadingpos.w,realfadingpos.h+2);
if(fadealpha<5)
{
fadingobject=0;
@@ -140,7 +140,7 @@ void bright_obj(int bright_x, int bright_y)
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);
//SDL_UpdateRect(screen,brdstreal.x,brdstreal.y,brdstreal.w,brdstreal.h);
}
void show_arrow(int arrow, int show)
@@ -159,7 +159,7 @@ void show_arrow(int arrow, int show)
else
SDL_BlitSurface(screenbak, &src, screen, &dst);
SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
//SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
break;
case arrow_right:
dst.x=R_gamearea_x+(R_maxtiles_h*R_tileside)-(10+dst.w);
@@ -169,7 +169,7 @@ void show_arrow(int arrow, int show)
else
SDL_BlitSurface(screenbak, &src, screen, &dst);
SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
//SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
break;
case arrow_up:
//fprintf(stderr,"up");

View File

@@ -93,7 +93,7 @@ void stage_up()
if(stage+1 != CEMETERY && stage+1 != CAVES && stage+1 != CASTLE && stage+1 != LAB)
{
SDL_FillRect(screen, &scorerect, 0); // limpiamos el cuadrado de los marcadores
SDL_UpdateRect(screen, scorerect.x, scorerect.y, scorerect.w, scorerect.h);
//SDL_UpdateRect(screen, scorerect.x, scorerect.y, scorerect.w, scorerect.h);
}
mplayer[dificulty].objects = 0; mplayer[dificulty].stageup = 0;
mplayer[dificulty].left = 0; mplayer[dificulty].right = 0;
@@ -112,6 +112,7 @@ void stage_up()
Mix_PlayChannel(0,timer,0);
print_monitor();
print_timer();
SDL_Flip(screen);
SDL_Delay(20);
}
}
@@ -148,7 +149,8 @@ void start_game()
LoadT(&font,DATADIR"/fonts/font16d.T");
SDL_SetColorKey(font, SDL_SRCCOLORKEY, SDL_MapRGB(font->format,0,0,0));
print_text(font,screen,16,16,140,90,"LOADING GAME DATA... PLEASE WAIT");
SDL_UpdateRect(screen,140,90,520,16);
//SDL_UpdateRect(screen,140,90,520,16);
SDL_Flip(screen);
SDL_FreeSurface(font);
setgame();
@@ -283,7 +285,7 @@ void print_timer()
else
print_text(font,screen,16,16,352,564,"%d:0%d",minutes,seconds);
SDL_UpdateRect(screen,224,544,208,40);
//SDL_UpdateRect(screen,224,544,208,40);
}
void do_gametimer()
@@ -342,6 +344,7 @@ void chk_sequence()
void game_loop()
{
print_room();
delta_time();
do_gametimer(); // esta rutina decrementa e imprime el timer
play_music();
@@ -354,5 +357,6 @@ void game_loop()
print_player();
chk_sequence(); // esta rutina se fija cual es el proximo objeto de la sequencia (Bomb Jack feature)
chk_state(); // esta rutina chequea si el personaje se murio, o si paso de nivel
SDL_Flip(screen);
SDL_Delay(1);
}

View File

@@ -33,7 +33,7 @@ void initsdl()
SDL_WM_SetIcon(SDL_LoadBMP(DATADIR"/Tgfx/icon.bmp"),NULL);
fullscreen=0;
screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp, /*SDL_HWSURFACE|SDL_DOUBLEBUF*/ SDL_SWSURFACE ); // TODO: fix HW surfaces
screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp, SDL_HWSURFACE|SDL_DOUBLEBUF /* SDL_SWSURFACE */ );
if (screen == NULL)
{
fprintf(stderr, "Can't set the video mode. Quitting.\nError; %s\n", SDL_GetError());

View File

@@ -208,8 +208,8 @@ void print_monsters()
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);
//SDL_UpdateRect(screen,oldmonsterposreal.x,oldmonsterposreal.y,M_w,M_h);
//SDL_UpdateRect(screen,monsterposreal.x,monsterposreal.y,M_w,M_h);
}
}
}

View File

@@ -93,7 +93,8 @@ void print_credits()
SDL_SetColorKey(creditsbuffer, SDL_SRCCOLORKEY, SDL_MapRGB(creditsbuffer->format, 0, 255, 0));
SDL_SetAlpha(creditsbuffer, SDL_SRCALPHA, 128);
SDL_BlitSurface(creditsbuffer, &cbuffer1, screen, &creditspos);
SDL_UpdateRect(screen,100,100,600,400);
//SDL_UpdateRect(screen,100,100,600,400);
SDL_Flip(screen);
SDL_Delay(50);
linegone++;
@@ -140,7 +141,7 @@ void print_monitor()
print_text(scorefont,screen,16,16,30,528, "LIVES:%d", mplayer[dificulty].lives);
print_text(scorefont,screen,16,16,30,546, "STAGE:%d", stage);
print_text(scorefont,screen,16,16,30,564, "ITEMS:%d/%d",mplayer[dificulty].objects,mstage[stage-1].objects);
SDL_UpdateRect(screen, 30, 482, 500, 100);
//SDL_UpdateRect(screen, 30, 482, 500, 100);
}
void blinkscreen(int R,int G, int B, int A)
@@ -207,7 +208,7 @@ void print_room()
}
SDL_BlitSurface(screen,&gamearea,screenbak,NULL);
print_monitor(); //imprime la informacion del jugador (vidas, puntos, etc)
SDL_Flip(screen);
//SDL_Flip(screen);
}
void showcode(char *str)
@@ -220,7 +221,8 @@ void showcode(char *str)
code.x=280; code.y=220;code.w=240;code.h=50;
print_text(scorefont,screen,16,16,code.x+8,code.y+7,"STAGE CODE IS:");
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_UpdateRect(screen, code.x, code.y, code.w, code.h);
SDL_Flip(screen);
escape_exit=0;
while(escape_exit==0)
{
@@ -242,6 +244,7 @@ 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));
delta_time();
SDL_SetAlpha(surface, SDL_SRCALPHA, int(alpha));
SDL_BlitSurface(surface, NULL, screen, &dst);
@@ -257,6 +260,7 @@ void fadesurface(SDL_Surface *surface, int x, int y, int speed)
float intro_blit(SDL_Surface *surface, int x, int y, int w, int h, float blit_alpha, int speed, int back)
{
SDL_Rect dst;
//SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,0,0,0));
dst.x=x; dst.y=y; dst.w=w; dst.h=h;
int alpha=int(blit_alpha);
SDL_SetAlpha(surface, SDL_SRCALPHA, alpha);

View File

@@ -345,8 +345,8 @@ void print_player()
playersrc.h = mplayer[dificulty].h;
SDL_BlitSurface(player, &playersrc, screen, &playerposreal);
SDL_UpdateRect(screen,oldplayerposreal.x,oldplayerposreal.y,P_w,oldplayerpos.h);
SDL_UpdateRect(screen,playerposreal.x,playerposreal.y,mplayer[dificulty].w,mplayer[dificulty].h);
//SDL_UpdateRect(screen,oldplayerposreal.x,oldplayerposreal.y,P_w,oldplayerpos.h);
//SDL_UpdateRect(screen,playerposreal.x,playerposreal.y,mplayer[dificulty].w,mplayer[dificulty].h);
}
void animateplayer()

View File

@@ -699,6 +699,7 @@ static void ANDROID_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
{
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROID_UpdateRects()");
// Used only in single-buffer mode
//if( SDL_CurrentVideoSurface && !(SDL_CurrentVideoSurface->flags & SDL_HWSURFACE) )
ANDROID_FlipHWSurface(this, SDL_CurrentVideoSurface);
}