Fixed graphical bug when level exit scroll direction was LEFT or UP.

This commit is contained in:
Rob Pearce 2016-07-29 11:13:55 +12:00
parent 21ca78a311
commit 61ce57d134
3 changed files with 29 additions and 14 deletions

39
rc.c
View File

@ -7090,6 +7090,7 @@ void drawlevel(void) {
levscrollinfo_t scrollinfo;
// this will hold a copy of the NEW level that we're going to.
if (temps) {
SDL_FreeSurface(temps);
temps = NULL;
@ -7100,6 +7101,9 @@ void drawlevel(void) {
screen->format->Amask);
SDL_DisplayFormat(temps);
// this will be a copy of the real screen we take before
// drawing the player and cloud sprites.
//
// no alpha mask on screen copy - otherwise we'll need to draw
// black all over it to make clear out alpha channel.
screencopy = SDL_CreateRGBSurface(SDL_SWSURFACE, SCREENW, SCREENH,
@ -7216,18 +7220,16 @@ void drawlevel(void) {
// just to be sure
//pspeed += 1;
// The overall plan here is:
// - Move player(s) + cloud(s) to new position
// - shuffle screen along
// - blit the next column of the new level in place
if (oldexitdir == D_LEFT) {
for (x = 0; x < SCREENW; x += speed) {
leveltransition_moveplayer(&scrollinfo);
leveltransition_scrolllevel( 0, 0, SCREENW-speed, SCREENH,
speed, 0, 0, 0,
speed, 0,
SCREENW-x, 0, speed, SCREENH,
0, 0, 0, 0);
@ -7238,7 +7240,7 @@ void drawlevel(void) {
leveltransition_moveplayer(&scrollinfo);
leveltransition_scrolllevel( 0, 0, SCREENW, SCREENH-speed,
0, speed, 0, 0,
0, speed,
0, SCREENH-y, SCREENW, speed,
0, 0, 0, 0);
@ -7249,7 +7251,7 @@ void drawlevel(void) {
leveltransition_moveplayer(&scrollinfo);
leveltransition_scrolllevel( 0, speed, SCREENW, SCREENH-speed,
0, 0, 0, 0,
0, 0,
0, y, SCREENW, speed,
0, SCREENH-speed, 0, 0);
@ -7260,8 +7262,8 @@ void drawlevel(void) {
leveltransition_moveplayer(&scrollinfo);
leveltransition_scrolllevel( speed, 0, SCREENW-speed, SCREENH,
0, 0, 0, 0,
x, 0, speed, SCREENW,
0, 0,
x, 0, speed, SCREENH,
SCREENW-speed, 0, 0, 0);
leveltransition_blit(&scrollinfo, screencopy);
@ -7273,7 +7275,6 @@ void drawlevel(void) {
levelcomplete = B_FALSE;
}
double getspeed(sprite_t *s ) {
int id = s->id;
double speed = DEFAULTSPEED;
@ -9523,6 +9524,7 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
// clear layer 2 as well
curlevel->map2[ty * LEVELW + tx ] = getuniq(T_BLANK);
melttile(tx, ty, FOREVER, B_PUFF);
sp = addsprite(fruittypes[curfruittype],
tx * TILEW + (TILEW/2),
ty * TILEH + (TILEH/2), "end_fruit");
@ -12502,12 +12504,15 @@ void leveltransition_moveplayer(levscrollinfo_t *l) {
}
void leveltransition_scrolllevel(int srcx, int srcy, int srcw, int srch,
int dstx, int dsty, int dstw, int dsth,
int dstx, int dsty,
int nextcolx, int nextcoly, int nextcolw, int nextcolh,
int nextcol_dstx, int nextcol_dsty, int nextcol_dstw, int nextcol_dsth) {
SDL_Rect src,dst,area;
SDL_Surface *buf = NULL;
// shuffle real screen
// shuffle real screen. Use a temp surface cause sdl doesn't seem to like
// blitting to and from the same surface.
src.x = srcx;
src.y = srcy;
src.w = srcw;
@ -12515,9 +12520,17 @@ void leveltransition_scrolllevel(int srcx, int srcy, int srcw, int srch,
dst.x = dstx;
dst.y = dsty;
dst.w = dstw;
dst.h = dsth;
SDL_BlitSurface(screen, &src, screen, &dst);
dst.w = 0;
dst.h = 0;
buf = SDL_CreateRGBSurface(SDL_SWSURFACE, srcw, srch,
screen->format->BitsPerPixel, screen->format->Rmask,
screen->format->Gmask,screen->format->Bmask, 0);
SDL_BlitSurface(screen, &src, buf, NULL);
SDL_BlitSurface(buf, NULL, screen, &dst);
SDL_FreeSurface(buf);
// blit next column from temp surface (take last column first)
area.x = nextcolx;

2
rc.h
View File

@ -92,7 +92,7 @@ int keydown(int whichplayer, int checkfor);
void leveltransition_blit(levscrollinfo_t *l, SDL_Surface *copybuffer);
void leveltransition_moveplayer(levscrollinfo_t *l);
void leveltransition_scrolllevel(int srcx, int srcy, int srcw, int srch,
int dstx, int dsty, int dstw, int dsth,
int dstx, int dsty,
int nextcolx, int nextcoly, int nextcolw, int nextcolh,
int nextcol_dstx, int nextcol_dsty, int nextcol_dstw, int nextcol_dsth);
void trytojump(sprite_t *pl);

2
todo
View File

@ -1,3 +1,5 @@
- move level 86 earlier (dificulty easier than other castle levels before it)
- animate players hanging from umbrellas ?
- sometimes when falling on to a trampoline at an angle, I teleport up to the top of the screen.