Merge remote-tracking branch 'origin/master' into renderswitch
This commit is contained in:
commit
03a3b02301
|
@ -70,7 +70,7 @@
|
||||||
boolean server = true; // true or false but !server == client
|
boolean server = true; // true or false but !server == client
|
||||||
#define client (!server)
|
#define client (!server)
|
||||||
boolean nodownload = false;
|
boolean nodownload = false;
|
||||||
static boolean serverrunning = false;
|
boolean serverrunning = false;
|
||||||
INT32 serverplayer = 0;
|
INT32 serverplayer = 0;
|
||||||
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
|
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
|
||||||
|
|
||||||
|
|
22
src/d_main.c
22
src/d_main.c
|
@ -242,7 +242,7 @@ static void D_Display(void)
|
||||||
// 5. The frame is ready to be drawn!
|
// 5. The frame is ready to be drawn!
|
||||||
|
|
||||||
// stop movie if needs to change renderer
|
// stop movie if needs to change renderer
|
||||||
if (setrenderneeded && (moviemode != MM_OFF))
|
if (setrenderneeded && (moviemode == MM_APNG))
|
||||||
M_StopMovie();
|
M_StopMovie();
|
||||||
|
|
||||||
// check for change of renderer or screen size (video mode)
|
// check for change of renderer or screen size (video mode)
|
||||||
|
@ -307,7 +307,10 @@ static void D_Display(void)
|
||||||
&& wipetypepre != UINT8_MAX)
|
&& wipetypepre != UINT8_MAX)
|
||||||
{
|
{
|
||||||
F_WipeStartScreen();
|
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_WipeEndScreen();
|
||||||
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
||||||
}
|
}
|
||||||
|
@ -521,6 +524,7 @@ static void D_Display(void)
|
||||||
if (rendermode != render_none)
|
if (rendermode != render_none)
|
||||||
{
|
{
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
|
|
||||||
// Funny.
|
// Funny.
|
||||||
if (WipeStageTitle && st_overlay)
|
if (WipeStageTitle && st_overlay)
|
||||||
{
|
{
|
||||||
|
@ -530,6 +534,14 @@ static void D_Display(void)
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
|
||||||
F_WipeStartScreen();
|
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);
|
F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,9 +626,6 @@ void D_SRB2Loop(void)
|
||||||
|
|
||||||
// Pushing of + parameters is now done back in D_SRB2Main, not here.
|
// Pushing of + parameters is now done back in D_SRB2Main, not here.
|
||||||
|
|
||||||
CONS_Printf("I_StartupKeyboard()...\n");
|
|
||||||
I_StartupKeyboard();
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
CONS_Printf("I_StartupMouse()...\n");
|
CONS_Printf("I_StartupMouse()...\n");
|
||||||
I_DoStartupMouse();
|
I_DoStartupMouse();
|
||||||
|
@ -1349,9 +1358,10 @@ void D_SRB2Main(void)
|
||||||
I_StartupSound();
|
I_StartupSound();
|
||||||
I_InitMusic();
|
I_InitMusic();
|
||||||
S_InitSfxChannels(cv_soundvolume.value);
|
S_InitSfxChannels(cv_soundvolume.value);
|
||||||
S_InitMusicDefs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S_InitMusicDefs();
|
||||||
|
|
||||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||||
ST_Init();
|
ST_Init();
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ extern SINT8 nodetoplayer2[MAXNETNODES]; // Say the numplayer for this node if a
|
||||||
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
|
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
|
||||||
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
|
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
|
||||||
|
|
||||||
|
extern boolean serverrunning;
|
||||||
|
|
||||||
INT32 Net_GetFreeAcks(boolean urgent);
|
INT32 Net_GetFreeAcks(boolean urgent);
|
||||||
void Net_AckTicker(void);
|
void Net_AckTicker(void);
|
||||||
|
|
||||||
|
|
|
@ -823,6 +823,10 @@ void D_RegisterClientCommands(void)
|
||||||
CV_RegisterVar(&cv_autobrake);
|
CV_RegisterVar(&cv_autobrake);
|
||||||
CV_RegisterVar(&cv_autobrake2);
|
CV_RegisterVar(&cv_autobrake2);
|
||||||
|
|
||||||
|
// Ported from kart
|
||||||
|
CV_RegisterVar(&cv_deadzone);
|
||||||
|
CV_RegisterVar(&cv_deadzone2);
|
||||||
|
|
||||||
// s_sound.c
|
// s_sound.c
|
||||||
CV_RegisterVar(&cv_soundvolume);
|
CV_RegisterVar(&cv_soundvolume);
|
||||||
CV_RegisterVar(&cv_closedcaptioning);
|
CV_RegisterVar(&cv_closedcaptioning);
|
||||||
|
|
|
@ -4462,20 +4462,34 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
||||||
ignorelines(f);
|
ignorelines(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Last I heard this crashes the game if you try to use it
|
else if (fastcmp(word, "SRB2"))
|
||||||
// so this is disabled for now
|
|
||||||
// -- Monster Iestyn
|
|
||||||
/* else if (fastcmp(word, "SRB2"))
|
|
||||||
{
|
{
|
||||||
INT32 ver = searchvalue(strtok(NULL, "\n"));
|
if (isdigit(word2[0]))
|
||||||
if (ver != PATCHVERSION)
|
{
|
||||||
deh_warning("Patch is for SRB2 version %d,\nonly version %d is supported", ver, PATCHVERSION);
|
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)
|
// Clear all data in certain locations (mostly for unlocks)
|
||||||
// Unless you REALLY want to piss people off,
|
// Unless you REALLY want to piss people off,
|
||||||
// define a custom gamedata /before/ doing this!!
|
// define a custom gamedata /before/ doing this!!
|
||||||
// (then again, modifiedgame will prevent game data saving anyway)
|
// (then again, modifiedgame will prevent game data saving anyway)
|
||||||
*/
|
|
||||||
else if (fastcmp(word, "CLEAR"))
|
else if (fastcmp(word, "CLEAR"))
|
||||||
{
|
{
|
||||||
boolean clearall = (fastcmp(word2, "ALL"));
|
boolean clearall = (fastcmp(word2, "ALL"));
|
||||||
|
|
|
@ -47,7 +47,7 @@ extern const char *superactions[MAXRECURSION];
|
||||||
extern UINT8 superstack;
|
extern UINT8 superstack;
|
||||||
|
|
||||||
// If the dehacked patch does not match this version, we throw a warning
|
// If the dehacked patch does not match this version, we throw a warning
|
||||||
#define PATCHVERSION 210
|
#define PATCHVERSION 220
|
||||||
|
|
||||||
#define MAXLINELEN 1024
|
#define MAXLINELEN 1024
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
|
|
||||||
#ifdef LOGMESSAGES
|
#ifdef LOGMESSAGES
|
||||||
extern FILE *logstream;
|
extern FILE *logstream;
|
||||||
|
extern char logfilename[1024];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
|
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
|
||||||
|
@ -631,8 +632,12 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||||
#define ROTANGLES 24 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
#define ROTANGLES 24 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
||||||
#define ROTANGDIFF (360 / ROTANGLES)
|
#define ROTANGDIFF (360 / ROTANGLES)
|
||||||
|
|
||||||
|
/// PNG support
|
||||||
#ifndef HAVE_PNG
|
#ifndef HAVE_PNG
|
||||||
#define NO_PNG_LUMPS
|
#define NO_PNG_LUMPS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// Render flats on walls
|
||||||
|
#define WALLFLATS
|
||||||
|
|
||||||
#endif // __DOOMDEF__
|
#endif // __DOOMDEF__
|
||||||
|
|
|
@ -917,8 +917,9 @@ void F_IntroDrawer(void)
|
||||||
{
|
{
|
||||||
if (rendermode != render_none)
|
if (rendermode != render_none)
|
||||||
{
|
{
|
||||||
|
wipestyleflags = WSF_FADEOUT;
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
F_WipeColorFill(31);
|
F_TryColormapFade(31);
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
F_RunWipe(99,true);
|
F_RunWipe(99,true);
|
||||||
}
|
}
|
||||||
|
@ -927,12 +928,11 @@ void F_IntroDrawer(void)
|
||||||
}
|
}
|
||||||
else if (intro_scenenum == 10)
|
else if (intro_scenenum == 10)
|
||||||
{
|
{
|
||||||
// The only fade to white in the entire damn game.
|
|
||||||
// (not true)
|
|
||||||
if (rendermode != render_none)
|
if (rendermode != render_none)
|
||||||
{
|
{
|
||||||
|
wipestyleflags = (WSF_FADEOUT|WSF_TOWHITE);
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
F_WipeColorFill(0);
|
F_TryColormapFade(0);
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
F_RunWipe(99,true);
|
F_RunWipe(99,true);
|
||||||
}
|
}
|
||||||
|
@ -941,8 +941,9 @@ void F_IntroDrawer(void)
|
||||||
{
|
{
|
||||||
if (rendermode != render_none)
|
if (rendermode != render_none)
|
||||||
{
|
{
|
||||||
|
wipestyleflags = WSF_FADEOUT;
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
F_WipeColorFill(31);
|
F_TryColormapFade(31);
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
F_RunWipe(99,true);
|
F_RunWipe(99,true);
|
||||||
}
|
}
|
||||||
|
@ -977,6 +978,7 @@ void F_IntroDrawer(void)
|
||||||
|
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
wipegamestate = -1;
|
wipegamestate = -1;
|
||||||
|
wipestyleflags = WSF_CROSSFADE;
|
||||||
animtimer = stoptimer = 0;
|
animtimer = stoptimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3625,6 +3627,8 @@ void F_StartContinue(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wipestyleflags = WSF_FADEOUT;
|
||||||
|
F_TryColormapFade(31);
|
||||||
G_SetGamestate(GS_CONTINUING);
|
G_SetGamestate(GS_CONTINUING);
|
||||||
gameaction = ga_nothing;
|
gameaction = ga_nothing;
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ extern boolean WipeStageTitle;
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
WIPESTYLE_NORMAL,
|
WIPESTYLE_NORMAL,
|
||||||
WIPESTYLE_LEVEL
|
WIPESTYLE_COLORMAP
|
||||||
} wipestyle_t;
|
} wipestyle_t;
|
||||||
extern wipestyle_t wipestyle;
|
extern wipestyle_t wipestyle;
|
||||||
|
|
||||||
|
@ -159,6 +159,11 @@ typedef enum
|
||||||
} wipestyleflags_t;
|
} wipestyleflags_t;
|
||||||
extern wipestyleflags_t wipestyleflags;
|
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 FADECOLORMAPDIV 8
|
||||||
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
|
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
|
||||||
|
|
||||||
|
|
248
src/f_wipe.c
248
src/f_wipe.c
|
@ -56,7 +56,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
|
||||||
|
|
||||||
0, // wipe_level_toblack
|
0, // wipe_level_toblack
|
||||||
UINT8_MAX, // wipe_intermission_toblack
|
UINT8_MAX, // wipe_intermission_toblack
|
||||||
UINT8_MAX, // wipe_continuing_toblack
|
0, // wipe_continuing_toblack
|
||||||
0, // wipe_titlescreen_toblack
|
0, // wipe_titlescreen_toblack
|
||||||
0, // wipe_timeattack_toblack
|
0, // wipe_timeattack_toblack
|
||||||
99, // wipe_credits_toblack
|
99, // wipe_credits_toblack
|
||||||
|
@ -161,7 +161,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
|
||||||
{
|
{
|
||||||
// Determine pixel to use from fademask
|
// Determine pixel to use from fademask
|
||||||
pcolor = &pMasterPalette[*lump++];
|
pcolor = &pMasterPalette[*lump++];
|
||||||
if (wipestyle == WIPESTYLE_LEVEL)
|
if (wipestyle == WIPESTYLE_COLORMAP)
|
||||||
*mask++ = pcolor->s.red / FADECOLORMAPDIV;
|
*mask++ = pcolor->s.red / FADECOLORMAPDIV;
|
||||||
else
|
else
|
||||||
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
|
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
|
||||||
|
@ -191,7 +191,7 @@ void F_WipeStageTitle(void)
|
||||||
{
|
{
|
||||||
// draw level title
|
// draw level title
|
||||||
if ((WipeStageTitle && st_overlay)
|
if ((WipeStageTitle && st_overlay)
|
||||||
&& (wipestyle == WIPESTYLE_LEVEL)
|
&& (wipestyle == WIPESTYLE_COLORMAP)
|
||||||
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
||||||
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
|
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
|
||||||
{
|
{
|
||||||
|
@ -282,7 +282,7 @@ static void F_DoWipe(fademask_t *fademask)
|
||||||
relativepos += vid.width;
|
relativepos += vid.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (*mask >= ((wipestyle == WIPESTYLE_LEVEL) ? FADECOLORMAPROWS : 10))
|
else if (*mask >= 10)
|
||||||
{
|
{
|
||||||
// shortcut - memcpy target to work
|
// shortcut - memcpy target to work
|
||||||
while (draw_linestogo--)
|
while (draw_linestogo--)
|
||||||
|
@ -293,25 +293,8 @@ static void F_DoWipe(fademask_t *fademask)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (wipestyle == WIPESTYLE_LEVEL)
|
// pointer to transtable that this mask would use
|
||||||
{
|
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// DRAWING LOOP
|
// DRAWING LOOP
|
||||||
while (draw_linestogo--)
|
while (draw_linestogo--)
|
||||||
|
@ -321,16 +304,113 @@ static void F_DoWipe(fademask_t *fademask)
|
||||||
e = e_base + relativepos;
|
e = e_base + relativepos;
|
||||||
draw_rowstogo = draw_rowend - draw_rowstart;
|
draw_rowstogo = draw_rowend - draw_rowstart;
|
||||||
|
|
||||||
if (wipestyle == WIPESTYLE_LEVEL)
|
while (draw_rowstogo--)
|
||||||
{
|
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
|
||||||
while (draw_rowstogo--)
|
|
||||||
*w++ = transtbl[*e++];
|
relativepos += vid.width;
|
||||||
}
|
}
|
||||||
else
|
// END DRAWING LOOP
|
||||||
{
|
}
|
||||||
while (draw_rowstogo--)
|
|
||||||
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
|
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;
|
relativepos += vid.width;
|
||||||
}
|
}
|
||||||
|
@ -382,6 +462,62 @@ void F_WipeEndScreen(void)
|
||||||
#endif
|
#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,
|
/** After setting up the screens you want to wipe,
|
||||||
* calling this will do a 'typical' 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);
|
paldiv = FixedDiv(257<<FRACBITS, 11<<FRACBITS);
|
||||||
|
|
||||||
// Init the wipe
|
// Init the wipe
|
||||||
|
F_DecideWipeStyle();
|
||||||
WipeInAction = true;
|
WipeInAction = true;
|
||||||
wipe_scr = screens[0];
|
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
|
// lastwipetic should either be 0 or the tic we last wiped
|
||||||
// on for fade-to-black
|
// on for fade-to-black
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -425,21 +553,39 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||||
I_Sleep();
|
I_Sleep();
|
||||||
lastwipetic = nowtime;
|
lastwipetic = nowtime;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
// Wipe styles
|
||||||
if (rendermode == render_opengl)
|
if (wipestyle == WIPESTYLE_COLORMAP)
|
||||||
{
|
{
|
||||||
// send in the wipe type and wipe frame because we need to cache the graphic
|
#ifdef HWRENDER
|
||||||
if (wipestyle == WIPESTYLE_LEVEL)
|
if (rendermode == render_opengl)
|
||||||
|
{
|
||||||
|
// send in the wipe type and wipe frame because we need to cache the graphic
|
||||||
HWR_DoTintedWipe(wipetype, wipeframe-1);
|
HWR_DoTintedWipe(wipetype, wipeframe-1);
|
||||||
|
}
|
||||||
else
|
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
|
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
|
#endif
|
||||||
F_DoWipe(fmask);
|
F_DoWipe(fmask);
|
||||||
|
}
|
||||||
if (wipestyle == WIPESTYLE_LEVEL)
|
|
||||||
F_WipeStageTitle();
|
|
||||||
|
|
||||||
I_OsPolling();
|
I_OsPolling();
|
||||||
I_UpdateNoBlit();
|
I_UpdateNoBlit();
|
||||||
|
|
222
src/g_game.c
222
src/g_game.c
|
@ -275,6 +275,12 @@ static UINT8 *metalbuffer = NULL;
|
||||||
static UINT8 *metal_p;
|
static UINT8 *metal_p;
|
||||||
static UINT16 metalversion;
|
static UINT16 metalversion;
|
||||||
|
|
||||||
|
typedef struct joystickvector2_s
|
||||||
|
{
|
||||||
|
INT32 xaxis;
|
||||||
|
INT32 yaxis;
|
||||||
|
} joystickvector2_t;
|
||||||
|
|
||||||
// extra data stuff (events registered this frame while recording)
|
// extra data stuff (events registered this frame while recording)
|
||||||
static struct {
|
static struct {
|
||||||
UINT8 flags; // EZT flags
|
UINT8 flags; // EZT flags
|
||||||
|
@ -394,6 +400,11 @@ consvar_t cv_directionchar2 = {"directionchar2", "Movement", CV_SAVE|CV_CALL, di
|
||||||
consvar_t cv_autobrake = {"autobrake", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_autobrake = {"autobrake", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_autobrake2 = {"autobrake2", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_autobrake2 = {"autobrake2", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
|
static CV_PossibleValue_t deadzone_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
|
||||||
|
consvar_t cv_deadzone = {"deadzone", "0.25", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
consvar_t cv_deadzone2 = {"deadzone2", "0.25", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
AXISNONE = 0,
|
AXISNONE = 0,
|
||||||
|
@ -401,7 +412,6 @@ typedef enum
|
||||||
AXISMOVE,
|
AXISMOVE,
|
||||||
AXISLOOK,
|
AXISLOOK,
|
||||||
AXISSTRAFE,
|
AXISSTRAFE,
|
||||||
AXISDEAD, //Axises that don't want deadzones
|
|
||||||
AXISJUMP,
|
AXISJUMP,
|
||||||
AXISSPIN,
|
AXISSPIN,
|
||||||
AXISFIRE,
|
AXISFIRE,
|
||||||
|
@ -882,12 +892,6 @@ static INT32 JoyAxis(axis_input_e axissel)
|
||||||
retaxis = -JOYAXISRANGE;
|
retaxis = -JOYAXISRANGE;
|
||||||
if (retaxis > (+JOYAXISRANGE))
|
if (retaxis > (+JOYAXISRANGE))
|
||||||
retaxis = +JOYAXISRANGE;
|
retaxis = +JOYAXISRANGE;
|
||||||
if (!Joystick.bGamepadStyle && axissel < AXISDEAD)
|
|
||||||
{
|
|
||||||
const INT32 jdeadzone = JOYAXISRANGE/4;
|
|
||||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (flp) retaxis = -retaxis; //flip it around
|
if (flp) retaxis = -retaxis; //flip it around
|
||||||
return retaxis;
|
return retaxis;
|
||||||
}
|
}
|
||||||
|
@ -955,16 +959,75 @@ static INT32 Joy2Axis(axis_input_e axissel)
|
||||||
retaxis = -JOYAXISRANGE;
|
retaxis = -JOYAXISRANGE;
|
||||||
if (retaxis > (+JOYAXISRANGE))
|
if (retaxis > (+JOYAXISRANGE))
|
||||||
retaxis = +JOYAXISRANGE;
|
retaxis = +JOYAXISRANGE;
|
||||||
if (!Joystick2.bGamepadStyle && axissel < AXISDEAD)
|
|
||||||
{
|
|
||||||
const INT32 jdeadzone = JOYAXISRANGE/4;
|
|
||||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (flp) retaxis = -retaxis; //flip it around
|
if (flp) retaxis = -retaxis; //flip it around
|
||||||
return retaxis;
|
return retaxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Take a magnitude of two axes, and adjust it to take out the deadzone
|
||||||
|
// Will return a value between 0 and JOYAXISRANGE
|
||||||
|
static INT32 G_BasicDeadZoneCalculation(INT32 magnitude, fixed_t deadZone)
|
||||||
|
{
|
||||||
|
const INT32 jdeadzone = (JOYAXISRANGE * deadZone) / FRACUNIT;
|
||||||
|
INT32 deadzoneAppliedValue = 0;
|
||||||
|
|
||||||
|
if (jdeadzone > 0)
|
||||||
|
{
|
||||||
|
if (magnitude > jdeadzone)
|
||||||
|
{
|
||||||
|
INT32 adjustedMagnitude = abs(magnitude);
|
||||||
|
adjustedMagnitude = min(adjustedMagnitude, JOYAXISRANGE);
|
||||||
|
|
||||||
|
adjustedMagnitude -= jdeadzone;
|
||||||
|
|
||||||
|
deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return deadzoneAppliedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the actual sensible radial value for a joystick axis when accounting for a deadzone
|
||||||
|
static void G_HandleAxisDeadZone(UINT8 splitnum, joystickvector2_t *joystickvector)
|
||||||
|
{
|
||||||
|
INT32 gamepadStyle = Joystick.bGamepadStyle;
|
||||||
|
fixed_t deadZone = cv_deadzone.value;
|
||||||
|
|
||||||
|
if (splitnum == 1)
|
||||||
|
{
|
||||||
|
gamepadStyle = Joystick2.bGamepadStyle;
|
||||||
|
deadZone = cv_deadzone2.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When gamepadstyle is "true" the values are just -1, 0, or 1. This is done in the interface code.
|
||||||
|
if (!gamepadStyle)
|
||||||
|
{
|
||||||
|
// Get the total magnitude of the 2 axes
|
||||||
|
INT32 magnitude = (joystickvector->xaxis * joystickvector->xaxis) + (joystickvector->yaxis * joystickvector->yaxis);
|
||||||
|
INT32 normalisedXAxis;
|
||||||
|
INT32 normalisedYAxis;
|
||||||
|
INT32 normalisedMagnitude;
|
||||||
|
double dMagnitude = sqrt((double)magnitude);
|
||||||
|
magnitude = (INT32)dMagnitude;
|
||||||
|
|
||||||
|
// Get the normalised xy values from the magnitude
|
||||||
|
normalisedXAxis = (joystickvector->xaxis * magnitude) / JOYAXISRANGE;
|
||||||
|
normalisedYAxis = (joystickvector->yaxis * magnitude) / JOYAXISRANGE;
|
||||||
|
|
||||||
|
// Apply the deadzone to the magnitude to give a correct value between 0 and JOYAXISRANGE
|
||||||
|
normalisedMagnitude = G_BasicDeadZoneCalculation(magnitude, deadZone);
|
||||||
|
|
||||||
|
// Apply the deadzone to the xy axes
|
||||||
|
joystickvector->xaxis = (normalisedXAxis * normalisedMagnitude) / JOYAXISRANGE;
|
||||||
|
joystickvector->yaxis = (normalisedYAxis * normalisedMagnitude) / JOYAXISRANGE;
|
||||||
|
|
||||||
|
// Cap the values so they don't go above the correct maximum
|
||||||
|
joystickvector->xaxis = min(joystickvector->xaxis, JOYAXISRANGE);
|
||||||
|
joystickvector->xaxis = max(joystickvector->xaxis, -JOYAXISRANGE);
|
||||||
|
joystickvector->yaxis = min(joystickvector->yaxis, JOYAXISRANGE);
|
||||||
|
joystickvector->yaxis = max(joystickvector->yaxis, -JOYAXISRANGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// G_BuildTiccmd
|
// G_BuildTiccmd
|
||||||
|
@ -985,12 +1048,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
{
|
{
|
||||||
boolean forcestrafe = false;
|
boolean forcestrafe = false;
|
||||||
boolean forcefullinput = false;
|
boolean forcefullinput = false;
|
||||||
INT32 tspeed, forward, side, axis, altaxis, i;
|
INT32 tspeed, forward, side, axis, strafeaxis, moveaxis, turnaxis, lookaxis, i;
|
||||||
const INT32 speed = 1;
|
const INT32 speed = 1;
|
||||||
// these ones used for multiple conditions
|
// these ones used for multiple conditions
|
||||||
boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming;
|
boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming;
|
||||||
player_t *player = &players[consoleplayer];
|
player_t *player = &players[consoleplayer];
|
||||||
camera_t *thiscam = &camera;
|
camera_t *thiscam = &camera;
|
||||||
|
joystickvector2_t movejoystickvector, lookjoystickvector;
|
||||||
|
|
||||||
static INT32 turnheld; // for accelerative turning
|
static INT32 turnheld; // for accelerative turning
|
||||||
static boolean keyboard_look; // true if lookup/down using keyboard
|
static boolean keyboard_look; // true if lookup/down using keyboard
|
||||||
|
@ -1030,11 +1094,16 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
localaiming = 0;
|
localaiming = 0;
|
||||||
joyaiming = thisjoyaiming;
|
joyaiming = thisjoyaiming;
|
||||||
|
|
||||||
axis = JoyAxis(AXISTURN);
|
turnaxis = JoyAxis(AXISTURN);
|
||||||
if (gamepadjoystickmove && axis != 0)
|
lookaxis = JoyAxis(AXISLOOK);
|
||||||
|
lookjoystickvector.xaxis = turnaxis;
|
||||||
|
lookjoystickvector.yaxis = lookaxis;
|
||||||
|
G_HandleAxisDeadZone(0, &lookjoystickvector);
|
||||||
|
|
||||||
|
if (gamepadjoystickmove && lookjoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
turnright = turnright || (axis > 0);
|
turnright = turnright || (lookjoystickvector.xaxis > 0);
|
||||||
turnleft = turnleft || (axis < 0);
|
turnleft = turnleft || (lookjoystickvector.xaxis < 0);
|
||||||
}
|
}
|
||||||
forward = side = 0;
|
forward = side = 0;
|
||||||
|
|
||||||
|
@ -1074,10 +1143,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
if (turnleft)
|
if (turnleft)
|
||||||
side -= sidemove[speed];
|
side -= sidemove[speed];
|
||||||
|
|
||||||
if (analogjoystickmove && axis != 0)
|
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||||
side += ((axis * sidemove[1]) >> 10);
|
side += ((lookjoystickvector.xaxis * sidemove[1]) >> 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cv_analog.value) // Analog
|
else if (cv_analog.value) // Analog
|
||||||
|
@ -1094,41 +1163,44 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
else if (turnleft)
|
else if (turnleft)
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
|
cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
|
||||||
|
|
||||||
if (analogjoystickmove && axis != 0)
|
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
// JOYAXISRANGE should be 1023 (divide by 1024)
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - ((axis * angleturn[1]) >> 10)); // ANALOG!
|
cmd->angleturn = (INT16)(cmd->angleturn - ((lookjoystickvector.xaxis * angleturn[1]) >> 10)); // ANALOG!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
axis = JoyAxis(AXISSTRAFE);
|
strafeaxis = JoyAxis(AXISSTRAFE);
|
||||||
if (gamepadjoystickmove && axis != 0)
|
moveaxis = JoyAxis(AXISMOVE);
|
||||||
|
movejoystickvector.xaxis = strafeaxis;
|
||||||
|
movejoystickvector.yaxis = moveaxis;
|
||||||
|
G_HandleAxisDeadZone(0, &movejoystickvector);
|
||||||
|
|
||||||
|
if (gamepadjoystickmove && movejoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
if (axis < 0)
|
if (movejoystickvector.xaxis > 0)
|
||||||
side += sidemove[speed];
|
side += sidemove[speed];
|
||||||
else if (axis > 0)
|
else if (movejoystickvector.xaxis < 0)
|
||||||
side -= sidemove[speed];
|
side -= sidemove[speed];
|
||||||
}
|
}
|
||||||
else if (analogjoystickmove && axis != 0)
|
else if (analogjoystickmove && movejoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||||
side += ((axis * sidemove[1]) >> 10);
|
side += ((movejoystickvector.xaxis * sidemove[1]) >> 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// forward with key or button
|
// forward with key or button
|
||||||
axis = JoyAxis(AXISMOVE);
|
if (movefkey || (gamepadjoystickmove && movejoystickvector.yaxis < 0)
|
||||||
altaxis = JoyAxis(AXISLOOK);
|
|
||||||
if (movefkey || (gamepadjoystickmove && axis < 0)
|
|
||||||
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||||
&& (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && altaxis < 0))))
|
&& (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0))))
|
||||||
forward = forwardmove[speed];
|
forward = forwardmove[speed];
|
||||||
if (movebkey || (gamepadjoystickmove && axis > 0)
|
if (movebkey || (gamepadjoystickmove && movejoystickvector.yaxis > 0)
|
||||||
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||||
&& (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0))))
|
&& (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0))))
|
||||||
forward -= forwardmove[speed];
|
forward -= forwardmove[speed];
|
||||||
|
|
||||||
if (analogjoystickmove && axis != 0)
|
if (analogjoystickmove && movejoystickvector.yaxis != 0)
|
||||||
forward -= ((axis * forwardmove[1]) >> 10); // ANALOG!
|
forward -= ((movejoystickvector.yaxis * forwardmove[1]) >> 10); // ANALOG!
|
||||||
|
|
||||||
// some people strafe left & right with mouse buttons
|
// some people strafe left & right with mouse buttons
|
||||||
// those people are weird
|
// those people are weird
|
||||||
|
@ -1211,9 +1283,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
localaiming += (mlooky<<19)*player_invert*screen_invert;
|
localaiming += (mlooky<<19)*player_invert*screen_invert;
|
||||||
}
|
}
|
||||||
|
|
||||||
axis = JoyAxis(AXISLOOK);
|
if (analogjoystickmove && joyaiming && lookjoystickvector.yaxis != 0 && cv_lookaxis.value != 0)
|
||||||
if (analogjoystickmove && joyaiming && axis != 0 && cv_lookaxis.value != 0)
|
localaiming += (lookjoystickvector.yaxis<<16) * screen_invert;
|
||||||
localaiming += (axis<<16) * screen_invert;
|
|
||||||
|
|
||||||
// spring back if not using keyboard neither mouselookin'
|
// spring back if not using keyboard neither mouselookin'
|
||||||
if (!keyboard_look && cv_lookaxis.value == 0 && !joyaiming && !mouseaiming)
|
if (!keyboard_look && cv_lookaxis.value == 0 && !joyaiming && !mouseaiming)
|
||||||
|
@ -1221,12 +1292,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
|
|
||||||
if (!(player->powers[pw_carry] == CR_NIGHTSMODE))
|
if (!(player->powers[pw_carry] == CR_NIGHTSMODE))
|
||||||
{
|
{
|
||||||
if (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0))
|
if (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0))
|
||||||
{
|
{
|
||||||
localaiming += KB_LOOKSPEED * screen_invert;
|
localaiming += KB_LOOKSPEED * screen_invert;
|
||||||
keyboard_look = true;
|
keyboard_look = true;
|
||||||
}
|
}
|
||||||
else if (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0))
|
else if (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0))
|
||||||
{
|
{
|
||||||
localaiming -= KB_LOOKSPEED * screen_invert;
|
localaiming -= KB_LOOKSPEED * screen_invert;
|
||||||
keyboard_look = true;
|
keyboard_look = true;
|
||||||
|
@ -1316,12 +1387,13 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
{
|
{
|
||||||
boolean forcestrafe = false;
|
boolean forcestrafe = false;
|
||||||
boolean forcefullinput = false;
|
boolean forcefullinput = false;
|
||||||
INT32 tspeed, forward, side, axis, altaxis, i;
|
INT32 tspeed, forward, side, axis, strafeaxis, moveaxis, turnaxis, lookaxis, i;
|
||||||
const INT32 speed = 1;
|
const INT32 speed = 1;
|
||||||
// these ones used for multiple conditions
|
// these ones used for multiple conditions
|
||||||
boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming;
|
boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming;
|
||||||
player_t *player = &players[secondarydisplayplayer];
|
player_t *player = &players[secondarydisplayplayer];
|
||||||
camera_t *thiscam = (player->bot == 2 ? &camera : &camera2);
|
camera_t *thiscam = (player->bot == 2 ? &camera : &camera2);
|
||||||
|
joystickvector2_t movejoystickvector, lookjoystickvector;
|
||||||
|
|
||||||
static INT32 turnheld; // for accelerative turning
|
static INT32 turnheld; // for accelerative turning
|
||||||
static boolean keyboard_look; // true if lookup/down using keyboard
|
static boolean keyboard_look; // true if lookup/down using keyboard
|
||||||
|
@ -1359,11 +1431,16 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
localaiming2 = 0;
|
localaiming2 = 0;
|
||||||
joyaiming = thisjoyaiming;
|
joyaiming = thisjoyaiming;
|
||||||
|
|
||||||
axis = Joy2Axis(AXISTURN);
|
turnaxis = Joy2Axis(AXISTURN);
|
||||||
if (gamepadjoystickmove && axis != 0)
|
lookaxis = Joy2Axis(AXISLOOK);
|
||||||
|
lookjoystickvector.xaxis = turnaxis;
|
||||||
|
lookjoystickvector.yaxis = lookaxis;
|
||||||
|
G_HandleAxisDeadZone(1, &lookjoystickvector);
|
||||||
|
|
||||||
|
if (gamepadjoystickmove && lookjoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
turnright = turnright || (axis > 0);
|
turnright = turnright || (lookjoystickvector.xaxis > 0);
|
||||||
turnleft = turnleft || (axis < 0);
|
turnleft = turnleft || (lookjoystickvector.xaxis < 0);
|
||||||
}
|
}
|
||||||
forward = side = 0;
|
forward = side = 0;
|
||||||
|
|
||||||
|
@ -1404,10 +1481,10 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
if (turnleft)
|
if (turnleft)
|
||||||
side -= sidemove[speed];
|
side -= sidemove[speed];
|
||||||
|
|
||||||
if (analogjoystickmove && axis != 0)
|
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||||
side += ((axis * sidemove[1]) >> 10);
|
side += ((lookjoystickvector.xaxis * sidemove[1]) >> 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cv_analog2.value) // Analog
|
else if (cv_analog2.value) // Analog
|
||||||
|
@ -1424,41 +1501,44 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
else if (turnleft)
|
else if (turnleft)
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
|
cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
|
||||||
|
|
||||||
if (analogjoystickmove && axis != 0)
|
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
// JOYAXISRANGE should be 1023 (divide by 1024)
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - ((axis * angleturn[1]) >> 10)); // ANALOG!
|
cmd->angleturn = (INT16)(cmd->angleturn - ((lookjoystickvector.xaxis * angleturn[1]) >> 10)); // ANALOG!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
axis = Joy2Axis(AXISSTRAFE);
|
strafeaxis = Joy2Axis(AXISSTRAFE);
|
||||||
if (gamepadjoystickmove && axis != 0)
|
moveaxis = Joy2Axis(AXISMOVE);
|
||||||
|
movejoystickvector.xaxis = strafeaxis;
|
||||||
|
movejoystickvector.yaxis = moveaxis;
|
||||||
|
G_HandleAxisDeadZone(1, &movejoystickvector);
|
||||||
|
|
||||||
|
if (gamepadjoystickmove && movejoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
if (axis < 0)
|
if (movejoystickvector.xaxis > 0)
|
||||||
side += sidemove[speed];
|
side += sidemove[speed];
|
||||||
else if (axis > 0)
|
else if (movejoystickvector.xaxis < 0)
|
||||||
side -= sidemove[speed];
|
side -= sidemove[speed];
|
||||||
}
|
}
|
||||||
else if (analogjoystickmove && axis != 0)
|
else if (analogjoystickmove && movejoystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||||
side += ((axis * sidemove[1]) >> 10);
|
side += ((movejoystickvector.xaxis * sidemove[1]) >> 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// forward with key or button
|
// forward with key or button
|
||||||
axis = Joy2Axis(AXISMOVE);
|
if (movefkey || (gamepadjoystickmove && movejoystickvector.yaxis < 0)
|
||||||
altaxis = Joy2Axis(AXISLOOK);
|
|
||||||
if (movefkey || (gamepadjoystickmove && axis < 0)
|
|
||||||
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||||
&& (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && altaxis < 0))))
|
&& (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0))))
|
||||||
forward = forwardmove[speed];
|
forward = forwardmove[speed];
|
||||||
if (movebkey || (gamepadjoystickmove && axis > 0)
|
if (movebkey || (gamepadjoystickmove && movejoystickvector.yaxis > 0)
|
||||||
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||||
&& (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0))))
|
&& (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0))))
|
||||||
forward -= forwardmove[speed];
|
forward -= forwardmove[speed];
|
||||||
|
|
||||||
if (analogjoystickmove && axis != 0)
|
if (analogjoystickmove && movejoystickvector.yaxis != 0)
|
||||||
forward -= ((axis * forwardmove[1]) >> 10); // ANALOG!
|
forward -= ((movejoystickvector.yaxis * forwardmove[1]) >> 10); // ANALOG!
|
||||||
|
|
||||||
// some people strafe left & right with mouse buttons
|
// some people strafe left & right with mouse buttons
|
||||||
// those people are (still) weird
|
// those people are (still) weird
|
||||||
|
@ -1538,9 +1618,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
localaiming2 += (mlook2y<<19)*player_invert*screen_invert;
|
localaiming2 += (mlook2y<<19)*player_invert*screen_invert;
|
||||||
}
|
}
|
||||||
|
|
||||||
axis = Joy2Axis(AXISLOOK);
|
if (analogjoystickmove && joyaiming && lookjoystickvector.yaxis != 0 && cv_lookaxis2.value != 0)
|
||||||
if (analogjoystickmove && joyaiming && axis != 0 && cv_lookaxis2.value != 0)
|
localaiming2 += (lookjoystickvector.yaxis<<16) * screen_invert;
|
||||||
localaiming2 += (axis<<16) * screen_invert;
|
|
||||||
|
|
||||||
// spring back if not using keyboard neither mouselookin'
|
// spring back if not using keyboard neither mouselookin'
|
||||||
if (!keyboard_look && cv_lookaxis2.value == 0 && !joyaiming && !mouseaiming)
|
if (!keyboard_look && cv_lookaxis2.value == 0 && !joyaiming && !mouseaiming)
|
||||||
|
@ -1548,12 +1627,12 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
|
|
||||||
if (!(player->powers[pw_carry] == CR_NIGHTSMODE))
|
if (!(player->powers[pw_carry] == CR_NIGHTSMODE))
|
||||||
{
|
{
|
||||||
if (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0))
|
if (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0))
|
||||||
{
|
{
|
||||||
localaiming2 += KB_LOOKSPEED * screen_invert;
|
localaiming2 += KB_LOOKSPEED * screen_invert;
|
||||||
keyboard_look = true;
|
keyboard_look = true;
|
||||||
}
|
}
|
||||||
else if (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0))
|
else if (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0))
|
||||||
{
|
{
|
||||||
localaiming2 -= KB_LOOKSPEED * screen_invert;
|
localaiming2 -= KB_LOOKSPEED * screen_invert;
|
||||||
keyboard_look = true;
|
keyboard_look = true;
|
||||||
|
@ -1804,9 +1883,6 @@ void G_DoLoadLevel(boolean resetplayer)
|
||||||
//
|
//
|
||||||
void G_StartTitleCard(void)
|
void G_StartTitleCard(void)
|
||||||
{
|
{
|
||||||
wipestyleflags |= WSF_FADEIN;
|
|
||||||
wipestyleflags &= ~WSF_FADEOUT;
|
|
||||||
|
|
||||||
// The title card has been disabled for this map.
|
// The title card has been disabled for this map.
|
||||||
// Oh well.
|
// Oh well.
|
||||||
if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
||||||
|
@ -1850,6 +1926,8 @@ void G_PreLevelTitleCard(void)
|
||||||
if (takescreenshot) // Only take screenshots after drawing.
|
if (takescreenshot) // Only take screenshots after drawing.
|
||||||
M_DoScreenShot();
|
M_DoScreenShot();
|
||||||
}
|
}
|
||||||
|
if (!cv_showhud.value)
|
||||||
|
wipestyleflags = WSF_CROSSFADE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 pausedelay = 0;
|
INT32 pausedelay = 0;
|
||||||
|
|
|
@ -72,6 +72,7 @@ extern consvar_t cv_useranalog, cv_useranalog2;
|
||||||
extern consvar_t cv_analog, cv_analog2;
|
extern consvar_t cv_analog, cv_analog2;
|
||||||
extern consvar_t cv_directionchar, cv_directionchar2;
|
extern consvar_t cv_directionchar, cv_directionchar2;
|
||||||
extern consvar_t cv_autobrake, cv_autobrake2;
|
extern consvar_t cv_autobrake, cv_autobrake2;
|
||||||
|
extern consvar_t cv_deadzone, cv_deadzone2;
|
||||||
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis;
|
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis;
|
||||||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2;
|
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2;
|
||||||
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest;
|
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest;
|
||||||
|
|
|
@ -33,10 +33,6 @@
|
||||||
#include "../r_patch.h"
|
#include "../r_patch.h"
|
||||||
#include "../p_setup.h"
|
#include "../p_setup.h"
|
||||||
|
|
||||||
//Hurdler: 25/04/2000: used for new colormap code in hardware mode
|
|
||||||
//static UINT8 *gr_colormap = NULL; // by default it must be NULL ! (because colormap tables are not initialized)
|
|
||||||
boolean firetranslucent = false;
|
|
||||||
|
|
||||||
// Values set after a call to HWR_ResizeBlock()
|
// Values set after a call to HWR_ResizeBlock()
|
||||||
static INT32 blocksize, blockwidth, blockheight;
|
static INT32 blocksize, blockwidth, blockheight;
|
||||||
|
|
||||||
|
@ -122,18 +118,16 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||||
|
|
||||||
texel = source[yfrac>>FRACBITS];
|
texel = source[yfrac>>FRACBITS];
|
||||||
|
|
||||||
if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel))
|
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||||
alpha = 0x80;
|
if (mipmap->colormap)
|
||||||
|
texel = mipmap->colormap[texel];
|
||||||
|
|
||||||
|
// transparent pixel
|
||||||
|
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||||
|
alpha = 0x00;
|
||||||
else
|
else
|
||||||
alpha = 0xff;
|
alpha = 0xff;
|
||||||
|
|
||||||
//Hurdler: not perfect, but better than holes
|
|
||||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
|
||||||
texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
|
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
|
||||||
else if (mipmap->colormap)
|
|
||||||
texel = mipmap->colormap[texel];
|
|
||||||
|
|
||||||
// hope compiler will get this switch out of the loops (dreams...)
|
// hope compiler will get this switch out of the loops (dreams...)
|
||||||
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
||||||
// Alam: SRB2 uses Mingw, HUGS
|
// Alam: SRB2 uses Mingw, HUGS
|
||||||
|
@ -236,18 +230,16 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
||||||
|
|
||||||
texel = source[yfrac>>FRACBITS];
|
texel = source[yfrac>>FRACBITS];
|
||||||
|
|
||||||
if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel))
|
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||||
alpha = 0x80;
|
if (mipmap->colormap)
|
||||||
|
texel = mipmap->colormap[texel];
|
||||||
|
|
||||||
|
// transparent pixel
|
||||||
|
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||||
|
alpha = 0x00;
|
||||||
else
|
else
|
||||||
alpha = 0xff;
|
alpha = 0xff;
|
||||||
|
|
||||||
//Hurdler: not perfect, but better than holes
|
|
||||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
|
||||||
texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
|
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
|
||||||
else if (mipmap->colormap)
|
|
||||||
texel = mipmap->colormap[texel];
|
|
||||||
|
|
||||||
// hope compiler will get this switch out of the loops (dreams...)
|
// hope compiler will get this switch out of the loops (dreams...)
|
||||||
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
||||||
// Alam: SRB2 uses Mingw, HUGS
|
// Alam: SRB2 uses Mingw, HUGS
|
||||||
|
@ -576,7 +568,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||||
{
|
{
|
||||||
UINT8 *block;
|
UINT8 *block;
|
||||||
INT32 bpp, i;
|
INT32 bpp, i;
|
||||||
UINT16 bu16 = ((0x00 <<8) | HWR_CHROMAKEY_EQUIVALENTCOLORINDEX);
|
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||||
|
|
||||||
bpp = format2bpp[grMipmap->grInfo.format];
|
bpp = format2bpp[grMipmap->grInfo.format];
|
||||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data));
|
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data));
|
||||||
|
@ -606,6 +598,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
||||||
texture_t *texture;
|
texture_t *texture;
|
||||||
texpatch_t *patch;
|
texpatch_t *patch;
|
||||||
patch_t *realpatch;
|
patch_t *realpatch;
|
||||||
|
UINT8 *pdata;
|
||||||
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
boolean skyspecial = false; //poor hack for Legacy large skies..
|
boolean skyspecial = false; //poor hack for Legacy large skies..
|
||||||
|
@ -638,7 +631,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
||||||
INT32 j;
|
INT32 j;
|
||||||
RGBA_t col;
|
RGBA_t col;
|
||||||
|
|
||||||
col = V_GetColor(HWR_CHROMAKEY_EQUIVALENTCOLORINDEX);
|
col = V_GetColor(HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||||
for (j = 0; j < blockheight; j++)
|
for (j = 0; j < blockheight; j++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < blockwidth; i++)
|
for (i = 0; i < blockwidth; i++)
|
||||||
|
@ -654,19 +647,30 @@ 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
|
boolean dealloc = true;
|
||||||
size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump);
|
size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump);
|
||||||
#endif
|
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||||
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
realpatch = (patch_t *)pdata;
|
||||||
|
|
||||||
#ifndef NO_PNG_LUMPS
|
#ifndef NO_PNG_LUMPS
|
||||||
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
||||||
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
|
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
HWR_DrawTexturePatchInCache(&grtex->mipmap,
|
#ifdef WALLFLATS
|
||||||
blockwidth, blockheight,
|
if (texture->type == TEXTURETYPE_FLAT)
|
||||||
texture, patch,
|
realpatch = R_FlatToPatch(pdata, texture->width, texture->height, 0, 0, NULL, false);
|
||||||
realpatch);
|
else
|
||||||
Z_Unlock(realpatch);
|
#endif
|
||||||
|
{
|
||||||
|
(void)lumplength;
|
||||||
|
dealloc = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
HWR_DrawTexturePatchInCache(&grtex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
|
||||||
|
|
||||||
|
if (dealloc)
|
||||||
|
Z_Unlock(realpatch);
|
||||||
}
|
}
|
||||||
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
||||||
if (format2bpp[grtex->mipmap.grInfo.format]==4)
|
if (format2bpp[grtex->mipmap.grInfo.format]==4)
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef unsigned char FBOOLEAN;
|
||||||
|
|
||||||
// byte value for paletted graphics, which represent the transparent color
|
// byte value for paletted graphics, which represent the transparent color
|
||||||
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 255
|
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 255
|
||||||
#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
|
//#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
|
||||||
|
|
||||||
// the chroma key color shows on border sprites, set it to black
|
// the chroma key color shows on border sprites, set it to black
|
||||||
#define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen()
|
#define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen()
|
||||||
|
|
|
@ -128,6 +128,5 @@ extern consvar_t cv_grrounddown; // on/off
|
||||||
|
|
||||||
extern INT32 patchformat;
|
extern INT32 patchformat;
|
||||||
extern INT32 textureformat;
|
extern INT32 textureformat;
|
||||||
extern boolean firetranslucent;
|
|
||||||
|
|
||||||
#endif //_HW_GLOB_
|
#endif //_HW_GLOB_
|
||||||
|
|
|
@ -963,7 +963,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||||
{
|
{
|
||||||
grmip = 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)
|
if (grmip->downloaded && grmip->grInfo.data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -184,10 +184,6 @@ void I_StartupMouse(void);
|
||||||
*/
|
*/
|
||||||
void I_StartupMouse2(void);
|
void I_StartupMouse2(void);
|
||||||
|
|
||||||
/** \brief keyboard startup, shutdown, handler
|
|
||||||
*/
|
|
||||||
void I_StartupKeyboard(void);
|
|
||||||
|
|
||||||
/** \brief setup timer irq and user timer routine.
|
/** \brief setup timer irq and user timer routine.
|
||||||
*/
|
*/
|
||||||
void I_StartupTimer(void);
|
void I_StartupTimer(void);
|
||||||
|
|
35
src/i_tcp.c
35
src/i_tcp.c
|
@ -209,7 +209,8 @@ static size_t numbans = 0;
|
||||||
static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
|
static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
|
||||||
static boolean init_tcp_driver = false;
|
static boolean init_tcp_driver = false;
|
||||||
|
|
||||||
static char port_name[8] = DEFAULTPORT;
|
static const char *serverport_name = DEFAULTPORT;
|
||||||
|
static const char *clientport_name;/* any port */
|
||||||
|
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
|
|
||||||
|
@ -887,6 +888,7 @@ static boolean UDP_Socket(void)
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
const INT32 b_ipv6 = M_CheckParm("-ipv6");
|
const INT32 b_ipv6 = M_CheckParm("-ipv6");
|
||||||
#endif
|
#endif
|
||||||
|
const char *serv;
|
||||||
|
|
||||||
|
|
||||||
for (s = 0; s < mysocketses; s++)
|
for (s = 0; s < mysocketses; s++)
|
||||||
|
@ -902,11 +904,16 @@ static boolean UDP_Socket(void)
|
||||||
hints.ai_socktype = SOCK_DGRAM;
|
hints.ai_socktype = SOCK_DGRAM;
|
||||||
hints.ai_protocol = IPPROTO_UDP;
|
hints.ai_protocol = IPPROTO_UDP;
|
||||||
|
|
||||||
|
if (serverrunning)
|
||||||
|
serv = serverport_name;
|
||||||
|
else
|
||||||
|
serv = clientport_name;
|
||||||
|
|
||||||
if (M_CheckParm("-bindaddr"))
|
if (M_CheckParm("-bindaddr"))
|
||||||
{
|
{
|
||||||
while (M_IsNextParm())
|
while (M_IsNextParm())
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
|
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
|
@ -927,7 +934,7 @@ static boolean UDP_Socket(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo("0.0.0.0", port_name, &hints, &ai);
|
gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
|
@ -942,8 +949,8 @@ static boolean UDP_Socket(void)
|
||||||
#ifdef HAVE_MINIUPNPC
|
#ifdef HAVE_MINIUPNPC
|
||||||
if (UPNP_support)
|
if (UPNP_support)
|
||||||
{
|
{
|
||||||
I_UPnP_rem(port_name, "UDP");
|
I_UPnP_rem(serverport_name, "UDP");
|
||||||
I_UPnP_add(NULL, port_name, "UDP");
|
I_UPnP_add(NULL, serverport_name, "UDP");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -960,7 +967,7 @@ static boolean UDP_Socket(void)
|
||||||
{
|
{
|
||||||
while (M_IsNextParm())
|
while (M_IsNextParm())
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
|
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
|
@ -981,7 +988,7 @@ static boolean UDP_Socket(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo("::", port_name, &hints, &ai);
|
gaie = I_getaddrinfo("::", serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
|
@ -1421,15 +1428,19 @@ boolean I_InitTcpNetwork(void)
|
||||||
if (!I_InitTcpDriver())
|
if (!I_InitTcpDriver())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (M_CheckParm("-port"))
|
if (M_CheckParm("-port") || M_CheckParm("-serverport"))
|
||||||
// Combined -udpport and -clientport into -port
|
// Combined -udpport and -clientport into -port
|
||||||
// As it was really redundant having two seperate parms that does the same thing
|
// As it was really redundant having two seperate parms that does the same thing
|
||||||
|
/* Sorry Steel, I'm adding these back. But -udpport is a stupid name. */
|
||||||
{
|
{
|
||||||
if (M_IsNextParm())
|
/*
|
||||||
strcpy(port_name, M_GetNextParm());
|
If it's NULL, that's okay! Because then
|
||||||
else
|
we'll get a random port from getaddrinfo.
|
||||||
strcpy(port_name, "0");
|
*/
|
||||||
|
serverport_name = M_GetNextParm();
|
||||||
}
|
}
|
||||||
|
if (M_CheckParm("-clientport"))
|
||||||
|
clientport_name = M_GetNextParm();
|
||||||
|
|
||||||
// parse network game options,
|
// parse network game options,
|
||||||
if (M_CheckParm("-server") || dedicated)
|
if (M_CheckParm("-server") || dedicated)
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
#include "m_misc.h"
|
#include "m_misc.h"
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
#include "hardware/hw_main.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// GIFs are always little-endian
|
// GIFs are always little-endian
|
||||||
#include "byteptr.h"
|
#include "byteptr.h"
|
||||||
|
|
||||||
|
@ -29,6 +33,7 @@ consvar_t cv_gif_downscale = {"gif_downscale", "On", CV_SAVE, CV_OnOff, NULL, 0
|
||||||
#ifdef HAVE_ANIGIF
|
#ifdef HAVE_ANIGIF
|
||||||
static boolean gif_optimize = false; // So nobody can do something dumb
|
static boolean gif_optimize = false; // So nobody can do something dumb
|
||||||
static boolean gif_downscale = false; // like changing cvars mid output
|
static boolean gif_downscale = false; // like changing cvars mid output
|
||||||
|
static RGBA_t *gif_palette = NULL;
|
||||||
|
|
||||||
static FILE *gif_out = NULL;
|
static FILE *gif_out = NULL;
|
||||||
static INT32 gif_frames = 0;
|
static INT32 gif_frames = 0;
|
||||||
|
@ -428,10 +433,7 @@ static void GIF_headwrite(void)
|
||||||
|
|
||||||
// write color table
|
// write color table
|
||||||
{
|
{
|
||||||
RGBA_t *pal = ((cv_screenshot_colorprofile.value)
|
RGBA_t *pal = gif_palette;
|
||||||
? pLocalPalette
|
|
||||||
: pMasterPalette);
|
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
WRITEUINT8(p, pal[i].s.red);
|
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 UINT8 *gifframe_data = NULL;
|
||||||
static size_t gifframe_size = 8192;
|
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
|
// GIF_framewrite
|
||||||
// writes a frame into the file.
|
// 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);
|
GIF_optimizeregion(cur_screen, movie_screen, &blitx, &blity, &blitw, &blith);
|
||||||
|
|
||||||
// blit to temp screen
|
// 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
|
else
|
||||||
{
|
{
|
||||||
|
@ -491,7 +524,18 @@ static void GIF_framewrite(void)
|
||||||
blith = vid.height;
|
blith = vid.height;
|
||||||
|
|
||||||
if (gif_frames == 0)
|
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];
|
movie_screen = screens[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,7 +624,7 @@ static void GIF_framewrite(void)
|
||||||
//
|
//
|
||||||
INT32 GIF_open(const char *filename)
|
INT32 GIF_open(const char *filename)
|
||||||
{
|
{
|
||||||
#ifdef HWRENDER
|
#if 0
|
||||||
if (rendermode != render_soft)
|
if (rendermode != render_soft)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("GIFs cannot be taken in non-software modes!\n"));
|
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_optimize = (!!cv_gif_optimize.value);
|
||||||
gif_downscale = (!!cv_gif_downscale.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_headwrite();
|
||||||
gif_frames = 0;
|
gif_frames = 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
22
src/m_menu.c
22
src/m_menu.c
|
@ -1119,6 +1119,8 @@ static menuitem_t OP_Joystick1Menu[] =
|
||||||
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook, 120},
|
{IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook, 120},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook, 130},
|
{IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook, 130},
|
||||||
|
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER,
|
||||||
|
NULL, "Deadzone", &cv_deadzone, 140 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static menuitem_t OP_Joystick2Menu[] =
|
static menuitem_t OP_Joystick2Menu[] =
|
||||||
|
@ -1135,6 +1137,8 @@ static menuitem_t OP_Joystick2Menu[] =
|
||||||
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook2,120},
|
{IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook2,120},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook2, 130},
|
{IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook2, 130},
|
||||||
|
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER,
|
||||||
|
NULL, "Deadzone", &cv_deadzone2, 140 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static menuitem_t OP_JoystickSetMenu[1+MAX_JOYSTICKS];
|
static menuitem_t OP_JoystickSetMenu[1+MAX_JOYSTICKS];
|
||||||
|
@ -1308,18 +1312,18 @@ static menuitem_t OP_OpenGLOptionsMenu[] =
|
||||||
{IT_STRING|IT_CVAR, NULL, "Model lighting", &cv_grmodellighting, 32},
|
{IT_STRING|IT_CVAR, NULL, "Model lighting", &cv_grmodellighting, 32},
|
||||||
|
|
||||||
{IT_HEADER, NULL, "General", NULL, 51},
|
{IT_HEADER, NULL, "General", NULL, 51},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Field of view", &cv_grfov, 62},
|
{IT_STRING|IT_CVAR, NULL, "Field of view", &cv_grfov, 63},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 72},
|
{IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 73},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 82},
|
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 83},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode,92},
|
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode,93},
|
||||||
|
|
||||||
{IT_HEADER, NULL, "Miscellaneous", NULL, 111},
|
{IT_HEADER, NULL, "Miscellaneous", NULL, 112},
|
||||||
{IT_SUBMENU|IT_STRING, NULL, "Fog...", &OP_OpenGLFogDef, 123},
|
{IT_SUBMENU|IT_STRING, NULL, "Fog...", &OP_OpenGLFogDef, 124},
|
||||||
#ifdef ALAM_LIGHTING
|
#ifdef ALAM_LIGHTING
|
||||||
{IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 133},
|
{IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 134},
|
||||||
#endif
|
#endif
|
||||||
#if defined (_WINDOWS) && (!((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)))
|
#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
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3020,7 +3024,7 @@ boolean M_Responder(event_t *ev)
|
||||||
}
|
}
|
||||||
else if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime())
|
else if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime())
|
||||||
{
|
{
|
||||||
const INT32 jdeadzone = JOYAXISRANGE/4;
|
const INT32 jdeadzone = (JOYAXISRANGE * cv_deadzone.value) / FRACUNIT;
|
||||||
if (ev->data3 != INT32_MAX)
|
if (ev->data3 != INT32_MAX)
|
||||||
{
|
{
|
||||||
if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone)
|
if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone)
|
||||||
|
|
|
@ -1161,12 +1161,8 @@ void M_StartMovie(void)
|
||||||
switch (cv_moviemode.value)
|
switch (cv_moviemode.value)
|
||||||
{
|
{
|
||||||
case MM_GIF:
|
case MM_GIF:
|
||||||
if (rendermode == render_soft)
|
moviemode = M_StartMovieGIF(pathname);
|
||||||
{
|
break;
|
||||||
moviemode = M_StartMovieGIF(pathname);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* FALLTHRU */
|
|
||||||
case MM_APNG:
|
case MM_APNG:
|
||||||
moviemode = M_StartMovieAPNG(pathname);
|
moviemode = M_StartMovieAPNG(pathname);
|
||||||
break;
|
break;
|
||||||
|
|
26
src/p_spec.c
26
src/p_spec.c
|
@ -138,6 +138,13 @@ static size_t maxanims;
|
||||||
|
|
||||||
static animdef_t *animdefs = NULL;
|
static animdef_t *animdefs = NULL;
|
||||||
|
|
||||||
|
// Increase the size of animdefs to make room for a new animation definition
|
||||||
|
static void GrowAnimDefs(void)
|
||||||
|
{
|
||||||
|
maxanims++;
|
||||||
|
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
// A prototype; here instead of p_spec.h, so they're "private"
|
// A prototype; here instead of p_spec.h, so they're "private"
|
||||||
void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum);
|
void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum);
|
||||||
void P_ParseAnimationDefintion(SINT8 istexture);
|
void P_ParseAnimationDefintion(SINT8 istexture);
|
||||||
|
@ -347,8 +354,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
||||||
if (i == maxanims)
|
if (i == maxanims)
|
||||||
{
|
{
|
||||||
// Increase the size to make room for the new animation definition
|
// Increase the size to make room for the new animation definition
|
||||||
maxanims++;
|
GrowAnimDefs();
|
||||||
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
|
|
||||||
strncpy(animdefs[i].startname, animdefsToken, 9);
|
strncpy(animdefs[i].startname, animdefsToken, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,8 +440,17 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
||||||
}
|
}
|
||||||
animdefs[i].speed = animSpeed;
|
animdefs[i].speed = animSpeed;
|
||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
}
|
|
||||||
|
|
||||||
|
#ifdef WALLFLATS
|
||||||
|
// hehe... uhh.....
|
||||||
|
if (!istexture)
|
||||||
|
{
|
||||||
|
GrowAnimDefs();
|
||||||
|
M_Memcpy(&animdefs[maxanims-1], &animdefs[i], sizeof(animdef_t));
|
||||||
|
animdefs[maxanims-1].istexture = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/** Checks for flats in levelflats that are part of a flat animation sequence
|
/** Checks for flats in levelflats that are part of a flat animation sequence
|
||||||
* and sets them up for animation.
|
* and sets them up for animation.
|
||||||
|
@ -476,7 +491,8 @@ static inline void P_FindAnimatedFlat(INT32 animnum)
|
||||||
atoi(sizeu1(i)), foundflats->name, foundflats->animseq,
|
atoi(sizeu1(i)), foundflats->name, foundflats->animseq,
|
||||||
foundflats->numpics,foundflats->speed);
|
foundflats->numpics,foundflats->speed);
|
||||||
}
|
}
|
||||||
else if (foundflats->u.flat.lumpnum >= startflatnum && foundflats->u.flat.lumpnum <= endflatnum)
|
else if ((!anims[animnum].istexture) && (foundflats->type == LEVELFLAT_FLAT)
|
||||||
|
&& (foundflats->u.flat.lumpnum >= startflatnum && foundflats->u.flat.lumpnum <= endflatnum))
|
||||||
{
|
{
|
||||||
foundflats->u.flat.baselumpnum = startflatnum;
|
foundflats->u.flat.baselumpnum = startflatnum;
|
||||||
foundflats->animseq = foundflats->u.flat.lumpnum - startflatnum;
|
foundflats->animseq = foundflats->u.flat.lumpnum - startflatnum;
|
||||||
|
@ -5626,7 +5642,7 @@ void P_UpdateSpecials(void)
|
||||||
if (foundflats->speed) // it is an animated flat
|
if (foundflats->speed) // it is an animated flat
|
||||||
{
|
{
|
||||||
// update the levelflat texture number
|
// update the levelflat texture number
|
||||||
if (foundflats->type == LEVELFLAT_TEXTURE)
|
if ((foundflats->type == LEVELFLAT_TEXTURE) && (foundflats->u.texture.basenum != -1))
|
||||||
foundflats->u.texture.num = foundflats->u.texture.basenum + ((leveltime/foundflats->speed + foundflats->animseq) % foundflats->numpics);
|
foundflats->u.texture.num = foundflats->u.texture.basenum + ((leveltime/foundflats->speed + foundflats->animseq) % foundflats->numpics);
|
||||||
// update the levelflat lump number
|
// update the levelflat lump number
|
||||||
else if ((foundflats->type == LEVELFLAT_FLAT) && (foundflats->u.flat.baselumpnum != LUMPERROR))
|
else if ((foundflats->type == LEVELFLAT_FLAT) && (foundflats->u.flat.baselumpnum != LUMPERROR))
|
||||||
|
|
178
src/r_data.c
178
src/r_data.c
|
@ -441,7 +441,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
||||||
texture_t *texture;
|
texture_t *texture;
|
||||||
texpatch_t *patch;
|
texpatch_t *patch;
|
||||||
patch_t *realpatch;
|
patch_t *realpatch;
|
||||||
boolean dealloc = false;
|
UINT8 *pdata;
|
||||||
int x, x1, x2, i, width, height;
|
int x, x1, x2, i, width, height;
|
||||||
size_t blocksize;
|
size_t blocksize;
|
||||||
column_t *patchcol;
|
column_t *patchcol;
|
||||||
|
@ -469,12 +469,17 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
||||||
wadnum = patch->wad;
|
wadnum = patch->wad;
|
||||||
lumpnum = patch->lump;
|
lumpnum = patch->lump;
|
||||||
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||||
realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); // can't use W_CachePatchNumPwad because OpenGL
|
pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||||
|
realpatch = (patch_t *)pdata;
|
||||||
|
|
||||||
#ifndef NO_PNG_LUMPS
|
#ifndef NO_PNG_LUMPS
|
||||||
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
||||||
goto multipatch;
|
goto multipatch;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WALLFLATS
|
||||||
|
if (texture->type == TEXTURETYPE_FLAT)
|
||||||
|
goto multipatch;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check the patch for holes.
|
// Check the patch for holes.
|
||||||
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
|
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
|
||||||
|
@ -531,9 +536,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi-patch textures (or 'composite')
|
// multi-patch textures (or 'composite')
|
||||||
#ifndef NO_PNG_LUMPS
|
|
||||||
multipatch:
|
multipatch:
|
||||||
#endif
|
|
||||||
texture->holes = false;
|
texture->holes = false;
|
||||||
texture->flip = 0;
|
texture->flip = 0;
|
||||||
blocksize = (texture->width * 4) + (texture->width * texture->height);
|
blocksize = (texture->width * 4) + (texture->width * texture->height);
|
||||||
|
@ -552,6 +555,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
||||||
// 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++)
|
||||||
{
|
{
|
||||||
|
boolean dealloc = true;
|
||||||
static void (*ColumnDrawerPointer)(column_t *, UINT8 *, texpatch_t *, INT32, INT32); // Column drawing function pointer.
|
static void (*ColumnDrawerPointer)(column_t *, UINT8 *, texpatch_t *, INT32, INT32); // Column drawing function pointer.
|
||||||
if (patch->style != AST_COPY)
|
if (patch->style != AST_COPY)
|
||||||
ColumnDrawerPointer = (patch->flip & 2) ? R_DrawBlendFlippedColumnInCache : R_DrawBlendColumnInCache;
|
ColumnDrawerPointer = (patch->flip & 2) ? R_DrawBlendFlippedColumnInCache : R_DrawBlendColumnInCache;
|
||||||
|
@ -560,17 +564,25 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
||||||
|
|
||||||
wadnum = patch->wad;
|
wadnum = patch->wad;
|
||||||
lumpnum = patch->lump;
|
lumpnum = patch->lump;
|
||||||
|
pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||||
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||||
realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
realpatch = (patch_t *)pdata;
|
||||||
dealloc = false;
|
dealloc = true;
|
||||||
|
|
||||||
#ifndef NO_PNG_LUMPS
|
#ifndef NO_PNG_LUMPS
|
||||||
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
||||||
{
|
|
||||||
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
|
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
|
||||||
dealloc = true;
|
else
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WALLFLATS
|
||||||
|
if (texture->type == TEXTURETYPE_FLAT)
|
||||||
|
realpatch = R_FlatToPatch(pdata, texture->width, texture->height, 0, 0, NULL, false);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
(void)lumplength;
|
||||||
|
dealloc = false;
|
||||||
|
}
|
||||||
|
|
||||||
x1 = patch->originx;
|
x1 = patch->originx;
|
||||||
width = SHORT(realpatch->width);
|
width = SHORT(realpatch->width);
|
||||||
|
@ -725,7 +737,6 @@ void R_LoadTextures(void)
|
||||||
for (w = 0, numtextures = 0; w < numwadfiles; w++)
|
for (w = 0, numtextures = 0; w < numwadfiles; w++)
|
||||||
{
|
{
|
||||||
// Count the textures from TEXTURES lumps
|
// Count the textures from TEXTURES lumps
|
||||||
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
||||||
while (texturesLumpPos != INT16_MAX)
|
while (texturesLumpPos != INT16_MAX)
|
||||||
{
|
{
|
||||||
|
@ -734,7 +745,6 @@ void R_LoadTextures(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count single-patch textures
|
// Count single-patch textures
|
||||||
|
|
||||||
if (wadfiles[w]->type == RET_PK3)
|
if (wadfiles[w]->type == RET_PK3)
|
||||||
{
|
{
|
||||||
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
||||||
|
@ -747,7 +757,11 @@ void R_LoadTextures(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||||
|
#ifdef WALLFLATS
|
||||||
|
goto countflats;
|
||||||
|
#else
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
texstart++; // Do not count the first marker
|
texstart++; // Do not count the first marker
|
||||||
|
|
||||||
|
@ -764,6 +778,40 @@ void R_LoadTextures(void)
|
||||||
{
|
{
|
||||||
numtextures += (UINT32)(texend - texstart);
|
numtextures += (UINT32)(texend - texstart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WALLFLATS
|
||||||
|
countflats:
|
||||||
|
// Count flats
|
||||||
|
if (wadfiles[w]->type == RET_PK3)
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForFolderStartPK3("flats/", (UINT16)w, 0);
|
||||||
|
texend = W_CheckNumForFolderEndPK3("flats/", (UINT16)w, texstart);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0);
|
||||||
|
texend = W_CheckNumForNamePwad("F_END", (UINT16)w, texstart);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
texstart++; // Do not count the first marker
|
||||||
|
|
||||||
|
// PK3s have subfolders, so we can't just make a simple sum
|
||||||
|
if (wadfiles[w]->type == RET_PK3)
|
||||||
|
{
|
||||||
|
for (j = texstart; j < texend; j++)
|
||||||
|
{
|
||||||
|
if (!W_IsLumpFolder((UINT16)w, j)) // Check if lump is a folder; if not, then count it
|
||||||
|
numtextures++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Add all the textures between F_START and F_END
|
||||||
|
{
|
||||||
|
numtextures += (UINT32)(texend - texstart);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no textures found by this point, bomb out
|
// If no textures found by this point, bomb out
|
||||||
|
@ -813,7 +861,11 @@ void R_LoadTextures(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||||
|
#ifdef WALLFLATS
|
||||||
|
goto checkflats;
|
||||||
|
#else
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
texstart++; // Do not count the first marker
|
texstart++; // Do not count the first marker
|
||||||
|
|
||||||
|
@ -857,6 +909,8 @@ void R_LoadTextures(void)
|
||||||
texture->width = SHORT(patchlump->width);
|
texture->width = SHORT(patchlump->width);
|
||||||
texture->height = SHORT(patchlump->height);
|
texture->height = SHORT(patchlump->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
texture->type = TEXTURETYPE_SINGLEPATCH;
|
||||||
texture->patchcount = 1;
|
texture->patchcount = 1;
|
||||||
texture->holes = false;
|
texture->holes = false;
|
||||||
texture->flip = 0;
|
texture->flip = 0;
|
||||||
|
@ -875,6 +929,107 @@ void R_LoadTextures(void)
|
||||||
textureheight[i] = texture->height << FRACBITS;
|
textureheight[i] = texture->height << FRACBITS;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WALLFLATS
|
||||||
|
checkflats:
|
||||||
|
// Yes
|
||||||
|
if (wadfiles[w]->type == RET_PK3)
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForFolderStartPK3("flats/", (UINT16)w, 0);
|
||||||
|
texend = W_CheckNumForFolderEndPK3("flats/", (UINT16)w, texstart);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0);
|
||||||
|
texend = W_CheckNumForNamePwad("F_END", (UINT16)w, texstart);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
texstart++; // Do not count the first marker
|
||||||
|
|
||||||
|
// Work through each lump between the markers in the WAD.
|
||||||
|
for (j = 0; j < (texend - texstart); j++)
|
||||||
|
{
|
||||||
|
UINT8 *flatlump;
|
||||||
|
UINT16 wadnum = (UINT16)w;
|
||||||
|
lumpnum_t lumpnum = texstart + j;
|
||||||
|
size_t lumplength;
|
||||||
|
size_t flatsize = 0;
|
||||||
|
|
||||||
|
if (wadfiles[w]->type == RET_PK3)
|
||||||
|
{
|
||||||
|
if (W_IsLumpFolder(wadnum, lumpnum)) // Check if lump is a folder
|
||||||
|
continue; // If it is then SKIP IT
|
||||||
|
}
|
||||||
|
|
||||||
|
flatlump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||||
|
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||||
|
|
||||||
|
switch (lumplength)
|
||||||
|
{
|
||||||
|
case 4194304: // 2048x2048 lump
|
||||||
|
flatsize = 2048;
|
||||||
|
break;
|
||||||
|
case 1048576: // 1024x1024 lump
|
||||||
|
flatsize = 1024;
|
||||||
|
break;
|
||||||
|
case 262144:// 512x512 lump
|
||||||
|
flatsize = 512;
|
||||||
|
break;
|
||||||
|
case 65536: // 256x256 lump
|
||||||
|
flatsize = 256;
|
||||||
|
break;
|
||||||
|
case 16384: // 128x128 lump
|
||||||
|
flatsize = 128;
|
||||||
|
break;
|
||||||
|
case 1024: // 32x32 lump
|
||||||
|
flatsize = 32;
|
||||||
|
break;
|
||||||
|
default: // 64x64 lump
|
||||||
|
flatsize = 64;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//CONS_Printf("\n\"%s\" is a flat, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),flatsize,flatsize);
|
||||||
|
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||||
|
|
||||||
|
// Set texture properties.
|
||||||
|
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
||||||
|
|
||||||
|
#ifndef NO_PNG_LUMPS
|
||||||
|
if (R_IsLumpPNG((UINT8 *)flatlump, lumplength))
|
||||||
|
{
|
||||||
|
INT16 width, height;
|
||||||
|
R_PNGDimensions((UINT8 *)flatlump, &width, &height, lumplength);
|
||||||
|
texture->width = width;
|
||||||
|
texture->height = height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
texture->width = texture->height = flatsize;
|
||||||
|
|
||||||
|
texture->type = TEXTURETYPE_FLAT;
|
||||||
|
texture->patchcount = 1;
|
||||||
|
texture->holes = false;
|
||||||
|
texture->flip = 0;
|
||||||
|
|
||||||
|
// Allocate information for the texture's patches.
|
||||||
|
patch = &texture->patches[0];
|
||||||
|
|
||||||
|
patch->originx = patch->originy = 0;
|
||||||
|
patch->wad = (UINT16)w;
|
||||||
|
patch->lump = texstart + j;
|
||||||
|
patch->flip = 0;
|
||||||
|
|
||||||
|
Z_Unlock(flatlump);
|
||||||
|
|
||||||
|
texturewidth[i] = texture->width;
|
||||||
|
textureheight[i] = texture->height << FRACBITS;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
@ -1191,6 +1346,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
||||||
M_Memcpy(resultTexture->name, newTextureName, 8);
|
M_Memcpy(resultTexture->name, newTextureName, 8);
|
||||||
resultTexture->width = newTextureWidth;
|
resultTexture->width = newTextureWidth;
|
||||||
resultTexture->height = newTextureHeight;
|
resultTexture->height = newTextureHeight;
|
||||||
|
resultTexture->type = TEXTURETYPE_COMPOSITE;
|
||||||
}
|
}
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
texturesToken = M_GetToken(NULL);
|
texturesToken = M_GetToken(NULL);
|
||||||
|
|
14
src/r_data.h
14
src/r_data.h
|
@ -45,6 +45,17 @@ typedef struct
|
||||||
enum patchalphastyle style;
|
enum patchalphastyle style;
|
||||||
} texpatch_t;
|
} texpatch_t;
|
||||||
|
|
||||||
|
// texture type
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TEXTURETYPE_UNKNOWN,
|
||||||
|
TEXTURETYPE_SINGLEPATCH,
|
||||||
|
TEXTURETYPE_COMPOSITE,
|
||||||
|
#ifdef WALLFLATS
|
||||||
|
TEXTURETYPE_FLAT,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
// A maptexturedef_t describes a rectangular texture,
|
// A maptexturedef_t describes a rectangular texture,
|
||||||
// which is composed of one or more mappatch_t structures
|
// which is composed of one or more mappatch_t structures
|
||||||
// that arrange graphic patches.
|
// that arrange graphic patches.
|
||||||
|
@ -52,6 +63,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
// Keep name for switch changing, etc.
|
// Keep name for switch changing, etc.
|
||||||
char name[8];
|
char name[8];
|
||||||
|
UINT8 type; // TEXTURETYPE_
|
||||||
INT16 width, height;
|
INT16 width, height;
|
||||||
boolean holes;
|
boolean holes;
|
||||||
UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both
|
UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both
|
||||||
|
@ -159,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_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))
|
#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;
|
extern INT32 numtextures;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -788,6 +788,8 @@ static UINT8 *R_GetTextureFlat(levelflat_t *levelflat, boolean leveltexture, boo
|
||||||
patch_t *patch = NULL;
|
patch_t *patch = NULL;
|
||||||
boolean texturechanged = (leveltexture ? (levelflat->u.texture.num != levelflat->u.texture.lastnum) : false);
|
boolean texturechanged = (leveltexture ? (levelflat->u.texture.num != levelflat->u.texture.lastnum) : false);
|
||||||
|
|
||||||
|
(void)ispng;
|
||||||
|
|
||||||
// Check if the texture changed.
|
// Check if the texture changed.
|
||||||
if (leveltexture && (!texturechanged))
|
if (leveltexture && (!texturechanged))
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,7 @@ extern int SDL_main(int argc, char *argv[]);
|
||||||
|
|
||||||
#ifdef LOGMESSAGES
|
#ifdef LOGMESSAGES
|
||||||
FILE *logstream = NULL;
|
FILE *logstream = NULL;
|
||||||
|
char logfilename[1024];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DOXYGEN
|
#ifndef DOXYGEN
|
||||||
|
@ -116,7 +117,6 @@ int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
const char *logdir = NULL;
|
const char *logdir = NULL;
|
||||||
char logfile[MAX_WADPATH];
|
|
||||||
myargc = argc;
|
myargc = argc;
|
||||||
myargv = argv; /// \todo pull out path to exe from this string
|
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);
|
timeinfo = localtime(&my_time);
|
||||||
|
|
||||||
strftime(buf, 26, "%Y-%m-%d %H-%M-%S", timeinfo);
|
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
|
#ifdef DEFAULTDIR
|
||||||
if (logdir)
|
if (logdir)
|
||||||
|
@ -149,14 +149,16 @@ int main(int argc, char **argv)
|
||||||
// Create dirs here because D_SRB2Main() is too late.
|
// Create dirs here because D_SRB2Main() is too late.
|
||||||
I_mkdir(va("%s%s"DEFAULTDIR, logdir, PATHSEP), 0755);
|
I_mkdir(va("%s%s"DEFAULTDIR, logdir, PATHSEP), 0755);
|
||||||
I_mkdir(va("%s%s"DEFAULTDIR"%slogs",logdir, PATHSEP, 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
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
I_mkdir("."PATHSEP"logs"PATHSEP, 0755);
|
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
|
#endif
|
||||||
|
|
||||||
|
@ -181,12 +183,13 @@ int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
MakeCodeWritable();
|
MakeCodeWritable();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// startup SRB2
|
// startup SRB2
|
||||||
CONS_Printf("Setting up SRB2...\n");
|
CONS_Printf("Setting up SRB2...\n");
|
||||||
D_SRB2Main();
|
D_SRB2Main();
|
||||||
#ifdef LOGMESSAGES
|
#ifdef LOGMESSAGES
|
||||||
if (!M_CheckParm("-nolog"))
|
if (!M_CheckParm("-nolog"))
|
||||||
CONS_Printf("Logfile: %s\n", logfile);
|
CONS_Printf("Logfile: %s\n", logfilename);
|
||||||
#endif
|
#endif
|
||||||
CONS_Printf("Entering main game loop...\n");
|
CONS_Printf("Entering main game loop...\n");
|
||||||
// never return
|
// never return
|
||||||
|
|
|
@ -102,6 +102,12 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (defined (__unix__) && !defined (_MSDOS)) || defined (UNIXCOMMON)
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#define NEWSIGNALHANDLER
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NOMUMBLE
|
#ifndef NOMUMBLE
|
||||||
#ifdef __linux__ // need -lrt
|
#ifdef __linux__ // need -lrt
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
@ -229,13 +235,11 @@ SDL_bool framebuffer = SDL_FALSE;
|
||||||
|
|
||||||
UINT8 keyboard_started = 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";
|
//static char msg[] = "oh no! back to reality!\r\n";
|
||||||
const char * sigmsg;
|
const char * sigmsg;
|
||||||
char sigdef[32];
|
char msg[128];
|
||||||
|
|
||||||
D_QuitNetGame(); // Fix server freezes
|
|
||||||
|
|
||||||
switch (num)
|
switch (num)
|
||||||
{
|
{
|
||||||
|
@ -261,20 +265,41 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
||||||
sigmsg = "SIGABRT - abnormal termination triggered by abort call";
|
sigmsg = "SIGABRT - abnormal termination triggered by abort call";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(sigdef,"signal number %d", num);
|
sprintf(msg,"signal number %d", num);
|
||||||
sigmsg = sigdef;
|
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,
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
"Signal caught",
|
"Process killed by signal",
|
||||||
sigmsg, NULL);
|
sigmsg, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NEWSIGNALHANDLER
|
||||||
|
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
||||||
|
{
|
||||||
|
D_QuitNetGame(); // Fix server freezes
|
||||||
|
I_ReportSignal(num, 0);
|
||||||
I_ShutdownSystem();
|
I_ShutdownSystem();
|
||||||
signal(num, SIG_DFL); //default signal action
|
signal(num, SIG_DFL); //default signal action
|
||||||
raise(num);
|
raise(num);
|
||||||
I_Quit();
|
I_Quit();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
|
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
|
||||||
{
|
{
|
||||||
|
@ -650,7 +675,7 @@ static inline void I_ShutdownConsole(void){}
|
||||||
//
|
//
|
||||||
// StartupKeyboard
|
// StartupKeyboard
|
||||||
//
|
//
|
||||||
void I_StartupKeyboard (void)
|
static void I_RegisterSignals (void)
|
||||||
{
|
{
|
||||||
#ifdef SIGINT
|
#ifdef SIGINT
|
||||||
signal(SIGINT , quit_handler);
|
signal(SIGINT , quit_handler);
|
||||||
|
@ -664,10 +689,12 @@ void I_StartupKeyboard (void)
|
||||||
|
|
||||||
// If these defines don't exist,
|
// If these defines don't exist,
|
||||||
// then compilation would have failed above us...
|
// then compilation would have failed above us...
|
||||||
|
#ifndef NEWSIGNALHANDLER
|
||||||
signal(SIGILL , signal_handler);
|
signal(SIGILL , signal_handler);
|
||||||
signal(SIGSEGV , signal_handler);
|
signal(SIGSEGV , signal_handler);
|
||||||
signal(SIGABRT , signal_handler);
|
signal(SIGABRT , signal_handler);
|
||||||
signal(SIGFPE , signal_handler);
|
signal(SIGFPE , signal_handler);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2139,6 +2166,85 @@ void I_Sleep(void)
|
||||||
SDL_Delay(cv_sleep.value);
|
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)
|
INT32 I_StartupSystem(void)
|
||||||
{
|
{
|
||||||
SDL_version SDLcompiled;
|
SDL_version SDLcompiled;
|
||||||
|
@ -2146,6 +2252,10 @@ INT32 I_StartupSystem(void)
|
||||||
SDL_VERSION(&SDLcompiled)
|
SDL_VERSION(&SDLcompiled)
|
||||||
SDL_GetVersion(&SDLlinked);
|
SDL_GetVersion(&SDLlinked);
|
||||||
I_StartupConsole();
|
I_StartupConsole();
|
||||||
|
#ifdef NEWSIGNALHANDLER
|
||||||
|
I_Fork();
|
||||||
|
#endif
|
||||||
|
I_RegisterSignals();
|
||||||
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
|
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
|
||||||
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
|
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
|
||||||
I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
|
I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
|
||||||
|
@ -2169,7 +2279,6 @@ void I_Quit(void)
|
||||||
if (quiting) goto death;
|
if (quiting) goto death;
|
||||||
SDLforceUngrabMouse();
|
SDLforceUngrabMouse();
|
||||||
quiting = SDL_FALSE;
|
quiting = SDL_FALSE;
|
||||||
I_ShutdownConsole();
|
|
||||||
M_SaveConfig(NULL); //save game config, cvars..
|
M_SaveConfig(NULL); //save game config, cvars..
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
D_SaveBan(); // save the ban list
|
D_SaveBan(); // save the ban list
|
||||||
|
@ -2287,8 +2396,6 @@ void I_Error(const char *error, ...)
|
||||||
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
I_ShutdownConsole();
|
|
||||||
|
|
||||||
M_SaveConfig(NULL); // save game config, cvars..
|
M_SaveConfig(NULL); // save game config, cvars..
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
D_SaveBan(); // save the ban list
|
D_SaveBan(); // save the ban list
|
||||||
|
@ -2388,6 +2495,10 @@ void I_ShutdownSystem(void)
|
||||||
{
|
{
|
||||||
INT32 c;
|
INT32 c;
|
||||||
|
|
||||||
|
#ifndef NEWSIGNALHANDLER
|
||||||
|
I_ShutdownConsole();
|
||||||
|
#endif
|
||||||
|
|
||||||
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
|
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
|
||||||
if (quit_funcs[c])
|
if (quit_funcs[c])
|
||||||
(*quit_funcs[c])();
|
(*quit_funcs[c])();
|
||||||
|
|
|
@ -1457,6 +1457,7 @@ void VID_CheckRenderer(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
|
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
|
||||||
|
Impl_VideoSetupBuffer();
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
|
@ -1465,7 +1466,6 @@ void VID_CheckRenderer(void)
|
||||||
SDL_FreeSurface(bufSurface);
|
SDL_FreeSurface(bufSurface);
|
||||||
bufSurface = NULL;
|
bufSurface = NULL;
|
||||||
}
|
}
|
||||||
Impl_VideoSetupBuffer();
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
HWR_FreeTextureCache();
|
HWR_FreeTextureCache();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1587,17 +1587,14 @@ static void Impl_VideoSetupSDLBuffer(void)
|
||||||
static void Impl_VideoSetupBuffer(void)
|
static void Impl_VideoSetupBuffer(void)
|
||||||
{
|
{
|
||||||
// Set up game's software render buffer
|
// Set up game's software render buffer
|
||||||
if (rendermode == render_soft)
|
vid.rowbytes = vid.width * vid.bpp;
|
||||||
|
vid.direct = NULL;
|
||||||
|
if (vid.buffer)
|
||||||
|
free(vid.buffer);
|
||||||
|
vid.buffer = calloc(vid.rowbytes*vid.height, NUMSCREENS);
|
||||||
|
if (!vid.buffer)
|
||||||
{
|
{
|
||||||
vid.rowbytes = vid.width * vid.bpp;
|
I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
|
||||||
vid.direct = NULL;
|
|
||||||
if (vid.buffer)
|
|
||||||
free(vid.buffer);
|
|
||||||
vid.buffer = calloc(vid.rowbytes*vid.height, NUMSCREENS);
|
|
||||||
if (!vid.buffer)
|
|
||||||
{
|
|
||||||
I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,26 @@
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief SDL Mixer interface for sound
|
/// \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 "../doomdef.h"
|
||||||
#include "../doomstat.h" // menuactive
|
#include "../doomstat.h" // menuactive
|
||||||
|
|
||||||
|
@ -57,24 +77,6 @@
|
||||||
#include "gme/gme.h"
|
#include "gme/gme.h"
|
||||||
#define GME_TREBLE 5.0f
|
#define GME_TREBLE 5.0f
|
||||||
#define GME_BASS 1.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
|
#endif // HAVE_LIBGME
|
||||||
|
|
||||||
static UINT16 BUFFERSIZE = 2048;
|
static UINT16 BUFFERSIZE = 2048;
|
||||||
|
|
|
@ -3244,6 +3244,29 @@ Unoptimized version
|
||||||
#endif
|
#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
|
// V_Init
|
||||||
// old software stuff, buffers are allocated at video mode setup
|
// old software stuff, buffers are allocated at video mode setup
|
||||||
// here we set the screens[x] pointers accordingly
|
// here we set the screens[x] pointers accordingly
|
||||||
|
@ -3255,13 +3278,9 @@ void V_Init(void)
|
||||||
const INT32 screensize = vid.rowbytes * vid.height;
|
const INT32 screensize = vid.rowbytes * vid.height;
|
||||||
|
|
||||||
LoadMapPalette();
|
LoadMapPalette();
|
||||||
// hardware modes do not use screens[] pointers
|
|
||||||
for (i = 0; i < NUMSCREENS; i++)
|
for (i = 0; i < NUMSCREENS; i++)
|
||||||
screens[i] = NULL;
|
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
|
// start address of NUMSCREENS * width*height vidbuffers
|
||||||
if (base)
|
if (base)
|
||||||
|
|
|
@ -37,6 +37,18 @@ cv_allcaps;
|
||||||
// Allocates buffer screens, call before R_Init.
|
// Allocates buffer screens, call before R_Init.
|
||||||
void V_Init(void);
|
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
|
// Set the current RGB palette lookup to use for palettized graphics
|
||||||
void V_SetPalette(INT32 palettenum);
|
void V_SetPalette(INT32 palettenum);
|
||||||
|
|
||||||
|
|
52
src/w_wad.c
52
src/w_wad.c
|
@ -11,6 +11,24 @@
|
||||||
/// \file w_wad.c
|
/// \file w_wad.c
|
||||||
/// \brief Handles WAD file header, directory, lump I/O
|
/// \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__
|
#ifdef __GNUC__
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,22 +40,6 @@
|
||||||
#include "lzf.h"
|
#include "lzf.h"
|
||||||
#endif
|
#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 "doomdef.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
|
@ -78,24 +80,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
||||||
#define O_BINARY 0
|
#define O_BINARY 0
|
||||||
#endif
|
#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
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue