Merge branch 'next' into mobjthinker-refactoring

This commit is contained in:
Alam Ed Arias 2019-12-26 14:50:35 -05:00
commit e823441e31
33 changed files with 705 additions and 302 deletions

View File

@ -274,7 +274,10 @@ static void D_Display(void)
&& wipetypepre != UINT8_MAX)
{
F_WipeStartScreen();
F_WipeColorFill(31);
// Check for Mega Genesis fade
wipestyleflags = WSF_FADEOUT;
if (F_TryColormapFade(31))
wipetypepost = -1; // Don't run the fade below this one
F_WipeEndScreen();
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
}
@ -488,6 +491,7 @@ static void D_Display(void)
if (rendermode != render_none)
{
F_WipeEndScreen();
// Funny.
if (WipeStageTitle && st_overlay)
{
@ -497,6 +501,14 @@ static void D_Display(void)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeStartScreen();
}
// Check for Mega Genesis fade
if (F_ShouldColormapFade())
{
wipestyleflags |= WSF_FADEIN;
wipestyleflags &= ~WSF_FADEOUT;
}
F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
}
@ -562,9 +574,6 @@ void D_SRB2Loop(void)
// Pushing of + parameters is now done back in D_SRB2Main, not here.
CONS_Printf("I_StartupKeyboard()...\n");
I_StartupKeyboard();
#ifdef _WINDOWS
CONS_Printf("I_StartupMouse()...\n");
I_DoStartupMouse();
@ -1288,9 +1297,10 @@ void D_SRB2Main(void)
I_StartupSound();
I_InitMusic();
S_InitSfxChannels(cv_soundvolume.value);
S_InitMusicDefs();
}
S_InitMusicDefs();
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();

View File

@ -1520,10 +1520,27 @@ static void readlevelheader(MYFILE *f, INT32 num)
deh_warning("Level header %d: invalid bonus type number %d", num, i);
}
// Title card
else if (fastcmp(word, "TITLECARDZIGZAG"))
{
deh_strlcpy(mapheaderinfo[num-1]->ltzzpatch, word2,
sizeof(mapheaderinfo[num-1]->ltzzpatch), va("Level header %d: title card zigzag patch name", num));
}
else if (fastcmp(word, "TITLECARDZIGZAGTEXT"))
{
deh_strlcpy(mapheaderinfo[num-1]->ltzztext, word2,
sizeof(mapheaderinfo[num-1]->ltzztext), va("Level header %d: title card zigzag text patch name", num));
}
else if (fastcmp(word, "TITLECARDACTDIAMOND"))
{
deh_strlcpy(mapheaderinfo[num-1]->ltactdiamond, word2,
sizeof(mapheaderinfo[num-1]->ltactdiamond), va("Level header %d: title card act diamond patch name", num));
}
else if (fastcmp(word, "MAXBONUSLIVES"))
mapheaderinfo[num-1]->maxbonuslives = (SINT8)i;
else if (fastcmp(word, "LEVELFLAGS"))
mapheaderinfo[num-1]->levelflags = (UINT8)i;
mapheaderinfo[num-1]->levelflags = (UINT16)i;
else if (fastcmp(word, "MENUFLAGS"))
mapheaderinfo[num-1]->menuflags = (UINT8)i;
@ -4462,20 +4479,34 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
ignorelines(f);
}
}
// Last I heard this crashes the game if you try to use it
// so this is disabled for now
// -- Monster Iestyn
/* else if (fastcmp(word, "SRB2"))
else if (fastcmp(word, "SRB2"))
{
INT32 ver = searchvalue(strtok(NULL, "\n"));
if (ver != PATCHVERSION)
deh_warning("Patch is for SRB2 version %d,\nonly version %d is supported", ver, PATCHVERSION);
if (isdigit(word2[0]))
{
i = atoi(word2);
if (i != PATCHVERSION)
{
deh_warning(
"Patch is for SRB2 version %d, "
"only version %d is supported",
i,
PATCHVERSION
);
}
}
else
{
deh_warning(
"SRB2 version definition has incorrect format, "
"use \"SRB2 %d\"",
PATCHVERSION
);
}
}
// Clear all data in certain locations (mostly for unlocks)
// Unless you REALLY want to piss people off,
// define a custom gamedata /before/ doing this!!
// (then again, modifiedgame will prevent game data saving anyway)
*/
else if (fastcmp(word, "CLEAR"))
{
boolean clearall = (fastcmp(word2, "ALL"));

View File

@ -47,7 +47,7 @@ extern const char *superactions[MAXRECURSION];
extern UINT8 superstack;
// If the dehacked patch does not match this version, we throw a warning
#define PATCHVERSION 210
#define PATCHVERSION 220
#define MAXLINELEN 1024

View File

@ -127,6 +127,7 @@
#ifdef LOGMESSAGES
extern FILE *logstream;
extern char logfilename[1024];
#endif
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3

View File

@ -310,12 +310,17 @@ typedef struct
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
SINT8 maxbonuslives; ///< How many bonus lives to award at Intermission? (-1 for unlimited.)
UINT8 levelflags; ///< LF_flags: merged booleans into one UINT8 for space, see below
UINT16 levelflags; ///< LF_flags: merged booleans into one UINT16 for space, see below
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
char selectheading[22]; ///< Level select heading. Allows for controllable grouping.
UINT16 startrings; ///< Number of rings players start with.
// Title card.
char ltzzpatch[8]; ///< Zig zag patch.
char ltzztext[8]; ///< Zig zag text.
char ltactdiamond[8]; ///< Act diamond.
// Freed animals stuff.
UINT8 numFlickies; ///< Internal. For freed flicky support.
mobjtype_t *flickies; ///< List of freeable flickies in this level. Allocated dynamically for space reasons. Be careful.

View File

@ -917,8 +917,9 @@ void F_IntroDrawer(void)
{
if (rendermode != render_none)
{
wipestyleflags = WSF_FADEOUT;
F_WipeStartScreen();
F_WipeColorFill(31);
F_TryColormapFade(31);
F_WipeEndScreen();
F_RunWipe(99,true);
}
@ -927,12 +928,11 @@ void F_IntroDrawer(void)
}
else if (intro_scenenum == 10)
{
// The only fade to white in the entire damn game.
// (not true)
if (rendermode != render_none)
{
wipestyleflags = (WSF_FADEOUT|WSF_TOWHITE);
F_WipeStartScreen();
F_WipeColorFill(0);
F_TryColormapFade(0);
F_WipeEndScreen();
F_RunWipe(99,true);
}
@ -941,8 +941,9 @@ void F_IntroDrawer(void)
{
if (rendermode != render_none)
{
wipestyleflags = WSF_FADEOUT;
F_WipeStartScreen();
F_WipeColorFill(31);
F_TryColormapFade(31);
F_WipeEndScreen();
F_RunWipe(99,true);
}
@ -977,6 +978,7 @@ void F_IntroDrawer(void)
F_WipeStartScreen();
wipegamestate = -1;
wipestyleflags = WSF_CROSSFADE;
animtimer = stoptimer = 0;
}
@ -3596,6 +3598,8 @@ void F_StartContinue(void)
return;
}
wipestyleflags = WSF_FADEOUT;
F_TryColormapFade(31);
G_SetGamestate(GS_CONTINUING);
gameaction = ga_nothing;

View File

@ -146,7 +146,7 @@ extern boolean WipeStageTitle;
typedef enum
{
WIPESTYLE_NORMAL,
WIPESTYLE_LEVEL
WIPESTYLE_COLORMAP
} wipestyle_t;
extern wipestyle_t wipestyle;
@ -159,6 +159,11 @@ typedef enum
} wipestyleflags_t;
extern wipestyleflags_t wipestyleflags;
// Even my function names are borderline
boolean F_ShouldColormapFade(void);
boolean F_TryColormapFade(UINT8 wipecolor);
void F_DecideWipeStyle(void);
#define FADECOLORMAPDIV 8
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)

View File

@ -56,7 +56,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
0, // wipe_level_toblack
UINT8_MAX, // wipe_intermission_toblack
UINT8_MAX, // wipe_continuing_toblack
0, // wipe_continuing_toblack
0, // wipe_titlescreen_toblack
0, // wipe_timeattack_toblack
99, // wipe_credits_toblack
@ -161,7 +161,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
{
// Determine pixel to use from fademask
pcolor = &pMasterPalette[*lump++];
if (wipestyle == WIPESTYLE_LEVEL)
if (wipestyle == WIPESTYLE_COLORMAP)
*mask++ = pcolor->s.red / FADECOLORMAPDIV;
else
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
@ -191,7 +191,7 @@ void F_WipeStageTitle(void)
{
// draw level title
if ((WipeStageTitle && st_overlay)
&& (wipestyle == WIPESTYLE_LEVEL)
&& (wipestyle == WIPESTYLE_COLORMAP)
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
{
@ -282,7 +282,7 @@ static void F_DoWipe(fademask_t *fademask)
relativepos += vid.width;
}
}
else if (*mask >= ((wipestyle == WIPESTYLE_LEVEL) ? FADECOLORMAPROWS : 10))
else if (*mask >= 10)
{
// shortcut - memcpy target to work
while (draw_linestogo--)
@ -293,25 +293,8 @@ static void F_DoWipe(fademask_t *fademask)
}
else
{
if (wipestyle == WIPESTYLE_LEVEL)
{
int nmask;
UINT8 *fade = fadecolormap;
if (wipestyleflags & WSF_TOWHITE)
fade = fadecolormap + (FADECOLORMAPROWS * 256);
nmask = *mask;
if (wipestyleflags & WSF_FADEIN)
nmask = (FADECOLORMAPROWS-1) - nmask;
transtbl = fade + (nmask * 256);
}
else
{
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
}
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
// DRAWING LOOP
while (draw_linestogo--)
@ -321,16 +304,113 @@ static void F_DoWipe(fademask_t *fademask)
e = e_base + relativepos;
draw_rowstogo = draw_rowend - draw_rowstart;
if (wipestyle == WIPESTYLE_LEVEL)
{
while (draw_rowstogo--)
*w++ = transtbl[*e++];
}
else
{
while (draw_rowstogo--)
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
}
while (draw_rowstogo--)
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
relativepos += vid.width;
}
// END DRAWING LOOP
}
if (++maskx >= fademask->width)
++masky, maskx = 0;
} while (++mask < maskend);
free(scrxpos);
free(scrypos);
}
}
static void F_DoColormapWipe(fademask_t *fademask, UINT8 *colormap)
{
// Lactozilla: F_DoWipe for WIPESTYLE_COLORMAP
{
// wipe screen, start, end
UINT8 *w = wipe_scr;
const UINT8 *s = wipe_scr_start;
const UINT8 *e = wipe_scr_end;
// first pixel for each screen
UINT8 *w_base = w;
const UINT8 *s_base = s;
const UINT8 *e_base = e;
// mask data, end
UINT8 *transtbl;
const UINT8 *mask = fademask->mask;
const UINT8 *maskend = mask + fademask->size;
// rectangle draw hints
UINT32 draw_linestart, draw_rowstart;
UINT32 draw_lineend, draw_rowend;
UINT32 draw_linestogo, draw_rowstogo;
// rectangle coordinates, etc.
UINT16* scrxpos = (UINT16*)malloc((fademask->width + 1) * sizeof(UINT16));
UINT16* scrypos = (UINT16*)malloc((fademask->height + 1) * sizeof(UINT16));
UINT16 maskx, masky;
UINT32 relativepos;
// ---
// Screw it, we do the fixed point math ourselves up front.
scrxpos[0] = 0;
for (relativepos = 0, maskx = 1; maskx < fademask->width; ++maskx)
scrxpos[maskx] = (relativepos += fademask->xscale)>>FRACBITS;
scrxpos[fademask->width] = vid.width;
scrypos[0] = 0;
for (relativepos = 0, masky = 1; masky < fademask->height; ++masky)
scrypos[masky] = (relativepos += fademask->yscale)>>FRACBITS;
scrypos[fademask->height] = vid.height;
// ---
maskx = masky = 0;
do
{
draw_rowstart = scrxpos[maskx];
draw_rowend = scrxpos[maskx + 1];
draw_linestart = scrypos[masky];
draw_lineend = scrypos[masky + 1];
relativepos = (draw_linestart * vid.width) + draw_rowstart;
draw_linestogo = draw_lineend - draw_linestart;
if (*mask == 0)
{
// shortcut - memcpy source to work
while (draw_linestogo--)
{
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
relativepos += vid.width;
}
}
else if (*mask >= FADECOLORMAPROWS)
{
// shortcut - memcpy target to work
while (draw_linestogo--)
{
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
relativepos += vid.width;
}
}
else
{
int nmask = *mask;
if (wipestyleflags & WSF_FADEIN)
nmask = (FADECOLORMAPROWS-1) - nmask;
transtbl = colormap + (nmask * 256);
// DRAWING LOOP
while (draw_linestogo--)
{
w = w_base + relativepos;
s = s_base + relativepos;
e = e_base + relativepos;
draw_rowstogo = draw_rowend - draw_rowstart;
while (draw_rowstogo--)
*w++ = transtbl[*e++];
relativepos += vid.width;
}
@ -382,6 +462,62 @@ void F_WipeEndScreen(void)
#endif
}
/** Verifies every condition for a colormapped fade.
*/
boolean F_ShouldColormapFade(void)
{
if ((wipestyleflags & (WSF_FADEIN|WSF_FADEOUT)) // only if one of those wipestyleflags are actually set
&& !(wipestyleflags & WSF_CROSSFADE)) // and if not crossfading
{
// World
return (gamestate == GS_LEVEL
|| gamestate == GS_TITLESCREEN
// Finales
|| gamestate == GS_CONTINUING
|| gamestate == GS_CREDITS
|| gamestate == GS_EVALUATION
|| gamestate == GS_INTRO
|| gamestate == GS_ENDING
// Menus
|| gamestate == GS_TIMEATTACK);
}
return false;
}
/** Decides what wipe style to use.
*/
void F_DecideWipeStyle(void)
{
// Set default wipe style
wipestyle = WIPESTYLE_NORMAL;
// Check for colormap wipe style
if (F_ShouldColormapFade())
wipestyle = WIPESTYLE_COLORMAP;
}
/** Attempt to run a colormap fade,
provided all the conditionals were properly met.
Returns true if so.
I demand you call F_RunWipe after this function.
*/
boolean F_TryColormapFade(UINT8 wipecolor)
{
if (F_ShouldColormapFade())
{
#ifdef HWRENDER
if (rendermode == render_opengl)
F_WipeColorFill(wipecolor);
#endif
return true;
}
else
{
F_WipeColorFill(wipecolor);
return false;
}
}
/** After setting up the screens you want to wipe,
* calling this will do a 'typical' wipe.
*/
@ -399,18 +535,10 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
paldiv = FixedDiv(257<<FRACBITS, 11<<FRACBITS);
// Init the wipe
F_DecideWipeStyle();
WipeInAction = true;
wipe_scr = screens[0];
// don't know where else to put this.
// this any good?
if ((gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN)
&& (wipestyleflags & (WSF_FADEIN|WSF_FADEOUT)) // only if one of those wipestyleflags are actually set
&& !(wipestyleflags & WSF_CROSSFADE)) // and if not crossfading
wipestyle = WIPESTYLE_LEVEL;
else
wipestyle = WIPESTYLE_NORMAL;
// lastwipetic should either be 0 or the tic we last wiped
// on for fade-to-black
for (;;)
@ -425,21 +553,39 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
I_Sleep();
lastwipetic = nowtime;
#ifdef HWRENDER
if (rendermode == render_opengl)
// Wipe styles
if (wipestyle == WIPESTYLE_COLORMAP)
{
// send in the wipe type and wipe frame because we need to cache the graphic
if (wipestyle == WIPESTYLE_LEVEL)
#ifdef HWRENDER
if (rendermode == render_opengl)
{
// send in the wipe type and wipe frame because we need to cache the graphic
HWR_DoTintedWipe(wipetype, wipeframe-1);
}
else
HWR_DoWipe(wipetype, wipeframe-1);
#endif
{
UINT8 *colormap = fadecolormap;
if (wipestyleflags & WSF_TOWHITE)
colormap += (FADECOLORMAPROWS * 256);
F_DoColormapWipe(fmask, colormap);
}
// Draw the title card above the wipe
F_WipeStageTitle();
}
else
{
#ifdef HWRENDER
if (rendermode == render_opengl)
{
// send in the wipe type and wipe frame because we need to cache the graphic
HWR_DoWipe(wipetype, wipeframe-1);
}
else
#endif
F_DoWipe(fmask);
if (wipestyle == WIPESTYLE_LEVEL)
F_WipeStageTitle();
F_DoWipe(fmask);
}
I_OsPolling();
I_UpdateNoBlit();

View File

@ -1883,9 +1883,6 @@ void G_DoLoadLevel(boolean resetplayer)
//
void G_StartTitleCard(void)
{
wipestyleflags |= WSF_FADEIN;
wipestyleflags &= ~WSF_FADEOUT;
// The title card has been disabled for this map.
// Oh well.
if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
@ -1929,6 +1926,8 @@ void G_PreLevelTitleCard(void)
if (takescreenshot) // Only take screenshots after drawing.
M_DoScreenShot();
}
if (!cv_showhud.value)
wipestyleflags = WSF_CROSSFADE;
}
INT32 pausedelay = 0;

View File

@ -963,7 +963,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
{
grmip = grmip->nextcolormap;
if (grmip->colormap == colormap || grmip->tcindex == skinnum)
if (grmip->colormap == colormap || (skinnum < TC_DEFAULT && grmip->tcindex == skinnum))
{
if (grmip->downloaded && grmip->grInfo.data)
{

View File

@ -184,10 +184,6 @@ void I_StartupMouse(void);
*/
void I_StartupMouse2(void);
/** \brief keyboard startup, shutdown, handler
*/
void I_StartupKeyboard(void);
/** \brief setup timer irq and user timer routine.
*/
void I_StartupTimer(void);

View File

@ -657,14 +657,16 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
LUA_PushUserdata(gL, inflictor, META_MOBJ);
LUA_PushUserdata(gL, source, META_MOBJ);
lua_pushinteger(gL, damage);
lua_pushinteger(gL, damagetype);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
if (lua_pcall(gL, 4, 1, 0)) {
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
if (lua_pcall(gL, 5, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
@ -745,14 +747,16 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
LUA_PushUserdata(gL, inflictor, META_MOBJ);
LUA_PushUserdata(gL, source, META_MOBJ);
lua_pushinteger(gL, damage);
lua_pushinteger(gL, damagetype);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
if (lua_pcall(gL, 4, 1, 0)) {
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
if (lua_pcall(gL, 5, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
@ -823,13 +827,15 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8
LUA_PushUserdata(gL, target, META_MOBJ);
LUA_PushUserdata(gL, inflictor, META_MOBJ);
LUA_PushUserdata(gL, source, META_MOBJ);
lua_pushinteger(gL, damagetype);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -4);
lua_pushvalue(gL, -4);
lua_pushvalue(gL, -4);
if (lua_pcall(gL, 3, 1, 0)) {
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
if (lua_pcall(gL, 4, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);

View File

@ -2071,6 +2071,12 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->levelselect);
else if (fastcmp(field,"bonustype"))
lua_pushinteger(L, header->bonustype);
else if (fastcmp(field,"ltzzpatch"))
lua_pushstring(L, header->ltzzpatch);
else if (fastcmp(field,"ltzztext"))
lua_pushstring(L, header->ltzztext);
else if (fastcmp(field,"ltactdiamond"))
lua_pushstring(L, header->ltactdiamond);
else if (fastcmp(field,"maxbonuslives"))
lua_pushinteger(L, header->maxbonuslives);
else if (fastcmp(field,"levelflags"))

View File

@ -20,6 +20,10 @@
#include "i_video.h"
#include "m_misc.h"
#ifdef HWRENDER
#include "hardware/hw_main.h"
#endif
// GIFs are always little-endian
#include "byteptr.h"
@ -29,6 +33,7 @@ consvar_t cv_gif_downscale = {"gif_downscale", "On", CV_SAVE, CV_OnOff, NULL, 0
#ifdef HAVE_ANIGIF
static boolean gif_optimize = false; // So nobody can do something dumb
static boolean gif_downscale = false; // like changing cvars mid output
static RGBA_t *gif_palette = NULL;
static FILE *gif_out = NULL;
static INT32 gif_frames = 0;
@ -428,10 +433,7 @@ static void GIF_headwrite(void)
// write color table
{
RGBA_t *pal = ((cv_screenshot_colorprofile.value)
? pLocalPalette
: pMasterPalette);
RGBA_t *pal = gif_palette;
for (i = 0; i < 256; i++)
{
WRITEUINT8(p, pal[i].s.red);
@ -457,6 +459,32 @@ const UINT8 gifframe_gchead[4] = {0x21,0xF9,0x04,0x04}; // GCE, bytes, packed by
static UINT8 *gifframe_data = NULL;
static size_t gifframe_size = 8192;
#ifdef HWRENDER
static void hwrconvert(void)
{
UINT8 *linear = HWR_GetScreenshot();
UINT8 *dest = screens[2];
UINT8 r, g, b;
INT32 x, y;
size_t i = 0;
InitColorLUT(gif_palette);
for (y = 0; y < vid.height; y++)
{
for (x = 0; x < vid.width; x++, i += 3)
{
r = (UINT8)linear[i];
g = (UINT8)linear[i + 1];
b = (UINT8)linear[i + 2];
dest[(y * vid.width) + x] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS];
}
}
free(linear);
}
#endif
//
// GIF_framewrite
// writes a frame into the file.
@ -482,7 +510,12 @@ static void GIF_framewrite(void)
GIF_optimizeregion(cur_screen, movie_screen, &blitx, &blity, &blitw, &blith);
// blit to temp screen
I_ReadScreen(movie_screen);
if (rendermode == render_soft)
I_ReadScreen(movie_screen);
#ifdef HWRENDER
else if (rendermode == render_opengl)
hwrconvert();
#endif
}
else
{
@ -491,7 +524,18 @@ static void GIF_framewrite(void)
blith = vid.height;
if (gif_frames == 0)
I_ReadScreen(movie_screen);
{
if (rendermode == render_soft)
I_ReadScreen(movie_screen);
#ifdef HWRENDER
else if (rendermode == render_opengl)
{
hwrconvert();
VID_BlitLinearScreen(screens[2], screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
}
#endif
}
movie_screen = screens[0];
}
@ -580,7 +624,7 @@ static void GIF_framewrite(void)
//
INT32 GIF_open(const char *filename)
{
#ifdef HWRENDER
#if 0
if (rendermode != render_soft)
{
CONS_Alert(CONS_WARNING, M_GetText("GIFs cannot be taken in non-software modes!\n"));
@ -594,6 +638,16 @@ INT32 GIF_open(const char *filename)
gif_optimize = (!!cv_gif_optimize.value);
gif_downscale = (!!cv_gif_downscale.value);
// GIF color table
// In hardware mode, uses the master palette
gif_palette = ((cv_screenshot_colorprofile.value
#ifdef HWRENDER
&& (rendermode == render_soft)
#endif
) ? pLocalPalette
: pMasterPalette);
GIF_headwrite();
gif_frames = 0;
return 1;

View File

@ -1309,18 +1309,18 @@ static menuitem_t OP_OpenGLOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Model lighting", &cv_grmodellighting, 32},
{IT_HEADER, NULL, "General", NULL, 51},
{IT_STRING|IT_CVAR, NULL, "Field of view", &cv_grfov, 62},
{IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 72},
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 82},
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode,92},
{IT_STRING|IT_CVAR, NULL, "Field of view", &cv_grfov, 63},
{IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 73},
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 83},
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode,93},
{IT_HEADER, NULL, "Miscellaneous", NULL, 111},
{IT_SUBMENU|IT_STRING, NULL, "Fog...", &OP_OpenGLFogDef, 123},
{IT_HEADER, NULL, "Miscellaneous", NULL, 112},
{IT_SUBMENU|IT_STRING, NULL, "Fog...", &OP_OpenGLFogDef, 124},
#ifdef ALAM_LIGHTING
{IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 133},
{IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 134},
#endif
#if defined (_WINDOWS) && (!((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)))
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 143},
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 144},
#endif
};

View File

@ -1161,12 +1161,8 @@ void M_StartMovie(void)
switch (cv_moviemode.value)
{
case MM_GIF:
if (rendermode == render_soft)
{
moviemode = M_StartMovieGIF(pathname);
break;
}
/* FALLTHRU */
moviemode = M_StartMovieGIF(pathname);
break;
case MM_APNG:
moviemode = M_StartMovieAPNG(pathname);
break;
@ -1783,7 +1779,7 @@ char *M_GetToken(const char *inputString)
|| stringToUse[startPos] == '\r'
|| stringToUse[startPos] == '\n'
|| stringToUse[startPos] == '\0'
|| stringToUse[startPos] == '"' // we're treating this as whitespace because SLADE likes adding it for no good reason
|| stringToUse[startPos] == '=' || stringToUse[startPos] == ';' // UDMF TEXTMAP.
|| inComment != 0)
&& startPos < stringLength)
{
@ -1841,6 +1837,23 @@ char *M_GetToken(const char *inputString)
texturesToken[1] = '\0';
return texturesToken;
}
// Return entire string within quotes, except without the quotes.
else if (stringToUse[startPos] == '"')
{
endPos = ++startPos;
while (stringToUse[endPos] != '"' && endPos < stringLength)
endPos++;
texturesTokenLength = endPos++ - startPos;
// Assign the memory. Don't forget an extra byte for the end of the string!
texturesToken = (char *)Z_Malloc((texturesTokenLength+1)*sizeof(char),PU_STATIC,NULL);
// Copy the string.
M_Memcpy(texturesToken, stringToUse+startPos, (size_t)texturesTokenLength);
// Make the final character NUL.
texturesToken[texturesTokenLength] = '\0';
return texturesToken;
}
// Now find the end of the token. This includes several additional characters that are okay to capture as one character, but not trailing at the end of another token.
endPos = startPos + 1;
@ -1851,7 +1864,7 @@ char *M_GetToken(const char *inputString)
&& stringToUse[endPos] != ','
&& stringToUse[endPos] != '{'
&& stringToUse[endPos] != '}'
&& stringToUse[endPos] != '"' // see above
&& stringToUse[endPos] != '=' && stringToUse[endPos] != ';' // UDMF TEXTMAP.
&& inComment == 0)
&& endPos < stringLength)
{

View File

@ -13157,7 +13157,7 @@ static void P_SetObjectSpecial(mobj_t *mobj)
}
}
mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, fixed_t z, mobjtype_t i)
static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, fixed_t z, mobjtype_t i)
{
mobj_t *mobj = NULL;
boolean doangle = true;
@ -13524,7 +13524,7 @@ void P_SpawnItemPattern(mapthing_t *mthing, boolean bonustime)
{
INT32 numitems = (mthing->type & 1) ? 16 : 8;
fixed_t size = (mthing->type & 1) ? 192*FRACUNIT : 96*FRACUNIT;
mobjtype_t itemtypes[1] = { (mthing->type & 1) ? MT_RING : MT_BLUESPHERE };
mobjtype_t itemtypes[1] = { (mthing->type < 606) ? MT_RING : MT_BLUESPHERE };
P_SpawnItemCircle(mthing, itemtypes, 1, numitems, size, bonustime);
return;
}

View File

@ -777,15 +777,13 @@ static void P_NetArchiveWorld(void)
size_t i;
INT32 statsec = 0, statline = 0;
const line_t *li = lines;
const line_t *spawnli = spawnlines;
const side_t *si;
const side_t *spawnsi;
UINT8 *put;
// reload the map just to see difference
virtres_t* virt = vres_GetMap(lastloadedmaplumpnum);
mapsector_t *ms = (mapsector_t*) vres_Find(virt, "SECTORS")->data;
mapsidedef_t *msd = (mapsidedef_t*) vres_Find(virt, "SIDEDEFS")->data;
maplinedef_t *mld = (maplinedef_t*) vres_Find(virt, "LINEDEFS")->data;
const sector_t *ss = sectors;
const sector_t *spawnss = spawnsectors;
UINT8 diff, diff2, diff3;
// initialize colormap vars because paranoia
@ -794,45 +792,45 @@ static void P_NetArchiveWorld(void)
WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD);
put = save_p;
for (i = 0; i < numsectors; i++, ss++, ms++)
for (i = 0; i < numsectors; i++, ss++, spawnss++)
{
diff = diff2 = diff3 = 0;
if (ss->floorheight != SHORT(ms->floorheight)<<FRACBITS)
if (ss->floorheight != spawnss->floorheight)
diff |= SD_FLOORHT;
if (ss->ceilingheight != SHORT(ms->ceilingheight)<<FRACBITS)
if (ss->ceilingheight != spawnss->ceilingheight)
diff |= SD_CEILHT;
//
// flats
//
if (ss->floorpic != P_CheckLevelFlat(ms->floorpic))
if (ss->floorpic != spawnss->floorpic)
diff |= SD_FLOORPIC;
if (ss->ceilingpic != P_CheckLevelFlat(ms->ceilingpic))
if (ss->ceilingpic != spawnss->ceilingpic)
diff |= SD_CEILPIC;
if (ss->lightlevel != SHORT(ms->lightlevel))
if (ss->lightlevel != spawnss->lightlevel)
diff |= SD_LIGHT;
if (ss->special != SHORT(ms->special))
if (ss->special != spawnss->special)
diff |= SD_SPECIAL;
if (ss->floor_xoffs != ss->spawn_flr_xoffs)
if (ss->floor_xoffs != spawnss->floor_xoffs)
diff2 |= SD_FXOFFS;
if (ss->floor_yoffs != ss->spawn_flr_yoffs)
if (ss->floor_yoffs != spawnss->floor_yoffs)
diff2 |= SD_FYOFFS;
if (ss->ceiling_xoffs != ss->spawn_ceil_xoffs)
if (ss->ceiling_xoffs != spawnss->ceiling_xoffs)
diff2 |= SD_CXOFFS;
if (ss->ceiling_yoffs != ss->spawn_ceil_yoffs)
if (ss->ceiling_yoffs != spawnss->ceiling_yoffs)
diff2 |= SD_CYOFFS;
if (ss->floorpic_angle != ss->spawn_flrpic_angle)
if (ss->floorpic_angle != spawnss->floorpic_angle)
diff2 |= SD_FLOORANG;
if (ss->ceilingpic_angle != ss->spawn_flrpic_angle)
if (ss->ceilingpic_angle != spawnss->ceilingpic_angle)
diff2 |= SD_CEILANG;
if (ss->tag != SHORT(ms->tag))
if (ss->tag != spawnss->tag)
diff2 |= SD_TAG;
if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag)
if (ss->nexttag != spawnss->nexttag || ss->firsttag != spawnss->firsttag)
diff3 |= SD_TAGLIST;
if (ss->extra_colormap != ss->spawn_extra_colormap)
if (ss->extra_colormap != spawnss->extra_colormap)
diff3 |= SD_COLORMAP;
// Check if any of the sector's FOFs differ from how they spawned
@ -936,45 +934,41 @@ static void P_NetArchiveWorld(void)
WRITEUINT16(put, 0xffff);
// do lines
for (i = 0; i < numlines; i++, mld++, li++)
for (i = 0; i < numlines; i++, spawnli++, li++)
{
diff = diff2 = diff3 = 0;
if (li->special != SHORT(mld->special))
if (li->special != spawnli->special)
diff |= LD_SPECIAL;
if (SHORT(mld->special) == 321 || SHORT(mld->special) == 322) // only reason li->callcount would be non-zero is if either of these are involved
if (spawnli->special == 321 || spawnli->special == 322) // only reason li->callcount would be non-zero is if either of these are involved
diff |= LD_CLLCOUNT;
if (li->sidenum[0] != 0xffff)
{
si = &sides[li->sidenum[0]];
if (si->textureoffset != SHORT(msd[li->sidenum[0]].textureoffset)<<FRACBITS)
spawnsi = &spawnsides[li->sidenum[0]];
if (si->textureoffset != spawnsi->textureoffset)
diff |= LD_S1TEXOFF;
//SoM: 4/1/2000: Some textures are colormaps. Don't worry about invalid textures.
if (R_CheckTextureNumForName(msd[li->sidenum[0]].toptexture) != -1
&& si->toptexture != R_TextureNumForName(msd[li->sidenum[0]].toptexture))
if (si->toptexture != spawnsi->toptexture)
diff |= LD_S1TOPTEX;
if (R_CheckTextureNumForName(msd[li->sidenum[0]].bottomtexture) != -1
&& si->bottomtexture != R_TextureNumForName(msd[li->sidenum[0]].bottomtexture))
if (si->bottomtexture != spawnsi->bottomtexture)
diff |= LD_S1BOTTEX;
if (R_CheckTextureNumForName(msd[li->sidenum[0]].midtexture) != -1
&& si->midtexture != R_TextureNumForName(msd[li->sidenum[0]].midtexture))
if (si->midtexture != spawnsi->midtexture)
diff |= LD_S1MIDTEX;
}
if (li->sidenum[1] != 0xffff)
{
si = &sides[li->sidenum[1]];
if (si->textureoffset != SHORT(msd[li->sidenum[1]].textureoffset)<<FRACBITS)
spawnsi = &spawnsides[li->sidenum[1]];
if (si->textureoffset != spawnsi->textureoffset)
diff2 |= LD_S2TEXOFF;
if (R_CheckTextureNumForName(msd[li->sidenum[1]].toptexture) != -1
&& si->toptexture != R_TextureNumForName(msd[li->sidenum[1]].toptexture))
if (si->toptexture != spawnsi->toptexture)
diff2 |= LD_S2TOPTEX;
if (R_CheckTextureNumForName(msd[li->sidenum[1]].bottomtexture) != -1
&& si->bottomtexture != R_TextureNumForName(msd[li->sidenum[1]].bottomtexture))
if (si->bottomtexture != spawnsi->bottomtexture)
diff2 |= LD_S2BOTTEX;
if (R_CheckTextureNumForName(msd[li->sidenum[1]].midtexture) != -1
&& si->midtexture != R_TextureNumForName(msd[li->sidenum[1]].midtexture))
if (si->midtexture != spawnsi->midtexture)
diff2 |= LD_S2MIDTEX;
if (diff2)
diff |= LD_DIFF2;
@ -1018,7 +1012,6 @@ static void P_NetArchiveWorld(void)
WRITEUINT16(put, 0xffff);
R_ClearTextureNumCache(false);
vres_Free(virt);
save_p = put;
}

View File

@ -103,6 +103,9 @@ node_t *nodes;
line_t *lines;
side_t *sides;
mapthing_t *mapthings;
sector_t *spawnsectors;
line_t *spawnlines;
side_t *spawnsides;
INT32 numstarposts;
UINT16 bossdisabled;
boolean stoppedclock;
@ -210,6 +213,9 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->lvlttl[0] = '\0';
mapheaderinfo[num]->selectheading[0] = '\0';
mapheaderinfo[num]->subttl[0] = '\0';
mapheaderinfo[num]->ltzzpatch[0] = '\0';
mapheaderinfo[num]->ltzztext[0] = '\0';
mapheaderinfo[num]->ltactdiamond[0] = '\0';
mapheaderinfo[num]->actnum = 0;
mapheaderinfo[num]->typeoflevel = 0;
mapheaderinfo[num]->nextlevel = (INT16)(i + 1);
@ -482,6 +488,7 @@ static inline void P_LoadRawSubsectors(void *data)
size_t numlevelflats;
levelflat_t *levelflats;
levelflat_t *foundflats;
//SoM: Other files want this info.
size_t P_PrecacheLevelFlats(void)
@ -645,17 +652,8 @@ static void P_LoadRawSectors(UINT8 *data)
{
mapsector_t *ms = (mapsector_t *)data;
sector_t *ss = sectors;
levelflat_t *foundflats;
size_t i;
// Allocate a big chunk of memory as big as our MAXLEVELFLATS limit.
//Fab : FIXME: allocate for whatever number of flats - 512 different flats per level should be plenty
foundflats = calloc(MAXLEVELFLATS, sizeof (*foundflats));
if (foundflats == NULL)
I_Error("Ran out of memory while loading sectors\n");
numlevelflats = 0;
// For each counted sector, copy the sector raw data from our cache pointer ms, to the global table pointer ss.
for (i = 0; i < numsectors; i++, ss++, ms++)
{
@ -666,11 +664,9 @@ static void P_LoadRawSectors(UINT8 *data)
ss->ceilingpic = P_AddLevelFlat(ms->ceilingpic, foundflats);
ss->lightlevel = SHORT(ms->lightlevel);
ss->spawn_lightlevel = SHORT(ms->lightlevel);
ss->special = SHORT(ms->special);
ss->tag = SHORT(ms->tag);
ss->nexttag = ss->firsttag = -1;
ss->spawn_nexttag = ss->spawn_firsttag = -1;
memset(&ss->soundorg, 0, sizeof(ss->soundorg));
ss->validcount = 0;
@ -705,9 +701,7 @@ static void P_LoadRawSectors(UINT8 *data)
ss->spawn_extra_colormap = NULL;
ss->floor_xoffs = ss->ceiling_xoffs = ss->floor_yoffs = ss->ceiling_yoffs = 0;
ss->spawn_flr_xoffs = ss->spawn_ceil_xoffs = ss->spawn_flr_yoffs = ss->spawn_ceil_yoffs = 0;
ss->floorpic_angle = ss->ceilingpic_angle = 0;
ss->spawn_flrpic_angle = ss->spawn_ceilpic_angle = 0;
ss->gravity = NULL;
ss->cullheight = NULL;
ss->verticalflip = false;
@ -726,16 +720,6 @@ static void P_LoadRawSectors(UINT8 *data)
ss->lineoutLength = -1.0l;
#endif // ----- end special tricks -----
}
// set the sky flat num
skyflatnum = P_AddLevelFlat(SKYFLATNAME, foundflats);
// copy table for global usage
levelflats = M_Memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
free(foundflats);
// search for animated flats and set up
P_SetupLevelFlatAnims();
}
//
@ -1447,7 +1431,6 @@ static void P_LoadRawSideDefs2(void *data)
break;
}
}
R_ClearTextureNumCache(true);
}
static boolean LineInBlock(fixed_t cx1, fixed_t cy1, fixed_t cx2, fixed_t cy2, fixed_t bx1, fixed_t by1)
@ -1985,6 +1968,14 @@ static void P_LoadMapData(const virtres_t* virt)
lines = Z_Calloc(numlines * sizeof (*lines), PU_LEVEL, NULL);
mapthings = Z_Calloc(nummapthings * sizeof (*mapthings), PU_LEVEL, NULL);
// Allocate a big chunk of memory as big as our MAXLEVELFLATS limit.
//Fab : FIXME: allocate for whatever number of flats - 512 different flats per level should be plenty
foundflats = calloc(MAXLEVELFLATS, sizeof (*foundflats));
if (foundflats == NULL)
I_Error("Ran out of memory while loading sectors\n");
numlevelflats = 0;
#ifdef UDMF
if (textmap)
{
@ -1999,7 +1990,29 @@ static void P_LoadMapData(const virtres_t* virt)
P_LoadRawLineDefs(virtlinedefs->data);
P_SetupLines();
P_LoadRawSideDefs2(virtsidedefs->data);
P_PrepareRawThings(virtthings->data);
}
R_ClearTextureNumCache(true);
// set the sky flat num
skyflatnum = P_AddLevelFlat(SKYFLATNAME, foundflats);
// copy table for global usage
levelflats = M_Memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
free(foundflats);
// search for animated flats and set up
P_SetupLevelFlatAnims();
// Copy relevant map data for NetArchive purposes.
spawnsectors = Z_Calloc(numsectors * sizeof (*sectors), PU_LEVEL, NULL);
spawnlines = Z_Calloc(numlines * sizeof (*lines), PU_LEVEL, NULL);
spawnsides = Z_Calloc(numsides * sizeof (*sides), PU_LEVEL, NULL);
memcpy(spawnsectors, sectors, numsectors * sizeof (*sectors));
memcpy(spawnlines, lines, numlines * sizeof (*lines));
memcpy(spawnsides, sides, numsides * sizeof (*sides));
}
#if 0
@ -2177,8 +2190,6 @@ void P_LoadThingsOnly(void)
// Search through all the thinkers.
thinker_t *think;
INT32 i, viewid = -1, centerid = -1; // for skyboxes
virtres_t* virt = vres_GetMap(lastloadedmaplumpnum);
virtlump_t* vth = vres_Find(virt, "THINGS");
// check if these are any of the normal viewpoint/centerpoint mobjs in the level or not
if (skyboxmo[0] || skyboxmo[1])
@ -2199,11 +2210,8 @@ void P_LoadThingsOnly(void)
P_LevelInitStuff();
P_PrepareRawThings(vth->data);
P_LoadThings(true);
vres_Free(virt);
// restore skybox viewpoint/centerpoint if necessary, set them to defaults if we can't do that
skyboxmo[0] = skyboxviewpnts[(viewid >= 0) ? viewid : 0];
skyboxmo[1] = skyboxcenterpnts[(centerid >= 0) ? centerid : 0];
@ -2766,8 +2774,6 @@ boolean P_SetupLevel(boolean skipprecip)
P_LoadLineDefs2();
P_GroupLines();
P_PrepareRawThings(vres_Find(virt, "THINGS")->data);
P_MakeMapMD5(virt, &mapmd5);
vres_Free(virt);

View File

@ -1603,8 +1603,6 @@ static inline void P_InitTagLists(void)
size_t j = (unsigned)sectors[i].tag % numsectors;
sectors[i].nexttag = sectors[j].firsttag;
sectors[j].firsttag = (INT32)i;
sectors[i].spawn_nexttag = sectors[i].nexttag;
sectors[j].spawn_firsttag = sectors[j].firsttag;
}
for (i = numlines - 1; i != (size_t)-1; i--)
@ -6405,22 +6403,16 @@ static void P_ApplyFlatAlignment(line_t *master, sector_t *sector, angle_t flata
{
if (!(master->flags & ML_NETONLY)) // Modify floor flat alignment unless ML_NETONLY flag is set
{
sector->spawn_flrpic_angle = sector->floorpic_angle = flatangle;
sector->floorpic_angle = flatangle;
sector->floor_xoffs += xoffs;
sector->floor_yoffs += yoffs;
// saved for netgames
sector->spawn_flr_xoffs = sector->floor_xoffs;
sector->spawn_flr_yoffs = sector->floor_yoffs;
}
if (!(master->flags & ML_NONET)) // Modify ceiling flat alignment unless ML_NONET flag is set
{
sector->spawn_ceilpic_angle = sector->ceilingpic_angle = flatangle;
sector->ceilingpic_angle = flatangle;
sector->ceiling_xoffs += xoffs;
sector->ceiling_yoffs += yoffs;
// saved for netgames
sector->spawn_ceil_xoffs = sector->ceiling_xoffs;
sector->spawn_ceil_yoffs = sector->ceiling_yoffs;
}
}

View File

@ -536,9 +536,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
}
// multi-patch textures (or 'composite')
#ifndef NO_PNG_LUMPS
multipatch:
#endif
texture->holes = false;
texture->flip = 0;
blocksize = (texture->width * 4) + (texture->width * texture->height);

View File

@ -171,6 +171,8 @@ const char *R_NameForColormap(extracolormap_t *extra_colormap);
#define R_PutRgbaRGB(r, g, b) (R_PutRgbaR(r) + R_PutRgbaG(g) + R_PutRgbaB(b))
#define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a))
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
extern INT32 numtextures;
#endif

View File

@ -384,17 +384,6 @@ typedef struct sector_s
// for fade thinker
INT16 spawn_lightlevel;
// these are saved for netgames, so do not let Lua touch these!
INT32 spawn_nexttag, spawn_firsttag; // the actual nexttag/firsttag values may differ if the sector's tag was changed
// offsets sector spawned with (via linedef type 7)
fixed_t spawn_flr_xoffs, spawn_flr_yoffs;
fixed_t spawn_ceil_xoffs, spawn_ceil_yoffs;
// flag angles sector spawned with (via linedef type 7)
angle_t spawn_flrpic_angle;
angle_t spawn_ceilpic_angle;
// colormap structure
extracolormap_t *spawn_extra_colormap;
} sector_t;

View File

@ -788,6 +788,8 @@ static UINT8 *R_GetTextureFlat(levelflat_t *levelflat, boolean leveltexture, boo
patch_t *patch = NULL;
boolean texturechanged = (leveltexture ? (levelflat->u.texture.num != levelflat->u.texture.lastnum) : false);
(void)ispng;
// Check if the texture changed.
if (leveltexture && (!texturechanged))
{

View File

@ -63,6 +63,7 @@ extern seg_t *segs;
extern size_t numsectors;
extern sector_t *sectors;
extern sector_t *spawnsectors;
extern size_t numsubsectors;
extern subsector_t *subsectors;
@ -72,9 +73,11 @@ extern node_t *nodes;
extern size_t numlines;
extern line_t *lines;
extern line_t *spawnlines;
extern size_t numsides;
extern side_t *sides;
extern side_t *spawnsides;
//
// POV data.

View File

@ -47,6 +47,7 @@ extern int SDL_main(int argc, char *argv[]);
#ifdef LOGMESSAGES
FILE *logstream = NULL;
char logfilename[1024];
#endif
#ifndef DOXYGEN
@ -116,7 +117,6 @@ int main(int argc, char **argv)
#endif
{
const char *logdir = NULL;
char logfile[MAX_WADPATH];
myargc = argc;
myargv = argv; /// \todo pull out path to exe from this string
@ -141,7 +141,7 @@ int main(int argc, char **argv)
timeinfo = localtime(&my_time);
strftime(buf, 26, "%Y-%m-%d %H-%M-%S", timeinfo);
strcpy(logfile, va("log-%s.txt", buf));
strcpy(logfilename, va("log-%s.txt", buf));
#ifdef DEFAULTDIR
if (logdir)
@ -149,14 +149,16 @@ int main(int argc, char **argv)
// Create dirs here because D_SRB2Main() is too late.
I_mkdir(va("%s%s"DEFAULTDIR, logdir, PATHSEP), 0755);
I_mkdir(va("%s%s"DEFAULTDIR"%slogs",logdir, PATHSEP, PATHSEP), 0755);
logstream = fopen(va("%s%s"DEFAULTDIR"%slogs%s%s",logdir, PATHSEP, PATHSEP, PATHSEP, logfile), "wt");
strcpy(logfilename, va("%s%s"DEFAULTDIR"%slogs%s%s",logdir, PATHSEP, PATHSEP, PATHSEP, logfilename));
}
else
#endif
{
I_mkdir("."PATHSEP"logs"PATHSEP, 0755);
logstream = fopen(va("."PATHSEP"logs"PATHSEP"%s", logfile), "wt");
strcpy(logfilename, va("."PATHSEP"logs"PATHSEP"%s", logfilename));
}
logstream = fopen(logfilename, "wt");
}
#endif
@ -181,12 +183,13 @@ int main(int argc, char **argv)
#endif
MakeCodeWritable();
#endif
// startup SRB2
CONS_Printf("Setting up SRB2...\n");
D_SRB2Main();
#ifdef LOGMESSAGES
if (!M_CheckParm("-nolog"))
CONS_Printf("Logfile: %s\n", logfile);
CONS_Printf("Logfile: %s\n", logfilename);
#endif
CONS_Printf("Entering main game loop...\n");
// never return

View File

@ -102,6 +102,12 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#endif
#endif
#if (defined (__unix__) && !defined (_MSDOS)) || defined (UNIXCOMMON)
#include <errno.h>
#include <sys/wait.h>
#define NEWSIGNALHANDLER
#endif
#ifndef NOMUMBLE
#ifdef __linux__ // need -lrt
#include <sys/mman.h>
@ -229,13 +235,11 @@ SDL_bool framebuffer = SDL_FALSE;
UINT8 keyboard_started = false;
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
static void I_ReportSignal(int num, int coredumped)
{
//static char msg[] = "oh no! back to reality!\r\n";
const char * sigmsg;
char sigdef[32];
D_QuitNetGame(); // Fix server freezes
char msg[128];
switch (num)
{
@ -261,20 +265,41 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
sigmsg = "SIGABRT - abnormal termination triggered by abort call";
break;
default:
sprintf(sigdef,"signal number %d", num);
sigmsg = sigdef;
sprintf(msg,"signal number %d", num);
if (coredumped)
sigmsg = 0;
else
sigmsg = msg;
}
I_OutputMsg("\nsignal_handler() error: %s\n", sigmsg);
if (coredumped)
{
if (sigmsg)
sprintf(msg, "%s (core dumped)", sigmsg);
else
strcat(msg, " (core dumped)");
sigmsg = msg;
}
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
"Signal caught",
"Process killed by signal",
sigmsg, NULL);
}
#ifndef NEWSIGNALHANDLER
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
{
D_QuitNetGame(); // Fix server freezes
I_ReportSignal(num, 0);
I_ShutdownSystem();
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
}
#endif
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
{
@ -650,7 +675,7 @@ static inline void I_ShutdownConsole(void){}
//
// StartupKeyboard
//
void I_StartupKeyboard (void)
static void I_RegisterSignals (void)
{
#ifdef SIGINT
signal(SIGINT , quit_handler);
@ -664,10 +689,12 @@ void I_StartupKeyboard (void)
// If these defines don't exist,
// then compilation would have failed above us...
#ifndef NEWSIGNALHANDLER
signal(SIGILL , signal_handler);
signal(SIGSEGV , signal_handler);
signal(SIGABRT , signal_handler);
signal(SIGFPE , signal_handler);
#endif
}
//
@ -2139,6 +2166,85 @@ void I_Sleep(void)
SDL_Delay(cv_sleep.value);
}
#ifdef NEWSIGNALHANDLER
static void newsignalhandler_Warn(const char *pr)
{
char text[128];
snprintf(text, sizeof text,
"Error while setting up signal reporting: %s: %s",
pr,
strerror(errno)
);
I_OutputMsg("%s\n", text);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
"Startup error",
text, NULL);
I_ShutdownConsole();
exit(-1);
}
static void I_Fork(void)
{
int child;
int status;
int signum;
int c;
child = fork();
switch (child)
{
case -1:
newsignalhandler_Warn("fork()");
break;
case 0:
break;
default:
if (logstream)
fclose(logstream);/* the child has this */
c = wait(&status);
#ifdef LOGMESSAGES
/* By the way, exit closes files. */
logstream = fopen(logfilename, "at");
#else
logstream = 0;
#endif
if (c == -1)
{
kill(child, SIGKILL);
newsignalhandler_Warn("wait()");
}
else
{
if (WIFSIGNALED (status))
{
signum = WTERMSIG (status);
#ifdef WCOREDUMP
I_ReportSignal(signum, WCOREDUMP (status));
#else
I_ReportSignal(signum, 0);
#endif
status = 128 + signum;
}
else if (WIFEXITED (status))
{
status = WEXITSTATUS (status);
}
I_ShutdownConsole();
exit(status);
}
}
}
#endif/*NEWSIGNALHANDLER*/
INT32 I_StartupSystem(void)
{
SDL_version SDLcompiled;
@ -2146,6 +2252,10 @@ INT32 I_StartupSystem(void)
SDL_VERSION(&SDLcompiled)
SDL_GetVersion(&SDLlinked);
I_StartupConsole();
#ifdef NEWSIGNALHANDLER
I_Fork();
#endif
I_RegisterSignals();
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
@ -2169,7 +2279,6 @@ void I_Quit(void)
if (quiting) goto death;
SDLforceUngrabMouse();
quiting = SDL_FALSE;
I_ShutdownConsole();
M_SaveConfig(NULL); //save game config, cvars..
#ifndef NONET
D_SaveBan(); // save the ban list
@ -2287,8 +2396,6 @@ void I_Error(const char *error, ...)
I_OutputMsg("\nI_Error(): %s\n", buffer);
// ---
I_ShutdownConsole();
M_SaveConfig(NULL); // save game config, cvars..
#ifndef NONET
D_SaveBan(); // save the ban list
@ -2388,6 +2495,10 @@ void I_ShutdownSystem(void)
{
INT32 c;
#ifndef NEWSIGNALHANDLER
I_ShutdownConsole();
#endif
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
if (quit_funcs[c])
(*quit_funcs[c])();

View File

@ -1441,6 +1441,7 @@ INT32 VID_SetMode(INT32 modeNum)
//Impl_SetWindowName("SRB2 "VERSIONSTRING);
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
Impl_VideoSetupBuffer();
if (rendermode == render_soft)
{
@ -1449,8 +1450,6 @@ INT32 VID_SetMode(INT32 modeNum)
SDL_FreeSurface(bufSurface);
bufSurface = NULL;
}
Impl_VideoSetupBuffer();
}
return SDL_TRUE;
@ -1573,7 +1572,7 @@ static void Impl_VideoSetupSDLBuffer(void)
static void Impl_VideoSetupBuffer(void)
{
// Set up game's software render buffer
if (rendermode == render_soft)
//if (rendermode == render_soft)
{
vid.rowbytes = vid.width * vid.bpp;
vid.direct = NULL;

View File

@ -9,6 +9,26 @@
/// \file
/// \brief SDL Mixer interface for sound
#ifdef HAVE_LIBGME
#ifdef HAVE_ZLIB
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#endif
#ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 0
#endif
#include <zlib.h>
#endif // HAVE_ZLIB
#endif // HAVE_LIBGME
#include "../doomdef.h"
#include "../doomstat.h" // menuactive
@ -57,24 +77,6 @@
#include "gme/gme.h"
#define GME_TREBLE 5.0f
#define GME_BASS 1.0f
#ifdef HAVE_ZLIB
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#endif
#ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 0
#endif
#include "zlib.h"
#endif // HAVE_ZLIB
#endif // HAVE_LIBGME
static UINT16 BUFFERSIZE = 2048;

View File

@ -1177,21 +1177,33 @@ tic_t lt_exitticker = 0, lt_endtime = 0;
//
// Load the graphics for the title card.
// Don't let LJ see this
//
static void ST_cacheLevelTitle(void)
{
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_WARNINGTITLE))
{
lt_patches[0] = (patch_t *)W_CachePatchName("LTACTBLU", PU_HUDGFX);
lt_patches[1] = (patch_t *)W_CachePatchName("LTZIGZAG", PU_HUDGFX);
lt_patches[2] = (patch_t *)W_CachePatchName("LTZZTEXT", PU_HUDGFX);
}
else // boss map
{
lt_patches[0] = (patch_t *)W_CachePatchName("LTACTRED", PU_HUDGFX);
lt_patches[1] = (patch_t *)W_CachePatchName("LTZIGRED", PU_HUDGFX);
lt_patches[2] = (patch_t *)W_CachePatchName("LTZZWARN", PU_HUDGFX);
}
#define SETPATCH(default, warning, custom, idx) \
{ \
lumpnum_t patlumpnum = LUMPERROR; \
if (mapheaderinfo[gamemap-1]->custom[0] != '\0') \
{ \
patlumpnum = W_CheckNumForName(mapheaderinfo[gamemap-1]->custom); \
if (patlumpnum != LUMPERROR) \
lt_patches[idx] = (patch_t *)W_CachePatchNum(patlumpnum, PU_HUDGFX); \
} \
if (patlumpnum == LUMPERROR) \
{ \
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_WARNINGTITLE)) \
lt_patches[idx] = (patch_t *)W_CachePatchName(default, PU_HUDGFX); \
else \
lt_patches[idx] = (patch_t *)W_CachePatchName(warning, PU_HUDGFX); \
} \
}
SETPATCH("LTACTBLU", "LTACTRED", ltactdiamond, 0)
SETPATCH("LTZIGZAG", "LTZIGRED", ltzzpatch, 1)
SETPATCH("LTZZTEXT", "LTZZWARN", ltzztext, 2)
#undef SETPATCH
}
//

View File

@ -3244,6 +3244,29 @@ Unoptimized version
#endif
}
// Taken from my videos-in-SRB2 project
// Generates a color look-up table
// which has up to 64 colors at each channel
// (see the defines in v_video.h)
UINT8 colorlookup[CLUTSIZE][CLUTSIZE][CLUTSIZE];
void InitColorLUT(RGBA_t *palette)
{
UINT8 r, g, b;
static boolean clutinit = false;
static RGBA_t *lastpalette = NULL;
if ((!clutinit) || (lastpalette != palette))
{
for (r = 0; r < CLUTSIZE; r++)
for (g = 0; g < CLUTSIZE; g++)
for (b = 0; b < CLUTSIZE; b++)
colorlookup[r][g][b] = NearestColor(r << SHIFTCOLORBITS, g << SHIFTCOLORBITS, b << SHIFTCOLORBITS);
clutinit = true;
lastpalette = palette;
}
}
// V_Init
// old software stuff, buffers are allocated at video mode setup
// here we set the screens[x] pointers accordingly
@ -3255,13 +3278,9 @@ void V_Init(void)
const INT32 screensize = vid.rowbytes * vid.height;
LoadMapPalette();
// hardware modes do not use screens[] pointers
for (i = 0; i < NUMSCREENS; i++)
screens[i] = NULL;
if (rendermode != render_soft)
{
return; // be sure to cause a NULL read/write error so we detect it, in case of..
}
// start address of NUMSCREENS * width*height vidbuffers
if (base)

View File

@ -37,6 +37,18 @@ cv_allcaps;
// Allocates buffer screens, call before R_Init.
void V_Init(void);
// Taken from my videos-in-SRB2 project
// Generates a color look-up table
// which has up to 64 colors at each channel
#define COLORBITS 6
#define SHIFTCOLORBITS (8-COLORBITS)
#define CLUTSIZE (1<<COLORBITS)
extern UINT8 colorlookup[CLUTSIZE][CLUTSIZE][CLUTSIZE];
void InitColorLUT(RGBA_t *palette);
// Set the current RGB palette lookup to use for palettized graphics
void V_SetPalette(INT32 palettenum);

View File

@ -11,6 +11,24 @@
/// \file w_wad.c
/// \brief Handles WAD file header, directory, lump I/O
#ifdef HAVE_ZLIB
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#endif
#ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 0
#endif
#include <zlib.h>
#endif
#ifdef __GNUC__
#include <unistd.h>
#endif
@ -22,22 +40,6 @@
#include "lzf.h"
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 0
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE
#endif
//#ifdef HAVE_ZLIB
#include "zlib.h"
//#endif // HAVE_ZLIB
#include "doomdef.h"
#include "doomstat.h"
#include "doomtype.h"
@ -77,24 +79,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#define O_BINARY 0
#endif
#ifdef HAVE_ZLIB
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#endif
#ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 0
#endif
#include "zlib.h"
#endif
typedef struct
{