mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
Merge branch 'master' into spinny-sign
This commit is contained in:
commit
bd9878eb48
14 changed files with 206 additions and 56 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
41
src/r_data.c
41
src/r_data.c
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
133
src/y_inter.c
133
src/y_inter.c
|
@ -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)
|
||||
{
|
||||
// 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,6 +538,17 @@ void Y_IntermissionDrawer(void)
|
|||
UINT8 continues = data.spec.continues & 0x7F;
|
||||
|
||||
V_DrawScaledPatch(152 + xoffset5, 150+yoffset, 0, data.spec.pcontinues);
|
||||
if (continues > 5)
|
||||
{
|
||||
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))
|
||||
|
@ -433,6 +557,7 @@ void Y_IntermissionDrawer(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw the emeralds
|
||||
//if (intertic & 1)
|
||||
|
@ -2096,6 +2221,8 @@ static void Y_UnloadData(void)
|
|||
if (rendermode != render_soft)
|
||||
return;
|
||||
|
||||
Y_CleanupScreenBuffer();
|
||||
|
||||
// unload the background patches
|
||||
UNLOAD(bgpatch);
|
||||
UNLOAD(widebgpatch);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue