Revert "Merge branch 'master' into sonicitems"

This reverts commit 4c0f64ff4f, reversing
changes made to eaaf708381.
This commit is contained in:
TehRealSalt 2018-06-04 16:30:16 -04:00
parent 4c0f64ff4f
commit 35774d4f13
30 changed files with 714 additions and 1243 deletions

View file

@ -836,9 +836,8 @@ boolean CON_Responder(event_t *ev)
return true; return true;
} }
// ...why shouldn't it eat the key? if it doesn't, it just means you // don't eat the key
// can control Sonic from the console, which is silly return false;
return true; //return false;
} }
// command completion forward (tab) and backward (shift-tab) // command completion forward (tab) and backward (shift-tab)
@ -1037,7 +1036,7 @@ boolean CON_Responder(event_t *ev)
// enter a char into the command prompt // enter a char into the command prompt
if (key < 32 || key > 127) if (key < 32 || key > 127)
return true; // even if key can't be printed, eat it anyway return false;
// add key to cmd line here // add key to cmd line here
if (key >= 'A' && key <= 'Z' && !shiftdown) //this is only really necessary for dedicated servers if (key >= 'A' && key <= 'Z' && !shiftdown) //this is only really necessary for dedicated servers

View file

@ -1214,37 +1214,22 @@ static inline void CL_DrawConnectionStatus(void)
if (lastfilenum != -1) if (lastfilenum != -1)
{ {
INT32 dldlength; INT32 dldlength;
static char tempname[28]; static char tempname[32];
fileneeded_t *file = &fileneeded[lastfilenum];
char *filename = file->filename;
Net_GetNetStat(); Net_GetNetStat();
dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256); dldlength = (INT32)((fileneeded[lastfilenum].currentsize/(double)fileneeded[lastfilenum].totalsize) * 256);
if (dldlength > 256) if (dldlength > 256)
dldlength = 256; dldlength = 256;
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175); V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 160); V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 160);
memset(tempname, 0, sizeof(tempname)); memset(tempname, 0, sizeof(tempname));
// offset filename to just the name only part nameonly(strncpy(tempname, fileneeded[lastfilenum].filename, 31));
filename += strlen(filename) - nameonlylength(filename);
if (strlen(filename) > sizeof(tempname)-1) // too long to display fully
{
size_t endhalfpos = strlen(filename)-10;
// display as first 14 chars + ... + last 10 chars
// which should add up to 27 if our math(s) is correct
snprintf(tempname, sizeof(tempname), "%.14s...%.10s", filename, filename+endhalfpos);
}
else // we can copy the whole thing in safely
{
strncpy(tempname, filename, sizeof(tempname)-1);
}
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP,
va(M_GetText("Downloading \"%s\""), tempname)); va(M_GetText("Downloading \"%s\""), tempname));
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE, V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10)); va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,fileneeded[lastfilenum].totalsize>>10));
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE, V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va("%3.1fK/s ", ((double)getbps)/1024)); va("%3.1fK/s ", ((double)getbps)/1024));
} }
@ -2309,7 +2294,7 @@ static void Command_connect(void)
// Assume we connect directly. // Assume we connect directly.
boolean viams = false; boolean viams = false;
if (COM_Argc() < 2 || *COM_Argv(1) == 0) if (COM_Argc() < 2)
{ {
CONS_Printf(M_GetText( CONS_Printf(M_GetText(
"Connect <serveraddress> (port): connect to a server\n" "Connect <serveraddress> (port): connect to a server\n"
@ -4163,7 +4148,6 @@ FILESTAMP
INT32 k = *txtpak++; // playernum INT32 k = *txtpak++; // playernum
const size_t txtsize = txtpak[0]+1; const size_t txtsize = txtpak[0]+1;
if (i >= gametic) // Don't copy old net commands
M_Memcpy(D_GetTextcmd(i, k), txtpak, txtsize); M_Memcpy(D_GetTextcmd(i, k), txtpak, txtsize);
txtpak += txtsize; txtpak += txtsize;
} }
@ -4666,7 +4650,6 @@ static void Local_Maketic(INT32 realtics)
void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle) void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
{ {
tic_t tic; tic_t tic;
UINT8 numadjust = 0;
(void)x; (void)x;
(void)y; (void)y;
@ -4676,21 +4659,7 @@ void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
// spawning, but will be applied afterwards. // spawning, but will be applied afterwards.
for (tic = server ? maketic : (neededtic - 1); tic >= gametic; tic--) for (tic = server ? maketic : (neededtic - 1); tic >= gametic; tic--)
{
if (numadjust++ == BACKUPTICS)
{
DEBFILE(va("SV_SpawnPlayer: All netcmds for player %d adjusted!\n", playernum));
// We already adjusted them all, waste of time doing the same thing over and over
// This shouldn't happen normally though, either gametic was 0 (which is handled now anyway)
// or maketic >= gametic + BACKUPTICS
// -- Monster Iestyn 16/01/18
break;
}
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle>>16) | TICCMD_RECEIVED); netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle>>16) | TICCMD_RECEIVED);
if (!tic) // failsafe for gametic == 0 -- Monster Iestyn 16/01/18
break;
}
} }
// create missed tic // create missed tic

View file

@ -1168,7 +1168,7 @@ void D_SRB2Main(void)
// add any files specified on the command line with -file wadfile // add any files specified on the command line with -file wadfile
// to the wad list // to the wad list
if (!(M_CheckParm("-connect") && !M_CheckParm("-server"))) if (!(M_CheckParm("-connect")))
{ {
if (M_CheckParm("-file")) if (M_CheckParm("-file"))
{ {
@ -1326,15 +1326,7 @@ void D_SRB2Main(void)
R_Init(); R_Init();
// setting up sound // setting up sound
if (dedicated)
{
nosound = true;
nomidimusic = nodigimusic = true;
}
else
{
CONS_Printf("S_Init(): Setting up sound.\n"); CONS_Printf("S_Init(): Setting up sound.\n");
}
if (M_CheckParm("-nosound")) if (M_CheckParm("-nosound"))
nosound = true; nosound = true;
if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic
@ -1433,7 +1425,7 @@ void D_SRB2Main(void)
ultimatemode = true; ultimatemode = true;
}*/ }*/
if (autostart || netgame) if (autostart || netgame || M_CheckParm("+connect") || M_CheckParm("-connect"))
{ {
gameaction = ga_nothing; gameaction = ga_nothing;
@ -1471,7 +1463,8 @@ void D_SRB2Main(void)
} }
} }
if (server && !M_CheckParm("+map")) if (server && !M_CheckParm("+map") && !M_CheckParm("+connect")
&& !M_CheckParm("-connect"))
{ {
// Prevent warping to nonexistent levels // Prevent warping to nonexistent levels
if (W_CheckNumForName(G_BuildMapName(pstartmap)) == LUMPERROR) if (W_CheckNumForName(G_BuildMapName(pstartmap)) == LUMPERROR)

View file

@ -252,17 +252,17 @@ consvar_t cv_allowseenames = {"allowseenames", "Yes", CV_NETVAR, CV_YesNo, NULL,
consvar_t cv_playername = {"name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playername = {"name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playername2 = {"name2", "Tails", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playername2 = {"name2", "Tails", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playername3 = {"name3", "Knuckles", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name3_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playername3 = {"name3", "Knuckles", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name3_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playername4 = {"name4", "Dr. Eggman", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name4_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playername4 = { "name4", "Metal Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name4_OnChange, 0, NULL, NULL, 0, 0, NULL};
// player colors // player colors
consvar_t cv_playercolor = {"color", "Blue", CV_SAVE|CV_CALL|CV_NOINIT, Color_cons_t, Color_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playercolor = {"color", "Blue", CV_CALL|CV_NOINIT, Color_cons_t, Color_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playercolor2 = {"color2", "Orange", CV_SAVE|CV_CALL|CV_NOINIT, Color_cons_t, Color2_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playercolor2 = {"color2", "Orange", CV_CALL|CV_NOINIT, Color_cons_t, Color2_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playercolor3 = {"color3", "Red", CV_SAVE|CV_CALL|CV_NOINIT, Color_cons_t, Color3_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playercolor3 = {"color3", "Red", CV_CALL|CV_NOINIT, Color_cons_t, Color3_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playercolor4 = {"color4", "Red", CV_SAVE|CV_CALL|CV_NOINIT, Color_cons_t, Color4_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playercolor4 = {"color4", "Blue", CV_CALL|CV_NOINIT, Color_cons_t, Color4_OnChange, 0, NULL, NULL, 0, 0, NULL};
// player's skin, saved for commodity, when using a favorite skins wad.. // player's skin, saved for commodity, when using a favorite skins wad..
consvar_t cv_skin = {"skin", DEFAULTSKIN, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skin = {"skin", DEFAULTSKIN, CV_CALL|CV_NOINIT, NULL, Skin_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skin2 = {"skin2", DEFAULTSKIN2, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin2_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skin2 = {"skin2", DEFAULTSKIN2, CV_CALL|CV_NOINIT, NULL, Skin2_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skin3 = {"skin3", DEFAULTSKIN3, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin3_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skin3 = {"skin3", DEFAULTSKIN3, CV_CALL|CV_NOINIT, NULL, Skin3_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin4_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_CALL|CV_NOINIT, NULL, Skin4_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -682,6 +682,7 @@ void D_RegisterServerCommands(void)
*/ */
void D_RegisterClientCommands(void) void D_RegisterClientCommands(void)
{ {
const char *username;
INT32 i; INT32 i;
for (i = 0; i < MAXSKINCOLORS; i++) for (i = 0; i < MAXSKINCOLORS; i++)
@ -742,6 +743,8 @@ void D_RegisterClientCommands(void)
#endif #endif
// register these so it is saved to config // register these so it is saved to config
if ((username = I_GetUserName()))
cv_playername.defaultvalue = username;
CV_RegisterVar(&cv_playername); CV_RegisterVar(&cv_playername);
CV_RegisterVar(&cv_playercolor); CV_RegisterVar(&cv_playercolor);
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME) CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
@ -1802,11 +1805,6 @@ static void Command_Playdemo_f(void)
CONS_Printf(M_GetText("Playing back demo '%s'.\n"), name); CONS_Printf(M_GetText("Playing back demo '%s'.\n"), name);
// Internal if no extension, external if one exists
// If external, convert the file name to a path in SRB2's home directory
if (FIL_CheckExtension(name))
G_DoPlayDemo(va("%s"PATHSEP"%s", srb2home, name));
else
G_DoPlayDemo(name); G_DoPlayDemo(name);
} }

View file

@ -990,41 +990,19 @@ filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum)
return FS_FOUND; // will never happen, but makes the compiler shut up return FS_FOUND; // will never happen, but makes the compiler shut up
} }
// Rewritten by Monster Iestyn to be less stupid
// Note: if completepath is true, "filename" is modified, but only if FS_FOUND is going to be returned
// (Don't worry about WinCE's version of filesearch, nobody cares about that OS anymore)
filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean completepath) filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean completepath)
{ {
filestatus_t homecheck; // store result of last file search filestatus_t homecheck = filesearch(filename, srb2home, wantedmd5sum, false, 10);
boolean badmd5 = false; // store whether md5 was bad from either of the first two searches (if nothing was found in the third) if (homecheck == FS_FOUND)
return filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
// first, check SRB2's "home" directory homecheck = filesearch(filename, srb2path, wantedmd5sum, false, 10);
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10); if (homecheck == FS_FOUND)
return filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
// next, check SRB2's "path" directory
homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
// finally check "." directory
#ifdef _arch_dreamcast #ifdef _arch_dreamcast
homecheck = filesearch(filename, "/cd", wantedmd5sum, completepath, 10); return filesearch(filename, "/cd", wantedmd5sum, completepath, 10);
#else #else
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10); return filesearch(filename, ".", wantedmd5sum, completepath, 10);
#endif #endif
if (homecheck != FS_NOTFOUND) // if not found this time, fall back on the below return statement
return homecheck; // otherwise return the result we got
return (badmd5 ? FS_MD5SUMBAD : FS_NOTFOUND); // md5 sum bad or file not found
} }

View file

@ -1883,6 +1883,7 @@ static void readframe(MYFILE *f, INT32 num)
char *word1; char *word1;
char *word2 = NULL; char *word2 = NULL;
char *tmp; char *tmp;
INT32 j;
do do
{ {
@ -1897,6 +1898,16 @@ static void readframe(MYFILE *f, INT32 num)
if (s == tmp) if (s == tmp)
continue; // Skip comment lines, but don't break. continue; // Skip comment lines, but don't break.
for (j = 0; s[j] != '\n'; j++)
{
if (s[j] == '=')
{
j += 2;
j = atoi(&s[j]);
break;
}
}
word1 = strtok(s, " "); word1 = strtok(s, " ");
if (word1) if (word1)
strupr(word1); strupr(word1);

View file

@ -222,19 +222,11 @@ static void F_SkyScroll(INT32 scrollspeed)
#ifdef HWRENDER #ifdef HWRENDER
else if (rendermode != render_none) else if (rendermode != render_none)
{ // if only software rendering could be this simple and retarded { // if only software rendering could be this simple and retarded
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); scrolled = animtimer;
INT32 y, pw = SHORT(pat->width) * dupz, ph = SHORT(pat->height) * dupz;
scrolled = animtimer * dupz;
for (x = 0; x < vid.width; x += pw)
{
for (y = 0; y < vid.height; y += ph)
{
if (scrolled > 0) if (scrolled > 0)
V_DrawScaledPatch(scrolled - pw, y, V_NOSCALESTART, pat); V_DrawScaledPatch(scrolled - SHORT(pat->width), 0, 0, pat);
for (x = 0; x < fakedwidth; x += SHORT(pat->width))
V_DrawScaledPatch(x + scrolled, y, V_NOSCALESTART, pat); V_DrawScaledPatch(x + scrolled, 0, 0, pat);
}
}
} }
#endif #endif

View file

@ -1159,14 +1159,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
INT32 laim, th, tspeed, forward, side, axis; //i INT32 laim, th, tspeed, forward, side, axis; //i
const INT32 speed = 1; const INT32 speed = 1;
// these ones used for multiple conditions // these ones used for multiple conditions
boolean turnleft, turnright, invertmouse, mouseaiming, lookaxis, analog, analogjoystickmove, gamepadjoystickmove, kbl, rd; boolean turnleft, turnright, invertmouse, mouseaiming, lookaxis, analog, analogjoystickmove, gamepadjoystickmove, kbl;
player_t *player; player_t *player;
camera_t *thiscam; camera_t *thiscam;
angle_t lang; angle_t lang;
static INT32 turnheld, turnheld2, turnheld3, turnheld4; // for accelerative turning static INT32 turnheld, turnheld2, turnheld3, turnheld4; // for accelerative turning
static boolean keyboard_look, keyboard_look2, keyboard_look3, keyboard_look4; // true if lookup/down using keyboard static boolean keyboard_look, keyboard_look2, keyboard_look3, keyboard_look4; // true if lookup/down using keyboard
static boolean resetdown, resetdown2, resetdown3, resetdown4; // don't cam reset every frame
switch (ssplayer) switch (ssplayer)
{ {
@ -1177,7 +1176,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
laim = localaiming2; laim = localaiming2;
th = turnheld2; th = turnheld2;
kbl = keyboard_look2; kbl = keyboard_look2;
rd = resetdown2;
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1); G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1);
break; break;
case 3: case 3:
@ -1187,7 +1185,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
laim = localaiming3; laim = localaiming3;
th = turnheld3; th = turnheld3;
kbl = keyboard_look3; kbl = keyboard_look3;
rd = resetdown3;
G_CopyTiccmd(cmd, I_BaseTiccmd3(), 1); G_CopyTiccmd(cmd, I_BaseTiccmd3(), 1);
break; break;
case 4: case 4:
@ -1197,7 +1194,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
laim = localaiming4; laim = localaiming4;
th = turnheld4; th = turnheld4;
kbl = keyboard_look4; kbl = keyboard_look4;
rd = resetdown4;
G_CopyTiccmd(cmd, I_BaseTiccmd4(), 1); G_CopyTiccmd(cmd, I_BaseTiccmd4(), 1);
break; break;
case 1: case 1:
@ -1208,7 +1204,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
laim = localaiming; laim = localaiming;
th = turnheld; th = turnheld;
kbl = keyboard_look; kbl = keyboard_look;
rd = resetdown;
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
break; break;
} }
@ -1405,15 +1400,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (InputDown(gc_custom3, ssplayer)) if (InputDown(gc_custom3, ssplayer))
cmd->buttons |= BT_CUSTOM3; cmd->buttons |= BT_CUSTOM3;
if (InputDown(gc_camreset, ssplayer))
{
if (thiscam->chase && !rd)
P_ResetCamera(player, thiscam);
rd = true;
}
else
rd = false;
// player aiming shit, ahhhh... // player aiming shit, ahhhh...
{ {
INT32 player_invert = invertmouse ? -1 : 1; INT32 player_invert = invertmouse ? -1 : 1;
@ -1569,7 +1555,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
localaiming2 = laim; localaiming2 = laim;
keyboard_look2 = kbl; keyboard_look2 = kbl;
turnheld2 = th; turnheld2 = th;
resetdown2 = rd;
camspin2 = InputDown(gc_lookback, ssplayer); camspin2 = InputDown(gc_lookback, ssplayer);
break; break;
case 3: case 3:
@ -1577,7 +1562,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
localaiming3 = laim; localaiming3 = laim;
keyboard_look3 = kbl; keyboard_look3 = kbl;
turnheld3 = th; turnheld3 = th;
resetdown3 = rd;
camspin3 = InputDown(gc_lookback, ssplayer); camspin3 = InputDown(gc_lookback, ssplayer);
break; break;
case 4: case 4:
@ -1585,7 +1569,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
localaiming4 = laim; localaiming4 = laim;
keyboard_look4 = kbl; keyboard_look4 = kbl;
turnheld4 = th; turnheld4 = th;
resetdown4 = rd;
camspin4 = InputDown(gc_lookback, ssplayer); camspin4 = InputDown(gc_lookback, ssplayer);
break; break;
case 1: case 1:
@ -1594,7 +1577,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
localaiming = laim; localaiming = laim;
keyboard_look = kbl; keyboard_look = kbl;
turnheld = th; turnheld = th;
resetdown = rd;
camspin = InputDown(gc_lookback, ssplayer); camspin = InputDown(gc_lookback, ssplayer);
break; break;
} }
@ -4086,7 +4068,6 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
unlocktriggers = 0; unlocktriggers = 0;
// clear itemfinder, just in case // clear itemfinder, just in case
if (!dedicated) // except in dedicated servers, where it is not registered and can actually I_Error debug builds
CV_StealthSetValue(&cv_itemfinder, 0); CV_StealthSetValue(&cv_itemfinder, 0);
} }

View file

@ -1293,6 +1293,7 @@ void G_Controldefault(void)
gamecontrol[gc_lookback ][1] = KEY_JOY1+5; // RB gamecontrol[gc_lookback ][1] = KEY_JOY1+5; // RB
// Extra controls // Extra controls
gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE;
gamecontrol[gc_pause ][0] = KEY_PAUSE; gamecontrol[gc_pause ][0] = KEY_PAUSE;
gamecontrol[gc_console ][0] = KEY_CONSOLE; gamecontrol[gc_console ][0] = KEY_CONSOLE;
gamecontrol[gc_talkkey ][0] = 't'; gamecontrol[gc_talkkey ][0] = 't';
@ -1303,47 +1304,10 @@ void G_Controldefault(void)
gamecontrol[gc_scores ][1] = KEY_JOY1+6; // Back gamecontrol[gc_scores ][1] = KEY_JOY1+6; // Back
gamecontrol[gc_spectate ][1] = KEY_JOY1+7; // Start (This is sort of like MP's pause...?) gamecontrol[gc_spectate ][1] = KEY_JOY1+7; // Start (This is sort of like MP's pause...?)
// Spectator controls
gamecontrol[gc_lookup ][0] = KEY_PGUP; gamecontrol[gc_lookup ][0] = KEY_PGUP;
gamecontrol[gc_lookdown ][0] = KEY_PGDN; gamecontrol[gc_lookdown ][0] = KEY_PGDN;
gamecontrol[gc_centerview ][0] = KEY_END; gamecontrol[gc_centerview ][0] = KEY_END;
gamecontrol[gc_camreset ][0] = KEY_HOME;
gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE;
// Player 2 controls
gamecontrolbis[gc_aimforward ][0] = KEY_2HAT1+0;
gamecontrolbis[gc_aimbackward][0] = KEY_2HAT1+1;
gamecontrolbis[gc_turnleft ][0] = KEY_2HAT1+2;
gamecontrolbis[gc_turnright ][0] = KEY_2HAT1+3;
gamecontrolbis[gc_accelerate ][0] = KEY_2JOY1+0; // A
gamecontrolbis[gc_drift ][0] = KEY_2JOY1+1; // X
gamecontrolbis[gc_brake ][0] = KEY_2JOY1+2; // B
gamecontrolbis[gc_fire ][0] = KEY_2JOY1+4; // LB
gamecontrolbis[gc_lookback ][0] = KEY_2JOY1+5; // RB
gamecontrolbis[gc_spectate ][0] = KEY_2JOY1+7; // Start
// Player 3 controls
gamecontrol3[gc_aimforward ][0] = KEY_3HAT1+0;
gamecontrol3[gc_aimbackward][0] = KEY_3HAT1+1;
gamecontrol3[gc_turnleft ][0] = KEY_3HAT1+2;
gamecontrol3[gc_turnright ][0] = KEY_3HAT1+3;
gamecontrol3[gc_accelerate ][0] = KEY_3JOY1+0; // A
gamecontrol3[gc_drift ][0] = KEY_3JOY1+1; // X
gamecontrol3[gc_brake ][0] = KEY_3JOY1+2; // B
gamecontrol3[gc_fire ][0] = KEY_3JOY1+4; // LB
gamecontrol3[gc_lookback ][0] = KEY_3JOY1+5; // RB
gamecontrol3[gc_spectate ][0] = KEY_3JOY1+7; // Start
// Player 4 controls
gamecontrol4[gc_aimforward ][0] = KEY_4HAT1+0;
gamecontrol4[gc_aimbackward][0] = KEY_4HAT1+1;
gamecontrol4[gc_turnleft ][0] = KEY_4HAT1+2;
gamecontrol4[gc_turnright ][0] = KEY_4HAT1+3;
gamecontrol4[gc_accelerate ][0] = KEY_4JOY1+0; // A
gamecontrol4[gc_drift ][0] = KEY_4JOY1+1; // X
gamecontrol4[gc_brake ][0] = KEY_4JOY1+2; // B
gamecontrol4[gc_fire ][0] = KEY_4JOY1+4; // LB
gamecontrol4[gc_lookback ][0] = KEY_4JOY1+5; // RB
gamecontrol4[gc_spectate ][0] = KEY_4JOY1+7; // Start
} }
//#endif //#endif

View file

@ -103,7 +103,6 @@ typedef enum
gc_brake, gc_brake,
gc_fire, gc_fire,
gc_lookback, gc_lookback,
gc_camreset,
gc_camtoggle, gc_camtoggle,
gc_spectate, gc_spectate,
gc_lookup, gc_lookup,

View file

@ -20,8 +20,8 @@
#define _HWR_DEFS_ #define _HWR_DEFS_
#include "../doomtype.h" #include "../doomtype.h"
#define ZCLIP_PLANE 4.0f // Used for the actual game drawing #define ZCLIP_PLANE 4.0f
#define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures #define NZCLIP_PLANE 0.9f
// ========================================================================== // ==========================================================================
// SIMPLE TYPES // SIMPLE TYPES
@ -134,13 +134,12 @@ enum EPolyFlags
PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pels are discarded (holes in texture) PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pels are discarded (holes in texture)
PF_Translucent = 0x00000002, // Poly is transparent, alpha = level of transparency PF_Translucent = 0x00000002, // Poly is transparent, alpha = level of transparency
PF_Additive = 0x00000004, // Poly is added to the frame buffer PF_Additive = 0x00000024, // Poly is added to the frame buffer
PF_Environment = 0x00000008, // Poly should be drawn environment mapped. PF_Environment = 0x00000008, // Poly should be drawn environment mapped.
// Hurdler: used for text drawing // Hurdler: used for text drawing
PF_Substractive = 0x00000010, // for splat PF_Substractive = 0x00000010, // for splat
PF_NoAlphaTest = 0x00000020, // hiden param PF_NoAlphaTest = 0x00000020, // hiden param
PF_Fog = 0x00000040, // Fog blocks PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive)&~PF_NoAlphaTest,
PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive|PF_Fog)&~PF_NoAlphaTest,
// other flag bits // other flag bits

View file

@ -147,7 +147,10 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
// | /| // | /|
// |/ | // |/ |
// 0--1 // 0--1
float dupx, dupy, fscale, fwidth, fheight; float sdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f;
float sdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f;
float pdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f*FIXED_TO_FLOAT(pscale);
float pdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f*FIXED_TO_FLOAT(pscale);
if (alphalevel >= 10 && alphalevel < 13) if (alphalevel >= 10 && alphalevel < 13)
return; return;
@ -158,40 +161,23 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
else else
HWR_GetMappedPatch(gpatch, colormap); HWR_GetMappedPatch(gpatch, colormap);
dupx = (float)vid.dupx;
dupy = (float)vid.dupy;
switch (option & V_SCALEPATCHMASK) switch (option & V_SCALEPATCHMASK)
{ {
case V_NOSCALEPATCH: case V_NOSCALEPATCH:
dupx = dupy = 1.0f; pdupx = pdupy = 2.0f;
break; break;
case V_SMALLSCALEPATCH: case V_SMALLSCALEPATCH:
dupx = (float)vid.smalldupx; pdupx = 2.0f * FIXED_TO_FLOAT(vid.fsmalldupx);
dupy = (float)vid.smalldupy; pdupy = 2.0f * FIXED_TO_FLOAT(vid.fsmalldupy);
break; break;
case V_MEDSCALEPATCH: case V_MEDSCALEPATCH:
dupx = (float)vid.meddupx; pdupx = 2.0f * FIXED_TO_FLOAT(vid.fmeddupx);
dupy = (float)vid.meddupy; pdupy = 2.0f * FIXED_TO_FLOAT(vid.fmeddupy);
break; break;
} }
dupx = dupy = (dupx < dupy ? dupx : dupy); if (option & V_NOSCALESTART)
fscale = FIXED_TO_FLOAT(pscale); sdupx = sdupy = 2.0f;
if (option & V_OFFSET)
{
cx -= (float)gpatch->leftoffset * dupx * fscale;
cy -= (float)gpatch->topoffset * dupy * fscale;
}
else
{
cy -= (float)gpatch->topoffset * fscale;
if (option & V_FLIP)
cx -= ((float)gpatch->width - (float)gpatch->leftoffset) * fscale;
else
cx -= (float)gpatch->leftoffset * fscale;
}
if (option & V_SPLITSCREEN) if (option & V_SPLITSCREEN)
cy += FIXED_TO_FLOAT((BASEVIDHEIGHT/2)<<FRACBITS); cy += FIXED_TO_FLOAT((BASEVIDHEIGHT/2)<<FRACBITS);
@ -199,70 +185,19 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
if (option & V_HORZSCREEN) if (option & V_HORZSCREEN)
cx += FIXED_TO_FLOAT((BASEVIDWIDTH/2)<<FRACBITS); cx += FIXED_TO_FLOAT((BASEVIDWIDTH/2)<<FRACBITS);
if (!(option & V_NOSCALESTART)) if (option & V_FLIP) // Need to flip both this and sow
{ {
cx = cx * dupx; v[0].x = v[3].x = (cx*sdupx-(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1;
cy = cy * dupy; v[2].x = v[1].x = (cx*sdupx+gpatch->leftoffset*pdupx)/vid.width - 1;
if (!(option & V_SCALEPATCHMASK))
{
// if it's meant to cover the whole screen, black out the rest
// cx and cy are possibly *slightly* off from float maths
// This is done before here compared to software because we directly alter cx and cy to centre
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
{
// Need to temporarily cache the real patch to get the colour of the top left pixel
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
const UINT8 *source = (const UINT8 *)(column) + 3;
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
Z_Free(realpatch);
}
// centre screen
if (vid.width != BASEVIDWIDTH * vid.dupx)
{
if (option & V_SNAPTORIGHT)
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
else if (!(option & V_SNAPTOLEFT))
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
}
if (vid.height != BASEVIDHEIGHT * vid.dupy)
{
if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM))
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
else if (option & V_SNAPTOBOTTOM)
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
else if (!(option & V_SNAPTOTOP))
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/2;
}
}
}
if (pscale != FRACUNIT)
{
fwidth = (float)gpatch->width * fscale * dupx;
fheight = (float)gpatch->height * fscale * dupy;
} }
else else
{ {
fwidth = (float)gpatch->width * dupx; v[0].x = v[3].x = (cx*sdupx-gpatch->leftoffset*pdupx)/vid.width - 1;
fheight = (float)gpatch->height * dupy; v[2].x = v[1].x = (cx*sdupx+(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1;
} }
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1 v[0].y = v[1].y = 1-(cy*sdupy-gpatch->topoffset*pdupy)/vid.height;
cx = -1 + (cx / (vid.width/2)); v[2].y = v[3].y = 1-(cy*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height;
cy = 1 - (cy / (vid.height/2));
// fwidth and fheight are similar
fwidth /= vid.width / 2;
fheight /= vid.height / 2;
// set the polygon vertices to the right positions
v[0].x = v[3].x = cx;
v[2].x = v[1].x = cx + fwidth;
v[0].y = v[1].y = cy;
v[2].y = v[3].y = cy - fheight;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
@ -315,7 +250,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
// | /| // | /|
// |/ | // |/ |
// 0--1 // 0--1
float dupx, dupy, fscale, fwidth, fheight; float sdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f;
float sdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f;
float pdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f*FIXED_TO_FLOAT(pscale);
float pdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f*FIXED_TO_FLOAT(pscale);
if (alphalevel >= 10 && alphalevel < 13) if (alphalevel >= 10 && alphalevel < 13)
return; return;
@ -323,109 +261,28 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
// make patch ready in hardware cache // make patch ready in hardware cache
HWR_GetPatch(gpatch); HWR_GetPatch(gpatch);
dupx = (float)vid.dupx;
dupy = (float)vid.dupy;
switch (option & V_SCALEPATCHMASK) switch (option & V_SCALEPATCHMASK)
{ {
case V_NOSCALEPATCH: case V_NOSCALEPATCH:
dupx = dupy = 1.0f; pdupx = pdupy = 2.0f;
break; break;
case V_SMALLSCALEPATCH: case V_SMALLSCALEPATCH:
dupx = (float)vid.smalldupx; pdupx = 2.0f * FIXED_TO_FLOAT(vid.fsmalldupx);
dupy = (float)vid.smalldupy; pdupy = 2.0f * FIXED_TO_FLOAT(vid.fsmalldupy);
break; break;
case V_MEDSCALEPATCH: case V_MEDSCALEPATCH:
dupx = (float)vid.meddupx; pdupx = 2.0f * FIXED_TO_FLOAT(vid.fmeddupx);
dupy = (float)vid.meddupy; pdupy = 2.0f * FIXED_TO_FLOAT(vid.fmeddupy);
break; break;
} }
dupx = dupy = (dupx < dupy ? dupx : dupy); if (option & V_NOSCALESTART)
fscale = FIXED_TO_FLOAT(pscale); sdupx = sdupy = 2.0f;
cy -= (float)gpatch->topoffset * fscale; v[0].x = v[3].x = (cx*sdupx - gpatch->leftoffset * pdupx) / vid.width - 1;
cx -= (float)gpatch->leftoffset * fscale; v[2].x = v[1].x = (cx*sdupx + ((w-sx) - gpatch->leftoffset) * pdupx) / vid.width - 1;
v[0].y = v[1].y = 1 - (cy*sdupy - gpatch->topoffset * pdupy) / vid.height;
if (!(option & V_NOSCALESTART)) v[2].y = v[3].y = 1 - (cy*sdupy + ((h-sy) - gpatch->topoffset) * pdupy) / vid.height;
{
cx = cx * dupx;
cy = cy * dupy;
if (!(option & V_SCALEPATCHMASK))
{
// if it's meant to cover the whole screen, black out the rest
// cx and cy are possibly *slightly* off from float maths
// This is done before here compared to software because we directly alter cx and cy to centre
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
{
// Need to temporarily cache the real patch to get the colour of the top left pixel
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
const UINT8 *source = (const UINT8 *)(column) + 3;
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
Z_Free(realpatch);
}
// centre screen
if (vid.width != BASEVIDWIDTH * vid.dupx)
{
if (option & V_SNAPTORIGHT)
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
else if (!(option & V_SNAPTOLEFT))
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
}
if (vid.height != BASEVIDHEIGHT * vid.dupy)
{
if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM))
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
else if (option & V_SNAPTOBOTTOM)
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
else if (!(option & V_SNAPTOTOP))
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/2;
}
}
}
fwidth = w;
fheight = h;
if (fwidth > w - sx)
fwidth = w - sx;
if (fheight > h - sy)
fheight = h - sy;
if (fwidth > gpatch->width)
fwidth = gpatch->width;
if (fheight > gpatch->height)
fheight = gpatch->height;
if (pscale != FRACUNIT)
{
fwidth *= fscale * dupx;
fheight *= fscale * dupy;
}
else
{
fwidth *= dupx;
fheight *= dupy;
}
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
cx = -1 + (cx / (vid.width/2));
cy = 1 - (cy / (vid.height/2));
// fwidth and fheight are similar
fwidth /= vid.width / 2;
fheight /= vid.height / 2;
// set the polygon vertices to the right positions
v[0].x = v[3].x = cx;
v[2].x = v[1].x = cx + fwidth;
v[0].y = v[1].y = cy;
v[2].y = v[3].y = cy - fheight;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
@ -802,7 +659,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
{ {
FOutVector v[4]; FOutVector v[4];
FSurfaceInfo Surf; FSurfaceInfo Surf;
float fx, fy, fw, fh; float sdupx, sdupy;
if (w < 0 || h < 0) if (w < 0 || h < 0)
return; // consistency w/ software return; // consistency w/ software
@ -811,79 +668,16 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
// | /| // | /|
// |/ | // |/ |
// 0--1 // 0--1
sdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f;
sdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f;
fx = (float)x; if (color & V_NOSCALESTART)
fy = (float)y; sdupx = sdupy = 2.0f;
fw = (float)w;
fh = (float)h;
if (!(color & V_NOSCALESTART)) v[0].x = v[3].x = (x*sdupx)/vid.width - 1;
{ v[2].x = v[1].x = (x*sdupx + w*sdupx)/vid.width - 1;
float dupx = (float)vid.dupx, dupy = (float)vid.dupy; v[0].y = v[1].y = 1-(y*sdupy)/vid.height;
v[2].y = v[3].y = 1-(y*sdupy + h*sdupy)/vid.height;
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
{
RGBA_t rgbaColour = V_GetColor(color);
FRGBAFloat clearColour;
clearColour.red = (float)rgbaColour.s.red / 255;
clearColour.green = (float)rgbaColour.s.green / 255;
clearColour.blue = (float)rgbaColour.s.blue / 255;
clearColour.alpha = 1;
HWD.pfnClearBuffer(true, false, &clearColour);
return;
}
fx *= dupx;
fy *= dupy;
fw *= dupx;
fh *= dupy;
if (vid.width != BASEVIDWIDTH * vid.dupx)
{
if (color & V_SNAPTORIGHT)
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
else if (!(color & V_SNAPTOLEFT))
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
}
if (vid.height != BASEVIDHEIGHT * dupy)
{
// same thing here
if (color & V_SNAPTOBOTTOM)
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
else if (!(color & V_SNAPTOTOP))
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
}
}
if (fx >= vid.width || fy >= vid.height)
return;
if (fx < 0)
{
fw += fx;
fx = 0;
}
if (fy < 0)
{
fh += fy;
fy = 0;
}
if (fw <= 0 || fh <= 0)
return;
if (fx + fw > vid.width)
fw = (float)vid.width - fx;
if (fy + fh > vid.height)
fh = (float)vid.height - fy;
fx = -1 + fx / (vid.width / 2);
fy = 1 - fy / (vid.height / 2);
fw = fw / (vid.width / 2);
fh = fh / (vid.height / 2);
v[0].x = v[3].x = fx;
v[2].x = v[1].x = fx + fw;
v[0].y = v[1].y = fy;
v[2].y = v[3].y = fy - fh;
//Hurdler: do we still use this argb color? if not, we should remove it //Hurdler: do we still use this argb color? if not, we should remove it
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //; v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;

View file

@ -79,7 +79,6 @@ EXPORT char *HWRAPI(GetRenderer) (void);
#define SCREENVERTS 10 #define SCREENVERTS 10
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]); EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
#endif #endif
EXPORT void HWRAPI(FlushScreenTextures) (void);
EXPORT void HWRAPI(StartScreenWipe) (void); EXPORT void HWRAPI(StartScreenWipe) (void);
EXPORT void HWRAPI(EndScreenWipe) (void); EXPORT void HWRAPI(EndScreenWipe) (void);
EXPORT void HWRAPI(DoScreenWipe) (float alpha); EXPORT void HWRAPI(DoScreenWipe) (float alpha);
@ -125,7 +124,6 @@ struct hwdriver_s
#ifdef SHUFFLE #ifdef SHUFFLE
PostImgRedraw pfnPostImgRedraw; PostImgRedraw pfnPostImgRedraw;
#endif #endif
FlushScreenTextures pfnFlushScreenTextures;
StartScreenWipe pfnStartScreenWipe; StartScreenWipe pfnStartScreenWipe;
EndScreenWipe pfnEndScreenWipe; EndScreenWipe pfnEndScreenWipe;
DoScreenWipe pfnDoScreenWipe; DoScreenWipe pfnDoScreenWipe;

View file

@ -68,7 +68,6 @@ typedef struct gr_vissprite_s
struct gr_vissprite_s *prev; struct gr_vissprite_s *prev;
struct gr_vissprite_s *next; struct gr_vissprite_s *next;
float x1, x2; float x1, x2;
float z1, z2;
float tz, ty; float tz, ty;
lumpnum_t patchlumpnum; lumpnum_t patchlumpnum;
boolean flip; boolean flip;
@ -79,6 +78,7 @@ typedef struct gr_vissprite_s
//Hurdler: 25/04/2000: now support colormap in hardware mode //Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap; UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
float z1, z2;
} gr_vissprite_t; } gr_vissprite_t;
// -------- // --------

File diff suppressed because it is too large Load diff

View file

@ -59,7 +59,7 @@ typedef struct GLRGBAFloat GLRGBAFloat;
#define N_PI_DEMI (M_PIl/2.0f) //(1.5707963268f) #define N_PI_DEMI (M_PIl/2.0f) //(1.5707963268f)
#define ASPECT_RATIO (1.0f) //(320.0f/200.0f) #define ASPECT_RATIO (1.0f) //(320.0f/200.0f)
#define FAR_CLIPPING_PLANE 32768.0f // Draw further! Tails 01-21-2001 #define FAR_CLIPPING_PLANE 150000.0f // Draw further! Tails 01-21-2001
static float NEAR_CLIPPING_PLANE = NZCLIP_PLANE; static float NEAR_CLIPPING_PLANE = NZCLIP_PLANE;
// ************************************************************************** // **************************************************************************
@ -107,19 +107,10 @@ static GLint viewport[4];
#endif #endif
// Yay for arbitrary numbers! NextTexAvail is buggy for some reason. // Yay for arbitrary numbers! NextTexAvail is buggy for some reason.
// Sryder: NextTexAvail is broken for these because palette changes or changes to the texture filter or antialiasing static GLuint screentexture = 60000;
// flush all of the stored textures, leaving them unavailable at times such as between levels static GLuint startScreenWipe = 60001;
// These need to start at 0 and be set to their number, and be reset to 0 when deleted so that intel GPUs static GLuint endScreenWipe = 60002;
// can know when the textures aren't there, as textures are always considered resident in their virtual memory static GLuint finalScreenTexture = 60003;
// TODO: Store them in a more normal way
#define SCRTEX_SCREENTEXTURE 65535
#define SCRTEX_STARTSCREENWIPE 65534
#define SCRTEX_ENDSCREENWIPE 65533
#define SCRTEX_FINALSCREENTEXTURE 65532
static GLuint screentexture = 0;
static GLuint startScreenWipe = 0;
static GLuint endScreenWipe = 0;
static GLuint finalScreenTexture = 0;
#if 0 #if 0
GLuint screentexture = FIRST_TEX_AVAIL; GLuint screentexture = FIRST_TEX_AVAIL;
#endif #endif
@ -272,7 +263,6 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
/* texture mapping */ //GL_EXT_copy_texture /* texture mapping */ //GL_EXT_copy_texture
#ifndef KOS_GL_COMPATIBILITY #ifndef KOS_GL_COMPATIBILITY
#define pglCopyTexImage2D glCopyTexImage2D #define pglCopyTexImage2D glCopyTexImage2D
#define pglCopyTexSubImage2D glCopyTexSubImage2D
#endif #endif
#else //!STATIC_OPENGL #else //!STATIC_OPENGL
@ -397,8 +387,6 @@ static PFNglBindTexture pglBindTexture;
/* texture mapping */ //GL_EXT_copy_texture /* texture mapping */ //GL_EXT_copy_texture
typedef void (APIENTRY * PFNglCopyTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); typedef void (APIENTRY * PFNglCopyTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
static PFNglCopyTexImage2D pglCopyTexImage2D; static PFNglCopyTexImage2D pglCopyTexImage2D;
typedef void (APIENTRY * PFNglCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
static PFNglCopyTexSubImage2D pglCopyTexSubImage2D;
#endif #endif
/* GLU functions */ /* GLU functions */
typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
@ -515,7 +503,6 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC(pglBindTexture , glBindTexture) GETOPENGLFUNC(pglBindTexture , glBindTexture)
GETOPENGLFUNC(pglCopyTexImage2D , glCopyTexImage2D) GETOPENGLFUNC(pglCopyTexImage2D , glCopyTexImage2D)
GETOPENGLFUNC(pglCopyTexSubImage2D , glCopyTexSubImage2D)
#undef GETOPENGLFUNC #undef GETOPENGLFUNC
@ -667,10 +654,6 @@ void SetModelView(GLint w, GLint h)
{ {
// DBG_Printf("SetModelView(): %dx%d\n", (int)w, (int)h); // DBG_Printf("SetModelView(): %dx%d\n", (int)w, (int)h);
// The screen textures need to be flushed if the width or height change so that they be remade for the correct size
if (screen_width != w || screen_height != h)
FlushScreenTextures();
screen_width = w; screen_width = w;
screen_height = h; screen_height = h;
@ -818,7 +801,6 @@ void Flush(void)
screentexture = FIRST_TEX_AVAIL; screentexture = FIRST_TEX_AVAIL;
} }
#endif #endif
tex_downloaded = 0; tex_downloaded = 0;
} }
@ -1074,56 +1056,30 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
switch (PolyFlags & PF_Blending) { switch (PolyFlags & PF_Blending) {
case PF_Translucent & PF_Blending: case PF_Translucent & PF_Blending:
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
#ifndef KOS_GL_COMPATIBILITY
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
#endif
break; break;
case PF_Masked & PF_Blending: case PF_Masked & PF_Blending:
// Hurdler: does that mean lighting is only made by alpha src? // Hurdler: does that mean lighting is only made by alpha src?
// it sounds ok, but not for polygonsmooth // it sounds ok, but not for polygonsmooth
pglBlendFunc(GL_SRC_ALPHA, GL_ZERO); // 0 alpha = holes in texture pglBlendFunc(GL_SRC_ALPHA, GL_ZERO); // 0 alpha = holes in texture
#ifndef KOS_GL_COMPATIBILITY
pglAlphaFunc(GL_GREATER, 0.5f);
#endif
break; break;
case PF_Additive & PF_Blending: case PF_Additive & PF_Blending:
#ifdef ATI_RAGE_PRO_COMPATIBILITY #ifdef ATI_RAGE_PRO_COMPATIBILITY
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
#else #else
pglBlendFunc(GL_SRC_ALPHA, GL_ONE); // src * alpha + dest pglBlendFunc(GL_SRC_ALPHA, GL_ONE); // src * alpha + dest
#endif
#ifndef KOS_GL_COMPATIBILITY
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
#endif #endif
break; break;
case PF_Environment & PF_Blending: case PF_Environment & PF_Blending:
pglBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); pglBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
#ifndef KOS_GL_COMPATIBILITY
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
#endif
break; break;
case PF_Substractive & PF_Blending: case PF_Substractive & PF_Blending:
// good for shadow // good for shadow
// not realy but what else ? // not realy but what else ?
pglBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); pglBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
#ifndef KOS_GL_COMPATIBILITY
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
#endif
break;
case PF_Fog & PF_Fog:
// Sryder: Fog
// multiplies input colour by input alpha, and destination colour by input colour, then adds them
pglBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR);
#ifndef KOS_GL_COMPATIBILITY
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
#endif
break; break;
default : // must be 0, otherwise it's an error default : // must be 0, otherwise it's an error
// No blending // No blending
pglBlendFunc(GL_ONE, GL_ZERO); // the same as no blending pglBlendFunc(GL_ONE, GL_ZERO); // the same as no blending
#ifndef KOS_GL_COMPATIBILITY
pglAlphaFunc(GL_GREATER, 0.5f);
#endif
break; break;
} }
} }
@ -1383,7 +1339,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
tex[w*j+i].s.green = 0; tex[w*j+i].s.green = 0;
tex[w*j+i].s.blue = 0; tex[w*j+i].s.blue = 0;
tex[w*j+i].s.alpha = 0; tex[w*j+i].s.alpha = 0;
pTexInfo->flags |= TF_TRANSPARENT; // there is a hole in it
} }
else else
{ {
@ -1454,22 +1409,8 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
tex_downloaded = pTexInfo->downloaded; tex_downloaded = pTexInfo->downloaded;
pglBindTexture(GL_TEXTURE_2D, pTexInfo->downloaded); pglBindTexture(GL_TEXTURE_2D, pTexInfo->downloaded);
// disable texture filtering on any texture that has holes so there's no dumb borders or blending issues
if (pTexInfo->flags & TF_TRANSPARENT)
{
#ifdef KOS_GL_COMPATIBILITY
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NONE);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NONE);
#else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
#endif
}
else
{
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
}
#ifdef KOS_GL_COMPATIBILITY #ifdef KOS_GL_COMPATIBILITY
pglTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444, w, h, 0, GL_ARGB4444, GL_UNSIGNED_BYTE, ptex); pglTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444, w, h, 0, GL_ARGB4444, GL_UNSIGNED_BYTE, ptex);
@ -1923,6 +1864,12 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration,
ambient[1] = 0.75f; ambient[1] = 0.75f;
if (ambient[2] > 0.75f) if (ambient[2] > 0.75f)
ambient[2] = 0.75f; ambient[2] = 0.75f;
if (color[3] < 255)
{
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
pglDepthMask(GL_FALSE);
}
} }
pglEnable(GL_CULL_FACE); pglEnable(GL_CULL_FACE);
@ -1951,12 +1898,10 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration,
pglMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient); pglMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient);
pglMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse); pglMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
#endif #endif
if (color[3] < 255)
SetBlend(PF_Translucent|PF_Modulated|PF_Clip);
else
SetBlend(PF_Masked|PF_Modulated|PF_Occlude|PF_Clip);
} }
DrawPolygon(NULL, NULL, 0, PF_Masked|PF_Modulated|PF_Occlude|PF_Clip);
pglPushMatrix(); // should be the same as glLoadIdentity pglPushMatrix(); // should be the same as glLoadIdentity
//Hurdler: now it seems to work //Hurdler: now it seems to work
pglTranslatef(pos->x, pos->z, pos->y); pglTranslatef(pos->x, pos->z, pos->y);
@ -1964,6 +1909,14 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration,
scaley = -scaley; scaley = -scaley;
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f); pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f); pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
//pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
// Remove depth mask when the model is transparent so it doesn't cut thorugh sprites // SRB2CBTODO: For all stuff too?!
if (color && color[3] < 255)
{
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
pglDepthMask(GL_FALSE);
}
val = *gl_cmd_buffer++; val = *gl_cmd_buffer++;
@ -2031,6 +1984,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration,
if (color) if (color)
pglDisable(GL_LIGHTING); pglDisable(GL_LIGHTING);
pglShadeModel(GL_FLAT); pglShadeModel(GL_FLAT);
pglDepthMask(GL_TRUE);
pglDisable(GL_CULL_FACE); pglDisable(GL_CULL_FACE);
} }
@ -2185,25 +2139,10 @@ EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
} }
#endif //SHUFFLE #endif //SHUFFLE
// Sryder: This needs to be called whenever the screen changes resolution in order to reset the screen textures to use
// a new size
EXPORT void HWRAPI(FlushScreenTextures) (void)
{
pglDeleteTextures(1, &screentexture);
pglDeleteTextures(1, &startScreenWipe);
pglDeleteTextures(1, &endScreenWipe);
pglDeleteTextures(1, &finalScreenTexture);
screentexture = 0;
startScreenWipe = 0;
endScreenWipe = 0;
finalScreenTexture = 0;
}
// Create Screen to fade from // Create Screen to fade from
EXPORT void HWRAPI(StartScreenWipe) (void) EXPORT void HWRAPI(StartScreenWipe) (void)
{ {
INT32 texsize = 2048; INT32 texsize = 2048;
boolean firstTime = (startScreenWipe == 0);
// Use a power of two texture, dammit // Use a power of two texture, dammit
if(screen_width <= 512) if(screen_width <= 512)
@ -2212,12 +2151,7 @@ EXPORT void HWRAPI(StartScreenWipe) (void)
texsize = 1024; texsize = 1024;
// Create screen texture // Create screen texture
if (firstTime)
startScreenWipe = SCRTEX_STARTSCREENWIPE;
pglBindTexture(GL_TEXTURE_2D, startScreenWipe); pglBindTexture(GL_TEXTURE_2D, startScreenWipe);
if (firstTime)
{
#ifdef KOS_GL_COMPATIBILITY #ifdef KOS_GL_COMPATIBILITY
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
@ -2230,20 +2164,14 @@ EXPORT void HWRAPI(StartScreenWipe) (void)
#ifndef KOS_GL_COMPATIBILITY #ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
#endif #endif
}
else
#ifndef KOS_GL_COMPATIBILITY
pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize);
#endif
tex_downloaded = startScreenWipe; tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
} }
// Create Screen to fade to // Create Screen to fade to
EXPORT void HWRAPI(EndScreenWipe)(void) EXPORT void HWRAPI(EndScreenWipe)(void)
{ {
INT32 texsize = 2048; INT32 texsize = 2048;
boolean firstTime = (endScreenWipe == 0);
// Use a power of two texture, dammit // Use a power of two texture, dammit
if(screen_width <= 512) if(screen_width <= 512)
@ -2252,12 +2180,7 @@ EXPORT void HWRAPI(EndScreenWipe)(void)
texsize = 1024; texsize = 1024;
// Create screen texture // Create screen texture
if (firstTime)
endScreenWipe = SCRTEX_ENDSCREENWIPE;
pglBindTexture(GL_TEXTURE_2D, endScreenWipe); pglBindTexture(GL_TEXTURE_2D, endScreenWipe);
if (firstTime)
{
#ifdef KOS_GL_COMPATIBILITY #ifdef KOS_GL_COMPATIBILITY
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
@ -2270,14 +2193,8 @@ EXPORT void HWRAPI(EndScreenWipe)(void)
#ifndef KOS_GL_COMPATIBILITY #ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
#endif #endif
}
else
#ifndef KOS_GL_COMPATIBILITY
pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize);
#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
tex_downloaded = endScreenWipe;
} }
@ -2319,7 +2236,7 @@ EXPORT void HWRAPI(DrawIntermissionBG)(void)
pglEnd(); pglEnd();
tex_downloaded = screentexture; tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
} }
// Do screen fades! // Do screen fades!
@ -2410,7 +2327,6 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
pglDisable(GL_TEXTURE_2D); // disable the texture in the 2nd texture unit pglDisable(GL_TEXTURE_2D); // disable the texture in the 2nd texture unit
pglActiveTexture(GL_TEXTURE0); pglActiveTexture(GL_TEXTURE0);
tex_downloaded = endScreenWipe;
} }
else else
{ {
@ -2436,10 +2352,11 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
pglTexCoord2f(xfix, 0.0f); pglTexCoord2f(xfix, 0.0f);
pglVertex3f(1.0f, -1.0f, 1.0f); pglVertex3f(1.0f, -1.0f, 1.0f);
pglEnd(); pglEnd();
tex_downloaded = endScreenWipe;
#ifndef MINI_GL_COMPATIBILITY #ifndef MINI_GL_COMPATIBILITY
} }
#endif #endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
} }
@ -2447,7 +2364,6 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
EXPORT void HWRAPI(MakeScreenTexture) (void) EXPORT void HWRAPI(MakeScreenTexture) (void)
{ {
INT32 texsize = 2048; INT32 texsize = 2048;
boolean firstTime = (screentexture == 0);
// Use a power of two texture, dammit // Use a power of two texture, dammit
if(screen_width <= 512) if(screen_width <= 512)
@ -2456,12 +2372,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (void)
texsize = 1024; texsize = 1024;
// Create screen texture // Create screen texture
if (firstTime)
screentexture = SCRTEX_SCREENTEXTURE;
pglBindTexture(GL_TEXTURE_2D, screentexture); pglBindTexture(GL_TEXTURE_2D, screentexture);
if (firstTime)
{
#ifdef KOS_GL_COMPATIBILITY #ifdef KOS_GL_COMPATIBILITY
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
@ -2474,19 +2385,13 @@ EXPORT void HWRAPI(MakeScreenTexture) (void)
#ifndef KOS_GL_COMPATIBILITY #ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
#endif #endif
}
else
#ifndef KOS_GL_COMPATIBILITY
pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize);
#endif
tex_downloaded = screentexture; tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
} }
EXPORT void HWRAPI(MakeScreenFinalTexture) (void) EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
{ {
INT32 texsize = 2048; INT32 texsize = 2048;
boolean firstTime = (finalScreenTexture == 0);
// Use a power of two texture, dammit // Use a power of two texture, dammit
if(screen_width <= 512) if(screen_width <= 512)
@ -2495,12 +2400,7 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
texsize = 1024; texsize = 1024;
// Create screen texture // Create screen texture
if (firstTime)
finalScreenTexture = SCRTEX_FINALSCREENTEXTURE;
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture); pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
if (firstTime)
{
#ifdef KOS_GL_COMPATIBILITY #ifdef KOS_GL_COMPATIBILITY
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
@ -2513,22 +2413,14 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
#ifndef KOS_GL_COMPATIBILITY #ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
#endif #endif
}
else
#ifndef KOS_GL_COMPATIBILITY
pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize);
#endif
tex_downloaded = finalScreenTexture; tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
} }
EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height) EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
{ {
float xfix, yfix; float xfix, yfix;
float origaspect, newaspect;
float xoff = 1, yoff = 1; // xoffset and yoffset for the polygon to have black bars around the screen
FRGBAFloat clearColour;
INT32 texsize = 2048; INT32 texsize = 2048;
if(screen_width <= 1024) if(screen_width <= 1024)
@ -2539,47 +2431,35 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
xfix = 1/((float)(texsize)/((float)((screen_width)))); xfix = 1/((float)(texsize)/((float)((screen_width))));
yfix = 1/((float)(texsize)/((float)((screen_height)))); yfix = 1/((float)(texsize)/((float)((screen_height))));
origaspect = (float)screen_width / screen_height; //pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
newaspect = (float)width / height;
if (origaspect < newaspect)
{
xoff = origaspect / newaspect;
yoff = 1;
}
else if (origaspect > newaspect)
{
xoff = 1;
yoff = newaspect / origaspect;
}
pglViewport(0, 0, width, height); pglViewport(0, 0, width, height);
clearColour.red = clearColour.green = clearColour.blue = 0;
clearColour.alpha = 1;
ClearBuffer(true, false, &clearColour);
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture); pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
pglBegin(GL_QUADS); pglBegin(GL_QUADS);
pglColor4f(1.0f, 1.0f, 1.0f, 1.0f); pglColor4f(1.0f, 1.0f, 1.0f, 1.0f);
// Bottom left // Bottom left
pglTexCoord2f(0.0f, 0.0f); pglTexCoord2f(0.0f, 0.0f);
pglVertex3f(-xoff, -yoff, 1.0f); pglVertex3f(-1, -1, 1.0f);
// Top left // Top left
pglTexCoord2f(0.0f, yfix); pglTexCoord2f(0.0f, yfix);
pglVertex3f(-xoff, yoff, 1.0f); pglVertex3f(-1, 1, 1.0f);
// Top right // Top right
pglTexCoord2f(xfix, yfix); pglTexCoord2f(xfix, yfix);
pglVertex3f(xoff, yoff, 1.0f); pglVertex3f(1, 1, 1.0f);
// Bottom right // Bottom right
pglTexCoord2f(xfix, 0.0f); pglTexCoord2f(xfix, 0.0f);
pglVertex3f(xoff, -yoff, 1.0f); pglVertex3f(1, -1, 1.0f);
pglEnd(); pglEnd();
tex_downloaded = finalScreenTexture; SetModelView(screen_width, screen_height);
SetStates();
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
} }
#endif //HWRENDER #endif //HWRENDER

View file

@ -479,10 +479,10 @@ static const struct {
{NULL, ARCH_NULL} {NULL, ARCH_NULL}
}; };
static UINT8 GetUserdataArchType(int index) static UINT8 GetUserdataArchType(void)
{ {
UINT8 i; UINT8 i;
lua_getmetatable(gL, index); lua_getmetatable(gL, -1);
for (i = 0; meta2arch[i].meta; i++) for (i = 0; meta2arch[i].meta; i++)
{ {
@ -561,7 +561,7 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
break; break;
} }
case LUA_TUSERDATA: case LUA_TUSERDATA:
switch (GetUserdataArchType(myindex)) switch (GetUserdataArchType())
{ {
case ARCH_MOBJINFO: case ARCH_MOBJINFO:
{ {
@ -768,25 +768,16 @@ static void ArchiveTables(void)
lua_pushnil(gL); lua_pushnil(gL);
while (lua_next(gL, -2)) while (lua_next(gL, -2))
{ {
// Write key ArchiveValue(TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this.
e = ArchiveValue(TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this.
if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
{
lua_pushvalue(gL, -2);
CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -1), luaL_typename(gL, -1), i);
lua_pop(gL, 1);
}
// Write value
e = ArchiveValue(TABLESINDEX, -1); e = ArchiveValue(TABLESINDEX, -1);
if (e == 1) if (e == 1)
n++; // the table contained a new table we'll have to archive. :( n++; // the table contained a new table we'll have to archive. :(
else if (e == 2) // invalid value type else if (e == 2)
{ {
lua_pushvalue(gL, -2); lua_pushvalue(gL, -2);
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -1), luaL_typename(gL, -1)); CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -1), luaL_typename(gL, -1));
lua_pop(gL, 1); lua_pop(gL, 1);
} }
lua_pop(gL, 1); lua_pop(gL, 1);
} }
lua_pop(gL, 1); lua_pop(gL, 1);
@ -922,16 +913,10 @@ static void UnArchiveTables(void)
lua_rawgeti(gL, TABLESINDEX, i); lua_rawgeti(gL, TABLESINDEX, i);
while (true) while (true)
{ {
if (UnArchiveValue(TABLESINDEX) == 1) // read key if (UnArchiveValue(TABLESINDEX) == 1)
break; break;
if (UnArchiveValue(TABLESINDEX) == 2) // read value if (UnArchiveValue(TABLESINDEX) == 2)
n++; n++;
if (lua_isnil(gL, -2)) // if key is nil (if a function etc was accidentally saved)
{
CONS_Alert(CONS_ERROR, "A nil key in table %d was found! (Invalid key type or corrupted save?)\n", i);
lua_pop(gL, 2); // pop key and value instead of setting them in the table, to prevent Lua panic errors
}
else
lua_rawset(gL, -3); lua_rawset(gL, -3);
} }
lua_pop(gL, 1); lua_pop(gL, 1);

View file

@ -1129,6 +1129,7 @@ static menuitem_t OP_MoveControlsMenu[] =
{IT_CALL | IT_STRING2, NULL, "Use/Throw Item", M_ChangeControl, gc_fire }, {IT_CALL | IT_STRING2, NULL, "Use/Throw Item", M_ChangeControl, gc_fire },
{IT_CALL | IT_STRING2, NULL, "Look Backward", M_ChangeControl, gc_lookback }, {IT_CALL | IT_STRING2, NULL, "Look Backward", M_ChangeControl, gc_lookback },
{IT_CALL | IT_STRING2, NULL, "Toggle Chasecam", M_ChangeControl, gc_camtoggle },
{IT_CALL | IT_STRING2, NULL, "Talk key", M_ChangeControl, gc_talkkey }, {IT_CALL | IT_STRING2, NULL, "Talk key", M_ChangeControl, gc_talkkey },
{IT_CALL | IT_STRING2, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey }, {IT_CALL | IT_STRING2, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey },
{IT_CALL | IT_STRING2, NULL, "Rankings/Scores", M_ChangeControl, gc_scores }, {IT_CALL | IT_STRING2, NULL, "Rankings/Scores", M_ChangeControl, gc_scores },
@ -1136,8 +1137,8 @@ static menuitem_t OP_MoveControlsMenu[] =
{IT_CALL | IT_STRING2, NULL, "Pause", M_ChangeControl, gc_pause }, {IT_CALL | IT_STRING2, NULL, "Pause", M_ChangeControl, gc_pause },
{IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console }, {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console },
{IT_SUBMENU | IT_STRING, NULL, "Spectator Controls...", &OP_SpectateControlsDef, 112}, {IT_SUBMENU | IT_STRING, NULL, "Spectator Controls...",&OP_SpectateControlsDef,120},
{IT_SUBMENU | IT_STRING, NULL, "Custom Lua Actions...", &OP_CustomControlsDef, 120}, {IT_SUBMENU | IT_STRING, NULL, "Custom Actions...", &OP_CustomControlsDef, 128},
}; };
static menuitem_t OP_SpectateControlsMenu[] = static menuitem_t OP_SpectateControlsMenu[] =
@ -1146,8 +1147,6 @@ static menuitem_t OP_SpectateControlsMenu[] =
{IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, gc_lookup }, {IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, gc_lookup },
{IT_CALL | IT_STRING2, NULL, "Look Down", M_ChangeControl, gc_lookdown }, {IT_CALL | IT_STRING2, NULL, "Look Down", M_ChangeControl, gc_lookdown },
{IT_CALL | IT_STRING2, NULL, "Center View", M_ChangeControl, gc_centerview}, {IT_CALL | IT_STRING2, NULL, "Center View", M_ChangeControl, gc_centerview},
{IT_CALL | IT_STRING2, NULL, "Reset Camera", M_ChangeControl, gc_camreset },
{IT_CALL | IT_STRING2, NULL, "Toggle Chasecam", M_ChangeControl, gc_camtoggle },
}; };
static menuitem_t OP_CustomControlsMenu[] = static menuitem_t OP_CustomControlsMenu[] =
@ -6711,13 +6710,6 @@ static void M_DrawConnectIPMenu(void)
static void M_ConnectIP(INT32 choice) static void M_ConnectIP(INT32 choice)
{ {
(void)choice; (void)choice;
if (*setupm_ip == 0)
{
M_StartMessage("You must specify an IP address.\n", NULL, MM_NOTHING);
return;
}
COM_BufAddText(va("connect \"%s\"\n", setupm_ip)); COM_BufAddText(va("connect \"%s\"\n", setupm_ip));
// A little "please wait" message. // A little "please wait" message.
@ -7382,12 +7374,13 @@ static void M_Setup1PControlsMenu(INT32 choice)
setupcontrols = gamecontrol; // was called from main Options (for console player, then) setupcontrols = gamecontrol; // was called from main Options (for console player, then)
currentMenu->lastOn = itemOn; currentMenu->lastOn = itemOn;
// Unhide P1-only controls // Unhide the three non-P2 controls
OP_MoveControlsMenu[9].status = IT_CALL|IT_STRING2; // Talk OP_MoveControlsMenu[12].status = IT_CALL|IT_STRING2;
OP_MoveControlsMenu[10].status = IT_CALL|IT_STRING2; // Team talk OP_MoveControlsMenu[13].status = IT_CALL|IT_STRING2;
OP_MoveControlsMenu[11].status = IT_CALL|IT_STRING2; // Rankings OP_MoveControlsMenu[14].status = IT_CALL|IT_STRING2;
OP_MoveControlsMenu[12].status = IT_CALL|IT_STRING2; // Pause // Unide the pause/console controls too
OP_MoveControlsMenu[13].status = IT_CALL|IT_STRING2; // Console OP_MoveControlsMenu[10].status = IT_CALL|IT_STRING2;
OP_MoveControlsMenu[11].status = IT_CALL|IT_STRING2;
OP_MoveControlsDef.prevMenu = &OP_P1ControlsDef; OP_MoveControlsDef.prevMenu = &OP_P1ControlsDef;
M_SetupNextMenu(&OP_MoveControlsDef); M_SetupNextMenu(&OP_MoveControlsDef);
@ -7402,12 +7395,13 @@ static void M_Setup2PControlsMenu(INT32 choice)
setupcontrols = gamecontrolbis; setupcontrols = gamecontrolbis;
currentMenu->lastOn = itemOn; currentMenu->lastOn = itemOn;
// Hide P1-only controls // Hide the three non-P2 controls
OP_MoveControlsMenu[9].status = IT_GRAYEDOUT2; // Talk OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Team talk OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings OP_MoveControlsMenu[14].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause // Hide the pause/console controls too
OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2;
OP_MoveControlsDef.prevMenu = &OP_P2ControlsDef; OP_MoveControlsDef.prevMenu = &OP_P2ControlsDef;
M_SetupNextMenu(&OP_MoveControlsDef); M_SetupNextMenu(&OP_MoveControlsDef);
@ -7423,12 +7417,13 @@ static void M_Setup3PControlsMenu(INT32 choice)
setupcontrols = gamecontrol3; setupcontrols = gamecontrol3;
currentMenu->lastOn = itemOn; currentMenu->lastOn = itemOn;
// Hide P1-only controls // Hide the three non-P3 controls
OP_MoveControlsMenu[9].status = IT_GRAYEDOUT2; // Talk OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Team talk OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings OP_MoveControlsMenu[14].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause // Hide the pause/console controls too
OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2;
OP_MoveControlsDef.prevMenu = &OP_P3ControlsDef; OP_MoveControlsDef.prevMenu = &OP_P3ControlsDef;
M_SetupNextMenu(&OP_MoveControlsDef); M_SetupNextMenu(&OP_MoveControlsDef);
@ -7443,12 +7438,13 @@ static void M_Setup4PControlsMenu(INT32 choice)
setupcontrols = gamecontrol4; setupcontrols = gamecontrol4;
currentMenu->lastOn = itemOn; currentMenu->lastOn = itemOn;
// Hide P1-only controls // Hide the three non-P4 controls
OP_MoveControlsMenu[9].status = IT_GRAYEDOUT2; // Talk OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Team talk OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings OP_MoveControlsMenu[14].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause // Hide the pause/console controls too
OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2;
OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2;
OP_MoveControlsDef.prevMenu = &OP_P4ControlsDef; OP_MoveControlsDef.prevMenu = &OP_P4ControlsDef;
M_SetupNextMenu(&OP_MoveControlsDef); M_SetupNextMenu(&OP_MoveControlsDef);

View file

@ -644,12 +644,13 @@ static void M_PNGhdr(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png_
static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png_byte movie) static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png_byte movie)
{ {
#ifdef PNG_TEXT_SUPPORTED #ifdef PNG_TEXT_SUPPORTED
#define SRB2PNGTXT 10 //PNG_KEYWORD_MAX_LENGTH(79) is the max #define SRB2PNGTXT 11 //PNG_KEYWORD_MAX_LENGTH(79) is the max
png_text png_infotext[SRB2PNGTXT]; png_text png_infotext[SRB2PNGTXT];
char keytxt[SRB2PNGTXT][12] = { char keytxt[SRB2PNGTXT][12] = {
"Title", "Description", "Playername", "Mapnum", "Mapname", "Title", "Author", "Description", "Playername", "Mapnum", "Mapname",
"Location", "Interface", "Revision", "Build Date", "Build Time"}; "Location", "Interface", "Revision", "Build Date", "Build Time"};
char titletxt[] = "SRB2Kart " VERSIONSTRING; char titletxt[] = "SRB2Kart " VERSIONSTRING;
png_charp authortxt = I_GetUserName();
png_charp playertxt = cv_playername.zstring; png_charp playertxt = cv_playername.zstring;
char desctxt[] = "SRB2Kart Screenshot"; char desctxt[] = "SRB2Kart Screenshot";
char Movietxt[] = "SRB2Kart Movie"; char Movietxt[] = "SRB2Kart Movie";
@ -700,18 +701,19 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
png_infotext[i].key = keytxt[i]; png_infotext[i].key = keytxt[i];
png_infotext[0].text = titletxt; png_infotext[0].text = titletxt;
png_infotext[1].text = authortxt;
if (movie) if (movie)
png_infotext[1].text = Movietxt; png_infotext[2].text = Movietxt;
else else
png_infotext[1].text = desctxt; png_infotext[2].text = desctxt;
png_infotext[2].text = playertxt; png_infotext[3].text = playertxt;
png_infotext[3].text = maptext; png_infotext[4].text = maptext;
png_infotext[4].text = lvlttltext; png_infotext[5].text = lvlttltext;
png_infotext[5].text = locationtxt; png_infotext[6].text = locationtxt;
png_infotext[6].text = interfacetxt; png_infotext[7].text = interfacetxt;
png_infotext[7].text = strncpy(ctrevision, comprevision, sizeof(ctrevision)-1); png_infotext[8].text = strncpy(ctrevision, comprevision, sizeof(ctrevision)-1);
png_infotext[8].text = strncpy(ctdate, compdate, sizeof(ctdate)-1); png_infotext[9].text = strncpy(ctdate, compdate, sizeof(ctdate)-1);
png_infotext[9].text = strncpy(cttime, comptime, sizeof(cttime)-1); png_infotext[10].text = strncpy(cttime, comptime, sizeof(cttime)-1);
png_set_text(png_ptr, png_info_ptr, png_infotext, SRB2PNGTXT); png_set_text(png_ptr, png_info_ptr, png_infotext, SRB2PNGTXT);
#undef SRB2PNGTXT #undef SRB2PNGTXT

View file

@ -2629,7 +2629,6 @@ boolean P_SetupLevel(boolean skipprecip)
{ {
tic_t starttime = I_GetTime(); tic_t starttime = I_GetTime();
tic_t endtime = starttime + (3*TICRATE)/2; tic_t endtime = starttime + (3*TICRATE)/2;
tic_t nowtime;
S_StartSound(NULL, sfx_s3kaf); S_StartSound(NULL, sfx_s3kaf);
@ -2639,17 +2638,9 @@ boolean P_SetupLevel(boolean skipprecip)
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_speclevel_towhite], false); F_RunWipe(wipedefs[wipe_speclevel_towhite], false);
nowtime = lastwipetic;
// Hold on white for extra effect. // Hold on white for extra effect.
while (nowtime < endtime) while (I_GetTime() < endtime)
{
// wait loop
while (!((nowtime = I_GetTime()) - lastwipetic))
I_Sleep(); I_Sleep();
lastwipetic = nowtime;
if (moviemode) // make sure we save frames for the white hold too
M_SaveFrame();
}
ranspecialwipe = 1; ranspecialwipe = 1;
} }

View file

@ -69,7 +69,7 @@ void R_DrawMasked(void);
#define DEFAULTSKIN "sonic" #define DEFAULTSKIN "sonic"
#define DEFAULTSKIN2 "tails" // secondary player #define DEFAULTSKIN2 "tails" // secondary player
#define DEFAULTSKIN3 "knuckles" // third player #define DEFAULTSKIN3 "knuckles" // third player
#define DEFAULTSKIN4 "eggman" // fourth player #define DEFAULTSKIN4 "metalsonic" // fourth player
typedef struct typedef struct
{ {

View file

@ -94,7 +94,6 @@ void *hwSym(const char *funcName,void *handle)
#ifdef SHUFFLE #ifdef SHUFFLE
GETFUNC(PostImgRedraw); GETFUNC(PostImgRedraw);
#endif //SHUFFLE #endif //SHUFFLE
GETFUNC(FlushScreenTextures);
GETFUNC(StartScreenWipe); GETFUNC(StartScreenWipe);
GETFUNC(EndScreenWipe); GETFUNC(EndScreenWipe);
GETFUNC(DoScreenWipe); GETFUNC(DoScreenWipe);

View file

@ -3371,7 +3371,7 @@ const char *I_LocateWad(void)
return waddir; return waddir;
} }
#ifdef __linux__ #if defined(LINUX) || defined(LINUX64)
#define MEMINFO_FILE "/proc/meminfo" #define MEMINFO_FILE "/proc/meminfo"
#define MEMTOTAL "MemTotal:" #define MEMTOTAL "MemTotal:"
#define MEMFREE "MemFree:" #define MEMFREE "MemFree:"
@ -3391,14 +3391,12 @@ UINT32 I_GetFreeMem(UINT32 *total)
}; };
if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL) if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL)
{ {
if (total)
*total = 0L; *total = 0L;
return 0; return 0;
} }
if (kvm_nlist(kd, namelist) != 0) if (kvm_nlist(kd, namelist) != 0)
{ {
kvm_close (kd); kvm_close (kd);
if (total)
*total = 0L; *total = 0L;
return 0; return 0;
} }
@ -3406,7 +3404,6 @@ UINT32 I_GetFreeMem(UINT32 *total)
sizeof (sum)) != sizeof (sum)) sizeof (sum)) != sizeof (sum))
{ {
kvm_close(kd); kvm_close(kd);
if (total)
*total = 0L; *total = 0L;
return 0; return 0;
} }
@ -3438,7 +3435,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
(PVOID) &pr_arena, sizeof (UINT32)); (PVOID) &pr_arena, sizeof (UINT32));
return pr_arena; return pr_arena;
#elif defined (__linux__) #elif defined (LINUX) || defined (LINUX64)
/* Linux */ /* Linux */
char buf[1024]; char buf[1024];
char *memTag; char *memTag;
@ -3454,16 +3451,14 @@ UINT32 I_GetFreeMem(UINT32 *total)
if (n < 0) if (n < 0)
{ {
// Error // Error
if (total)
*total = 0L; *total = 0L;
return 0; return 0;
} }
buf[n] = '\0'; buf[n] = '\0';
if ((memTag = strstr(buf, MEMTOTAL)) == NULL) if (NULL == (memTag = strstr(buf, MEMTOTAL)))
{ {
// Error // Error
if (total)
*total = 0L; *total = 0L;
return 0; return 0;
} }
@ -3471,10 +3466,9 @@ UINT32 I_GetFreeMem(UINT32 *total)
memTag += sizeof (MEMTOTAL); memTag += sizeof (MEMTOTAL);
totalKBytes = atoi(memTag); totalKBytes = atoi(memTag);
if ((memTag = strstr(buf, MEMFREE)) == NULL) if (NULL == (memTag = strstr(buf, MEMFREE)))
{ {
// Error // Error
if (total)
*total = 0L; *total = 0L;
return 0; return 0;
} }
@ -3490,7 +3484,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
if (total) if (total)
*total = 48<<20; *total = 48<<20;
return 48<<20; return 48<<20;
#endif #endif /* LINUX */
} }
const CPUInfoFlags *I_CPUInfo(void) const CPUInfoFlags *I_CPUInfo(void)

View file

@ -1506,7 +1506,6 @@ void I_StartupGraphics(void)
#ifdef SHUFFLE #ifdef SHUFFLE
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL); HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
#endif #endif
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL); HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL); HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL); HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);

View file

@ -214,11 +214,8 @@ void OglSdlFinishUpdate(boolean waitvbl)
HWR_DrawScreenFinalTexture(sdlw, sdlh); HWR_DrawScreenFinalTexture(sdlw, sdlh);
SDL_GL_SwapWindow(window); SDL_GL_SwapWindow(window);
GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE); SetModelView(realwidth, realheight);
SetStates();
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
// effects that want to take the old screen can do so after this
HWR_DrawScreenFinalTexture(realwidth, realheight);
} }
EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma) EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)

View file

@ -1180,6 +1180,12 @@ void I_StartupSound(void)
audio.callback = I_UpdateStream; audio.callback = I_UpdateStream;
audio.userdata = &localdata; audio.userdata = &localdata;
if (dedicated)
{
nosound = nomidimusic = nodigimusic = true;
return;
}
// Configure sound device // Configure sound device
CONS_Printf("I_StartupSound:\n"); CONS_Printf("I_StartupSound:\n");
@ -1475,6 +1481,9 @@ void I_InitMusic(void)
I_AddExitFunc(I_ShutdownGMEMusic); I_AddExitFunc(I_ShutdownGMEMusic);
#endif #endif
if ((nomidimusic && nodigimusic) || dedicated)
return;
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
MIX_VERSION(&MIXcompiled) MIX_VERSION(&MIXcompiled)
MIXlinked = Mix_Linked_Version(); MIXlinked = Mix_Linked_Version();

View file

@ -100,7 +100,6 @@ void *hwSym(const char *funcName,void *handle)
#ifdef SHUFFLE #ifdef SHUFFLE
GETFUNC(PostImgRedraw); GETFUNC(PostImgRedraw);
#endif //SHUFFLE #endif //SHUFFLE
GETFUNC(FlushScreenTextures);
GETFUNC(StartScreenWipe); GETFUNC(StartScreenWipe);
GETFUNC(EndScreenWipe); GETFUNC(EndScreenWipe);
GETFUNC(DoScreenWipe); GETFUNC(DoScreenWipe);

View file

@ -1972,7 +1972,6 @@ void I_StartupGraphics(void)
#ifdef SHUFFLE #ifdef SHUFFLE
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL); HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
#endif #endif
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL); HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL); HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL); HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);

View file

@ -943,6 +943,14 @@ void V_DrawPatchFill(patch_t *pat)
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
INT32 x, y, pw = SHORT(pat->width) * dupz, ph = SHORT(pat->height) * dupz; INT32 x, y, pw = SHORT(pat->width) * dupz, ph = SHORT(pat->height) * dupz;
#ifdef HWRENDER
if (rendermode == render_opengl)
{
pw = FixedMul(SHORT(pat->width)*FRACUNIT, vid.fdupx)>>FRACBITS;
ph = FixedMul(SHORT(pat->height)*FRACUNIT, vid.fdupy)>>FRACBITS;
}
#endif
for (x = 0; x < vid.width; x += pw) for (x = 0; x < vid.width; x += pw)
{ {
for (y = 0; y < vid.height; y += ph) for (y = 0; y < vid.height; y += ph)

View file

@ -117,7 +117,6 @@ static loadfunc_t hwdFuncTable[] = {
#ifdef SHUFFLE #ifdef SHUFFLE
{"PostImgRedraw@4", &hwdriver.pfnPostImgRedraw}, {"PostImgRedraw@4", &hwdriver.pfnPostImgRedraw},
#endif #endif
{"FlushScreenTextures@0",&hwdriver.pfnFlushScreenTextures},
{"StartScreenWipe@0", &hwdriver.pfnStartScreenWipe}, {"StartScreenWipe@0", &hwdriver.pfnStartScreenWipe},
{"EndScreenWipe@0", &hwdriver.pfnEndScreenWipe}, {"EndScreenWipe@0", &hwdriver.pfnEndScreenWipe},
{"DoScreenWipe@4", &hwdriver.pfnDoScreenWipe}, {"DoScreenWipe@4", &hwdriver.pfnDoScreenWipe},
@ -148,7 +147,6 @@ static loadfunc_t hwdFuncTable[] = {
#ifdef SHUFFLE #ifdef SHUFFLE
{"PostImgRedraw", &hwdriver.pfnPostImgRedraw}, {"PostImgRedraw", &hwdriver.pfnPostImgRedraw},
#endif #endif
{"FlushScreenTextures"},&hwdriver.pfnFlushScreenTextures},
{"StartScreenWipe", &hwdriver.pfnStartScreenWipe}, {"StartScreenWipe", &hwdriver.pfnStartScreenWipe},
{"EndScreenWipe", &hwdriver.pfnEndScreenWipe}, {"EndScreenWipe", &hwdriver.pfnEndScreenWipe},
{"DoScreenWipe", &hwdriver.pfnDoScreenWipe}, {"DoScreenWipe", &hwdriver.pfnDoScreenWipe},