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
if (vid.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
if (setsizeneeded)
@ -415,6 +422,7 @@ static void D_Display(void)
if (rendermode == render_soft)
{
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
Y_ConsiderScreenBuffer();
usebuffer = true;
}
lastdraw = false;

View File

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

View File

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

View File

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

View File

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

View File

@ -2307,7 +2307,7 @@ void M_InitMenuPresTables(void)
strncpy(menupres[i].musname, "_recat", 7);
else if (i == MN_SP_NIGHTSATTACK)
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);
}
}
@ -8723,6 +8723,10 @@ void M_DrawTimeAttackMenu(void)
char beststr[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);
// A 160x100 image of the level as entry MAPxxP

View File

@ -2459,7 +2459,7 @@ void T_RaiseSector(levelspecthink_t *raise)
break;
}
}
if (raise->vars[9]) // Dynamically Sinking Platform^tm
{
#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)
return true;
if (thing == tmthing->tracer) // don't collide with rider
return true;
@ -1054,7 +1054,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
P_KillMobj(thing, tmthing, tmthing->tracer, 0);
return true;
}
if (thing->type == tmthing->type // bounce against other rollout rocks
&& (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[4] = airbob->vars[5]
- (sec->ceilingheight - sec->floorheight);
airbob->vars[9] = dynamic ? 1 : 0;
airbob->sourceline = sourceline;

View File

@ -1096,7 +1096,7 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
// Spinning.
if (player->pflags & PF_SPINNING)
return true;
if (player->dashmode >= DASHMODE_THRESHOLD && (player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE))
return true;
@ -7820,7 +7820,7 @@ static void P_MovePlayer(player_t *player)
if (!(player->powers[pw_nocontrol] & (1<<15)))
player->pflags |= PF_JUMPSTASIS;
}
if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING)
{
player->pflags |= PF_STASIS;
@ -10978,19 +10978,19 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
tic_t dashmode = player->dashmode;
boolean underwater = mo->eflags & MFE_UNDERWATER;
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 (stat != fume->info->spawnstate)
P_SetMobjState(fume, fume->info->spawnstate);
return;
}
if (underwater) // No fume underwater; spawn bubbles instead!
{
fume->movedir += FixedAngle(FixedDiv(2 * player->speed, 3 * mo->scale));
fume->movefactor += player->speed;
if (fume->movefactor > FixedDiv(2 * player->normalspeed, 3 * mo->scale))
{
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 factorY = P_ReturnThrustY(mo, angle + ANGLE_90, mo->scale);
fixed_t offsetH, offsetV, x, y, z;
for (i = -1; i < 2; i += 2)
{
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;
P_SpawnMobj(x, y, z, MT_SMALLBUBBLE)->scale = mo->scale >> 1;
}
fume->movefactor = 0;
}
if (panim == PA_WALK)
{
if (stat != fume->info->spawnstate)
@ -11021,13 +11021,13 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
return;
}
}
if (stat == fume->info->spawnstate) // If currently inivisble, activate!
{
P_SetMobjState(fume, (stat = fume->info->seestate));
P_SetScale(fume, mo->scale);
}
if (dashmode > DASHMODE_THRESHOLD && stat != fume->info->seestate) // If in dashmode, grow really big and flash
{
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->destscale = (mo->scale + FixedDiv(player->speed, player->normalspeed)) / (underwater ? 6 : 3);
fume->color = FUME_SKINCOLORS[(dashmode * sizeof(FUME_SKINCOLORS)) / (DASHMODE_MAX + 1)];
if (underwater)
{
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->eflags = (fume->eflags & ~MFE_VERTICALFLIP) | (mo->eflags & MFE_VERTICALFLIP); // Make sure to flip in reverse gravity!
// Finally, set its position
dist = -mo->radius - FixedMul(fume->info->radius, fume->destscale - mo->scale/3);
P_UnsetThingPosition(fume);
fume->x = mo->x + P_ReturnThrustX(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;
lumpnum_t lumpnum = texstart + j;
#ifndef NO_PNG_LUMPS
size_t lumplength;
#endif
if (wadfiles[w]->type == RET_PK3)
{
@ -839,8 +841,10 @@ void R_LoadTextures(void)
continue; // If it is then SKIP IT
}
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
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);
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
#if PNG_LIBPNG_VER_DLLNUM < 14
/*#if PNG_LIBPNG_VER_DLLNUM < 14
typedef PNG_CONST png_byte *png_const_bytep;
#endif
typedef struct {
png_const_bytep buffer;
png_uint_32 bufsize;
png_uint_32 current_pos;
#endif*/
typedef struct
{
const UINT8 *buffer;
UINT32 size;
UINT32 position;
} png_io_t;
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);
if (length > (f->bufsize - f->current_pos))
if (length > (f->size - f->position))
png_error(png_ptr, "PNG_IOReader: buffer overrun");
memcpy(data, f->buffer + f->current_pos, length);
f->current_pos += length;
memcpy(data, f->buffer + f->position, length);
f->position += length;
}
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);
#endif
// set our own read_function
png_io.buffer = (png_const_bytep)png;
png_io.bufsize = size;
png_io.current_pos = 0;
// set our own read function
png_io.buffer = png;
png_io.size = size;
png_io.position = 0;
png_set_read_fn(png_ptr, &png_io, PNG_IOReader);
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);
#endif
// set our own read_function
png_io.buffer = (png_bytep)png;
png_io.bufsize = size;
png_io.current_pos = 0;
// set our own read function
png_io.buffer = png;
png_io.size = size;
png_io.position = 0;
png_set_read_fn(png_ptr, &png_io, PNG_IOReader);
#ifdef PNG_SET_USER_LIMITS_SUPPORTED

View File

@ -1531,7 +1531,10 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
if (!lumpcache[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]);
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 *interpic = NULL; // custom picture defined in map header
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;
static boolean useinterpic;
static INT32 timer;
static y_buffer_t *y_buffer;
static INT32 intertic;
static INT32 tallydonetic = -1;
@ -153,6 +165,8 @@ static INT32 endtic = -1;
intertype_t intertype = int_none;
static void Y_RescaleScreenBuffer(void);
static void Y_CleanupScreenBuffer(void);
static void Y_AwardCoopBonuses(void);
static void Y_AwardSpecialStageBonus(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);
}
//
// 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
//
@ -229,12 +331,23 @@ void Y_IntermissionDrawer(void)
else if (!usetile)
{
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
else
{
@ -425,11 +538,23 @@ void Y_IntermissionDrawer(void)
UINT8 continues = data.spec.continues & 0x7F;
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))
break;
V_DrawContinueIcon(246 + xoffset5 - (i*20), 162+yoffset, 0, *data.spec.playerchar, *data.spec.playercolor);
INT32 leftx = (continues >= 10) ? 216 : 224;
V_DrawContinueIcon(leftx + xoffset5, 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)
return;
Y_CleanupScreenBuffer();
// unload the background patches
UNLOAD(bgpatch);
UNLOAD(widebgpatch);

View File

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