Merge branch 'master' into spinny-sign

This commit is contained in:
lachwright 2019-11-08 19:59:08 +08:00
commit bd9878eb48
14 changed files with 206 additions and 56 deletions

View file

@ -227,7 +227,14 @@ static void D_Display(void)
SCR_SetMode(); // change video mode SCR_SetMode(); // change video mode
if (vid.recalc) if (vid.recalc)
{
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc() SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
#ifdef HWRENDER
// Shoot! The screen texture was flushed!
if ((rendermode == render_opengl) && (gamestate == GS_INTERMISSION))
usebuffer = false;
#endif
}
// change the view size if needed // change the view size if needed
if (setsizeneeded) if (setsizeneeded)
@ -415,6 +422,7 @@ static void D_Display(void)
if (rendermode == render_soft) if (rendermode == render_soft)
{ {
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes); VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
Y_ConsiderScreenBuffer();
usebuffer = true; usebuffer = true;
} }
lastdraw = false; lastdraw = false;

View file

@ -836,7 +836,7 @@ void F_IntroDrawer(void)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
V_DrawScaledPatch(0, 0, 0, radar); V_DrawScaledPatch(0, 0, 0, radar);
W_UnlockCachedPatch(radar); W_UnlockCachedPatch(radar);
V_DrawString(8, 128, 0, cutscene_disptext); V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
@ -849,7 +849,7 @@ void F_IntroDrawer(void)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
V_DrawScaledPatch(0, 0, 0, grass); V_DrawScaledPatch(0, 0, 0, grass);
W_UnlockCachedPatch(grass); W_UnlockCachedPatch(grass);
V_DrawString(8, 128, 0, cutscene_disptext); V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
@ -862,7 +862,7 @@ void F_IntroDrawer(void)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
V_DrawSmallScaledPatch(0, 0, 0, confront); V_DrawSmallScaledPatch(0, 0, 0, confront);
W_UnlockCachedPatch(confront); W_UnlockCachedPatch(confront);
V_DrawString(8, 128, 0, cutscene_disptext); V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
@ -875,7 +875,7 @@ void F_IntroDrawer(void)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
V_DrawSmallScaledPatch(0, 0, 0, sdo); V_DrawSmallScaledPatch(0, 0, 0, sdo);
W_UnlockCachedPatch(sdo); W_UnlockCachedPatch(sdo);
V_DrawString(224, 8, 0, cutscene_disptext); V_DrawString(224, 8, V_ALLOWLOWERCASE, cutscene_disptext);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
@ -2586,8 +2586,8 @@ void F_ContinueDrawer(void)
{ {
if (!(continuetime & 1) || continuetime > 17) if (!(continuetime & 1) || continuetime > 17)
V_DrawContinueIcon(x, 68, 0, players[consoleplayer].skin, players[consoleplayer].skincolor); V_DrawContinueIcon(x, 68, 0, players[consoleplayer].skin, players[consoleplayer].skincolor);
V_DrawScaledPatch(x+12, 68-2, 0, stlivex); V_DrawScaledPatch(x+12, 66, 0, stlivex);
V_DrawRightAlignedString(x+36, 69-5, 0, V_DrawRightAlignedString(x+38, 64, 0,
va("%d",(imcontinuing ? ncontinues-1 : ncontinues))); va("%d",(imcontinuing ? ncontinues-1 : ncontinues)));
} }
else else

View file

@ -690,7 +690,9 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
// Composite the columns together. // Composite the columns together.
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
{ {
#ifndef NO_PNG_LUMPS
size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump); size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump);
#endif
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
#ifndef NO_PNG_LUMPS #ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
@ -929,9 +931,9 @@ static void HWR_LoadPatchFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
{ {
UINT8 *flat; UINT8 *flat;
patch_t *patch = (patch_t *)W_CacheLumpNum(flatlumpnum, PU_STATIC); patch_t *patch = (patch_t *)W_CacheLumpNum(flatlumpnum, PU_STATIC);
#ifndef NO_PNG_LUMPS
size_t lumplength = W_LumpLength(flatlumpnum); size_t lumplength = W_LumpLength(flatlumpnum);
#ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)patch, lumplength)) if (R_IsLumpPNG((UINT8 *)patch, lumplength))
patch = R_PNGToPatch((UINT8 *)patch, lumplength, NULL, false); patch = R_PNGToPatch((UINT8 *)patch, lumplength, NULL, false);
#endif #endif

View file

@ -406,7 +406,7 @@ light_t *t_lspr[NUMSPRITES] =
&lspr[NOLIGHT], // SPR_HHPL &lspr[NOLIGHT], // SPR_HHPL
&lspr[NOLIGHT], // SPR_SHRM &lspr[NOLIGHT], // SPR_SHRM
&lspr[NOLIGHT], // SPR_HHZM &lspr[NOLIGHT], // SPR_HHZM
// Azure Temple Scenery // Azure Temple Scenery
&lspr[NOLIGHT], // SPR_BGAR &lspr[NOLIGHT], // SPR_BGAR
&lspr[NOLIGHT], // SPR_RCRY &lspr[NOLIGHT], // SPR_RCRY

View file

@ -557,7 +557,7 @@ typedef enum sprite
SPR_HHPL, // Dr Seuss Trees SPR_HHPL, // Dr Seuss Trees
SPR_SHRM, // Mushroom SPR_SHRM, // Mushroom
SPR_HHZM, // Misc SPR_HHZM, // Misc
// Azure Temple Scenery // Azure Temple Scenery
SPR_BGAR, // ATZ Gargoyles SPR_BGAR, // ATZ Gargoyles
SPR_RCRY, // ATZ Red Crystal (Target) SPR_RCRY, // ATZ Red Crystal (Target)

View file

@ -2307,7 +2307,7 @@ void M_InitMenuPresTables(void)
strncpy(menupres[i].musname, "_recat", 7); strncpy(menupres[i].musname, "_recat", 7);
else if (i == MN_SP_NIGHTSATTACK) else if (i == MN_SP_NIGHTSATTACK)
strncpy(menupres[i].musname, "_nitat", 7); strncpy(menupres[i].musname, "_nitat", 7);
else if (i == MN_SP_PLAYER) else if (i == MN_SP_PLAYER || i == MN_SR_PLAYER)
strncpy(menupres[i].musname, "_chsel", 7); strncpy(menupres[i].musname, "_chsel", 7);
} }
} }
@ -8723,6 +8723,10 @@ void M_DrawTimeAttackMenu(void)
char beststr[40]; char beststr[40];
char reqscore[40], reqtime[40], reqrings[40]; char reqscore[40], reqtime[40], reqrings[40];
strcpy(reqscore, "\0");
strcpy(reqtime, "\0");
strcpy(reqrings, "\0");
M_DrawLevelPlatterHeader(32-lsheadingheight/2, cv_nextmap.string, true, false); M_DrawLevelPlatterHeader(32-lsheadingheight/2, cv_nextmap.string, true, false);
// A 160x100 image of the level as entry MAPxxP // A 160x100 image of the level as entry MAPxxP

View file

@ -2459,7 +2459,7 @@ void T_RaiseSector(levelspecthink_t *raise)
break; break;
} }
} }
if (raise->vars[9]) // Dynamically Sinking Platform^tm if (raise->vars[9]) // Dynamically Sinking Platform^tm
{ {
#define shaketime 10 #define shaketime 10

View file

@ -1040,7 +1040,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
{ {
if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !thing->health) if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !thing->health)
return true; return true;
if (thing == tmthing->tracer) // don't collide with rider if (thing == tmthing->tracer) // don't collide with rider
return true; return true;
@ -1054,7 +1054,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
P_KillMobj(thing, tmthing, tmthing->tracer, 0); P_KillMobj(thing, tmthing, tmthing->tracer, 0);
return true; return true;
} }
if (thing->type == tmthing->type // bounce against other rollout rocks if (thing->type == tmthing->type // bounce against other rollout rocks
&& (tmthing->momx || tmthing->momy || thing->momx || thing->momy)) && (tmthing->momx || tmthing->momy || thing->momx || thing->momy))
{ {

View file

@ -6070,7 +6070,7 @@ static void P_AddAirbob(sector_t *sec, line_t *sourceline, boolean noadjust, boo
airbob->vars[5] = sec->ceilingheight; airbob->vars[5] = sec->ceilingheight;
airbob->vars[4] = airbob->vars[5] airbob->vars[4] = airbob->vars[5]
- (sec->ceilingheight - sec->floorheight); - (sec->ceilingheight - sec->floorheight);
airbob->vars[9] = dynamic ? 1 : 0; airbob->vars[9] = dynamic ? 1 : 0;
airbob->sourceline = sourceline; airbob->sourceline = sourceline;

View file

@ -1096,7 +1096,7 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
// Spinning. // Spinning.
if (player->pflags & PF_SPINNING) if (player->pflags & PF_SPINNING)
return true; return true;
if (player->dashmode >= DASHMODE_THRESHOLD && (player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)) if (player->dashmode >= DASHMODE_THRESHOLD && (player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE))
return true; return true;
@ -7820,7 +7820,7 @@ static void P_MovePlayer(player_t *player)
if (!(player->powers[pw_nocontrol] & (1<<15))) if (!(player->powers[pw_nocontrol] & (1<<15)))
player->pflags |= PF_JUMPSTASIS; player->pflags |= PF_JUMPSTASIS;
} }
if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING)
{ {
player->pflags |= PF_STASIS; player->pflags |= PF_STASIS;
@ -10978,19 +10978,19 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
tic_t dashmode = player->dashmode; tic_t dashmode = player->dashmode;
boolean underwater = mo->eflags & MFE_UNDERWATER; boolean underwater = mo->eflags & MFE_UNDERWATER;
statenum_t stat = fume->state-states; statenum_t stat = fume->state-states;
if (panim != PA_WALK && panim != PA_RUN && panim != PA_DASH) // turn invisible when not in a coherent movement state if (panim != PA_WALK && panim != PA_RUN && panim != PA_DASH) // turn invisible when not in a coherent movement state
{ {
if (stat != fume->info->spawnstate) if (stat != fume->info->spawnstate)
P_SetMobjState(fume, fume->info->spawnstate); P_SetMobjState(fume, fume->info->spawnstate);
return; return;
} }
if (underwater) // No fume underwater; spawn bubbles instead! if (underwater) // No fume underwater; spawn bubbles instead!
{ {
fume->movedir += FixedAngle(FixedDiv(2 * player->speed, 3 * mo->scale)); fume->movedir += FixedAngle(FixedDiv(2 * player->speed, 3 * mo->scale));
fume->movefactor += player->speed; fume->movefactor += player->speed;
if (fume->movefactor > FixedDiv(2 * player->normalspeed, 3 * mo->scale)) if (fume->movefactor > FixedDiv(2 * player->normalspeed, 3 * mo->scale))
{ {
INT16 i; INT16 i;
@ -11000,7 +11000,7 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
fixed_t factorX = P_ReturnThrustX(mo, angle + ANGLE_90, mo->scale); fixed_t factorX = P_ReturnThrustX(mo, angle + ANGLE_90, mo->scale);
fixed_t factorY = P_ReturnThrustY(mo, angle + ANGLE_90, mo->scale); fixed_t factorY = P_ReturnThrustY(mo, angle + ANGLE_90, mo->scale);
fixed_t offsetH, offsetV, x, y, z; fixed_t offsetH, offsetV, x, y, z;
for (i = -1; i < 2; i += 2) for (i = -1; i < 2; i += 2)
{ {
offsetH = i*P_ReturnThrustX(fume, fume->movedir, radiusV); offsetH = i*P_ReturnThrustX(fume, fume->movedir, radiusV);
@ -11010,10 +11010,10 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
z = mo->z + (mo->height >> 1) + offsetV; z = mo->z + (mo->height >> 1) + offsetV;
P_SpawnMobj(x, y, z, MT_SMALLBUBBLE)->scale = mo->scale >> 1; P_SpawnMobj(x, y, z, MT_SMALLBUBBLE)->scale = mo->scale >> 1;
} }
fume->movefactor = 0; fume->movefactor = 0;
} }
if (panim == PA_WALK) if (panim == PA_WALK)
{ {
if (stat != fume->info->spawnstate) if (stat != fume->info->spawnstate)
@ -11021,13 +11021,13 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
return; return;
} }
} }
if (stat == fume->info->spawnstate) // If currently inivisble, activate! if (stat == fume->info->spawnstate) // If currently inivisble, activate!
{ {
P_SetMobjState(fume, (stat = fume->info->seestate)); P_SetMobjState(fume, (stat = fume->info->seestate));
P_SetScale(fume, mo->scale); P_SetScale(fume, mo->scale);
} }
if (dashmode > DASHMODE_THRESHOLD && stat != fume->info->seestate) // If in dashmode, grow really big and flash if (dashmode > DASHMODE_THRESHOLD && stat != fume->info->seestate) // If in dashmode, grow really big and flash
{ {
fume->destscale = mo->scale; fume->destscale = mo->scale;
@ -11044,19 +11044,19 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
fume->flags2 = (fume->flags2 & ~MF2_DONTDRAW) | (mo->flags2 & MF2_DONTDRAW); fume->flags2 = (fume->flags2 & ~MF2_DONTDRAW) | (mo->flags2 & MF2_DONTDRAW);
fume->destscale = (mo->scale + FixedDiv(player->speed, player->normalspeed)) / (underwater ? 6 : 3); fume->destscale = (mo->scale + FixedDiv(player->speed, player->normalspeed)) / (underwater ? 6 : 3);
fume->color = FUME_SKINCOLORS[(dashmode * sizeof(FUME_SKINCOLORS)) / (DASHMODE_MAX + 1)]; fume->color = FUME_SKINCOLORS[(dashmode * sizeof(FUME_SKINCOLORS)) / (DASHMODE_MAX + 1)];
if (underwater) if (underwater)
{ {
fume->frame = (fume->frame & FF_FRAMEMASK) | FF_ANIMATE | (P_RandomRange(0, 9) * FF_TRANS10); fume->frame = (fume->frame & FF_FRAMEMASK) | FF_ANIMATE | (P_RandomRange(0, 9) * FF_TRANS10);
} }
} }
fume->movecount = dashmode; // keeps track of previous dashmode value so we know whether Metal is entering or leaving it fume->movecount = dashmode; // keeps track of previous dashmode value so we know whether Metal is entering or leaving it
fume->eflags = (fume->eflags & ~MFE_VERTICALFLIP) | (mo->eflags & MFE_VERTICALFLIP); // Make sure to flip in reverse gravity! fume->eflags = (fume->eflags & ~MFE_VERTICALFLIP) | (mo->eflags & MFE_VERTICALFLIP); // Make sure to flip in reverse gravity!
// Finally, set its position // Finally, set its position
dist = -mo->radius - FixedMul(fume->info->radius, fume->destscale - mo->scale/3); dist = -mo->radius - FixedMul(fume->info->radius, fume->destscale - mo->scale/3);
P_UnsetThingPosition(fume); P_UnsetThingPosition(fume);
fume->x = mo->x + P_ReturnThrustX(fume, angle, dist); fume->x = mo->x + P_ReturnThrustX(fume, angle, dist);
fume->y = mo->y + P_ReturnThrustY(fume, angle, dist); fume->y = mo->y + P_ReturnThrustY(fume, angle, dist);

View file

@ -831,7 +831,9 @@ void R_LoadTextures(void)
{ {
UINT16 wadnum = (UINT16)w; UINT16 wadnum = (UINT16)w;
lumpnum_t lumpnum = texstart + j; lumpnum_t lumpnum = texstart + j;
#ifndef NO_PNG_LUMPS
size_t lumplength; size_t lumplength;
#endif
if (wadfiles[w]->type == RET_PK3) if (wadfiles[w]->type == RET_PK3)
{ {
@ -839,8 +841,10 @@ void R_LoadTextures(void)
continue; // If it is then SKIP IT continue; // If it is then SKIP IT
} }
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
patchlump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); patchlump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
#ifndef NO_PNG_LUMPS
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
#endif
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height); //CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL); texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
@ -2798,22 +2802,23 @@ boolean R_IsLumpPNG(const UINT8 *d, size_t s)
#ifdef HAVE_PNG #ifdef HAVE_PNG
#if PNG_LIBPNG_VER_DLLNUM < 14 /*#if PNG_LIBPNG_VER_DLLNUM < 14
typedef PNG_CONST png_byte *png_const_bytep; typedef PNG_CONST png_byte *png_const_bytep;
#endif #endif*/
typedef struct { typedef struct
png_const_bytep buffer; {
png_uint_32 bufsize; const UINT8 *buffer;
png_uint_32 current_pos; UINT32 size;
UINT32 position;
} png_io_t; } png_io_t;
static void PNG_IOReader(png_structp png_ptr, png_bytep data, png_size_t length) static void PNG_IOReader(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_io_t *f = png_get_io_ptr(png_ptr); png_io_t *f = png_get_io_ptr(png_ptr);
if (length > (f->bufsize - f->current_pos)) if (length > (f->size - f->position))
png_error(png_ptr, "PNG_IOReader: buffer overrun"); png_error(png_ptr, "PNG_IOReader: buffer overrun");
memcpy(data, f->buffer + f->current_pos, length); memcpy(data, f->buffer + f->position, length);
f->current_pos += length; f->position += length;
} }
typedef struct typedef struct
@ -2899,10 +2904,10 @@ static png_bytep *PNG_Read(const UINT8 *png, UINT16 *w, UINT16 *h, INT16 *topoff
png_memcpy(png_jmpbuf(png_ptr), jmpbuf, sizeof jmp_buf); png_memcpy(png_jmpbuf(png_ptr), jmpbuf, sizeof jmp_buf);
#endif #endif
// set our own read_function // set our own read function
png_io.buffer = (png_const_bytep)png; png_io.buffer = png;
png_io.bufsize = size; png_io.size = size;
png_io.current_pos = 0; png_io.position = 0;
png_set_read_fn(png_ptr, &png_io, PNG_IOReader); png_set_read_fn(png_ptr, &png_io, PNG_IOReader);
memset(&chunk, 0x00, sizeof(png_chunk_t)); memset(&chunk, 0x00, sizeof(png_chunk_t));
@ -3069,10 +3074,10 @@ boolean R_PNGDimensions(UINT8 *png, INT16 *width, INT16 *height, size_t size)
png_memcpy(png_jmpbuf(png_ptr), jmpbuf, sizeof jmp_buf); png_memcpy(png_jmpbuf(png_ptr), jmpbuf, sizeof jmp_buf);
#endif #endif
// set our own read_function // set our own read function
png_io.buffer = (png_bytep)png; png_io.buffer = png;
png_io.bufsize = size; png_io.size = size;
png_io.current_pos = 0; png_io.position = 0;
png_set_read_fn(png_ptr, &png_io, PNG_IOReader); png_set_read_fn(png_ptr, &png_io, PNG_IOReader);
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_SET_USER_LIMITS_SUPPORTED

View file

@ -1531,7 +1531,10 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
if (!lumpcache[lump]) if (!lumpcache[lump])
{ {
size_t len = W_LumpLengthPwad(wad, lump); size_t len = W_LumpLengthPwad(wad, lump);
void *ptr, *lumpdata, *srcdata = NULL; void *ptr, *lumpdata;
#ifndef NO_PNG_LUMPS
void *srcdata = NULL;
#endif
ptr = Z_Malloc(len, tag, &lumpcache[lump]); ptr = Z_Malloc(len, tag, &lumpcache[lump]);
lumpdata = Z_Malloc(len, tag, NULL); lumpdata = Z_Malloc(len, tag, NULL);

View file

@ -143,9 +143,21 @@ static patch_t *widebgpatch = NULL; // INTERSCW
static patch_t *bgtile = NULL; // SPECTILE/SRB2BACK static patch_t *bgtile = NULL; // SPECTILE/SRB2BACK
static patch_t *interpic = NULL; // custom picture defined in map header static patch_t *interpic = NULL; // custom picture defined in map header
static boolean usetile; static boolean usetile;
static INT32 timer;
typedef struct
{
INT32 source_width, source_height;
INT32 source_bpp, source_rowbytes;
UINT8 *source_picture;
INT32 target_width, target_height;
INT32 target_bpp, target_rowbytes;
UINT8 *target_picture;
} y_buffer_t;
boolean usebuffer = false; boolean usebuffer = false;
static boolean useinterpic; static boolean useinterpic;
static INT32 timer; static y_buffer_t *y_buffer;
static INT32 intertic; static INT32 intertic;
static INT32 tallydonetic = -1; static INT32 tallydonetic = -1;
@ -153,6 +165,8 @@ static INT32 endtic = -1;
intertype_t intertype = int_none; intertype_t intertype = int_none;
static void Y_RescaleScreenBuffer(void);
static void Y_CleanupScreenBuffer(void);
static void Y_AwardCoopBonuses(void); static void Y_AwardCoopBonuses(void);
static void Y_AwardSpecialStageBonus(void); static void Y_AwardSpecialStageBonus(void);
static void Y_CalculateCompetitionWinners(void); static void Y_CalculateCompetitionWinners(void);
@ -207,6 +221,94 @@ static void Y_IntermissionTokenDrawer(void)
V_DrawCroppedPatch(32<<FRACBITS, y<<FRACBITS, FRACUNIT/2, 0, tokenicon, 0, 0, SHORT(tokenicon->width), calc); V_DrawCroppedPatch(32<<FRACBITS, y<<FRACBITS, FRACUNIT/2, 0, tokenicon, 0, 0, SHORT(tokenicon->width), calc);
} }
//
// Y_ConsiderScreenBuffer
//
// Can we copy the current screen
// to a buffer?
//
void Y_ConsiderScreenBuffer(void)
{
if (gameaction != ga_completed)
return;
if (y_buffer == NULL)
y_buffer = Z_Calloc(sizeof(y_buffer_t), PU_STATIC, NULL);
else
return;
y_buffer->source_width = vid.width;
y_buffer->source_height = vid.height;
y_buffer->source_bpp = vid.bpp;
y_buffer->source_rowbytes = vid.rowbytes;
y_buffer->source_picture = ZZ_Alloc(y_buffer->source_width*vid.bpp * y_buffer->source_height);
VID_BlitLinearScreen(screens[1], y_buffer->source_picture, vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
// Make the rescaled screen buffer
Y_RescaleScreenBuffer();
}
//
// Y_RescaleScreenBuffer
//
// Write the rescaled source picture,
// to the destination picture that
// has the current screen's resolutions.
//
static void Y_RescaleScreenBuffer(void)
{
INT32 sx, sy; // source
INT32 dx, dy; // dest
fixed_t scalefac, yscalefac;
fixed_t rowfrac, colfrac;
UINT8 *dest;
// Who knows?
if (y_buffer == NULL)
return;
if (y_buffer->target_picture)
Z_Free(y_buffer->target_picture);
y_buffer->target_width = vid.width;
y_buffer->target_height = vid.height;
y_buffer->target_rowbytes = vid.rowbytes;
y_buffer->target_bpp = vid.bpp;
y_buffer->target_picture = ZZ_Alloc(y_buffer->target_width*vid.bpp * y_buffer->target_height);
dest = y_buffer->target_picture;
scalefac = FixedDiv(y_buffer->target_width*FRACUNIT, y_buffer->source_width*FRACUNIT);
yscalefac = FixedDiv(y_buffer->target_height*FRACUNIT, y_buffer->source_height*FRACUNIT);
rowfrac = FixedDiv(FRACUNIT, yscalefac);
colfrac = FixedDiv(FRACUNIT, scalefac);
for (sy = 0, dy = 0; sy < (y_buffer->source_height << FRACBITS) && dy < y_buffer->target_height; sy += rowfrac, dy++)
for (sx = 0, dx = 0; sx < (y_buffer->source_width << FRACBITS) && dx < y_buffer->target_width; sx += colfrac, dx += y_buffer->target_bpp)
dest[(dy * y_buffer->target_rowbytes) + dx] = y_buffer->source_picture[((sy>>FRACBITS) * y_buffer->source_width) + (sx>>FRACBITS)];
}
//
// Y_CleanupScreenBuffer
//
// Free all related memory.
//
static void Y_CleanupScreenBuffer(void)
{
// Who knows?
if (y_buffer == NULL)
return;
if (y_buffer->target_picture)
Z_Free(y_buffer->target_picture);
if (y_buffer->source_picture)
Z_Free(y_buffer->source_picture);
Z_Free(y_buffer);
y_buffer = NULL;
}
// //
// Y_IntermissionDrawer // Y_IntermissionDrawer
// //
@ -229,12 +331,23 @@ void Y_IntermissionDrawer(void)
else if (!usetile) else if (!usetile)
{ {
if (rendermode == render_soft && usebuffer) if (rendermode == render_soft && usebuffer)
VID_BlitLinearScreen(screens[1], screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
#ifdef HWRENDER
else if(rendermode != render_soft && usebuffer)
{ {
HWR_DrawIntermissionBG(); // no y_buffer
if (y_buffer == NULL)
VID_BlitLinearScreen(screens[1], screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
else
{
// Maybe the resolution changed?
if ((y_buffer->target_width != vid.width) || (y_buffer->target_height != vid.height))
Y_RescaleScreenBuffer();
// Blit the already-scaled screen buffer to the current screen
VID_BlitLinearScreen(y_buffer->target_picture, screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
}
} }
#ifdef HWRENDER
else if (rendermode != render_soft && usebuffer)
HWR_DrawIntermissionBG();
#endif #endif
else else
{ {
@ -425,11 +538,23 @@ void Y_IntermissionDrawer(void)
UINT8 continues = data.spec.continues & 0x7F; UINT8 continues = data.spec.continues & 0x7F;
V_DrawScaledPatch(152 + xoffset5, 150+yoffset, 0, data.spec.pcontinues); V_DrawScaledPatch(152 + xoffset5, 150+yoffset, 0, data.spec.pcontinues);
for (i = 0; i < continues; ++i) if (continues > 5)
{ {
if ((data.spec.continues & 0x80) && i == continues-1 && (endtic < 0 || intertic%20 < 10)) INT32 leftx = (continues >= 10) ? 216 : 224;
break; V_DrawContinueIcon(leftx + xoffset5, 162+yoffset, 0, *data.spec.playerchar, *data.spec.playercolor);
V_DrawContinueIcon(246 + xoffset5 - (i*20), 162+yoffset, 0, *data.spec.playerchar, *data.spec.playercolor); V_DrawScaledPatch(leftx + xoffset5 + 12, 160+yoffset, 0, stlivex);
if (!((data.spec.continues & 0x80) && !(endtic < 0 || intertic%20 < 10)))
V_DrawRightAlignedString(252 + xoffset5, 158+yoffset, 0,
va("%d",(((data.spec.continues & 0x80) && (endtic < 0)) ? continues-1 : continues)));
}
else
{
for (i = 0; i < continues; ++i)
{
if ((data.spec.continues & 0x80) && i == continues-1 && (endtic < 0 || intertic%20 < 10))
break;
V_DrawContinueIcon(246 + xoffset5 - (i*20), 162+yoffset, 0, *data.spec.playerchar, *data.spec.playercolor);
}
} }
} }
} }
@ -2096,6 +2221,8 @@ static void Y_UnloadData(void)
if (rendermode != render_soft) if (rendermode != render_soft)
return; return;
Y_CleanupScreenBuffer();
// unload the background patches // unload the background patches
UNLOAD(bgpatch); UNLOAD(bgpatch);
UNLOAD(widebgpatch); UNLOAD(widebgpatch);

View file

@ -15,6 +15,7 @@ void Y_IntermissionDrawer(void);
void Y_Ticker(void); void Y_Ticker(void);
void Y_StartIntermission(void); void Y_StartIntermission(void);
void Y_EndIntermission(void); void Y_EndIntermission(void);
void Y_ConsiderScreenBuffer(void);
typedef enum typedef enum
{ {