Compare commits

..
Author SHA1 Message Date
Alug 0be25bd362 Merge branch 'Saturn-Next' into Saturn 2024-10-20 14:56:56 +02:00
84 changed files with 3422 additions and 3701 deletions

No files matched your search

-4
View File
@@ -134,7 +134,6 @@ set(SRB2_CORE_RENDER_SOURCES
r_sky.c
r_splats.c
r_things.c
r_portal.c
r_bsp.h
r_data.h
@@ -150,7 +149,6 @@ set(SRB2_CORE_RENDER_SOURCES
r_splats.h
r_state.h
r_things.h
r_portal.h
)
set(SRB2_CORE_GAME_SOURCES
@@ -472,7 +470,6 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
@@ -490,7 +487,6 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.h
+3 -4
View File
@@ -293,7 +293,7 @@ ifdef NOHW
else
OPTS+=-DHWRENDER
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_portal.o\
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o
endif
@@ -563,7 +563,6 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/r_splats.o \
$(OBJDIR)/r_patch.o \
$(OBJDIR)/r_things.o \
$(OBJDIR)/r_portal.o \
$(OBJDIR)/screen.o \
$(OBJDIR)/v_video.o \
$(OBJDIR)/s_sound.o \
@@ -739,7 +738,7 @@ ifdef MINGW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h\
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
@@ -748,7 +747,7 @@ else
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
+1 -1
View File
@@ -628,7 +628,7 @@ static void COM_ExecuteString(char *ptext)
// check cvars
// Hurdler: added at Ebola's request ;)
// (don't flood the console in software mode with bad gl_xxx command)
// (don't flood the console in software mode with bad gr_xxx command)
if (!CV_Command() && con_destlines)
CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
}
+30 -41
View File
@@ -1228,7 +1228,7 @@ static inline void CL_DrawConnectionStatus(void)
//Draw bottom box
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
for (i = 0; i < 16; ++i)
V_DrawFill((BASEVIDWIDTH/2-128) + (i * 16), BASEVIDHEIGHT-24, 16, 8, palstart + ((animtime - i) & 15));
@@ -1275,7 +1275,7 @@ static inline void CL_DrawConnectionStatus(void)
cltext = M_GetText("Connecting to server...");
break;
}
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS, cltext);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, cltext);
}
else
{
@@ -1285,7 +1285,7 @@ static inline void CL_DrawConnectionStatus(void)
INT32 checkednum = 0;
INT32 i;
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
//ima just count files here
for (i = 0; i < fileneedednum; i++)
@@ -1293,12 +1293,12 @@ static inline void CL_DrawConnectionStatus(void)
checkednum++;
// Loading progress
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS, "Checking server addons...");
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, "Checking server addons...");
totalfileslength = (INT32)((checkednum/(double)(fileneedednum)) * 256);
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va(" %2u/%2u Files",checkednum,fileneedednum));
}
else if (cl_mode == CL_LOADFILES)
@@ -1307,7 +1307,7 @@ static inline void CL_DrawConnectionStatus(void)
INT32 loadcompletednum = 0;
INT32 i;
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
//ima just count files here
for (i = 0; i < fileneedednum; i++)
@@ -1315,12 +1315,12 @@ static inline void CL_DrawConnectionStatus(void)
loadcompletednum++;
// Loading progress
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS, "Loading server addons...");
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, "Loading server addons...");
totalfileslength = (INT32)((loadcompletednum/(double)(fileneedednum)) * 256);
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va(" %2u/%2u Files",loadcompletednum,fileneedednum));
}
else if (lastfilenum != -1)
@@ -1334,7 +1334,7 @@ static inline void CL_DrawConnectionStatus(void)
// Draw the bottom box.
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-58-8, 32, 1);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-14, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-14, V_YELLOWMAP, "Press ESC to abort");
Net_GetNetStat();
dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256);
@@ -1359,17 +1359,17 @@ static inline void CL_DrawConnectionStatus(void)
strncpy(tempname, filename, sizeof(tempname)-1);
}
#ifdef HAVE_CURL
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-30, MENUCAPS,
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-30, 0,
va(M_GetText("%s downloading"), ((cl_mode == CL_DOWNLOADHTTPFILES) ? "\x82""HTTP" : "\x85""Direct")));
#else
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-30, MENUCAPS,
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-30, 0,
va(M_GetText("%s downloading"),("\x85""Direct")));
#endif
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-22, V_YELLOWMAP|MENUCAPS,
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-22, V_YELLOWMAP,
va(M_GetText("\"%s\""), tempname));
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE|MENUCAPS,
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10));
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE|MENUCAPS,
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
va("%3.1fK/s ", ((double)getbps)/1024));
// Download progress
@@ -1379,20 +1379,20 @@ static inline void CL_DrawConnectionStatus(void)
else
totaldldsize = downloadcompletedsize;
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-14, V_YELLOWMAP|MENUCAPS, "Overall Download Progress");
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-14, V_YELLOWMAP, "Overall Download Progress");
totalfileslength = (INT32)((totaldldsize/(double)totalfilesrequestedsize) * 256);
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
if (totalfilesrequestedsize>>20 >= 10) //display in MB if over 10MB
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va(" %4uM/%4uM",totaldldsize>>20,totalfilesrequestedsize>>20));
else
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va(" %4uK/%4uK",totaldldsize>>10,totalfilesrequestedsize>>10));
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va("%2u/%2u Files ",downloadcompletednum,totalfilesrequestednum));
}
else
@@ -1403,12 +1403,12 @@ static inline void CL_DrawConnectionStatus(void)
//Draw bottom box
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
for (i = 0; i < 16; ++i)
V_DrawFill((BASEVIDWIDTH/2-128) + (i * 16), BASEVIDHEIGHT-24, 16, 8, palstart + ((animtime - i) & 15));
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS,
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP,
M_GetText("Waiting to download files..."));
}
}
@@ -4275,20 +4275,14 @@ void SV_ResetServer(void)
for (i = 0; i < MAXPLAYERS; i++)
{
LUA_InvalidatePlayer(&players[i]);
playeringame[i] = false;
playernode[i] = UINT8_MAX;
sprintf(player_names[i], "Player %d", i + 1);
adminplayers[i] = -1; // Populate the entire adminplayers array with -1.
}
memset(playeringame, false, sizeof playeringame);
memset(playernode, UINT8_MAX, sizeof playernode);
ClearAdminPlayers(); // Populate the entire adminplayers array with -1.
memset(player_name_changes, 0, sizeof player_name_changes);
pingmeasurecount = 1;
memset(realpingtable, 0, sizeof realpingtable);
memset(playerpingtable, 0, sizeof playerpingtable);
mynode = 0;
cl_packetmissed = false;
#ifdef SATURNSYNCH
@@ -4470,7 +4464,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (server && multiplayer && motd[0] != '\0')
COM_BufAddText(va("sayto %d %s\n", newplayernum, motd));
D_AddPostloadFiles();
D_AddAutoloadFiles();
LUAh_PlayerJoin(newplayernum);
@@ -4557,9 +4551,7 @@ static boolean SV_AddWaitingPlayers(void)
buf[0] = (UINT8)node;
buf[1] = newplayernum;
if (playerpernode[node] < 1)
{
nodetoplayer[node] = newplayernum;
}
else if (playerpernode[node] < 2)
{
nodetoplayer2[node] = newplayernum;
@@ -6409,21 +6401,19 @@ boolean TryRunTics(tic_t realtics)
}
#endif
ticking = neededtic > gametic;
if (ticking)
if (neededtic > gametic)
{
if (realtics)
hu_stopped = false;
hu_stopped = false;
}
if (player_joining)
{
if (realtics)
hu_stopped = true;
hu_stopped = true;
return false;
}
ticking = neededtic > gametic;
if (ticking)
{
// run the count * tics
@@ -6454,8 +6444,7 @@ boolean TryRunTics(tic_t realtics)
}
else
{
if (realtics)
hu_stopped = true;
hu_stopped = true;
}
return ticking;
+58 -30
View File
@@ -99,6 +99,7 @@ UINT8 window_notinfocus = false;
// DEMO LOOP
//
//static INT32 demosequence;
static const char *pagename = "MAP1PIC";
static char *startupwadfiles[MAX_WADFILES];
static char *startuppwads[MAX_WADFILES];
@@ -115,6 +116,7 @@ boolean devparm = false; // started game with -devparm
boolean singletics = false; // timedemo
boolean lastdraw = false;
postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
// These variables are only true if
@@ -511,12 +513,15 @@ static boolean D_Display(void)
if (rendermode == render_soft)
{
if (!splitscreen)
R_ApplyViewMorph();
if (!splitscreen)
R_ApplyViewMorph();
for (i = 0; i <= splitscreen; i++)
{
V_DoPostProcessor(i, &players[displayplayers[i]], postimgparam[i]);
if (!postimgtype[i])
continue;
V_DoPostProcessor(i, postimgtype[i], postimgparam[i]);
}
}
@@ -813,7 +818,7 @@ void D_SRB2Loop(void)
{
renderdeltatics = FLOAT_TO_FIXED(deltatics);
if (!(paused || P_AutoPause()) && !hu_stopped)
if (!(paused || P_AutoPause()) && deltatics < 1.0 && !hu_stopped)
{
rendertimefrac = g_time.timefrac;
}
@@ -1067,7 +1072,8 @@ static void D_FindAddonsToAutoload(void)
const char *autoloadpath;
boolean postload;
INT32 i;
INT32 i, len;
boolean hasprefix = false;
char wadsToAutoload[256] = "";
// does it exist tho
@@ -1089,8 +1095,7 @@ static void D_FindAddonsToAutoload(void)
|| (wadsToAutoload[0] == '#'))
continue;
// this marks it so that it loads after loading server addons
else if (fastncmp(wadsToAutoload, "postload ", 9))
{
else if (fastncmp(wadsToAutoload, "postload ", 9)) {
strremove(wadsToAutoload, "postload ");
postload = true;
}
@@ -1102,10 +1107,34 @@ static void D_FindAddonsToAutoload(void)
wadsToAutoload[i] = '\0';
}
if (!postload && W_CheckPostLoadList(wadsToAutoload))
len = strlen(wadsToAutoload);
hasprefix = false;
for (i = 0; i < len; ++i)
{
CONS_Printf("forcing postload for file %s\n", wadsToAutoload);
postload = true;
if (wadsToAutoload[i] == '_')
{
hasprefix = true;
break;
}
}
// Lets just hope no one adds bonuschars in autoload
if (hasprefix)
{
// We searching for c in prefix, which stands for "character" and doesn't work well with
// autoload atm, only fine for postload
for (i = 0; i < len; ++i)
{
if (wadsToAutoload[i] == '_') break; // Prefix end
if (wadsToAutoload[i] == 'c' || wadsToAutoload[i] == 'C')
{
CONS_Alert(CONS_WARNING, "forcing postload for %s as local skin\n", wadsToAutoload);
postload = true;
break; // Found it
}
}
}
// LOAD IT
@@ -1123,30 +1152,30 @@ static void D_FindAddonsToAutoload(void)
fclose(autoloadconfigfile);
}
static void D_AddAutoloadFiles(void)
void D_AddAutoloadFiles(void)
{
if (wasautoloaded)
if (wasautoloaded && postautoloaded)
return;
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfiles);
if (!wasautoloaded && !modeattacking)
{
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfiles);
wasautoloaded = true;
}
wasautoloaded = true;
}
void D_AddPostloadFiles(void)
{
if (postautoloaded || !netgame)
return;
if ((!postautoloaded) && netgame)
{
CONS_Printf("D_AutoloadFile(): Loading postloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfilespost);
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfilespost);
postautoloaded = true;
postautoloaded = true;
}
}
void D_CleanFile(char **filearray)
@@ -1841,8 +1870,6 @@ void D_SRB2Main(void)
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();
D_AddAutoloadFiles();
// Set up splitscreen players before joining!
if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm()))
{
@@ -2044,6 +2071,7 @@ void D_SRB2Main(void)
if (dedicated && server)
{
pagename = "TITLESKY";
levelstarttic = gametic;
G_SetGamestate(GS_LEVEL);
if (!P_SetupLevel(false, false))
+3 -3
View File
@@ -45,12 +45,12 @@ extern boolean statdp; // stat display for extended player setup
extern boolean nametaggfx; // Nametag stuffs
extern boolean driftgaugegfx;
// autoload stuff
void D_AddAutoloadFiles(void);
extern boolean autoloading;
extern boolean autoloaded;
extern boolean postautoloaded;
void D_AddPostloadFiles(void);
extern boolean wasautoloaded;
extern char *autoloadwadfilespost[MAX_WADFILES];
extern char *autoloadwadfiles[MAX_WADFILES];
-8
View File
@@ -2983,14 +2983,6 @@ static void Command_Map_f(void)
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
else
{
if (!mapheaderinfo[newmapnum-1] || mapheaderinfo[newmapnum-1] == NULL)
{
CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum));
Z_Free(realmapname);
Z_Free(mapname);
return;
}
if (!(mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype)))
{
CONS_Alert(CONS_WARNING, M_GetText("Course %s (%s) doesn't support %s mode!\n(Use -force to override)\n"), realmapname, G_BuildMapName(newmapnum),
-2
View File
@@ -413,8 +413,6 @@ typedef struct player_s
// See pflags_t, above.
pflags_t pflags;
UINT16 postimgflags;
// playing animation.
panim_t panim;
+1 -5
View File
@@ -9149,6 +9149,7 @@ int LUA_EnumLib(lua_State *L)
PUSHGETTER(globalweather, u8);
PUSHGETTER(levelskynum, i32);
PUSHGETTER(globallevelskynum, i32);
PUSHGETTER((*mapmusname), str);
PUSHGETTER(mapmusflags, u16);
PUSHGETTER(mapmusposition, u32);
PUSHGETTER(gravity, fxp);
@@ -9165,11 +9166,6 @@ int LUA_EnumLib(lua_State *L)
PUSHGETTER(racecountdown, u32);
PUSHGETTER(exitcountdown, u32);
lua_pushcfunction(L, lua_glib_new_getter);
lua_pushliteral(L, "mapmusname");
lua_glib_push_str_getter(L, mapmusname);
lua_call(L, 2, 0);
lua_pushcfunction(L, lua_glib_new_getter);
lua_pushliteral(L, "mariomode");
lua_pushcfunction(L, lua_enumlib_mariomode_get);
+2 -2
View File
@@ -127,8 +127,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v7.2"
#define VERSIONSTRINGW L"Saturn v7.2"
#define VERSIONSTRING "Saturn v7.1"
#define VERSIONSTRINGW L"Saturn v7.1"
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
// AND appveyor.yml, for the build bots!
+1
View File
@@ -112,6 +112,7 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
extern boolean nodrawers;
extern boolean noblit;
extern boolean lastdraw;
extern postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
extern INT32 viewwindowx, viewwindowy;
+8 -6
View File
@@ -344,12 +344,14 @@ typedef union FColorRGBA RGBA_t;
typedef enum
{
POSTIMG_WATER = 1, // Underwater screen effect.
POSTIMG_MOTION = 1<<1, // Unused motion blur effect.
POSTIMG_FLIP = 1<<2, // Flipcam screen effect.
POSTIMG_HEAT = 1<<3, // Heatwave screen effect.
POSTIMG_MIRROR = 1<<4, // encore screen effect.
} postimgflag_t;
postimg_none,
postimg_water,
postimg_motion,
postimg_flip,
postimg_heat,
postimg_mirror,
postimg_mirrorflip
} postimg_t;
typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num)
#define LUMPERROR UINT32_MAX
+8 -12
View File
@@ -366,8 +366,6 @@ void SendWeaponPref2(void);
void SendWeaponPref3(void);
void SendWeaponPref4(void);
static void G_FixCamera(UINT8 view);
//static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}};
static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
{1, "Left X"}, {2, "Left Y"}, {-1, "Left X-"}, {-2, "Left Y-"},
@@ -1494,13 +1492,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
//Reset away view if a command is given.
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
&& displayplayers[0] != consoleplayer && ssplayer == 1)
{
displayplayers[0] = consoleplayer;
G_FixCamera(1);
// i dont like this lmao
if (cv_director.value)
CV_SetValue(&cv_director, 0);
}
}
@@ -2010,12 +2002,15 @@ static void G_FixCamera(UINT8 view)
// The order of displayplayers can change, which would
// invalidate localangle.
localangle[view - 1] = player->mo->angle; // Players *always* have mobjs, right?
localangle[view - 1] = player->cmd.angleturn;
P_ResetCamera(player, &camera[view - 1]);
// Make sure the viewport doesn't interpolate at all into
// its new position -- just snap instantly into place.
// Why does it need to be done twice?
R_ResetViewInterpolation(view);
R_ResetViewInterpolation(view);
}
@@ -4547,7 +4542,8 @@ INT32 G_FindMap(const char *mapname, char **foundmapnamep,
break;
}
}
else if (apromapnum == 0 || wanttable)
else
if (apromapnum == 0 || wanttable)
{
/* LEVEL 1--match keywords verbatim */
if (( aprop = strcasestr(realmapname, mapname) ))
@@ -4638,8 +4634,8 @@ INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
{
if (mapname[0] == '*') // current map
return gamemap;
else if (mapname[0] == '?' && mapheaderinfo[gamemap-1])
return G_RandMap(G_TOLFlag(gametype), gamemap-1, false, 0, false, NULL)+1;
else if (mapname[0] == '?')
return G_RandMap(G_TOLFlag(gametype), prevmap, false, 0, false, NULL);
else if (mapname[0] == '+' && mapheaderinfo[gamemap-1]) // next map
{
newmapnum = mapheaderinfo[gamemap-1]->nextlevel;
+21 -23
View File
@@ -46,12 +46,12 @@ int unsortedVertexArrayAllocSize = 65536;
// Call HWR_RenderBatches to render all the collected geometry.
void HWR_StartBatching(void)
{
if (currently_batching)
if (currently_batching)
{
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
}
// init arrays if that has not been done yet
// init arrays if that has not been done yet
if (!finalVertexArray)
{
finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
@@ -61,7 +61,7 @@ void HWR_StartBatching(void)
unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
}
currently_batching = true;
currently_batching = true;
}
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
@@ -69,14 +69,14 @@ void HWR_StartBatching(void)
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
void HWR_SetCurrentTexture(GLMipmap_t *texture)
{
if (currently_batching)
{
current_texture = texture;
}
else
{
HWD.pfnSetTexture(texture);
}
if (currently_batching)
{
current_texture = texture;
}
else
{
HWD.pfnSetTexture(texture);
}
}
// If batching is enabled, this function collects the polygon data and the chosen texture
@@ -84,7 +84,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
// render the polygon immediately.
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader_target, boolean horizonSpecial)
{
if (currently_batching)
if (currently_batching)
{
if (!pSurf)
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
@@ -220,7 +220,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
// the rendering backend to draw them.
void HWR_RenderBatches(void)
{
int finalVertexWritePos = 0;// position in finalVertexArray
int finalVertexWritePos = 0;// position in finalVertexArray
int finalIndexWritePos = 0;// position in finalVertexIndexArray
int polygonReadPos = 0;// position in polygonArraySorted
@@ -236,7 +236,7 @@ void HWR_RenderBatches(void)
int i;
if (!currently_batching)
if (!currently_batching)
I_Error("HWR_RenderBatches called without starting batching");
nextSurfaceInfo.LightInfo.fade_end = 0;
@@ -256,7 +256,6 @@ void HWR_RenderBatches(void)
ps_hw_numcalls.value.i = ps_hw_numverts.value.i = 0;
ps_hw_numshaders.value.i = ps_hw_numtextures.value.i
= ps_hw_numpolyflags.value.i = ps_hw_numcolors.value.i = 1;
// init polygonArraySorted
for (i = 0; i < polygonArraySize; i++)
{
@@ -265,12 +264,11 @@ void HWR_RenderBatches(void)
// sort polygons
PS_START_TIMING(ps_hw_batchsorttime);
if (cv_glshaders.value && gl_shadersavailable)
if (cv_grshaders.value && gr_shadersavailable)
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygons);
else
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygonsNoShaders);
PS_STOP_TIMING(ps_hw_batchsorttime);
// sort order
// 1. shader
// 2. texture
@@ -289,14 +287,14 @@ void HWR_RenderBatches(void)
// set state for first batch
if (cv_glshaders.value && gl_shadersavailable)
if (cv_grshaders.value && gr_shadersavailable)
{
HWD.pfnSetShader(currentShader);
}
if (currentPolyFlags & PF_NoTexture)
currentTexture = NULL;
else
else
HWD.pfnSetTexture(currentTexture);
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
@@ -371,7 +369,7 @@ void HWR_RenderBatches(void)
nextSurfaceInfo = nextEntry->surf;
if (nextPolyFlags & PF_NoTexture)
nextTexture = 0;
if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable)
if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable)
{
changeState = true;
changeShader = true;
@@ -386,7 +384,7 @@ void HWR_RenderBatches(void)
changeState = true;
changePolyFlags = true;
}
if (cv_glshaders.value && gl_shadersavailable)
if (cv_grshaders.value && gr_shadersavailable)
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
@@ -459,7 +457,6 @@ void HWR_RenderBatches(void)
ps_hw_numcolors.value.i++;
}
// and that should be it?
}
}
// reset the arrays (set sizes to 0)
@@ -469,4 +466,5 @@ void HWR_RenderBatches(void)
PS_STOP_TIMING(ps_hw_batchdrawtime);
}
#endif // HWRENDER
+8 -8
View File
@@ -46,7 +46,7 @@ typedef struct
// when loading the map, this is set to true if portals are found.
// if no portals are found, the portal scanning phase can be skipped while rendering, saving a bit of time.
boolean gl_maphasportals = false;
boolean gr_maphasportals = false;
// ==========================================================================
// FLOOR & CEILING CONVEX POLYS GENERATION
@@ -371,14 +371,14 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
line_t *line = lseg->linedef;
// portal check
if (!gl_maphasportals && line->special == 40 && lseg->side == 0)
if (!gr_maphasportals && line->special == 40 && lseg->side == 0)
{
// Find the other side!
INT32 line2 = P_FindSpecialLineFromTag(40, line->tag, -1);
if (line == &lines[line2])
line2 = P_FindSpecialLineFromTag(40, line->tag, line2);
if (line2 >= 0) // found it!
gl_maphasportals = 1;
gr_maphasportals = 1;
}
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
@@ -768,7 +768,7 @@ static INT32 SolveTProblem(void)
INT32 i;
size_t l;
if (cv_glsolvetjoin.value == 0)
if (cv_grsolvetjoin.value == 0)
return 0;
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
@@ -905,7 +905,7 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
#endif
// reset the portal flag
gl_maphasportals = 0;
gr_maphasportals = 0;
// find min/max boundaries of map
//CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
@@ -923,9 +923,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
// allocate table for back to front drawing of subsectors
/*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors);
if (!gl_drawsubsectors)
I_Error("couldn't malloc gl_drawsubsectors\n");*/
/*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors);
if (!gr_drawsubsectors)
I_Error("couldn't malloc gr_drawsubsectors\n");*/
// number of the first new subsector that might be added
addsubsector = numsubsectors;
+133 -132
View File
@@ -166,7 +166,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
if (pwidth <= 0 || pheight <= 0)
return;
palette = HWR_GetTexturePalette();
ncols = pwidth;
@@ -216,7 +216,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (texture->width <= 0 || texture->height <= 0)
return;
palette = HWR_GetTexturePalette();
x1 = patch->originx;
@@ -275,15 +275,15 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
}
}
static UINT8 *MakeBlock(GLMipmap_t *glMipmap)
static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
{
UINT8 *block;
INT32 bpp, i;
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
INT32 blocksize = (glMipmap->width * glMipmap->height);
INT32 blocksize = (grMipmap->width * grMipmap->height);
bpp = format2bpp(glMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(glMipmap->data));
bpp = format2bpp(grMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
switch (bpp)
{
@@ -303,7 +303,7 @@ static UINT8 *MakeBlock(GLMipmap_t *glMipmap)
// Create a composite texture from patches, adapt the texture size to a power of 2
// height and width for the hardware texture cache.
//
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noencore)
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noencore)
{
UINT8 *block;
texture_t *texture;
@@ -313,7 +313,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
INT32 i;
boolean skyspecial = false; //poor hack for Legacy large skies..
RGBA_t *palette;
palette = HWR_GetTexturePalette();
@@ -328,30 +328,30 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
)
{
skyspecial = true;
gltex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
grtex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
}
else
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
grtex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
gltex->mipmap.width = (UINT16)texture->width;
gltex->mipmap.height = (UINT16)texture->height;
grtex->mipmap.width = (UINT16)texture->width;
grtex->mipmap.height = (UINT16)texture->height;
if (skyspecial)
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
grtex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
else
gltex->mipmap.format = textureformat;
grtex->mipmap.format = textureformat;
gltex->mipmap.colormap = colormaps;
grtex->mipmap.colormap = colormaps;
#ifdef GLENCORE
if (encoremap && !noencore)
gltex->mipmap.colormap += COLORMAP_REMAPOFFSET;
grtex->mipmap.colormap += COLORMAP_REMAPOFFSET;
#endif
blockwidth = texture->width;
blockheight = texture->height;
blocksize = (blockwidth * blockheight);
block = MakeBlock(&gltex->mipmap);
block = MakeBlock(&grtex->mipmap);
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
{
@@ -375,7 +375,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
{
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
HWR_DrawTexturePatchInCache(&gltex->mipmap,
HWR_DrawTexturePatchInCache(&grtex->mipmap,
blockwidth, blockheight,
texture, patch,
realpatch);
@@ -383,78 +383,78 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
}
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
if (format2bpp(gltex->mipmap.format)==4)
if (format2bpp(grtex->mipmap.format)==4)
{
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
{
if (block[i] != 0)
continue;
gltex->mipmap.flags |= TF_TRANSPARENT;
grtex->mipmap.flags |= TF_TRANSPARENT;
break;
}
}
gltex->scaleX = 1.0f/(texture->width*FRACUNIT);
gltex->scaleY = 1.0f/(texture->height*FRACUNIT);
grtex->scaleX = 1.0f/(texture->width*FRACUNIT);
grtex->scaleY = 1.0f/(texture->height*FRACUNIT);
}
// patch may be NULL if glMipmap has been initialised already and makebitmap is false
void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap)
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
{
// don't do it twice (like a cache)
if (glMipmap->width == 0)
if (grMipmap->width == 0)
{
// save the original patch header so that the GLPatch can be casted
// into a standard patch_t struct and the existing code can get the
// orginal patch dimensions and offsets.
glPatch->width = SHORT(patch->width);
glPatch->height = SHORT(patch->height);
glPatch->leftoffset = SHORT(patch->leftoffset);
glPatch->topoffset = SHORT(patch->topoffset);
grPatch->width = SHORT(patch->width);
grPatch->height = SHORT(patch->height);
grPatch->leftoffset = SHORT(patch->leftoffset);
grPatch->topoffset = SHORT(patch->topoffset);
//glMipmap->width = (UINT16)SHORT(patch->width);
//glMipmap->height = (UINT16)SHORT(patch->height);
glMipmap->width = glMipmap->height = 1;
while (glMipmap->width < glPatch->width) glMipmap->width <<= 1;
while (glMipmap->height < glPatch->height) glMipmap->height <<= 1;
//grMipmap->width = (UINT16)SHORT(patch->width);
//grMipmap->height = (UINT16)SHORT(patch->height);
grMipmap->width = grMipmap->height = 1;
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
// no wrap around, no chroma key
glMipmap->flags = 0;
grMipmap->flags = 0;
// setup the texture info
glMipmap->format = patchformat;
//glPatch->max_s = glPatch->max_t = 1.0f;
glPatch->max_s = (float)glPatch->width / (float)glMipmap->width;
glPatch->max_t = (float)glPatch->height / (float)glMipmap->height;
grMipmap->format = patchformat;
//grPatch->max_s = grPatch->max_t = 1.0f;
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
}
Z_Free(glMipmap->data);
glMipmap->data = NULL;
Z_Free(grMipmap->data);
grMipmap->data = NULL;
if (makebitmap)
{
MakeBlock(glMipmap);
HWR_DrawPatchInCache(glMipmap,
glMipmap->width, glMipmap->height,
glPatch->width, glPatch->height,
MakeBlock(grMipmap);
HWR_DrawPatchInCache(grMipmap,
grMipmap->width, grMipmap->height,
grPatch->width, grPatch->height,
patch);
}
//glPatch->max_s = glPatch->max_t = 1.0f;
//grPatch->max_s = grPatch->max_t = 1.0f;
}
// =================================================
// CACHING HANDLING
// =================================================
static size_t gl_numtextures;
static GLMapTexture_t *gl_textures; // For all textures
static size_t gr_numtextures;
static GLMapTexture_t *gr_textures; // For all textures
void HWR_InitTextureCache(void)
{
gl_numtextures = 0;
gl_textures = NULL;
gr_numtextures = 0;
gr_textures = NULL;
}
// Callback function for HWR_FreeTextureCache.
@@ -526,10 +526,10 @@ void HWR_FreeTextureCache(void)
// now the heap don't have any 'user' pointing to our
// texturecache info, we can free it
if (gl_textures)
free(gl_textures);
gl_textures = NULL;
gl_numtextures = 0;
if (gr_textures)
free(gr_textures);
gr_textures = NULL;
gr_numtextures = 0;
}
void HWR_LoadTextures(size_t pnumtextures)
@@ -537,13 +537,13 @@ void HWR_LoadTextures(size_t pnumtextures)
// we must free it since numtextures changed
HWR_FreeTextureCache();
gl_numtextures = pnumtextures;
gr_numtextures = pnumtextures;
#ifdef GLENCORE
gl_textures = calloc(pnumtextures, sizeof (*gl_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
gr_textures = calloc(pnumtextures, sizeof (*gr_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
#else
gl_textures = calloc(pnumtextures, sizeof (*gl_textures));
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
#endif
if (gl_textures == NULL)
if (gr_textures == NULL)
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
}
@@ -552,9 +552,9 @@ void HWR_LoadTextures(size_t pnumtextures)
// --------------------------------------------------------------------------
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
{
GLMapTexture_t *gltex;
GLMapTexture_t *grtex;
if (tex < 0 || tex >= (signed)gl_numtextures)
if (tex < 0 || tex >= (signed)gr_numtextures)
{
#ifdef PARANOIA
I_Error("HWR_GetTexture: Invalid texture ID %d", tex);
@@ -563,25 +563,25 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
#endif
}
#ifdef GLENCORE
gltex = &gl_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
grtex = &gr_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
#else
gltex = &gl_textures[tex];
grtex = &gr_textures[tex];
#endif
if (!gltex->mipmap.data && !gltex->mipmap.downloaded)
HWR_GenerateTexture(tex, gltex, noencore);
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
HWR_GenerateTexture(tex, grtex, noencore);
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!gltex->mipmap.downloaded)
HWD.pfnSetTexture(&gltex->mipmap);
HWR_SetCurrentTexture(&gltex->mipmap);
if (!grtex->mipmap.downloaded)
HWD.pfnSetTexture(&grtex->mipmap);
HWR_SetCurrentTexture(&grtex->mipmap);
// The system-memory data can be purged now.
Z_ChangeTag(gltex->mipmap.data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
return gltex;
return grtex;
}
static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
{
#ifdef GLENCORE
UINT8 *flat;
@@ -590,8 +590,8 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
size_t size, pflatsize;
// setup the texture info
glMipmap->format = GL_TEXFMT_P_8;
glMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
size = W_LumpLength(flatlumpnum);
@@ -619,21 +619,21 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
pflatsize = 64;
break;
}
glMipmap->width = (UINT16)pflatsize;
glMipmap->height = (UINT16)pflatsize;
grMipmap->width = (UINT16)pflatsize;
grMipmap->height = (UINT16)pflatsize;
// the flat raw data needn't be converted with palettized textures
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
PU_HWRCACHE, &glMipmap->data));
PU_HWRCACHE, &grMipmap->data));
#ifdef GLENCORE
flat = glMipmap->data;
flat = grMipmap->data;
for (steppy = 0; steppy < size; steppy++)
{
if (flat[steppy] == HWR_PATCHES_CHROMAKEY_COLORINDEX)
continue;
flat[steppy] = glMipmap->colormap[flat[steppy]];
flat[steppy] = grMipmap->colormap[flat[steppy]];
}
#endif
}
@@ -641,44 +641,44 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
// Download a Doom 'flat' to the hardware cache and make it ready for use
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
{
GLMipmap_t *glmip;
GLMipmap_t *grmip;
if (flatlumpnum == LUMPERROR)
return;
glmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
glmip->colormap = colormaps;
grmip->colormap = colormaps;
#ifdef GLENCORE
if (!noencoremap && encoremap)
glmip->colormap += COLORMAP_REMAPOFFSET;
grmip->colormap += COLORMAP_REMAPOFFSET;
#endif
if (!glmip->downloaded && !glmip->data)
HWR_CacheFlat(glmip, flatlumpnum);
if (!grmip->downloaded && !grmip->data)
HWR_CacheFlat(grmip, flatlumpnum);
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!glmip->downloaded)
HWD.pfnSetTexture(glmip);
HWR_SetCurrentTexture(glmip);
if (!grmip->downloaded)
HWD.pfnSetTexture(grmip);
HWR_SetCurrentTexture(grmip);
// The system-memory data can be purged now.
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
}
//
// HWR_LoadMappedPatch(): replace the skin color of the sprite in cache
// : load it first in doom cache if not already
//
static void HWR_LoadMappedPatch(GLMipmap_t *glmip, GLPatch_t *gpatch)
static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
{
if (!glmip->downloaded && !glmip->data)
if (!grmip->downloaded && !grmip->data)
{
patch_t *patch = gpatch->rawpatch;
if (!patch)
patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
HWR_MakePatch(patch, gpatch, glmip, true);
HWR_MakePatch(patch, gpatch, grmip, true);
// You can't free rawpatch for some reason?
// (Obviously I can't, sprite rotation needs that...)
@@ -688,12 +688,12 @@ static void HWR_LoadMappedPatch(GLMipmap_t *glmip, GLPatch_t *gpatch)
}
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!glmip->downloaded)
HWD.pfnSetTexture(glmip);
HWR_SetCurrentTexture(glmip);
if (!grmip->downloaded)
HWD.pfnSetTexture(grmip);
HWR_SetCurrentTexture(grmip);
// The system-memory data can be purged now.
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
@@ -732,7 +732,7 @@ void HWR_GetPatch(GLPatch_t *gpatch)
// -------------------+
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
{
GLMipmap_t *glmip, *newmip;
GLMipmap_t *grmip, *newmip;
// Blatant hack for encore colormapping aside...
if (colormap == colormaps || colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
@@ -744,14 +744,14 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
// search for the mimmap
// skip the first (no colormap translated)
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
{
glmip = glmip->nextcolormap;
grmip = grmip->nextcolormap;
if (glmip->colormap != colormap)
if (grmip->colormap != colormap)
continue;
HWR_LoadMappedPatch(glmip, gpatch);
HWR_LoadMappedPatch(grmip, gpatch);
return;
}
// not found, create it!
@@ -764,7 +764,7 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
glmip->nextcolormap = newmip;
grmip->nextcolormap = newmip;
newmip->colormap = colormap;
HWR_LoadMappedPatch(newmip, gpatch);
@@ -781,18 +781,18 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
{
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
GLPatch_t *glpatch;
GLPatch_t *grpatch;
if (!(glpatch = M_AATreeGet(hwrcache, lumpnum)))
if (!(grpatch = M_AATreeGet(hwrcache, lumpnum)))
{
glpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
glpatch->wadnum = wadnum;
glpatch->lumpnum = lumpnum;
glpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, lumpnum, glpatch);
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
grpatch->wadnum = wadnum;
grpatch->lumpnum = lumpnum;
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, lumpnum, grpatch);
}
return glpatch;
return grpatch;
}
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
@@ -840,14 +840,14 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
Z_Free(flat);
}
static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
{
size_t size;
UINT16 fmheight = 0, fmwidth = 0;
// setup the texture info
glMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
glMipmap->flags = 0;
grMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
grMipmap->flags = 0;
size = W_LumpLength(fademasklumpnum);
@@ -876,28 +876,28 @@ static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
}
// Thankfully, this will still work for this scenario
glMipmap->width = fmwidth;
glMipmap->height = fmheight;
grMipmap->width = fmwidth;
grMipmap->height = fmheight;
MakeBlock(glMipmap);
MakeBlock(grMipmap);
HWR_DrawFadeMaskInCache(glMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
HWR_DrawFadeMaskInCache(grMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
// I DO need to convert this because it isn't power of 2 and we need the alpha
}
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
{
GLMipmap_t *glmip;
GLMipmap_t *grmip;
glmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
if (!glmip->downloaded && !glmip->data)
HWR_CacheFadeMask(glmip, fademasklumpnum);
if (!grmip->downloaded && !grmip->data)
HWR_CacheFadeMask(grmip, fademasklumpnum);
HWD.pfnSetTexture(glmip);
HWD.pfnSetTexture(grmip);
// The system-memory data can be purged now.
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
}
// =================================================
@@ -909,15 +909,15 @@ void HWR_SetPalette(RGBA_t *palette)
if (HWR_ShouldUsePaletteRendering())
{
// set the palette for palette postprocessing
if (cv_glpalettedepth.value == 16)
if (cv_grpalettedepth.value == 16)
{
// crush to 16-bit rgb565, like software currently does in the standard configuration
// Note: Software's screenshots have the 24-bit palette, but the screen gets
// the 16-bit version! For making comparison screenshots either use an external screenshot
// tool or set the palette depth to 24 bits.
RGBA_t crushed_palette[256];
for (int i = 0; i < 256; i++)
int i;
for (i = 0; i < 256; i++)
{
float fred = (float)(palette[i].s.red >> 3);
float fgreen = (float)(palette[i].s.green >> 2);
@@ -935,7 +935,7 @@ void HWR_SetPalette(RGBA_t *palette)
}
// this part is responsible for keeping track of the palette OUTSIDE of a level.
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
HWR_SetMapPalette();
}
else
@@ -987,9 +987,11 @@ void HWR_SetMapPalette(void)
RGBA_t *palette;
int i;
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
{
// outside of a level, pLocalPalette should have PLAYPAL ready for us
// outside of a level, pMasterPalette should have PLAYPAL ready for us
//palette = pMasterPalette; // we dont have this in kart so just use pLocalPalette as before
palette = pLocalPalette;
}
else
@@ -999,10 +1001,8 @@ void HWR_SetMapPalette(void)
lumpnum_t lumpnum = W_GetNumForName(GetPalette());
size_t palsize = W_LumpLength(lumpnum);
UINT8 *RGB_data;
if (palsize < 768) // 256 * 3
I_Error("HWR_SetMapPalette: A programmer assumed palette lumps are at least 768 bytes long, but apparently this was a wrong assumption!\n");
RGB_data = W_CacheLumpNum(lumpnum, PU_CACHE);
// we got the RGB palette now, but we need it in RGBA format.
for (i = 0; i < 256; i++)
@@ -1050,6 +1050,7 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
return id;
}
// get hwr lighttable id for colormap, create it if it doesn't already exist
UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
{
+2 -2
View File
@@ -337,7 +337,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f;
if (floatangle >= 180.0)
return 0xffffffff;
a1 = (angle_t)xs_CRoundToInt(ANG1 * floatangle);
a1 = (angle_t)(ANG1 * (int)floatangle);
return a1;
}
@@ -458,4 +458,4 @@ boolean gld_SphereInFrustum(float x, float y, float z, float radius)
}
return true;
}
#endif
#endif
+6 -1
View File
@@ -121,6 +121,8 @@ typedef struct
poly_t *planepoly; // the generated convex polygon
} extrasubsector_t;
//here lies gr_vissprite
// Kart features
#define USE_FTRANSFORM_ANGLEZ
#define USE_FTRANSFORM_MIRROR
@@ -171,9 +173,9 @@ enum
{
SHADER_NONE = -1,
SHADER_FLOOR = 0,
SHADER_SHADOW,
SHADER_WALL,
SHADER_SPRITE,
SHADER_SPRITECLIPHACK,
SHADER_MODEL,
SHADER_WATER,
SHADER_FOG,
@@ -287,6 +289,9 @@ typedef struct FSurfaceInfo FSurfaceInfo;
enum hwdsetspecialstate
{
#ifdef USE_FBO_OGL
HWD_SET_FRAMEBUFFER,
#endif
HWD_SET_SHADERS,
HWD_SET_TEXTUREFILTERMODE,
+10 -10
View File
@@ -569,7 +569,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
if (color & 0xFF00) // Do COLORMAP fade.
{
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
if (HWR_ShouldUsePaletteRendering() && cv_grscreentextures.value)
{
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
@@ -593,12 +593,12 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
{
RGBA_t *palette = HWR_GetTexturePalette();
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
if (HWR_ShouldUsePaletteRendering())
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
else
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
poly_flags |= PF_Translucent;
}
@@ -652,17 +652,17 @@ void HWR_DrawViewBorder(INT32 clearlines)
INT32 basewindowx, basewindowy;
GLPatch_t *patch;
// if (gl_viewwidth == vid.width)
// if (gr_viewwidth == vid.width)
// return;
if (!clearlines)
clearlines = BASEVIDHEIGHT; // refresh all
// calc view size based on original game resolution
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdupx));
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowx), vid.fdupx));
// top
HWR_DrawFlatFill(0, 0,
@@ -776,9 +776,9 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
F2DCoord v1, v2;
RGBA_t color_rgba;
RGBA_t *palette = HWR_GetTexturePalette();
color_rgba = palette[color&0xFF];
v1.x = ((float)fl->a.x-(vid.width/2.0f))*(2.0f/vid.width);
v1.y = ((float)fl->a.y-(vid.height/2.0f))*(2.0f/vid.height);
+12 -3
View File
@@ -23,7 +23,7 @@
// needed for sprite rendering
// equivalent of the software renderer's vissprites
typedef struct gl_vissprite_s
typedef struct gr_vissprite_s
{
float x1, x2;
float z1, z2;
@@ -32,6 +32,7 @@ typedef struct gl_vissprite_s
float scale;
float spritexscale, spriteyscale;
float spritexoffset, spriteyoffset;
UINT32 renderflags;
GLPatch_t *gpatch;
boolean flip;
UINT8 translucency; //alpha level 0-255
@@ -41,7 +42,7 @@ typedef struct gl_vissprite_s
//Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} gl_vissprite_t;
} gr_vissprite_t;
// --------
// hw_bsp.c
@@ -63,7 +64,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap);
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore);
void HWR_GetPatch(GLPatch_t *gpatch);
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
void HWR_MakePatch(patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap);
void HWR_MakePatch(patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
void HWR_SetPalette(RGBA_t *palette);
@@ -81,6 +82,14 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
extern INT32 patchformat;
extern INT32 textureformat;
// --------
// hw_main.c // originally hw_drawnodes.c from HWPortal branch
// --------
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight,
INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
// --------
// hw_shaders.c
// --------
+1382 -1028
View File
File diff suppressed because it is too large. Load diff
+60 -63
View File
@@ -23,7 +23,6 @@
#include "hw_glob.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_portal.h"
#include "../am_map.h"
#include "../d_player.h"
@@ -36,32 +35,15 @@
void HWR_Startup(void);
void HWR_Shutdown(void);
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowx, gl_baseviewwindowy;
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy;
extern float gl_basewindowcenterx, gl_basewindowcentery;
extern float gr_basewindowcenterx, gr_basewindowcentery;
extern unsigned msaa;
extern boolean a2c;
extern FTransform atransform;
extern float gl_viewsin, gl_viewcos;
extern boolean gl_drawing_stencil;
extern seg_t *gl_curline;
extern side_t *gl_sidedef;
extern line_t *gl_linedef;
extern sector_t *gl_frontsector;
extern sector_t *gl_backsector;
enum
{
HWR_STENCIL_NORMAL,
HWR_STENCIL_BEGIN,
HWR_STENCIL_REVERSE,
HWR_STENCIL_DEPTH,
HWR_STENCIL_SKY
};
extern float gr_viewsin, gr_viewcos;
// Performance stats
extern ps_metric_t ps_hw_nodesorttime;
@@ -80,7 +62,7 @@ extern ps_metric_t ps_hw_numcolors;
extern ps_metric_t ps_hw_batchsorttime;
extern ps_metric_t ps_hw_batchdrawtime;
extern boolean gl_shadersavailable;
extern boolean gr_shadersavailable;
// hw_draw.c
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
@@ -99,25 +81,24 @@ UINT8 *HWR_GetScreenshot(void);
boolean HWR_Screenshot(const char *lbmname);
// hw_main.c
void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox);
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
void HWR_SetViewSize(void);
void HWR_AddCommands(void);
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
void HWR_SetTransform(float fpov, player_t *player);
void HWR_ClearClipper(void);
void HWR_SetStencilState(int state, int level);
boolean HWR_UseShader(void);
boolean HWR_ShouldUsePaletteRendering(void);
boolean HWR_PalRenderFlashpal(void);
void HWR_TogglePaletteRendering(void);
// My original intention was to split hw_main.c
// into files like hw_bsp.c, hw_sprites.c...
// hw_main.c: Lighting and fog
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap);
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
@@ -125,6 +106,7 @@ FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
INT32 HWR_GetTextureUsed(void);
// hw_main.c: Post-rendering
void HWR_DoPostProcessor(player_t *player);
void HWR_StartScreenWipe(void);
void HWR_EndScreenWipe(void);
void HWR_DrawIntermissionBG(void);
@@ -133,55 +115,70 @@ void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT
void HWR_MakeScreenFinalTexture(void);
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
// hw_main.c: Planes
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
// hw_main.c: Segs
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
// moved HWR_SplitWall to hw_main.c
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
void HWR_DrawSkyBackground(float fpov);
// hw_main.c: Sprites
void HWR_AddSprites(sector_t *sec);
void HWR_ProjectSprite(mobj_t *thing);
//void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
void HWR_DrawSprites(void);
// hw_bsp.c
void HWR_CreatePlanePolygons(INT32 bspnum);
extern boolean gl_maphasportals;
extern boolean gr_maphasportals;
// hw_cache.c
void HWR_LoadTextures(size_t pnumtextures);
RGBA_t *HWR_GetTexturePalette(void);
void HWR_SetShaderState(void);
// Console variables
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
extern consvar_t cv_glscreentextures;
extern consvar_t cv_grshaders;
#ifdef USE_FBO_OGL
extern consvar_t cv_glframebuffer;
extern consvar_t cv_grframebuffer;
#endif
extern consvar_t cv_splitwallfix;
extern consvar_t cv_grshearing;
extern consvar_t cv_grfov;
extern consvar_t cv_grmdls;
extern consvar_t cv_grfog;
extern consvar_t cv_grfogdensity;
extern consvar_t cv_grfiltermode;
extern consvar_t cv_granisotropicmode;
extern consvar_t cv_grcorrecttricks;
extern consvar_t cv_grfovchange;
extern consvar_t cv_grsolvetjoin;
extern consvar_t cv_grspritebillboarding;
extern consvar_t cv_grfakecontrast;
extern consvar_t cv_grslopecontrast;
extern consvar_t cv_grhorizonlines;
extern consvar_t cv_grfallbackplayermodel;
extern consvar_t cv_grbatching;
extern consvar_t cv_grrenderdistance;
extern consvar_t cv_grpaletterendering;
extern consvar_t cv_grpalettedepth;
extern consvar_t cv_grflashpal;
extern consvar_t cv_lightdither;
extern consvar_t cv_grscreentextures;
extern consvar_t cv_grportals;
extern consvar_t cv_nostencil;
extern consvar_t cv_secbright;
extern consvar_t cv_glmdls;
extern consvar_t cv_glfallbackplayermodel;
extern consvar_t cv_glspritebillboarding;
extern consvar_t cv_glshearing;
extern consvar_t cv_glfakecontrast;
extern consvar_t cv_glslopecontrast;
extern consvar_t cv_glshaders;
extern consvar_t cv_gllightdither;
extern consvar_t cv_glsecbright;
extern consvar_t cv_glfiltermode;
extern consvar_t cv_glanisotropicmode;
extern consvar_t cv_glsolvetjoin;
extern consvar_t cv_glbatching;
extern consvar_t cv_glrenderdistance;
extern consvar_t cv_glhorizonlines;
extern consvar_t cv_glportals;
extern consvar_t cv_glfovchange;
extern consvar_t cv_glpaletterendering;
extern consvar_t cv_glpalettedepth;
extern consvar_t cv_glflashpal;
extern CV_PossibleValue_t granisotropicmode_cons_t[];
#endif
+83 -83
View File
@@ -147,7 +147,7 @@ static void PNG_warn(png_structp PNG, png_const_charp pngtext)
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
}
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *glpatch)
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch)
{
png_structp png_ptr;
png_infop png_info_ptr;
@@ -201,7 +201,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
fclose(png_FILE);
Z_Free(glpatch->mipmap->data);
Z_Free(grpatch->mipmap->data);
return 0;
}
#ifdef USE_FAR_KEYWORD
@@ -242,7 +242,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
{
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &glpatch->mipmap->data);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->data);
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
for (i = 0; i < height; i++)
row_pointers[i] = PNG_image + i*pitch;
@@ -282,7 +282,7 @@ typedef struct
} PcxHeader;
static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
GLPatch_t *glpatch)
GLPatch_t *grpatch)
{
PcxHeader header;
#define PALSIZE 768
@@ -322,7 +322,7 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
pw = *w = header.xmax - header.xmin + 1;
ph = *h = header.ymax - header.ymin + 1;
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &glpatch->mipmap->data);
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->data);
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
{
@@ -364,43 +364,43 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
// -----------------+
static void md2_loadTexture(md2_t *model)
{
GLPatch_t *glpatch;
GLPatch_t *grpatch;
const char *filename = model->filename;
if (model->glpatch)
if (model->grpatch)
{
glpatch = model->glpatch;
Z_Free(glpatch->mipmap->data);
grpatch = model->grpatch;
Z_Free(grpatch->mipmap->data);
}
else
{
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
&(model->glpatch));
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->grpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
#endif
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
{
glpatch->notfound = true;// mark it so its not searched for again repeatedly
grpatch->notfound = true;// mark it so its not searched for again repeatedly
return;
}
glpatch->mipmap->downloaded = 0;
glpatch->mipmap->flags = 0;
grpatch->mipmap->downloaded = 0;
grpatch->mipmap->flags = 0;
glpatch->width = (INT16)w;
glpatch->height = (INT16)h;
glpatch->mipmap->width = (UINT16)w;
glpatch->mipmap->height = (UINT16)h;
grpatch->width = (INT16)w;
grpatch->height = (INT16)h;
grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap->height = (UINT16)h;
// for palette rendering, color cube is applied in post-processing instead of here
if (!HWR_ShouldUsePaletteRendering())
@@ -408,7 +408,7 @@ static void md2_loadTexture(md2_t *model)
UINT32 size;
RGBA_t *image;
// Lactozilla: Apply colour cube
image = glpatch->mipmap->data;
image = grpatch->mipmap->data;
size = w*h;
while (size--)
{
@@ -417,8 +417,8 @@ static void md2_loadTexture(md2_t *model)
}
}
}
HWD.pfnSetTexture(glpatch->mipmap);
HWR_UnlockCachedPatch(glpatch);
HWD.pfnSetTexture(grpatch->mipmap);
HWR_UnlockCachedPatch(grpatch);
}
// -----------------+
@@ -426,49 +426,49 @@ static void md2_loadTexture(md2_t *model)
// -----------------+
static void md2_loadBlendTexture(md2_t *model)
{
GLPatch_t *glpatch;
GLPatch_t *grpatch;
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
strcpy(filename, model->filename);
FIL_ForceExtension(filename, "_blend.png");
if (model->blendglpatch)
if (model->blendgrpatch)
{
glpatch = model->blendglpatch;
Z_Free(glpatch->mipmap->data);
grpatch = model->blendgrpatch;
Z_Free(grpatch->mipmap->data);
}
else
{
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
&(model->blendglpatch));
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->blendgrpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
#endif
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
{
glpatch->notfound = true;// mark it so its not searched for again repeatedly
grpatch->notfound = true;// mark it so its not searched for again repeatedly
Z_Free(filename);
return;
}
glpatch->mipmap->downloaded = 0;
glpatch->mipmap->flags = 0;
grpatch->mipmap->downloaded = 0;
grpatch->mipmap->flags = 0;
glpatch->width = (INT16)w;
glpatch->height = (INT16)h;
glpatch->mipmap->width = (UINT16)w;
glpatch->mipmap->height = (UINT16)h;
grpatch->width = (INT16)w;
grpatch->height = (INT16)h;
grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap->height = (UINT16)h;
}
HWD.pfnSetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(glpatch);
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(grpatch);
Z_Free(filename);
}
@@ -489,7 +489,7 @@ void HWR_InitMD2(void)
{
md2_playermodels[s].scale = -1.0f;
md2_playermodels[s].model = NULL;
md2_playermodels[s].glpatch = NULL;
md2_playermodels[s].grpatch = NULL;
md2_playermodels[s].skin = -1;
md2_playermodels[s].notfound = true;
md2_playermodels[s].error = false;
@@ -498,7 +498,7 @@ void HWR_InitMD2(void)
{
md2_localplayermodels[s].scale = -1.0f;
md2_localplayermodels[s].model = NULL;
md2_localplayermodels[s].glpatch = NULL;
md2_localplayermodels[s].grpatch = NULL;
md2_localplayermodels[s].skin = -1;
md2_localplayermodels[s].notfound = true;
md2_localplayermodels[s].error = false;
@@ -507,7 +507,7 @@ void HWR_InitMD2(void)
{
md2_models[i].scale = -1.0f;
md2_models[i].model = NULL;
md2_models[i].glpatch = NULL;
md2_models[i].grpatch = NULL;
md2_models[i].skin = -1;
md2_models[i].notfound = true;
md2_models[i].error = false;
@@ -680,7 +680,7 @@ spritemd2found:
#define SETBRIGHTNESS(brightness,r,g,b) \
brightness = (UINT8)(((1063*(UINT32)(r))/5000) + ((3576*(UINT32)(g))/5000) + ((361*(UINT32)(b))/5000))
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glmip, INT32 skinnum, skincolors_t color)
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
{
UINT16 w = gpatch->width, h = gpatch->height;
UINT32 size = w*h;
@@ -696,24 +696,24 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
memset(translation, 0, sizeof(translation));
memset(cutoff, 0, sizeof(cutoff));
if (glmip->width == 0)
if (grmip->width == 0)
{
glmip->width = gpatch->width;
glmip->height = gpatch->height;
grmip->width = gpatch->width;
grmip->height = gpatch->height;
// no wrap around, no chroma key
glmip->flags = 0;
grmip->flags = 0;
// setup the texture info
glmip->format = GL_TEXFMT_RGBA;
grmip->format = GL_TEXFMT_RGBA;
}
if (glmip->data)
if (grmip->data)
{
Z_Free(glmip->data);
glmip->data = NULL;
Z_Free(grmip->data);
grmip->data = NULL;
}
cur = Z_Malloc(size*4, PU_HWRCACHE, &glmip->data);
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->data);
memset(cur, 0x00, size*4);
image = gpatch->mipmap->data;
@@ -1044,7 +1044,7 @@ skippixel:
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
{
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
GLMipmap_t *glmip, *newmip;
GLMipmap_t *grmip, *newmip;
if (colormap == colormaps || colormap == NULL)
{
@@ -1055,15 +1055,15 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
// search for the mimmap
// skip the first (no colormap translated)
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
{
glmip = glmip->nextcolormap;
if (glmip->colormap == colormap)
grmip = grmip->nextcolormap;
if (grmip->colormap == colormap)
{
if (glmip->downloaded && glmip->data)
if (grmip->downloaded && grmip->data)
{
HWD.pfnSetTexture(glmip); // found the colormap, set it to the correct texture
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
return;
}
}
@@ -1079,7 +1079,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
glmip->nextcolormap = newmip;
grmip->nextcolormap = newmip;
newmip->colormap = colormap;
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
@@ -1095,7 +1095,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
// Returns :
// -----------------+
void HWR_DrawMD2(gl_vissprite_t *spr)
void HWR_DrawMD2(gr_vissprite_t *spr)
{
md2_t *md2;
@@ -1105,7 +1105,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
FTransform p;
FSurfaceInfo Surf;
if (!cv_glmdls.value)
if (!cv_grmdls.value)
return;
if (spr->precip)
@@ -1164,7 +1164,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
angle_t ang;
interpmobjstate_t interp;
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_grmaxinterpdist.value))
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
@@ -1244,22 +1244,22 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
}
}
//Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->glpatch;
gpatch = md2->grpatch;
if (!gpatch || ((!gpatch->mipmap->format || !gpatch->mipmap->downloaded) && !gpatch->notfound))
md2_loadTexture(md2);
gpatch = md2->glpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap->format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendglpatch
|| ((!((GLPatch_t *)md2->blendglpatch)->mipmap->format || !((GLPatch_t *)md2->blendglpatch)->mipmap->downloaded)
&& !((GLPatch_t *)md2->blendglpatch)->notfound)))
&& (!md2->blendgrpatch
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
&& !((GLPatch_t *)md2->blendgrpatch)->notfound)))
md2_loadBlendTexture(md2);
if (gpatch && gpatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
{
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
md2->blendglpatch && ((GLPatch_t *)md2->blendglpatch)->mipmap->format
&& gpatch->width == ((GLPatch_t *)md2->blendglpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendglpatch)->height)
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->format
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
{
INT32 tcskinnum = TC_DEFAULT;
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
@@ -1284,7 +1284,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
}
else tcskinnum = TC_DEFAULT;
}
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendglpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
}
else
{
@@ -1313,7 +1313,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
// Interpolate the model interpolation. (lol)
tics -= FixedToFloat(rendertimefrac);
if (cv_glmdls.value == 1 && tics <= durs)
if (cv_grmdls.value == 1 && tics <= durs)
{
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
if (spr->mobj->frame & FF_ANIMATE)
@@ -1478,8 +1478,8 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
float oy = ys * flipfactor*FIXED_TO_FLOAT(interp.spriteyoffset);
// offset perpendicular to the camera angle
p.x -= ox * gl_viewsin;
p.y += ox * gl_viewcos;
p.x -= ox * gr_viewsin;
p.y += ox * gr_viewcos;
p.z += oy;
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
+3 -3
View File
@@ -28,8 +28,8 @@ typedef struct
float scale;
float offset;
model_t *model;
void *glpatch;
void *blendglpatch;
void *grpatch;
void *blendgrpatch;
boolean notfound;
INT32 skin;
boolean error;
@@ -40,7 +40,7 @@ extern md2_t md2_playermodels[MAXSKINS];
extern md2_t md2_localplayermodels[MAXLOCALSKINS];
void HWR_InitMD2(void);
void HWR_DrawMD2(gl_vissprite_t *spr);
void HWR_DrawMD2(gr_vissprite_t *spr);
void HWR_AddPlayerMD2(INT32 skin, boolean local);
void HWR_AddSpriteMD2(size_t spritenum);
-227
View File
@@ -1,227 +0,0 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
// Copyright (C) 1996 by id Software, Inc.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_portal.c
/// \brief OpenGL renderer portals.
// ==========================================================================
// Visual portals (attr. Hannu Hanhi)
// ==========================================================================
#ifdef HWRENDER
#include "../r_portal.h"
#include "../z_zone.h"
#include "hw_clip.h"
#include "hw_drv.h"
#include "hw_defs.h"
#include "hw_main.h"
#include "hw_portal.h"
SINT8 gl_portal_state = GLPORTAL_OFF;
gl_portallist_t *currentportallist;
// clip the area outside the portal destination window
void HWR_PortalClipping(gl_portal_t *portal)
{
gld_clipper_SafeAddClipRange(portal->angle1, portal->angle2);
}
static gl_portal_t* HWR_Portal_Add (seg_t *seg)
{
gl_portal_t *portal = Z_Malloc(sizeof(gl_portal_t), PU_STATIC, NULL);
// Linked list.
if (!currentportallist->base)
{
currentportallist->base = portal;
currentportallist->cap = portal;
}
else
{
currentportallist->cap->next = portal;
currentportallist->cap = portal;
}
portal->next = NULL;
portal->seg = seg;
return portal;
}
void HWR_FreePortalList(gl_portallist_t freelist)
{
portalcullsector = NULL;
// free memory from portal list allocated by calls to Add2Lines
gl_portal_t *gl_portal_temp = freelist.base;
while (gl_portal_temp)
{
gl_portal_t *nextportal = gl_portal_temp->next;
Z_Free(gl_portal_temp);
gl_portal_temp = nextportal;
}
}
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg)
{
gl_portal_t *portal = HWR_Portal_Add(seg);
// Offset the portal view by the linedef centers
line_t* start = &lines[line1];
line_t* dest = &lines[line2];
angle_t dangle = R_PointToAngle2(0, 0, dest->dx, dest->dy) - R_PointToAngle2(start->dx, start->dy, 0, 0);
fixed_t disttopoint;
angle_t angtopoint;
vertex_t dest_c, start_c;
// looking glass center
start_c.x = start->v1->x/2 + start->v2->x/2;
start_c.y = start->v1->y/2 + start->v2->y/2;
// other side center
dest_c.x = dest->v1->x/2 + dest->v2->x/2;
dest_c.y = dest->v1->y/2 + dest->v2->y/2;
disttopoint = R_PointToDist2(start_c.x, start_c.y, viewx, viewy);
angtopoint = R_PointToAngle2(start_c.x, start_c.y, viewx, viewy);
angtopoint += dangle;
portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
portal->viewangle = viewangle + dangle;
portal->angle1 = R_PointToAngle64(seg->v1->x, seg->v1->y) + dangle;
portal->angle2 = R_PointToAngle64(seg->v2->x, seg->v2->y) + dangle;
portal->clipline = line2;
}
void HWR_PortalFrame(gl_portal_t* portal)
{
viewx = portal->viewx;
viewy = portal->viewy;
viewz = portal->viewz;
viewangle = portal->viewangle;
//viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
//viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
if (portal->clipline != -1)
{
portalclipline = &lines[portal->clipline];
portalcullsector = portalclipline->frontsector;
viewsector = portalclipline->frontsector;
}
else
{
portalclipline = NULL;
portalcullsector = NULL;
viewsector = R_PointInSubsector(viewx, viewy)->sector;
}
}
// Renders a portal segment.
static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
{
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
// set our portal state and prepare to render the seg
HWR_SetPortalState(state);
gl_curline = portal->seg;
gl_frontsector = portal->seg->frontsector;
gl_backsector = portal->seg->backsector;
HWR_ProcessSeg();
gl_drawing_stencil = false;
// need to work around the r_opengl PF_Invisible bug with this call
// similarly as in the linkdraw hack in HWR_DrawSprites
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
}
// Renders a single portal from the current viewpoint.
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
{
// draw portal seg to stencil buffer with increment
HWR_SetTransform(fpov, player);
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
// go to portal frame lmao
HWR_PortalFrame(portal);
// call HWR_RenderViewpoint
HWR_RenderViewpoint(portal, fpov, player, stencil_level + 1, true);
// return to current frame
if (rootportal)
HWR_PortalFrame(rootportal);
else // current frame is not a portal frame but the main view!
{
R_SetupFrame(player, false);
portalclipline = NULL;
}
// remove portal seg from stencil buffer
HWR_SetTransform(fpov, player);
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
// draw portal seg to depth buffer
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_DEPTH, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_DEPTH);
}
// returns true if the point is on the correct (viewable) side of the
// portal destination line
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y)
{
// we are checking if the point is on the viewable side of the portal exit.
// being exactly on the portal exit line is not enough to pass the test.
// P_PointOnLineSide could behave differently from this expectation on this case,
// so first check if the point is precisely on the line, and then if not, check the side.
vertex_t closest_point;
P_ClosestPointOnLine(x, y, portalclipline, &closest_point);
if (closest_point.x != x || closest_point.y != y)
{
if (P_PointOnLineSide(x, y, portalclipline) != 1)
return true;
}
return false;
}
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord)
{
if (!portalclipline)
return true;
if (HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM]))
{
return true;
}
// we did not find any reason to pass the check, so return failure
return false;
}
#endif
-81
View File
@@ -1,81 +0,0 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_portal.h
/// \brief OpenGL renderer portal struct, functions, linked list extern.
#ifndef __HW_PORTAL__
#define __HW_PORTAL__
#ifdef HWRENDER
#include "../doomstat.h"
#include "../r_data.h"
#include "../r_bsp.h"
/** Portal structure.
*/
enum
{
GLPORTAL_OFF,
GLPORTAL_SEARCH,
GLPORTAL_STENCIL,
GLPORTAL_DEPTH,
GLPORTAL_INSIDE,
};
typedef struct gl_portal_s
{
struct gl_portal_s *next;
// Viewport.
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
seg_t *seg; // seg that is used for drawing to the stencil buffer
INT32 clipline; // Optional clipline for line-based portals
// angles for the left and right edges of the portal
// relative to the viewpoint
angle_t angle1;
angle_t angle2;
} gl_portal_t;
typedef struct gl_portallist_s
{
gl_portal_t *base;
gl_portal_t *cap;
} gl_portallist_t;
extern SINT8 gl_portal_state;
// new thing
extern gl_portallist_t *currentportallist;
static inline void HWR_SetPortalState (SINT8 state)
{
gl_portal_state = state;
}
// Adds an entry to the clipper for portal rendering
void HWR_PortalClipping(gl_portal_t *portal);
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg);
void HWR_PortalFrame(gl_portal_t* portal);
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level);
void HWR_FreePortalList(gl_portallist_t portallist);
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y);
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord);
#endif
#endif
+13 -12
View File
@@ -25,19 +25,19 @@ static struct {
const char *vertex;
const char *fragment;
} const gl_shadersources[] = {
// Floor shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_FLOOR_FRAGMENT_SHADER},
// Shadow shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_SHADOW_FRAGMENT_SHADER},
// Wall shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
// Sprite shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
// Sprite clipping hack shader (for pulling things out of the floor)
{GLSL_SPRITECLIP_HACK_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
// Model shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
@@ -52,7 +52,7 @@ static struct {
// Palette postprocess shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_PALETTE_POSTPROCESS_FRAGMENT_SHADER},
// UI colormap fade shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_UI_COLORMAP_FADE_FRAGMENT_SHADER},
@@ -279,11 +279,11 @@ static char *HWR_PreprocessShader(char *original)
// Calculate length of modified shader.
new_len = original_len;
if (cv_glpaletterendering.value)
if (cv_grpaletterendering.value)
ADD_TO_LEN(PALETTE_RENDERING_DEFINE)
if (cv_gllightdither.value)
if (cv_lightdither.value)
ADD_TO_LEN(LIGHT_DITHERING_DEFINE)
#undef ADD_TO_LEN
@@ -324,10 +324,10 @@ static char *HWR_PreprocessShader(char *original)
}
// Write the defines.
if (cv_glpaletterendering.value)
if (cv_grpaletterendering.value)
WRITE_DEFINE(PALETTE_RENDERING_DEFINE)
if (cv_gllightdither.value)
if (cv_lightdither.value)
WRITE_DEFINE(LIGHT_DITHERING_DEFINE)
#undef WRITE_DEFINE
@@ -410,7 +410,7 @@ int HWR_GetShaderFromTarget(int shader_target)
// - custom shaders are enabled
// - custom shaders are allowed by the server
if (custom_shader != -1 && gl_shaders[custom_shader].compiled &&
cv_glshaders.value == 1)
cv_grshaders.value == 1)
return custom_shader;
else
return gl_shadertargets[shader_target].base_shader;
@@ -432,6 +432,7 @@ static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
customshaderxlat_t shaderxlat[] =
{
{"Flat", SHADER_FLOOR},
{"Shadow", SHADER_SHADOW},
{"WallTexture", SHADER_WALL},
{"Sprite", SHADER_SPRITE},
{"Model", SHADER_MODEL},
@@ -564,7 +565,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
int i;
boolean modified_shaders[NUMSHADERTARGETS] = {0};
if (!gl_shadersavailable)
if (!gr_shadersavailable)
return;
lump = HWR_FindShaderDefs(wadnum);
+5 -11
View File
@@ -31,16 +31,6 @@
"gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n" \
"}\0"
// Sprite clipping makes me want to McFucking Die
#define GLSL_SPRITECLIP_HACK_VERTEX_SHADER \
"void main(void) {\n" \
"gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;\n" \
"gl_FrontColor = gl_Color;\n" \
"gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;\n" \
"gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n" \
"gl_Position.z -= 160.0 / gl_Position.z;\n" \
"}\0"
// ==================
// Fragment shaders
// ==================
@@ -181,7 +171,7 @@
"gl_FragColor = final_color;\n" \
"}\n" \
"#endif\0"
#define GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL \
"uniform sampler2D tex;\n" \
"uniform vec4 poly_color;\n" \
@@ -220,6 +210,10 @@
#define GLSL_WALL_FRAGMENT_SHADER \
GLSL_WALL_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER
#define GLSL_SHADOW_FRAGMENT_SHADER \
GLSL_FLOOR_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
//
// Water surface shader
+47 -37
View File
@@ -24,7 +24,6 @@
#include <stdarg.h>
#include <math.h>
#include "../../r_local.h" // For rendertimefrac, used for the leveltime shader uniform
#include "../../i_video.h" // for UseScreenFBO
#include "r_opengl.h"
#include "r_vbo.h"
#include "../hw_shaders.h"
@@ -122,9 +121,9 @@ static GLint viewport[4];
#ifdef USE_FBO_OGL
GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
GLboolean FrameBufferEnabled = GL_FALSE, RenderToFramebuffer = GL_FALSE;
boolean supportFBO = false;
static boolean fboinit = false;
#endif
// Sryder: NextTexAvail is broken for these because palette changes or changes to the texture filter or antialiasing
@@ -707,15 +706,7 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
#ifdef USE_FBO_OGL
static boolean GLFramebuffer_CheckExt(void)
{
//this stuff needs atleast OGL 3.0
if (majorGL < 3)
return false;
// check if all needed gl extensions are available
return (isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions) && isExtAvailable("GL_ARB_framebuffer_object", gl_extensions) && isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions));
}
static boolean GLFramebuffer_IsFuncAvailible(void);
#endif
void SetupGLFunc4(void)
@@ -762,7 +753,7 @@ void SetupGLFunc4(void)
pglGetUniformLocation = GetGLFunc("glGetUniformLocation");
#ifdef USE_FBO_OGL
if (GLFramebuffer_CheckExt())
if (GLFramebuffer_IsFuncAvailible())
{
pglGenFramebuffers = GetGLFunc("glGenFramebuffers");
pglBindFramebuffer = GetGLFunc("glBindFramebuffer");
@@ -775,17 +766,24 @@ void SetupGLFunc4(void)
pglRenderbufferStorage = GetGLFunc("glRenderbufferStorage");
pglFramebufferRenderbuffer = GetGLFunc("glFramebufferRenderbuffer");
// check if ALL functions are availible
if (pglGenFramebuffers && pglBindFramebuffer &&
pglDeleteFramebuffers && pglFramebufferTexture2D &&
pglCheckFramebufferStatus && pglGenRenderbuffers &&
pglBindRenderbuffer && pglDeleteRenderbuffers &&
pglRenderbufferStorage && pglFramebufferRenderbuffer)
supportFBO = true;
}
#endif
}
#ifdef USE_FBO_OGL
static boolean GLFramebuffer_IsFuncAvailible(void)
{
//this stuff needs atleast OGL 3.0
if (majorGL < 3)
return false;
return (isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_object",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions));
return false;
}
#endif
EXPORT boolean HWRAPI(InitShaders) (void)
{
if (!pglUseProgram)
@@ -953,6 +951,7 @@ static void GLPerspective(GLfloat fovy, GLfloat aspect)
pglMultMatrixf(&m[0][0]);
}
// -----------------+
// SetModelView :
// -----------------+
@@ -1047,7 +1046,7 @@ EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo)
#ifdef USE_FBO_OGL
static void GLFramebuffer_GenerateAttachments(void)
{
if (!supportFBO || !UseScreenFBO())
if (!supportFBO)
return;
// Bind the framebuffer
@@ -1084,16 +1083,11 @@ static void GLFramebuffer_GenerateAttachments(void)
// Unbind the framebuffer
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
fboinit = true;
}
void GLFramebuffer_DeleteAttachments(void)
{
if (!supportFBO || fboinit == false)
return;
if (FramebufferObject == 0 && RenderbufferObject == 0 && FramebufferTexture == 0)
if (!supportFBO)
return;
// Unbind the framebuffer
@@ -1108,12 +1102,11 @@ void GLFramebuffer_DeleteAttachments(void)
FramebufferTexture = 0;
RenderbufferObject = 0;
fboinit = false;
}
static void GLFramebuffer_Generate(void)
{
if (!supportFBO || !UseScreenFBO())
if (!supportFBO)
return;
// Generate the framebuffer
@@ -1126,7 +1119,7 @@ static void GLFramebuffer_Generate(void)
static void GLFramebuffer_Delete(void)
{
if (!supportFBO || fboinit == false)
if (!supportFBO)
return;
if (FramebufferObject)
@@ -1138,10 +1131,7 @@ static void GLFramebuffer_Delete(void)
inline void GLFramebuffer_Unbind(void)
{
if (!supportFBO || fboinit == false)
return;
if (FramebufferObject == 0 && RenderbufferObject == 0)
if (!supportFBO)
return;
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -1150,7 +1140,7 @@ inline void GLFramebuffer_Unbind(void)
inline void GLFramebuffer_Enable(void)
{
if (!supportFBO || !UseScreenFBO())
if (!supportFBO)
return;
if (FramebufferObject == 0)
@@ -1164,10 +1154,7 @@ inline void GLFramebuffer_Enable(void)
void GLFramebuffer_Disable(void)
{
if (!supportFBO || fboinit == false)
return;
if (FramebufferObject == 0 && RenderbufferObject == 0)
if (!supportFBO)
return;
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -1183,6 +1170,8 @@ void GLFramebuffer_Disable(void)
// -----------------+
void Flush(void)
{
//GL_DBG_Printf ("HWR_Flush()\n");
while (TexCacheHead)
{
FTextureInfo *pTexInfo = TexCacheHead;
@@ -1209,6 +1198,7 @@ void Flush(void)
textureBufferSize = 0;
}
// -----------------+
// isExtAvailable : Look if an OpenGL extension is available
// Returns : true if extension available
@@ -1236,6 +1226,7 @@ INT32 isExtAvailable(const char *extension, const GLubyte *start)
return 0;
}
// -----------------+
// Init : Initialise the OpenGL interface API
// Returns :
@@ -1245,6 +1236,7 @@ EXPORT boolean HWRAPI(Init) (void)
return LoadGL();
}
// -----------------+
// SetupGLInfo : Retreive and store currently loaded OpenGL version
// -----------------+
@@ -1406,6 +1398,7 @@ static void Clamp2D(GLenum pname)
#endif
}
// -----------------+
// SetBlend : Set render mode
// -----------------+
@@ -2254,6 +2247,12 @@ static void gld_BuildSky(int row_count, int col_count)
}
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
static void RenderDome(INT32 skytexnum)
{
int i, j;
@@ -2351,6 +2350,17 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
case HWD_SET_SHADERS:
gl_allowshaders = Value;
break;
#ifdef USE_FBO_OGL
case HWD_SET_FRAMEBUFFER:
FrameBufferEnabled = Value ? GL_TRUE : GL_FALSE;
if (!supportFBO)
{
FrameBufferEnabled = GL_FALSE;
CV_Set(&cv_grframebuffer, "Off");
}
break;
#endif
case HWD_SET_TEXTUREFILTERMODE:
switch (Value)
{
+4
View File
@@ -98,6 +98,10 @@ typedef void (APIENTRY * PFNglGetIntegerv) (GLenum pname, GLint *params);
extern PFNglGetIntegerv pglGetIntegerv;
typedef const GLubyte* (APIENTRY * PFNglGetString) (GLenum name);
extern PFNglGetString pglGetString;
#if 0
typedef void (APIENTRY * PFNglEnableClientState) (GLenum cap); // redefined in r_opengl.c
static PFNglEnableClientState pglEnableClientState;
#endif
#endif
#ifdef USE_FBO_OGL
+1 -2
View File
@@ -2617,8 +2617,7 @@ static void HU_DrawRankings(void)
boolean completed[MAXPLAYERS];
UINT32 whiteplayer = MAXPLAYERS;
if (!automapactive)
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
if (cons_menuhighlight.value)
hilicol = cons_menuhighlight.value;
-1
View File
@@ -146,7 +146,6 @@ extern boolean xwaylandcrap;
void RefreshOGLSDLSurface(void);
void I_DownSample(void);
boolean UseScreenFBO(void);
extern boolean downsample;
#endif
+1 -1
View File
@@ -69,7 +69,7 @@ static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
static boolean K_DirectorIsEnabled(void)
{
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (((!playeringame[consoleplayer] || players[consoleplayer].spectator)) || (demo.playback && !demo.freecam && (!demo.title || !modeattacking))) && !K_DirectorIsPlayerAlone());
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (((stplyr && !stplyr->spectator) && (!playeringame[consoleplayer] || players[consoleplayer].spectator)) || (demo.playback && !demo.freecam && (!demo.title || !modeattacking))) && !K_DirectorIsPlayerAlone());
}
void K_InitDirector(void)
+157 -149
View File
@@ -725,34 +725,34 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_showinput);
CV_RegisterVar(&cv_showlaptimes);
CV_RegisterVar(&cv_newspeedometer);
CV_RegisterVar(&cv_battlespeedo);
CV_RegisterVar(&cv_saltyhop);
CV_RegisterVar(&cv_saltyhopsfx);
CV_RegisterVar(&cv_saltysquish);
//Colourized HUD
CV_RegisterVar(&cv_colorizedhud);
CV_RegisterVar(&cv_colorizedhudcolor);
CV_RegisterVar(&cv_colorizeditembox);
CV_RegisterVar(&cv_darkitembox);
CV_RegisterVar(&cv_biglaps);
CV_RegisterVar(&cv_highresportrait);
CV_RegisterVar(&cv_slamsound);
CV_RegisterVar(&cv_minihead);
CV_RegisterVar(&cv_showminimapnames);
CV_RegisterVar(&cv_showlapemblem);
CV_RegisterVar(&cv_stagetitle);
CV_RegisterVar(&cv_stagetitle);
CV_RegisterVar(&cv_lessflicker);
CV_RegisterVar(&cv_mouseturn);
}
@@ -2779,9 +2779,16 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
TVector v;
TVector *res;
fixed_t finalx, finaly, finalz, dist;
//mobj_t hoopcenter;
angle_t degrees, fa, closestangle;
fixed_t mobjx, mobjy, mobjz;
//hoopcenter.x = x;
//hoopcenter.y = y;
//hoopcenter.z = z;
//hoopcenter.z = z - mobjinfo[type].height/2;
degrees = FINEANGLES/number;
closestangle = 0;
@@ -3167,19 +3174,17 @@ static void K_SpawnAIZDust(player_t *player)
static void K_StretchPlayerGravity(player_t *p)
{
I_Assert(p != NULL);
I_Assert(p->mo != NULL);
I_Assert(!P_MobjWasRemoved(p->mo));
fixed_t mos = FRACUNIT;
fixed_t rzs = abs(p->mo->momz);
fixed_t zspd = abs(rzs/mos);
fixed_t mos = FRACUNIT;
fixed_t rzs = abs(p->mo->momz);
fixed_t zspd = abs(rzs/mos);
fixed_t stretchScaleFactor = 0;
fixed_t rzsDiv = 1;
fixed_t slamDiv = 1;
fixed_t dxs = p->mo->realxscale;
fixed_t dys = p->mo->realyscale;
fixed_t dxs = p->mo->realxscale;
fixed_t dys = p->mo->realyscale;
//boolean gravSlamming = false;
//fixed_t impactFactor = 0;
stretchScaleFactor = FixedDiv(FRACUNIT*60, cv_gravstretch.value);
if (stretchScaleFactor > 17476977)
@@ -3189,6 +3194,10 @@ static void K_StretchPlayerGravity(player_t *p)
//CONS_Printf(M_GetText("div: %d, scale factor: %d, stretch value: %d\n"), rzsDiv, stretchScaleFactor, cv_gravstretch.value);
I_Assert(p != NULL);
I_Assert(p->mo != NULL);
I_Assert(!P_MobjWasRemoved(p->mo));
if (p->mo->slamsoundtimer)
p->mo->slamsoundtimer--;
@@ -3198,43 +3207,43 @@ static void K_StretchPlayerGravity(player_t *p)
p->mo->slamsoundtimer = TICRATE;
}
if (!P_IsObjectOnGround(p->mo))
{
if (zspd != 0)
{
if (((dxs-(rzsDiv))) > (dxs/5))
{
p->mo->spritexscale = ((dxs-(rzsDiv)));
p->mo->stretchslam = rzs;
}
else
p->mo->spritexscale = (dxs/5);
if (!P_IsObjectOnGround(p->mo))
{
if (zspd != 0)
{
if (((dxs-(rzsDiv))) > (dxs/5))
{
p->mo->spritexscale = ((dxs-(rzsDiv)));
p->mo->stretchslam = rzs;
}
else
p->mo->spritexscale = (dxs/5);
p->mo->spriteyscale = (dys+((rzsDiv*2)/3));
}
else
{
p->mo->spritexscale = (dxs);
p->mo->spriteyscale = (dys);
}
}
else
{
p->mo->spriteyscale = (dys+((rzsDiv*2)/3));
}
else
{
p->mo->spritexscale = (dxs);
p->mo->spriteyscale = (dys);
}
}
else
{
if (stretchScaleFactor > 17476977)
slamDiv = 0;
else
slamDiv = FixedDiv(p->mo->stretchslam, stretchScaleFactor);
p->mo->spritexscale = (dxs+(((slamDiv*2)/3)*2));
p->mo->spriteyscale = (dys-(slamDiv));
if (p->mo->stretchslam > 0)
p->mo->stretchslam -= (4*mos);
else
p->mo->stretchslam = 0;
}
p->mo->spritexscale = (dxs+(((slamDiv*2)/3)*2));
p->mo->spriteyscale = (dys-(slamDiv));
if (p->mo->stretchslam > 0)
p->mo->stretchslam -= (4*mos);
else
p->mo->stretchslam = 0;
}
}
static void K_QuiteSaltyHop(player_t *p)
static void K_QuiteSaltyHop(player_t *p)
{
// what the fuck is this haya
fixed_t mos = FRACUNIT; // doesnt work correctly if it isnt :/
@@ -3256,7 +3265,7 @@ static void K_QuiteSaltyHop(player_t *p)
p->mo->salty_zoffset = 0;
p->mo->salty_momz = 0;
p->mo->init_salty = true;
}
}
else if ((p->mo->salty_jump)) {
if (p->mo->eflags & MFE_JUSTHITFLOOR) {
p->mo->salty_zoffset = 0;
@@ -3290,7 +3299,7 @@ static void K_QuiteSaltyHop(player_t *p)
p->mo->salty_jump = true;
p->mo->salty_zoffset = 0;
p->mo->salty_momz = 6*mos;
if (cv_saltyhopsfx.value)
if (cv_saltyhopsfx.value)
S_StartSound(p->mo, sfx_s25a);
}
}
@@ -3299,55 +3308,56 @@ static void K_QuiteSaltyHop(player_t *p)
void K_RollMobjBySlopes(mobj_t* mo, boolean usedistance)
{
I_Assert(mo->subsector != NULL);
I_Assert(mo->subsector->sector != NULL);
I_Assert(mo->subsector != NULL);
I_Assert(mo->subsector->sector != NULL);
angle_t an;
const boolean flip = mo->eflags & MFE_VERTICALFLIP;
const fixed_t m_dist = usedistance ? R_PointToDist(mo->x, mo->y) : 0;
const fixed_t rolldist = cv_sloperolldist.value * mapobjectscale;
angle_t an;
boolean flip = mo->eflags & MFE_VERTICALFLIP;
fixed_t m_dist = R_PointToDist(mo->x, mo->y);
fixed_t rolldist = cv_sloperolldist.value * mapobjectscale;
// lifted from hw_md2
if (mo->standingslope)
{
fixed_t tempz = mo->standingslope->normal.z;
fixed_t tempy = mo->standingslope->normal.y;
fixed_t tempx = mo->standingslope->normal.x;
fixed_t tempangle = -(R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
// lifted from hw_md2
if (mo->standingslope)
{
fixed_t tempz = mo->standingslope->normal.z;
fixed_t tempy = mo->standingslope->normal.y;
fixed_t tempx = mo->standingslope->normal.x;
fixed_t tempangle = -(R_PointToAngle2(
0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
// admittedly this is a very hacky way to do the pitch and roll easing
// admittedly this is a very hacky way to do the pitch and roll easing
// pitch
if ((!usedistance) || (m_dist <= (rolldist)))
{
an = (INT32)((angle_t)tempangle - mo->pitch_sprite) / SLOPEROLL_DIV;
// pitch
if ((!usedistance) || (m_dist <= (rolldist)))
{
an = (INT32)((angle_t)tempangle - mo->pitch_sprite) / SLOPEROLL_DIV;
mo->pitch_sprite = an ? mo->pitch_sprite + an : (angle_t)tempangle;
}
else
mo->pitch_sprite = FixedAngle(0);
mo->pitch_sprite = an ? mo->pitch_sprite + an : (angle_t)tempangle;
}
else
mo->pitch_sprite = FixedAngle(0);
mo->slopepitch = flip ? InvAngle(mo->pitch_sprite) : mo->pitch_sprite;
mo->slopepitch = flip ? InvAngle(mo->pitch_sprite) : mo->pitch_sprite;
// roll
tempangle = (R_PointToAngle2(0, 0, tempz, tempy));
// roll
tempangle = (R_PointToAngle2(0, 0, tempz, tempy));
if (!usedistance || (m_dist <= (rolldist)))
{
an = (INT32)((angle_t)tempangle - mo->roll_sprite) / SLOPEROLL_DIV;
if ((!usedistance) || (m_dist <= (rolldist)))
{
an = (INT32)((angle_t)tempangle - mo->roll_sprite) / SLOPEROLL_DIV;
mo->roll_sprite = an ? mo->roll_sprite + an : (angle_t)tempangle;
}
else
mo->roll_sprite = FixedAngle(0);
mo->roll_sprite = an ? mo->roll_sprite + an : (angle_t)tempangle;
}
else
mo->roll_sprite = FixedAngle(0);
mo->sloperoll = flip ? InvAngle(mo->roll_sprite) : mo->roll_sprite;
}
else if (P_IsObjectOnGround(mo))
{
mo->sloperoll = FixedAngle(0);
mo->slopepitch = FixedAngle(0);
}
mo->sloperoll = flip ? InvAngle(mo->roll_sprite) : mo->roll_sprite;
}
else if (P_IsObjectOnGround(mo))
{
mo->sloperoll = FixedAngle(0);
mo->slopepitch = FixedAngle(0);
}
}
void K_SpawnBoostTrail(player_t *player)
@@ -4450,6 +4460,7 @@ void K_RepairOrbitChain(mobj_t *orbit)
if (orbit->target && orbit->target->player)
{
player_t *player = orbit->target->player;
INT32 num = 0;
mobj_t *cur = orbit->target->hnext;
@@ -6493,10 +6504,14 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->mo->spriteyscale = player->mo->realyscale;
}
if (cv_spriteroll.value && cv_sloperoll.value)
boolean usedist = false;
if (cv_sloperolldist.value > 0)
usedist = true;
if ((cv_spriteroll.value) && (cv_sloperoll.value))
{
if ((!player->mo->salty_jump)) // seeing a character rotate mid-hop looks really janky
K_RollMobjBySlopes(player->mo, (cv_sloperolldist.value && !splitscreen));
K_RollMobjBySlopes(player->mo, usedist);
}
else
{
@@ -7096,7 +7111,7 @@ void K_LoadKartHUDGraphics(void)
kp_karmasticker = W_CachePatchName("K_STKARM", PU_HUDGFX);
kp_splitkarmabomb = W_CachePatchName("K_SPTKRM", PU_HUDGFX);
kp_timeoutsticker = W_CachePatchName("K_STTOUT", PU_HUDGFX);
if (xtra_speedo) // snowy speedometer
{
skp_smallsticker = W_CachePatchName("SP_SMSTC", PU_HUDGFX);
@@ -7111,8 +7126,8 @@ void K_LoadKartHUDGraphics(void)
{
skp_smallsticker3 = W_CachePatchName("SP_SM3TC", PU_HUDGFX);
}
if (achi_speedo)
if (achi_speedo)
{
skp_smallstickerachi = W_CachePatchName("SP_AMSTC", PU_HUDGFX);
skp_speedpatchesachi[0] = W_CachePatchName("K_TRNULL", PU_HUDGFX); // lolxd
@@ -7122,7 +7137,7 @@ void K_LoadKartHUDGraphics(void)
skp_speedpatchesachi[4] = W_CachePatchName("SP_APERC", PU_HUDGFX);
}
if (big_lap){
if (big_lap){
kp_lapstickerbig = W_CachePatchName("K_STLAPB", PU_HUDGFX);
kp_lapstickerbig2 = W_CachePatchName("K_STLA2B", PU_HUDGFX);
}
@@ -7144,8 +7159,8 @@ void K_LoadKartHUDGraphics(void)
kp_itembgclr[3] = W_CachePatchName("K_ISBCD", PU_HUDGFX);
kp_itemmulstickerclr[1] = W_CachePatchName("K_ISMULC", PU_HUDGFX);
kp_itemmulstickerclr[0] = W_CachePatchName("K_ITMULC", PU_HUDGFX);
if (big_lap_color){
if (big_lap_color){
kp_lapstickerbigclr = W_CachePatchName("K_SCLAPB", PU_HUDGFX);
kp_lapstickerbig2clr = W_CachePatchName("K_SCLA2B", PU_HUDGFX);
}
@@ -7155,8 +7170,8 @@ void K_LoadKartHUDGraphics(void)
if (xtra_speedo3 && xtra_speedo_clr3) // 80x11 patch scaled to size
skp_smallstickerclr3 = W_CachePatchName("SC_SM3TC", PU_HUDGFX);
if (achi_speedo && achi_speedo_clr)
if (achi_speedo && achi_speedo_clr)
{
skp_smallstickerachiclr = W_CachePatchName("SC_AMSTC", PU_HUDGFX);
skp_speedpatchesachiclr[0] = W_CachePatchName("K_TRNULL", PU_HUDGFX); // lolxd
@@ -7187,13 +7202,13 @@ void K_LoadKartHUDGraphics(void)
// Nametags
if (nametaggfx)
{
nametagpic = W_CachePatchName("NTLINE", PU_HUDGFX);
nametagline = W_CachePatchName("NTLINEV", PU_HUDGFX);
nametagspeed = W_CachePatchName("NTSP", PU_HUDGFX);
nametagweight = W_CachePatchName("NTWH", PU_HUDGFX);
}
if (driftgaugegfx){
driftgauge = W_CachePatchName("K_DGAU", PU_HUDGFX);
driftgaugecolor = W_CachePatchName("K_DCAU", PU_HUDGFX);
@@ -7760,7 +7775,7 @@ static void K_drawKartStats(void)
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
UINT8 splitnum = 0;
for (; splitnum < MAXSPLITSCREENPLAYERS; ++splitnum)
{
if (stplyr == &players[displayplayers[splitnum]])
@@ -7769,7 +7784,7 @@ static void K_drawKartStats(void)
if (!LUA_HudEnabled(hud_statdisplay))
return;
//Internal offset for speedometer
if (cv_kartspeedometer.value)
{
@@ -8333,7 +8348,7 @@ static void K_DrawKartPositionNum(INT32 num)
scale *= 2;
overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw.
}
if (splitscreen || (cv_showinput.value && !splitscreen))
scale /= 2;
@@ -8625,7 +8640,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
p = &players[tab[i].num];
if (cv_highresportrait.value)
V_DrawSmallMappedPatch(x, y-4, 0, R_GetSkinFaceWant(p), colormap);
else
else
V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(p), colormap);
}
/*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this
@@ -8767,7 +8782,7 @@ static void K_drawKartSpeedometer(void)
//KartZ speedo
fixed_t fuspeed = 0;
INT32 spdpatch = 0;
INT32 speedtype = 0;
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
@@ -8795,7 +8810,7 @@ static void K_drawKartSpeedometer(void)
}
// man.
if ((cv_newspeedometer.value == 1) || (cv_newspeedometer.value == 2 && !xtra_speedo) || (cv_newspeedometer.value == 3 && !achi_speedo) || (cv_newspeedometer.value == 4 && !kartzspeedo) || (cv_newspeedometer.value == 5 && !xtra_speedo3))
if ((cv_newspeedometer.value == 1) || (cv_newspeedometer.value == 2 && !xtra_speedo) || (cv_newspeedometer.value == 3 && !achi_speedo) || (cv_newspeedometer.value == 4 && !kartzspeedo) || (cv_newspeedometer.value == 5 && !xtra_speedo3))
{
switch (speedtype) {
case 1:
@@ -8844,8 +8859,8 @@ static void K_drawKartSpeedometer(void)
V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallstickerachi));
V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed, 3, NULL);
V_DrawScaledPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatchesachi[cv_kartspeedometer.value]);
}
}
}
}
else if (cv_newspeedometer.value == 5 && xtra_speedo3) // why bother if we dont?
{
if (K_UseColorHud() && xtra_speedo_clr3) //Colourized hud
@@ -8859,19 +8874,19 @@ static void K_drawKartSpeedometer(void)
V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed, 3, NULL);
V_DrawScaledPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatches[cv_kartspeedometer.value]);
}
// Kart Z speedo bullshit...
// Draw the Speed counter.
else if (cv_newspeedometer.value == 4 && kartzspeedo)
{
fuspeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT;
#define NUM_INTERVALS 22
const int speedIntervals[NUM_INTERVALS] = {2, 5, 7, 10, 12, 15, 17, 20, 22, 25, 27, 30, 32, 35, 37, 40, 42, 45, 47, 50, 52, 55};
for (int i = 0; i < NUM_INTERVALS; ++i)
for (int i = 0; i < NUM_INTERVALS; ++i)
{
if (fuspeed < speedIntervals[i])
if (fuspeed < speedIntervals[i])
{
spdpatch = i;
break;
@@ -9015,7 +9030,7 @@ static boolean K_GetScreenCoords(vector2_t *vec, player_t *player, mobj_t *targe
#ifdef HWRENDER
// NOW we can get the angle differnce
if (rendermode == render_opengl && cv_glshearing.value == 0)
if (rendermode == render_opengl && cv_grshearing.value == 0)
{
angle_t yang = R_PointToAngle2(0, 0, dist, y); // not perspective
x = FixedMul(x, FINECOSINE((yang>>ANGLETOFINESHIFT) & FINEMASK)); // perspective
@@ -9061,9 +9076,9 @@ static boolean K_GetScreenCoords(vector2_t *vec, player_t *player, mobj_t *targe
// project the angle to get our final X coordinate
x = FixedMul(FINETANGENT(((x+ANGLE_90)>>ANGLETOFINESHIFT) & 4095), fov);
if (splitscreen == 1) // divide by 320/200 (1.6) on 2P splitscreen
x = (x/2) + (x/8);
x = (x/2) + (x/8);
x = x + xres;
// now clip in screen-space
if (!dontclip && (x < 0 || x > xres*2 || y < 0 || y > yres*2))
return false;
@@ -9126,7 +9141,7 @@ static void K_drawNameTags(void)
fixed_t maxdistance = (10*cv_nametagdist.value)* mapobjectscale;
flipped = 0;
fixed_t z;
if (i > PLAYERSMASK)
continue;
if (!players[i].mo || P_MobjWasRemoved(players[i].mo) || players[i].spectator || !playeringame[i])
@@ -9165,7 +9180,7 @@ static void K_drawNameTags(void)
trans = V_40TRANS;
else if (distance > (maxdistance*3/5))
trans = V_20TRANS;
else
else
trans = 0;
break;
case 3:
@@ -9365,7 +9380,7 @@ skipcrap:
if (!K_GetScreenCoords(&pos, stplyr, stplyr->mo, FixedMul(cv_driftgaugeofs.value, cv_driftgaugeofs.value > 0 ? stplyr->mo->scale : mapobjectscale), false))
return;
basex = pos.x>>FRACBITS;
basex = pos.x>>FRACBITS;
basey = pos.y>>FRACBITS;
fixed_t barx;
@@ -9616,8 +9631,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
boolean skinlocal = mo->skinlocal;
fixed_t amnumxpos, amnumypos;
INT32 amxpos, amypos, wntdamxpos, wntdamypos;
fixed_t scale = FRACUNIT;
INT32 amxpos, amypos;
if (mo->skin)
skin = ((skin_t*)(mo->localskin ? mo->localskin : mo->skin))-(skinlocal ? localskins : skins);
@@ -9628,28 +9642,11 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
if (encoremode)
amnumxpos = -amnumxpos;
amxpos = amnumxpos + ((x + (SHORT(minimapinfo.minimap_pic->width)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width)) / 2)<<FRACBITS);
amypos = amnumypos + ((y + (SHORT(minimapinfo.minimap_pic->height)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->height)) / 2)<<FRACBITS);
if (cv_showminimapnames.value && mo->player && !(modeattacking || gamestate == GS_TIMEATTACK))
{
const char *player_name = va("%c%s", (mo->color) ? V_GetSkincolorChar(mo->color) : 0, player_names[mo->player - players]);
V_DrawCenteredSmallStringAtFixed(amxpos + (4*FRACUNIT), amypos - (3*FRACUNIT), V_ALLOWLOWERCASE|flags, player_name);
}
// thx wanted reticle for having weird offsets very cool
wntdamxpos = cv_minihead.value ? amxpos + (1<<FRACBITS) : amxpos - (4<<FRACBITS);
wntdamypos = cv_minihead.value ? amypos + (1<<FRACBITS) : amypos - (4<<FRACBITS);
if (cv_minihead.value)
{
amxpos += (SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width) / 4)<<FRACBITS;
amypos += (SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->height) / 4)<<FRACBITS;
scale /= 2;
}
amxpos = amnumxpos + ((x + (SHORT(minimapinfo.minimap_pic->width)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width))/2)<<FRACBITS);
amypos = amnumypos + ((y + (SHORT(minimapinfo.minimap_pic->height)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->height))/2)<<FRACBITS);
if (!mo->color) // 'default' color
V_DrawSciencePatch(amxpos, amypos, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], scale);
V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT);
else
{
UINT8 *colormap;
@@ -9657,14 +9654,25 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE);
else
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
V_DrawFixedPatch(amxpos, amypos, scale, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], colormap);
if (cv_minihead.value)
V_DrawFixedPatch(amxpos + (2*FRACUNIT), amypos + (2*FRACUNIT), FRACUNIT/2, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], colormap);
else
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], colormap);
if (cv_showminimapnames.value && !(modeattacking || gamestate == GS_TIMEATTACK))
{
const char *player_name = va("%c%s", V_GetSkincolorChar(mo->color), player_names[mo->player - players]);
V_DrawCenteredSmallStringAtFixed(amxpos + (4*FRACUNIT), amypos - (3*FRACUNIT), V_ALLOWLOWERCASE|flags, player_name);
}
if (mo->player
&& ((G_RaceGametype() && mo->player->kartstuff[k_position] == spbplace)
|| (G_BattleGametype() && K_IsPlayerWanted(mo->player))))
{
V_DrawFixedPatch(wntdamxpos, wntdamypos, scale, flags, kp_wantedreticle, NULL);
if (cv_minihead.value)
V_DrawFixedPatch(amxpos, amypos, FRACUNIT/2, flags, kp_wantedreticle, NULL);
else
V_DrawFixedPatch(amxpos - (4<<FRACBITS), amypos - (4<<FRACBITS), FRACUNIT, flags, kp_wantedreticle, NULL);
}
}
}
@@ -10497,7 +10505,7 @@ void K_drawKartHUD(void)
// Draw the item window
if (LUA_HudEnabled(hud_item) && !freecam)
K_drawKartItem();
K_drawKartItem();
if (cv_driftgauge.value && !modeattacking)
{
+86 -46
View File
@@ -591,16 +591,26 @@ static int libd_drawOnMinimap(lua_State *L)
UINT8 *colormap = NULL; // do we want to colormap this patch?
boolean centered; // the patch is centered and doesn't need readjusting on x/y coordinates.
huddrawlist_h list;
patch_t *AutomapPic = NULL;
// variables used to replicate k_kart's mmap drawer:
INT32 lumpnum;
patch_t *AutomapPic;
INT32 mx, my;
INT32 splitflags, minimaptrans;
// base position of the minimap which also takes splits into account:
INT32 MM_X, MM_Y;
// variables used for actually drawing the icon:
INT32 splitflags, minimaptrans;
fixed_t amnumxpos, amnumypos;
fixed_t amxpos, amypos;
INT32 mm_x, mm_y;
INT32 amxpos, amypos;
node_t *bsp = &nodes[numnodes-1];
fixed_t maxx, minx, maxy, miny;
fixed_t mapwidth, mapheight;
fixed_t xoffset, yoffset;
fixed_t xscale, yscale, zoom;
fixed_t patchw, patchh;
HUDONLY // only run this function in hud hooks
@@ -612,6 +622,8 @@ static int libd_drawOnMinimap(lua_State *L)
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
centered = lua_optboolean(L, 6);
// replicate exactly what source does for its minimap drawer; AKA hardcoded garbo.
// first, check what position the mmap is supposed to be in (pasted from k_kart.c):
MM_X = BASEVIDWIDTH - 50 + cv_mini_xoffset.value; // 270
MM_Y = (BASEVIDHEIGHT/2)-16 + cv_mini_yoffset.value; // 84
@@ -646,6 +658,7 @@ static int libd_drawOnMinimap(lua_State *L)
else
return 0;
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);
splitflags |= minimaptrans;
@@ -666,70 +679,97 @@ static int libd_drawOnMinimap(lua_State *L)
if (stplyr != &players[displayplayers[0]])
return 0;
AutomapPic = minimapinfo.minimap_pic;
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
if (!AutomapPic)
{
if (lumpnum != -1)
AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX);
else
return 0; // no pic, just get outta here
}
// Handle offsets and stuff.
mm_x = MM_X - (SHORT(AutomapPic->width)/2);
mm_y = MM_Y - (SHORT(AutomapPic->height)/2);
mx = MM_X - (AutomapPic->width/2);
my = MM_Y - (AutomapPic->height/2);
// let offsets transfer to the heads, too!
if (encoremode)
{
mm_x += SHORT(AutomapPic->leftoffset);
}
mx += SHORT(AutomapPic->leftoffset);
else
{
mm_x -= SHORT(AutomapPic->leftoffset);
}
mx -= SHORT(AutomapPic->leftoffset);
my -= SHORT(AutomapPic->topoffset);
mm_y -= SHORT(AutomapPic->topoffset);
// now that we have replicated this behavior, we can draw an icon from our supplied x, y coordinates by replicating k_kart.c's totally understandable uncommented code!!!
// scale patch coords
patchw = (SHORT(patch->width) * scale / 2);
patchh = (SHORT(patch->height) * scale / 2);
// get map boundaries using nodes
maxx = maxy = INT32_MAX;
minx = miny = INT32_MIN;
minx = bsp->bbox[0][BOXLEFT];
maxx = bsp->bbox[0][BOXRIGHT];
miny = bsp->bbox[0][BOXBOTTOM];
maxy = bsp->bbox[0][BOXTOP];
if (centered)
{
patchw = patchh = 0; // patch is supposedly already centered, don't butt in.
}
if (bsp->bbox[1][BOXLEFT] < minx)
minx = bsp->bbox[1][BOXLEFT];
if (bsp->bbox[1][BOXRIGHT] > maxx)
maxx = bsp->bbox[1][BOXRIGHT];
if (bsp->bbox[1][BOXBOTTOM] < miny)
miny = bsp->bbox[1][BOXBOTTOM];
if (bsp->bbox[1][BOXTOP] > maxy)
maxy = bsp->bbox[1][BOXTOP];
amnumxpos = (FixedMul(x, minimapinfo.zoom) - minimapinfo.offs_x);
amnumypos = -(FixedMul(y, minimapinfo.zoom) - minimapinfo.offs_y);
// You might be wondering why these are being bitshift here
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
// map boundaries and sizes will ALWAYS be whole numbers thankfully
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
minx >>= FRACBITS;
maxx >>= FRACBITS;
miny >>= FRACBITS;
maxy >>= FRACBITS;
// these are our final map boundaries:
mapwidth = maxx - minx;
mapheight = maxy - miny;
// These should always be small enough to be bitshift back right now
xoffset = (minx + mapwidth/2)<<FRACBITS;
yoffset = (miny + mapheight/2)<<FRACBITS;
xscale = FixedDiv(AutomapPic->width, mapwidth);
yscale = FixedDiv(AutomapPic->height, mapheight);
zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20);
amnumxpos = (FixedMul(x, zoom) - FixedMul(xoffset, zoom));
amnumypos = -(FixedMul(y, zoom) - FixedMul(yoffset, zoom));
if (encoremode)
{
amnumxpos = -amnumxpos;
}
amxpos = amnumxpos + ((mm_x + SHORT(AutomapPic->width) / 2)<<FRACBITS) - patchw;
amypos = amnumypos + ((mm_y + SHORT(AutomapPic->height) / 2)<<FRACBITS) - patchh;
// scale patch coords
patchw = patch->width*scale /2;
patchh = patch->height*scale /2;
if (centered)
patchw = patchh = 0; // patch is supposedly already centered, don't butt in.
amxpos = amnumxpos + ((mx + AutomapPic->width/2)<<FRACBITS) - patchw;
amypos = amnumypos + ((my + AutomapPic->height/2)<<FRACBITS) - patchh;
// and NOW we can FINALLY DRAW OUR GOD DAMN PATCH :V
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
list = (huddrawlist_h) lua_touserdata(L, -1);
lua_pop(L, 1);
if (cv_minihead.value)
{
amxpos += patchw / 2;
amypos += patchh / 2;
scale /= 2;
}
if (LUA_HUD_IsDrawListValid(list))
{
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
}
else
{
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
if (LUA_HUD_IsDrawListValid(list)){
if (cv_minihead.value)
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale/2, patch, splitflags, colormap);
else
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
}else{
if (cv_minihead.value)
V_DrawFixedPatch(amxpos, amypos, scale/2, splitflags, patch, colormap);
else
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
}
return 0;
}
@@ -1572,4 +1612,4 @@ void LUAh_VoteHUD(huddrawlist_h list)
lua_pushlightuserdata(gL, NULL);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
}
}
+1 -3
View File
@@ -111,8 +111,6 @@ static void A_Lua(mobj_t *actor)
lua_pushinteger(gL, var2);
LUA_Call(gL, 3, 0, 1);
lua_pop(gL, 1); // pop error handler
if (found)
{
--superstack;
@@ -942,7 +940,7 @@ static int lib_setSfxInfo(lua_State *L)
if (lua_isnumber(L, 2))
{
int j = lua_tointeger(L, 2);
int j = lua_tointeger(L, 2) - 1;
// Read and Write enums were combined, need to do this switch now
switch (j)
+1 -1
View File
@@ -281,7 +281,7 @@ static int lib_iterateSectorThinglist(lua_State *L)
if (!lua_isnil(L, 1))
{
thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
if (!thing)
if (P_MobjWasRemoved(thing))
return luaL_error(L, "current entry in thinglist was removed; avoid calling P_RemoveMobj on entries!");
thing = thing->snext;
}
+335 -183
View File
@@ -37,9 +37,8 @@
/*
* Sacrifice very little compression quality in favour of compression speed.
* This gives almost the same compression as the default code, and is
* (very roughly) 15% faster. This is the preferable mode of operation.
* (very roughly) 15% faster. This is the preferred mode of operation.
*/
#ifndef VERY_FAST
# define VERY_FAST 1
#endif
@@ -48,7 +47,7 @@
* Sacrifice some more compression quality in favour of compression speed.
* (roughly 1-2% worse compression for large blocks and
* 9-10% for small, redundant, blocks and >>20% better speed in both cases)
* In INT16: when in need for speed, enable this for binary data,
* In short: when in need for speed, enable this for binary data,
* possibly disable this for text data.
*/
#ifndef ULTRA_FAST
@@ -66,21 +65,10 @@
#endif
#endif
/*
* Use string functions to copy memory.
* this is usually a loss, even with glibc's optimized memcpy
*/
#ifndef USE_MEMCPY
#ifdef _MSC_VER
# define USE_MEMCPY 0
#else
# define USE_MEMCPY 1
#endif
#endif
/*
* You may choose to pre-set the hash table (might be faster on some
* modern cpus and large (>>64k) blocks)
* modern cpus and large (>>64k) blocks, and also makes compression
* deterministic/repeatable when the configuration otherwise is the same).
*/
#ifndef INIT_HTAB
# define INIT_HTAB 1
@@ -88,15 +76,15 @@
/*
* Avoid assigning values to errno variable? for some embedding purposes
* (linux kernel for example), this is neccessary. NOTE: this breaks
* the documentation in lzf.h.
* (linux kernel for example), this is necessary. NOTE: this breaks
* the documentation in lzf.h. Avoiding errno has no speed impact.
*/
#ifndef AVOID_ERRNO
# define AVOID_ERRNO 0
#endif
/*
* Wether to pass the LZF_STATE variable as argument, or allocate it
* Whether to pass the LZF_STATE variable as argument, or allocate it
* on the stack. For small-stack environments, define this to 1.
* NOTE: this breaks the prototype in lzf.h.
*/
@@ -105,51 +93,109 @@
#endif
/*
* Wether to add extra checks for input validity in lzf_decompress
* Whether to add extra checks for input validity in lzf_decompress
* and return EINVAL if the input stream has been corrupted. This
* only shields against overflowing the input buffer and will not
* detect most corrupted streams.
* This check is not normally noticable on modern hardware
* This check is not normally noticeable on modern hardware
* (<1% slowdown), but might slow down older cpus considerably.
*/
#ifndef CHECK_INPUT
# define CHECK_INPUT 1
#endif
/*
* Whether the target CPU has a slow multiplication. This affects
* the default hash function for the compressor, and enables a slightly
* worse hash function that needs only shifts.
*/
#ifndef MULTIPLICATION_IS_SLOW
# define MULTIPLICATION_IS_SLOW 0
#endif
/*
* If defined, then this data type will be used for storing offsets.
* This can be useful if you want to use a huge hashtable, want to
* conserve memory, or both, and your data fits into e.g. 64kb.
* If instead you want to compress data > 4GB, then it's better to
* to "#define LZF_USE_OFFSETS 0" instead.
*/
/*#define LZF_HSLOT unsigned short*/
/*
* Whether to store pointers or offsets inside the hash table. On
* 64 bit architetcures, pointers take up twice as much space,
* and might also be slower. Default is to autodetect.
*/
/*#define LZF_USE_OFFSETS autodetect */
/*
* Whether to optimise code for size, at the expense of speed. Use
* this when you are extremely tight on memory, perhaps in combination
* with AVOID_ERRNO 1 and CHECK_INPUT 0.
*/
#ifndef OPTIMISE_SIZE
# ifdef __OPTIMIZE_SIZE__
# define OPTIMISE_SIZE 1
# else
# define OPTIMISE_SIZE 0
# endif
#endif
/*****************************************************************************/
/* nothing should be changed below */
typedef unsigned char u8;
typedef const u8 *LZF_STATE[1 << (HLOG)];
#if !STRICT_ALIGN
/* for unaligned accesses we need a 16 bit datatype. */
# include <string.h>
# include <limits.h>
# if USHRT_MAX == 65535
typedef unsigned short u16;
# elif UINT_MAX == 65535
typedef unsigned int u16;
# else
# undef STRICT_ALIGN
# define STRICT_ALIGN 1
# endif
#endif
#if ULTRA_FAST
# if defined(VERY_FAST)
# undef VERY_FAST
# undef VERY_FAST
#endif
#ifndef LZF_USE_OFFSETS
# ifdef _WIN32
# define LZF_USE_OFFSETS defined(_M_X64)
# else
# include <stdint.h>
# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU)
# endif
#endif
#if USE_MEMCPY || INIT_HTAB
# ifdef __cplusplus
# include <cstring>
typedef unsigned char u8;
#ifdef LZF_HSLOT
# define LZF_HSLOT_BIAS ((const u8 *)in_data)
#else
# ifdef LZF_USE_OFFSETS
# define LZF_HSLOT_BIAS ((const u8 *)in_data)
typedef unsigned int LZF_HSLOT;
# else
# include <string.h>
# define LZF_HSLOT_BIAS 0
typedef const u8 *LZF_HSLOT;
# endif
#endif
#if USHRT_MAX == 65535
typedef unsigned short u16;
#elif UINT_MAX == 65535
typedef unsigned int u16;
#else
# undef STRICT_ALIGN
# define STRICT_ALIGN 1
#endif
#define LZF_MAX_LIT (1 << 5)
#define LZF_MAX_OFF (1 << 13)
#define LZF_MAX_REF ((1 << 8) + (1 << 3))
typedef LZF_HSLOT LZF_STATE[1 << (HLOG)];
typedef struct
{
const u8 *first [1 << (6+8)]; /* most recent occurance of a match */
u16 prev [LZF_MAX_OFF]; /* how many bytes to go backwards for the next match */
} LZF_STATE_BEST[1];
#endif
@@ -164,14 +210,31 @@ typedef const u8 *LZF_STATE[1 << (HLOG)];
# define SET_ERRNO(n) errno = (n)
#endif
#ifndef USE_REP_MOVSB
#if (defined (__i386) || defined (__amd64)) && __GNUC__ >= 3
#define USE_REP_MOVSB 1
#else
#define USE_REP_MOVSB 0 // Default to 0 if not defined elsewhere
#endif
#endif
#if USE_REP_MOVSB /* small win on amd, big loss on intel */
#if (defined (__i386) || defined (__amd64)) && __GNUC__ >= 3
# define lzf_movsb(dst, src, len) \
asm ("rep movsb" \
: "=D" (dst), "=S" (src), "=c" (len) \
: "0" (dst), "1" (src), "2" (len));
#endif
#endif
size_t
lzf_decompress (const void *const in_data, size_t in_len,
void *out_data, size_t out_len)
void *out_data, size_t out_len)
{
u8 const *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data;
u8 *op = (u8 *)out_data;
u8 const *const in_end = ip + in_len;
u8 *const out_end = op + out_len;
u8 *const out_end = op + out_len;
do
{
@@ -195,14 +258,23 @@ lzf_decompress (const void *const in_data, size_t in_len,
}
#endif
#if USE_MEMCPY
M_Memcpy (op, ip, ctrl);
op += ctrl;
ip += ctrl;
#else
do
#ifdef lzf_movsb
lzf_movsb (op, ip, ctrl);
#elif OPTIMISE_SIZE
while (ctrl--)
*op++ = *ip++;
while (--ctrl);
#else
switch (ctrl)
{
case 32: *op++ = *ip++; case 31: *op++ = *ip++; case 30: *op++ = *ip++; case 29: *op++ = *ip++;
case 28: *op++ = *ip++; case 27: *op++ = *ip++; case 26: *op++ = *ip++; case 25: *op++ = *ip++;
case 24: *op++ = *ip++; case 23: *op++ = *ip++; case 22: *op++ = *ip++; case 21: *op++ = *ip++;
case 20: *op++ = *ip++; case 19: *op++ = *ip++; case 18: *op++ = *ip++; case 17: *op++ = *ip++;
case 16: *op++ = *ip++; case 15: *op++ = *ip++; case 14: *op++ = *ip++; case 13: *op++ = *ip++;
case 12: *op++ = *ip++; case 11: *op++ = *ip++; case 10: *op++ = *ip++; case 9: *op++ = *ip++;
case 8: *op++ = *ip++; case 7: *op++ = *ip++; case 6: *op++ = *ip++; case 5: *op++ = *ip++;
case 4: *op++ = *ip++; case 3: *op++ = *ip++; case 2: *op++ = *ip++; case 1: *op++ = *ip++;
}
#endif
}
else /* back reference */
@@ -244,12 +316,49 @@ lzf_decompress (const void *const in_data, size_t in_len,
return 0;
}
*op++ = *ref++;
*op++ = *ref++;
#ifdef lzf_movsb
len += 2;
lzf_movsb (op, ref, len);
#elif OPTIMISE_SIZE
len += 2;
do
*op++ = *ref++;
while (--len);
#else
switch (len)
{
default:
len += 2;
if (op >= ref + len)
{
/* disjunct areas */
memcpy (op, ref, len);
op += len;
}
else
{
/* overlapping, use octet by octet copying */
do
*op++ = *ref++;
while (--len);
}
break;
case 9: *op++ = *ref++;
case 8: *op++ = *ref++;
case 7: *op++ = *ref++;
case 6: *op++ = *ref++;
case 5: *op++ = *ref++;
case 4: *op++ = *ref++;
case 3: *op++ = *ref++;
case 2: *op++ = *ref++;
case 1: *op++ = *ref++;
case 0: *op++ = *ref++; /* two octets more */
*op++ = *ref++;
}
#endif
}
}
while (ip < in_end);
@@ -266,23 +375,29 @@ lzf_decompress (const void *const in_data, size_t in_len,
/*
* don't play with this unless you benchmark!
* decompression is not dependent on the hash function
* the hashing function might seem strange, just believe me
* the data format is not dependent on the hash function.
* the hash function might seem strange, just believe me,
* it works ;)
*/
#ifndef FRST
# define FRST(p) (((p[0]) << 8) | p[1])
# define NEXT(v,p) (((v) << 8) | p[2])
# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
#endif
/*
* IDX works because it is very similar to a multiplicative hash, e.g.
* ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1))
* the latter is also quite fast on newer CPUs, and sligthly better
*
* the next one is also quite good, albeit slow ;)
* (int)(cos(h & 0xffffff) * 1e6)
# if MULTIPLICATION_IS_SLOW
# if ULTRA_FAST
# define IDX(h) ((( h >> (3*8 - HLOG)) - h ) & (HSIZE - 1))
# elif VERY_FAST
# define IDX(h) ((( h >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
# else
# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
# endif
# else
/* this one was developed with sesse,
* and is very similar to the one in snappy.
* it does need a modern enough cpu with a fast multiplication.
*/
# define IDX(h) (((h * 0x1e35a7bdU) >> (32 - HLOG - 8)) & (HSIZE - 1))
# endif
#endif
#if 0
/* original lzv-like hash function, much worse and thus slower */
@@ -291,177 +406,214 @@ lzf_decompress (const void *const in_data, size_t in_len,
# define IDX(h) ((h) & (HSIZE - 1))
#endif
#define MAX_LIT (1 << 5)
#define MAX_OFF (1 << 13)
#define MAX_REF ((1 << 8) + (1 << 3))
#if __GNUC__ >= 3
# define expect(expr,value) __builtin_expect ((expr),(value))
# define inline inline
#else
# define expect(expr,value) (expr)
# define inline static
#endif
#define expect_false(expr) expect ((expr) != 0, 0)
#define expect_true(expr) expect ((expr) != 0, 1)
/*
* compressed format
*
* 000LLLLL <L+1> ; literal
* LLLooooo oooooooo ; backref L
* 111ooooo LLLLLLLL oooooooo ; backref L+7
* 000LLLLL <L+1> ; literal, L+1=1..33 octets
* LLLooooo oooooooo ; backref L+1=1..7 octets, o+1=1..4096 offset
* 111ooooo LLLLLLLL oooooooo ; backref L+8 octets, o+1=1..4096 offset
*
*/
size_t
lzf_compress (const void *const in_data,size_t in_len,
void *out_data, size_t out_len
lzf_compress (const void *const in_data, size_t in_len,
void *out_data, size_t out_len
#if LZF_STATE_ARG
, LZF_STATE *htab
, LZF_STATE htab
#endif
)
)
{
#if !LZF_STATE_ARG
LZF_STATE htab;
#endif
const u8 **hslot;
const u8 *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data;
u8 *op = (u8 *)out_data;
const u8 *in_end = ip + in_len;
u8 *out_end = op + out_len;
const u8 *ref = NULL;
u8 *out_end = op + out_len;
const u8 *ref;
/*
* off requires a type wide enough to hold a general pointer difference.
* ISO C doesn't have that (size_t might not be enough and ptrdiff_t only
* works for differences within a single object). We also assume that
* no bit pattern traps. Since the only platform that is both non-POSIX
* and fails to support both assumptions is windows 64 bit, we make a
* special workaround for it.
*/
unsigned int hval = FRST (ip);
size_t off;
int lit = 0;
unsigned int hval;
int lit;
if (!in_len || !out_len)
return 0;
#if INIT_HTAB
# if USE_MEMCPY
memset (htab, 0, sizeof (htab));
# else
for (hslot = htab; hslot < htab + HSIZE; hslot++)
*hslot++ = ip;
# endif
#endif
for (;;)
lit = 0; op++; /* start run */
hval = FRST (ip);
while (ip < in_end - 2)
{
if (ip < in_end - 2)
{
hval = NEXT (hval, ip);
hslot = htab + IDX (hval);
ref = *hslot; *hslot = ip;
LZF_HSLOT *hslot;
if (
#if INIT_HTAB && !USE_MEMCPY
ref < ip /* the next test will actually take care of this, but this is faster */
&&
hval = NEXT (hval, ip);
hslot = htab + IDX (hval);
ref = *hslot + LZF_HSLOT_BIAS; *hslot = ip - LZF_HSLOT_BIAS;
if (1
#if INIT_HTAB
&& ref < ip /* the next test will actually take care of this, but this is faster */
#endif
(off = ip - ref - 1) < MAX_OFF
&& ip + 4 < in_end
&& ref > (const u8 *)in_data
&& (off = ip - ref - 1) < LZF_MAX_OFF
&& ref > (const u8 *)in_data
&& ref[2] == ip[2]
#if STRICT_ALIGN
&& ref[0] == ip[0]
&& ref[1] == ip[1]
&& ref[2] == ip[2]
&& ((ref[1] << 8) | ref[0]) == ((ip[1] << 8) | ip[0])
#else
&& *(const u16 *)ref == *(const u16 *)ip
&& ref[2] == ip[2]
&& *(const u16 *)ref == *(const u16 *)ip
#endif
)
{
/* match found at *ref++ */
unsigned int len = 2;
size_t maxlen = in_end - ip - len;
maxlen = maxlen > MAX_REF ? MAX_REF : maxlen;
)
{
/* match found at *ref++ */
unsigned int len = 2;
size_t maxlen = in_end - ip - len;
maxlen = maxlen > LZF_MAX_REF ? LZF_MAX_REF : maxlen;
if (op + lit + 1 + 3 >= out_end)
if (expect_false (op + 3 + 1 >= out_end)) /* first a faster conservative test */
if (op - !lit + 3 + 1 >= out_end) /* second the exact but rare test */
return 0;
op [- lit - 1] = lit - 1; /* stop run */
op -= !lit; /* undo run if length is zero */
for (;;)
{
if (expect_true (maxlen > 16))
{
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break;
}
do
len++;
while (len < maxlen && ref[len] == ip[len]);
if (lit)
{
*op++ = (u8)(lit - 1);
lit = -lit;
do
*op++ = ip[lit];
while (++lit);
}
break;
}
len -= 2;
ip++;
len -= 2; /* len is now #octets - 1 */
ip++;
if (len < 7)
{
*op++ = (u8)((off >> 8) + (len << 5));
}
else
{
*op++ = (u8)((off >> 8) + ( 7 << 5));
*op++ = (u8)(len - 7);
}
if (len < 7)
{
*op++ = (off >> 8) + (len << 5);
}
else
{
*op++ = (off >> 8) + ( 7 << 5);
*op++ = len - 7;
}
*op++ = (u8)off;
*op++ = off;
lit = 0; op++; /* start run */
ip += len + 1;
if (expect_false (ip >= in_end - 2))
break;
#if ULTRA_FAST || VERY_FAST
ip += len;
#if VERY_FAST && !ULTRA_FAST
--ip;
#endif
hval = FRST (ip);
--ip;
# if VERY_FAST && !ULTRA_FAST
--ip;
# endif
hval = FRST (ip);
hval = NEXT (hval, ip);
htab[IDX (hval)] = ip;
ip++;
hval = NEXT (hval, ip);
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
ip++;
#if VERY_FAST && !ULTRA_FAST
hval = NEXT (hval, ip);
htab[IDX (hval)] = ip;
ip++;
#endif
# if VERY_FAST && !ULTRA_FAST
hval = NEXT (hval, ip);
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
ip++;
# endif
#else
do
{
hval = NEXT (hval, ip);
htab[IDX (hval)] = ip;
ip++;
}
while (len--);
#endif
continue;
ip -= len + 1;
do
{
hval = NEXT (hval, ip);
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
ip++;
}
while (len--);
#endif
}
else if (ip == in_end)
break;
/* one more literal byte we must copy */
lit++;
ip++;
if (lit == MAX_LIT)
else
{
if (op + 1 + MAX_LIT >= out_end)
/* one more literal byte we must copy */
if (expect_false (op >= out_end))
return 0;
*op++ = MAX_LIT - 1;
#if USE_MEMCPY
M_Memcpy (op, ip - MAX_LIT, MAX_LIT);
op += MAX_LIT;
lit = 0;
#else
lit = -lit;
do
*op++ = ip[lit];
while (++lit);
#endif
lit++; *op++ = *ip++;
if (expect_false (lit == LZF_MAX_LIT))
{
op [- lit - 1] = lit - 1; /* stop run */
lit = 0; op++; /* start run */
}
}
}
if (lit)
{
if (op + lit + 1 >= out_end)
return 0;
if (op + 3 > out_end) /* at most 3 bytes can be missing here */
return 0;
*op++ = (u8)(lit - 1);
lit = -lit;
do
*op++ = ip[lit];
while (++lit);
while (ip < in_end)
{
lit++; *op++ = *ip++;
if (expect_false (lit == LZF_MAX_LIT))
{
op [- lit - 1] = lit - 1; /* stop run */
lit = 0; op++; /* start run */
}
}
return op - (u8 *) out_data;
op [- lit - 1] = lit - 1; /* end run */
op -= !lit; /* undo run if length is zero */
return op - (u8 *)out_data;
}
+2 -2
View File
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2000-2005 by Marc Alexander Lehmann <schmorp@schmorp.de>
// Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp@schmorp.de>
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -22,7 +22,7 @@
**
***********************************************************************/
#define LZF_VERSION 0x0105 /* 1.5 */
#define LZF_VERSION 0x0106 /* 1.6 */
/*
* Compress in_len bytes stored at the memory block starting at
-29
View File
@@ -247,35 +247,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
return INT32_MAX;
}
/** \brief The xs_CRoundToInt function
\param val double number
\return Round toward nearest, but ties round toward even
*/
#if defined(SRB2_BIG_ENDIAN)
#define _xs_iexp_ 0
#define _xs_iman_ 1
#else
#define _xs_iexp_ 1 //intel is little endian
#define _xs_iman_ 0
#endif //BigEndian_
typedef double real64;
typedef union _xs_doubleints
{
real64 val;
unsigned ival[2];
} _xs_doubleints;
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
{
_xs_doubleints uval;
uval.val = val + 6755399441055744.0;
return uval.ival[_xs_iman_];
}
typedef struct
{
fixed_t x;
+143 -181
View File
@@ -1160,7 +1160,7 @@ static menuitem_t OP_ControlsMenu[] =
{IT_CALL | IT_STRING, NULL, "Player 3 Controls...", &M_Setup3PControlsMenu, 30},
{IT_CALL | IT_STRING, NULL, "Player 4 Controls...", &M_Setup4PControlsMenu, 40},
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 60},
{IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 80},
@@ -1372,7 +1372,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "Saturation", &cv_globalsaturation , 40},
{IT_SUBMENU|IT_STRING, NULL, "Advanced Color Settings...", &OP_ColorOptionsDef, 50},
{IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 65},
@@ -1484,7 +1484,7 @@ static menuitem_t OP_ColorOptionsMenu[] =
static menuitem_t OP_ExpOptionsMenu[] =
{
{IT_HEADER, NULL, "Advanced Video Options", NULL, 10},
{IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_maxinterpdist, 30},
{IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_grmaxinterpdist, 30},
{IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 40},
{IT_STRING | IT_CVAR, NULL, "Scale Weather with Mobjscale", &cv_mobjscaleprecip, 60},
@@ -1492,15 +1492,15 @@ static menuitem_t OP_ExpOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 80},
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 90},
#ifdef HWRENDER
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 110},
#ifdef HWRENDER
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 100},
#ifdef USE_FBO_OGL
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 120},
#endif
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 140},
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_grframebuffer, 110},
#endif
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_grpalettedepth, 130},
{IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 150},
#endif
};
static const char* OP_ExpTooltips[] =
@@ -1511,13 +1511,13 @@ static const char* OP_ExpTooltips[] =
"Should weather be scaled with Mapobjectscale?.",
"When weather is on this will cut the object amount used in half.",
"Toggle being able to see the sky.",
"Change the FPS counter sampling method\nInaccurate updates slower and might miss frame drops and such\nAccurate updates faster and is more accurate, but might be less readable", // how to ingles??
#ifdef HWRENDER
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
#ifdef USE_FBO_OGL
"Allows the game to downsample from a higher resolution than your display\nin OpenGL renderer mode. Requires a GPU with atleast OpenGL 3.0 support.",
#endif
"Change the depth of the Palette in Palette rendering mode\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.",
"Fixes issues that resulted in Textures sticking from the ground sometimes.\n This may be CPU heavy and result in worse performance in some cases.",
#endif
};
@@ -1529,13 +1529,13 @@ enum
op_exp_precipmoscale,
op_exp_lessprecip,
op_exp_skybox,
op_exp_accuratefps,
#ifdef HWRENDER
op_exp_glscrtx,
op_exp_grscrtx,
#ifdef USE_FBO_OGL
op_exp_fbo,
#endif
op_exp_paldepth,
op_exp_spltwal,
#endif
};
@@ -1543,24 +1543,24 @@ enum
#ifdef HWRENDER
static menuitem_t OP_OpenGLOptionsMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "3D Models", &cv_glmdls, 15},
{IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_glfallbackplayermodel, 20},
{IT_STRING | IT_CVAR, NULL, "Shaders", &cv_glshaders, 25},
{IT_STRING | IT_CVAR, NULL, "Palette Rendering", &cv_glpaletterendering, 30},
{IT_STRING | IT_CVAR, NULL, "Palette Rendering Flashpals",&cv_glflashpal, 35},
{IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_glsecbright, 40},
{IT_STRING | IT_CVAR, NULL, "3D Models", &cv_grmdls, 15},
{IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_grfallbackplayermodel, 20},
{IT_STRING | IT_CVAR, NULL, "Shaders", &cv_grshaders, 25},
{IT_STRING | IT_CVAR, NULL, "Palette Rendering", &cv_grpaletterendering, 30},
{IT_STRING | IT_CVAR, NULL, "Flashpals in Palette Renderer", &cv_grflashpal, 35},
{IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 40},
{IT_STRING | IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 50},
{IT_STRING | IT_CVAR, NULL, "Texture Filter", &cv_glfiltermode, 55},
{IT_STRING | IT_CVAR, NULL, "Anisotropic", &cv_glanisotropicmode, 60},
{IT_STRING | IT_CVAR, NULL, "Visual Portals", &cv_glportals, 65},
{IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 50},
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 55},
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 60},
{IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 65},
{IT_STRING | IT_CVAR, NULL, "Wall Contrast Style", &cv_glfakecontrast, 75},
{IT_STRING | IT_CVAR, NULL, "Slope Contrast", &cv_glslopecontrast, 80},
{IT_STRING | IT_CVAR, NULL, "Dithered Lightning", &cv_gllightdither, 85},
{IT_STRING | IT_CVAR, NULL, "Sprite Billboarding", &cv_glspritebillboarding, 90},
{IT_STRING | IT_CVAR, NULL, "Software Perspective", &cv_glshearing, 95},
{IT_STRING | IT_CVAR, NULL, "Rendering Distance", &cv_glrenderdistance, 100},
{IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 75},
{IT_STRING|IT_CVAR, NULL, "Slope Contrast", &cv_grslopecontrast, 80},
{IT_STRING | IT_CVAR, NULL, "Dithered Lightning", &cv_lightdither, 85},
{IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 90},
{IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 95},
{IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 100},
};
static const char* OP_OpenGLTooltips[] =
@@ -1577,32 +1577,11 @@ static const char* OP_OpenGLTooltips[] =
"Recreates an effect from software mode that is used on some maps.",
"The look of the wall contrast effect.",
"Wall contrast but for slopes.",
"Should shader lightning be dithered?",
"Should OpenGL lightning be dithered?",
"Should sprites always face the camera?",
"Recreates the look of software mode camera perspective.",
"How far the game world should be drawn.",
};
enum
{
op_gl_mdls,
op_gl_falbckmdls,
op_gl_shader,
op_gl_palrender,
op_gl_flashpal,
op_gl_secbright,
op_gl_scrdepth,
op_gl_filter,
op_gl_anis,
op_gl_portal,
op_gl_wallcont,
op_gl_slopecont,
op_gl_lightdither,
op_gl_bill,
op_gl_shearing,
op_gl_renderdist,
};
#endif
static menuitem_t OP_SoundOptionsMenu[] =
@@ -1629,7 +1608,7 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 75},
{IT_STRING|IT_CVAR, NULL, "Hit Em Delay", &cv_karthitemdialog, 85},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95},
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 105},
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 115},
@@ -1643,7 +1622,7 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 85},
{IT_STRING|IT_CVAR, NULL, "Hit Em Delay", &cv_karthitemdialog, 95},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 105},
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 115},
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 125},
@@ -1704,7 +1683,7 @@ static const char* OP_SoundAdvancedTooltips[] =
{
#ifdef HAVE_OPENMPT
NULL,
"Filter used to resample tracker instruments.",
"Resample tracker modules to sound similar to Paula hardware.",
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
@@ -1817,7 +1796,7 @@ static menuitem_t OP_HUDOptionsMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "Show HUD (F3)", &cv_showhud, 10},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "HUD Visibility", &cv_translucenthud, 20},
NULL, "HUD Visibility", &cv_translucenthud, 20},
{IT_STRING | IT_SUBMENU, NULL, "Online HUD options...", &OP_ChatOptionsDef, 35},
{IT_STRING | IT_CVAR, NULL, "Background Glass", &cons_backcolor, 45},
@@ -1833,9 +1812,9 @@ static menuitem_t OP_HUDOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120},
{IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 135},
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 145},
{IT_STRING | IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 155},
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 165},
@@ -2087,7 +2066,7 @@ static menuitem_t OP_AdvServerOptionsMenu[] =
};
static const char* OP_AdvServerOptionsTooltips[] =
{
{
"Server used for master server.",
"Attempts to resynchronise player to server.",
#ifdef SATURNSYNCH
@@ -2351,6 +2330,7 @@ enum
sh_hudoffsets,
};
static menuitem_t OP_HudOffsetMenu[] =
{
{IT_HEADER, NULL, "Kart Hud Offsets", NULL, 0},
@@ -2404,7 +2384,7 @@ static menuitem_t OP_SaturnCreditsMenu[] =
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 80},
{IT_STRING+IT_SPACE, NULL, "", NULL, 83}, // dummy text
{IT_STRING+IT_SPACE, NULL, "", NULL, 83}, // dummy text
{IT_STRING2+IT_SPACE, NULL, "Sunflower aka AnimeSonic", NULL, 90},
{IT_STRING2+IT_SPACE, NULL, "Yuz aka Yuzler", NULL, 100},
@@ -3412,7 +3392,7 @@ void PDistort_menu_Onchange(void)
OP_PlayerDistortMenu[slrotatedist].status = IT_STRING | IT_CVAR;
else
OP_PlayerDistortMenu[slrotatedist].status = IT_GRAYEDOUT;
if ((cv_sloperoll.value == 2) && (cv_spriteroll.value)) //enable/disable sparkroll depending on which setting
OP_PlayerDistortMenu[sparkrotate].status = IT_STRING | IT_CVAR;
else
@@ -3441,7 +3421,7 @@ void Bird_menu_Onchange(void)
OP_AdvancedBirdMenu[fadegrow].status = status;
OP_AdvancedBirdMenu[respawnfadeout].status = status;
OP_AdvancedBirdMenu[respawnfadein].status = status;
if (cv_birdmusic.value)
{
OP_BirdMenu[lvlresum].status = IT_STRING | IT_CVAR;
@@ -3453,7 +3433,7 @@ void Bird_menu_Onchange(void)
OP_BirdMenu[lvlresum].status = IT_GRAYEDOUT;
OP_BirdMenu[spclresum].status = IT_GRAYEDOUT;
OP_BirdMenu[advmusic].status = IT_GRAYEDOUT;
}
}
}
//menu code is nice
@@ -3465,30 +3445,11 @@ void SaturnHud_menu_Onchange(void)
status = IT_STRING | IT_CVAR;
else
status = IT_GRAYEDOUT;
OP_SaturnHudMenu[sh_coloritem].status = status;
OP_SaturnHudMenu[sh_colorhud_customcolor].status = status;
}
#ifdef HWRENDER
void M_UpdateOGLMenu(void)
{
#ifdef USE_FBO_OGL
OP_ExpOptionsMenu[op_exp_fbo].status = (!supportFBO || cv_glscreentextures.value != 2) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
#endif
OP_ExpOptionsMenu[op_exp_paldepth].status = (!HWR_ShouldUsePaletteRendering()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_falbckmdls].status = (!cv_glmdls.value) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_lightdither].status = (!HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_secbright].status = (!HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_palrender].status = (cv_glscreentextures.value != 2 || !HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_flashpal].status = (!HWR_ShouldUsePaletteRendering()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
}
#endif
// ==========================================================================
// END ORGANIZATION STUFF.
// ==========================================================================
@@ -4359,9 +4320,9 @@ void M_Drawer(void)
#ifdef HWRENDER
if (rendermode == render_opengl)
V_DrawThinString(0, 0, V_GREENMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Opengl"));
#endif
#endif
if (rendermode == render_soft)
V_DrawThinString(0, 0, V_REDMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Software"));
V_DrawThinString(0, 0, V_REDMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Software"));
}
}
}
@@ -4452,18 +4413,18 @@ void M_StartControlPanel(void)
MPauseMenu[mpause_psetup].status = IT_DISABLED;
MISC_ChangeTeamMenu[0].status = IT_DISABLED;
MISC_ChangeSpectateMenu[0].status = IT_DISABLED;
MPauseMenu[mpause_addlocalskins].status = IT_STRING | IT_CALL;
MPauseMenu[mpause_localskin].status = IT_STRING | IT_CALL;
// Reset these in case splitscreen messes things up
MPauseMenu[mpause_addons].alphaKey = 8;
if (IsPlayerAdmin(consoleplayer))
MPauseMenu[mpause_addlocalskins].alphaKey = 16;
else
MPauseMenu[mpause_addlocalskins].alphaKey = 24;
MPauseMenu[mpause_scramble].alphaKey = 8;
MPauseMenu[mpause_switchmap].alphaKey = 24;
@@ -4484,17 +4445,17 @@ void M_StartControlPanel(void)
if (G_GametypeHasTeams())
MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU;
}
if (server || (!cv_showlocalskinmenus.value))
{
MPauseMenu[mpause_addlocalskins].status = IT_DISABLED;
MPauseMenu[mpause_localskin].status = IT_DISABLED;
MPauseMenu[mpause_options].alphaKey = 64;
MPauseMenu[mpause_title].alphaKey = 80;
MPauseMenu[mpause_quit].alphaKey = 88;
}
if (splitscreen)
{
@@ -4759,12 +4720,11 @@ void M_Init(void)
if (rendermode == render_soft)
{
OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED;
OP_ExpOptionsMenu[op_exp_glscrtx].status = IT_DISABLED;
OP_ExpOptionsMenu[op_exp_grscrtx].status = IT_DISABLED;
#ifdef USE_FBO_OGL
OP_ExpOptionsMenu[op_exp_fbo].status = IT_DISABLED;
#endif
OP_ExpOptionsMenu[op_exp_paldepth].status = IT_DISABLED;
OP_ExpOptionsMenu[op_exp_spltwal].status = IT_DISABLED;
}
if (rendermode == render_opengl)
@@ -4773,25 +4733,15 @@ void M_Init(void)
if (!supportFBO)
OP_ExpOptionsMenu[op_exp_fbo].status = IT_GRAYEDOUT;
#endif
if (!gl_shadersavailable)
{
OP_OpenGLOptionsMenu[op_gl_shader].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_lightdither].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_secbright].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_palrender].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_flashpal].status = IT_GRAYEDOUT;
OP_ExpOptionsMenu[op_exp_paldepth].status = IT_GRAYEDOUT;
}
}
#endif
if (!xtra_speedo && !kartzspeedo && !achi_speedo) // why bother?
OP_SaturnHudMenu[sh_speedometer].status = IT_GRAYEDOUT;
//if (!xtra_speedo && kartzspeedo)
//OP_SaturnMenu[sm_speedometer].text = "Speedometer (No Small)";
//if (xtra_speedo && !kartzspeedo)
//OP_SaturnMenu[sm_speedometer].text = "Speedometer (No PMeter)";
// idk i dont wanna bother with this tbh lmao
@@ -5127,7 +5077,7 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
yoffset = (((5*10 - num_lines*10)));
// Draw BG first,,,
for (int i = 0; i < num_lines; i++)
for (int i = 0; i < num_lines; i++)
{
V_DrawFill(0, (y + yoffset - 6)+5, vid.width, 11, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
yoffset += 11;
@@ -5136,7 +5086,7 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
yoffset = (((5*10 - num_lines*10)));
// THEN the text
for (int i = 0; i < num_lines; i++)
for (int i = 0; i < num_lines; i++)
{
V_DrawCenteredThinString(x, y + yoffset, option, clines[i]);
V_DrawCenteredThinString(x, y + yoffset, option|V_YELLOWMAP|((9 - alpha) << V_ALPHASHIFT), clines[i]);
@@ -5152,6 +5102,8 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
static void M_DrawGenericMenu(void)
{
INT32 x, y, w, i, cursory = 0;
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
// DRAW MENU
x = currentMenu->x;
@@ -5198,9 +5150,9 @@ static void M_DrawGenericMenu(void)
cursory = y;
if ((currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
V_DrawString(x, y, MENUCAPS, currentMenu->menuitems[i].text);
V_DrawString(x, y, lowercase, currentMenu->menuitems[i].text);
else
V_DrawString(x, y, MENUCAPS|highlightflags, currentMenu->menuitems[i].text);
V_DrawString(x, y, lowercase|highlightflags, currentMenu->menuitems[i].text);
// Cvar specific handling
switch (currentMenu->menuitems[i].status & IT_TYPE)
@@ -5227,7 +5179,7 @@ static void M_DrawGenericMenu(void)
default:
w = V_StringWidth(cv->string, 0);
V_DrawString(BASEVIDWIDTH - x - w, y,
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|MENUCAPS, cv->string);
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|lowercase, cv->string);
if (i == itemOn)
{
V_DrawCharacter(BASEVIDWIDTH - x - 10 - w - (skullAnimCounter/5), y,
@@ -5242,7 +5194,7 @@ static void M_DrawGenericMenu(void)
y += STRINGHEIGHT;
break;
case IT_STRING2:
V_DrawString(((BASEVIDWIDTH - V_StringWidth(currentMenu->menuitems[i].text, 0))>>1), y, MENUCAPS, currentMenu->menuitems[i].text);
V_DrawString(((BASEVIDWIDTH - V_StringWidth(currentMenu->menuitems[i].text, 0))>>1), y, lowercase, currentMenu->menuitems[i].text);
/* FALLTHRU */
case IT_DYLITLSPACE:
y += SMALLLINEHEIGHT;
@@ -5258,21 +5210,21 @@ static void M_DrawGenericMenu(void)
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
/* FALLTHRU */
case IT_TRANSTEXT2:
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, currentMenu->menuitems[i].text);
V_DrawString(x, y, V_TRANSLUCENT|lowercase, currentMenu->menuitems[i].text);
y += SMALLLINEHEIGHT;
break;
case IT_QUESTIONMARKS:
if (currentMenu->menuitems[i].alphaKey)
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING|MENUCAPS, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING|lowercase, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
y += SMALLLINEHEIGHT;
break;
case IT_HEADERTEXT: // draws 16 pixels to the left, in yellow text
if (currentMenu->menuitems[i].alphaKey)
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
V_DrawString(x-16, y, highlightflags|MENUCAPS, currentMenu->menuitems[i].text);
V_DrawString(x-16, y, highlightflags|lowercase, currentMenu->menuitems[i].text);
y += SMALLLINEHEIGHT;
break;
}
@@ -5289,7 +5241,7 @@ static void M_DrawGenericMenu(void)
{
V_DrawScaledPatch(currentMenu->x - 24, cursory, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
V_DrawString(currentMenu->x, cursory, MENUCAPS|highlightflags, currentMenu->menuitems[itemOn].text);
V_DrawString(currentMenu->x, cursory, lowercase|highlightflags, currentMenu->menuitems[itemOn].text);
}
// dumb hack
@@ -5366,6 +5318,8 @@ static void M_DrawGenericScrollMenu(void)
// draw title (or big pic)
M_DrawMenuTitle();
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
for (; i < max; i++)
{
@@ -5383,9 +5337,9 @@ static void M_DrawGenericScrollMenu(void)
case IT_STRING:
case IT_WHITESTRING:
if (i != itemOn && (currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
V_DrawString(x, y, MENUCAPS, currentMenu->menuitems[i].text);
V_DrawString(x, y, lowercase, currentMenu->menuitems[i].text);
else
V_DrawString(x, y, MENUCAPS|highlightflags, currentMenu->menuitems[i].text);
V_DrawString(x, y, lowercase|highlightflags, currentMenu->menuitems[i].text);
// Cvar specific handling
switch (currentMenu->menuitems[i].status & IT_TYPE)
@@ -5407,12 +5361,12 @@ static void M_DrawGenericScrollMenu(void)
if (itemOn == i)
M_DrawTextInput(x + 8, y + 12, &menuinput, 0);
else
V_DrawString(x + 8, y + 12, MENUCAPS, cv->string);
V_DrawString(x + 8, y + 12, lowercase, cv->string);
break;
default:
V_DrawRightAlignedString(BASEVIDWIDTH - x, y,
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : highlightflags)|MENUCAPS, cv->string);
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : highlightflags)|lowercase, cv->string);
if (i == itemOn)
{
V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y,
@@ -5426,13 +5380,13 @@ static void M_DrawGenericScrollMenu(void)
}
break;
case IT_TRANSTEXT:
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, currentMenu->menuitems[i].text);
V_DrawString(x, y, V_TRANSLUCENT|lowercase, currentMenu->menuitems[i].text);
break;
case IT_QUESTIONMARKS:
V_DrawString(x, y, MENUCAPS|V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
V_DrawString(x, y, lowercase|V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
break;
case IT_HEADERTEXT:
V_DrawString(x-16, y, highlightflags|MENUCAPS, currentMenu->menuitems[i].text);
V_DrawString(x-16, y, highlightflags|lowercase, currentMenu->menuitems[i].text);
break;
}
}
@@ -5486,6 +5440,8 @@ static void M_DrawCenteredMenu(void)
// draw title (or big pic)
M_DrawMenuTitle();
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
for (i = 0; i < currentMenu->numitems; i++)
{
@@ -5525,9 +5481,9 @@ static void M_DrawCenteredMenu(void)
cursory = y;
if ((currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
V_DrawCenteredString(x, y, MENUCAPS, currentMenu->menuitems[i].text);
V_DrawCenteredString(x, y, lowercase, currentMenu->menuitems[i].text);
else
V_DrawCenteredString(x, y, highlightflags|MENUCAPS, currentMenu->menuitems[i].text);
V_DrawCenteredString(x, y, highlightflags|lowercase, currentMenu->menuitems[i].text);
// Cvar specific handling
switch(currentMenu->menuitems[i].status & IT_TYPE)
@@ -5552,7 +5508,7 @@ static void M_DrawCenteredMenu(void)
break;
default:
V_DrawString(BASEVIDWIDTH - x - V_StringWidth(cv->string, 0), y,
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|MENUCAPS, cv->string);
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|lowercase, cv->string);
break;
}
break;
@@ -5560,7 +5516,7 @@ static void M_DrawCenteredMenu(void)
y += STRINGHEIGHT;
break;
case IT_STRING2:
V_DrawCenteredString(x, y, MENUCAPS, currentMenu->menuitems[i].text);
V_DrawCenteredString(x, y, lowercase, currentMenu->menuitems[i].text);
/* FALLTHRU */
case IT_DYLITLSPACE:
y += SMALLLINEHEIGHT;
@@ -5569,7 +5525,7 @@ static void M_DrawCenteredMenu(void)
if (currentMenu->menuitems[i].alphaKey)
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
V_DrawCenteredString(x, y, V_TRANSLUCENT|V_OLDSPACING|MENUCAPS, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
V_DrawCenteredString(x, y, V_TRANSLUCENT|V_OLDSPACING|lowercase, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
y += SMALLLINEHEIGHT;
break;
case IT_GRAYPATCH:
@@ -5592,7 +5548,7 @@ static void M_DrawCenteredMenu(void)
{
V_DrawScaledPatch(x - V_StringWidth(currentMenu->menuitems[itemOn].text, 0)/2 - 24, cursory, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
V_DrawCenteredString(x, cursory, highlightflags|MENUCAPS, currentMenu->menuitems[itemOn].text);
V_DrawCenteredString(x, cursory, highlightflags|lowercase, currentMenu->menuitems[itemOn].text);
}
}
@@ -6413,7 +6369,7 @@ static void M_AddonAutoLoad(INT32 ch)
S_StartSound(NULL, sfx_s26d);
return;
}
// first, find the file //
path = va("%s"PATHSEP"%s", srb2home, AUTOLOADCONFIGFILENAME);
autoloadconfigfile = fopen(path, "a");
@@ -6428,7 +6384,7 @@ static void M_AddonAutoLoad(INT32 ch)
case EXT_CFG:
CONS_Printf("Added the \x82%s\x80 console script to the autoload configuration list.\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
fprintf(autoloadconfigfile, "%s\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
S_StartSound(NULL, sfx_s221);
break;
case EXT_LUA:
@@ -6441,7 +6397,7 @@ static void M_AddonAutoLoad(INT32 ch)
{
CONS_Printf("Added \x82%s\x80 to the autoload configuration list.\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
fprintf(autoloadconfigfile, "%s\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
S_StartSound(NULL, sfx_s221);
}
else
@@ -6451,7 +6407,7 @@ static void M_AddonAutoLoad(INT32 ch)
}
break;
}
// lastly, do some last things and close the autoload config file //
fclose(autoloadconfigfile);
}
@@ -6655,7 +6611,7 @@ static void M_HandleAddons(INT32 choice)
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, AUTOLOADCONFIGFILENAME) == 0)
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartserv.cfg") == 0)
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartexec.cfg") == 0))
{
{
M_StartMessage(va("%c%s\x80\nYou can't autoload this builds' base console scripts, silly!\n They're already autoloaded on startup! \n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
S_StartSound(NULL, sfx_s26d);
}
@@ -7098,11 +7054,11 @@ static void DrawReplayHutReplayInfo(void)
switch (demolist[dir_on[menudepthleft]].type)
{
case MD_NOTLOADED:
V_DrawCenteredString(160, 40, V_SNAPTOTOP|MENUCAPS, "Loading replay information...");
V_DrawCenteredString(160, 40, V_SNAPTOTOP, "Loading replay information...");
break;
case MD_INVALID:
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags|MENUCAPS, "This replay cannot be played.");
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags, "This replay cannot be played.");
break;
case MD_SUBDIR:
@@ -7144,7 +7100,7 @@ static void DrawReplayHutReplayInfo(void)
if (mapheaderinfo[demolist[dir_on[menudepthleft]].map-1])
{
char *title = G_BuildMapTitle(demolist[dir_on[menudepthleft]].map);
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
V_DrawString(x, y, V_SNAPTOTOP, title);
Z_Free(title);
}
else
@@ -7161,24 +7117,26 @@ static void DrawReplayHutReplayInfo(void)
{
// No standings were loaded!
V_DrawString(x, y+39, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "No standings available.");
break;
}
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags|MENUCAPS, "Winner");
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags, "WINNER");
V_DrawString(x+38, y+30, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[0].name);
if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
{
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Time");
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags, "TIME");
}
else
{
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Score");
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags, "SCORE");
}
if (demolist[dir_on[menudepthleft]].standings[0].timeorscore == (UINT32_MAX-1))
{
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP|MENUCAPS, "No Contest");
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP, "NO CONTEST");
}
else if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
{
@@ -7924,7 +7882,7 @@ static void M_Options(INT32 choice)
OP_MainMenu[5].status = OP_MainMenu[6].status = (Playing() && !(server || IsPlayerAdmin(consoleplayer))) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU);
OP_MainMenu[10].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_CALL); // Play credits
OP_MainMenu[13].status = (!cv_showlocalskinmenus.value) ? (IT_DISABLED) : (IT_CALL|IT_STRING);
#ifdef HAVE_DISCORDRPC
@@ -8498,14 +8456,14 @@ static void M_DrawMusicTest(void)
if (curplaying && curplaying->authors[0])
V_DrawRightAlignedThinString(BASEVIDWIDTH-16, 46, V_ALLOWLOWERCASE, curplaying->authors);
if (curplaying)
{
if (!curplaying->usage[0])
V_DrawString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s", curplaying->name));
else
V_DrawSmallString(vid.dupx, vid.height - 5*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s - %.255s\n", curplaying->name, curplaying->usage));
if (cv_showmusicfilename.value)
V_DrawSmallString(0, 0, V_SNAPTOTOP|V_SNAPTOLEFT|V_ALLOWLOWERCASE, curplaying->filename);
}
@@ -8651,7 +8609,7 @@ static void M_HandleMusicTest(INT32 choice)
case KEY_ENTER:
S_StopSounds();
S_StopMusic();
curplaying = soundtestdefs[st_sel];
curplaying = soundtestdefs[st_sel];
S_ChangeMusicInternal(curplaying->name, true);
break;
@@ -8948,7 +8906,7 @@ void M_DrawTimeAttackMenu(void)
if (i == itemOn)
cursory = y;
V_DrawString(x, y, ((dispstatus == IT_WHITESTRING) ? highlightflags : 0)|MENUCAPS, currentMenu->menuitems[i].text);
V_DrawString(x, y, (dispstatus == IT_WHITESTRING) ? highlightflags : 0 , currentMenu->menuitems[i].text);
// Cvar specific handling
if ((currentMenu->menuitems[i].status & IT_TYPE) == IT_CVAR)
@@ -8973,7 +8931,7 @@ void M_DrawTimeAttackMenu(void)
soffset = 0;
// Should see nothing but strings
V_DrawString(BASEVIDWIDTH - x - soffset - strw, y, highlightflags|MENUCAPS, str);
V_DrawString(BASEVIDWIDTH - x - soffset - strw, y, highlightflags, str);
if (i == itemOn)
{
@@ -9003,7 +8961,7 @@ void M_DrawTimeAttackMenu(void)
// DRAW THE SKULL CURSOR
V_DrawScaledPatch(x - 24, cursory, 0, W_CachePatchName("M_CURSOR", PU_CACHE));
V_DrawString(x, cursory, highlightflags|MENUCAPS, currentMenu->menuitems[itemOn].text);
V_DrawString(x, cursory, highlightflags, currentMenu->menuitems[itemOn].text);
// Level record list
if (cv_nextmap.value)
@@ -9018,10 +8976,10 @@ void M_DrawTimeAttackMenu(void)
V_DrawFill((BASEVIDWIDTH - dupadjust)>>1, 78, dupadjust, 36, 239);
V_DrawRightAlignedString(149, 80, highlightflags|MENUCAPS, "Best Lap:");
V_DrawRightAlignedString(149, 80, highlightflags, "BEST LAP:");
K_drawKartTimestamp(lap, 19, 86, 0, 2);
V_DrawRightAlignedString(292, 80, highlightflags|MENUCAPS, "Best Time:");
V_DrawRightAlignedString(292, 80, highlightflags, "BEST TIME:");
K_drawKartTimestamp(time, 162, 86, cv_nextmap.value, 1);
}
@@ -9033,7 +8991,7 @@ void M_DrawTimeAttackMenu(void)
for (i = 0; i < 4; ++i)
{
y = currentMenu->y+SP_TimeAttackMenu[i].alphaKey;
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, SP_TimeAttackMenu[i].text);
V_DrawString(x, y, V_TRANSLUCENT, SP_TimeAttackMenu[i].text);
ncv = (consvar_t *)SP_TimeAttackMenu[i].itemaction;
if (SP_TimeAttackMenu[i].status & IT_CV_STRING)
{
@@ -9050,7 +9008,7 @@ void M_DrawTimeAttackMenu(void)
soffset = 0;
// Should see nothing but strings
V_DrawString(BASEVIDWIDTH - x - soffset - strw, y, highlightflags|V_TRANSLUCENT|MENUCAPS, str);
V_DrawString(BASEVIDWIDTH - x - soffset - strw, y, highlightflags|V_TRANSLUCENT, str);
}
}
}
@@ -9516,10 +9474,10 @@ static void M_Connect(INT32 choice)
{
// do not call menuexitfunc
M_ClearMenus(false);
CV_Set(&cv_lastserver, I_GetNodeAddress(serverlist[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE].node));
COM_BufAddText(va("connect node %d\n", serverlist[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE].node));
COM_BufAddText(va("connect node %d\n", serverlist[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE].node));
}
static void M_Refresh(INT32 choice)
@@ -9765,7 +9723,7 @@ void M_SortServerList(void)
#ifndef NONET
#ifdef UPDATE_ALERT
#ifdef MASTERSERVER
#ifdef MASTERSERVER
static void M_CheckMODVersion(int id)
{
char updatestring[500];
@@ -10040,9 +9998,9 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
const char *item2 = gamecontrol[gc_fire][1] != 0 ? G_KeynumToString(gamecontrol[gc_fire][1]) : NULL;
if (item1 != NULL && item2 != NULL)
snprintf(encoretoggle, 32, "%s/%s - Toggle Encore", item1, item2);
snprintf(encoretoggle, 32, "%s/%s: Toggle Encore", item1, item2);
else
snprintf(encoretoggle, 32, "%s - Toggle Encore", item1 != NULL ? item1 : item2 != NULL ? item2 : "Item");
snprintf(encoretoggle, 32, "%s: Toggle Encore", item1 != NULL ? item1 : item2 != NULL ? item2 : "Item");
V_DrawThinString(1, BASEVIDHEIGHT-8-1, V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_TRANSLUCENT|V_ALLOWLOWERCASE, encoretoggle);
}
@@ -10080,10 +10038,10 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
len = strlen(addonname);
#define charsonside 14
if (len > charlimit)
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, va("%.*s...%s", charsonside, addonname, addonname+((len-charlimit) + charsonside))); // variable reuse...
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT, va("%.*s...%s", charsonside, addonname, addonname+((len-charlimit) + charsonside))); // variable reuse...
#undef charsonside
else
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, addonname); // variable reuse...
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT, addonname); // variable reuse...
}
if (!cv_kartencore.value || gamestate == GS_TIMEATTACK || cv_newgametype.value != GT_RACE)
@@ -10265,17 +10223,19 @@ static void M_DrawMPMainMenu(void)
// use generic drawer for cursor, items and title
M_DrawGenericMenu();
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
#ifndef NONET
#if MAXPLAYERS != 16
Update the maxplayers label...
#endif
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+MP_MainMenu[4].alphaKey,
((itemOn == 4) ? highlightflags : 0)|MENUCAPS, "(2-16 Players)");
((itemOn == 4) ? highlightflags : 0)|lowercase, "(2-16 Players)");
#endif
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+MP_MainMenu[5].alphaKey,
((itemOn == 5) ? highlightflags : 0)|MENUCAPS,
((itemOn == 5) ? highlightflags : 0)|lowercase,
"(2-4 players)"
);
@@ -10470,7 +10430,7 @@ static void M_ConnectLastServer(INT32 choice)
}
M_ClearMenus(true);
COM_BufAddText(va("connect \"%s\"\n", cv_lastserver.string));
COM_BufAddText(va("connect \"%s\"\n", cv_lastserver.string));
}
// Tails 11-19-2002
@@ -10641,11 +10601,11 @@ static void M_DrawSetupMultiPlayerMenu(void)
statoffset = 0;
tw = V_StringWidth("Character", 0);//V_StringWidth(GETSELECTEDSKINNAME, 0);
st = V_StringWidth(GETSELECTEDSKINNAME, 0);
INT32 selectedskin = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin);
speed = skins[selectedskin].kartspeed;
weight = skins[selectedskin].kartweight;
weight = skins[selectedskin].kartweight;
V_DrawString((mx+(tw/2)) - (st/2), my + 37,
((MP_PlayerSetupMenu[2].status & IT_TYPE) == IT_SPACE ? V_TRANSLUCENT : 0) | highlightflags | V_ALLOWLOWERCASE,
GETSELECTEDSKINNAME);
@@ -10653,7 +10613,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
statoffset = 50;
else
statoffset = 113;
V_DrawString(statx - statoffset, staty - 10, V_6WIDTHSPACE, va("\x84%dS \x87%dW", GETSELECTEDSPEED, GETSELECTEDWEIGHT));
#undef GETSELECTEDSKINNAME
#undef GETSELECTEDSPEED
@@ -10718,7 +10678,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
V_DrawCharacter(mx + 2 + st + (skullAnimCounter/5), my + 164,
'\x1D' | highlightflags, false); // right arrow
}
break;
break;
case SKINMENUTYPE_GRID:
case SKINMENUTYPE_2D:
V_DrawString(mx, my + 152, highlightflags | V_ALLOWLOWERCASE, KartColor_Names[setupm_fakecolor]); // SRB2kart
@@ -10762,8 +10722,8 @@ static void M_DrawSetupMultiPlayerMenu(void)
{
//Background
V_DrawScaledPatch(statx - 50, staty + 4, 0, W_CachePatchName("K_STATNB", PU_CACHE));
//Speed
//Speed
for (i = 0; i < GETSELECTEDSPEED; i++) // draw the stat bars
{
if (i == 0)
@@ -10773,11 +10733,11 @@ static void M_DrawSetupMultiPlayerMenu(void)
else
V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN2", PU_CACHE));
}
//Weight
for (i = 0; i < GETSELECTEDWEIGHT; i++) // draw the stat bars
{
if (i == 0)
V_DrawScaledPatch(statx - 30, staty + 63, 0, W_CachePatchName("K_STATN4", PU_CACHE));
else if (i == GETSELECTEDWEIGHT -1)
@@ -11053,10 +11013,10 @@ static void M_DrawSetupMultiPlayerMenu(void)
#define indexwidth 8
{
INT32 colwidth = ((BASEVIDWIDTH-(2*mx))-charw)/(2*indexwidth);
if (cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED)
colwidth = colwidth - 10;
INT32 j = -colwidth;
INT16 col = setupm_fakecolor - colwidth;
INT32 x = mx;
@@ -11190,7 +11150,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
frame = 0; // Try to use standing frame
sprframe = &sprdef->spriteframes[frame];
//minenice's speen css, it's a piece of shit but hey
//patch = W_CachePatchNum(sprframe->lumppat[1], PU_CACHE);
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
@@ -11260,7 +11220,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
if (setupm_skinselect < ROUNDSKINSUPTO8 - SKINGRIDWIDTH) //if we arent at the bottom of the menu
{
setupm_skinselect += SKINGRIDWIDTH;
if (cv_skinselectmenu.value == SKINMENUTYPE_GRID){
if (setupm_skinselect >= ((setupm_skinypos-1)+SKINGRIDHEIGHT)*8 && setupm_skinypos < (ROUNDSKINSUPTO8/8)-SKINGRIDHEIGHT)
setupm_skinypos++;
@@ -11333,9 +11293,9 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
else if (cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED){
setupm_skinypos = (((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)-2) > 0 ? ((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)-2) : 0);
M_PrevOpt();
}
}
else
M_PrevOpt();
@@ -11796,7 +11756,7 @@ static boolean M_QuitMultiPlayerMenu(void)
}
// you know what? always putting these in the buffer won't hurt anything.
COM_BufAddText (va("%s \"%s\"\n",setupm_cvskin->name,skins[setupm_fakeskin].name));
COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor));
COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor));
return true;
}
@@ -12621,9 +12581,11 @@ static void M_VideoModeMenu(INT32 choice)
static void M_DrawVideoMenu(void)
{
M_DrawGenericMenu();
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + OP_VideoOptionsMenu[0].alphaKey,
(SCR_IsAspectCorrect(vid.width, vid.height) ? recommendedflags : highlightflags)|MENUCAPS,
(SCR_IsAspectCorrect(vid.width, vid.height) ? recommendedflags : highlightflags)|lowercase,
va("%dx%d", vid.width, vid.height));
}
@@ -12712,7 +12674,7 @@ static void M_DrawLocalSkinMenu(void)
else
multi_tics += multi_state->tics * FRACUNIT;
}
// skin 0 is default player sprite
if (R_AnySkinAvailable(cv_fakelocalskin.string) != -1)
{
@@ -12721,7 +12683,7 @@ static void M_DrawLocalSkinMenu(void)
}
else
{
// ATTEMPT TO FIND REAL SKIN
// ATTEMPT TO FIND REAL SKIN
if (R_AnySkinAvailable(cv_skin.string) != -1)
{
sprdef = &allskins[R_AnySkinAvailable(cv_skin.string)].spritedef;
-4
View File
@@ -299,10 +299,6 @@ void Bird_menu_Onchange(void);
// Saturn Hud menu updating
void SaturnHud_menu_Onchange(void);
#ifdef HWRENDER
void M_UpdateOGLMenu(void);
#endif
void M_ReplayHut(INT32 choice);
void M_SetPlaybackMenuPointer(void);
+4 -4
View File
@@ -301,7 +301,7 @@ static boolean PS_IsRowValid(perfstatrow_t *row)
|| (row->flags & PS_SW && rendermode != render_soft)
|| (row->flags & PS_HW && rendermode != render_opengl)
#ifdef HWRENDER
|| (row->flags & PS_BATCHING && !cv_glbatching.value)
|| (row->flags & PS_BATCHING && !cv_grbatching.value)
#endif
);
}
@@ -518,7 +518,7 @@ static void PS_UpdateFrameStats(void)
ps_hw_spritesorttime.value.p +
ps_hw_spritedrawtime.value.p;
if (cv_glbatching.value)
if (cv_grbatching.value)
{
ps_otherrendertime.value.p -=
ps_hw_batchsorttime.value.p +
@@ -547,7 +547,7 @@ static void PS_UpdateFrameStats(void)
PS_UpdateRowHistories(interpolation_rows, true);*/
#ifdef HWRENDER
if (rendermode == render_opengl && cv_glbatching.value)
if (rendermode == render_opengl && cv_grbatching.value)
{
PS_UpdateRowHistories(batchcount_rows, true);
PS_UpdateRowHistories(batchcalls_rows, true);
@@ -760,7 +760,7 @@ static void PS_DrawRenderStats(void)
/*cy = */PS_DrawPerfRows(x, 10, V_BLUEMAP, commoncounter_rows);// + half_row;
#ifdef HWRENDER
if (rendermode == render_opengl && cv_glbatching.value)
if (rendermode == render_opengl && cv_grbatching.value)
{
x = hires ? 200 : 155;
y = PS_DrawPerfRows(x, 10, V_PURPLEMAP, batchcount_rows);
+5 -16
View File
@@ -118,15 +118,6 @@ static void M_TextInputToWordBegin(textinput_t *input, boolean move_sel)
if (move_sel) input->select = input->cursor;
}
static void M_TextInputPaste(textinput_t *input)
{
const char *paste = I_ClipboardPaste();
if (input->select != input->cursor)
M_TextInputDelSelection(input);
if (paste != NULL)
M_TextInputAddString(input, paste);
}
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size)
{
input->buffer = buffer;
@@ -156,12 +147,6 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
|| key == KEY_LALT || key == KEY_RALT)
return false;
if (shiftdown && key == KEY_INS)
{
M_TextInputPaste(input);
return true;
}
if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
{
if (key == 'x' || key == 'X')
@@ -183,7 +168,11 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
}
else if (key == 'v' || key == 'V')
{
M_TextInputPaste(input);
const char *paste = I_ClipboardPaste();
if (input->select != input->cursor)
M_TextInputDelSelection(input);
if (paste != NULL)
M_TextInputAddString(input, paste);
return true;
}
else if (key == 'w' || key == 'W')
+5 -2
View File
@@ -2400,6 +2400,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
UINT8 shouldForce = LUAh_ShouldDamage(target, inflictor, source, damage);
if (P_MobjWasRemoved(target))
return (shouldForce == 1); // mobj was removed
if (P_MobjWasRemoved(source))
source = NULL;
if (shouldForce == 1)
force = true;
else if (shouldForce == 2)
@@ -2636,7 +2638,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
P_ResetPlayer(target->player);
}
else
{
switch (target->type)
{
case MT_EGGMOBILE2: // egg slimer
@@ -2650,7 +2651,9 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
P_SetMobjState(target, target->info->painstate);
break;
}
}
if (P_MobjWasRemoved(target))
return false;
if (!P_MobjWasRemoved(target))
{
+1 -8
View File
@@ -298,14 +298,7 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype
#define P_SpawnNameFinder(s,t) P_SPMAngle(s,t,s->angle,true,0)
#endif
void P_ColorTeamMissile(mobj_t *missile, player_t *source);
// P_MobjFlip
// Special utility to return +1 or -1 depending on mobj's gravity
FUNCINLINE static ATTRINLINE SINT8 P_MobjFlip(const mobj_t *mobj)
{
return (mobj && mobj->eflags & MFE_VERTICALFLIP) ? -1 : 1;
}
SINT8 P_MobjFlip(const mobj_t *mobj);
fixed_t P_GetMobjGravity(mobj_t *mo);
FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
+134 -130
View File
@@ -91,7 +91,6 @@ FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj)
// var2 determines delay between animation frames
if (!(mobj->frame & FF_ANIMATE) || --mobj->anim_duration != 0)
return;
mobj->anim_duration = (UINT16)mobj->state->var2;
// compare the current sprite frame to the one we started from
@@ -352,6 +351,18 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state)
return true;
}
//
// P_MobjFlip
//
// Special utility to return +1 or -1 depending on mobj's gravity
//
SINT8 P_MobjFlip(const mobj_t *mobj)
{
if (mobj && mobj->eflags & MFE_VERTICALFLIP)
return -1;
return 1;
}
//
// P_WeaponOrPanel
//
@@ -397,7 +408,7 @@ void P_ExplodeMissile(mobj_t *mo)
P_RadiusAttack(mo, mo, 96*FRACUNIT);
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
if (explodemo)
if (!P_MobjWasRemoved(explodemo))
{
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
@@ -406,7 +417,7 @@ void P_ExplodeMissile(mobj_t *mo)
S_StartSound(explodemo, sfx_pop);
}
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
if (explodemo)
if (!P_MobjWasRemoved(explodemo))
{
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
@@ -415,7 +426,7 @@ void P_ExplodeMissile(mobj_t *mo)
S_StartSound(explodemo, sfx_dmpain);
}
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
if (explodemo)
if (!P_MobjWasRemoved(explodemo))
{
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
@@ -424,7 +435,7 @@ void P_ExplodeMissile(mobj_t *mo)
S_StartSound(explodemo, sfx_pop);
}
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
if (explodemo)
if (!P_MobjWasRemoved(explodemo))
{
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
@@ -3231,92 +3242,100 @@ void P_DestroyRobots(void)
}
}
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
static void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
// P_CameraThinker
//
// Process the mobj-ish required functions of the camera
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled)
{
const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
UINT16 postimgflags = 0;
boolean itsatwodlevel = false;
boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
postimg_t postimg = postimg_none;
UINT8 i;
if (encoremode)
postimgflags |= POSTIMG_MIRROR;
if (flipcam)
postimgflags |= POSTIMG_FLIP;
// This can happen when joining
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
return true;
if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist
if (twodlevel)
itsatwodlevel = true;
else
{
for (i = 0; i <= splitscreen; i++)
{
if (thiscam == &camera[i] && players[displayplayers[i]].mo
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
{
itsatwodlevel = true;
break;
}
}
}
if (encoremode && !flipcam)
postimg = postimg_mirror;
else if (!encoremode && flipcam)
postimg = postimg_flip;
else if (encoremode && flipcam)
postimg = postimg_mirrorflip;
else if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist
{
camera_t dummycam;
dummycam.subsector = player->awayviewmobj->subsector;
dummycam.x = player->awayviewmobj->x;
dummycam.y = player->awayviewmobj->y;
dummycam.z = player->awayviewmobj->z;
//dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT
dummycam.height = 0; // Why? Remote viewpoint cameras have no height.
// Are we in water?
if (P_CameraCheckWater(&dummycam))
postimgflags |= POSTIMG_WATER;
if (P_CameraCheckHeat(&dummycam))
postimgflags |= POSTIMG_HEAT;
postimg = postimg_water;
else if (P_CameraCheckHeat(&dummycam))
postimg = postimg_heat;
}
else
{
// Are we in water?
if (P_CameraCheckWater(thiscam))
postimgflags |= POSTIMG_WATER;
if (P_CameraCheckHeat(thiscam))
postimgflags |= POSTIMG_HEAT;
postimg = postimg_water;
else if (P_CameraCheckHeat(thiscam))
postimg = postimg_heat;
}
for (i = 0; i <= splitscreen; i++)
if (postimg != postimg_none)
{
if (player != &players[displayplayers[i]])
continue;
for (i = 0; i <= splitscreen; i++)
{
if (player != &players[displayplayers[i]])
continue;
players[displayplayers[i]].postimgflags = postimgflags;
break;
postimgtype[i] = postimg;
}
}
}
// P_CameraThinker
//
// Process the mobj-ish required functions of the camera
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled)
{
// This can happen when joining
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
return true;
P_CalcChasePostImg(player, thiscam);
if (thiscam->momx || thiscam->momy)
{
if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam)) // Never fails for 2D mode.
{
if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam))
{ // Never fails for 2D mode.
mobj_t dummy;
dummy.thinker.function.acp1 = (actionf_p1)P_MobjThinker;
dummy.subsector = thiscam->subsector;
dummy.x = thiscam->x;
dummy.y = thiscam->y;
dummy.z = thiscam->z;
dummy.height = thiscam->height;
if (player->pflags & PF_TIMEOVER)
player->kartstuff[k_timeovercam] = (2*TICRATE)+1;
if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
P_ResetCamera(player, thiscam);
else
P_SlideCameraMove(thiscam);
if (resetcalled) // Okay this means the camera is fully reset.
return true;
}
}
P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam);
if (!itsatwodlevel)
P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam);
thiscam->subsector = R_PointInSubsector(thiscam->x, thiscam->y);
thiscam->floorz = tmfloorz;
@@ -3328,7 +3347,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
thiscam->z += thiscam->momz + player->mo->pmomz;
#ifndef NOCLIPCAM
if (!(player->pflags & PF_NOCLIP || leveltime < introtime))
if (!itsatwodlevel && !(player->pflags & PF_NOCLIP || leveltime < introtime))
{
// clip movement
if (thiscam->z <= thiscam->floorz) // hit the floor
@@ -3371,13 +3390,13 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
#endif
}
if (thiscam->ceilingz - thiscam->z < thiscam->height
&& thiscam->ceilingz >= thiscam->z)
if (itsatwodlevel
|| (thiscam->ceilingz - thiscam->z < thiscam->height
&& thiscam->ceilingz >= thiscam->z))
{
thiscam->ceilingz = thiscam->z + thiscam->height;
thiscam->floorz = thiscam->z;
}
return false;
}
@@ -3391,8 +3410,8 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
I_Assert(mobj != NULL);
I_Assert(mobj->player != NULL);
I_Assert(!P_MobjWasRemoved(mobj));
if (!mobj)
if (P_MobjWasRemoved(mobj))
return;
P_MobjCheckWater(mobj);
@@ -6011,36 +6030,41 @@ static void P_KoopaThinker(mobj_t *koopa)
//
void P_RollPitchMobj(mobj_t* mobj)
{
if (!mobj || P_MobjWasRemoved(mobj))
return;
boolean usedist = false;
if (P_MobjWasRemoved(mobj))
return;
if (cv_spriteroll.value && cv_sloperoll.value == 2)
{
K_RollMobjBySlopes(mobj, cv_sloperolldist.value && !splitscreen);
}
else
{
mobj->sloperoll = FixedAngle(0);
mobj->slopepitch = FixedAngle(0);
}
if (cv_sloperolldist.value > 0)
usedist = true;
if (cv_spriteroll.value && cv_sloperoll.value == 2)
{
K_RollMobjBySlopes(mobj, usedist);
}
else
{
mobj->sloperoll = FixedAngle(0);
mobj->slopepitch = FixedAngle(0);
}
}
angle_t P_MobjPitchAndRoll(mobj_t *mobj)
{
spritedef_t *sprdef;
spriteframe_t *sprframe;
angle_t ang = 0;
spritedef_t *sprdef;
spriteframe_t *sprframe;
angle_t ang = 0;
angle_t camang = 0;
angle_t return_angle = 0;
if (!cv_spriteroll.value)
return 0;
if (P_MobjWasRemoved(mobj))
return 0;
if (P_MobjWasRemoved(mobj))
return 0;
size_t rot = mobj->frame & FF_FRAMEMASK;
boolean papersprite = (mobj->frame & FF_PAPERSPRITE);
size_t rot = mobj->frame & FF_FRAMEMASK;
boolean papersprite = (mobj->frame & FF_PAPERSPRITE);
if (mobj->skin && mobj->sprite == SPR_PLAY)
{
@@ -6071,12 +6095,12 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
camang = R_PointToAngle(mobj->x, mobj->y);
}
return_angle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mobj->roll)
return_angle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mobj->roll)
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch);
if (cv_sloperoll.value)
{
return_angle += FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
return_angle += FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
}
@@ -6239,7 +6263,7 @@ void P_MobjThinker(mobj_t *mobj)
P_RemoveMobj(mobj);
return;
}
if (cv_sloperoll.value == 2 && mobj->state == &states[S_SHADOW])
{
mobj->slopepitch = mobj->target->slopepitch;
@@ -6262,7 +6286,6 @@ void P_MobjThinker(mobj_t *mobj)
P_RemoveMobj(mobj);
return;
}
P_RollPitchMobj(mobj);
break;
case MT_SMOLDERING:
@@ -6893,7 +6916,7 @@ void P_MobjThinker(mobj_t *mobj)
// separate thinker
if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse))
{
if (!mobj)
if (P_MobjWasRemoved(mobj))
return;
P_MobjCheckWater(mobj);
@@ -9411,11 +9434,11 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->destscale = mapobjectscale;
mobj->scalespeed = mapobjectscale/12;
}
// Sprite rendering
mobj->realxscale = mobj->realyscale = mobj->scale;
mobj->realxscale = mobj->realyscale = mobj->scale;
mobj->spritexscale = mobj->realxscale;
mobj->spriteyscale = mobj->realyscale;
mobj->spriteyscale = mobj->realyscale;
mobj->spritexoffset = mobj->spriteyoffset = 0;
// Funni slam sound when landing
@@ -9869,11 +9892,11 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
mobj->destscale = mapobjectscale;
mobj->scalespeed = mapobjectscale/12;
}
// Sprite rendering
mobj->spritexscale = mobj->spriteyscale = mobj->scale;
mobj->spritexscale = mobj->spriteyscale = mobj->scale;
mobj->spritexoffset = mobj->spriteyoffset = 0;
// set subsector and/or block links
P_SetThingPosition(mobj);
I_Assert(mobj->subsector != NULL);
@@ -9971,13 +9994,10 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
if (mobj->floorz != starting_floorz)
mobj->precipflags |= PCF_FOF;
else
{
INT32 special = GETSECSPECIAL(mobj->subsector->sector->special, 1);
if (special == 7 || special == 6 || mobj->subsector->sector->floorpic == skyflatnum)
mobj->precipflags |= PCF_PIT;
}
else if (GETSECSPECIAL(mobj->subsector->sector->special, 1) == 7
|| GETSECSPECIAL(mobj->subsector->sector->special, 1) == 6
|| mobj->subsector->sector->floorpic == skyflatnum)
mobj->precipflags |= PCF_PIT;
R_ResetPrecipitationMobjInterpolationState(mobj);
@@ -10080,7 +10100,7 @@ void P_RemoveMobj(mobj_t *mobj)
P_SetTarget(&mobj->hprev->hnext, cachenext);
P_SetTarget(&mobj->hprev, NULL);
}
// clear the reference from the mapthing
if (mobj->spawnpoint)
mobj->spawnpoint->mobj = NULL;
@@ -10271,7 +10291,7 @@ void P_PrecipitationEffects(void)
INT32 volume;
size_t i;
boolean rainsfx = true;
boolean sounds_rain = true;
boolean sounds_thunder = true;
boolean effects_lightning = true;
boolean lightningStrike = false;
@@ -10304,7 +10324,7 @@ void P_PrecipitationEffects(void)
effects_lightning = false;
break;
case PRECIP_STORM_NORAIN: // no rain, lightning and thunder allowed
rainsfx = false;
sounds_rain = false;
case PRECIP_STORM: // everything.
break;
default:
@@ -10312,8 +10332,6 @@ void P_PrecipitationEffects(void)
return;
}
boolean sounds_rain = ((cv_drawdist_precip.value != 0) && rainsfx && (!leveltime || leveltime % 80 == 1));
// Currently thunderstorming with lightning, and we're sounding the thunder...
// and where there's thunder, there's gotta be lightning!
if (effects_lightning && lightningStrike)
@@ -10333,57 +10351,38 @@ void P_PrecipitationEffects(void)
if (sound_disabled)
return; // Sound off? D'aw, no fun.
if (!sounds_rain && !sounds_thunder)
return; // no need to calculate volume at ALL
if (players[displayplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum)
volume = 255; // Sky above? We get it full blast.
else
{
/* GCC is optimizing away y >= yl, FUCK YOU */
INT64 x, y, yl, yh, xl, xh;
volatile fixed_t x, y, yl, yh, xl, xh;
fixed_t closedist, newdist;
// Essentially check in a 1024 unit radius of the player for an outdoor area.
#define RADIUSSTEP (64*FRACUNIT)
#define SEARCHRADIUS (16*RADIUSSTEP)
yl = yh = players[displayplayers[0]].mo->y;
yl -= SEARCHRADIUS;
while (yl < INT32_MIN)
yl += RADIUSSTEP;
yh += SEARCHRADIUS;
while (yh > INT32_MAX)
yh -= RADIUSSTEP;
yl = players[displayplayers[0]].mo->y - 1024*FRACUNIT;
yh = players[displayplayers[0]].mo->y + 1024*FRACUNIT;
xl = players[displayplayers[0]].mo->x - 1024*FRACUNIT;
xh = players[displayplayers[0]].mo->x + 1024*FRACUNIT;
closedist = 2048*FRACUNIT;
xl = xh = players[displayplayers[0]].mo->x;
xl -= SEARCHRADIUS;
while (xl < INT32_MIN)
xl += RADIUSSTEP;
xh += SEARCHRADIUS;
while (xh > INT32_MAX)
xh -= RADIUSSTEP;
closedist = SEARCHRADIUS*2;
#undef SEARCHRADIUS
for (y = yl; y <= yh; y += RADIUSSTEP)
for (x = xl; x <= xh; x += RADIUSSTEP)
for (y = yl; y >= yl && y <= yh; y += FRACUNIT*64)
for (x = xl; x >= xl && x <= xh; x += FRACUNIT*64)
{
if (R_PointInSubsector((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
if (R_PointInSubsector(x, y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
continue;
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, (fixed_t)x, (fixed_t)y, 0);
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, x, y, 0);
if (newdist < closedist)
closedist = newdist;
}
volume = 255 - (closedist>>(FRACBITS+2));
}
#undef RADIUSSTEP
volume = CLAMP(volume, 0, 255);
if (sounds_rain)
if (sounds_rain && (!leveltime || leveltime % 80 == 1))
S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_rainin, volume);
if (!sounds_thunder)
@@ -10568,8 +10567,7 @@ void P_SpawnPlayer(INT32 playernum)
}
// spawn as spectator determination
if (multiplayer && demo.playback)
; // Don't mess with spectator values since the demo setup handles them already.
if (multiplayer && demo.playback); // Don't mess with spectator values since the demo setup handles them already.
else if (!G_GametypeHasSpectators())
p->spectator = false;
else if (netgame && p->jointime <= 1 && pcount)
@@ -10636,8 +10634,15 @@ void P_SpawnPlayer(INT32 playernum)
// (usefulness: when body mobj is detached from player (who respawns),
// the dead body mobj retains the skin through the 'spritedef' override).
mobj->skin = &skins[p->skin];
mobj->localskin = ((p->localskin > 0) ? (p->skinlocal ? &localskins[p->localskin - 1] : &skins[p->localskin - 1]) : 0);
if (p->localskin > 0)
{
if (p->skinlocal)
mobj->localskin = &localskins[p->localskin - 1];
else
mobj->localskin = & skins[p->localskin - 1];
}
else
mobj->localskin = 0;
mobj->skinlocal = p->skinlocal;
mobj->health = p->health;
@@ -11245,8 +11250,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
mobj = P_SpawnMobj(x, y, z, i);
if (!mobj || P_MobjWasRemoved(mobj))
{
if (!mobj || P_MobjWasRemoved(mobj)) {
CONS_Alert(CONS_ERROR, "Failed to spawn map thing #%d at %d, %d. This will crash vanilla clients!\n", mthing->type, x>>FRACBITS, y>>FRACBITS);
return;
}
+5 -4
View File
@@ -261,7 +261,6 @@ typedef enum {
PCF_SPLASH = 1<<4, // Splashed on the ground, return to the ceiling after the animation's over
PCF_THUNK = 1<<5, // Ran the thinker this tic.
} precipflag_t;
// Map Object definition.
typedef struct mobj_s
{
@@ -288,7 +287,8 @@ typedef struct mobj_s
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT16 anim_duration; // for FF_ANIMATE states
UINT32 renderflags; // render flags
fixed_t spritexscale, spriteyscale;
fixed_t spritexoffset, spriteyoffset;
fixed_t old_spritexscale, old_spriteyscale;
@@ -440,7 +440,8 @@ typedef struct precipmobj_s
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT16 anim_duration; // for FF_ANIMATE states
UINT32 renderflags; // render flags
fixed_t spritexscale, spriteyscale;
fixed_t spritexoffset, spriteyoffset;
fixed_t old_spritexscale, old_spriteyscale;
@@ -449,7 +450,7 @@ typedef struct precipmobj_s
fixed_t realxscale, realyscale; // funn-E streeetch
fixed_t stretchslam; // "squish" effect when you land
//sloperollangle
angle_t sloperoll, slopepitch;
angle_t old_sloperoll, old_slopepitch;
+11 -21
View File
@@ -460,11 +460,7 @@ FUNCINLINE static ATTRINLINE void P_LoadRawVertexes(UINT8 *data)
* \param seg Seg to compute length for.
* \return Length in fracunits.
*/
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
fixed_t P_SegLength(seg_t *seg)
#else
static inline fixed_t P_SegLength(seg_t *seg)
#endif
{
INT64 dx = (seg->v2->x - seg->v1->x)>>1;
INT64 dy = (seg->v2->y - seg->v1->y)>>1;
@@ -514,7 +510,7 @@ void P_UpdateSegLightOffset(seg_t *li)
// Loads the SEGS resource from a level.
static void P_LoadRawSegs(UINT8 *data)
{
INT32 rawlinedef, rawside;
INT32 linedef, side;
mapseg_t *ml = (mapseg_t*)data;
seg_t *li = segs;
line_t *ldef;
@@ -534,14 +530,14 @@ static void P_LoadRawSegs(UINT8 *data)
li->angle = (SHORT(ml->angle))<<FRACBITS;
li->offset = (SHORT(ml->offset))<<FRACBITS;
rawlinedef = SHORT(ml->linedef);
ldef = &lines[rawlinedef];
linedef = SHORT(ml->linedef);
ldef = &lines[linedef];
li->linedef = ldef;
li->side = rawside = SHORT(ml->side);
li->sidedef = &sides[ldef->sidenum[rawside]];
li->frontsector = sides[ldef->sidenum[rawside]].sector;
li->side = side = SHORT(ml->side);
li->sidedef = &sides[ldef->sidenum[side]];
li->frontsector = sides[ldef->sidenum[side]].sector;
if (ldef->flags & ML_TWOSIDED)
li->backsector = sides[ldef->sidenum[rawside^1]].sector;
li->backsector = sides[ldef->sidenum[side^1]].sector;
else
li->backsector = 0;
@@ -2498,9 +2494,6 @@ static void P_InitMinimapInfo(void)
fixed_t a;
fixed_t b;
node_t *bsp = &nodes[numnodes-1];
minimapinfo.minimap_pic = NULL;
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
if (lumpnum != -1)
@@ -2512,7 +2505,6 @@ static void P_InitMinimapInfo(void)
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM];
minimapinfo.max_y = bsp->bbox[0][BOXTOP];
if (bsp->bbox[1][BOXLEFT] < minimapinfo.min_x)
minimapinfo.min_x = bsp->bbox[1][BOXLEFT];
if (bsp->bbox[1][BOXRIGHT] > minimapinfo.max_x)
@@ -2521,19 +2513,15 @@ static void P_InitMinimapInfo(void)
minimapinfo.min_y = bsp->bbox[1][BOXBOTTOM];
if (bsp->bbox[1][BOXTOP] > minimapinfo.max_y)
minimapinfo.max_y = bsp->bbox[1][BOXTOP];
// You might be wondering why these are being bitshift here
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
// map boundaries and sizes will ALWAYS be whole numbers thankfully
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
minimapinfo.map_w = (minimapinfo.max_x >>= FRACBITS) - (minimapinfo.min_x >>= FRACBITS);
minimapinfo.map_h = (minimapinfo.max_y >>= FRACBITS) - (minimapinfo.min_y >>= FRACBITS);
minimapinfo.minimap_w = minimapinfo.minimap_h = 100;
a = FixedDiv(minimapinfo.minimap_w<<FRACBITS, minimapinfo.map_w<<4);
b = FixedDiv(minimapinfo.minimap_h<<FRACBITS, minimapinfo.map_h<<4);
if (a < b)
{
minimapinfo.minimap_h = FixedMul(a, minimapinfo.map_h)>>(FRACBITS-4);
@@ -2547,10 +2535,8 @@ static void P_InitMinimapInfo(void)
}
minimapinfo.zoom = b;
}
minimapinfo.zoom >>= (FRACBITS-4);
minimapinfo.zoom -= (minimapinfo.zoom/20);
// These should always be small enough to be bitshift back right now
minimapinfo.offs_x = FixedMul((minimapinfo.min_x + minimapinfo.map_w/2) << FRACBITS, minimapinfo.zoom);
minimapinfo.offs_y = FixedMul((minimapinfo.min_y + minimapinfo.map_h/2) << FRACBITS, minimapinfo.zoom);
@@ -2601,6 +2587,9 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
P_LevelInitStuff(reloadinggamestate);
for (i = 0; i <= splitscreen; i++)
postimgtype[i] = postimg_none;
if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0'
&& atoi(mapheaderinfo[gamemap-1]->forcecharacter) != 255)
P_ForceCharacter(mapheaderinfo[gamemap-1]->forcecharacter);
@@ -3022,6 +3011,7 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
if (rendermode != render_none && !reloadinggamestate)
{
R_ResetViewInterpolation(0);
R_ResetViewInterpolation(0);
R_UpdateMobjInterpolators();
}
-5
View File
@@ -88,11 +88,6 @@ SINT8 P_PartialAddGetStage(void);
boolean P_RunSOC(const char *socfilename);
void P_WriteThings(lumpnum_t lump);
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
fixed_t P_SegLength(seg_t *seg);
#endif
void P_UpdateSegLightOffset(seg_t *li);
size_t P_PrecacheLevelFlats(void);
void P_AllocMapHeader(INT16 i);
+74 -34
View File
@@ -364,11 +364,11 @@ void P_SpawnSlope_Line(int linenum)
// In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef
fslope = line->frontsector->f_slope =
P_MakeSlope(&point, &direction, dz, flags);
P_MakeSlope(&point, &direction, dz, flags);
// Set up some shit
fslope->extent = extent;
fslope->refpos = 1;
// Set up some shit
fslope->extent = extent;
fslope->refpos = 1;
// Now remember that f_slope IS a vector
// fslope->o = origin 3D point 1 of the vector
@@ -425,11 +425,11 @@ void P_SpawnSlope_Line(int linenum)
dz = FixedDiv(origin.z - point.z, extent);
cslope = line->frontsector->c_slope =
P_MakeSlope(&point, &direction, dz, flags);
P_MakeSlope(&point, &direction, dz, flags);
// Set up some shit
cslope->extent = extent;
cslope->refpos = 2;
// Set up some shit
cslope->extent = extent;
cslope->refpos = 2;
// Sync the linedata of the line that started this slope
// TODO: Anything special for control sector based slopes later?
@@ -494,11 +494,11 @@ void P_SpawnSlope_Line(int linenum)
dz = FixedDiv(origin.z - point.z, extent);
fslope = line->backsector->f_slope =
P_MakeSlope(&point, &direction, dz, flags);
P_MakeSlope(&point, &direction, dz, flags);
// Set up some shit
fslope->extent = extent;
fslope->refpos = 3;
// Set up some shit
fslope->extent = extent;
fslope->refpos = 3;
// Sync the linedata of the line that started this slope
// TODO: Anything special for control sector based slopes later?
@@ -531,7 +531,6 @@ void P_SpawnSlope_Line(int linenum)
P_CalculateSlopeNormal(fslope);
}
if (backceil)
{
fixed_t highest, lowest;
@@ -541,11 +540,11 @@ void P_SpawnSlope_Line(int linenum)
dz = FixedDiv(origin.z - point.z, extent);
cslope = line->backsector->c_slope =
P_MakeSlope(&point, &direction, dz, flags);
P_MakeSlope(&point, &direction, dz, flags);
// Set up some shit
cslope->extent = extent;
cslope->refpos = 4;
// Set up some shit
cslope->extent = extent;
cslope->refpos = 4;
// Sync the linedata of the line that started this slope
// TODO: Anything special for control sector based slopes later?
@@ -605,8 +604,7 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
memset(ret->vertices, 0, 3*sizeof(mapthing_t));
// And... look for the vertices in question.
for (i = 0; i < nummapthings; i++, mt++)
{
for (i = 0; i < nummapthings; i++, mt++) {
if (mt->type != 750) // Haha, I'm hijacking the old Chaos Spawn thingtype for something!
continue;
@@ -619,8 +617,7 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
}
// Now set heights for each vertex, because they haven't been set yet
for (i = 0; i < 3; i++)
{
for (i = 0; i < 3; i++) {
mt = ret->vertices[i];
if (!mt) // If a vertex wasn't found, it's game over. There's nothing you can do to recover (except maybe try and kill the slope instead - TODO?)
I_Error("P_NewVertexSlope: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1);
@@ -652,23 +649,23 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
//
void P_CopySectorSlope(line_t *line)
{
sector_t *fsec = line->frontsector;
int i, special = line->special;
sector_t *fsec = line->frontsector;
int i, special = line->special;
// Check for copy linedefs
for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
{
sector_t *srcsec = sectors + i;
// Check for copy linedefs
for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
{
sector_t *srcsec = sectors + i;
if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
}
if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
}
fsec->hasslope = true;
fsec->hasslope = true;
line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
}
//
@@ -793,6 +790,49 @@ void P_ResetDynamicSlopes(void)
// Various utilities related to slopes
//
//
// P_GetZAt
//
// Returns the height of the sloped plane at (x, y) as a fixed_t
//
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y)
{
fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) +
FixedMul(y - slope->o.y, slope->d.y);
return slope->o.z + FixedMul(dist, slope->zdelta);
}
// Returns the height of the sector floor at (x, y)
fixed_t P_GetSectorFloorZAt(const sector_t *sector, fixed_t x, fixed_t y)
{
return sector->f_slope ? P_GetZAt(sector->f_slope, x, y) : sector->floorheight;
}
// Returns the height of the sector ceiling at (x, y)
fixed_t P_GetSectorCeilingZAt(const sector_t *sector, fixed_t x, fixed_t y)
{
return sector->c_slope ? P_GetZAt(sector->c_slope, x, y) : sector->ceilingheight;
}
// Returns the height of the FOF top at (x, y)
fixed_t P_GetFFloorTopZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y)
{
return *ffloor->t_slope ? P_GetZAt(*ffloor->t_slope, x, y) : *ffloor->topheight;
}
// Returns the height of the FOF bottom at (x, y)
fixed_t P_GetFFloorBottomZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y)
{
return *ffloor->b_slope ? P_GetZAt(*ffloor->b_slope, x, y) : *ffloor->bottomheight;
}
// Returns the height of the light list at (x, y)
fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y)
{
return light->slope ? P_GetZAt(light->slope, x, y) : light->height;
}
//
// P_QuantizeMomentumToSlope
//
+8 -37
View File
@@ -13,12 +13,9 @@
#ifndef P_SLOPES_H__
#define P_SLOPES_H__
#include "doomtype.h"
void P_CalculateSlopeNormal(pslope_t *slope);
void P_ResetDynamicSlopes(void);
void P_RunDynamicSlopes(void);
// P_SpawnSlope_Line
// Creates one or more slopes based on the given line type and front/back
// sectors.
@@ -33,45 +30,19 @@ void P_CopySectorSlope(line_t *line);
pslope_t *P_SlopeById(UINT16 id);
//
// P_GetZAt
//
// Returns the height of the sloped plane at (x, y) as a fixed_t
FUNCINLINE static ATTRINLINE fixed_t P_GetZAt(pslope_t *z_slope, fixed_t x, fixed_t y)
{
return z_slope->o.z + FixedMul((FixedMul(x - z_slope->o.x, z_slope->d.x) + FixedMul(y - z_slope->o.y, z_slope->d.y)), z_slope->zdelta);
}
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y);
// Returns the height of the sector floor at (x, y)
FUNCINLINE static ATTRINLINE fixed_t P_GetSectorFloorZAt(const sector_t *z_sector, fixed_t x, fixed_t y)
{
return z_sector->f_slope ? P_GetZAt(z_sector->f_slope, x, y) : z_sector->floorheight;
}
// Returns the height of the sector at (x, y)
fixed_t P_GetSectorFloorZAt (const sector_t *sector, fixed_t x, fixed_t y);
fixed_t P_GetSectorCeilingZAt(const sector_t *sector, fixed_t x, fixed_t y);
// Returns the height of the sector ceiling at (x, y)
FUNCINLINE static ATTRINLINE fixed_t P_GetSectorCeilingZAt(const sector_t *z_sector, fixed_t x, fixed_t y)
{
return z_sector->c_slope ? P_GetZAt(z_sector->c_slope, x, y) : z_sector->ceilingheight;
}
// Returns the height of the FOF top at (x, y)
FUNCINLINE static ATTRINLINE fixed_t P_GetFFloorTopZAt(const ffloor_t *z_ffloor, fixed_t x, fixed_t y)
{
return *z_ffloor->t_slope ? P_GetZAt(*z_ffloor->t_slope, x, y) : *z_ffloor->topheight;
}
// Returns the height of the FOF bottom at (x, y)
FUNCINLINE static ATTRINLINE fixed_t P_GetFFloorBottomZAt(const ffloor_t *z_ffloor, fixed_t x, fixed_t y)
{
return *z_ffloor->b_slope ? P_GetZAt(*z_ffloor->b_slope, x, y) : *z_ffloor->bottomheight;
}
// Returns the height of the FOF at (x, y)
fixed_t P_GetFFloorTopZAt (const ffloor_t *ffloor, fixed_t x, fixed_t y);
fixed_t P_GetFFloorBottomZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y);
// Returns the height of the light list at (x, y)
FUNCINLINE static ATTRINLINE fixed_t P_GetLightZAt(const lightlist_t *z_light, fixed_t x, fixed_t y)
{
return z_light->slope ? P_GetZAt(z_light->slope, x, y) : z_light->height;
}
fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y);
// Lots of physics-based bullshit
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
+2 -3
View File
@@ -2084,9 +2084,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
mo->y += y;
mo->z += z;
P_SetThingPosition(mo);
mo->old_x = mo->x;
mo->old_y = mo->y;
mo->old_z = mo->z;
if (mo->player)
{
@@ -2105,6 +2102,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
camera[i].reset = true;
camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y);
R_RelativeTeleportViewInterpolation(i, x, y, z, 0);
R_ResetViewInterpolation(i + 1); // reset view interp as well
break;
}
}
@@ -2522,6 +2520,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (displayplayers[i] == (mo->player - players))
{
R_ResetViewInterpolation(i + 1);
R_ResetViewInterpolation(i + 1);
}
}
}
+9 -13
View File
@@ -434,21 +434,10 @@ void P_Ticker(boolean run)
{
INT32 i;
// Increment jointime and quittime even if paused
//Increment jointime even if paused.
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
{
players[i].jointime++;
}
}
if (run)
{
// Update old view state BEFORE ticking so resetting
// the old interpolation state from game logic works.
R_UpdateViewInterpolation();
}
++players[i].jointime;
if (objectplacing)
{
@@ -480,6 +469,9 @@ void P_Ticker(boolean run)
return;
}
for (i = 0; i <= splitscreen; i++)
postimgtype[i] = postimg_none;
P_MapStart();
if (run)
@@ -680,6 +672,7 @@ void P_Ticker(boolean run)
if (run)
{
R_UpdateLevelInterpolators();
R_UpdateViewInterpolation();
// Hack: ensure newview is assigned every tic.
// Ensures view interpolation is T-1 to T in poor network conditions
@@ -715,6 +708,9 @@ void P_PreTicker(INT32 frames)
INT32 i;
ticcmd_t temptic;
for (i = 0; i <= splitscreen; i++)
postimgtype[i] = postimg_none;
hook_defrosting = frames;
while (hook_defrosting)
+30 -30
View File
@@ -2498,7 +2498,7 @@ static void P_MovePlayer(player_t *player)
}
#ifdef HWRENDER
if (rendermode == render_opengl && cv_glfovchange.value)
if (rendermode != render_soft && rendermode != render_none && cv_grfovchange.value)
{
fixed_t speed;
const fixed_t runnyspeed = 20*FRACUNIT;
@@ -3995,6 +3995,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
{
P_MoveChaseCamera(player, thiscam, false);
R_ResetViewInterpolation(num + 1);
R_ResetViewInterpolation(num + 1);
}
return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming);
@@ -4102,12 +4103,11 @@ boolean P_SpectatorJoinGame(player_t *player)
return false;
}
// the below is first person only, if you're curious. check out P_CalcChasePostImg in p_mobj.c for chasecam
static void P_CalcPostImg(player_t *player)
{
sector_t *sector = player->mo->subsector->sector;
INT16 typeflag = 0;
//INT32 *param;
postimg_t *type = NULL;
INT32 *param;
fixed_t pviewheight;
UINT8 i;
@@ -4122,19 +4122,20 @@ static void P_CalcPostImg(player_t *player)
pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
}
/*for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{
type = &postimgtype[i];
param = &postimgparam[i];
break;
}
}*/
}
// see if we are in heat (no, not THAT kind of heat...)
if (P_FindSpecialLineFromTag(13, sector->tag, -1) != -1)
typeflag |= POSTIMG_HEAT;
*type = postimg_heat;
else if (sector->ffloors)
{
ffloor_t *rover;
@@ -4153,7 +4154,7 @@ static void P_CalcPostImg(player_t *player)
continue;
if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1)
typeflag |= POSTIMG_HEAT;
*type = postimg_heat;
}
}
@@ -4175,35 +4176,36 @@ static void P_CalcPostImg(player_t *player)
if (pviewheight >= topheight || pviewheight <= bottomheight)
continue;
typeflag |= POSTIMG_WATER;
*type = postimg_water;
}
}
if (encoremode) // srb2kart
typeflag |= POSTIMG_MIRROR;
if (player->mo->eflags & MFE_VERTICALFLIP)
typeflag |= POSTIMG_FLIP;
// Motion blur
// unused
/*if (player->speed > (35<<FRACBITS))
if (!encoremode) // srb2kart
{
typeflag |= POSTIMG_MOTION;
if (player->mo->eflags & MFE_VERTICALFLIP)
*type = postimg_flip;
}
else
{
if (player->mo->eflags & MFE_VERTICALFLIP)
*type = postimg_mirrorflip;
else
*type = postimg_mirror;
}
#if 1
(void)param;
#else
// Motion blur
if (player->speed > (35<<FRACBITS))
{
*type = postimg_motion;
*param = (player->speed - 32)/4;
if (*param > 5)
*param = 5;
}*/
for (i = 0; i <= splitscreen; i++)
{
if (player != &players[displayplayers[i]])
continue;
players[displayplayers[i]].postimgflags = typeflag;
break;
}
#endif
}
void P_DoTimeOver(player_t *player)
@@ -4213,8 +4215,6 @@ void P_DoTimeOver(player_t *player)
player->pflags |= PF_TIMEOVER;
demo.savebutton = leveltime;
if (P_IsLocalPlayer(player) && !demo.playback)
legitimateexit = true; // SRB2kart: losing a race is still seeing it through to the end :p
+2 -3
View File
@@ -15,8 +15,6 @@
#include "g_game.h"
#include "r_local.h"
#include "r_state.h"
#include "r_portal.h" // Add seg portals
#include "r_splats.h"
#include "p_local.h" // camera
@@ -30,6 +28,7 @@ side_t *sidedef;
line_t *linedef;
sector_t *frontsector;
sector_t *backsector;
portal_pair *g_portal; // is curline a portal seg?
// very ugly realloc() of drawsegs at run-time, I upped it to 512
// instead of 256.. and someone managed to send me a level with
@@ -487,7 +486,7 @@ static void R_AddLine(seg_t *line)
line2 = P_FindSpecialLineFromTag(40, line->linedef->tag, line2);
if (line2 >= 0) // found it!
{
Portal_Add2Lines(line->linedef-lines, line2, x1, x2); // Remember the lines for later rendering
R_AddPortal(line->linedef-lines, line2, x1, x2); // Remember the lines for later rendering
//return; // Don't fill in that space now!
goto clipsolid;
}
+2 -2
View File
@@ -25,8 +25,7 @@ extern side_t *sidedef;
extern line_t *linedef;
extern sector_t *frontsector;
extern sector_t *backsector;
typedef struct portal_s portal_t;
extern portal_t *g_portal; // is curline a portal seg?
extern portal_pair *g_portal; // is curline a portal seg?
// drawsegs are allocated on the fly... see r_segs.c
@@ -42,6 +41,7 @@ void R_ClearClipSegs(void);
void R_PortalClearClipSegs(INT32 start, INT32 end);
void R_ClearDrawSegs(void);
void R_RenderBSPNode(INT32 bspnum);
void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2);
// determines when a given sector shouldn't abide by the encoremap's palette.
// no longer a static since this is used for encore in hw_main.c as well now:
+8
View File
@@ -687,6 +687,14 @@ typedef struct
#pragma pack()
#endif
typedef enum // trimmed since its only real use here is for xscale/yscale
{
RF_HORIZONTALFLIP = 0x0001, // Flip sprite horizontally
RF_VERTICALFLIP = 0x0002, // Flip sprite vertically
RF_ABSOLUTEOFFSETS = 0x0004, // Sprite uses the object's offsets absolutely, instead of relatively
RF_FLIPOFFSETS = 0x0008, // Relative object offsets are flipped with the sprite
} renderflags_t;
typedef enum
{
SRF_SINGLE = 0, // 0-angle for all rotations
-1
View File
@@ -78,7 +78,6 @@ fixed_t dc_iscale, dc_texturemid;
UINT8 dc_hires; // under MSVC boolean is a byte, while on other systems, it a bit,
// soo lets make it a byte on all system for the ASM code
UINT8 *dc_source;
INT32 dc_sourcelength;
// -----------------------
// translucency stuff here
-1
View File
@@ -62,7 +62,6 @@ extern lighttable_t *ds_colormap;
extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
extern INT32 ds_waterofs, ds_bgofs;
extern UINT8 *ds_source; // start of a 64*64 tile image
extern INT32 dc_sourcelength;
extern UINT8 *ds_transmap;
extern INT32 ds_bgofs;
+34 -130
View File
@@ -28,8 +28,6 @@ void R_DrawColumn_8(void)
register UINT8 *dest;
register fixed_t frac;
fixed_t fracstep;
INT32 npow2min;
INT32 npow2max;
count = dc_yh - dc_yl;
@@ -53,26 +51,13 @@ void R_DrawColumn_8(void)
fracstep = dc_iscale;
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep))*(!dc_hires);
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
// This is as fast as it gets.
{
register const UINT8 *source = dc_source;
register const lighttable_t *colormap = dc_colormap;
register INT32 heightmask = dc_texheight-1;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
if (dc_texheight & heightmask) // not a power of 2 -- killough
{
heightmask++;
@@ -89,10 +74,7 @@ void R_DrawColumn_8(void)
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
// heightmask is the Tutti-Frutti fix
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
// and a few bytes after as well
*dest = colormap[source[CLAMP(frac>>FRACBITS, npow2min, npow2max)]];
*dest = colormap[source[frac>>FRACBITS]];
dest += vid.width;
// Avoid overflow.
@@ -133,8 +115,6 @@ void R_Draw2sMultiPatchColumn_8(void)
register UINT8 *dest;
register fixed_t frac;
fixed_t fracstep;
INT32 npow2min;
INT32 npow2max;
count = dc_yh - dc_yl;
@@ -167,20 +147,6 @@ void R_Draw2sMultiPatchColumn_8(void)
register const lighttable_t *colormap = dc_colormap;
register INT32 heightmask = dc_texheight-1;
register UINT8 val;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
if (dc_texheight & heightmask) // not a power of 2 -- killough
{
heightmask++;
@@ -197,10 +163,7 @@ void R_Draw2sMultiPatchColumn_8(void)
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
// heightmask is the Tutti-Frutti fix
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
// and a few bytes after as well
val = source[CLAMP(frac>>FRACBITS, npow2min, npow2max)];
val = source[frac>>FRACBITS];
if (val != TRANSPARENTPIXEL)
{
@@ -260,8 +223,6 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void)
register UINT8 *dest;
register fixed_t frac;
fixed_t fracstep;
INT32 npow2min;
INT32 npow2max;
count = dc_yh - dc_yl;
@@ -295,20 +256,6 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void)
register const lighttable_t *colormap = dc_colormap;
register INT32 heightmask = dc_texheight-1;
register UINT8 val;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
if (dc_texheight & heightmask) // not a power of 2 -- killough
{
heightmask++;
@@ -325,10 +272,7 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void)
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
// heightmask is the Tutti-Frutti fix
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
// and a few bytes after as well
val = source[CLAMP(frac>>FRACBITS, npow2min, npow2max)];
val = source[frac>>FRACBITS];
if (val != TRANSPARENTPIXEL)
{
@@ -432,8 +376,6 @@ void R_DrawTranslucentColumn_8(void)
register INT32 count;
register UINT8 *dest;
register fixed_t frac, fracstep;
INT32 npow2min;
INT32 npow2max;
count = dc_yh - dc_yl + 1;
@@ -461,20 +403,6 @@ void R_DrawTranslucentColumn_8(void)
register const UINT8 *transmap = dc_transmap;
register const lighttable_t *colormap = dc_colormap;
register INT32 heightmask = dc_texheight - 1;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
if (dc_texheight & heightmask)
{
heightmask++;
@@ -492,11 +420,7 @@ void R_DrawTranslucentColumn_8(void)
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
// heightmask is the Tutti-Frutti fix
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
// and a few bytes after as well
*dest = *(transmap + (colormap[source[CLAMP(frac>>FRACBITS, npow2min, npow2max)]]<<8) + (*dest));
*dest = *(transmap + (colormap[source[frac>>FRACBITS]]<<8) + (*dest));
dest += vid.width;
if ((frac += fracstep) >= heightmask)
@@ -534,8 +458,6 @@ void R_DrawTranslatedTranslucentColumn_8(void)
register INT32 count;
register UINT8 *dest;
register fixed_t frac, fracstep;
INT32 npow2min;
INT32 npow2max;
count = dc_yh - dc_yl + 1;
@@ -555,20 +477,6 @@ void R_DrawTranslatedTranslucentColumn_8(void)
// This is as fast as it gets.
{
register INT32 heightmask = dc_texheight - 1;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
if (dc_texheight & heightmask)
{
heightmask++;
@@ -586,10 +494,7 @@ void R_DrawTranslatedTranslucentColumn_8(void)
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
// heightmask is the Tutti-Frutti fix
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
// and a few bytes after as well
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[CLAMP(frac>>FRACBITS, npow2min, npow2max)]]]<<8) + (*dest));
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]]<<8) + (*dest));
dest += vid.width;
if ((frac += fracstep) >= heightmask)
@@ -681,14 +586,14 @@ void R_DrawSpan_8 (void)
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
register UINT32 bit;
UINT32 bit;
UINT8 *source;
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
register size_t count = (ds_x2 - ds_x1 + 1);
size_t count = (ds_x2 - ds_x1 + 1);
size_t i;
xposition = ds_xfrac; yposition = ds_yfrac;
@@ -776,13 +681,13 @@ void R_DrawTiltedSpan_8(void)
UINT8 *source;
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
double startz, startu, startv;
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
register UINT32 bit;
UINT32 bit;
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
@@ -917,13 +822,13 @@ void R_DrawTiltedTranslucentSpan_8(void)
UINT8 *source;
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
double startz, startu, startv;
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
register UINT32 bit;
UINT32 bit;
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
@@ -1059,14 +964,14 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
UINT8 *source;
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
UINT8 *dsrc;
double startz, startu, startv;
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
register UINT32 bit;
UINT32 bit;
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
@@ -1200,7 +1105,7 @@ void R_DrawTiltedSplat_8(void)
UINT8 *source;
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
UINT8 val;
@@ -1208,7 +1113,7 @@ void R_DrawTiltedSplat_8(void)
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
register UINT32 bit;
UINT32 bit;
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
@@ -1352,13 +1257,13 @@ void R_DrawSplat_8 (void)
UINT32 xposition;
UINT32 yposition;
UINT32 xstep, ystep;
register UINT32 bit;
UINT32 bit;
UINT8 *source;
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
register size_t count;
size_t count;
size_t i;
UINT32 val;
@@ -1422,13 +1327,13 @@ void R_DrawTranslucentSplat_8 (void)
UINT32 xposition;
UINT32 yposition;
UINT32 xstep, ystep;
register UINT32 bit;
UINT32 bit;
UINT8 *source;
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
register size_t count;
size_t count;
size_t i;
UINT8 val;
@@ -1487,14 +1392,14 @@ void R_DrawTranslucentSpan_8 (void)
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
register UINT32 bit;
UINT32 bit;
UINT8 *source;
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
register size_t count = (ds_x2 - ds_x1 + 1);
size_t count = (ds_x2 - ds_x1 + 1);
size_t i;
xposition = ds_xfrac; yposition = ds_yfrac;
@@ -1546,14 +1451,14 @@ void R_DrawTranslucentWaterSpan_8(void)
UINT32 xposition;
UINT32 yposition;
UINT32 xstep, ystep;
register UINT32 bit;
UINT32 bit;
UINT8 *source;
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
UINT8 *dsrc;
register size_t count;
size_t count;
size_t i;
// SoM: we only need 6 bits for the integer part (0 thru 63) so the rest
@@ -1605,9 +1510,9 @@ void R_DrawTranslucentWaterSpan_8(void)
void R_DrawFogSpan_8(void)
{
UINT8 *colormap;
register UINT8 *dest;
UINT8 *dest;
register size_t count;
size_t count;
colormap = ds_colormap;
//dest = ylookup[ds_y] + columnofs[ds_x1];
@@ -1638,8 +1543,8 @@ void R_DrawFogSpan_8(void)
*/
void R_DrawFogColumn_8(void)
{
register INT32 count;
register UINT8 *dest;
INT32 count;
UINT8 *dest;
count = dc_yh - dc_yl;
@@ -1674,8 +1579,7 @@ void R_DrawFogColumn_8(void)
*/
void R_DrawColumnShadowed_8(void)
{
register INT32 count;
INT32 realyh, i, height, bheight = 0, solid = 0;
INT32 count, realyh, i, height, bheight = 0, solid = 0;
realyh = dc_yh;
+4 -12
View File
@@ -23,7 +23,6 @@
#include "r_state.h"
#include "z_zone.h"
#include "console.h" // con_startup_loadprogress
#include "i_time.h"
#ifdef HWRENDER
#include "hardware/hw_main.h" // for cv_grshearing
@@ -80,7 +79,6 @@ static viewvars_t skyview_old[MAXSPLITSCREENPLAYERS];
static viewvars_t skyview_new[MAXSPLITSCREENPLAYERS];
static viewvars_t *oldview = &pview_old[0];
static tic_t last_view_update;
static int oldview_invalid[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
viewvars_t *newview = &pview_new[0];
@@ -131,7 +129,7 @@ static void R_SetupFreelook(void)
// (lmps, network and use F12...)
if (rendermode == render_soft
#ifdef HWRENDER
|| cv_glshearing.value
|| cv_grshearing.value
#endif
)
{
@@ -209,27 +207,21 @@ void R_UpdateViewInterpolation(void)
if (oldview_invalid[i]) oldview_invalid[i]--;
}
last_view_update = I_GetTime();
}
void R_ResetViewInterpolation(UINT8 p)
{
// Wait an extra tic if the interpolation state hasn't
// updated yet.
int t = ((last_view_update == I_GetTime()) ? 1 : 2);
if (p == 0)
{
UINT8 i;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
oldview_invalid[i] = t;
oldview_invalid[i]++;
}
}
else
{
oldview_invalid[p - 1] = t;
oldview_invalid[p - 1]++;
}
}
@@ -331,7 +323,7 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac);
#ifdef HWRENDER
if (cv_glmdls.value)
if (cv_grmdls.value)
{
// pitch roll stuff
out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac);
+150 -40
View File
@@ -31,7 +31,6 @@
#include "p_spec.h" // skyboxmo
#include "z_zone.h"
#include "m_random.h" // quake camera shake
#include "r_portal.h"
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
#include "r_fps.h" // Frame interpolation/uncapped
#include "tables.h"
@@ -67,6 +66,14 @@ boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisibl
sector_t *viewsector;
player_t *viewplayer;
// PORTALS!
// You can thank and/or curse JTE for these.
UINT8 portalrender;
sector_t *portalcullsector;
portal_pair *portal_base, *portal_cap;
line_t *portalclipline;
INT32 portalclipstart, portalclipend;
fixed_t rendertimefrac;
fixed_t rendertimefrac_unpaused;
fixed_t renderdeltatics;
@@ -187,7 +194,7 @@ consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE|CV_CALL|CV_NO
consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mobjscaleprecip = {"scaleprecipmobjscale", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_maxinterpdist = {"maxinterpdist", "Infinite", CV_SAVE, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grmaxinterpdist = {"gr_maxinterpdist", "Infinite", CV_SAVE, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ripplewater = {"waterripples", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -318,6 +325,29 @@ PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *restrict node)
(~mask & (FixedMul(y, node->dx>>FRACBITS) >= FixedMul(node->dy>>FRACBITS, x)));
}
// killough 5/2/98: reformatted
PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line)
{
fixed_t lx = line->v1->x;
fixed_t ly = line->v1->y;
fixed_t ldx = line->v2->x - lx;
fixed_t ldy = line->v2->y - ly;
if (!ldx)
return x <= lx ? ldy > 0 : ldy < 0;
if (!ldy)
return y <= ly ? ldx < 0 : ldx > 0;
x -= lx;
y -= ly;
// Try to quickly decide by looking at sign bits.
if ((ldy ^ ldx ^ x ^ y) < 0)
return (ldy ^ x) < 0; // (left is negative)
return FixedMul(y, ldx>>FRACBITS) >= FixedMul(ldy>>FRACBITS, x);
}
//
// R_PointToAngle
// To get a global angle from cartesian coordinates,
@@ -1474,30 +1504,112 @@ void R_SetupFrame(player_t *player, boolean skybox)
R_InterpolateView(R_UsingFrameInterpolation() ? (demo.playback && demo.freecam) ? rendertimefrac_unpaused : rendertimefrac : FRACUNIT, false);
}
static void R_PortalFrame(portal_t *portal)
#define ANGLED_PORTALS
static void R_PortalFrame(line_t *start, line_t *dest, portal_pair *portal)
{
vertex_t dest_c, start_c;
#ifdef ANGLED_PORTALS
// delta angle
angle_t dangle = R_PointToAngle2(0,0,dest->dx,dest->dy) - R_PointToAngle2(start->dx,start->dy,0,0);
#endif
//R_SetupFrame(player, false);
viewx = portal->viewx;
viewy = portal->viewy;
viewz = portal->viewz;
viewangle = portal->viewangle;
// viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
// viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
// newview->sin = FINESINE(newview->angle>>ANGLETOFINESHIFT);
// newview->cos = FINECOSINE(newview->angle>>ANGLETOFINESHIFT);
portalcullsector = dest->frontsector;
viewsector = dest->frontsector;
portalclipline = dest;
portalclipstart = portal->start;
portalclipend = portal->end;
if (portal->clipline != -1)
// Offset the portal view by the linedef centers
// looking glass center
start_c.x = (start->v1->x + start->v2->x) / 2;
start_c.y = (start->v1->y + start->v2->y) / 2;
// other side center
dest_c.x = (dest->v1->x + dest->v2->x) / 2;
dest_c.y = (dest->v1->y + dest->v2->y) / 2;
// Heights!
viewz += dest->frontsector->floorheight - start->frontsector->floorheight;
// calculate the difference in position and rotation!
#ifdef ANGLED_PORTALS
if (dangle == 0)
#endif
{ // the entrance goes straight opposite the exit, so we just need to mess with the offset.
viewx += dest_c.x - start_c.x;
viewy += dest_c.y - start_c.y;
return;
}
#ifdef ANGLED_PORTALS
viewangle += dangle;
// newview->sin = FINESINE(newview->angle>>ANGLETOFINESHIFT);
// newview->cos = FINECOSINE(newview->angle>>ANGLETOFINESHIFT);
//CONS_Printf("dangle == %u\n", AngleFixed(dangle)>>FRACBITS);
// ????
{
portalclipline = &lines[portal->clipline];
portalcullsector = portalclipline->frontsector;
viewsector = portalclipline->frontsector;
fixed_t disttopoint;
angle_t angtopoint;
disttopoint = R_PointToDist2(start_c.x, start_c.y, newview->x, newview->y);
angtopoint = R_PointToAngle2(start_c.x, start_c.y, newview->x, newview->y);
angtopoint += dangle;
viewx = dest_c.x+FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
viewy = dest_c.y+FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
}
#endif
}
void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2)
{
portal_pair *portal = Z_Malloc(sizeof(portal_pair), PU_LEVEL, NULL);
INT16 *ceilingclipsave = Z_Malloc(sizeof(INT16)*(x2-x1), PU_LEVEL, NULL);
INT16 *floorclipsave = Z_Malloc(sizeof(INT16)*(x2-x1), PU_LEVEL, NULL);
fixed_t *frontscalesave = Z_Malloc(sizeof(fixed_t)*(x2-x1), PU_LEVEL, NULL);
portal->line1 = line1;
portal->line2 = line2;
portal->pass = portalrender+1;
portal->next = NULL;
R_PortalStoreClipValues(x1, x2, ceilingclipsave, floorclipsave, frontscalesave);
portal->ceilingclip = ceilingclipsave;
portal->floorclip = floorclipsave;
portal->frontscale = frontscalesave;
portal->start = x1;
portal->end = x2;
g_portal = portal; // this tells R_StoreWallRange that curline is a portal seg
portal->viewx = viewx;
portal->viewy = viewy;
portal->viewz = viewz;
portal->viewangle = viewangle;
if (!portal_base)
{
portal_base = portal;
portal_cap = portal;
}
else
{
portalclipline = NULL;
portalcullsector = NULL;
viewsector = R_PointInSubsector(viewx, viewy)->sector;
portal_cap->next = portal;
portal_cap = portal;
}
}
@@ -1513,6 +1625,7 @@ static void R_PortalFrame(portal_t *portal)
void R_RenderPlayerView(player_t *player)
{
portal_pair *portal;
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
UINT8 i;
@@ -1549,7 +1662,8 @@ void R_RenderPlayerView(player_t *player)
break;
}
Portal_InitList();
portalrender = 0;
portal_base = portal_cap = NULL;
PS_START_TIMING(ps_skyboxtime);
if (skybox && skyVisible)
@@ -1592,7 +1706,7 @@ void R_RenderPlayerView(player_t *player)
else
{
portalclipstart = 0;
portalclipend = viewwidth;
portalclipend = viewwidth-1;
R_ClearClipSegs();
}
R_ClearDrawSegs();
@@ -1614,41 +1728,37 @@ void R_RenderPlayerView(player_t *player)
ps_numsprites.value.i = numvisiblesprites;
// PORTAL RENDERING
PS_START_TIMING(ps_sw_portaltime);
// Portal rendering. Hijacks the BSP traversal.
if (portal_base)
for(portal = portal_base; portal; portal = portal_base)
{
portal_t *portal;
// render the portal
CONS_Debug(DBG_RENDER, "Rendering portal from line %d to %d\n", portal->line1, portal->line2);
portalrender = portal->pass;
for (portal = portal_base; portal; portal = portal_base)
{
portalrender = portal->pass; // Recursiveness depth.
R_PortalFrame(&lines[portal->line1], &lines[portal->line2], portal);
R_ClearFFloorClips();
R_PortalClearClipSegs(portal->start, portal->end);
// Apply the viewpoint stored for the portal.
R_PortalFrame(portal);
R_PortalRestoreClipValues(portal->start, portal->end, portal->ceilingclip, portal->floorclip, portal->frontscale);
// Hack in the clipsegs to delimit the starting
// clipping for sprites and possibly other similar
// future items.
R_PortalClearClipSegs(portal->start, portal->end);
validcount++;
// Hack in the top/bottom clip values for the window
// that were previously stored.
Portal_ClipApply(portal);
R_RenderBSPNode((INT32)numnodes - 1);
R_ClipSprites();
//R_DrawPlanes();
//R_DrawMasked();
// Render the BSP from the new viewpoint, and clip
// any sprites with the new clipsegs and window.
R_RenderBSPNode((INT32)numnodes - 1);
R_ClipSprites();
Portal_Remove(portal);
validcount++;
}
// okay done. free it.
portalcullsector = NULL; // Just in case...
portal_base = portal->next;
Z_Free(portal->ceilingclip);
Z_Free(portal->floorclip);
Z_Free(portal->frontscale);
Z_Free(portal);
}
PS_STOP_TIMING(ps_sw_portaltime);
// END PORTAL RENDERING
PS_START_TIMING(ps_sw_planetime);
R_DrawPlanes();
@@ -1760,7 +1870,7 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_maxportals);
CV_RegisterVar(&cv_maxinterpdist);
CV_RegisterVar(&cv_grmaxinterpdist);
CV_RegisterVar(&cv_ripplewater);
+23 -13
View File
@@ -73,18 +73,7 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
// Utility functions.
INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *node);
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line)
{
fixed_t lx = line->v1->x;
fixed_t ly = line->v1->y;
fixed_t ldx = line->v2->x - lx;
fixed_t ldy = line->v2->y - ly;
// use cross product to determine side quickly
return (INT64)(y - ly) * ldx - (INT64)(x - lx) * ldy > 0;
}
INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line);
angle_t R_PointToAngle(fixed_t x, fixed_t y);
angle_t R_PointToAngle64(INT64 x, INT64 y);
angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
@@ -101,6 +90,27 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh);
typedef struct portal_pair
{
INT32 line1;
INT32 line2;
UINT8 pass;
struct portal_pair *next;
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
INT32 start;
INT32 end;
INT16 *ceilingclip;
INT16 *floorclip;
fixed_t *frontscale;
} portal_pair;
// Performance stats
extern precise_t ps_prevframetime;// time when previous frame was rendered
extern ps_metric_t ps_rendercalltime;
@@ -136,7 +146,7 @@ extern consvar_t cv_drawdist, cv_drawdist_precip, cv_lessprecip, cv_mobjscalepre
extern consvar_t cv_fov;
extern consvar_t cv_skybox;
extern consvar_t cv_tailspickup;
extern consvar_t cv_maxinterpdist;
extern consvar_t cv_grmaxinterpdist;
extern consvar_t cv_ripplewater;
// Called by startup code.
+11 -11
View File
@@ -775,11 +775,11 @@ static UINT16 GetPatchPixel(patch_t *patch, INT32 x, INT32 y, boolean flip)
#ifdef HWRENDER
static patch_t *R_CreateHardwarePatch(patch_t *patch)
{
GLPatch_t *glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
glPatch->rawpatch = patch;
HWR_MakePatch(patch, glPatch, glPatch->mipmap, false);
return (patch_t *)glPatch;
GLPatch_t *grPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
grPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
grPatch->rawpatch = patch;
HWR_MakePatch(patch, grPatch, grPatch->mipmap, false);
return (patch_t *)grPatch;
}
#endif
@@ -842,8 +842,8 @@ patch_t *Patch_GetRotatedSprite(spriteframe_t *sprite, size_t frame, size_t spri
}
else
{
xpivot = SHORT(patch->leftoffset);
ypivot = SHORT(patch->height) / 2;
xpivot = patch->leftoffset;
ypivot = patch->height / 2;
}
RotatedPatch_DoRotation(rotsprite, patch, rotationangle, xpivot, ypivot, flip);
@@ -902,9 +902,9 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
size_t size;
INT32 bflip = (flip != 0x00);
INT32 width = SHORT(patch->width);
INT32 height = SHORT(patch->height);
INT32 leftoffset = SHORT(patch->leftoffset);
INT32 width = patch->width;
INT32 height = patch->height;
INT32 leftoffset = patch->leftoffset;
INT32 newwidth, newheight;
fixed_t ca = rollcosang[angle];
@@ -975,7 +975,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
}
ox = (newwidth / 2) + (leftoffset - xpivot);
oy = (newheight / 2) + (SHORT(patch->topoffset) - ypivot);
oy = (newheight / 2) + (patch->topoffset - ypivot);
width = (maxx - minx);
height = (maxy - miny);
+50 -18
View File
@@ -28,7 +28,6 @@
#include "z_zone.h"
#include "p_tick.h"
#include "r_fps.h"
#include "r_portal.h"
//
// opening
@@ -40,6 +39,12 @@
// good night sweet prince
//#define SHITPLANESPARENCY
//SoM: 3/23/2000: Use Boom visplane hashing.
#define VISPLANEHASHBITS 9
#define VISPLANEHASHMASK ((1<<VISPLANEHASHBITS)-1)
// the last visplane list is outside of the hash table and is used for fof planes
#define MAXVISPLANES ((1<<VISPLANEHASHBITS)+1)
static visplane_t *visplanes[MAXVISPLANES];
static visplane_t *freetail;
static visplane_t **freehead = &freetail;
@@ -107,6 +112,50 @@ void R_InitPlanes(void)
// FIXME: unused
}
// R_PortalStoreClipValues
// Saves clipping values for later. -Red
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale)
{
INT32 i;
for (i = 0; i < end-start; i++)
{
*ceil = ceilingclip[start+i];
ceil++;
*floor = floorclip[start+i];
floor++;
*scale = frontscale[start+i];
scale++;
}
}
// R_PortalRestoreClipValues
// Inverse of the above. Restores the old value!
void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale)
{
INT32 i;
for (i = 0; i < end-start; i++)
{
ceilingclip[start+i] = *ceil;
ceil++;
floorclip[start+i] = *floor;
floor++;
frontscale[start+i] = *scale;
scale++;
}
// HACKS FOLLOW
for (i = 0; i < start; i++)
{
floorclip[i] = -1;
ceilingclip[i] = (INT16)viewheight;
}
for (i = end; i < vid.width; i++)
{
floorclip[i] = -1;
ceilingclip[i] = (INT16)viewheight;
}
}
//
// Water ripple effect!!
// Needs the height of the plane, and the vertical position of the span.
@@ -258,23 +307,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
spanfunc();
}
void R_ClearFFloorClips (void)
{
INT32 i, p;
// opening / clipping determination
for (i = 0; i < viewwidth; i++)
{
for (p = 0; p < MAXFFLOORS; p++)
{
ffloor[p].f_clip[i] = (INT16)viewheight;
ffloor[p].c_clip[i] = -1;
}
}
numffloors = 0;
}
//
// R_ClearPlanes
// At begining of frame.
+2 -2
View File
@@ -18,7 +18,6 @@
#include "r_data.h"
#include "p_polyobj.h"
//SoM: 3/23/2000: Use Boom visplane hashing.
#define VISPLANEHASHBITS 9
#define VISPLANEHASHMASK ((1<<VISPLANEHASHBITS)-1)
// the last visplane list is outside of the hash table and is used for fof planes
@@ -76,8 +75,9 @@ extern fixed_t *yslope;
extern lighttable_t **planezlight;
void R_InitPlanes(void);
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
void R_ClearPlanes(void);
void R_ClearFFloorClips (void);
void R_MapPlane(INT32 y, INT32 x1, INT32 x2);
void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2);
-193
View File
@@ -1,193 +0,0 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
// Copyright (C) 1996 by id Software, Inc.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file r_portal.c
/// \brief Software renderer portals.
#include "r_portal.h"
#include "r_plane.h"
#include "r_main.h" // viewheight, viewwidth
#include "z_zone.h"
#include "r_things.h"
#include "r_sky.h"
UINT8 portalrender; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */
// Linked list for portals.
portal_t *portal_base, *portal_cap;
line_t *portalclipline;
sector_t *portalcullsector;
INT32 portalclipstart, portalclipend;
portal_t *g_portal; // is curline a portal seg?
void Portal_InitList (void)
{
portalrender = 0;
portal_base = portal_cap = NULL;
}
/** Store the clipping window for a portal in its given range.
*
* The window is copied from the current window at the time
* the function is called, so it is useful for converting one-sided
* lines into portals.
*/
static void Portal_ClipRange (portal_t* portal)
{
INT32 start = portal->start;
INT32 end = portal->end;
INT16 *ceil = portal->ceilingclip;
INT16 *floor = portal->floorclip;
fixed_t *scale = portal->frontscale;
INT32 i;
for (i = 0; i < end-start; i++)
{
*ceil = ceilingclip[start+i];
ceil++;
*floor = floorclip[start+i];
floor++;
*scale = frontscale[start+i];
scale++;
}
}
/** Apply the clipping window from a portal.
*/
void Portal_ClipApply (const portal_t* portal)
{
INT32 i;
INT32 start = portal->start;
INT32 end = portal->end;
INT16 *ceil = portal->ceilingclip;
INT16 *floor = portal->floorclip;
fixed_t *scale = portal->frontscale;
for (i = 0; i < end-start; i++)
{
ceilingclip[start+i] = *ceil;
ceil++;
floorclip[start+i] = *floor;
floor++;
frontscale[start+i] = *scale;
scale++;
}
// HACKS FOLLOW
for (i = 0; i < start; i++)
{
floorclip[i] = -1;
ceilingclip[i] = (INT16)viewheight;
}
for (i = end; i < vid.width; i++)
{
floorclip[i] = -1;
ceilingclip[i] = (INT16)viewheight;
}
}
static portal_t* Portal_Add (const INT16 x1, const INT16 x2)
{
portal_t *portal = Z_Malloc(sizeof(portal_t), PU_LEVEL, NULL);
INT16 *ceilingclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL);
INT16 *floorclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL);
fixed_t *frontscalesave = Z_Malloc(sizeof(fixed_t)*(x2-x1 + 1), PU_LEVEL, NULL);
// Linked list.
if (!portal_base)
{
portal_base = portal;
portal_cap = portal;
}
else
{
portal_cap->next = portal;
portal_cap = portal;
}
portal->next = NULL;
// Store clipping values so they can be restored once the portal is rendered.
portal->ceilingclip = ceilingclipsave;
portal->floorclip = floorclipsave;
portal->frontscale = frontscalesave;
portal->start = x1;
portal->end = x2;
// Increase recursion level.
portal->pass = portalrender+1;
return portal;
}
void Portal_Remove (portal_t* portal)
{
portalcullsector = NULL;
portal_base = portal->next;
Z_Free(portal->ceilingclip);
Z_Free(portal->floorclip);
Z_Free(portal->frontscale);
Z_Free(portal);
}
/** Creates a portal out of two lines and a determined screen range.
*
* line1 determines the entrance, and line2 the exit.
* x1 and x2 determine the screen's column bounds.
* The view's offset from the entry line center is obtained,
* and then rotated&translated to the exit line's center.
* When the portal renders, it will create the illusion of
* the two lines being seamed together.
*/
void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, const INT32 x2)
{
portal_t* portal = Portal_Add(x1, x2);
// Offset the portal view by the linedef centers
line_t* start = &lines[line1];
line_t* dest = &lines[line2];
angle_t dangle = R_PointToAngle2(0,0,dest->dx,dest->dy) - R_PointToAngle2(start->dx,start->dy,0,0);
fixed_t disttopoint;
angle_t angtopoint;
vertex_t dest_c, start_c;
// looking glass center
start_c.x = (start->v1->x + start->v2->x) / 2;
start_c.y = (start->v1->y + start->v2->y) / 2;
// other side center
dest_c.x = (dest->v1->x + dest->v2->x) / 2;
dest_c.y = (dest->v1->y + dest->v2->y) / 2;
disttopoint = R_PointToDist2(start_c.x, start_c.y, viewx, viewy);
angtopoint = R_PointToAngle2(start_c.x, start_c.y, viewx, viewy);
angtopoint += dangle;
portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
portal->viewangle = viewangle + dangle;
portal->clipline = line2;
Portal_ClipRange(portal);
g_portal = portal; // this tells R_StoreWallRange that curline is a portal seg
}
-57
View File
@@ -1,57 +0,0 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file r_portal.h
/// \brief Software renderer portal struct, functions, linked list extern.
#ifndef __R_PORTAL__
#define __R_PORTAL__
#include "r_data.h"
/** Portal structure.
*/
typedef struct portal_s
{
struct portal_s *next;
// Viewport.
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
UINT8 pass; /**< Keeps track of the portal's recursion depth. */
INT32 clipline; /**< Optional clipline for line-based portals. */
// Clipping information.
INT32 start; /**< First horizontal pixel coordinate to draw at. */
INT32 end; /**< Last horizontal pixel coordinate to draw at. */
INT16 *ceilingclip; /**< Temporary screen top clipping array. */
INT16 *floorclip; /**< Temporary screen bottom clipping array. */
fixed_t *frontscale;/**< Temporary screen bottom clipping array. */
} portal_t;
extern portal_t* portal_base;
extern portal_t* portal_cap;
extern UINT8 portalrender;
extern line_t *portalclipline;
extern sector_t *portalcullsector;
extern INT32 portalclipstart, portalclipend;
void Portal_InitList (void);
void Portal_Remove (portal_t* portal);
void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, const INT32 x2);
void Portal_ClipApply (const portal_t* portal);
#endif
+5 -16
View File
@@ -15,7 +15,6 @@
#include "r_local.h"
#include "r_sky.h"
#include "r_portal.h"
#include "r_splats.h"
#include "w_wad.h"
@@ -276,7 +275,6 @@ static void R_Render2sidedMultiPatchColumn(column_t *column)
if (dc_yl <= dc_yh && dc_yh < vid.height && dc_yh > 0)
{
dc_source = (UINT8 *)column + 3;
dc_sourcelength = 0;
if (colfunc == wallcolfunc)
twosmultipatchfunc();
@@ -1448,7 +1446,6 @@ static void R_RenderSegLoop (void)
dc_texturemid = rw_midtexturemid;
dc_source = R_GetColumn(midtexture,texturecolumn);
dc_texheight = textureheight[midtexture]>>FRACBITS;
dc_sourcelength = 0;
colfunc();
// dont draw anything more for this column, since
@@ -1496,7 +1493,6 @@ static void R_RenderSegLoop (void)
dc_texturemid = rw_toptexturemid;
dc_source = R_GetColumn(toptexture,texturecolumn);
dc_texheight = textureheight[toptexture]>>FRACBITS;
dc_sourcelength = 0;
colfunc();
ceilingclip[rw_x] = (INT16)mid;
}
@@ -1534,7 +1530,6 @@ static void R_RenderSegLoop (void)
dc_source = R_GetColumn(bottomtexture,
texturecolumn);
dc_texheight = textureheight[bottomtexture]>>FRACBITS;
dc_sourcelength = 0;
colfunc();
floorclip[rw_x] = (INT16)mid;
}
@@ -1610,12 +1605,6 @@ static INT64 R_CalcSegDist(seg_t* seg, INT64 x2, INT64 y2)
}
}
static inline INT32 get_flat_tex (INT32 texnum)
{
texnum = R_GetTextureNum(texnum);
return textures[texnum]->holes ? 0 : texnum; // R_DrawWallColumn cannot render holey textures
}
//
// R_StoreWallRange
// A wall segment will be drawn
@@ -1873,7 +1862,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{
fixed_t texheight;
// single sided line
midtexture = get_flat_tex(sidedef->midtexture);
midtexture = R_GetTextureNum(sidedef->midtexture);
texheight = textureheight[midtexture];
// a single sided line is terminal, so it must mark ends
markfloor = markceiling = true;
@@ -2056,15 +2045,15 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{
// Special case... use offsets from 2nd side but only if it has a texture.
side_t *def = &sides[linedef->sidenum[1]];
toptexture = get_flat_tex(def->toptexture);
toptexture = R_GetTextureNum(def->toptexture);
if (!toptexture) //Second side has no texture, use the first side's instead.
toptexture = get_flat_tex(sidedef->toptexture);
toptexture = R_GetTextureNum(sidedef->toptexture);
texheight = textureheight[toptexture];
}
else
{
toptexture = get_flat_tex(sidedef->toptexture);
toptexture = R_GetTextureNum(sidedef->toptexture);
texheight = textureheight[toptexture];
}
if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked
@@ -2089,7 +2078,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (worldlow > worldbottom || worldlowslope > worldbottomslope) // Only if VISIBLE!!!
{
// bottom texture
bottomtexture = get_flat_tex(sidedef->bottomtexture);
bottomtexture = R_GetTextureNum(sidedef->bottomtexture);
if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked
if (linedef->flags & ML_DONTPEGBOTTOM)
+3
View File
@@ -59,6 +59,9 @@ typedef struct floorsplat_s
struct floorsplat_s *nextvis;
} floorsplat_t;
// p_setup.c
fixed_t P_SegLength(seg_t *seg);
// call at P_SetupLevel()
void R_ClearLevelSplats(void);
+4
View File
@@ -94,6 +94,10 @@ extern boolean viewsky, skyVisible;
extern boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible of each splitscreen player
extern sector_t *viewsector;
extern player_t *viewplayer;
extern UINT8 portalrender;
extern sector_t *portalcullsector;
extern line_t *portalclipline;
extern INT32 portalclipstart, portalclipend;
extern consvar_t cv_allowmlook;
extern consvar_t cv_maxportals;
+79 -60
View File
@@ -31,7 +31,6 @@
#include "dehacked.h" // get_number (for thok)
#include "d_netfil.h" // blargh. for nameonly().
#include "m_cheat.h" // objectplace
#include "r_portal.h"
#include "k_kart.h" // SRB2kart
#include "p_local.h" // stplyr
#ifdef HWRENDER
@@ -44,7 +43,7 @@ CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2];
static void R_InitSkins(void);
#define MINZ (FRACUNIT*16)
#define MINZ (FRACUNIT*4)
#define BASEYCENTER (BASEVIDHEIGHT/2)
typedef struct
@@ -523,7 +522,7 @@ void R_InitSprites(void)
// it can be is do before loading config for skin cvar possible value
R_InitSkins();
for (i = 0; i < numwadfiles; i++)
for (i = 0; i < numwadfiles; i++)
{
R_AddSkins((UINT16)i, false);
R_LoadSpriteInfoLumps(i, wadfiles[i]->numlumps);
@@ -584,9 +583,6 @@ void R_DrawMaskedColumn(column_t *column)
basetexturemid = dc_texturemid;
if (!column || column == 0)
return;
for (; column->topdelta != 0xff ;)
{
// calculate unclipped screen coordinates
@@ -622,7 +618,6 @@ void R_DrawMaskedColumn(column_t *column)
if (dc_yl <= dc_yh && dc_yh > 0 && column->length != 0)
{
dc_source = (UINT8 *)column + 3;
dc_sourcelength = column->length;
dc_texturemid = basetexturemid - (topdelta<<FRACBITS);
// Drawn by R_DrawColumn.
@@ -687,7 +682,6 @@ static void R_DrawFlippedMaskedColumn(column_t *column)
if (dc_yl <= dc_yh && dc_yh > 0 && column->length != 0)
{
dc_source = ZZ_Alloc(column->length);
dc_sourcelength = column->length;
for (s = (UINT8 *)column+2+column->length, d = dc_source; d < dc_source+column->length; --s)
*d++ = *s;
dc_texturemid = basetexturemid - (topdelta<<FRACBITS);
@@ -733,7 +727,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
if (overflow_test < 0) overflow_test = -overflow_test;
if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // ditto
}
// TODO This check should not be necessary. But Papersprites near to the camera will sometimes create invalid values
// for the vissprite's startfrac. This happens because they are not depth culled like other sprites.
// Someone who is more familiar with papersprites pls check and try to fix <3
@@ -805,7 +799,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
dc_colormap += COLORMAP_REMAPOFFSET;
dc_texturemid = vis->texturemid;
dc_texheight = SHORT(patch->height);
dc_texheight = 0;
frac = vis->startfrac;
windowtop = windowbottom = sprbotscreen = INT32_MAX;
@@ -814,10 +808,8 @@ static void R_DrawVisSprite(vissprite_t *vis)
this_scale = FixedMul(this_scale, ((skin_t *)vis->mobj->localskin)->highresscale);
else if (vis->mobj->skin && ((skin_t *)vis->mobj->skin)->flags & SF_HIRES)
this_scale = FixedMul(this_scale, ((skin_t *)vis->mobj->skin)->highresscale);
if (this_scale <= 0)
this_scale = 1;
if (this_scale != FRACUNIT)
{
if (!vis->isScaled)
@@ -883,10 +875,12 @@ static void R_DrawVisSprite(vissprite_t *vis)
}
else
{
pwidth = SHORT(patch->width);
// Non-paper drawing loop
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale)
{
texturecolumn = CLAMP(frac >> FRACBITS, 0, SHORT(patch->width) - 1);
{
texturecolumn = CLAMP(frac >> FRACBITS, 0, pwidth - 1);
column = (column_t *)((UINT8 *)patch + LONG(patch->columnofs[texturecolumn]));
localcolfunc (column);
@@ -932,7 +926,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
dc_iscale = FixedDiv(FRACUNIT, vis->scale);
dc_texturemid = FixedDiv(vis->texturemid, this_scale);
dc_texheight = SHORT(patch->height);
dc_texheight = 0;
frac = vis->startfrac;
spryscale = vis->scale;
@@ -947,14 +941,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale)
{
texturecolumn = frac>>FRACBITS;
if (texturecolumn < 0 || texturecolumn >= patch->width)
{
CONS_Debug(DBG_RENDER, "R_DrawPrecipitationSpriteRange: bad texturecolumn\n");
break;
}
texturecolumn = CLAMP(frac >> FRACBITS, 0, SHORT(patch->width) - 1);
column = (column_t *)((UINT8 *)patch + LONG(patch->columnofs[texturecolumn]));
R_DrawMaskedColumn(column);
@@ -1167,17 +1154,17 @@ static void R_ProjectSprite(mobj_t *thing)
angle_t pitchnroll = 0;
angle_t sliptiderollangle = 0;
#endif
INT32 dist = -1;
if (cv_maxinterpdist.value)
if (cv_grmaxinterpdist.value)
dist = R_QuickCamDist(thing->x, thing->y);
// uncapped/interpolation
interpmobjstate_t interp = {0};
// do interpolation
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value))
{
R_InterpolateMobjState(oldthing, rendertimefrac, &interp);
}
@@ -1269,7 +1256,7 @@ static void R_ProjectSprite(mobj_t *thing)
{
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
camang = R_PointToAngle (interp.x, interp.y);
if (mirrored)
ang = InvAngle(ang);
}
@@ -1286,9 +1273,9 @@ static void R_ProjectSprite(mobj_t *thing)
// choose a different rotation based on player view
//ang = R_PointToAngle (interp.x, interp.y) - interpangle;
if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right
if ((ang < ANGLE_180) && (sprframe->rotate & SRF_RIGHT)) // See from right
rot = 6; // F7 slot
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
else if ((ang >= ANGLE_180) && (sprframe->rotate & SRF_LEFT)) // See from left
rot = 2; // F3 slot
else // Normal behaviour
rot = (ang+ANGLE_202h)>>29;
@@ -1299,7 +1286,7 @@ static void R_ProjectSprite(mobj_t *thing)
}
I_Assert(lump < max_spritelumps);
if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES)
this_scale = FixedMul(this_scale, ((skin_t *)thing->localskin)->highresscale);
else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
@@ -1312,7 +1299,7 @@ static void R_ProjectSprite(mobj_t *thing)
#ifdef ROTSPRITE
pitchnroll = 0; // set this to 0, non-paper sprites will affect this value
if (cv_spriteroll.value)
{
if (papersprite)
@@ -1358,10 +1345,10 @@ static void R_ProjectSprite(mobj_t *thing)
if (rotsprite != NULL)
{
spr_width = SHORT(rotsprite->width) << FRACBITS;
spr_height = SHORT(rotsprite->height) << FRACBITS;
spr_offset = SHORT(rotsprite->leftoffset) << FRACBITS;
spr_topoffset = SHORT(rotsprite->topoffset) << FRACBITS;
spr_width = rotsprite->width << FRACBITS;
spr_height = rotsprite->height << FRACBITS;
spr_offset = rotsprite->leftoffset << FRACBITS;
spr_topoffset = rotsprite->topoffset << FRACBITS;
spr_topoffset += FEETADJUST;
// flip -> rotate, not rotate -> flip
@@ -1379,8 +1366,21 @@ static void R_ProjectSprite(mobj_t *thing)
if (spritexscale < 1 || spriteyscale < 1)
return;
spr_offset += interp.spritexoffset;
spr_topoffset += interp.spriteyoffset;
if (thing->renderflags & RF_ABSOLUTEOFFSETS)
{
spr_offset = interp.spritexoffset;
spr_topoffset = interp.spriteyoffset;
}
else
{
SINT8 flipoffset = 1;
if ((thing->renderflags & RF_FLIPOFFSETS) && flip)
flipoffset = -1;
spr_offset += interp.spritexoffset * flipoffset;
spr_topoffset += interp.spriteyoffset * flipoffset;
}
if (flip)
offset = spr_offset - spr_width;
@@ -1457,7 +1457,7 @@ static void R_ProjectSprite(mobj_t *thing)
tx2 += FixedDiv(tx-tx2, div);
tz2 = FixedMul(MINZ, this_scale);
}
if ((tx2 / 4) < -(FixedMul(tz2, fovtan)) || (tx / 4) > FixedMul(tz, fovtan)) // too far off the side?
return;
@@ -1485,7 +1485,7 @@ static void R_ProjectSprite(mobj_t *thing)
return;
range++; // fencepost problem
if (range > 32767)
{
// If the range happens to be too large for fixed_t,
@@ -1528,7 +1528,7 @@ static void R_ProjectSprite(mobj_t *thing)
// PORTAL SPRITE CLIPPING
if (portalrender && portalclipline)
{
if (x2 < portalclipstart || x1 >= portalclipend)
if (x2 < portalclipstart || x1 > portalclipend)
return;
if (P_PointOnLineSide(interp.x, interp.y, portalclipline) != 0)
@@ -1600,6 +1600,7 @@ static void R_ProjectSprite(mobj_t *thing)
// store information in a vissprite
vis = R_NewVisSprite();
vis->renderflags = thing->renderflags;
vis->heightsec = heightsec; //SoM: 3/17/2000
vis->mobjflags = thing->flags;
vis->scale = yscale; //<<detailshift;
@@ -1620,8 +1621,17 @@ static void R_ProjectSprite(mobj_t *thing)
vis->mobj = thing; // Easy access! Tails 06-07-2002
vis->x1 = x1 < portalclipstart ? portalclipstart : x1;
vis->x2 = x2 >= portalclipend ? portalclipend-1 : x2;
vis->x1 = x1 < 0 ? 0 : x1;
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
// PORTAL SEMI-CLIPPING
if (portalrender && portalclipline)
{
if (vis->x1 < portalclipstart)
vis->x1 = portalclipstart;
if (vis->x2 > portalclipend)
vis->x2 = portalclipend;
}
vis->sector = thing->subsector->sector;
vis->szt = (INT16)((centeryfrac - FixedMul(vis->gzt - viewz, sortscale))>>FRACBITS);
@@ -1739,7 +1749,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
INT32 dist = 1;
if (cv_maxinterpdist.value)
if (cv_grmaxinterpdist.value)
dist = R_QuickCamDist(thing->x, thing->y);
// uncapped/interpolation
@@ -1752,7 +1762,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
}
// do interpolation
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value))
{
R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp);
}
@@ -1831,7 +1841,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
// PORTAL SPRITE CLIPPING
if (portalrender && portalclipline)
{
if (x2 < portalclipstart || x1 >= portalclipend)
if (x2 < portalclipstart || x1 > portalclipend)
return;
if (P_PointOnLineSide(interp.x, interp.y, portalclipline) != 0)
@@ -1865,8 +1875,17 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->scalestep = 0;
vis->paperdistance = 0;
vis->x1 = x1 < portalclipstart ? portalclipstart : x1;
vis->x2 = x2 >= portalclipend ? portalclipend-1 : x2;
vis->x1 = x1 < 0 ? 0 : x1;
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
// PORTAL SEMI-CLIPPING
if (portalrender && portalclipline)
{
if (vis->x1 < portalclipstart)
vis->x1 = portalclipstart;
if (vis->x2 > portalclipend)
vis->x2 = portalclipend;
}
vis->xscale = xscale; //SoM: 4/17/2000
vis->sector = thing->subsector->sector;
@@ -2370,7 +2389,7 @@ static drawnode_t *R_CreateDrawNode(drawnode_t *link)
node->thickseg = NULL;
node->ffloor = NULL;
node->sprite = NULL;
ps_numdrawnodes.value.i++;
return node;
}
@@ -2647,7 +2666,7 @@ static void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2)
if (spr->cliptop[x] == -2)
spr->cliptop[x] = -1;
}
// Check if it'll be visible
// Not done for floorsprites.
if (cv_spriteclip.value)
@@ -2722,7 +2741,7 @@ void R_ClipSprites(void)
for (; clippedvissprites < visspritecount; clippedvissprites++)
{
vissprite_t *spr = R_GetVisSprite(clippedvissprites);
if (cv_spriteclip.value
&& (spr->szt > vid.height || spr->sz < 0))
{
@@ -2747,7 +2766,7 @@ void R_ClipSprites(void)
}
R_ClipVisSprite(spr, spr->x1, spr->x2);
if ((spr->cut & SC_NOTVISIBLE) == 0)
numvisiblesprites++;
}
@@ -2764,10 +2783,10 @@ boolean R_ThingVisible (mobj_t *thing)
if (splitscreen)
{
if ((viewssnum == 0 && (thing->eflags & MFE_DRAWONLYFORP1))
|| (viewssnum == 1 && (thing->eflags & MFE_DRAWONLYFORP2))
|| (viewssnum == 2 && (thing->eflags & MFE_DRAWONLYFORP2))
|| (viewssnum == 3 && (thing->eflags & MFE_DRAWONLYFORP4)))
if ((viewssnum == 0 && (thing->renderflags & MFE_DRAWONLYFORP1))
|| (viewssnum == 1 && (thing->renderflags & MFE_DRAWONLYFORP2))
|| (viewssnum == 2 && (thing->renderflags & MFE_DRAWONLYFORP2))
|| (viewssnum == 3 && (thing->renderflags & MFE_DRAWONLYFORP4)))
return true;
}
@@ -3274,7 +3293,7 @@ static int skinSortFunc(const void *a, const void *b) //tbh i have no clue what
void sortSkinGrid(void)
{
//CONS_Printf("Sorting skin list (%d)...\n", cv_skinselectgridsort.value);
qs22j(skinsorted, numskins, sizeof(UINT8), skinSortFunc);
qs22j(skinsorted, numskins, sizeof(UINT8), skinSortFunc);
}
//
@@ -3300,12 +3319,12 @@ void R_AddSkins(UINT16 wadnum, boolean local)
// advance by default
lastlump = lump + 1;
if (!local && numskins >= MAXSKINS)
if (numskins >= MAXSKINS)
{
CONS_Alert(CONS_WARNING, M_GetText("Unable to add skin, too many characters are loaded (%d maximum)\n"), MAXSKINS);
continue; // so we know how many skins couldn't be added
}
if (local && numlocalskins >= MAXLOCALSKINS)
if (numlocalskins >= MAXLOCALSKINS)
{
CONS_Alert(CONS_WARNING, M_GetText("Unable to add localskin, too many localskins are loaded (%d maximum)\n"), MAXLOCALSKINS);
continue; // so we know how many skins couldn't be added
@@ -3558,7 +3577,7 @@ next_token:
Forceskin_cons_t[numskins+1].value = numskins;
Forceskin_cons_t[numskins+1].strvalue = skins[numskins].name;
}
skin->localskin = local;
// so we dont have to guess
@@ -3585,7 +3604,7 @@ next_token:
CONS_Debug(DBG_SETUP, M_GetText("Incremented %d, %d to %d\n"), skin->kartspeed, skin->kartweight, skinstatscount[skin->kartspeed - 1][skin->kartweight - 1]);
skinsorted[numskins] = numskins;
}
allskins[numallskins] = ( (local) ? localskins : skins )[( (local) ? numlocalskins : numskins )];
local ? numlocalskins++ : numskins++;
-1
View File
@@ -55,7 +55,6 @@ extern fixed_t sprtopscreen;
extern fixed_t sprbotscreen;
extern fixed_t windowtop;
extern fixed_t windowbottom;
extern INT32 lengthcol;
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);
+13 -14
View File
@@ -2191,11 +2191,11 @@ static boolean oldencore = false;
static boolean skipmusic = false;
boolean skipintromus = false;
static const char *musicexception_list[17] = {
static const char *musicexception_list[16] = {
"vote", "voteea", "voteeb", "racent", "krwin",
"krok", "krlose", "krfail", "kbwin", "kbok",
"kblose", "kstart", "estart", "wait2j", "titles",
"CHRSHF", "CHRSHP" // no clue what those are tbh
"kblose", "kstart", "estart", "wait2j", "CHRSHP",
"CHRSHF"
};
//checks for any kind of event music like intermission, vote etc.
@@ -2207,7 +2207,7 @@ static void S_CheckEventMus(const char *newmus)
if (!cv_keepmusic.value)
return;
for (int i = 0; i < 17; i++)
for (int i = 0; i < 16; i++)
if (stricmp(music_name, musicexception_list[i]) == 0 || stricmp(newmus, musicexception_list[i]) == 0) // weird? sure! but were lucky enough newmus reflects whats being replaced
{
skipmusic = true;
@@ -2242,7 +2242,15 @@ void S_CheckMap(void)
//
void S_InitMapMusic(void)
{
skipintromus = false;
if (!cv_skipintromusic.value)
skipintromus = false;
else
{
char *maptitle = G_BuildMapTitle(gamemap);
skipintromus = cv_skipintromusic.value && stricmp(maptitle, "Wandering Falls") != 0; // thanks diggle!
if (maptitle)
Z_Free(maptitle);
}
if (mapmusflags & MUSIC_RELOADRESET)
{
@@ -2260,15 +2268,6 @@ void S_InitMapMusic(void)
// lug: but not when we keep the map music lol
S_StopMusic();
if (cv_skipintromusic.value)
{
char *maptitle = G_BuildMapTitle(gamemap);
// for some reason, occasionally the title screen music doesent seem to be reset in time, so skipping the intro may make it just continue playing it instead, weird..
skipintromus = (stricmp(music_name, "titles") != 0) && (stricmp(maptitle, "Wandering Falls") != 0); // thanks diggle!
if (maptitle)
Z_Free(maptitle);
}
if (skipintromus)
return;
+10 -6
View File
@@ -82,8 +82,7 @@ static void SCR_ChangeFullscreen (void);
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t accuratefps_cons_t[] = {{0, "Inaccurate"}, {1, "Accurate"}, {0, NULL}};
consvar_t cv_accuratefps = {"fpssampling", "1", CV_SAVE, accuratefps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_accuratefps = {"accuratefpscounter", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// =========================================================================
// SCREEN VARIABLES
@@ -355,7 +354,11 @@ void SCR_ChangeFullscreen(void)
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
{
return (width % BASEVIDWIDTH == 0 && height % BASEVIDHEIGHT == 0 && width / BASEVIDWIDTH == height / BASEVIDHEIGHT);
return
( width % BASEVIDWIDTH == 0
&& height % BASEVIDHEIGHT == 0
&& width / BASEVIDWIDTH == height / BASEVIDHEIGHT
);
}
double averageFPS = 0.0f;
@@ -408,6 +411,7 @@ void SCR_CalculateFPS(void)
if (total_frame_time >= MAX_FRAME_TIME)
{
static int sampleIndex = 0;
int i;
fps_samples[sampleIndex] = frameElapsed;
@@ -416,7 +420,7 @@ void SCR_CalculateFPS(void)
sampleIndex = 0;
averageFPS = 0.0;
for (int i = 0; i < NUM_FPS_SAMPLES; i++)
for (i = 0; i < NUM_FPS_SAMPLES; i++)
{
averageFPS += fps_samples[i];
}
@@ -454,7 +458,7 @@ void SCR_DisplayTicRate(void)
return;
// new kart counter
if (cv_ticrate.value == 1 || cv_ticrate.value == 2)
if ((cv_ticrate.value == 1) || (cv_ticrate.value == 2))
{
// draw "FPS"
if (cv_ticrate.value == 1)
@@ -488,7 +492,7 @@ void SCR_DisplayTicRate(void)
// draw our actual framerate
V_DrawPingNum(x, 190, fpsflags, fps, ticcntcolor);
}
else if (cv_ticrate.value == 3 || cv_ticrate.value == 4) // kart v1.0/srb2 counter
else if ((cv_ticrate.value == 3)||(cv_ticrate.value == 4)) // kart v1.0/srb2 counter
{
if (fps > (benchmark - 5))
ticcntcolor2 = V_GREENMAP;
+3 -6
View File
@@ -758,7 +758,7 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
#ifdef USE_FBO_OGL
void I_DownSample(void)
{
if (!cv_glframebuffer.value || !supportFBO) //no sense to do this crap if we cant benefit from it
if (!cv_grframebuffer.value || !supportFBO) //no sense to do this crap if we cant benefit from it
{
downsample = false;
return;
@@ -781,11 +781,8 @@ void I_DownSample(void)
}
else
{
if (downsample == true)
{
downsample = false; // its not so no need to do crap
RefreshOGLSDLSurface();
}
downsample = false; // its not so no need to do crap
RefreshOGLSDLSurface();
}
}
+19 -26
View File
@@ -68,19 +68,10 @@ PFNglGetIntegerv pglGetIntegerv;
PFNglGetString pglGetString;
#endif
#ifdef USE_FBO_OGL
#if defined (__unix__)
#ifdef USE_FBO_OGL
static boolean isnvidiagpu = false;
#endif
boolean UseScreenFBO(void)
{
return ((supportFBO && cv_glframebuffer.value && downsample)
#if defined (__unix__)
|| (supportFBO && isnvidiagpu && xwaylandcrap)
#endif
);
}
#endif
/** \brief SDL video display surface
@@ -121,11 +112,10 @@ boolean LoadGL(void)
\return if true, changed video mode
*/
static boolean first_init = false;
boolean OglSdlSurface(INT32 w, INT32 h)
{
INT32 cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
static boolean first_init = false;
const char *gllogdir = NULL;
oglflags = 0;
@@ -181,7 +171,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
else
maximumAnisotropy = 1;
glanisotropicmode_cons_t[1].value = maximumAnisotropy;
granisotropicmode_cons_t[1].value = maximumAnisotropy;
#if defined (__unix__)
#ifdef USE_FBO_OGL
@@ -190,6 +180,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
#endif
#endif
}
first_init = true;
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
@@ -211,25 +202,21 @@ boolean OglSdlSurface(INT32 w, INT32 h)
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
#ifdef USE_FBO_OGL
RenderToFramebuffer = ((FrameBufferEnabled && supportFBO && downsample)
#if defined (__unix__)
|| (isnvidiagpu && xwaylandcrap)
#endif
);
if (!supportFBO)
{
if (cv_glframebuffer.value)
CV_SetValue(&cv_glframebuffer, 0);
}
if (UseScreenFBO())
if (RenderToFramebuffer)
GLFramebuffer_Enable();
else
GLFramebuffer_Disable();
#endif
if (!first_init)
HWR_Startup();
HWR_Startup();
textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
first_init = true;
return true;
}
@@ -254,14 +241,20 @@ void OglSdlFinishUpdate(boolean waitvbl)
HWR_MakeScreenFinalTexture();
#ifdef USE_FBO_OGL
if (UseScreenFBO())
RenderToFramebuffer = ((FrameBufferEnabled && supportFBO && downsample)
#if defined (__unix__)
|| (isnvidiagpu && xwaylandcrap)
#endif
);
if (RenderToFramebuffer)
GLFramebuffer_Unbind();
#endif
HWR_DrawScreenFinalTexture(sdlw, sdlh);
#ifdef USE_FBO_OGL
if (UseScreenFBO())
if (RenderToFramebuffer)
GLFramebuffer_Enable();
#endif
+4 -28
View File
@@ -15,7 +15,6 @@
#include "doomdef.h"
#include "g_game.h"
#include "g_input.h"
#include "r_local.h"
#include "p_local.h"
#include "f_finale.h"
@@ -774,33 +773,10 @@ static void ST_overlayDrawer(void)
}
else
{
if (cv_showdirectorhud.value)
{
V_DrawString(2, BASEVIDHEIGHT-50, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -"));
V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt);
V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Accelerate - Float"));
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Brake - Sink"));
char directortoggle[32] = {0};
const char *item1 = gamecontrol[gc_director][0] != 0 ? G_KeynumToString(gamecontrol[gc_director][0]) : NULL;
const char *item2 = gamecontrol[gc_director][1] != 0 ? G_KeynumToString(gamecontrol[gc_director][1]) : NULL;
if (item1 != NULL && item2 != NULL)
snprintf(directortoggle, 32, "%s/%s - Toggle Director", item1, item2);
else
snprintf(directortoggle, 32, "%s - Toggle Director", item1 != NULL ? item1 : item2 != NULL ? item2 : "Not Bound");
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, directortoggle);
directortextactive = true;
}
else
{
V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -"));
V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt);
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Accelerate - Float"));
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Brake - Sink"));
}
V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -"));
V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt);
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Accelerate - Float"));
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Brake - Sink"));
}
}
}
+60 -61
View File
@@ -1112,7 +1112,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
if (x >= vid.width || y >= vid.height)
return; // off the screen
if (x < 0)
{
w += x;
@@ -1126,7 +1126,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
if (w <= 0 || h <= 0)
return; // zero width/height wouldn't draw anything
if (x + w > vid.width)
w = vid.width-x;
if (y + h > vid.height)
@@ -1149,7 +1149,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
}
c &= 255;
if (alphalevel)
{
const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<<FF_TRANSSHIFT) + (c*256));
@@ -2495,7 +2495,7 @@ void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *str
default:
break;
}
charflags = (option & V_CHARCOLORMASK);
colormap = V_GetStringColormap(charflags);
@@ -3189,7 +3189,7 @@ INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
// Perform a particular image postprocessing function.
//
void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param)
{
#if NUMSCREENS < 5
// do not enable image post processing for ARM, SH and MIPS CPUs
@@ -3197,7 +3197,6 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
(void)type;
(void)param;
#else
(void)param; // unused motion blur stuff
INT32 yoffset, xoffset;
#ifdef HWRENDER
@@ -3208,9 +3207,6 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
if (view < 0 || view > 3 || view > splitscreen)
return;
if (!player->postimgflags)
return;
if ((view == 1 && splitscreen == 1) || view >= 2)
yoffset = viewheight;
else
@@ -3221,11 +3217,10 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
else
xoffset = 0;
UINT8 *tmpscr = screens[4];
UINT8 *srcscr = screens[0];
if (player->postimgflags & POSTIMG_WATER)
if (type == postimg_water)
{
UINT8 *tmpscr = screens[4];
UINT8 *srcscr = screens[0];
INT32 y;
// Set disStart to a range from 0 to FINEANGLE, incrementing by 128 per tic
angle_t disStart = (((leveltime-1)*128) + (rendertimefrac / (FRACUNIT/128))) & FINEMASK;
@@ -3262,30 +3257,29 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
}
/*
Unoptimized version
for (x = 0; x < vid.width*vid.bpp; x++)
{
newpix = (x + sine);
Unoptimized version
for (x = 0; x < vid.width*vid.bpp; x++)
{
newpix = (x + sine);
if (newpix < 0)
newpix = 0;
else if (newpix >= vid.width)
newpix = vid.width-1;
tmpscr[y*vid.width + x] = srcscr[y*vid.width+newpix]; // *(transme + (srcscr[y*vid.width+x]<<8) + srcscr[y*vid.width+newpix]);
}*/
if (newpix < 0)
newpix = 0;
else if (newpix >= vid.width)
newpix = vid.width-1;
tmpscr[y*vid.width + x] = srcscr[y*vid.width+newpix]; // *(transme + (srcscr[y*vid.width+x]<<8) + srcscr[y*vid.width+newpix]);
}*/
disStart += 22;//the offset into the displacement map, increment each game loop
disStart &= FINEMASK; //clip it to FINEMASK
}
UINT8 *tmp = tmpscr;
tmpscr = srcscr;
srcscr = tmp;
VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset,
viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width);
}
/*if (player->postimgflags & POSTIMG_MOTION) // Motion Blur!
{
else if (type == postimg_motion) // Motion Blur!
{
UINT8 *tmpscr = screens[4];
UINT8 *srcscr = screens[0];
INT32 x, y;
// TODO: Add a postimg_param so that we can pick the translucency level...
@@ -3294,12 +3288,30 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
for (y = yoffset; y < yoffset+viewheight; y++)
{
for (x = xoffset; x < xoffset+viewwidth; x++)
tmpscr[y*vid.width + x] = colormaps[*(transme + (srcscr [(y*vid.width)+x ] <<8) + (tmpscr[(y*vid.width)+x]))];
{
tmpscr[y*vid.width + x]
= colormaps[*(transme + (srcscr [(y*vid.width)+x ] <<8) + (tmpscr[(y*vid.width)+x]))];
}
}
}*/
if (player->postimgflags & POSTIMG_HEAT) // Heat wave
VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset,
viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width);
}
else if (type == postimg_flip) // Flip the screen upside-down
{
UINT8 *tmpscr = screens[4];
UINT8 *srcscr = screens[0];
INT32 y, y2;
for (y = yoffset, y2 = yoffset+viewheight - 1; y < yoffset+viewheight; y++, y2--)
M_Memcpy(&tmpscr[(y2*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset], viewwidth);
VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset,
viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width);
}
else if (type == postimg_heat) // Heat wave
{
UINT8 *tmpscr = screens[4];
UINT8 *srcscr = screens[0];
INT32 y;
// Make sure table is built
@@ -3340,53 +3352,40 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
heatindex[view] %= vid.height;
}
UINT8 *tmp = tmpscr;
tmpscr = srcscr;
srcscr = tmp;
VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset,
viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width);
}
if ((player->postimgflags & POSTIMG_FLIP) && !(player->postimgflags & POSTIMG_MIRROR)) // Flip the screen upside-down
{
INT32 y, y2;
for (y = yoffset, y2 = yoffset+viewheight - 1; y < yoffset+viewheight; y++, y2--)
M_Memcpy(&tmpscr[(y2*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset], viewwidth);
UINT8 *tmp = tmpscr;
tmpscr = srcscr;
srcscr = tmp;
}
else if ((player->postimgflags & POSTIMG_MIRROR) && !(player->postimgflags & POSTIMG_FLIP)) // Flip the screen on the x axis
else if (type == postimg_mirror) // Flip the screen on the x axis
{
UINT8 *tmpscr = screens[4];
UINT8 *srcscr = screens[0];
INT32 y, x, x2;
for (y = yoffset; y < yoffset+viewheight; y++)
{
for (x = xoffset, x2 = xoffset+((viewwidth*vid.bpp)-1); x < xoffset+(viewwidth*vid.bpp); x++, x2--)
tmpscr[y*vid.width + x2] = srcscr[y*vid.width + x];
}
UINT8 *tmp = tmpscr;
tmpscr = srcscr;
srcscr = tmp;
VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset,
viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width);
}
else if ((player->postimgflags & POSTIMG_MIRROR) && (player->postimgflags & POSTIMG_FLIP)) // Flip the screen upside-down and on the x axis
else if (type == postimg_mirrorflip) // Flip the screen upside-down and on the x axis
{
UINT8 *tmpscr = screens[4];
UINT8 *srcscr = screens[0];
INT32 y, x;
for (y = yoffset; y < yoffset + viewheight; y++)
for (x = xoffset; x < xoffset + viewwidth; x++)
tmpscr[((yoffset + viewheight - 1 - y) * vid.width) + xoffset + viewwidth - (x - xoffset) - 1] = srcscr[(y * vid.width) + x];
UINT8 *tmp = tmpscr;
tmpscr = srcscr;
srcscr = tmp;
VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset,
viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width);
}
VID_BlitLinearScreen(srcscr+vid.width*vid.bpp*yoffset+xoffset, tmpscr+vid.width*vid.bpp*yoffset+xoffset,
viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width);
#endif
}
// Taken from my videos-in-SRB2 project
// Generates a color look-up table
// which has up to 64 colors at each channel
+1 -6
View File
@@ -182,9 +182,6 @@ void V_DrawFadeScreen(UINT16 color, UINT8 strength);
void V_DrawFadeConsBack(INT32 plines);
// allow menu text to be displayed in lowercase
#define MENUCAPS (!cv_menucaps.value ? V_ALLOWLOWERCASE : 0)
// draw a single character
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
// draw a single character, but for the chat
@@ -254,9 +251,7 @@ INT32 V_SubStringLengthToFit(const char *string, INT32 width, INT32 option);
char V_GetSkincolorChar(INT32 color);
typedef struct player_s player_t;
void V_DoPostProcessor(INT32 view, player_t *player, INT32 param);
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
void V_DrawPatchFill(patch_t *pat);
+9 -228
View File
@@ -1699,7 +1699,7 @@ void *W_CacheLumpName(const char *name, INT32 tag)
#ifdef HWRENDER
FUNCINLINE static ATTRINLINE void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
{
GLPatch_t *glPatch;
GLPatch_t *grPatch;
if (rendermode == render_soft || rendermode == render_none)
return W_CacheLumpNumPwad(wad, lump, tag);
@@ -1707,29 +1707,29 @@ FUNCINLINE static ATTRINLINE void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump,
if (!TestValidLump(wad, lump))
return NULL;
glPatch = HWR_GetCachedGLPatchPwad(wad, lump);
grPatch = HWR_GetCachedGLPatchPwad(wad, lump);
if (glPatch->mipmap->data)
if (grPatch->mipmap->data)
{
if (tag == PU_CACHE)
tag = PU_HWRCACHE;
Z_ChangeTag(glPatch->mipmap->data, tag);
Z_ChangeTag(grPatch->mipmap->data, tag);
}
else
{
patch_t *ptr = NULL;
// Only load the patch if we haven't initialised the glPatch yet
if (glPatch->mipmap->width == 0)
ptr = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
// Only load the patch if we haven't initialised the grPatch yet
if (grPatch->mipmap->width == 0)
ptr = W_CacheLumpNumPwad(grPatch->wadnum, grPatch->lumpnum, PU_STATIC);
// Run HWR_MakePatch in all cases, to recalculate some things
HWR_MakePatch(ptr, glPatch, glPatch->mipmap, false);
HWR_MakePatch(ptr, grPatch, grPatch->mipmap, false);
Z_Free(ptr);
}
// return GLPatch_t, which can be casted to (patch_t) with valid patch header info
return (void *)glPatch;
return (void *)grPatch;
}
void *W_CachePatchNum(lumpnum_t lumpnum, INT32 tag)
@@ -2120,225 +2120,6 @@ int W_VerifyNMUSlumps(const char *filename)
return W_VerifyFile(filename, NMUSlist, false);
}
static int W_NameStartsWith(const char *name, lumpchecklist_t *checklist)
{
size_t j;
for (j = 0; checklist[j].len && checklist[j].name; ++j)
{
if (strncasecmp(name, checklist[j].name, checklist[j].len) == 0)
return true;
}
return false;
}
// Checks if file contains at least one lump which name starts with one of strings in checklist
static int W_CheckWADContains(FILE *fp, lumpchecklist_t *checklist)
{
size_t i, j;
// if we're here it's a WAD file
wadinfo_t header;
filelump_t lumpinfo;
// read the header
if (fread(&header, 1, sizeof header, fp) == sizeof header
&& header.numlumps < INT16_MAX
&& strncmp(header.identification, "ZWAD", 4)
&& strncmp(header.identification, "IWAD", 4)
&& strncmp(header.identification, "PWAD", 4)
&& strncmp(header.identification, "SDLL", 4))
{
return true;
}
header.numlumps = LONG(header.numlumps);
header.infotableofs = LONG(header.infotableofs);
// let seek to the lumpinfo list
if (fseek(fp, header.infotableofs, SEEK_SET) == -1)
return true;
for (i = 0; i < header.numlumps; i++)
{
// fill in lumpinfo for this wad file directory
if (fread(&lumpinfo, sizeof (lumpinfo), 1 , fp) != 1)
return -1;
lumpinfo.filepos = LONG(lumpinfo.filepos);
lumpinfo.size = LONG(lumpinfo.size);
if (lumpinfo.size == 0)
continue;
for (j = 0; j < NUMSPRITES; j++)
if (!strncmp(lumpinfo.name, sprnames[j], 4)) // Sprites
continue;
if (W_NameStartsWith(lumpinfo.name, checklist))
return true;
}
return false;
}
static int W_CheckPK3Contains(FILE *fp, lumpchecklist_t *checklist)
{
zend_t zend;
zlentry_t zlentry;
long file_size;/* size of zip file */
long data_size;/* size of data inside zip file */
UINT16 numlumps;
size_t i;
char pat_central[] = {0x50, 0x4b, 0x01, 0x02, 0x00};
char pat_end[] = {0x50, 0x4b, 0x05, 0x06, 0x00};
char lumpname[9];
// Haha the ResGetLumpsZip function doesn't
// check for file errors, so neither will I.
// Central directory bullshit
fseek(fp, 0, SEEK_END);
file_size = ftell(fp);
if (!ResFindSignature(fp, pat_end, max(0, ftell(fp) - (22 + 65536))))
return true;
fseek(fp, -4, SEEK_CUR);
if (fread(&zend, 1, sizeof zend, fp) < sizeof zend)
return true;
data_size = sizeof zend;
numlumps = SHORT(zend.entries);
fseek(fp, LONG(zend.cdiroffset), SEEK_SET);
char *cdir = (char*)(malloc(LONG(zend.cdirsize)));
if (fread(cdir, 1, LONG(zend.cdirsize), fp) < (UINT32)(LONG(zend.cdirsize)))
return true;
size_t offset = 0;
for (i = 0; i < numlumps; i++)
{
zentry_t *zentry = (zentry_t*)(cdir + offset);
char* fullname;
char* trimname;
char* dotpos;
if (memcmp(zentry->signature, pat_central, 4) != 0)
return false;
fullname = (char*)(malloc(SHORT(zentry->namelen) + 1));
strlcpy(fullname, (char*)(zentry + 1), SHORT(zentry->namelen) + 1);
// Strip away file address and extension for the 8char name.
if ((trimname = strrchr(fullname, '/')) != 0)
trimname++;
else
trimname = fullname; // Care taken for root files.
if (*trimname) // Ignore directories, well kinda
{
if ((dotpos = strrchr(trimname, '.')) == 0)
dotpos = fullname + strlen(fullname); // Watch for files without extension.
memset(lumpname, '\0', 9); // Making sure they're initialized to 0. Is it necessary?
strncpy(lumpname, trimname, min(8, dotpos - trimname));
if (W_NameStartsWith(lumpname, checklist))
return true;
}
if (W_NameStartsWith(fullname, checklist))
return true;
free(fullname);
offset += sizeof *zentry + SHORT(zentry->namelen) + SHORT(zentry->xtralen) + SHORT(zentry->commlen);
data_size +=
sizeof *zentry + SHORT(zentry->namelen) + SHORT(zentry->xtralen) + SHORT(zentry->commlen);
if (fseek(fp, LONG(zentry->offset), SEEK_SET) != 0)
return false;
if (fread(&zlentry, 1, sizeof(zlentry_t), fp) < sizeof (zlentry_t))
return false;
data_size +=
sizeof zlentry + SHORT(zlentry.namelen) + SHORT(zlentry.xtralen) + LONG(zlentry.compsize);
}
free(cdir);
if (data_size < file_size)
{
const char * error = "ZIP file has holes (%ld extra bytes)\n";
CONS_Alert(CONS_ERROR, error, (file_size - data_size));
return -1;
}
else if (data_size > file_size)
{
const char * error = "Reported size of ZIP file contents exceeds file size (%ld extra bytes)\n";
CONS_Alert(CONS_ERROR, error, (data_size - file_size));
return -1;
}
else
{
return false;
}
}
static int W_CheckFileContains(const char *filename, lumpchecklist_t *checklist)
{
FILE *handle;
int contains = false;
if (!checklist)
I_Error("No checklist for %s\n", filename);
// open wad file
if ((handle = W_OpenWadFile(&filename, false)) == NULL)
return -1;
if (stricmp(&filename[strlen(filename) - 4], ".pk3") == 0)
contains = W_CheckPK3Contains(handle, checklist);
else
{
// detect wad file by the absence of the other supported extensions
if (stricmp(&filename[strlen(filename) - 4], ".soc")
&& stricmp(&filename[strlen(filename) - 4], ".lua"))
{
contains = W_CheckWADContains(handle, checklist);
}
}
fclose(handle);
return contains;
}
int W_CheckPostLoadList(const char *filename)
{
static lumpchecklist_t postloadlist[] =
{
{"Lua/", 4},
{"SOC/", 4},
{"Skins/", 6},
{"S_SKIN", 6},
{"LUA_", 4},
{"SOC_", 4},
{"MAINCFG", 7},
{"OBJCTCFG", 8},
{"MAP", 3},
{NULL, 0},
};
return W_CheckFileContains(filename, postloadlist);
}
/** \brief Generates a virtual resource used for level data loading.
*
* \param lumpnum_t reference
-2
View File
@@ -226,6 +226,4 @@ void W_VerifyFileMD5(UINT16 wadfilenum, const char *matchmd5);
int W_VerifyNMUSlumps(const char *filename);
int W_CheckPostLoadList(const char *filename);
#endif // __W_WAD__
+7 -13
View File
@@ -388,7 +388,7 @@ void Y_IntermissionDrawer(void)
if (cv_betainterscreen.value == 1
#ifdef HWRENDER
|| (rendermode == render_opengl && cv_glscreentextures.value != 2) // use the neato kart bg for intermission on disabled screen textures
|| (rendermode == render_opengl && cv_grscreentextures.value != 2) // use the neato kart bg for intermission on disabled screen textures
#endif
)
V_DrawPatchFill(bgtile); // use the neato kart bg for intermission on disabled screen textures
@@ -463,12 +463,14 @@ void Y_IntermissionDrawer(void)
for (i = 0; i < data.match.numplayers; i++)
{
boolean dojitter = data.match.jitter[data.match.num[i]];
data.match.jitter[data.match.num[i]] = 0;
if (data.match.num[i] != MAXPLAYERS && playeringame[data.match.num[i]] && !players[data.match.num[i]].spectator)
{
char strtime[MAXPLAYERNAME+1];
// Apply the jitter offset (later reversed)
if (data.match.jitter[data.match.num[i]] > 0)
if (dojitter)
y--;
V_DrawCenteredString(x+6, y, 0, va("%d", data.match.pos[i]));
@@ -557,7 +559,7 @@ void Y_IntermissionDrawer(void)
}
}
if (data.match.jitter[data.match.num[i]] > 0)
if (dojitter)
y++;
}
else
@@ -664,16 +666,8 @@ void Y_Ticker(void)
return;
}
if (intertic < TICRATE || endtic != -1)
{
if (intertic < TICRATE || intertic & 1 || endtic != -1)
return;
}
if (data.match.rankingsmode && intertic & 1)
{
memset(data.match.jitter, 0, sizeof (data.match.jitter));
return;
}
if (intertype == int_race || intertype == int_match)
{