Compare commits

..
Author SHA1 Message Date
alufolie91 c65647450a test: always draw 2nd final screen texture
we didnt do this in some cases to save on performance a bit
2026-04-12 15:32:15 +02:00
alufolie91 4edc102d67 hack: fix intermission background becoming white after resolution change 2026-04-12 15:23:53 +02:00
alufolie91 e0bf663157 Hack: fix intermission screen displaying whitescreen in some cases
does not fix whitescreen when switching resolutions while in intermission screen, but oh well
lets hope there will be no issues with calling D_Renderview in intermission state, but it seems to work from quick testing lul
2026-04-12 15:05:51 +02:00
alufolie91 eccc3eb33f print opengl extensions in new lines for ogllog
otherwise this may still get truncated and lots of text editor also complain about a super long single line of text
also fix null ptr dereferencing into strtok should strdup return null
2026-04-12 14:30:49 +02:00
indev 1217089d81 G_UseContinue is unused, delet it 2026-04-11 21:53:15 +03:00
alufolie91 e5c0967a3f BLUA: simplify lua number hash 2026-04-11 16:49:19 +02:00
indev 27f22e4b5b Use case insensitive string hashing and compare functions for cvar hashtable 2026-04-09 19:09:37 +03:00
alufolie91 c039d14efc remove even more unused stuff 2026-04-08 22:42:34 +02:00
alufolie91 71a0b25e32 remove old and unused menu player description stuff
hope ignorelines is the correct thing to well ignore lines lol
2026-04-08 22:42:31 +02:00
alufolie91 8c2132a98c remove a few more unused things 2026-04-08 21:54:32 +02:00
alufolie91 898bcd336d should be
:chonkbuncle:
2026-04-08 18:53:43 +02:00
alufolie91 5461a6dcbe cleanup skinselect menu stuff slightly 2026-04-08 14:56:44 +02:00
alufolie91 d957bddc1f update opengl dithering shader
now works more like i intended too by more or less scaling the pattern to be roughly the same size on each resolution and trying to reduce precision issues by using floor to convert float values to integer range
2026-04-08 14:39:09 +02:00
alufolie91 7177a9f57f raise version to v9.3 2026-04-07 17:53:11 +02:00
alufolie91 4ccf3dfaf9 software: make R_DrawWallColumn being able to render "holey" textures
not the most efficient but idk a better solution to this, and clipping code may cause some other undesired effects, but well were not supposed to be drawing textures with holes on single sided walls eitherways, but here we are
basically this copies columns into a buffer filled with cyan pixels, so the holes become cyan instead of nothing, which we can cut again using the twomultipatch drawers
fixes the "melt" effect on some things like spelunky or music plant (and well reading/writing oob)
2026-04-05 20:37:24 +02:00
indev 489a58f9fd Allocate all colormaps with PU_STATIC 2026-04-05 18:31:55 +02:00
alufolie91 b26effa241 Merge pull request #223 from Indev450/bluaopti2
Some optimizations and fixes for BLUA from LUA
2026-04-05 18:28:50 +02:00
alufolie91 efd8c20d26 enable lto by default on makefile builds
change flag to NOLTO to disable lto
at this point we shouldnt have any issues anymore since the utter crapton of bugfixes
2026-04-05 18:26:16 +02:00
46 changed files with 485 additions and 929 deletions

No files matched your search

+2 -2
View File
@@ -93,7 +93,7 @@
# NOLDWARNING=1 - ?
# NOSDLMAIN=1 - ?
# SDLMAIN=1 - ?
# USELTO=1 - Enable building with LTO.
# NOLTO=1 - Disable link time optimizations
#
# Library configuration flags:
# Everything here is an override.
@@ -260,7 +260,7 @@ debug_opts=-D_DEBUG
else # build a normal optimized version
debug_opts=-DNDEBUG
opts+=-O3
ifdef USELTO
ifndef NOLTO
# compile with LTO
opts+=-flto=auto
libs+=-flto=auto
+7
View File
@@ -81,6 +81,7 @@ static /*const*/ Node dummynode_ = {
/*
** hash for lua_Numbers
*/
#if 0
static Node *hashnum (const Table *t, lua_Number n) {
unsigned int a[numints];
int i;
@@ -90,6 +91,12 @@ static Node *hashnum (const Table *t, lua_Number n) {
for (i = 1; i < numints; i++) a[0] += a[i];
return hashmod(t, a[0]);
}
#else
// our lua_Number is just typedef´d int32 so no need to do any of the above
static inline Node *hashnum (const Table *t, lua_Number n) {
return hashmod(t, cast(unsigned int, n));
}
#endif
+2 -2
View File
@@ -1168,8 +1168,8 @@ void VS_Print(vsbuf_t *buf, const char *data)
#define NAME cvar_map_t
#define KEY_TY const char *
#define VAL_TY consvar_t *
#define HASH_FN vt_hash_string
#define CMPR_FN vt_cmpr_string
#define HASH_FN FNV1a_HashLowercaseString
#define CMPR_FN vt_cmpr_casestring
#include "verstable.h"
#define NAME netvar_map_t
+2 -2
View File
@@ -4361,7 +4361,7 @@ void D_ClientServerInit(void)
playerinfo[i].node = 255;
gametic = 0;
localgametic = 0;
leveltime = 0;
// do not send anything before the real begin
SV_StopServer();
@@ -6819,7 +6819,7 @@ boolean TryRunTics(tic_t realtics)
{
boolean update_stats = !(paused || P_AutoPause());
DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic));
DEBFILE(va("============ Running tic %d (local %d)\n", gametic, leveltime));
if (update_stats)
PS_START_TIMING(ps_tictime);
+47 -20
View File
@@ -362,6 +362,45 @@ static void D_Renderview(void)
// added comment : there is a wipe eatch change of the gamestate
gamestate_t wipegamestate = GS_LEVEL;
static void D_MakeIntermissionBG(void)
{
if (!lastdraw)
return;
if (rendermode == render_none)
{
lastdraw = false;
return;
}
// no more valid map
// shouldnt happen at this point, but better safe than sorry!
if (!numsectors)
{
lastdraw = false;
return;
}
// need to render level again for this
// should be fine since at this point we did not unload it yet
if (cv_renderview.value)
{
D_Renderview();
}
#ifdef HWRENDER
if (rendermode == render_opengl)
{
HWR_MakeScreenTexture();
}
else
#endif
{
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.width);
}
lastdraw = false;
}
static boolean D_Display(void)
{
boolean ranwipe = false;
@@ -519,6 +558,8 @@ static boolean D_Display(void)
break;
}
D_MakeIntermissionBG();
if (gamestate == GS_LEVEL)
{
// draw the view directly
@@ -529,16 +570,6 @@ static boolean D_Display(void)
PS_STOP_TIMING(ps_rendercalltime);
}
if (lastdraw)
{
if (rendermode == render_soft)
{
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.width);
}
lastdraw = false;
}
PS_START_TIMING(ps_uitime);
ST_Drawer();
HU_Drawer();
@@ -697,16 +728,16 @@ void D_SRB2Loop(void)
for (;;)
{
if (I_Interrupted())
{
I_Quit();
}
// capbudget is the minimum precise_t duration of a single loop iteration
precise_t capbudget;
precise_t elapsed;
precise_t enterprecise, finishprecise;
if (I_Interrupted())
{
I_Quit();
}
enterprecise = I_GetPreciseTime();
memset(&g_dc, 0, sizeof(g_dc));
@@ -1786,10 +1817,6 @@ void D_SRB2Main(void)
// Setup default unlockable conditions
M_SetupDefaultConditionSets();
// Setup character tables
// Have to be done here before files are loaded
M_InitCharacterTables();
// load wad, including the main wad file
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
@@ -2163,8 +2190,8 @@ void D_SRB2Main(void)
if (dedicated && server)
{
levelstarttic = gametic;
G_SetGamestate(GS_LEVEL);
if (!P_SetupLevel(false, false))
I_Quit(); // fail so reset game stuff
}
-1
View File
@@ -27,7 +27,6 @@ extern "C" {
// SINT8 is used for nodes sometimes >:(
#define MAXNETNODES 127
#define BROADCASTADDR MAXNETNODES
#define NETSPLITSCREEN // Kart's splitscreen netgame feature
#define STATLENGTH (TICRATE*2)
-5
View File
@@ -93,11 +93,6 @@ extern consvar_t cv_pause;
extern consvar_t cv_restrictskinchange, cv_allowteamchange, cv_ingamecap, cv_respawntime;
extern consvar_t cv_spectatorreentry, cv_antigrief;
/*extern consvar_t cv_teleporters, cv_superring, cv_supersneakers, cv_invincibility;
extern consvar_t cv_jumpshield, cv_watershield, cv_ringshield, cv_forceshield, cv_bombshield;
extern consvar_t cv_1up, cv_eggmanbox;
extern consvar_t cv_recycler;*/
// SRB2kart items
extern consvar_t cv_sneaker, cv_rocketsneaker, cv_invincibility, cv_banana;
extern consvar_t cv_eggmanmonitor, cv_orbinaut, cv_jawz, cv_mine;
+4
View File
@@ -1424,6 +1424,7 @@ void I_Quit(void)
/* prevent recursive I_Quit() */
if (quiting)
goto death;
quiting = false;
I_ShutdownConsole();
M_SaveConfig(NULL); //save game config, cvars..
@@ -1441,14 +1442,17 @@ void I_Quit(void)
// use this for 1.28 19990220 by Kin
I_ShutdownGraphics();
I_ShutdownSystem();
/* if option -noendtxt is set, don't print the text */
if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM") != LUMPERROR)
{
printf("\r");
ShowEndTxt();
}
if (myargmalloc)
free(myargv); // Deallocate allocated memory
death:
W_Shutdown();
exit(0);
-11
View File
@@ -115,10 +115,6 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h)
return -1;
}
void VID_RefreshModeList(void)
{
}
void VID_PrepareModeList(void)
{
}
@@ -129,13 +125,6 @@ INT32 VID_SetMode(INT32 modeNum)
return true;
}
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height)
{
(void)width;
(void)height;
return false;
}
void I_StartupGraphics(void)
{
}
+66 -180
View File
@@ -43,6 +43,9 @@
#include "m_cond.h"
// idk how PUSHGETTER works, but this is unused
static UINT8 ultimatemode = false;
#define REQUIRE_MATHLIB_GUID "{748fcbc8-6480-4013-ac4e-7afce6cab766}"
// Free slot names
@@ -280,149 +283,6 @@ static void clear_levels(void)
P_AllocMapHeader(gamemap-1);
}
static boolean findFreeSlot(INT32 *num)
{
// Send the character select entry to a free slot.
while (*num < MAXSKINS && PlayerMenu[*num].status != IT_DISABLED)
*num = *num+1;
// No more free slots. :(
if (*num >= MAXSKINS)
return false;
// Found one! ^_^
return true;
}
// Reads a player.
// For modifying the character select screen
static void readPlayer(MYFILE *f, INT32 num)
{
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word;
char *word2;
INT32 i;
boolean slotfound = false;
do
{
if (myfgets(s, MAXLINELEN, f))
{
if (s[0] == '\n')
break;
word = strtok(s, " ");
if (word)
strupr(word);
else
break;
if (fastcmp(word, "PLAYERTEXT"))
{
char *playertext = NULL;
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done;
PlayerMenu[num].status = IT_CALL;
// A friendly neighborhood alias for brevity's sake
const size_t note_size = sizeof(description[num].notes);
for (i = 0; i < (INT32)(MAXLINELEN-note_size-3); i++)
{
if (s[i] == '=')
{
playertext = &s[i+2];
break;
}
}
if (playertext)
{
strlcpy(description[num].notes, playertext, note_size);
strlcat(description[num].notes,
myhashfgets(playertext, note_size, f), note_size);
}
else
strcpy(description[num].notes, "");
// For some reason, cutting the string did not work above. Most likely due to strcpy or strcat...
// It works down here, though.
{
INT32 numline = 0;
for (i = 0; (size_t)i < note_size-1; i++)
{
if (numline < 20 && description[num].notes[i] == '\n')
numline++;
if (numline >= 20 || description[num].notes[i] == '\0' || description[num].notes[i] == '#')
break;
}
}
description[num].notes[strlen(description[num].notes)-1] = '\0';
description[num].notes[i] = '\0';
continue;
}
word2 = strtok(NULL, " = ");
if (word2)
strupr(word2);
else
break;
if (word2[strlen(word2)-1] == '\n')
word2[strlen(word2)-1] = '\0';
i = atoi(word2);
if (fastcmp(word, "PICNAME"))
{
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done;
PlayerMenu[num].status = IT_CALL;
strncpy(description[num].picname, word2, 8);
}
else if (fastcmp(word, "STATUS"))
{
// Limit the status to only IT_DISABLED and IT_CALL
if (i)
i = IT_CALL;
else
i = IT_DISABLED;
/*
You MAY disable previous entries if you so desire...
But try to enable something that's already enabled and you will be sent to a free slot.
Because of this, you are allowed to edit any previous entrys you like, but only if you
signal that you are purposely doing so by disabling and then reenabling the slot.
... Or use MENUPOSITION first, that works too. Hell, you could edit multiple character
slots in a single section that way, due to how SOC editing works.
*/
if (i != IT_DISABLED && !slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done;
PlayerMenu[num].status = (INT16)i;
}
else if (fastcmp(word, "SKINNAME"))
{
// Send to free slot.
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done;
PlayerMenu[num].status = IT_CALL;
strlcpy(description[num].skinname, word2, sizeof description[num].skinname);
strlwr(description[num].skinname);
}
else
deh_warning("readPlayer %d: unknown word '%s'", num, word);
}
} while (!myfeof(f)); // finish when the line is empty
done:
Z_Free(s);
}
static int freeslotusage[2][2] = {{0, 0}, {0, 0}}; // [S_, MT_][max, previous .wad's max]
void DEH_UpdateMaxFreeslots(void)
@@ -2503,26 +2363,12 @@ static void readmaincfg(MYFILE *f)
{
flashingtics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "TAILSFLYTICS"))
{
tailsflytics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "UNDERWATERTICS"))
{
underwatertics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "SPACETIMETICS"))
{
spacetimetics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "EXTRALIFETICS"))
{
// this modifies player->powers[pw_extralife]
// which still has some game behaviour attached to it...
extralifetics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "GAMEOVERTICS"))
{
gameovertics = get_number(word2);
}
else if (fastcmp(word, "INTROTOPLAY"))
{
@@ -2546,10 +2392,7 @@ static void readmaincfg(MYFILE *f)
if (creditscutscene > 128)
creditscutscene = 128;
}
else if (fastcmp(word, "NUMDEMOS"))
{
numDemos = (UINT8)get_number(word2);
}
else if (fastcmp(word, "DEMODELAYTIME"))
{
demoDelayTime = get_number(word2);
@@ -2562,10 +2405,6 @@ static void readmaincfg(MYFILE *f)
{
use1upSound = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
}
else if (fastcmp(word, "MAXXTRALIFE"))
{
continue; // unused
}
else if (fastcmp(word, "GAMEDATA"))
{
// just ignore it but dont throw a warning
@@ -2604,6 +2443,30 @@ static void readmaincfg(MYFILE *f)
{
strlcpy(customversionstring, word2, sizeof (customversionstring));
}
else if (fastcmp(word, "NUMDEMOS"))
{
continue; // unused
}
else if (fastcmp(word, "TAILSFLYTICS"))
{
continue; // unused
}
else if (fastcmp(word, "UNDERWATERTICS"))
{
continue; // unused
}
else if (fastcmp(word, "SPACETIMETICS"))
{
continue; // unused
}
else if (fastcmp(word, "GAMEOVERTICS"))
{
continue; // unused
}
else if (fastcmp(word, "MAXXTRALIFE"))
{
continue; // unused
}
else
deh_warning("Maincfg: unknown word '%s'", word);
}
@@ -2817,6 +2680,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
// it doesn't test the version of SRB2 and version of dehacked file
dbg_line = -1; // start at -1 so the first line is 0.
while (!myfeof(f))
{
char origpos[256];
@@ -2844,11 +2708,15 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
strncpy(origpos, s, size);
origpos[size] = '\0';
if (NULL != (word = strtok(s, " "))) {
if (NULL != (word = strtok(s, " ")))
{
strupr(word);
if (word[strlen(word)-1] == '\n')
word[strlen(word)-1] = '\0';
const size_t wordlen = strlen(word);
if (word[wordlen-1] == '\n')
word[wordlen-1] = '\0';
}
if (word)
{
if (fastcmp(word, "FREESLOT"))
@@ -2869,32 +2737,46 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
// This is not a major mod.
continue;
}
word2 = strtok(NULL, " ");
if (fastcmp(word, "CHARACTER"))
{
if (word2) {
if (word2)
{
strupr(word2);
if (word2[strlen(word2)-1] == '\n')
word2[strlen(word2)-1] = '\0';
const size_t wordlen = strlen(word2);
if (word2[wordlen-1] == '\n')
word2[wordlen-1] = '\0';
i = atoi(word2);
} else
}
else
i = 0;
if (i >= 0 && i < 32)
readPlayer(f, i);
ignorelines(f); // unused
else
{
deh_warning("Character %d out of range (0 - 31)", i);
ignorelines(f);
}
// This is not a major mod.
continue;
}
if (word2)
{
strupr(word2);
if (word2[strlen(word2)-1] == '\n')
word2[strlen(word2)-1] = '\0';
const size_t wordlen = strlen(word2);
if (word2[wordlen-1] == '\n')
word2[wordlen-1] = '\0';
i = atoi(word2);
if (fastcmp(word, "PATCH"))
{
// Read patch from spec file.
@@ -2905,6 +2787,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_mobjtype(word2); // find a thing by name
if (i < NUMMOBJTYPES && i >= 0)
{
if (i < (MT_FIRSTFREESLOT+freeslotusage[1][1]))
@@ -2952,6 +2835,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_state(word2); // find a state by name
if (i < NUMSTATES && i >= 0)
{
if (i < (S_FIRSTFREESLOT+freeslotusage[0][1]))
@@ -2968,6 +2852,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_sfx(word2); // find a sound by name
if (i < NUMSFX && i >= 0)
readsound(f, i, savesfxnames);
else
@@ -2981,6 +2866,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_huditem(word2); // find a huditem by name
if (i >= 0 && i < NUMHUDITEMS)
readhuditem(f, i);
else
@@ -8572,13 +8458,13 @@ FUNCINLINE static ATTRINLINE int lib_getenum(lua_State *L)
const char *word;
boolean mathlib = lua_toboolean(L, UV_MATHLIB);
if (lua_type(L,2) != LUA_TSTRING)
if (lua_type(L, 2) != LUA_TSTRING)
return 0;
word = lua_tostring(L,2);
word = lua_tostring(L, 2);
/* First check actions, as they can be overridden. */
if (!mathlib && fastncmp("A_",word,2))
if (!mathlib && fastncmp("A_", word, 2))
{
char *caps;
// Try to get a Lua action first.
+1 -1
View File
@@ -61,7 +61,7 @@ enum
typedef struct
{
INT16 x, y;
}ATTRPACK mapvertex_t;
} ATTRPACK mapvertex_t;
// A SideDef, defining the visual appearance of a wall,
// by setting textures and offsets.
+2 -2
View File
@@ -130,8 +130,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v9.3 - Testing"
#define VERSIONSTRINGW L"Saturn v9.3 - Testing"
#define VERSIONSTRING "Saturn v9.3"
#define VERSIONSTRINGW L"Saturn v9.3"
#define SATURN_TESTING // comment out for saturn release builds!
-7
View File
@@ -54,7 +54,6 @@ extern INT16 maptol;
extern UINT8 globalweather;
extern INT32 curWeather;
extern INT32 cursaveslot;
extern INT16 lastmapsaved;
extern boolean gamecomplete;
#define PRECIP_NONE 0
@@ -78,7 +77,6 @@ extern boolean imcontinuing; // Temporary flag while continuing
extern UINT8 modeattacking;
// menu demo things
extern UINT8 numDemos;
extern UINT32 demoDelayTime;
extern UINT32 demoIdleTime;
@@ -114,7 +112,6 @@ extern UINT8 paused; // Game paused?
extern UINT8 window_notinfocus; // are we in focus? (backend independant -- handles auto pausing and display of "focus lost" message)
extern boolean nodrawers;
extern boolean noblit;
extern boolean lastdraw;
#ifdef MOTIONBLUR
@@ -402,9 +399,6 @@ extern boolean CheckForReverseGravity;
extern UINT16 invulntics;
extern UINT16 sneakertics;
extern UINT16 flashingtics;
extern UINT16 tailsflytics;
extern UINT16 underwatertics;
extern UINT16 spacetimetics;
extern UINT16 extralifetics;
// SRB2kart
@@ -490,7 +484,6 @@ extern UINT32 timesBeatenWithEmeralds;
// WAD, partly set at startup time.
extern tic_t gametic;
#define localgametic leveltime
// Player spawn spots.
extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative
-8
View File
@@ -1110,14 +1110,6 @@ void F_TitleScreenTicker(boolean run)
return;
}
// Replay intro when done cycling through demos
/*if (curDemo == numDemos) -- uuuh... we have a LOT of maps AND a big devteam... probably not gonna see a repeat unless you're super unlucky :V
{
curDemo = 0;
F_StartIntro();
return;
}*/
mapname = G_BuildMapName(G_RandMap(TOL_RACE, -2, false, 0, false, NULL)+1);
numstaff = 1;
+2 -3
View File
@@ -66,12 +66,10 @@
#include <locale.h>
// menu demo things
UINT8 numDemos = 0; //3; -- i'm FED UP of losing my skincolour to a broken demo. change this back when we make new ones
UINT32 demoDelayTime = 15*TICRATE;
UINT32 demoIdleTime = 3*TICRATE;
boolean nodrawers = false; // for comparative timing purposes
boolean noblit = false; // for comparative timing purposes
static tic_t demostarttime; // for comparative timing purposes
//@TODO put these all in a struct for namespacing purposes?
@@ -3512,10 +3510,11 @@ static INT32 restorecv_vidwait;
void G_TimeDemo(const char *name)
{
nodrawers = M_CheckParm("-nodraw");
noblit = M_CheckParm("-noblit");
restorecv_vidwait = cv_vidwait.value;
if (cv_vidwait.value)
CV_Set(&cv_vidwait, "0");
demo.timing = true;
singletics = true;
framecount = 0;
+1 -23
View File
@@ -61,7 +61,6 @@
gameaction_t gameaction = 0;
gamestate_t gamestate = GS_NULL;
UINT8 ultimatemode = false;
boolean botingame = false;
UINT8 botskin = 0;
@@ -87,7 +86,6 @@ INT16 maptol = 0;
UINT8 globalweather = 0;
INT32 curWeather = PRECIP_NONE;
INT32 cursaveslot = -1; // Auto-save 1p savegame slot
INT16 lastmapsaved = 0; // Last map we auto-saved at
boolean gamecomplete = false;
UINT16 mainwads = 0;
@@ -108,7 +106,6 @@ INT32 consoleplayer = 0; // player taking events and displaying
INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {}; // view being displayed
tic_t gametic = 0;
tic_t levelstarttic = 0; // gametic at level start
UINT32 totalrings = 0; // for intermission
INT16 lastmap = 0; // last level you were at (returning from special stages)
tic_t timeinmap = 0; // Ticker for time spent in level (used for levelcard display)
@@ -186,9 +183,6 @@ boolean CheckForReverseGravity = false;
UINT16 invulntics = 20*TICRATE;
UINT16 sneakertics = 20*TICRATE;
UINT16 flashingtics = 3*TICRATE/2; // SRB2kart
UINT16 tailsflytics = 8*TICRATE;
UINT16 underwatertics = 30*TICRATE;
UINT16 spacetimetics = 11*TICRATE + (TICRATE/2);
UINT16 extralifetics = 4*TICRATE;
// SRB2kart
@@ -206,8 +200,6 @@ const INT32 wipeoutslowtime = 20;
const INT32 wantedreduce = 5*TICRATE;
const INT32 wantedfrequency = 10*TICRATE;
INT32 gameovertics = 15*TICRATE;
UINT8 use1upSound = 0;
UINT8 introtoplay = 0;
@@ -1298,8 +1290,6 @@ static void G_DoLoadLevel(boolean resetplayer)
// Make sure objectplace is OFF when you first start the level!
OP_ResetObjectplace();
levelstarttic = gametic; // for time calculation
if (wipegamestate == GS_LEVEL)
wipegamestate = -1; // force a wipe
@@ -3353,18 +3343,6 @@ static void G_DoStartVote(void)
gameaction = ga_nothing;
}
//
// G_UseContinue
//
void G_UseContinue(void)
{
if (gamestate == GS_LEVEL && !netgame && !multiplayer)
{
gameaction = ga_startcont;
lastdraw = true;
}
}
static void G_DoStartContinue(void)
{
I_Assert(!netgame && !multiplayer);
@@ -3403,7 +3381,7 @@ static void G_DoContinued(void)
token = 0;
// Reset # of lives
pl->lives = (ultimatemode) ? 1 : 3;
pl->lives = 3;
D_MapChange(gamemap, gametype, false, false, 0, false, false);
-5
View File
@@ -39,12 +39,8 @@ extern INT32 player_name_changes[MAXPLAYERS];
extern player_t players[MAXPLAYERS];
extern boolean playeringame[MAXPLAYERS];
// gametic at level start
extern tic_t levelstarttic;
// for modding?
extern INT16 prevmap, nextmap;
extern INT32 gameovertics;
extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard display)
extern INT16 rw_maximums[NUM_WEAPONS];
@@ -252,7 +248,6 @@ UINT8 G_GetGametypeColor(INT16 gt);
void G_ExitLevel(void);
void G_NextLevel(void);
void G_Continue(void);
void G_UseContinue(void);
void G_AfterIntermission(void);
void G_EndGame(void); // moved from y_inter.c/h and renamed
-1
View File
@@ -52,7 +52,6 @@ typedef enum
} gameaction_t;
extern gamestate_t gamestate;
extern UINT8 ultimatemode; // was sk_insane
extern gameaction_t gameaction;
extern boolean botingame;
+53 -48
View File
@@ -254,11 +254,13 @@ static void CV_screentextures_OnChange(void)
{
if (cv_glpaletterendering.value != 0)
CV_SetValue(&cv_glpaletterendering, 0);
#ifdef USE_FBO_OGL
if (cv_glframebuffer.value != 0)
CV_SetValue(&cv_glframebuffer, 0);
#endif
// HACK: set lastdraw so intermission bg can refresh after toggling screentextures
if (gamestate == GS_INTERMISSION)
lastdraw = true;
}
GL_SetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
M_UpdateOGLMenu();
@@ -3862,7 +3864,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
wallVerts[1].y = endbot;
// The x and y only need to be adjusted in the case that it's not a papersprite
if (cv_glspritebillboarding.value && sprmo && !papersprite)
if (cv_glspritebillboarding.value && !papersprite)
{
// Get the x and z of the vertices so billboarding draws correctly
realheight = realbot - realtop;
@@ -5979,7 +5981,7 @@ static void COM_HWR_glinfo(void)
// if the GPU is super new and supports a bajillion extensions - xyzzy
char *copy = strdup((const char*)gl_extensions);
char *ext = strtok(copy, " ");
char *ext;
if (copy == NULL)
{
@@ -5987,6 +5989,8 @@ static void COM_HWR_glinfo(void)
return;
}
ext = strtok(copy, " ");
do
{
CONS_Printf(" - %s\n", ext);
@@ -6091,61 +6095,62 @@ static void HWR_DoPostProcessor(void)
if (cv_glscreentextures.value != 2) // screen textures are needed for the rest of the effects
return;
//UINT8 viewnum = R_GetViewNumber(); // see below
// Not supported in splitscreen - someone want to add support?
if (splitscreen || cv_reducevfx.value)
return;
//UINT8 viewnum = R_GetViewNumber();
//camera_t *thiscam = &camera[viewnum];
const camera_t *thiscam = &camera[0];
// Not supported in splitscreen - someone want to add support?
const boolean screenwave = (!splitscreen && !cv_reducevfx.value && (thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT));
if (!(thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT))
return;
// Capture the screen for intermission and screen waving
if ((lastdraw || screenwave) && gamestate != GS_INTERMISSION)
if (gamestate != GS_INTERMISSION)
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
// Drunken vision! WooOOooo~
if (screenwave)
// 10 by 10 grid. 2 coordinates (xy)
float v[SCREENVERTS][SCREENVERTS][2];
float disStart = (leveltime-1) + FixedToFloat(R_GetTimeFrac(RTF_LEVEL));
UINT8 x, y;
float WAVELENGTH;
float AMPLITUDE;
float FREQUENCY;
// Modifies the wave.
if (thiscam->postimg & POSTIMG_WATER)
{
// 10 by 10 grid. 2 coordinates (xy)
float v[SCREENVERTS][SCREENVERTS][2];
float disStart = (leveltime-1) + FixedToFloat(R_GetTimeFrac(RTF_LEVEL));
UINT8 x, y;
float WAVELENGTH;
float AMPLITUDE;
float FREQUENCY;
// Modifies the wave.
if (thiscam->postimg & POSTIMG_WATER)
{
WAVELENGTH = 5.0f;
AMPLITUDE = 40.0f;
FREQUENCY = 8.0f;
}
else
{
WAVELENGTH = 10.0f;
AMPLITUDE = 60.0f;
FREQUENCY = 4.0f;
}
//static constexpr float scale = ((float)SCREENVERTS - 1.0f) / 9.0f; // well this evals to just 1.0f and what is x / 1? kek
for (x = 0; x < SCREENVERTS; x++)
{
for (y = 0; y < SCREENVERTS; y++)
{
// Change X position based on its Y position.
v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast<float>(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
v[x][y][1] = y-4.5f; // (y / scale)
}
}
GL_PostImgRedraw(v);
// Capture the screen again for screen waving on the intermission
if (gamestate != GS_INTERMISSION)
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
WAVELENGTH = 5.0f;
AMPLITUDE = 40.0f;
FREQUENCY = 8.0f;
}
else
{
WAVELENGTH = 10.0f;
AMPLITUDE = 60.0f;
FREQUENCY = 4.0f;
}
//static constexpr float scale = ((float)SCREENVERTS - 1.0f) / 9.0f; // well this evals to just 1.0f and what is x / 1? kek
for (x = 0; x < SCREENVERTS; x++)
{
for (y = 0; y < SCREENVERTS; y++)
{
// Change X position based on its Y position.
v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast<float>(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
v[x][y][1] = y-4.5f; // (y / scale)
}
}
GL_PostImgRedraw(v);
// Capture the screen again for screen waving on the intermission
if (gamestate != GS_INTERMISSION)
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
// Flipping of the screen isn't done here anymore
}
+5
View File
@@ -151,6 +151,11 @@ FUNCINLINE static ATTRINLINE void HWR_RenderVhsEffect(fixed_t upbary, fixed_t do
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
}
FUNCINLINE static ATTRINLINE void HWR_MakeScreenTexture(void)
{
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
}
FUNCINLINE static ATTRINLINE void HWR_MakeScreenFinalTexture(void)
{
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
+9 -19
View File
@@ -78,33 +78,23 @@
// Include GLSL_FLOOR_FUDGES or GLSL_WALL_FUDGES or define the fudges in shaders that use this macro.
#define GLSL_DOOM_COLORMAP_DITHER \
"float baseValue = max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \
"float endResolutionx = scr_resolution.x;\n" \
"float endResolutiony = scr_resolution.y;\n" \
"if (scr_resolution.x > 1280.0) {\n" \
"endResolutionx = scr_resolution.x * 0.5;\n" \
"}\n" \
"if (scr_resolution.y > 720.0) {\n" \
"endResolutiony = scr_resolution.y * 0.5;\n" \
"}\n" \
"float zFactor = clamp((z - 192.0) / (6144.0 - 192.0), 0.0, 1.0);\n" \
"int scaleFactor = int(mix(1.0, 8.0, zFactor));\n" \
"endResolutionx = endResolutionx * scaleFactor;\n" \
"endResolutiony = endResolutiony * scaleFactor;\n" \
"vec2 normalizedPosition = position * vec2(endResolutionx / scr_resolution.x, endResolutiony / scr_resolution.y);\n" \
"int x = int(mod(normalizedPosition.x, 4.0));\n" \
"int y = int(mod(normalizedPosition.y, 4.0));\n" \
"float patscale = min(scr_resolution.x / 1280.0, scr_resolution.y / 720.0);\n" \
"patscale = max(floor(patscale + 0.5), 1.0);\n" \
"patscale = 1.0 / patscale;\n" \
"ivec2 p = ivec2(mod(floor(position * patscale), 4.0));\n" \
"float depthfactor = clamp((z - 192.0) / (6144.0 - 192.0), 0.0, 1.0);\n" \
"float bayerMatrix[4*4] = float[4*4](\n" \
"0.0, 8.0, 2.0, 10.0,\n" \
"12.0, 4.0, 14.0, 6.0,\n" \
"3.0, 11.0, 1.0, 9.0,\n" \
"15.0, 7.0, 13.0, 5.0\n" \
");\n" \
"float threshold = 16.0;\n" \
"#ifdef SRB2_PALETTE_RENDERING\n" \
"float threshold = (1.0 - pow(zFactor, 2.0)) * (bayerMatrix[y*4 + x] / 11.0);\n" \
"#else\n" \
"float threshold = (1.0 - pow(zFactor, 2.0)) * (bayerMatrix[y*4 + x] / 16.0);\n" \
"threshold = 11.0;\n" \
"#endif\n" \
"return mix(baseValue + threshold - 0.5 / 16.0, baseValue, zFactor);\n"
"threshold = (1.0 - pow(depthfactor, 2.0)) * (bayerMatrix[p.y*4 + p.x] / threshold);\n" \
"return mix(baseValue + threshold - 0.5 / 16.0, baseValue, depthfactor);\n"
#define GLSL_DOOM_COLORMAP_NODITHER \
"return max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \
+3 -13
View File
@@ -1581,7 +1581,6 @@ static void HU_drawMiniChat(void)
y = chaty - charheight*(msglines+1);
#ifdef NETSPLITSCREEN
if (splitscreen)
{
y -= BASEVIDHEIGHT/2;
@@ -1589,7 +1588,6 @@ static void HU_drawMiniChat(void)
y += 16;
}
else
#endif
y -= (cv_kartspeedometer.value ? 16 : 0);
dx = 0;
@@ -1687,18 +1685,15 @@ static void HU_drawChatLog(INT32 offset)
if (chat_scroll > chat_maxscroll)
chat_scroll = chat_maxscroll;
#ifdef NETSPLITSCREEN
if (splitscreen)
{
boxh = max(6, boxh/2);
if (splitscreen > 1)
boxw = max(64, boxw/2);
}
#endif
y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12;
#ifdef NETSPLITSCREEN
if (splitscreen)
{
y -= BASEVIDHEIGHT/2;
@@ -1706,7 +1701,6 @@ static void HU_drawChatLog(INT32 offset)
y += 16;
}
else
#endif
y -= (cv_kartspeedometer.value ? 16 : 0);
@@ -1821,7 +1815,6 @@ static void HU_DrawChat(void)
const char *talk = ntalk;
const char *mute = "Chat has been muted.";
#ifdef NETSPLITSCREEN
if (splitscreen)
{
y -= BASEVIDHEIGHT/2;
@@ -1832,7 +1825,6 @@ static void HU_DrawChat(void)
}
}
else
#endif
y -= (cv_kartspeedometer.value ? 16 : 0);
if (teamtalk)
@@ -1933,7 +1925,7 @@ static void HU_DrawChat(void)
INT32 count = 0;
INT32 p_dispy = chaty - charheight - 1;
size_t longest_name_length = 0;
#ifdef NETSPLITSCREEN
if (splitscreen)
{
p_dispy -= BASEVIDHEIGHT/2;
@@ -1941,13 +1933,13 @@ static void HU_DrawChat(void)
p_dispy += 16;
}
else
#endif
p_dispy -= (cv_kartspeedometer.value ? 16 : 0);
// Find longest player name, for drawing background for /pm list later
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i]) continue;
if (!playeringame[i])
continue;
longest_name_length = max(longest_name_length, strlen(player_names[i]));
}
@@ -2050,7 +2042,6 @@ static void HU_DrawChat(void)
skip = 0;
#ifdef NETSPLITSCREEN
if (splitscreen)
{
suggesty -= BASEVIDHEIGHT/2;
@@ -2058,7 +2049,6 @@ static void HU_DrawChat(void)
suggesty += 16;
}
else
#endif
suggesty -= (cv_kartspeedometer.value ? 16 : 0);
while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL)
-5
View File
@@ -68,12 +68,7 @@ typedef struct
#define HU_MAXMSGLEN 223
#define HU_MSGBUFSIZE 255
#define MAX_CHAT_BUFSIZE 256 // that's enough messages, right? We'll delete the older ones when that gets out of hand.
#define NETSPLITSCREEN // why the hell WOULDN'T we want this?
#ifdef NETSPLITSCREEN
#define OLDCHAT (cv_consolechat.value == 1 || dedicated || vid.width < 640)
#else
#define OLDCHAT (cv_consolechat.value == 1 || dedicated || vid.width < 640)
#endif
#define CHAT_MUTE (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this still allows to open the chat but not to type. That's used for scrolling and whatnot.
#define OLD_MUTE (OLDCHAT && cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this is used to prevent oldchat from opening when muted.
-3
View File
@@ -44,9 +44,6 @@ extern "C" {
struct JoyType_s
{
/*! if true, we MUST Poll() to get new joystick data,
that is: we NEED the DIRECTINPUTDEVICE2 ! (watchout NT compatibility) */
INT32 bJoyNeedPoll;
/*! this joystick is a gamepad, read: digital axes
if FALSE, interpret the joystick event data as JOYAXISRANGE (see above) */
INT32 bGamepadStyle;
-2
View File
@@ -95,7 +95,6 @@ INT32 VID_SetMode(INT32 modenum);
*/
const char *VID_GetModeName(INT32 modenum);
void VID_RefreshModeList(void);
void VID_PrepareModeList(void);
/** \brief can video system do fullscreen
@@ -122,7 +121,6 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale);
UINT32 I_GetRefreshRate(void);
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height);
boolean I_CheckNativeRes(void);
void I_SetBorderlessWindow(void);
+9 -2
View File
@@ -4022,6 +4022,7 @@ static void K_drawBattleFullscreen(void)
{
if (stplyrnum == 0)
V_DrawFadeScreen(0xFF00, 16);
if (stplyr->exiting < 6*TICRATE && !stplyr->spectator)
{
if (stplyr->kartstuff[k_position] == 1)
@@ -4337,7 +4338,7 @@ static void K_drawInput(void)
}
else
{
const boolean analogjoystickmove = cv_usejoystick[stplyrnum].value && !Joystick[stplyrnum].bGamepadStyle;
const boolean analogjoystickmove = cv_usejoystick[stplyrnum].value && !Joystick[stplyrnum].bGamepadStyle;
const boolean gamepadjoystickmove = cv_usejoystick[stplyrnum].value && Joystick[stplyrnum].bGamepadStyle;
const UINT8 ssplayer = stplyrnum+1;
@@ -4354,9 +4355,10 @@ static void K_drawInput(void)
{
hudforward += KART_FULLTURN;
}
if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0))
{
hudforward-= KART_FULLTURN;
hudforward -= KART_FULLTURN;
}
}
@@ -4442,6 +4444,7 @@ static void K_drawChallengerScreen(void)
19,20,19,20,19,20,19,20,19,20, // frame 20-21, 1 tic, 5 alternating: all text vibrates from impact
21,22,23,24 // frame 22-25, 1 tic: CHALLENGER turns gold
};
const UINT8 offset = min(52-1, (3*TICRATE)-mapreset);
V_DrawFadeScreen(0xFF00, 16); // Fade out
@@ -4543,6 +4546,7 @@ static void K_drawDistributionDebugger(void)
kp_orbinaut[4],
kp_jawz[1]
};
INT32 useodds = 0;
INT32 pingame = 0, bestbumper = 0;
INT32 i;
@@ -4559,8 +4563,10 @@ static void K_drawDistributionDebugger(void)
if (!playeringame[i] || players[i].spectator)
continue;
pingame++;
if (players[i].exiting)
dontforcespb = true;
if (players[i].kartstuff[k_bumper] > bestbumper)
bestbumper = players[i].kartstuff[k_bumper];
}
@@ -4714,6 +4720,7 @@ void K_drawKartHUD(void)
{
if (LUA_HudEnabled(hud_battlefullscreen))
K_drawBattleFullscreen();
return;
}
+1 -1
View File
@@ -1297,7 +1297,7 @@ static int lib_hudsetvotebackground(lua_State *L)
if (strlen(prefix) != 4)
{
return luaL_argerror(L, 1, "prefix should 4 characters wide");
return luaL_argerror(L, 1, "prefix should be 4 characters wide");
}
strncpy(VoteScreen.luaPrefix, prefix, 4);
-8
View File
@@ -249,9 +249,6 @@ boolean cht_Responder(event_t *ev)
#define REQUIRE_SINGLEPLAYER if (netgame || multiplayer)\
{ CONS_Printf(M_GetText("This only works in single player.\n")); return; }
#define REQUIRE_NOULTIMATE if (ultimatemode)\
{ CONS_Printf(M_GetText("You're too good to be cheating!\n")); return; }
// command that can be typed at the console!
void Command_CheatNoClip_f(void)
{
@@ -259,7 +256,6 @@ void Command_CheatNoClip_f(void)
REQUIRE_INLEVEL;
REQUIRE_SINGLEPLAYER;
REQUIRE_NOULTIMATE;
plyr = &players[consoleplayer];
plyr->pflags ^= PF_NOCLIP;
@@ -274,7 +270,6 @@ void Command_CheatGod_f(void)
REQUIRE_INLEVEL;
REQUIRE_SINGLEPLAYER;
REQUIRE_NOULTIMATE;
plyr = &players[consoleplayer];
plyr->pflags ^= PF_GODMODE;
@@ -289,7 +284,6 @@ void Command_CheatNoTarget_f(void)
REQUIRE_INLEVEL;
REQUIRE_SINGLEPLAYER;
REQUIRE_NOULTIMATE;
plyr = &players[consoleplayer];
plyr->pflags ^= PF_INVIS;
@@ -593,7 +587,6 @@ void Command_Devmode_f(void)
#ifndef _DEBUG
REQUIRE_SINGLEPLAYER;
#endif
REQUIRE_NOULTIMATE;
if (COM_Argc() > 1)
{
@@ -1048,7 +1041,6 @@ void Command_ObjectPlace_f(void)
{
REQUIRE_INLEVEL;
REQUIRE_SINGLEPLAYER;
REQUIRE_NOULTIMATE;
G_SetGameModified(multiplayer, true);
-9
View File
@@ -29,7 +29,6 @@ void Command_ObjectPlace_f(void);
void Command_Writethings_f(void);
extern consvar_t cv_opflags, cv_mapthingnum, cv_speed;
//extern consvar_t cv_snapto, cv_grid;
extern boolean objectplacing;
extern mobjtype_t op_currentthing;
@@ -48,18 +47,10 @@ void Command_CheatNoClip_f(void);
void Command_CheatGod_f(void);
void Command_CheatNoTarget_f(void);
void Command_Savecheckpoint_f(void);
/*void Command_Getallemeralds_f(void);
void Command_Resetemeralds_f(void);
void Command_Setrings_f(void);
void Command_Setlives_f(void);
void Command_Setcontinues_f(void);*/
void Command_Devmode_f(void);
void Command_Scale_f(void);
void Command_Gravflip_f(void);
void Command_Hurtme_f(void);
/*void Command_JumpToAxis_f(void);
void Command_Charability_f(void);
void Command_Charspeed_f(void);*/
void Command_Teleport_f(void);
void Command_RTeleport_f(void);
void Command_Skynum_f(void);
+84 -165
View File
@@ -149,9 +149,6 @@ M_waiting_mode_t m_waiting_mode = M_NOT_WAITING;
const char *quitmsg[NUM_QUITMESSAGES] = {};
// Stuff for customizing the player select screen Tails 09-22-2003
description_t description[MAXSKINS] = {};
INT32 mapwads[NUMMAPS] = {};
boolean browselocalskins = false;
@@ -308,6 +305,7 @@ static void M_SetupMultiHandler(INT32 choice);
// Options
// Split into multiple parts due to size
static void M_VideoModeMenu(INT32 choice);
static void M_Setup1PControlsMenu(void);
static void M_Setup2PControlsMenu(void);
static void M_Setup3PControlsMenu(void);
@@ -1995,8 +1993,6 @@ void M_Ticker(void)
//
void M_Init(void)
{
UINT8 i;
COM_AddCommand("manual", Command_Manual_f);
CV_RegisterVar(&cv_nextmap);
@@ -2042,15 +2038,6 @@ void M_Init(void)
quitmsg[QUIT3MSG5] = M_GetText("You'll be back to play soon, though...\n...right?\n\n(Press 'Y' to quit)");
quitmsg[QUIT3MSG6] = M_GetText("Aww, is Eggman's Nightclub too\ndifficult for you?\n\n(Press 'Y' to quit)");
// Setup PlayerMenu table
for (i = 0; i < MAXSKINS; i++)
{
PlayerMenu[i].status = (i == 0 ? IT_CALL : IT_DISABLED);
PlayerMenu[i].patch = PlayerMenu[i].text = NULL;
PlayerMenu[i].itemaction = M_ChoosePlayer;
PlayerMenu[i].alphaKey = 0;
}
#ifdef HWRENDER
// Permanently hide some options based on render mode
if (rendermode == render_soft)
@@ -2105,55 +2092,6 @@ void M_Init(void)
M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf);
}
void M_InitCharacterTables(void)
{
UINT8 i;
// Setup PlayerMenu table
for (i = 0; i < MAXSKINS; i++)
{
PlayerMenu[i].status = (i < 4 ? IT_CALL : IT_DISABLED);
PlayerMenu[i].patch = PlayerMenu[i].text = NULL;
PlayerMenu[i].itemaction = M_ChoosePlayer;
PlayerMenu[i].alphaKey = 0;
}
// Setup description table
for (i = 0; i < MAXSKINS; i++)
{
if (i == 0)
{
strcpy(description[i].notes, "\x82Sonic\x80 is the fastest of the three, but also the hardest to control. Beginners beware, but experts will find Sonic very powerful.\n\n\x82""Ability:\x80 Speed Thok\nDouble jump to zoom forward with a huge burst of speed.\n\n\x82Tip:\x80 Simply letting go of forward does not slow down in SRB2. To slow down, hold the opposite direction.");
strcpy(description[i].picname, "");
strcpy(description[i].skinname, "sonic");
}
else if (i == 1)
{
strcpy(description[i].notes, "\x82Tails\x80 is the most mobile of the three, but has the slowest speed. Because of his mobility, he's well-\nsuited to beginners.\n\n\x82""Ability:\x80 Fly\nDouble jump to start flying for a limited time. Repetitively hit the jump button to ascend.\n\n\x82Tip:\x80 To quickly descend while flying, hit the spin button.");
strcpy(description[i].picname, "");
strcpy(description[i].skinname, "tails");
}
else if (i == 2)
{
strcpy(description[i].notes, "\x82Knuckles\x80 is well-\nrounded and can destroy breakable walls simply by touching them, but he can't jump as high as the other two.\n\n\x82""Ability:\x80 Glide & Climb\nDouble jump to glide in the air as long as jump is held. Glide into a wall to climb it.\n\n\x82Tip:\x80 Press spin while climbing to jump off the wall; press jump instead to jump off\nand face away from\nthe wall.");
strcpy(description[i].picname, "");
strcpy(description[i].skinname, "knuckles");
}
else if (i == 3)
{
strcpy(description[i].notes, "\x82Sonic & Tails\x80 team up to take on Dr. Eggman!\nControl Sonic while Tails desperately struggles to keep up.\n\nPlayer 2 can control Tails directly by setting the controls in the options menu.\nTails's directional controls are relative to Player 1's camera.\n\nTails can pick up Sonic while flying and carry him around.");
strcpy(description[i].picname, "CHRS&T");
strcpy(description[i].skinname, "sonic&tails");
}
else
{
strcpy(description[i].notes, "???");
strcpy(description[i].picname, "");
strcpy(description[i].skinname, "");
}
}
}
// ==========================================================================
// SPECIAL MENU OPTION DRAW ROUTINES GO HERE
// ==========================================================================
@@ -7952,25 +7890,24 @@ static void M_DrawSetupMultiPlayerMenu(void)
INT32 tw = 0;
spritedef_t *sprdef;
spriteframe_t *sprframe;
patch_t *statbg = (patch_t *)W_CachePatchName("K_STATBG", PU_PATCH);
patch_t *statlr = (patch_t *)W_CachePatchName("K_STATLR", PU_PATCH);
patch_t *statud = (patch_t *)W_CachePatchName("K_STATUD", PU_PATCH);
patch_t *statdot = (patch_t *)W_CachePatchName("K_SDOT0" , PU_PATCH);
patch_t *patch;
UINT8 frame;
UINT8 speed;
UINT8 weight;
UINT8 i;
UINT8 s, w;
const UINT8 *flashcol = V_GetStringColormap(highlightflags);
INT32 skinnum = 0;
INT32 statx, staty;
UINT32 speenframe;
INT32 sltw, actw, hetw;
UINT8 skintodisplay;
INT32 nameboxaddy = 0;
int statoffset = 0;
int gridyoffset = 0;
const UINT8 *flashcol = V_GetStringColormap(highlightflags);
patch_t *statbg = (patch_t *)W_CachePatchName("K_STATBG", PU_PATCH);
patch_t *statlr = (patch_t *)W_CachePatchName("K_STATLR", PU_PATCH);
patch_t *statud = (patch_t *)W_CachePatchName("K_STATUD", PU_PATCH);
patch_t *statdot = (patch_t *)W_CachePatchName("K_SDOT0" , PU_PATCH);
mx = MP_PlayerSetupDef.x;
my = MP_PlayerSetupDef.y;
@@ -7985,8 +7922,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
switch (cv_skinselectmenu.value)
{
case SKINMENUTYPE_EXTENDED:
nameboxaddy = 6;
break;
case SKINMENUTYPE_GRID:
nameboxaddy = 6;
break;
@@ -8002,39 +7937,23 @@ static void M_DrawSetupMultiPlayerMenu(void)
else
M_DrawTextInput(mx + 40, my + nameboxaddy, &setupm_input, 0);
#define GETSELECTEDSKINNAME (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].realname : skins[setupm_fakeskin].realname)
#define GETSELECTEDSPEED (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartspeed : skins[setupm_fakeskin].kartspeed)
#define GETSELECTEDWEIGHT (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartweight : skins[setupm_fakeskin].kartweight)
// draw skin string
st = V_StringWidth(skins[setupm_fakeskin].realname, 0);
switch (cv_skinselectmenu.value)
{
case SKINMENUTYPE_EXTENDED:
#define GETSELECTEDSKINNAME (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].realname : skins[setupm_fakeskin].realname)
#define GETSELECTEDSPEED (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartspeed : skins[setupm_fakeskin].kartspeed)
#define GETSELECTEDWEIGHT (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartweight : skins[setupm_fakeskin].kartweight)
tw = V_StringWidth("Character", 0);//V_StringWidth(GETSELECTEDSKINNAME, 0);
st = V_StringWidth(GETSELECTEDSKINNAME, 0);
V_DrawString((mx+(tw/2)) - (st/2), my + 37,
((MP_PlayerSetupMenu[2].status & IT_TYPE) == IT_SPACE ? V_TRANSLUCENT : 0) | highlightflags | V_ALLOWLOWERCASE,
GETSELECTEDSKINNAME);
if (statdp == true)
statoffset = 50;
else
statoffset = 113;
V_DrawString(statx - statoffset, staty - 10, V_6WIDTHSPACE, va("\x84%dS \x87%dW", GETSELECTEDSPEED, GETSELECTEDWEIGHT));
#undef GETSELECTEDSKINNAME
#undef GETSELECTEDSPEED
#undef GETSELECTEDWEIGHT
break;
V_DrawString(statx - (statdp ? 50 : 113), staty - 10, V_6WIDTHSPACE, va("\x84%dS \x87%dW", GETSELECTEDSPEED, GETSELECTEDWEIGHT));
/* FALLTHRU */
case SKINMENUTYPE_GRID:
#define GETSELECTEDSKINNAME (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].realname : skins[setupm_fakeskin].realname)
tw = V_StringWidth("Character", 0);//V_StringWidth(GETSELECTEDSKINNAME, 0);
tw = V_StringWidth("Character", 0);
st = V_StringWidth(GETSELECTEDSKINNAME, 0);
V_DrawString((mx+(tw/2)) - (st/2), my + 37,
((MP_PlayerSetupMenu[2].status & IT_TYPE) == IT_SPACE ? V_TRANSLUCENT : 0) | highlightflags | V_ALLOWLOWERCASE,
GETSELECTEDSKINNAME);
#undef GETSELECTEDSKINNAME
break;
case SKINMENUTYPE_2D:
@@ -8112,8 +8031,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
break;
}
#define GRIDSTATOFFSET 0
switch (cv_skinselectmenu.value)
{
case SKINMENUTYPE_EXTENDED:
@@ -8125,9 +8042,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
if (itemOn == 1)
V_DrawSmallString(statx+101, staty-37, V_6WIDTHSPACE|highlightflags, "BS: change");
#define GETSELECTEDSPEED (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartspeed : skins[setupm_fakeskin].kartspeed)
#define GETSELECTEDWEIGHT (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartweight : skins[setupm_fakeskin].kartweight)
if (statdp == true)
{
//Background
@@ -8157,22 +8071,19 @@ static void M_DrawSetupMultiPlayerMenu(void)
}
}
#undef GETSELECTEDSPEED
#undef GETSELECTEDWEIGHT
break;
case SKINMENUTYPE_GRID:
// SRB2Kart: draw the stat backer
// labels
V_DrawSmallString(statx+12+GRIDSTATOFFSET, staty+67, V_6WIDTHSPACE|highlightflags, "Acceleration");
V_DrawSmallString(statx+76+GRIDSTATOFFSET, staty+67, V_6WIDTHSPACE|highlightflags, "Max Speed");
V_DrawSmallString(statx+14+GRIDSTATOFFSET, staty+75, V_6WIDTHSPACE|highlightflags, "Handling");
V_DrawSmallString(statx+21+GRIDSTATOFFSET, staty+108, V_6WIDTHSPACE|highlightflags, "Weight");
V_DrawSmallString(statx+12, staty+67, V_6WIDTHSPACE|highlightflags, "Acceleration");
V_DrawSmallString(statx+76, staty+67, V_6WIDTHSPACE|highlightflags, "Max Speed");
V_DrawSmallString(statx+14, staty+75, V_6WIDTHSPACE|highlightflags, "Handling");
V_DrawSmallString(statx+21, staty+108, V_6WIDTHSPACE|highlightflags, "Weight");
// label arrows
V_DrawFixedPatch(((statx+61+GRIDSTATOFFSET)<<FRACBITS) + (FRACUNIT>>1), (staty+67)<<FRACBITS, FRACUNIT>>1, 0, statlr, flashcol);
V_DrawFixedPatch((statx+40+GRIDSTATOFFSET)<<FRACBITS, (staty+80)<<FRACBITS, FRACUNIT>>1, 0, statud, flashcol);
V_DrawFixedPatch(((statx+61)<<FRACBITS) + (FRACUNIT>>1), (staty+67)<<FRACBITS, FRACUNIT>>1, 0, statlr, flashcol);
V_DrawFixedPatch((statx+40)<<FRACBITS, (staty+80)<<FRACBITS, FRACUNIT>>1, 0, statud, flashcol);
// bg
V_DrawFixedPatch(((statx+48+GRIDSTATOFFSET)<<FRACBITS)+(FRACUNIT>>1), (staty+73)<<FRACBITS, FRACUNIT>>1, 0, statbg, NULL);
V_DrawFixedPatch(((statx+48)<<FRACBITS)+(FRACUNIT>>1), (staty+73)<<FRACBITS, FRACUNIT>>1, 0, statbg, NULL);
for (i = 0; i < numskins; i++) // draw the stat dots
{
@@ -8180,7 +8091,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
{
speed = skins[i].kartspeed;
weight = skins[i].kartweight;
V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, NULL);
V_DrawFixedPatch((((statx+46) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, NULL);
}
}
@@ -8206,9 +8117,9 @@ static void M_DrawSetupMultiPlayerMenu(void)
#define TEXTVERTSHIFT 10
DRAWSLOW(statx - sltw - 2, staty);
DRAWSLOW(statx - sltw - 2, staty - TEXTVERTSHIFT+ (9 * 18) - 11);
DRAWSLOW(statx - sltw - 2, staty - TEXTVERTSHIFT + (9 * 18) - 11);
DRAWFAST(statx + (9 * 18), staty);
DRAWFAST(statx + (9 * 18), staty - TEXTVERTSHIFT+ (9 * 18) - 11);
DRAWFAST(statx + (9 * 18), staty - TEXTVERTSHIFT + (9 * 18) - 11);
DRAWACCEL(statx - actw - 2, staty + TEXTVERTSHIFT);
DRAWACCEL(statx + (9 * 18), staty + TEXTVERTSHIFT);
DRAWHEAVY(statx - hetw - 2, staty + (9 * 18) - 11);
@@ -8245,15 +8156,18 @@ static void M_DrawSetupMultiPlayerMenu(void)
break;
}
#undef GETSELECTEDSKINNAME
#undef GETSELECTEDSPEED
#undef GETSELECTEDWEIGHT
switch (cv_skinselectmenu.value)
{
//Skin grid stuff
case SKINMENUTYPE_EXTENDED:
gridyoffset = 10;
//Skin grid stuff
case SKINMENUTYPE_EXTENDED:
for (s = 0; s < SKINGRIDNEWWIDTH*SKINGRIDNEWHEIGHT; s++)
{
INT32 x = ((s % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH) - 8) + 100 + SKINXSHIFT; //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4;
INT32 y = ((s / SKINGRIDNEWWIDTH) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2)) + gridyoffset); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4;
INT32 y = ((s / SKINGRIDNEWWIDTH) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2)) + 10); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4;
INT32 calcs = s + (setupm_skinypos * SKINGRIDNEWWIDTH);
INT32 skinn;
patch_t *face;
@@ -8279,7 +8193,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
{
patch_t *cursor;
INT32 curx = (((setupm_skinselect % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH/2)) + SKINXSHIFT) + 20;
INT32 cury = (((setupm_skinselect / SKINGRIDNEWWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2))+ gridyoffset);
INT32 cury = (((setupm_skinselect / SKINGRIDNEWWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2))+ 10);
UINT8 cursorframe = (I_GetTime() / 4) % 7;
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
@@ -8339,13 +8253,13 @@ static void M_DrawSetupMultiPlayerMenu(void)
weight = skins[selectedskin].kartweight;
statdot = (patch_t *)W_CachePatchName("K_SDOT1", PU_PATCH);
if (skullAnimCounter < 4) // SRB2Kart: we draw this dot later so that it's not covered if there's multiple skins with the same stats
V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, flashcol);
V_DrawFixedPatch((((statx+46) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, flashcol);
else
V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, NULL);
V_DrawFixedPatch((((statx+46) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, NULL);
statdot = (patch_t *)W_CachePatchName("K_SDOT2", PU_PATCH); // coloured center
if (setupm_fakecolor)
V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, R_GetTranslationColormap(0, setupm_fakecolor, GTC_MENUCACHE));
V_DrawFixedPatch((((statx+46) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, R_GetTranslationColormap(0, setupm_fakecolor, GTC_MENUCACHE));
}
break;
case SKINMENUTYPE_2D:
@@ -8396,7 +8310,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
}
}
break;
#undef GRIDSTATOFFSET
#undef SKINXSHIFT
default:
speed = skins[setupm_fakeskin].kartspeed;
@@ -9747,11 +9660,14 @@ static void M_ResetControls(INT32 choice)
// ===============
//added : 30-01-98:
#define MAXCOLUMNMODES 12 //max modes displayed in one column
#define MAXMODEDESCS (MAXCOLUMNMODES*3)
static modedesc_t modedescs[MAXMODEDESCS];
void M_VideoModeMenu(INT32 choice)
static void M_VideoModeMenu(INT32 choice)
{
INT32 i, nummodes, width, height;
INT32 i, j, vdup, nummodes, width, height;
const char *desc;
(void)choice;
@@ -9765,30 +9681,54 @@ void M_VideoModeMenu(INT32 choice)
nummodes = VID_NumModes();
// DOS does not skip mode 0, because mode 0 is ALWAYS present
for (i = 0; i < nummodes && vidm_nummodes < MAXMODEDESCS; i++)
i = 0;
for (; i < nummodes && vidm_nummodes < MAXMODEDESCS; i++)
{
desc = VID_GetModeName(i);
if (desc)
{
vdup = 0;
if (!desc)
continue;
// when a resolution exists both under VGA and VESA, keep the
// VESA mode, which is always a higher modenum
for (j = 0; j < vidm_nummodes; j++)
{
if (fastcmp(modedescs[j].desc, desc))
{
// mode(0): 320x200 is always standard VGA, not vesa
if (modedescs[j].modenum)
{
modedescs[j].modenum = i;
vdup = 1;
modedescs[vidm_nummodes].modenum = i;
modedescs[vidm_nummodes].desc = desc;
if (i == vid.modenum)
vidm_selected = j;
}
else
vdup = 1;
if (i == vid.modenum)
vidm_selected = vidm_nummodes;
break;
}
}
// Pull out the width and height
sscanf(desc, "%u%*c%u", &width, &height);
if (!vdup)
{
modedescs[vidm_nummodes].modenum = i;
modedescs[vidm_nummodes].desc = desc;
// Show resolutions above desktop res as red.
if (I_CheckAboveDesktopRes(width, height))
modedescs[vidm_nummodes].goodratio = 2;
// Show multiples of 320x200 as green.
else if (SCR_IsAspectCorrect(width, height))
modedescs[vidm_nummodes].goodratio = 1;
if (i == vid.modenum)
vidm_selected = vidm_nummodes;
vidm_nummodes++;
// Pull out the width and height
sscanf(desc, "%u%*c%u", &width, &height);
// Show multiples of 320x200 as green.
if (SCR_IsAspectCorrect(width, height))
modedescs[vidm_nummodes].goodratio = 1;
vidm_nummodes++;
}
}
}
vidm_column_size = (vidm_nummodes+2) / 3;
@@ -10005,11 +9945,7 @@ static void M_DrawVideoMode(void)
V_DrawString(row, col, highlightflags|MENUCAPS, modedescs[i].desc);
// Show multiples of 320x200 as green.
else
{
const UINT8 goodratio = modedescs[i].goodratio;
const INT32 goodflag = ((goodratio == 2) ? warningflags : (goodratio == 1) ? recommendedflags : 0);
V_DrawString(row, col, goodflag|MENUCAPS, modedescs[i].desc);
}
V_DrawString(row, col, ((modedescs[i].goodratio) ? recommendedflags : 0)|MENUCAPS, modedescs[i].desc);
col += 8;
if ((i % vidm_column_size) == (vidm_column_size-1))
@@ -10048,26 +9984,9 @@ static void M_DrawVideoMode(void)
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 138,
recommendedflags|MENUCAPS, "Marked modes are recommended.");
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 146,
warningflags|MENUCAPS, "Marked modes are above Desktop resolution");
if (rendermode == render_opengl)
{
#ifdef USE_FBO_OGL
if (!cv_glframebuffer.value)
#endif
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 154,
warningflags|MENUCAPS, "and will have visual errors in OpenGL mode.");
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 166,
highlightflags|MENUCAPS, "Other modes may have visual errors.");
}
else
{
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 154,
highlightflags|MENUCAPS, "Other modes may have visual errors.");
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 166,
highlightflags|MENUCAPS, "Larger modes may have performance issues.");
}
highlightflags|MENUCAPS, "Other modes may have visual errors.");
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 158,
highlightflags|MENUCAPS, "Larger modes may have performance issues.");
}
// Draw the cursor for the VidMode menu
-27
View File
@@ -50,9 +50,6 @@ void M_Drawer(void);
// Called by D_SRB2Main, loads the config file.
void M_Init(void);
// Called by D_SRB2Main also, sets up the playermenu and description tables.
void M_InitCharacterTables(void);
// Called by intro code to force menu up upon a keypress,
// does nothing if menu is already up.
void M_StartControlPanel(void);
@@ -84,11 +81,6 @@ typedef enum
} menumessagetype_t;
void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtype);
extern boolean DPADUPSCROLL;
extern boolean DPADDOWNSCROLL;
extern boolean DPADLEFTSCROLL;
extern boolean DPADRIGHTSCROLL;
typedef enum
{
M_NOT_WAITING,
@@ -168,8 +160,6 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
#define MAXMENUCCVARS 999
#define MAXTOOLTIPS 255
typedef union
{
struct menu_s *submenu; // IT_SUBMENU
@@ -195,8 +185,6 @@ typedef struct menuitem_s
UINT16 alphaKey;
} menuitem_t;
extern menuitem_t PlayerMenu[MAXSKINS];
typedef struct menu_s
{
const char *menutitlepic;
@@ -223,23 +211,10 @@ extern menu_t *currentMenu;
extern menu_t MainDef;
extern menu_t SP_LoadDef;
#define MAXCOLUMNMODES 12 //max modes displayed in one column
#define MAXMODEDESCS (MAXCOLUMNMODES*3)
extern menu_t OP_VideoModeDef;
void M_VideoModeMenu(INT32 choice);
// Call upon joystick hotplug
void M_SetupJoystickMenu(INT32 choice);
extern menu_t OP_JoystickSetDef;
// Stuff for customizing the player select screen
typedef struct
{
char notes[441];
char picname[8];
char skinname[SKINNAMESIZE*2+2]; // skin&skin\0
} description_t;
// mode descriptions for video mode menu
typedef struct
{
@@ -267,8 +242,6 @@ typedef struct
extern INT32 mapwads[NUMMAPS];
extern description_t description[MAXSKINS];
extern consvar_t cv_replaysearchrate;
extern consvar_t cv_showfocuslost;
extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort;
-6
View File
@@ -495,12 +495,6 @@ static menuitem_t SP_LevelStatsMenu[] =
{IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelStats, '\0'}, // dummy menuitem for the control func
};
// A rare case.
// External files modify this menu, so we can't call it static.
// And I'm too lazy to go through and rename it everywhere. ARRGH!
#define M_ChoosePlayer NULL
menuitem_t PlayerMenu[MAXSKINS];
// -----------------------------------
// Multiplayer and all of its submenus
// -----------------------------------
+11 -52
View File
@@ -1531,10 +1531,7 @@ void A_LobShot(void *thing)
if (!(actor->flags & MF_BOSS))
{
if (ultimatemode)
actor->reactiontime = actor->info->reactiontime*TICRATE;
else
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
}
}
@@ -1570,10 +1567,7 @@ void A_FireShot(void *thing)
if (!(actor->flags & MF_BOSS))
{
if (ultimatemode)
actor->reactiontime = actor->info->reactiontime*TICRATE;
else
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
}
}
@@ -1613,10 +1607,7 @@ void A_SuperFireShot(void *thing)
if (!(actor->flags & MF_BOSS))
{
if (ultimatemode)
actor->reactiontime = actor->info->reactiontime*TICRATE;
else
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
}
}
@@ -2870,12 +2861,6 @@ void A_ExtraLife(void *thing)
if (actor->type == MT_1UPICO && !actor->tracer)
actor->frame -= 2; // No lives icon for this player, use the default.
if (ultimatemode) //I don't THINK so!
{
S_StartSound(player->mo, sfx_lose);
return;
}
// In shooter gametypes, give the player 100 rings instead of an extra life.
if (gametype != GT_COOP && gametype != GT_COMPETITION)
P_GivePlayerRings(player, 100);
@@ -4015,26 +4000,13 @@ void A_JetChase(void *thing)
}
// chase towards player
if (ultimatemode)
P_Thrust(actor, actor->angle, FixedMul(actor->info->speed/2, actor->scale));
else
P_Thrust(actor, actor->angle, FixedMul(actor->info->speed/4, actor->scale));
P_Thrust(actor, actor->angle, FixedMul(actor->info->speed/4, actor->scale));
// must adjust height
if (ultimatemode)
{
if (actor->z < (actor->target->z + actor->target->height + FixedMul((64<<FRACBITS), actor->scale)))
actor->momz += FixedMul(FRACUNIT/2, actor->scale);
else
actor->momz -= FixedMul(FRACUNIT/2, actor->scale);
}
if (actor->z < (actor->target->z + actor->target->height + FixedMul((32<<FRACBITS), actor->scale)))
actor->momz += FixedMul(FRACUNIT/2, actor->scale);
else
{
if (actor->z < (actor->target->z + actor->target->height + FixedMul((32<<FRACBITS), actor->scale)))
actor->momz += FixedMul(FRACUNIT/2, actor->scale);
else
actor->momz -= FixedMul(FRACUNIT/2, actor->scale);
}
actor->momz -= FixedMul(FRACUNIT/2, actor->scale);
}
// Function: A_JetbThink
@@ -4137,10 +4109,7 @@ void A_JetgShoot(void *thing)
A_FaceTarget(actor);
P_SpawnMissile(actor, actor->target, (mobjtype_t)actor->info->raisestate);
if (ultimatemode)
actor->reactiontime = actor->info->reactiontime*TICRATE;
else
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
if (actor->info->attacksound)
S_StartSound(actor, actor->info->attacksound);
@@ -6463,12 +6432,8 @@ void A_BuzzFly(void *thing)
// chase towards player
{
INT32 dist, realspeed;
const fixed_t mf = 5*(FRACUNIT/4);
if (ultimatemode)
realspeed = FixedMul(FixedMul(actor->info->speed,mf), actor->scale);
else
realspeed = FixedMul(actor->info->speed, actor->scale);
realspeed = FixedMul(actor->info->speed, actor->scale);
dist = P_AproxDistance(P_AproxDistance(actor->target->x - actor->x,
actor->target->y - actor->y), actor->target->z - actor->z);
@@ -9256,10 +9221,7 @@ void A_MultiShot(void *thing)
if (!(actor->flags & MF_BOSS))
{
if (ultimatemode)
actor->reactiontime = actor->info->reactiontime*TICRATE;
else
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
}
}
@@ -10868,10 +10830,7 @@ void A_BrakFireShot(void *thing)
if (!(actor->flags & MF_BOSS))
{
if (ultimatemode)
actor->reactiontime = actor->info->reactiontime*TICRATE;
else
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
}
}
-7
View File
@@ -99,9 +99,6 @@ typedef struct camera_s
// Hold up/down to pan the camera vertically
SINT8 dpad_y_held;
// Things used by FS cameras.
fixed_t viewheight;
angle_t startangle;
// Camera demobjerization
// Info for drawing: position.
@@ -121,8 +118,6 @@ typedef struct camera_s
fixed_t radius;
fixed_t height;
fixed_t relativex;
// Momentums, used to update position.
fixed_t momx, momy, momz;
@@ -219,7 +214,6 @@ void P_DoJumpShield(player_t *player);
void P_BlackOw(player_t *player);
void P_ElementalFireTrail(player_t *player);
//void P_DoPityCheck(player_t *player);
void P_PlayerThink(player_t *player);
void P_PlayerAfterThink(player_t *player);
void P_DoPlayerExit(player_t *player);
@@ -280,7 +274,6 @@ void P_RemoveMobj(mobj_t *th);
void P_RemoveSavegameMobj(mobj_t *th);
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
//void P_RunShields(void);
void P_RunOverlays(void);
void P_RunShadows(void);
void P_MobjThinker(mobj_t *mobj);
+1 -10
View File
@@ -11163,16 +11163,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
}
}
if (ultimatemode)
{
if (i == MT_PITYTV || i == MT_GREENTV || i == MT_YELLOWTV || i == MT_BLUETV || i == MT_BLACKTV || i == MT_WHITETV)
return; // No shields in Ultimate mode
if (i == MT_SUPERRINGBOX)
return; // No rings in Ultimate mode (except special stages)
}
if (i == MT_EMMY && (gametype != GT_COOP || ultimatemode || tokenbits == 30 || tokenlist & (1 << tokenbits++)))
if (i == MT_EMMY && (gametype != GT_COOP || tokenbits == 30 || tokenlist & (1 << tokenbits++)))
return; // you already got this token, or there are too many, or the gametype's not right
// Objectplace landing point
-4
View File
@@ -3308,8 +3308,6 @@ FUNCINLINE static ATTRINLINE void P_ArchiveMisc(savebuffer_t *save)
else
WRITEINT16(save->p, gamemap);
lastmapsaved = gamemap;
WRITEUINT16(save->p, (botskin ? (emeralds|(1<<10)) : emeralds)+357);
WRITESTRINGN(save->p, timeattackfolder, sizeof(timeattackfolder));
}
@@ -3333,8 +3331,6 @@ FUNCINLINE static ATTRINLINE void P_UnArchiveSPGame(savebuffer_t *save, INT16 ma
if (!mapheaderinfo[gamemap-1])
P_AllocMapHeader(gamemap-1);
lastmapsaved = gamemap;
tokenlist = 0;
token = 0;
+2 -2
View File
@@ -706,6 +706,7 @@ void P_Ticker(boolean run)
if (indirectitemcooldown > 0)
indirectitemcooldown--;
if (hyubgone > 0)
hyubgone--;
@@ -713,8 +714,7 @@ void P_Ticker(boolean run)
{
K_UpdateSpectateGrief();
}
if (G_BattleGametype())
else if (G_BattleGametype())
{
if (wantedcalcdelay && --wantedcalcdelay <= 0)
K_CalculateBattleWanted();
-2
View File
@@ -3478,8 +3478,6 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
}
}
thiscam->relativex = 0;
thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y);
thiscam->radius = 20*FRACUNIT;
-2
View File
@@ -515,8 +515,6 @@ void R_FlushTranslationColormapCache(void)
// in reality, the few routines that can work for either mode, are
// put here
enum columncontext_e columncontext = COLUMNCONTEXT_DIRECT;
enum ColumnFlushType
{
FLUSH_NONE = 0x0000,
+2 -1
View File
@@ -105,7 +105,6 @@ enum columncontext_e
COLUMNCONTEXT_FLUSH,
};
extern enum columncontext_e columncontext;
void R_SetColumnContext(enum columncontext_e _columncontext);
void R_ResetColumnBuffer(void);
@@ -124,6 +123,8 @@ enum
COLDRAWFUNC_TRANSTRANS,
COLDRAWFUNC_TWOSMULTIPATCH,
COLDRAWFUNC_TWOSMULTIPATCHTRANS,
COLDRAWFUNC_TWOSMULTIPATCH_DIRECT,
COLDRAWFUNC_TWOSMULTIPATCHTRANS_DIRECT,
COLDRAWFUNC_FOG,
COLDRAWFUNC_MAX
+56 -2
View File
@@ -16,6 +16,7 @@
#include "r_sky.h"
#include <algorithm>
#include <vector>
#include "r_portal.h"
#include "r_splats.h"
@@ -1166,6 +1167,37 @@ static inline void R_ExpandPlaneY(visplane_t *pl, INT32 x, INT16 top, INT16 bott
// CALLED: CORE LOOPING ROUTINE.
//
static std::vector<UINT8> holecol(256);
// used for R_DrawWallColumn
// convert "holey" columns into contigous columns
// filled with cyan in place of holes
static UINT8 *R_GetHoleColumn(drawcolumndata_t* dc)
{
column_t *col = (column_t *)(dc->source - 3);
const INT32 texheight = dc->texheight;
holecol.resize(texheight);
// fill in everything with cyan so we can skip it
memset(holecol.data(), TRANSPARENTPIXEL, texheight);
// shamelessly copy pasted from R_GenerateTexture
INT32 topdelta, prevdelta = -1;
while (col->topdelta != 0xff)
{
topdelta = col->topdelta;
if (topdelta <= prevdelta)
topdelta += prevdelta;
prevdelta = topdelta;
memcpy(holecol.data() + topdelta, (UINT8*)col + 4, col->length);
col = (column_t *)((UINT8*)col + col->length + 4);
}
return holecol.data();
}
static void R_DrawWallColumn(drawcolumndata_t* dc, INT32 yl, INT32 yh, fixed_t mid, fixed_t texturecolumn, INT32 texture, boolean remap)
{
const INT32 itexturecolumn = texturecolumn >> FRACBITS;
@@ -1175,13 +1207,35 @@ static void R_DrawWallColumn(drawcolumndata_t* dc, INT32 yl, INT32 yh, fixed_t m
dc->source = R_GetColumn(texture, itexturecolumn);
dc->texheight = textureheight[texture] >> FRACBITS;
dc->sourcelength = dc->texheight;
R_SetColumnFunc(colfunctype);
coldrawfunc_t* colfunccopy = colfunc;
if (textures[texture]->holes)
{
dc->source = R_GetHoleColumn(dc);
if (cv_softcyancut.value)
{
// need to use multipatch drawers to cut cyan pixels
if (R_CheckColumnFunc(COLDRAWFUNC_FUZZY) == true)
{
colfunccopy = colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS_DIRECT];
}
else
{
colfunccopy = colfuncs[COLDRAWFUNC_TWOSMULTIPATCH_DIRECT];
}
}
}
drawcolumndata_t dc_copy = *dc;
if (remap)
{
dc_copy.colormap += COLORMAP_REMAPOFFSET;
}
colfunccopy(const_cast<drawcolumndata_t*>(&dc_copy));
}
@@ -1390,7 +1444,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
// calculate lighting
pindex = FixedMul(rw_scale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE-1;
dc->colormap = walllights[pindex];
@@ -1425,7 +1479,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
pindex = FixedMul(rw_scale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE-1;
if (dc->lightlist[i].extra_colormap)
+2 -2
View File
@@ -1398,8 +1398,8 @@ void S_LoadMusicDefs(UINT16 wadnum)
for (int k = 0; k < 2; k++)
{
const char *lumpname = (k == 1 ? "MUSCINFO" : "MUSICDEF");
lumpnum = W_CheckNumForNamePwad(lumpname, wadnum, 0); //check for MUSCINFO lump on 2nd iteration
const char *lumpname = (k == 1 ? "MUSCINFO" : "MUSICDEF"); //check for MUSCINFO lump on 2nd iteration
lumpnum = W_CheckNumForNamePwad(lumpname, wadnum, 0);
if (lumpnum == INT16_MAX)
continue;
+12 -6
View File
@@ -42,8 +42,8 @@ INT32 setmodeneeded = 0; // video mode change needed if > 0 (the mode number to
static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}};
//added : 03-02-98: default screen mode, as loaded/saved in config
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_frameskip = {"frameskip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -120,6 +120,10 @@ static void SCR_SetDrawFuncs(enum columncontext_e _columncontext)
colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn;
}
// gotta keep a copy of those for R_DrawWallColumn.....
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH_DIRECT] = R_Draw2sMultiPatchColumn;
colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS_DIRECT] = R_Draw2sMultiPatchTranslucentColumn;
colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn;
R_SetColumnFunc(BASEDRAWFUNC);
@@ -154,7 +158,6 @@ void SCR_SetMode(void)
// effectively adding massive overhead due to excessive flushing, so we draw our masked thing directly to screen instead
void R_SetColumnContext(enum columncontext_e _columncontext)
{
columncontext = _columncontext;
SCR_SetDrawFuncs(_columncontext); // set our column drawers
}
@@ -274,6 +277,10 @@ void SCR_Recalc(void)
// vid.recalc lasts only for the next refresh...
con_recalc = true;
am_recalc = true;
// HACK: set lastdraw so intermission bg can refresh after resolution change
if (gamestate == GS_INTERMISSION)
lastdraw = true;
}
// Check for screen cmd-line parms: to force a resolution.
@@ -315,9 +322,8 @@ void SCR_CheckDefaultMode(void)
void SCR_SetDefaultMode(void)
{
// remember the default screen size
CV_StealthSetValue(&cv_scr_width, vid.width);
CV_StealthSetValue(&cv_scr_height, vid.height);
VID_RefreshModeList(); // probably not needed but justin käs
CV_SetValue(&cv_scr_width, vid.width);
CV_SetValue(&cv_scr_height, vid.height);
}
// Change fullscreen on/off according to cv_fullscreen
+84 -254
View File
@@ -84,20 +84,15 @@
#endif
// maximum number of windowed modes (see windowedModes[][])
#define MAXWINMODES (128)
#define MAXWINMODES (22)
static void I_FillScreenResolutionsList(boolean force);
/** \brief
*/
static INT32 numVidModes = -1;
typedef struct
{
char name[10];
INT32 w;
INT32 h;
} video_mode_t;
static video_mode_t windowedModes[MAXWINMODES] = {{"320x200", 320, 200}}; // make sure the default mode exists
static const char *fallback_resolution_name = "Fallback";
static int vid_nummodes = 1;
/** \brief
*/
static char vidModeName[33][32]; // allow 33 different modes
rendermode_t rendermode = render_none;
@@ -144,6 +139,9 @@ static SDL_bool disable_mouse = SDL_FALSE;
#define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN)
#define MOUSEBUTTONS_MAX MOUSEBUTTONS
// first entry in the modelist which is not bigger than MAXVIDWIDTHxMAXVIDHEIGHT
static INT32 firstEntry = 0;
// Total mouse motion X/Y offsets
static INT32 mousemovex = 0, mousemovey = 0;
@@ -164,6 +162,38 @@ static SDL_Texture *texture = NULL;
static SDL_GLContext sdlglcontext = NULL;
#endif
static SDL_bool havefocus = SDL_TRUE;
static const char *fallback_resolution_name = "Fallback";
// windowed video modes from which to choose from.
static INT32 windowedModes[MAXWINMODES][2] =
{
{2560,1440}, // 1.66
{1920,1200}, // 1.60,6.00
{1920,1080}, // 1.66
{1680,1050}, // 1.60,5.25
{1600,1200}, // 1.33
{1600, 900}, // 1.66
{1366, 768}, // 1.66
{1440, 900}, // 1.60,4.50
{1280,1024}, // 1.33?
{1280, 960}, // 1.33,4.00
{1280, 800}, // 1.60,4.00
{1280, 720}, // 1.66
{1152, 864}, // 1.33,3.60
{1024, 768}, // 1.33,3.20
{ 960, 600}, // 1.33,3.20
{ 800, 600}, // 1.33,2.50
{ 735, 415}, // 1.33,2.50
{ 640, 480}, // 1.33,2.00
{ 640, 400}, // 1.60,2.00
{ 500, 300}, // 1.33
{ 320, 240}, // 1.33,1.00
{ 320, 200}, // 1.60,1.00
};
#define CUSTOMMODENUM 9999
static INT32 custom_width = 0;
static INT32 custom_height = 0;
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
static void Impl_SetWindowIcon(void);
@@ -489,20 +519,11 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
return;
}
if (windowmoved)
if (windowmoved && rendermode == render_opengl)
{
I_CheckDesktopRes();
// if we say moved our game window to a different screen
// refetch our resolutions
I_FillScreenResolutionsList(false);
#ifdef HWRENDER
#ifdef USE_FBO_OGL
if (rendermode == render_opengl)
{
I_DownSample();
}
#endif
I_DownSample();
#endif
windowmoved = SDL_FALSE;
}
@@ -519,8 +540,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
if (!firsttimeonmouse)
{
if (cv_usemouse.value)
I_StartupMouse();
if (cv_usemouse.value) I_StartupMouse();
}
}
else if (!mousefocus && !kbfocus)
@@ -1214,9 +1234,9 @@ static void VID_Command_ModeList_f(void)
"Under opengl, fullscreen only supports native desktop resolution.\n"
"Under software, the mode is stretched up to desktop resolution.\n");
for (i = 0; i < vid_nummodes; i++)
for (i = 0; i < MAXWINMODES; i++)
{
CONS_Printf("%2d: %dx%d\n", i, windowedModes[i].w, windowedModes[i].h);
CONS_Printf("%2d: %dx%d\n", i, windowedModes[i][0], windowedModes[i][1]);
}
}
@@ -1255,7 +1275,7 @@ static void I_CheckDesktopRes(void)
return;
}
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0)
if (SDL_GetDesktopDisplayMode(currentDisplayIndex, &curmode) != 0)
{
return;
}
@@ -1270,11 +1290,6 @@ boolean I_CheckNativeRes(void)
return (vid.width == desktopwidth && vid.height == desktopheight);
}
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height)
{
return (width > desktopwidth || height > desktopheight);
}
#ifdef USE_FBO_OGL
void RefreshOGLSDLSurface(void)
@@ -1505,207 +1520,13 @@ void I_SetPalette(RGBA_t *palette)
}
}
// make sure the canonical resolutions are always available
static const struct {
const int w, h;
} canonicals[] = {
{1920, 1200}, // 16:10
{1280, 800}, // 16:10
{ 960, 600}, // 16:10
{ 640, 400}, // 16:10
{ 320, 200}, // Vanilla Doom
};
static const int num_canonicals = sizeof(canonicals)/sizeof(*canonicals);
// [FG] sort resolutions by width first and height second
static int cmp_resolutions(const void *a, const void *b)
{
const video_mode_t *ma = (const video_mode_t *) a;
const video_mode_t *mb = (const video_mode_t *) b;
return (ma->w == mb->w) ? mb->h - ma->h : mb->w - ma->w;
}
static void I_AppendResolution(SDL_DisplayMode *mode, int *list_size)
{
int i;
for (i = 0; i < *list_size; i++)
if (windowedModes[i].w == mode->w
&& windowedModes[i].h == mode->h)
return;
snprintf(windowedModes[*list_size].name,
sizeof(windowedModes[*list_size].name),
"%dx%d", mode->w, mode->h);
windowedModes[*list_size].w = mode->w;
windowedModes[*list_size].h = mode->h;
(*list_size)++;
}
// small helper to check if a video mode is canonical
static boolean IsModeCanonical(int w, int h)
{
for (int i = 0; i < num_canonicals; i++)
{
if (canonicals[i].w == w && canonicals[i].h == h)
return true;
}
return false;
}
// check if our desired resolution already is in the videomode list
static int IsCustomResolutionInList(int list_size)
{
INT32 custom_w = cv_scr_width.value;
INT32 custom_h = cv_scr_height.value;
// startup
if (!custom_w || !custom_h)
return -2;
// invalid resolution
// dont even attempt to add it
if (custom_w < BASEVIDWIDTH || custom_w > MAXVIDWIDTH
|| custom_h < BASEVIDHEIGHT || custom_h > MAXVIDHEIGHT)
return -1;
for (int i = 0; i < list_size; i++)
{
if (windowedModes[i].w == custom_w && windowedModes[i].h == custom_h)
{
return 1;
}
}
return 0;
}
//
// I_FillScreenResolutionsList
// Get all the supported screen resolutions
// and fill the list with them
//
static void I_FillScreenResolutionsList(boolean force)
{
int currentDisplayIndex = -1;
static int oldDisplayIndex = -1;
SDL_DisplayMode mode;
int i = 0, list_size = 0;
int count = 0;
char custom_resolution[10];
currentDisplayIndex = SDL_GetWindowDisplayIndex(window);
// No valid index
if (currentDisplayIndex < 0)
{
return;
}
// didnt change screen, no need to redo the list
if (!force && currentDisplayIndex == oldDisplayIndex)
{
return;
}
oldDisplayIndex = currentDisplayIndex;
// Don't call SDL_ListModes if SDL has not been initialized
count = SDL_GetNumDisplayModes(currentDisplayIndex);
list_size = 0;
// on success, SDL_GetNumDisplayModes() always returns at least 1
if (count > 0)
{
// -2 for the desired resolution and for NULL
count = min(count, MAXWINMODES - 2 - num_canonicals);
for (i = count - 1 + num_canonicals; i >= 0; i--)
{
// make sure the canonical resolutions are always available
if (i > count - 1)
{
mode.w = canonicals[i - count].w;
mode.h = canonicals[i - count].h;
}
else
{
SDL_GetDisplayMode(currentDisplayIndex, i, &mode);
}
I_AppendResolution(&mode, &list_size);
}
windowedModes[list_size].name[0] = '\0';
}
const int customresinlist = IsCustomResolutionInList(list_size);
if (customresinlist == 0)
{
// did not find mode from list, make custom resolution if the values somewhat make sense
if (list_size < MAXWINMODES)
{
snprintf(custom_resolution, sizeof(custom_resolution), "%dx%d", cv_scr_width.value, cv_scr_height.value);
// [FG] if the desired resolution not in the list, append it
snprintf(windowedModes[list_size].name,
sizeof(windowedModes[list_size].name),
"%dx%d", cv_scr_width.value, cv_scr_height.value);
windowedModes[list_size].w = cv_scr_width.value;
windowedModes[list_size].h = cv_scr_height.value;
list_size++;
}
else
CONS_Alert(CONS_ERROR, "Could not set custom resolution!\n");
}
else if (customresinlist == -1)
CONS_Alert(CONS_ERROR, "Could not set custom resolution!\n");
// [FG] sort the list
SDL_qsort(windowedModes, list_size, sizeof(*windowedModes), cmp_resolutions);
// if we have more video modes than we can list
// try to shrink the list, lowest resolutions first
// whilst keeping the canonicals
if (list_size > MAXMODEDESCS)
{
// list is sorted from largest to smallest, so start at the end
for (i = list_size - 1; i >= 0 && list_size > MAXMODEDESCS; i--)
{
if (IsModeCanonical(windowedModes[i].w, windowedModes[i].h))
continue;
// Should we like, instead prioritize checking for non aspect correct resolutions to remove?
// we gotta shift everything
// due to canonicals we cant just shrink the list
for (int k = i; k < list_size - 1; k++)
{
windowedModes[k] = windowedModes[k + 1];
}
list_size--;
}
}
windowedModes[list_size].name[0] = '\0';
vid_nummodes = list_size;
// be sure to update the video menu
if (menuactive &&
currentMenu == &OP_VideoModeDef)
M_VideoModeMenu(0);
}
// return number of fullscreen + X11 modes
INT32 VID_NumModes(void)
{
return vid_nummodes;
if (USE_FULLSCREEN && numVidModes != -1)
return numVidModes - firstEntry;
else
return MAXWINMODES;
}
const char *VID_GetModeName(INT32 modeNum)
@@ -1715,32 +1536,40 @@ const char *VID_GetModeName(INT32 modeNum)
return fallback_resolution_name;
}
if (modeNum > vid_nummodes)
if (modeNum > MAXWINMODES)
return NULL;
return windowedModes[modeNum].name;
sprintf(&vidModeName[modeNum][0], "%dx%d",
windowedModes[modeNum][0],
windowedModes[modeNum][1]);
return &vidModeName[modeNum][0];
}
INT32 VID_GetModeForSize(INT32 w, INT32 h)
{
int i;
for (i = 0; i < vid_nummodes; i++)
for (i = 0; i < MAXWINMODES; i++)
{
if (windowedModes[i].w == w && windowedModes[i].h == h)
if (windowedModes[i][0] == w && windowedModes[i][1] == h)
{
return i;
}
}
return -1;
}
// did not find mode from list, make custom resolution if the values somewhat make sense
// opengl mode does not mind about max resolution defined in screen.h
// if not using opengl, check against the maximum as well
if ((w >= BASEVIDWIDTH && h >= BASEVIDHEIGHT) &&
(rendermode == render_opengl || (w <= MAXVIDWIDTH && h <= MAXVIDHEIGHT)))
{
custom_width = w;
custom_height = h;
return CUSTOMMODENUM;
}
void VID_RefreshModeList(void)
{
// check if we even need to rebuild the list
if (IsCustomResolutionInList(vid_nummodes) == 0)
I_FillScreenResolutionsList(true);
return -1;
}
void VID_PrepareModeList(void)
@@ -1774,10 +1603,17 @@ INT32 VID_SetMode(INT32 modeNum)
{
vid.recalc = true;
if (modeNum >= 0 && modeNum < vid_nummodes)
if (modeNum >= 0 && modeNum < MAXWINMODES)
{
vid.width = windowedModes[modeNum].w;
vid.height = windowedModes[modeNum].h;
vid.width = windowedModes[modeNum][0];
vid.height = windowedModes[modeNum][1];
vid.modenum = modeNum;
}
else if (modeNum == CUSTOMMODENUM && custom_width && custom_height)
{
// at this point these values are assumed to be okay
vid.width = custom_width;
vid.height = custom_height;
vid.modenum = modeNum;
}
else
@@ -1810,6 +1646,7 @@ INT32 VID_SetMode(INT32 modeNum)
return SDL_TRUE;
}
static SDL_bool Impl_CreateContext(void)
{
// Renderer-specific stuff
@@ -1832,9 +1669,6 @@ static SDL_bool Impl_CreateContext(void)
I_Error("Failed to set up GL context: %s\n", SDL_GetError());
}
// be sure to fill the resolution list the moment we have a window
I_FillScreenResolutionsList(false);
return SDL_TRUE;
}
#endif
@@ -1876,9 +1710,6 @@ static SDL_bool Impl_CreateContext(void)
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
// be sure to fill the resolution list the moment we have a window
I_FillScreenResolutionsList(false);
return SDL_TRUE;
}
@@ -2116,6 +1947,8 @@ void I_StartupGraphics(void)
usesdl2soft = M_CheckParm("-softblit");
borderlesswindow = M_CheckParm("-borderless");
VID_Command_ModeList_f();
#ifdef HWRENDER
if (rendermode == render_opengl)
{
@@ -2139,9 +1972,6 @@ void I_StartupGraphics(void)
vid.height = BASEVIDHEIGHT; // BitsPerPixel is the SDL interface's
vid.recalc = true; // Set up the console stufff
// be sure to print AFTER window creation
VID_Command_ModeList_f();
#ifdef HAVE_TTF
I_ShutdownTTF();
#endif
+7 -3
View File
@@ -137,13 +137,13 @@ boolean OglSdlSurface(INT32 w, INT32 h)
GL_DBG_Printf("OpenGL %s\n", gl_version);
GL_DBG_Printf("GPU: %s\n", gl_renderer);
GL_DBG_Printf("Extensions:");
GL_DBG_Printf("Extensions: \n");
{
// Need to do it with strtok for same reason its done like that in gr_glinfo command
char *copy = strdup((const char*)gl_extensions);
char *ext = strtok(copy, " ");
char *ext;
if (copy == NULL)
{
@@ -151,9 +151,11 @@ boolean OglSdlSurface(INT32 w, INT32 h)
}
else
{
ext = strtok(copy, " ");
do
{
GL_DBG_Printf(" %s", ext);
GL_DBG_Printf(" - %s\n", ext);
} while ((ext = strtok(NULL, " ")) != NULL);
free(copy);
@@ -254,10 +256,12 @@ void OglSdlFinishUpdate(SDL_Window *window)
// 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
// well we dont need it on native res it seems
#if 0
#ifdef USE_FBO_OGL
if ((!I_CheckNativeRes() && !usefbo) || WipeInAction)
#else
if (!I_CheckNativeRes() || WipeInAction)
#endif
#endif
HWR_DrawScreenFinalTexture(realwidth, realheight, false);
}
+8 -1
View File
@@ -462,6 +462,8 @@ License (MIT):
#include <stdbool.h>
#include <string.h>
#include "fastcmp.h"
// Two-way concatenation macro.
#define VT_CAT_( a, b ) a##b
#define VT_CAT( a, b ) VT_CAT_( a, b )
@@ -705,7 +707,12 @@ static inline FORCE_INLINE bool vt_cmpr_integer( uint64_t key_1, uint64_t key_2
static inline FORCE_INLINE bool vt_cmpr_string( const char *key_1, const char *key_2 )
{
return strcmp( key_1, key_2 ) == 0;
return fastcmp( key_1, key_2 );
}
static inline FORCE_INLINE bool vt_cmpr_casestring( const char *key_1, const char *key_2 )
{
return fasticmp( key_1, key_2 );
}
// Default allocation and free functions.