Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
alama committed Aug 27, 2014
2 parents 4f1f17b + 7cb7707 commit 6e7c783
Show file tree
Hide file tree
Showing 26 changed files with 533 additions and 380 deletions.
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Here it is! SRB2 v2.1.10 source code!
Here it is! SRB2 v2.1.11 source code!
(why do we keep the version number up to date
when everything else in this file is hilariously old?
- Inuyasha)
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC)

ifdef SDL
INTERFACE=sdl
INTERFACE=sdl2
OBJDIR:=$(OBJDIR)/SDL
endif

Expand Down
8 changes: 0 additions & 8 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,14 +1320,6 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
if (!var || !var->string || !value || !stricmp(var->string, value))
return; // no changes

// Don't allow skin/color changes in single player
if ((var == &cv_skin || var == &cv_playercolor) &&
!(cv_debug || devparm) && !(multiplayer || netgame)
&& (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION))
{
return;
}

if (var->flags & CV_NETVAR)
{
// send the value of the variable
Expand Down
21 changes: 16 additions & 5 deletions src/d_clisrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ char motd[254], server_context[8]; // Message of the Day, Unique Context (even w

// server specific vars
UINT8 playernode[MAXPLAYERS];
UINT8 consfailcount[MAXPLAYERS];
UINT8 consfailstatus[MAXPLAYERS];

#ifdef NEWPING
UINT16 pingmeasurecount = 1;
Expand Down Expand Up @@ -944,6 +942,14 @@ static void SV_SendResynch(INT32 node)
{
INT32 i, j;

if (!nodeingame[node])
{
// player left during resynch
// so obviously we don't need to do any of this anymore
resynch_inprogress[node] = false;
return;
}

// resynched?
if (!resynch_status[node])
{
Expand Down Expand Up @@ -2213,6 +2219,9 @@ static void CL_RemovePlayer(INT32 playernum)
playerpernode[node]--;
if (playerpernode[node] <= 0)
{
// If a resynch was in progress, well, it no longer needs to be.
SV_InitResynchVars(playernode[playernum]);

nodeingame[playernode[playernum]] = false;
Net_CloseConnection(playernode[playernum]);
ResetNode(node);
Expand Down Expand Up @@ -2270,9 +2279,6 @@ static void CL_RemovePlayer(INT32 playernum)
if (playernum == displayplayer)
displayplayer = consoleplayer; // don't look through someone's view who isn't there

consfailcount[playernum] = 0;
consfailstatus[playernum] = 0;

#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[playernum]);
#endif
Expand Down Expand Up @@ -2753,8 +2759,13 @@ void SV_ResetServer(void)
tictoclear = maketic;

for (i = 0; i < MAXNETNODES; i++)
{
ResetNode(i);

// Make sure resynch status doesn't get carried over!
SV_InitResynchVars(i);
}

for (i = 0; i < MAXPLAYERS; i++)
{
#ifdef HAVE_BLUA
Expand Down
1 change: 0 additions & 1 deletion src/d_clisrv.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ SINT8 nametonum(const char *name);

extern char motd[254], server_context[8];
extern UINT8 playernode[MAXPLAYERS];
extern UINT8 consfailcount[MAXPLAYERS];

INT32 D_NumPlayers(void);
void D_ResetTiccmds(void);
Expand Down
7 changes: 3 additions & 4 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,10 +1091,10 @@ void D_SRB2Main(void)

// Check MD5s of autoloaded files
W_VerifyFileMD5(0, "ac309fb3c7d4b5b685e2cd26beccf0e8"); // srb2.srb/srb2.wad
W_VerifyFileMD5(1, "e956466eff2c79f7b1cdefad24761bce"); // zones.dta
W_VerifyFileMD5(2, "95a4cdbed287323dd361243f357a5fd2"); // player.dta
W_VerifyFileMD5(1, "f39b6c849295e3c81875726e8cc0e2c7"); // zones.dta
W_VerifyFileMD5(2, "cfca0f1c73023cbbd8f844f45480f799"); // player.dta
W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.dta
W_VerifyFileMD5(4, "01735733412bf68c42f4669e964fc952"); // patch.dta
W_VerifyFileMD5(4, "3d6cfc185fd7c195eb934ce593b0248f"); // patch.dta
// don't check music.dta because people like to modify it, and it doesn't matter if they do
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
#endif
Expand Down Expand Up @@ -1146,7 +1146,6 @@ void D_SRB2Main(void)

wipegamestate = gamestate;

P_InitMapHeaders();
savedata.lives = 0; // flag this as not-used

//------------------------------------------------ COMMAND LINE PARAMS
Expand Down
37 changes: 32 additions & 5 deletions src/d_netcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3177,15 +3177,16 @@ static void Command_ListWADS_f(void)
INT32 i = numwadfiles;
char *tempname;
CONS_Printf(M_GetText("There are %d wads loaded:\n"),numwadfiles);
for (i--; i; i--)
for (i--; i >= 0; i--)
{
nameonly(tempname = va("%s", wadfiles[i]->filename));
if (i >= mainwads)
CONS_Printf(" %.2d: %s\n", i, tempname);
if (!i)
CONS_Printf("\x82 IWAD\x80: %s\n", tempname);
else if (i <= mainwads)
CONS_Printf("\x82 * %.2d\x80: %s\n", i, tempname);
else
CONS_Printf("* %.2d: %s\n", i, tempname);
CONS_Printf(" %.2d: %s\n", i, tempname);
}
CONS_Printf(" IWAD: %s\n", wadfiles[0]->filename);
}

// =========================================================================
Expand Down Expand Up @@ -4026,6 +4027,16 @@ static void Name2_OnChange(void)
*/
static void Skin_OnChange(void)
{
if (!Playing())
return; // do whatever you want

if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player.
&& (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CONTINUING))
{
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
return;
}

if (CanChangeSkin(consoleplayer) && !P_PlayerMoving(consoleplayer))
SendNameAndColor();
else
Expand All @@ -4042,6 +4053,9 @@ static void Skin_OnChange(void)
*/
static void Skin2_OnChange(void)
{
if (!Playing() || !splitscreen)
return; // do whatever you want

if (CanChangeSkin(secondarydisplayplayer) && !P_PlayerMoving(secondarydisplayplayer))
SendNameAndColor2();
else
Expand All @@ -4057,6 +4071,16 @@ static void Skin2_OnChange(void)
*/
static void Color_OnChange(void)
{
if (!Playing())
return; // do whatever you want

if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player.
&& (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CONTINUING))
{
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
return;
}

if (!P_PlayerMoving(consoleplayer))
{
// Color change menu scrolling fix is no longer necessary
Expand All @@ -4076,6 +4100,9 @@ static void Color_OnChange(void)
*/
static void Color2_OnChange(void)
{
if (!Playing() || !splitscreen)
return; // do whatever you want

if (!P_PlayerMoving(secondarydisplayplayer))
{
// Color change menu scrolling fix is no longer necessary
Expand Down
6 changes: 3 additions & 3 deletions src/doomdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ extern FILE *logstream;
#define VERSIONSTRING "Trunk"
#else
#define VERSION 201 // Game version
#define SUBVERSION 10 // more precise version number
#define VERSIONSTRING "v2.1.10"
#define SUBVERSION 11 // more precise version number
#define VERSIONSTRING "v2.1.11"
#endif

// Modification options
Expand Down Expand Up @@ -201,7 +201,7 @@ extern FILE *logstream;
// it's only for detection of the version the player is using so the MS can alert them of an update.
// Only set it higher, not lower, obviously.
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
#define MODVERSION 15
#define MODVERSION 16



Expand Down
123 changes: 93 additions & 30 deletions src/f_wipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
}

fm.xscale = FixedDiv(fm.width<<FRACBITS, vid.width<<FRACBITS);
fm.yscale = FixedDiv(fm.height<<FRACBITS, vid.height<<FRACBITS);
fm.xscale = FixedDiv(vid.width<<FRACBITS, fm.width<<FRACBITS);
fm.yscale = FixedDiv(vid.height<<FRACBITS, fm.height<<FRACBITS);
return &fm;

// Landing point for freeing data -- do this instead of just returning NULL
Expand All @@ -172,13 +172,6 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
*/
static void F_DoWipe(fademask_t *fademask)
{
// wipe screen, start, end
UINT8 *w = wipe_scr;
const UINT8 *s = wipe_scr_start;
const UINT8 *e = wipe_scr_end;
UINT8 transval;
INT32 x = 0, y = 0;

#ifdef HWRENDER
/// \todo Mask wipes for OpenGL
if(rendermode != render_soft)
Expand All @@ -187,29 +180,99 @@ static void F_DoWipe(fademask_t *fademask)
return;
}
#endif
// Software mask wipe
do

// Software mask wipe -- optimized; though it might not look like it!
// Okay, to save you wondering *how* this is more optimized than the simpler
// version that came before it...
// ---
// The previous code did two FixedMul calls for every single pixel on the
// screen, of which there are hundreds of thousands -- if not millions -- of.
// This worked fine for smaller screen sizes, but with excessively large
// (1920x1200) screens that meant 4 million+ calls out to FixedMul, and that
// would take /just/ long enough that fades would start to noticably lag.
// ---
// This code iterates over the fade mask's pixels instead of the screen's,
// and deals with drawing over each rectangular area before it moves on to
// the next pixel in the fade mask. As a result, it's more complex (and might
// look a little messy; sorry!) but it simultaneously runs at twice the speed.
// In addition, we precalculate all the X and Y positions that we need to draw
// from and to, so it uses a little extra memory, but again, helps it run faster.
{
if (*s != *e)
// 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[fademask->width + 1];
UINT16 scrypos[fademask->height + 1];
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
{
transval = fademask->mask[ // y*width + x
(FixedMul(y<<FRACBITS,fademask->yscale)>>FRACBITS)*fademask->width
+ (FixedMul(x<<FRACBITS,fademask->xscale)>>FRACBITS)
];

if (transval == 0)
*w = *s;
else if (transval == 10)
*w = *e;
else
*w = transtables[(*e<<8) + *s + ((9 - transval)<<FF_TRANSSHIFT)];
}
if (++x >= vid.width)
{
x = 0;
++y;
}
} while (++w && ++s && ++e && w < wipe_scr + vid.width*vid.height);
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
// (ignore that it goes out of bounds if *mask is 0 or 10 --
// it wouldn't be used in those cases anyway)

draw_rowstart = scrxpos[maskx];
draw_rowend = scrxpos[maskx + 1];
draw_linestart = scrypos[masky];
draw_lineend = scrypos[masky + 1];

// DRAWING LOOP
relativepos = (draw_linestart * vid.width) + draw_rowstart;
draw_linestogo = draw_lineend - draw_linestart;
while (draw_linestogo--)
{
w = w_base + relativepos;
s = s_base + relativepos;
e = e_base + relativepos;
draw_rowstogo = draw_rowend - draw_rowstart;
while (draw_rowstogo--)
{
if (*s != *e)
*w = ((*mask == 0) ? *s : (*mask == 10) ? *e : transtbl[(*e<<8) + *s]);
++w, ++s, ++e;
}
relativepos += vid.width;
}
// END DRAWING LOOP

if (++maskx >= fademask->width)
++masky, maskx = 0;
} while (++mask < maskend);
}
}
#endif

Expand Down
Loading

0 comments on commit 6e7c783

Please sign in to comment.