Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6a1e58405 | ||
|
|
ea10c9ac13 | ||
|
|
e6d3f3f27c | ||
|
|
f713b7fb60 | ||
|
|
c35a542d60 | ||
|
|
e6c699faf4 | ||
|
|
f626b4b031 | ||
|
|
aed81c0ff5 | ||
|
|
1354f2f302 | ||
|
|
8ea5d0f729 | ||
|
|
ab93865255 | ||
|
|
1ecdd3dae6 | ||
|
|
ddcd6b0d31 | ||
|
|
5196f1c5b9 | ||
|
|
9dd6ec718f | ||
|
|
69237d6a3a | ||
|
|
426cbee752 | ||
|
|
c2f3486e6d | ||
|
|
e4a575cc5e | ||
|
|
f00c9d8c23 | ||
|
|
f70f7152ab | ||
|
|
8c7f35fa29 | ||
|
|
fe74e69da6 | ||
|
|
c170f53948 | ||
|
|
13fd825bcf | ||
|
|
8ee4fc2fa1 | ||
|
|
679a8387c9 | ||
|
|
9044a46b31 | ||
|
|
e1b41d2c58 | ||
|
|
3204095afb | ||
|
|
538de7d2d2 | ||
|
|
2cba586d9c | ||
|
|
ad4d587a52 | ||
|
|
a929636a28 | ||
|
|
06a2508a9c | ||
|
|
64b2e2ee37 | ||
|
|
b6ef6eb801 | ||
|
|
b4d48cc9ec | ||
|
|
f83a937dc5 | ||
|
|
e2acb4c3fc | ||
|
|
5bf722a1fb | ||
|
|
0751484439 | ||
|
|
e5b16c7aa0 | ||
|
|
bac058d128 | ||
|
|
dd4a9ae890 | ||
|
|
f91687209b | ||
|
|
ec4140a9d2 | ||
|
|
2553c9e878 | ||
|
|
f9f33aa53a | ||
|
|
4455ebe58f | ||
|
|
35cfdea9e7 | ||
|
|
346433d248 | ||
|
|
16a7e69292 | ||
|
|
441824fc70 | ||
|
|
f46b77ab7b | ||
|
|
561af0e601 | ||
|
|
362c21505d | ||
|
|
d3d40de996 | ||
|
|
3ce4653bb5 | ||
|
|
a639c87a90 | ||
|
|
3aac16432a | ||
|
|
1c9ea1eb2e | ||
|
|
a47aea4c9f | ||
|
|
9cd0e6c385 | ||
|
|
c23a0f08c4 | ||
|
|
3ff865b1b6 | ||
|
|
cdedf1349c | ||
|
|
7beab3b582 | ||
|
|
b1b592f88d | ||
|
|
8737a40a4d | ||
|
|
71ce5be570 | ||
|
|
b883d02abb | ||
|
|
09f79a6934 | ||
|
|
9bdcfe9750 | ||
|
|
b767180473 | ||
|
|
acb5d96788 | ||
|
|
228a932598 | ||
|
|
b53cc6fd2b | ||
|
|
01cd8f5a0f | ||
|
|
9732e74bf3 | ||
|
|
2ed4a7b548 | ||
|
|
52c11d1444 | ||
|
|
78d50e4c43 | ||
|
|
7f05d27f42 | ||
|
|
3675fdd361 | ||
|
|
98dfe528d8 | ||
|
|
7da590df94 | ||
|
|
90cc5a6cb0 | ||
|
|
ca9277366c | ||
|
|
e79bf24bcd | ||
|
|
2c1201ff34 | ||
|
|
c4ff1a3aca | ||
|
|
5760f25c74 | ||
|
|
0a6f700c6f | ||
|
|
3147dfb012 | ||
|
|
5007a33bbf | ||
|
|
c65acfa90e | ||
|
|
b167c19137 | ||
|
|
d48b08856e | ||
|
|
9ba5c9a38b | ||
|
|
1a9f30a328 | ||
|
|
97058bfcf6 | ||
|
|
bd41bbb304 | ||
|
|
f47cb885cc | ||
|
|
1ab243d93a | ||
|
|
15d59cbbd8 | ||
|
|
c88d2dadb0 | ||
|
|
a4e96d2380 | ||
|
|
002c550263 | ||
|
|
25b9bc4100 | ||
|
|
7105606475 | ||
|
|
71e4005226 | ||
|
|
76b66b41b6 | ||
|
|
43e1331594 | ||
|
|
23ba3d493b | ||
|
|
487cbc495a | ||
|
|
faeb4d22ed | ||
|
|
9dc2ad4f32 | ||
|
|
ceae12baba | ||
|
|
58c58e9542 | ||
|
|
46c7bf8b03 | ||
|
|
c011d09e33 | ||
|
|
65fadcf709 | ||
|
|
e2b06aa600 | ||
|
|
7ab0a808a9 | ||
|
|
bc7ce5c983 | ||
|
|
6e55d88816 | ||
|
|
97f0ea1b0f | ||
|
|
b6be5bc6b4 | ||
|
|
fca542cd4e | ||
|
|
e3d61b2974 | ||
|
|
9cb84d214e | ||
|
|
6a0069f08f | ||
|
|
4a32bb7f9f | ||
|
|
3404ca63bc | ||
|
|
238688047e | ||
|
|
c0e24c1119 | ||
|
|
cc2bab7736 | ||
|
|
c6d0627f08 | ||
|
|
6c22b1e01a | ||
|
|
144bddea78 | ||
|
|
050ae2ab6d | ||
|
|
f6da608402 | ||
|
|
76685068fe | ||
|
|
d5f1b744bb | ||
|
|
bd221ef0b4 | ||
|
|
dc42c5b8b5 | ||
|
|
c29e6911b1 | ||
|
|
44a31e7561 | ||
|
|
e250e706a0 | ||
|
|
00f09421b8 | ||
|
|
daa747805d | ||
|
|
3612a9cd02 | ||
|
|
78e94b66ba | ||
|
|
8fe9173355 | ||
|
|
1210a885d4 | ||
|
|
25f02f6cd3 | ||
|
|
d69b6672be | ||
|
|
24ccc5eee4 | ||
|
|
d577944143 | ||
|
|
c4746962bd | ||
|
|
664e8c363b | ||
|
|
b5269ebbb5 | ||
|
|
52b4f65582 | ||
|
|
e91c90329d | ||
|
|
ab6f33929d | ||
|
|
557187a305 | ||
|
|
47f194b82e | ||
|
|
5da6739077 | ||
|
|
2f689c1ab7 | ||
|
|
82d30b5abf | ||
|
|
8c3b6911a3 | ||
|
|
294a459fc2 | ||
|
|
44c9b87557 | ||
|
|
911264ccb3 | ||
|
|
9936e38f20 | ||
|
|
e1f402b86c | ||
|
|
124bfe6ca9 | ||
|
|
e3b1dba13c | ||
|
|
6cbd7503f9 | ||
|
|
1cc4c2df72 | ||
|
|
5726658729 | ||
|
|
d0a307e5b5 | ||
|
|
9208a7233f | ||
|
|
e58c66facd | ||
|
|
8117b528ab | ||
|
|
9f4df6b80d | ||
|
|
355a1c2046 | ||
|
|
00d383cc28 | ||
|
|
e46391992a | ||
|
|
fff8b24309 | ||
|
|
59f9705b93 | ||
|
|
7be1c58ba5 | ||
|
|
da1df719e3 | ||
|
|
b626c095d0 | ||
|
|
3df993184b | ||
|
|
ec9c8dba1b | ||
|
|
171d36158c | ||
|
|
22a84a5504 | ||
|
|
53ead1007e | ||
|
|
e852034ca8 | ||
|
|
00112bc4c8 | ||
|
|
4a74eaa6b0 | ||
|
|
ed04181899 | ||
|
|
ed86f2c227 | ||
|
|
1175247614 | ||
|
|
f8825c5024 | ||
|
|
9a8ef2c7e0 | ||
|
|
5a7626d88e | ||
|
|
6457af1cce | ||
|
|
b18b3bf17e | ||
|
|
1ba44ad8c4 | ||
|
|
d5b28577c1 |
No files matched your search
@@ -6,24 +6,38 @@
|
||||
|
||||
- Sprites player rotation on slopes; going on hills, levitate, going down, and so on alters your sprites (configurable)
|
||||
- You can alter all the base kart HUD element offsets on the fly in the Saturn Options settings menu
|
||||
- "addfilelocal" Command, for those who want to use things like their custom hud in netgames (Same as addfile but completely client sided)
|
||||
- OpenMPT for Tracker module playback (Complete with filters) fixed looping issues while even sounding better than the old GME playback
|
||||
- `addfilelocal` Command, for those who want to use things like their custom hud in netgames (Same as addfile but completely client sided)
|
||||
- OpenMPT for Tracker module playback instead of GME
|
||||
- Fixes looping and sounds better
|
||||
- Allows filter configuration
|
||||
- The minimal brightness with Shaders can be configured, now you can seeeee in dark areas (0-255 , uses Sector brightness values)
|
||||
- Lua hooks for Intermission (ex: You can make hostmod votes still visible during intermission!)
|
||||
- Visual Portals from Haya´s HEP Client
|
||||
- Toggable lowercase menu´s also from Haya´s HEP client
|
||||
- Lua HUD hooks for Intermission (ex: You can make hostmod votes still visible during intermission!)
|
||||
- Lua HUD hooks for Vote Screen (ex: You can make hostmod votes still visible during map vote screen!)
|
||||
- Saltyhop! do a funny hop
|
||||
- Smaller Speedometer (optional / requieres extra.kart file)
|
||||
- Record Attack input display can now be used everywhere
|
||||
- Smaller minimap icons and also show player names on the minimap (toggable)
|
||||
- `showmusiccredit` command, shows you the current music track again
|
||||
- `listskins` show a list of all skins currently loaded
|
||||
- Visual Portals from Haya's HEP Client
|
||||
- Toggable lowercase menu's also from Haya's HEP client
|
||||
- Everything that Galaxy has
|
||||
|
||||
## Improvements / Bug fixes
|
||||
|
||||
- Replay size has been increased to 10MiB minimum, to make replay overflows very unlikely to happen (can be set to 100MiB max with "maxdemosize" command in console)
|
||||
- Music changes now properly show the music credits (ex: Kart maps with easter eggs that alter the music) *The mapper still has to provide a MusicDEF for this to work.
|
||||
- Replay size has been increased to 10MiB minimum, to make replay overflows very unlikely to happen
|
||||
- can be set to 100MiB max with `maxdemosize` command in console
|
||||
- Music changes now properly show the music credits (ex: Kart maps with easter eggs that alter the music)
|
||||
- The mapper still has to provide a MusicDEF for this to work.
|
||||
- Configurable chatlog length (yay can read those messages from 30 mins ago without opening log.txt)
|
||||
- Configurable timeout for waiting to join a full server (in vanilla this is capped to 5 minutes before it boots you out)
|
||||
- Characters now spin in skin selection menu (configurable)
|
||||
- HTTP Addon download speed has been raised dramatically (configurable with "downloadspeed" command)
|
||||
- Zone memory allocations have been rewritten, speeds up some map loading, and may improve performance on busy maps
|
||||
- HTTP Addon download speed has been raised dramatically
|
||||
- configurable with `downloadspeed` command
|
||||
- HWR Drawnodes have been refactored, this should fix a few rare crashes esp in regards to OpenGL Visportals
|
||||
- The Position Number in the corner is alot smaller now (half the size!)
|
||||
- Toggable Lap animation
|
||||
- Main menu shows the current renderer being used
|
||||
- MSAA and A2C Antialiasing support (Configurable in renderer.txt file)
|
||||
|
||||
## Performance / Debugging
|
||||
@@ -31,17 +45,18 @@
|
||||
- Access for `mobj_t` and `player_t` fields from Lua has been completely rewritten, for much better performance with many Lua scripts
|
||||
- Lua shows Tracebacks whenever an error occurs
|
||||
- The Lua Perfstats page now has multiple pages and is more organized (ps_thinkframe_page X in console)
|
||||
- People with lower end hardware can disable "screen textures" with "gr_screentextures" command, huge performance gain with minimal visual loss (Note intermission screen background is broken with this)
|
||||
- Software mode has gotten "ffloorclip", which boosts performance on maps with many Floor over Floor roads
|
||||
- People with lower end hardware can disable "screen textures" with "gr_screentextures" command, huge performance gain with minimal visual loss
|
||||
- Intermission backgrounds, heat wave effects and etc are broken with this
|
||||
- `ffloorclip`, exclusive to Software, which boosts performance on maps with many Floor over Floor sectors
|
||||
|
||||
## Technical fixes
|
||||
|
||||
- ZFigthing Textures in Opengl mode have been fixed in engine (well almost all of it)
|
||||
- Fof's intersecting with slopes have less issues and now render correctly in Opengl
|
||||
- FOFs intersecting with slopes have less issues and now render correctly in Opengl
|
||||
- Midtextures on slopes in Opengl are fixed, many weird guardrails and fences, aswell as some of those sticking out textures from the ground on some maps should be gone
|
||||
- The annoying depraction messages for "P_TeleportMove" and "P_AproxDistance" have been silenced
|
||||
- The annoying depraction messages for `P_TeleportMove` and `P_AproxDistance` have been silenced
|
||||
- Silenced the annoying "cant find next map..." messages as theyre super useless and annoying anyways
|
||||
- Added a small cooldown on "map" command due to spamming causing a SIGSEGV
|
||||
- Added a small cooldown on `map` command due to spamming causing a SIGSEGV
|
||||
|
||||
## MISC
|
||||
- Bird's Camara Tilting feature is no longer turned on by default
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# Core sources
|
||||
set(SRB2_CORE_SOURCES
|
||||
am_map.c
|
||||
args.c
|
||||
b_bot.c
|
||||
command.c
|
||||
comptime.c
|
||||
@@ -52,6 +53,7 @@ set(SRB2_CORE_SOURCES
|
||||
|
||||
set(SRB2_CORE_HEADERS
|
||||
am_map.h
|
||||
args.h
|
||||
b_bot.h
|
||||
byteptr.h
|
||||
command.h
|
||||
|
||||
@@ -626,6 +626,7 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/lzf.o \
|
||||
$(OBJDIR)/vid_copy.o \
|
||||
$(OBJDIR)/b_bot.o \
|
||||
$(OBJDIR)/args.o \
|
||||
$(i_cdmus_o) \
|
||||
$(i_net_o) \
|
||||
$(i_system_o) \
|
||||
|
||||
@@ -24,7 +24,7 @@ static INT64 start_time; // as microseconds since the epoch
|
||||
|
||||
// I should probably return how much memory is remaining
|
||||
// for this process, considering Android's process memory limit.
|
||||
UINT32 I_GetFreeMem(UINT32 *total)
|
||||
size_t I_GetFreeMem(size_t *total)
|
||||
{
|
||||
// what the heck? sysinfo() is partially missing in bionic?
|
||||
/* struct sysinfo si; */
|
||||
|
||||
+46
-2
@@ -277,7 +277,7 @@ static xcommand_t *com_commands = NULL; // current commands
|
||||
|
||||
#define MAX_ARGS 80
|
||||
static size_t com_argc;
|
||||
static char *com_argv[MAX_ARGS];
|
||||
char *com_argv[MAX_ARGS];
|
||||
static const char *com_null_string = "";
|
||||
static char *com_args = NULL; // current command args or NULL
|
||||
|
||||
@@ -327,6 +327,16 @@ const char *COM_Argv(size_t arg)
|
||||
return com_argv[arg];
|
||||
}
|
||||
|
||||
/** Returns all of the console command arguments
|
||||
*
|
||||
* \return String pointer to the argv table.
|
||||
* \sa COM_ArgvList
|
||||
*/
|
||||
char **COM_ArgvList(void)
|
||||
{
|
||||
return com_argv;
|
||||
}
|
||||
|
||||
/** Gets all console command arguments.
|
||||
*
|
||||
* \return String pointer to all arguments for the last command.
|
||||
@@ -634,10 +644,44 @@ static void COM_ExecuteString(char *ptext)
|
||||
static void COM_Alias_f(void)
|
||||
{
|
||||
cmdalias_t *a;
|
||||
const char *alias_format = "\x87%-8s:\x80 %s\n";
|
||||
int argc = COM_Argc();
|
||||
|
||||
if (COM_Argc() < 3)
|
||||
if (argc == 2)
|
||||
{
|
||||
const char *begin = COM_Argv(1);
|
||||
size_t szBegin = strlen(begin);
|
||||
|
||||
/* Display all aliases that start with `begin`. */
|
||||
CONS_Printf(M_GetText("All aliases that start with \x87'%s'\x80 are:\n"), begin);
|
||||
|
||||
int count = 0;
|
||||
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next)
|
||||
{
|
||||
if (strncmp(begin, head->name, szBegin) == 0)
|
||||
{
|
||||
CONS_Printf(alias_format, head->name, head->value);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
CONS_Printf(M_GetText("There are none.\n"));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (argc < 3)
|
||||
{
|
||||
/* Display alias subtext, show all aliases. */
|
||||
CONS_Printf(M_GetText("alias <name> <command>: create a shortcut command that executes other command(s)\n"));
|
||||
|
||||
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next)
|
||||
{
|
||||
CONS_Printf(alias_format, head->name, head->value);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,12 @@ typedef void (*com_func_t)(void);
|
||||
void COM_AddCommand(const char *name, com_func_t func);
|
||||
int COM_AddLuaCommand(const char *name);
|
||||
|
||||
#define MAX_ARGS 80
|
||||
extern char *com_argv[MAX_ARGS];
|
||||
|
||||
size_t COM_Argc(void);
|
||||
const char *COM_Argv(size_t arg); // if argv > argc, returns empty string
|
||||
char **COM_ArgvList(void);
|
||||
char *COM_Args(void);
|
||||
size_t COM_CheckParm(const char *check); // like M_CheckParm :)
|
||||
size_t COM_CheckPartialParm(const char *check);
|
||||
|
||||
+17
-17
@@ -153,25 +153,25 @@ consvar_t cons_backcolor = {"con_backcolor", "Black", CV_CALL|CV_SAVE, backcolor
|
||||
|
||||
static CV_PossibleValue_t menuhighlight_cons_t[] =
|
||||
{
|
||||
{0, "Game type"},
|
||||
{V_YELLOWMAP, "Always yellow"},
|
||||
{V_PURPLEMAP, "Always purple"},
|
||||
{V_GREENMAP, "Always green"},
|
||||
{V_BLUEMAP, "Always blue"},
|
||||
{V_REDMAP, "Always red"},
|
||||
{V_GRAYMAP, "Always gray"},
|
||||
{V_ORANGEMAP, "Always orange"},
|
||||
{V_SKYMAP, "Always sky-blue"},
|
||||
{V_GOLDMAP, "Always gold"},
|
||||
{V_LAVENDERMAP, "Always lavender"},
|
||||
{V_TEAMAP, "Always tea-green"},
|
||||
{V_STEELMAP, "Always steel-blue"},
|
||||
{V_PINKMAP, "Always pink"},
|
||||
{V_BROWNMAP, "Always brown"},
|
||||
{V_PEACHMAP, "Always peach"},
|
||||
{0, "Gametype Default"},
|
||||
{V_YELLOWMAP, "Always Yellow"},
|
||||
{V_PURPLEMAP, "Always Purple"},
|
||||
{V_GREENMAP, "Always Green"},
|
||||
{V_BLUEMAP, "Always Blue"},
|
||||
{V_REDMAP, "Always Red"},
|
||||
{V_GRAYMAP, "Always Gray"},
|
||||
{V_ORANGEMAP, "Always Orange"},
|
||||
{V_SKYMAP, "Always Sky-Blue"},
|
||||
{V_GOLDMAP, "Always Gold"},
|
||||
{V_LAVENDERMAP, "Always Lavender"},
|
||||
{V_TEAMAP, "Always Tea-Green"},
|
||||
{V_STEELMAP, "Always Steel-Blue"},
|
||||
{V_PINKMAP, "Always Pink"},
|
||||
{V_BROWNMAP, "Always Brown"},
|
||||
{V_PEACHMAP, "Always Peach"},
|
||||
{0, NULL}
|
||||
};
|
||||
consvar_t cons_menuhighlight = {"menuhighlight", "Game type", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cons_menuhighlight = {"menuhighlight", "Gametype Default", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void CON_Print(char *msg);
|
||||
|
||||
|
||||
@@ -957,9 +957,12 @@ static boolean AddIWAD(void)
|
||||
}
|
||||
}
|
||||
|
||||
boolean found_extra_kart;
|
||||
|
||||
static void IdentifyVersion(void)
|
||||
{
|
||||
const char *srb2waddir = NULL;
|
||||
found_extra_kart = false;
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
// change to the directory where 'srb2.srb' is found
|
||||
@@ -1012,6 +1015,11 @@ static void IdentifyVersion(void)
|
||||
#ifdef USE_PATCH_KART
|
||||
D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupwadfiles);
|
||||
#endif
|
||||
// completely optional
|
||||
if (FIL_ReadFileOK(va(pandf,srb2waddir,"extra.kart"))) {
|
||||
D_AddFile(va(pandf,srb2waddir,"extra.kart"), startupwadfiles);
|
||||
found_extra_kart = true;
|
||||
}
|
||||
|
||||
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
||||
#define MUSICTEST(str) \
|
||||
@@ -1337,6 +1345,9 @@ void D_SRB2Main(void)
|
||||
|
||||
#endif //ifndef DEVELOP
|
||||
|
||||
if (found_extra_kart) // found the funny, add it in!
|
||||
mainwads++;
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
|
||||
@@ -25,6 +25,8 @@ extern boolean usehome; //Alam: which path?
|
||||
extern const char *pandf; //Alam: how to path?
|
||||
extern char srb2path[256]; //Alam: SRB2's Home
|
||||
|
||||
extern boolean found_extra_kart; // for use in k_kart.c
|
||||
|
||||
// the infinite loop of D_SRB2Loop() called from win_main for windows version
|
||||
void D_SRB2Loop(void) FUNCNORETURN;
|
||||
|
||||
|
||||
+292
-3
@@ -49,6 +49,7 @@
|
||||
#include "m_anigif.h"
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "y_inter.h"
|
||||
#include "fastcmp.h"
|
||||
#include "m_perfstats.h"
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
@@ -141,6 +142,8 @@ static void Command_SetViews_f(void);
|
||||
|
||||
static void Command_Addfilelocal(void);
|
||||
static void Command_Addfile(void);
|
||||
static void Command_Addskins(void);
|
||||
static void Command_GLocalSkin(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
#ifdef DELFILE
|
||||
static void Command_Delfile(void);
|
||||
@@ -190,6 +193,9 @@ static void Command_ShowTime_f(void);
|
||||
|
||||
static void Command_Isgamemodified_f(void);
|
||||
static void Command_Cheats_f(void);
|
||||
|
||||
static void Command_ListSkins(void);
|
||||
|
||||
#ifdef _DEBUG
|
||||
static void Command_Togglemodified_f(void);
|
||||
#ifdef HAVE_BLUA
|
||||
@@ -286,6 +292,8 @@ consvar_t cv_skin = {"skin", DEFAULTSKIN, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin_
|
||||
consvar_t cv_skin2 = {"skin2", DEFAULTSKIN2, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skin3 = {"skin3", DEFAULTSKIN3, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
// haha I've beaten you now, ONLINE
|
||||
consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -444,6 +452,7 @@ static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "
|
||||
consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_forceskin = {"forceskin", "Off", CV_NETVAR|CV_CALL|CV_CHEAT, Forceskin_cons_t, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fakelocalskin = {"fakelocalskin", "None", CV_SAVE, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -465,6 +474,13 @@ consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0
|
||||
|
||||
static CV_PossibleValue_t pingmeasurement_cons_t[] = {{0, "Frames"}, {1, "Milliseconds"}, {0, NULL}};
|
||||
consvar_t cv_pingmeasurement = {"pingmeasurement", "Frames", CV_SAVE, pingmeasurement_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_luaimmersion = {"luaimmersion", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showminimapnames = {"showminimapnames", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showlapemblem = {"showlapemblem", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showviewpointtext = {"showviewpointtext", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -503,7 +519,7 @@ consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_
|
||||
|
||||
consvar_t cv_showtrackaddon = {"showtrackaddon", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scoll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {0, NULL}};
|
||||
static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scroll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {0, NULL}};
|
||||
consvar_t cv_skinselectmenu = {"skinselectmenu", "Grid", CV_SAVE, skinselectmenu_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t skinselectgridsort_t[] ={
|
||||
@@ -634,6 +650,8 @@ void D_RegisterServerCommands(void)
|
||||
|
||||
COM_AddCommand("addfilelocal", Command_Addfilelocal);
|
||||
COM_AddCommand("addfile", Command_Addfile);
|
||||
COM_AddCommand("addskins", Command_Addskins);
|
||||
COM_AddCommand("localskin", Command_GLocalSkin);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
|
||||
#ifdef DELFILE
|
||||
@@ -700,6 +718,8 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_powerstones);
|
||||
CV_RegisterVar(&cv_competitionboxes);
|
||||
CV_RegisterVar(&cv_matchboxes);
|
||||
|
||||
CV_RegisterVar(&cv_slamsound);
|
||||
|
||||
/*CV_RegisterVar(&cv_recycler);
|
||||
CV_RegisterVar(&cv_teleporters);
|
||||
@@ -765,6 +785,14 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_pingtimeout);
|
||||
CV_RegisterVar(&cv_showping);
|
||||
CV_RegisterVar(&cv_pingmeasurement);
|
||||
|
||||
CV_RegisterVar(&cv_luaimmersion);
|
||||
CV_RegisterVar(&cv_fakelocalskin);
|
||||
|
||||
CV_RegisterVar(&cv_minihead);
|
||||
CV_RegisterVar(&cv_showminimapnames);
|
||||
|
||||
CV_RegisterVar(&cv_showlapemblem);
|
||||
|
||||
CV_RegisterVar(&cv_showtrackaddon);
|
||||
|
||||
@@ -869,6 +897,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_playername);
|
||||
CV_RegisterVar(&cv_playercolor);
|
||||
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
|
||||
CV_RegisterVar(&cv_localskin);
|
||||
// secondary player (splitscreen)
|
||||
CV_RegisterVar(&cv_playername2);
|
||||
CV_RegisterVar(&cv_playercolor2);
|
||||
@@ -954,6 +983,15 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_mini_yoffset);
|
||||
CV_RegisterVar(&cv_want_xoffset);
|
||||
CV_RegisterVar(&cv_want_yoffset);
|
||||
CV_RegisterVar(&cv_showinput);
|
||||
CV_RegisterVar(&cv_newspeedometer);
|
||||
|
||||
CV_RegisterVar(&cv_saltyhop);
|
||||
CV_RegisterVar(&cv_saltyhopsfx);
|
||||
CV_RegisterVar(&cv_saltysquish);
|
||||
|
||||
CV_RegisterVar(&cv_growmusic);
|
||||
CV_RegisterVar(&cv_supermusic);
|
||||
|
||||
//CV_RegisterVar(&cv_crosshair);
|
||||
//CV_RegisterVar(&cv_crosshair2);
|
||||
@@ -1142,8 +1180,34 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_discordstreamer);
|
||||
CV_RegisterVar(&cv_discordasks);
|
||||
#endif
|
||||
|
||||
COM_AddCommand("listskins", Command_ListSkins);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches the skins list for a skin of the "realname", if found, changes
|
||||
* the CVAR value to be the "name" of the skin.
|
||||
* \sa cv_skin, Skin_OnChange, Skin2_OnChange
|
||||
* \author karen
|
||||
*/
|
||||
static void Skin_FindRealNameSkin(consvar_t *cvar)
|
||||
{
|
||||
// Not the best way to implements this but it will do.
|
||||
|
||||
int i;
|
||||
const char *value = cvar->string;
|
||||
for (i = 0; i < numskins; i++)
|
||||
{
|
||||
if (strncmp(value, skins[i].realname, sizeof skins[i].realname) == 0)
|
||||
{
|
||||
// Change the cvar to be the value of the name.
|
||||
CV_StealthSet(cvar, skins[i].name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Checks if a name (as received from another player) is okay.
|
||||
* A name is okay if it is no fewer than 1 and no more than ::MAXPLAYERNAME
|
||||
* chars long (not including NUL), it does not begin or end with a space,
|
||||
@@ -4516,7 +4580,7 @@ static void Command_Addfile(void)
|
||||
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
||||
if (!(netgame || multiplayer) || musiconly)
|
||||
{
|
||||
P_AddWadFile(fn);
|
||||
P_AddWadFile(fn, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4565,6 +4629,156 @@ static void Command_Addfile(void)
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||
}
|
||||
|
||||
// i hate myself
|
||||
static boolean DumbStartsWith(const char *pre, const char *str)
|
||||
{
|
||||
size_t lenpre = strlen(pre),
|
||||
lenstr = strlen(str);
|
||||
return lenstr < lenpre ? false : memcmp(pre, str, lenpre) == 0;
|
||||
}
|
||||
|
||||
/** Adds something at runtime.
|
||||
*/
|
||||
static void
|
||||
Command_Addskins (void)
|
||||
{
|
||||
if (COM_Argc() > 3)
|
||||
{
|
||||
CONS_Printf(
|
||||
"addskins <file>: Load a skin file.\n");
|
||||
return;
|
||||
}
|
||||
// no forcing?
|
||||
/*
|
||||
if (fasticmp(COM_Argv(2), "-force") || fasticmp(COM_Argv(2), "-f")) {
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Adding file %s. May or may not be a skin.\n"), COM_Argv(1));
|
||||
P_AddWadFile(COM_Argv(1), 0, true);
|
||||
} else {
|
||||
if (DumbStartsWith("KC_", COM_Argv(1))) {
|
||||
P_AddWadFile(COM_Argv(1), 0, true);
|
||||
} else if (DumbStartsWith("KCL_", COM_Argv(1))) {
|
||||
if (!demo.playback) {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is a skin with lua. Include -force or -f to force it to load.\n"), COM_Argv(1));
|
||||
return;
|
||||
} else {
|
||||
*/
|
||||
P_AddWadFile(COM_Argv(1), true);
|
||||
/*
|
||||
}
|
||||
} else {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is not a skin.\n"), COM_Argv(1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// args n stuff
|
||||
#include "args.h"
|
||||
|
||||
static void Command_GLocalSkin (void)
|
||||
{
|
||||
size_t first_option;
|
||||
size_t option_display;
|
||||
size_t option_all;
|
||||
size_t option_player;
|
||||
|
||||
option_player = COM_CheckPartialParm("-p");
|
||||
option_display = COM_CheckPartialParm("-d");
|
||||
option_all = COM_CheckPartialParm("-a");
|
||||
|
||||
char* fuck; // local skin name
|
||||
|
||||
if (!( first_option = COM_FirstOption() ))
|
||||
first_option = COM_Argc();
|
||||
|
||||
if (first_option < 2)
|
||||
{
|
||||
/* holy fucking shit */
|
||||
CONS_Printf("localskin <name> [-player <name>] [-display <number>] [-all]:\n");
|
||||
CONS_Printf(M_GetText("Set a localskin via its internal name (usually printed on the console).\n\n\
|
||||
* Using \"-player\" will set a localskin to a specified player.\n\
|
||||
Defaults to yourself.\n\
|
||||
* Using \"-display\" will set a localskin to the displayed player.\n\
|
||||
Defaults to 0, which is the first player displayed.\n\
|
||||
Can go up to 3 for splitscreen.\n\
|
||||
* Using \"-all\" will set a localskin to ALL players.\n\
|
||||
* \"localskin none\" removes the localskin, just like how\n\
|
||||
\"forceskin none\" does.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
fuck = ConcatCommandArgv(1, first_option);
|
||||
|
||||
char* player_name = player_names[consoleplayer];
|
||||
char* display_num = "0";
|
||||
size_t dnum = 0;
|
||||
|
||||
if (option_display) // -display
|
||||
{
|
||||
// handle default: 0
|
||||
if (COM_Argv(option_display + 1)[0] == "" || COM_Argv(option_display + 1)[0] != "-")
|
||||
display_num = COM_Argv(option_display + 1);
|
||||
|
||||
if (isdigit(display_num[0]) || display_num == "0")
|
||||
{
|
||||
dnum = atoi(display_num);
|
||||
if (dnum > 3 || dnum < 0) // nuh uh
|
||||
dnum = 0;
|
||||
SetLocalPlayerSkin(displayplayers[dnum], fuck, NULL);
|
||||
|
||||
CONS_Printf("Successfully applied localskin to displayed player.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Could not apply localskin.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
else if (option_all) // -all
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
SetLocalPlayerSkin(i, fuck, NULL);
|
||||
}
|
||||
CONS_Printf("Successfully applied localskin to all players.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
else // -player or no other arguments
|
||||
{
|
||||
if (option_player)
|
||||
{
|
||||
int i;
|
||||
player_name = COM_Argv(option_player + 1);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (fasticmp(player_names[i], player_name))
|
||||
SetLocalPlayerSkin(i, fuck, NULL);
|
||||
}
|
||||
CONS_Printf("Successfully applied localskin to specified player.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalPlayerSkin(consoleplayer, fuck, &cv_localskin);
|
||||
CONS_Printf("Successfully applied localskin.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Could not apply localskin.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
/** removes the last added pwad at runtime.
|
||||
* Searches for sounds, maps, music and images to remove
|
||||
@@ -4721,7 +4935,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
|
||||
ncs = findfile(filename,md5sum,true);
|
||||
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename))
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename, false))
|
||||
{
|
||||
Command_ExitGame_f();
|
||||
if (ncs == FS_FOUND)
|
||||
@@ -5736,6 +5950,8 @@ static void Name4_OnChange(void)
|
||||
*/
|
||||
static void Skin_OnChange(void)
|
||||
{
|
||||
Skin_FindRealNameSkin(&cv_skin);
|
||||
|
||||
if (!Playing())
|
||||
return; // do whatever you want
|
||||
|
||||
@@ -5762,6 +5978,8 @@ static void Skin_OnChange(void)
|
||||
*/
|
||||
static void Skin2_OnChange(void)
|
||||
{
|
||||
Skin_FindRealNameSkin(&cv_skin2);
|
||||
|
||||
if (!Playing() || !splitscreen)
|
||||
return; // do whatever you want
|
||||
|
||||
@@ -5776,6 +5994,8 @@ static void Skin2_OnChange(void)
|
||||
|
||||
static void Skin3_OnChange(void)
|
||||
{
|
||||
Skin_FindRealNameSkin(&cv_skin3);
|
||||
|
||||
if (!Playing() || splitscreen < 2)
|
||||
return; // do whatever you want
|
||||
|
||||
@@ -5790,6 +6010,8 @@ static void Skin3_OnChange(void)
|
||||
|
||||
static void Skin4_OnChange(void)
|
||||
{
|
||||
Skin_FindRealNameSkin(&cv_skin4);
|
||||
|
||||
if (!Playing() || splitscreen < 3)
|
||||
return; // do whatever you want
|
||||
|
||||
@@ -5802,6 +6024,73 @@ static void Skin4_OnChange(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void Command_ListSkins(void)
|
||||
{
|
||||
int i;
|
||||
int page = 0;
|
||||
int numpages = numskins / 10 + (numskins % 10 ? 1 : 0);
|
||||
int longest_name = 0;
|
||||
|
||||
if (COM_Argc() > 1)
|
||||
{
|
||||
if (sscanf(COM_Argv(1), " %d", &page) == 0)
|
||||
{
|
||||
CONS_Printf("Expected a number.\n");
|
||||
return;
|
||||
}
|
||||
else if (page > numpages)
|
||||
{
|
||||
CONS_Printf("There are only %d pages.\n", numpages);
|
||||
return;
|
||||
}
|
||||
else if (page < 0)
|
||||
{
|
||||
CONS_Printf("Page number cannot be negative.\n");
|
||||
return;
|
||||
}
|
||||
else if (page == 0)
|
||||
{
|
||||
CONS_Printf("There is no 0th page. (What are you a programmer?)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
--page;
|
||||
}
|
||||
|
||||
CONS_Printf("Total %d skins. Page (%d/%d)\n", numskins, page + 1, numpages);
|
||||
|
||||
// Find the longest name and realname in the skins list. (used for alignment)
|
||||
for (i = page * 10; i < numskins && i < (page + 1) * 10; i++)
|
||||
{
|
||||
int length;
|
||||
skin_t *skin = &skins[i];
|
||||
|
||||
if ((length = strlen(skin->name)) > longest_name)
|
||||
longest_name = length;
|
||||
}
|
||||
|
||||
for (i = page * 10; i < numskins && i < (page + 1) * 10; i++)
|
||||
{
|
||||
skin_t *skin = &skins[i];
|
||||
|
||||
CONS_Printf(
|
||||
"%s[%-*s]\x80 %s\n",
|
||||
HU_SkinColorToConsoleColor(skin->prefcolor),
|
||||
longest_name,
|
||||
skin->name,
|
||||
skin->realname);
|
||||
}
|
||||
|
||||
if (page + 1 != numpages)
|
||||
{
|
||||
CONS_Printf("Use \"listskins %d\" to see the next page.\n", page + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("There are no more pages.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/** Sends a color change for the console player, unless that player is moving.
|
||||
* \sa cv_playercolor, Color2_OnChange, Skin_OnChange
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
extern consvar_t cv_playername;
|
||||
extern consvar_t cv_playercolor;
|
||||
extern consvar_t cv_skin;
|
||||
extern consvar_t cv_localskin;
|
||||
// secondary splitscreen player
|
||||
extern consvar_t cv_playername2;
|
||||
extern consvar_t cv_playercolor2;
|
||||
@@ -150,7 +151,15 @@ extern consvar_t cv_pingtimeout;
|
||||
extern consvar_t cv_showping;
|
||||
extern consvar_t cv_pingmeasurement;
|
||||
|
||||
//extern consvar_t cv_smallpos;
|
||||
extern consvar_t cv_showminimapnames;
|
||||
extern consvar_t cv_minihead;
|
||||
|
||||
extern consvar_t cv_showlapemblem;
|
||||
|
||||
extern consvar_t cv_showviewpointtext;
|
||||
extern consvar_t cv_luaimmersion;
|
||||
extern consvar_t cv_fakelocalskin;
|
||||
|
||||
extern consvar_t cv_skipmapcheck;
|
||||
|
||||
|
||||
+2
-2
@@ -513,7 +513,7 @@ INT32 CL_CheckFiles(void)
|
||||
|
||||
for (i = 0, j = mainwads+1; i < fileneedednum || j < numwadfiles;)
|
||||
{
|
||||
if (j < numwadfiles && !wadfiles[j]->important)
|
||||
if (j < numwadfiles && (!wadfiles[j]->important || wadfiles[j]->localfile))
|
||||
{
|
||||
// Unimportant on our side. still don't care.
|
||||
++j;
|
||||
@@ -562,7 +562,7 @@ INT32 CL_CheckFiles(void)
|
||||
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
|
||||
|
||||
// Check in already loaded files
|
||||
for (j = mainwads+1; j < numwadfiles; j++)
|
||||
for (j = mainwads+1; wadfiles[j]; j++)
|
||||
{
|
||||
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
|
||||
if (!stricmp(wadfilename, fileneeded[i].filename) &&
|
||||
|
||||
@@ -371,6 +371,7 @@ typedef struct player_s
|
||||
|
||||
angle_t viewrollangle;
|
||||
angle_t tilt;
|
||||
angle_t tilt_sprite;
|
||||
|
||||
// Mouse aiming, where the guy is looking at!
|
||||
// It is updated with cmd->aiming.
|
||||
@@ -415,6 +416,8 @@ typedef struct player_s
|
||||
UINT8 skincolor;
|
||||
|
||||
INT32 skin;
|
||||
INT32 localskin;
|
||||
boolean skinlocal;
|
||||
|
||||
UINT32 score; // player score
|
||||
fixed_t dashspeed; // dashing speed
|
||||
|
||||
@@ -8735,6 +8735,7 @@ struct {
|
||||
|
||||
// Custom client features exposed to lua
|
||||
{"FEATURE_INTERMISSIONHUD",1},
|
||||
{"FEATURE_VOTEHUD",1},
|
||||
#endif
|
||||
|
||||
{NULL,0}
|
||||
|
||||
+39
-2
@@ -37,7 +37,9 @@
|
||||
// length of IP strings
|
||||
#define IP_SIZE 21
|
||||
|
||||
consvar_t cv_discordrp = {"discordrp", "On", CV_SAVE|CV_CALL, CV_OnOff, DRPC_UpdatePresence, 0, NULL, NULL, 0, 0, NULL};
|
||||
static void Discordrp_OnChange(void);
|
||||
|
||||
consvar_t cv_discordrp = {"discordrp", "On", CV_SAVE|CV_CALL, CV_OnOff, Discordrp_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_discordstreamer = {"discordstreamer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_discordasks = {"discordasks", "Yes", CV_SAVE|CV_CALL, CV_YesNo, DRPC_UpdatePresence, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -47,6 +49,8 @@ discordRequest_t *discordRequestList = NULL;
|
||||
|
||||
static char self_ip[IP_SIZE];
|
||||
|
||||
boolean drpc_init = false;
|
||||
|
||||
/*--------------------------------------------------
|
||||
static char *DRPC_XORIPString(const char *input)
|
||||
|
||||
@@ -315,6 +319,9 @@ void DRPC_RemoveRequest(discordRequest_t *removeRequest)
|
||||
--------------------------------------------------*/
|
||||
void DRPC_Init(void)
|
||||
{
|
||||
if (drpc_init || !cv_discordrp.value) return;
|
||||
|
||||
drpc_init = true;
|
||||
DiscordEventHandlers handlers;
|
||||
memset(&handlers, 0, sizeof(handlers));
|
||||
|
||||
@@ -325,10 +332,36 @@ void DRPC_Init(void)
|
||||
handlers.joinRequest = DRPC_HandleJoinRequest;
|
||||
|
||||
Discord_Initialize(DISCORD_APPID, &handlers, 1, NULL);
|
||||
I_AddExitFunc(Discord_Shutdown);
|
||||
I_AddExitFunc(DRPC_Shutdown);
|
||||
DRPC_UpdatePresence();
|
||||
}
|
||||
|
||||
void DRPC_Shutdown(void)
|
||||
{
|
||||
if (!drpc_init)
|
||||
{
|
||||
CONS_Printf("DiscordRPC never started\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Shutting down DiscordRPC\n");
|
||||
|
||||
Discord_Shutdown();
|
||||
drpc_init = false;
|
||||
}
|
||||
|
||||
static void Discordrp_OnChange(void)
|
||||
{
|
||||
if (cv_discordrp.value)
|
||||
{
|
||||
DRPC_UpdatePresence();
|
||||
}
|
||||
else
|
||||
{
|
||||
DRPC_Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void DRPC_GotServerIP(UINT32 address)
|
||||
|
||||
@@ -402,6 +435,10 @@ static void DRPC_EmptyRequests(void)
|
||||
--------------------------------------------------*/
|
||||
void DRPC_UpdatePresence(void)
|
||||
{
|
||||
if (!cv_discordrp.value) return;
|
||||
|
||||
if (!drpc_init) DRPC_Init();
|
||||
|
||||
char detailstr[48+1];
|
||||
|
||||
char mapimg[8+1];
|
||||
|
||||
@@ -64,6 +64,13 @@ void DRPC_RemoveRequest(discordRequest_t *removeRequest);
|
||||
void DRPC_Init(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_Shutdown(void);
|
||||
|
||||
Shutdown Discord Rich Presence if it was started at all.
|
||||
--------------------------------------------------*/
|
||||
void DRPC_Shutdown(void);
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_UpdatePresence(void);
|
||||
|
||||
|
||||
+2
-2
@@ -149,8 +149,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v1 "
|
||||
#define VERSIONSTRINGW L"Saturn v1"
|
||||
#define VERSIONSTRING "Saturn v3 "
|
||||
#define VERSIONSTRINGW L"Saturn v3"
|
||||
// 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!
|
||||
|
||||
@@ -5,7 +5,7 @@ UINT8 graphics_started = 0;
|
||||
|
||||
UINT8 keyboard_started = 0;
|
||||
|
||||
UINT32 I_GetFreeMem(UINT32 *total)
|
||||
size_t I_GetFreeMem(size_t *total)
|
||||
{
|
||||
*total = 0;
|
||||
return 0;
|
||||
|
||||
+83
-13
@@ -468,6 +468,10 @@ consvar_t cv_songcredits = {"songcredits", "On", CV_SAVE, CV_OnOff, NULL, 0, NUL
|
||||
// Show "FREE PLAY" when you're alone. :(
|
||||
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// We can disable special tunes!
|
||||
consvar_t cv_growmusic = {"growmusic", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_supermusic = {"supermusic", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
/*consvar_t cv_crosshair = {"crosshair", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_crosshair2 = {"crosshair2", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_crosshair3 = {"crosshair3", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -545,8 +549,12 @@ static CV_PossibleValue_t stretchfactor_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0
|
||||
consvar_t cv_gravstretch = {"gravstretch", "0", CV_FLOAT | CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t slamsound_t[] = {{0, "Off"}, {1, "On"}, {0, NULL}};
|
||||
consvar_t cv_slamsound = {"slamsound", "1", CV_SAVE, slamsound_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t sloperolldist_cons_t[] = {
|
||||
/*{256, "256"},*/ {512, "512"}, {768, "768"},
|
||||
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
||||
@@ -842,6 +850,16 @@ void G_SetGameModified(boolean silent, boolean major)
|
||||
M_EndModeAttackRun();
|
||||
}
|
||||
|
||||
void G_SetWadModified(boolean silent, boolean major, UINT16 wadnum)
|
||||
{
|
||||
// now that we have a wad that is actually well, a gameplay changing mod
|
||||
// (for later)
|
||||
wadfiles[wadnum]->majormod = true;
|
||||
|
||||
// set our game to be marked as modified.
|
||||
G_SetGameModified(silent, major);
|
||||
}
|
||||
|
||||
/** Builds an original game map name from a map number.
|
||||
* The complexity is due to MAPA0-MAPZZ.
|
||||
*
|
||||
@@ -2698,6 +2716,8 @@ void G_PlayerReborn(INT32 player)
|
||||
UINT8 mare;
|
||||
UINT8 skincolor;
|
||||
INT32 skin;
|
||||
int localskin;
|
||||
boolean skinlocal;
|
||||
tic_t jointime;
|
||||
UINT8 splitscreenindex;
|
||||
boolean spectator;
|
||||
@@ -2744,6 +2764,8 @@ void G_PlayerReborn(INT32 player)
|
||||
|
||||
skincolor = players[player].skincolor;
|
||||
skin = players[player].skin;
|
||||
localskin = players[player].localskin;
|
||||
skinlocal = players[player].skinlocal;
|
||||
// SRB2kart
|
||||
kartspeed = players[player].kartspeed;
|
||||
kartweight = players[player].kartweight;
|
||||
@@ -2833,6 +2855,8 @@ void G_PlayerReborn(INT32 player)
|
||||
// save player config truth reborn
|
||||
p->skincolor = skincolor;
|
||||
p->skin = skin;
|
||||
p->localskin = localskin;
|
||||
p->skinlocal = skinlocal;
|
||||
// SRB2kart
|
||||
p->kartspeed = kartspeed;
|
||||
p->kartweight = kartweight;
|
||||
@@ -5699,6 +5723,9 @@ void G_GhostAddHit(INT32 playernum, mobj_t *victim)
|
||||
|
||||
void G_WriteAllGhostTics(void)
|
||||
{
|
||||
UINT8 *save_demo_p = demo_p;
|
||||
#define CHECKSPACE(num) if (demo_p+(num) > demoend) { demo_p = save_demo_p; G_CheckDemoStatus(); return; }
|
||||
|
||||
INT32 i, counter = leveltime;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
@@ -5713,10 +5740,16 @@ void G_WriteAllGhostTics(void)
|
||||
if (counter % cv_netdemosyncquality.value != 0) // Only write 1 in this many ghost datas per tic to cut down on multiplayer replay size.
|
||||
continue;
|
||||
|
||||
CHECKSPACE(1);
|
||||
|
||||
WRITEUINT8(demo_p, i);
|
||||
G_WriteGhostTic(players[i].mo, i);
|
||||
}
|
||||
|
||||
CHECKSPACE(1);
|
||||
WRITEUINT8(demo_p, 0xFF);
|
||||
|
||||
#undef CHECKSPACE
|
||||
}
|
||||
|
||||
void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
@@ -5727,6 +5760,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
UINT8 sprite;
|
||||
UINT8 frame;
|
||||
|
||||
UINT8 *save_demo_p = demo_p;
|
||||
#define CHECKSPACE(num) if (demo_p+(num) > demoend) { demo_p = save_demo_p; G_CheckDemoStatus(); return; }
|
||||
|
||||
if (!demo_p)
|
||||
return;
|
||||
if (!(demoflags & DF_GHOST))
|
||||
@@ -5753,6 +5789,8 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
oldghost[playernum].y = ghost->y;
|
||||
oldghost[playernum].z = ghost->z;
|
||||
ziptic |= GZT_XYZ;
|
||||
|
||||
CHECKSPACE(sizeof(fixed_t)*3);
|
||||
WRITEFIXED(demo_p,oldghost[playernum].x);
|
||||
WRITEFIXED(demo_p,oldghost[playernum].y);
|
||||
WRITEFIXED(demo_p,oldghost[playernum].z);
|
||||
@@ -5769,6 +5807,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
oldghost[playernum].momx = momx;
|
||||
oldghost[playernum].momy = momy;
|
||||
ziptic |= GZT_MOMXY;
|
||||
|
||||
CHECKSPACE(4);
|
||||
|
||||
WRITEINT16(demo_p,momx);
|
||||
WRITEINT16(demo_p,momy);
|
||||
}
|
||||
@@ -5777,6 +5818,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
{
|
||||
oldghost[playernum].momz = momx;
|
||||
ziptic |= GZT_MOMZ;
|
||||
|
||||
CHECKSPACE(2);
|
||||
|
||||
WRITEINT16(demo_p,momx);
|
||||
}
|
||||
|
||||
@@ -5797,6 +5841,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
{
|
||||
oldghost[playernum].angle = ghost->angle>>24;
|
||||
ziptic |= GZT_ANGLE;
|
||||
|
||||
CHECKSPACE(1);
|
||||
|
||||
WRITEUINT8(demo_p,oldghost[playernum].angle);
|
||||
}
|
||||
|
||||
@@ -5806,6 +5853,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
{
|
||||
oldghost[playernum].frame = frame;
|
||||
ziptic |= GZT_SPRITE;
|
||||
|
||||
CHECKSPACE(1);
|
||||
|
||||
WRITEUINT8(demo_p,oldghost[playernum].frame);
|
||||
}
|
||||
|
||||
@@ -5845,20 +5895,26 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
|
||||
if (ghostext[playernum].flags & EZT_COLOR)
|
||||
{
|
||||
CHECKSPACE(1);
|
||||
WRITEUINT8(demo_p,ghostext[playernum].color);
|
||||
ghostext[playernum].lastcolor = ghostext[playernum].color;
|
||||
}
|
||||
if (ghostext[playernum].flags & EZT_SCALE)
|
||||
{
|
||||
CHECKSPACE(sizeof(fixed_t));
|
||||
WRITEFIXED(demo_p,ghostext[playernum].scale);
|
||||
ghostext[playernum].lastscale = ghostext[playernum].scale;
|
||||
}
|
||||
if (ghostext[playernum].flags & EZT_HIT)
|
||||
{
|
||||
CHECKSPACE(2);
|
||||
WRITEUINT16(demo_p,ghostext[playernum].hits);
|
||||
for (i = 0; i < ghostext[playernum].hits; i++)
|
||||
{
|
||||
mobj_t *mo = ghostext[playernum].hitlist[i];
|
||||
|
||||
CHECKSPACE(4+4+2+sizeof(fixed_t)*3+sizeof(angle_t));
|
||||
|
||||
WRITEUINT32(demo_p,UINT32_MAX); // reserved for some method of determining exactly which mobj this is. (mobjnum doesn't work here.)
|
||||
WRITEUINT32(demo_p,mo->type);
|
||||
WRITEUINT16(demo_p,(UINT16)mo->health);
|
||||
@@ -5872,9 +5928,14 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
ghostext[playernum].hitlist = NULL;
|
||||
}
|
||||
if (ghostext[playernum].flags & EZT_SPRITE)
|
||||
{
|
||||
CHECKSPACE(1);
|
||||
WRITEUINT8(demo_p,sprite);
|
||||
}
|
||||
if (ghostext[playernum].flags & EZT_KART)
|
||||
{
|
||||
CHECKSPACE(12);
|
||||
|
||||
WRITEINT32(demo_p, ghostext[playernum].kartitem);
|
||||
WRITEINT32(demo_p, ghostext[playernum].kartamount);
|
||||
WRITEINT32(demo_p, ghostext[playernum].kartbumpers);
|
||||
@@ -5891,6 +5952,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
G_CheckDemoStatus(); // no more space
|
||||
return;
|
||||
}
|
||||
#undef CHECKSPACE
|
||||
}
|
||||
|
||||
void G_ConsAllGhostTics(void)
|
||||
@@ -6743,22 +6805,30 @@ void G_RecordDemo(const char *name)
|
||||
{
|
||||
INT32 maxsize;
|
||||
|
||||
CONS_Printf("Recording demo %s.lmp\n", name);
|
||||
|
||||
strcpy(demoname, name);
|
||||
strcat(demoname, ".lmp");
|
||||
maxsize = cv_maxdemosize.value*1024*1024;
|
||||
if (demobuffer)
|
||||
free(demobuffer);
|
||||
demo_p = NULL;
|
||||
demo.recording = false;
|
||||
demobuffer = malloc(maxsize);
|
||||
demoend = demobuffer + maxsize;
|
||||
|
||||
if (demobuffer)
|
||||
demo.recording = true;
|
||||
else
|
||||
CONS_Alert(CONS_ERROR, "Failed to allocate demo buffer\n");
|
||||
free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demoend = NULL;
|
||||
|
||||
if (cv_recordmultiplayerdemos.value)
|
||||
{
|
||||
CONS_Printf("Recording demo %s.lmp\n", name);
|
||||
|
||||
strcpy(demoname, name);
|
||||
strcat(demoname, ".lmp");
|
||||
|
||||
maxsize = cv_maxdemosize.value*1024*1024;
|
||||
|
||||
demobuffer = malloc(maxsize);
|
||||
demoend = demobuffer + maxsize;
|
||||
|
||||
if (demobuffer)
|
||||
demo.recording = true;
|
||||
else
|
||||
CONS_Alert(CONS_ERROR, "Failed to allocate demo buffer\n");
|
||||
}
|
||||
}
|
||||
|
||||
void G_RecordMetal(void)
|
||||
|
||||
@@ -113,6 +113,7 @@ extern INT16 rw_maximums[NUM_WEAPONS];
|
||||
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection/*, cv_compactscoreboard*/;
|
||||
extern consvar_t cv_songcredits;
|
||||
extern consvar_t cv_showfreeplay;
|
||||
extern consvar_t cv_growmusic, cv_supermusic;
|
||||
extern consvar_t cv_pauseifunfocused;
|
||||
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
|
||||
extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/;
|
||||
@@ -145,11 +146,18 @@ extern consvar_t cv_mini_xoffset;
|
||||
extern consvar_t cv_mini_yoffset;
|
||||
extern consvar_t cv_want_xoffset;
|
||||
extern consvar_t cv_want_yoffset;
|
||||
extern consvar_t cv_showinput;
|
||||
extern consvar_t cv_newspeedometer;
|
||||
|
||||
extern consvar_t cv_saltyhop;
|
||||
extern consvar_t cv_saltyhopsfx;
|
||||
extern consvar_t cv_saltysquish;
|
||||
|
||||
extern consvar_t cv_driftsparkpulse;
|
||||
extern consvar_t cv_gravstretch;
|
||||
extern consvar_t cv_sloperoll;
|
||||
extern consvar_t cv_sliptideroll;
|
||||
extern consvar_t cv_slamsound;
|
||||
extern consvar_t cv_sloperolldist;
|
||||
|
||||
extern consvar_t cv_invincmusicfade;
|
||||
@@ -395,6 +403,7 @@ boolean G_GetRetryFlag(void);
|
||||
void G_LoadGameData(void);
|
||||
void G_LoadGameSettings(void);
|
||||
|
||||
void G_SetWadModified(boolean silent, boolean major, UINT16 wadnum);
|
||||
void G_SetGameModified(boolean silent, boolean major);
|
||||
|
||||
void G_SetGamestate(gamestate_t newstate);
|
||||
|
||||
@@ -576,7 +576,6 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Make sure texture is downloaded and set it as the source
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -224,6 +224,7 @@ struct FSurfaceInfo
|
||||
RGBA_t PolyColor;
|
||||
RGBA_t TintColor;
|
||||
RGBA_t FadeColor;
|
||||
UINT32 LightTableId;
|
||||
FLightInfo LightInfo; // jimita 14032019
|
||||
};
|
||||
typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
@@ -231,6 +232,7 @@ typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
HWD_SET_SHADERS,
|
||||
HWD_SET_PALETTE_SHADER_ENABLED,
|
||||
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
|
||||
+11
-11
@@ -122,7 +122,7 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||
flags |= PF_ForceWrapY;
|
||||
|
||||
// clip it since it is used for bunny scroll in doom I
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags, false);
|
||||
}
|
||||
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
|
||||
@@ -300,10 +300,10 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags, false);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags, false);
|
||||
}
|
||||
|
||||
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
|
||||
@@ -454,10 +454,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags, false);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags, false);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -533,7 +533,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||
// BTW, I see we put 0 for PFs, and If I'm right, that
|
||||
// means we take the previous PFs as default
|
||||
// how can we be sure they are ok?
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest, false); //PF_Translucent);
|
||||
}
|
||||
|
||||
|
||||
@@ -570,7 +570,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
Surf.PolyColor.rgba = pLocalPalette[color].rgba;
|
||||
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
@@ -597,7 +597,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -846,7 +846,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
Surf.PolyColor = V_GetColor(color);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
// -------------------+
|
||||
@@ -954,7 +954,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -1062,7 +1062,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
Surf.PolyColor = V_GetColor(color);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
+11
-2
@@ -21,6 +21,7 @@
|
||||
#include "hw_md2.h"
|
||||
|
||||
#include "hw_dll.h"
|
||||
#include "../doomdef.h"
|
||||
|
||||
// ==========================================================================
|
||||
// STANDARD DLL EXPORTS
|
||||
@@ -34,7 +35,7 @@ EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal, RGBA_t *pgamma);
|
||||
#endif
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, boolean horizonSpecial);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo);
|
||||
@@ -46,7 +47,9 @@ EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||
|
||||
//Hurdler: added for new development
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface);
|
||||
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, FSurfaceInfo *Surface);
|
||||
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||
@@ -77,6 +80,9 @@ EXPORT void HWRAPI(InitCustomShaders) (void);
|
||||
EXPORT void HWRAPI(StartBatching) (void);
|
||||
EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, int *sNumPolys, int *sNumVerts, int *sNumCalls, int *sNumShaders, int *sNumTextures, int *sNumPolyFlags, int *sNumColors);
|
||||
|
||||
EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable);
|
||||
EXPORT void HWRAPI(ClearLightTableCache) (void);
|
||||
|
||||
// ==========================================================================
|
||||
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
|
||||
// ==========================================================================
|
||||
@@ -123,6 +129,9 @@ struct hwdriver_s
|
||||
|
||||
StartBatching pfnStartBatching;
|
||||
RenderBatches pfnRenderBatches;
|
||||
|
||||
AddLightTable pfnAddLightTable;
|
||||
ClearLightTableCache pfnClearLightTableCache;
|
||||
};
|
||||
|
||||
extern struct hwdriver_s hwdriver;
|
||||
|
||||
+239
-83
@@ -30,6 +30,7 @@
|
||||
#include "../r_fps.h"
|
||||
#include "../r_state.h"
|
||||
#include "../r_local.h"
|
||||
#include "../r_data.h"
|
||||
#include "../r_patch.h" // a mystery as to what this is for
|
||||
#include "../r_bsp.h" // R_NoEncore
|
||||
#include "../r_main.h" // cv_fov
|
||||
@@ -60,10 +61,14 @@ struct hwdriver_s hwdriver;
|
||||
// Commands and console variables
|
||||
// ==========================================================================
|
||||
|
||||
// keep the state here instead of in the cv var, so it always matches the state in r_opengl.c
|
||||
int gr_use_palette_shader = 0;
|
||||
|
||||
static void CV_filtermode_ONChange(void);
|
||||
static void CV_anisotropic_ONChange(void);
|
||||
static void CV_screentextures_ONChange(void);
|
||||
static void CV_useCustomShaders_ONChange(void);
|
||||
static void CV_useCustomShaders_ONChange(void);
|
||||
static void CV_grpaletteshader_OnChange(void);
|
||||
|
||||
static CV_PossibleValue_t grfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED, "Nearest"},
|
||||
{HWD_SET_TEXTUREFILTER_BILINEAR, "Bilinear"}, {HWD_SET_TEXTUREFILTER_TRILINEAR, "Trilinear"},
|
||||
@@ -115,7 +120,11 @@ static INT32 current_bsp_culling_distance = 0;
|
||||
consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL, CV_OnOff,
|
||||
CV_screentextures_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grusecustomshaders = {"gr_usecustomshaders", "Yes", CV_CALL|CV_SAVE, CV_OnOff, CV_useCustomShaders_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grusecustomshaders = {"gr_usecustomshaders", "Yes", CV_CALL|CV_SAVE, CV_OnOff, CV_useCustomShaders_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grpaletteshader = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_grpaletteshader_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grflashpal = {"gr_flashpal", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void CV_filtermode_ONChange(void)
|
||||
{
|
||||
@@ -138,6 +147,16 @@ static void CV_useCustomShaders_ONChange(void)
|
||||
HWD.pfnInitCustomShaders();
|
||||
}
|
||||
|
||||
static void CV_grpaletteshader_OnChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_PALETTE_SHADER_ENABLED, cv_grpaletteshader.value);
|
||||
gr_use_palette_shader = cv_grpaletteshader.value;
|
||||
V_SetPalette(0);
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Globals
|
||||
// ==========================================================================
|
||||
@@ -194,7 +213,7 @@ FTransform atransform;
|
||||
|
||||
// Float variants of viewx, viewy, viewz, etc.
|
||||
static float gr_viewx, gr_viewy, gr_viewz;
|
||||
static float gr_viewsin, gr_viewcos;
|
||||
float gr_viewsin, gr_viewcos;
|
||||
|
||||
static fixed_t dup_viewx, dup_viewy, dup_viewz;
|
||||
|
||||
@@ -400,6 +419,7 @@ static size_t gr_numportalcullsectors = 0;
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap)
|
||||
{
|
||||
RGBA_t poly_color, tint_color, fade_color;
|
||||
boolean default_colormap = false;
|
||||
|
||||
poly_color.rgba = 0xFFFFFFFF;
|
||||
tint_color.rgba = (colormap != NULL) ? (UINT32)colormap->rgba : GL_DEFAULTMIX;
|
||||
@@ -451,6 +471,37 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
||||
Surface->LightInfo.light_level = light_level;
|
||||
Surface->LightInfo.fade_start = (colormap != NULL) ? colormap->fadestart : 0;
|
||||
Surface->LightInfo.fade_end = (colormap != NULL) ? colormap->fadeend : 31;
|
||||
|
||||
if (gr_use_palette_shader)
|
||||
{
|
||||
if (!colormap)
|
||||
{
|
||||
colormap = &extra_colormaps[num_extra_colormaps];
|
||||
default_colormap = true;
|
||||
}
|
||||
if (!colormap->gl_lighttable_id)
|
||||
{
|
||||
UINT8 *colormap_pointer;
|
||||
|
||||
if (default_colormap)
|
||||
{
|
||||
colormap_pointer = colormaps;
|
||||
}
|
||||
else
|
||||
{
|
||||
colormap_pointer = colormap->colormap;
|
||||
}
|
||||
colormap->gl_lighttable_id = HWD.pfnAddLightTable(colormap_pointer);
|
||||
}
|
||||
|
||||
Surface->LightTableId = colormap->gl_lighttable_id;
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_ClearLightTableCache()
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnClearLightTableCache();
|
||||
}
|
||||
|
||||
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap) // Let's see if this can work
|
||||
@@ -723,9 +774,82 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
|
||||
else if (PolyFlags & PF_Ripple)
|
||||
HWD.pfnSetShader(5); // water shader
|
||||
else
|
||||
HWD.pfnSetShader(1); // floor shader
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags);
|
||||
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags, false);
|
||||
|
||||
if (subsector)
|
||||
{
|
||||
// Horizon lines
|
||||
FOutVector horizonpts[6];
|
||||
float dist, vx, vy;
|
||||
float x1, y1, xd, yd;
|
||||
UINT8 numplanes, j;
|
||||
vertex_t v; // For determining the closest distance from the line to the camera, to split render planes for minimum distortion;
|
||||
|
||||
const float renderdist = 27000.0f; // How far out to properly render the plane
|
||||
const float farrenderdist = 32768.0f; // From here, raise plane to horizon level to fill in the line with some texture distortion
|
||||
|
||||
seg_t *line = &segs[subsector->firstline];
|
||||
|
||||
for (i = 0; i < subsector->numlines; i++, line++)
|
||||
{
|
||||
if (line->linedef->special == 41 && R_PointOnSegSide(dup_viewx, dup_viewy, line) == 0)
|
||||
{
|
||||
P_ClosestPointOnLine(viewx, viewy, line->linedef, &v);
|
||||
dist = FIXED_TO_FLOAT(R_PointToDist(v.x, v.y));
|
||||
|
||||
x1 = ((polyvertex_t *)line->pv1)->x;
|
||||
y1 = ((polyvertex_t *)line->pv1)->y;
|
||||
xd = ((polyvertex_t *)line->pv2)->x - x1;
|
||||
yd = ((polyvertex_t *)line->pv2)->y - y1;
|
||||
|
||||
// Based on the seg length and the distance from the line, split horizon into multiple poly sets to reduce distortion
|
||||
dist = sqrtf((xd*xd) + (yd*yd)) / dist / 16.0f;
|
||||
if (dist > 100.0f)
|
||||
numplanes = 100;
|
||||
else
|
||||
numplanes = (UINT8)dist + 1;
|
||||
|
||||
for (j = 0; j < numplanes; j++)
|
||||
{
|
||||
// Left side
|
||||
vx = x1 + xd * j / numplanes;
|
||||
vy = y1 + yd * j / numplanes;
|
||||
SETUP3DVERT((&horizonpts[1]), vx, vy);
|
||||
|
||||
dist = sqrtf(powf(vx - gr_viewx, 2) + powf(vy - gr_viewy, 2));
|
||||
vx = (vx - gr_viewx) * renderdist / dist + gr_viewx;
|
||||
vy = (vy - gr_viewy) * renderdist / dist + gr_viewy;
|
||||
SETUP3DVERT((&horizonpts[0]), vx, vy);
|
||||
|
||||
// Right side
|
||||
vx = x1 + xd * (j+1) / numplanes;
|
||||
vy = y1 + yd * (j+1) / numplanes;
|
||||
SETUP3DVERT((&horizonpts[2]), vx, vy);
|
||||
|
||||
dist = sqrtf(powf(vx - gr_viewx, 2) + powf(vy - gr_viewy, 2));
|
||||
vx = (vx - gr_viewx) * renderdist / dist + gr_viewx;
|
||||
vy = (vy - gr_viewy) * renderdist / dist + gr_viewy;
|
||||
SETUP3DVERT((&horizonpts[3]), vx, vy);
|
||||
|
||||
// Horizon fills
|
||||
vx = (horizonpts[0].x - gr_viewx) * farrenderdist / renderdist + gr_viewx;
|
||||
vy = (horizonpts[0].z - gr_viewy) * farrenderdist / renderdist + gr_viewy;
|
||||
SETUP3DVERT((&horizonpts[5]), vx, vy);
|
||||
horizonpts[5].y = gr_viewz;
|
||||
|
||||
vx = (horizonpts[3].x - gr_viewx) * farrenderdist / renderdist + gr_viewx;
|
||||
vy = (horizonpts[3].z - gr_viewy) * farrenderdist / renderdist + gr_viewy;
|
||||
SETUP3DVERT((&horizonpts[4]), vx, vy);
|
||||
horizonpts[4].y = gr_viewz;
|
||||
|
||||
// Draw
|
||||
HWD.pfnDrawPolygon(&Surf, horizonpts, 6, PolyFlags, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
@@ -788,8 +912,8 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
|
||||
break;
|
||||
}
|
||||
|
||||
HWD.pfnSetShader(2); // wall shader
|
||||
HWD.pfnDrawPolygon(&pSurf, wallVerts, 4, i|PF_Modulated|PF_Decal);
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader
|
||||
HWD.pfnDrawPolygon(&pSurf, wallVerts, 4, i|PF_Modulated|PF_Decal, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -822,7 +946,7 @@ void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend
|
||||
{
|
||||
HWR_Lighting(pSurf, lightlevel, wallcolormap);
|
||||
|
||||
HWD.pfnSetShader(2); // wall shader
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader
|
||||
|
||||
// don't draw to color buffer when drawing to stencil
|
||||
if (gl_drawing_stencil)
|
||||
@@ -831,7 +955,7 @@ void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend
|
||||
blendmode &= ~PF_Masked;
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(pSurf, wallVerts, 4, blendmode|PF_Modulated|PF_Occlude);
|
||||
HWD.pfnDrawPolygon(pSurf, wallVerts, 4, blendmode|PF_Modulated|PF_Occlude, false);
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
if (gr_curline->linedef->splats && cv_splats.value)
|
||||
@@ -904,13 +1028,15 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa
|
||||
{
|
||||
if (pfloor && (pfloor->flags & FF_FOG))
|
||||
{
|
||||
lightnum = HWR_CalcWallLight(pfloor->master->frontsector->lightlevel, v1x, v1y, v2x, v2y);
|
||||
colormap = pfloor->master->frontsector->extra_colormap;
|
||||
lightnum = pfloor->master->frontsector->lightlevel;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y);
|
||||
}
|
||||
else
|
||||
{
|
||||
lightnum = HWR_CalcWallLight(*list[i].lightlevel, v1x, v1y, v2x, v2y);
|
||||
colormap = list[i].extra_colormap;
|
||||
lightnum = *list[i].lightlevel;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1001,9 +1127,22 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa
|
||||
}
|
||||
#endif
|
||||
|
||||
// Found a break
|
||||
bot = min(max(bheight, realbot), top);
|
||||
#ifdef ESLOPE
|
||||
if (endbheight > endtop)
|
||||
endbot = endtop;
|
||||
#endif
|
||||
if (bheight >= top)
|
||||
continue;
|
||||
|
||||
//Found a break;
|
||||
bot = bheight;
|
||||
|
||||
if (bot < realbot)
|
||||
bot = realbot;
|
||||
|
||||
#ifdef ESLOPE
|
||||
endbot = min(max(endbheight, endrealbot), endtop);
|
||||
#endif
|
||||
|
||||
Surf->PolyColor.s.alpha = alpha;
|
||||
|
||||
@@ -1125,7 +1264,7 @@ void HWR_DrawSkyWallList()
|
||||
HWD.pfnUnSetShader();
|
||||
for (i = 0; i < skyWallVertexArraySize; i++)
|
||||
{
|
||||
HWD.pfnDrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
HWD.pfnDrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1297,8 +1436,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT));
|
||||
}
|
||||
|
||||
lightnum = HWR_CalcWallLight(gr_frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y);
|
||||
colormap = gr_frontsector->extra_colormap;
|
||||
lightnum = gr_frontsector->lightlevel;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
|
||||
|
||||
if (gr_frontsector)
|
||||
Surf.PolyColor.s.alpha = 255;
|
||||
@@ -2119,8 +2259,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
blendmode = PF_Fog|PF_NoTexture;
|
||||
|
||||
lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y);
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
lightnum = rover->master->frontsector->lightlevel;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
|
||||
|
||||
|
||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
@@ -2242,8 +2384,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
blendmode = PF_Fog|PF_NoTexture;
|
||||
|
||||
lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y);
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
lightnum = rover->master->frontsector->lightlevel;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
|
||||
|
||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
@@ -2950,8 +3093,8 @@ void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t
|
||||
else
|
||||
blendmode |= PF_Masked|PF_Modulated;
|
||||
|
||||
HWD.pfnSetShader(1); // floor shader
|
||||
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode);
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader
|
||||
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode, false);
|
||||
}
|
||||
|
||||
void HWR_AddPolyObjectPlanes(void)
|
||||
@@ -3749,13 +3892,13 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
|
||||
if (sSurf.PolyColor.s.alpha > floorheight/4)
|
||||
{
|
||||
sSurf.PolyColor.s.alpha = (UINT8)(sSurf.PolyColor.s.alpha - floorheight/4);
|
||||
HWD.pfnSetShader(1); // floor shader
|
||||
HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated);
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader
|
||||
HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated, false);
|
||||
}
|
||||
}
|
||||
|
||||
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
|
||||
static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts)
|
||||
static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts, const boolean precip)
|
||||
{
|
||||
if (cv_grspritebillboarding.value && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) && wallVerts)
|
||||
{
|
||||
@@ -3825,7 +3968,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
FOutVector baseWallVerts[4]; // This is what the verts should end up as
|
||||
GLPatch_t *gpatch;
|
||||
FSurfaceInfo Surf;
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->flags & SF_HIRES);
|
||||
extracolormap_t *colormap;
|
||||
FUINT lightlevel;
|
||||
FBITFIELD blend = 0;
|
||||
@@ -3849,7 +3992,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
|
||||
if (hires)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)spr->mobj->skin)->highresscale);
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->highresscale);
|
||||
|
||||
gpatch = spr->gpatch; //W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
|
||||
|
||||
@@ -3907,7 +4050,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
}
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, baseWallVerts);
|
||||
HWR_RotateSpritePolyToAim(spr, baseWallVerts, false);
|
||||
|
||||
// push it toward the camera to mitigate floor-clipping sprites
|
||||
{
|
||||
@@ -4116,8 +4259,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
|
||||
Surf.PolyColor.s.alpha = alpha;
|
||||
|
||||
HWD.pfnSetShader(3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated);
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, false);
|
||||
|
||||
top = bot;
|
||||
#ifdef ESLOPE
|
||||
@@ -4156,8 +4299,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
|
||||
Surf.PolyColor.s.alpha = alpha;
|
||||
|
||||
HWD.pfnSetShader(3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated);
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, false);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -4171,11 +4314,11 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||
FOutVector wallVerts[4];
|
||||
GLPatch_t *gpatch; // sprite patch converted to hardware
|
||||
FSurfaceInfo Surf;
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->flags & SF_HIRES);
|
||||
if (spr->mobj)
|
||||
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
if (hires)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)spr->mobj->skin)->highresscale);
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->highresscale);
|
||||
|
||||
if (!spr->mobj)
|
||||
return;
|
||||
@@ -4254,7 +4397,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
// ...nah
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts);
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
|
||||
|
||||
// push it toward the camera to mitigate floor-clipping sprites
|
||||
{
|
||||
@@ -4309,8 +4452,8 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||
blend = PF_Translucent|PF_Occlude;
|
||||
}
|
||||
|
||||
HWD.pfnSetShader(3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated);
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4348,7 +4491,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
|
||||
wallVerts[1].z = wallVerts[2].z = spr->z2;
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts);
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, true);
|
||||
|
||||
wallVerts[0].s = wallVerts[3].s = 0;
|
||||
wallVerts[2].s = wallVerts[1].s = gpatch->max_s;
|
||||
@@ -4403,8 +4546,8 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
|
||||
blend = PF_Translucent|PF_Occlude;
|
||||
}
|
||||
|
||||
HWD.pfnSetShader(3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated);
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, false);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -4722,8 +4865,19 @@ void HWR_DrawSprites(void)
|
||||
else
|
||||
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
md2_t *md2;
|
||||
if (spr->mobj->localskin)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
md2 = &md2_localplayermodels[(skin_t *)spr->mobj->localskin - localskins];
|
||||
else
|
||||
md2 = &md2_playermodels [(skin_t *)spr->mobj->localskin - skins];
|
||||
}
|
||||
else
|
||||
md2 = &md2_playermodels[(skin_t *)spr->mobj->skin - skins];
|
||||
|
||||
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
|
||||
if (!cv_grmdls.value || ((md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) && ((!cv_grfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
if (!cv_grmdls.value || ((md2->notfound || md2->scale < 0.0f) && ((!cv_grfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
@@ -4970,7 +5124,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if (thing->skin && thing->sprite == SPR_PLAY)
|
||||
{
|
||||
sprdef = &((skin_t *)thing->skin)->spritedef;
|
||||
sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef;
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[thing->sprite];
|
||||
#endif
|
||||
@@ -5045,8 +5199,8 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
}
|
||||
}
|
||||
|
||||
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)thing->skin)->highresscale);
|
||||
if (thing->skin && ((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->flags & SF_HIRES)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->highresscale);
|
||||
|
||||
spr_width = spritecachedinfo[lumpoff].width;
|
||||
spr_height = spritecachedinfo[lumpoff].height;
|
||||
@@ -5065,7 +5219,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
rollsum = (thing->rollangle)+(thing->sloperoll);
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, sprinfo, rollangle);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
@@ -5074,6 +5228,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
spr_offset = rotsprite->leftoffset << FRACBITS;
|
||||
spr_topoffset = rotsprite->topoffset << FRACBITS;
|
||||
spr_topoffset += FEETADJUST;
|
||||
|
||||
// flip -> rotate, not rotate -> flip
|
||||
flip = 0;
|
||||
}
|
||||
@@ -5129,13 +5284,13 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
gz = FIXED_TO_FLOAT(interp.z+thing->height) - FIXED_TO_FLOAT(spr_topoffset) * this_yscale;
|
||||
gzt = gz + FIXED_TO_FLOAT(spr_height) * this_yscale;
|
||||
gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
|
||||
gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale);
|
||||
}
|
||||
else
|
||||
{
|
||||
gzt = FIXED_TO_FLOAT(interp.z) + FIXED_TO_FLOAT(spr_topoffset) * this_yscale;
|
||||
gz = gzt - FIXED_TO_FLOAT(spr_height) * this_yscale;
|
||||
gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
|
||||
gz = gzt - (FIXED_TO_FLOAT(spr_height) * this_yscale);
|
||||
}
|
||||
|
||||
if (thing->subsector->sector->cullheight)
|
||||
@@ -5177,10 +5332,10 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
vis->spriteyscale = spriteyscale;
|
||||
vis->spritexoffset = FIXED_TO_FLOAT(spr_offset);
|
||||
vis->spriteyoffset = FIXED_TO_FLOAT(spr_topoffset);
|
||||
//vis->patchlumpnum = sprframe->lumppat[rot];
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (rotsprite)
|
||||
vis->gpatch = (GLPatch_t *)rotsprite;
|
||||
vis->gpatch = (GLPatch_t *)rotsprite;
|
||||
else
|
||||
#endif
|
||||
vis->gpatch = (GLPatch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
|
||||
@@ -5204,10 +5359,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
if (thing->colorized)
|
||||
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE);
|
||||
else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
|
||||
{
|
||||
size_t skinnum = (skin_t*)thing->skin-skins;
|
||||
vis->colormap = R_GetTranslationColormap((INT32)skinnum, thing->color, GTC_CACHE);
|
||||
}
|
||||
vis->colormap = R_GetLocalTranslationColormap(thing->skin, thing->localskin, thing->color, GTC_CACHE, thing->skinlocal);
|
||||
else
|
||||
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, thing->color, GTC_CACHE);
|
||||
}
|
||||
@@ -5252,11 +5404,11 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
unsigned rot = 0;
|
||||
UINT8 flip;
|
||||
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
if (!thing)
|
||||
return;
|
||||
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused)
|
||||
@@ -5325,16 +5477,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
x1 = tr_x + x1 * rightcos;
|
||||
x2 = tr_x - x2 * rightcos;
|
||||
|
||||
// okay, we can't return now... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!(thing->precipflags & PCF_THUNK))
|
||||
{
|
||||
if (thing->precipflags & PCF_RAIN)
|
||||
P_RainThinker(thing);
|
||||
else
|
||||
P_SnowThinker(thing);
|
||||
thing->precipflags |= PCF_THUNK;
|
||||
}
|
||||
|
||||
//
|
||||
// store information in a vissprite
|
||||
//
|
||||
@@ -5345,7 +5487,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
vis->z2 = z2;
|
||||
vis->tz = tz;
|
||||
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
|
||||
//vis->patchlumpnum = sprframe->lumppat[rot];
|
||||
vis->gpatch = (GLPatch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
|
||||
vis->flip = flip;
|
||||
vis->mobj = (mobj_t *)thing;
|
||||
@@ -5364,6 +5505,16 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
vis->gz = vis->gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height);
|
||||
|
||||
vis->precip = true;
|
||||
|
||||
// okay... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!(thing->precipflags & PCF_THUNK))
|
||||
{
|
||||
if (thing->precipflags & PCF_RAIN)
|
||||
P_RainThinker(thing);
|
||||
else
|
||||
P_SnowThinker(thing);
|
||||
thing->precipflags |= PCF_THUNK;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean drewsky = false;
|
||||
@@ -5696,8 +5847,18 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
}
|
||||
gr_collect_skywalls = false;
|
||||
|
||||
ps_numsprites.value.i = gr_visspritecount;
|
||||
PS_START_TIMING(ps_hw_spritesorttime);
|
||||
HWR_SortVisSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritesorttime);
|
||||
PS_START_TIMING(ps_hw_spritedrawtime);
|
||||
HWR_DrawSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritedrawtime);
|
||||
|
||||
ps_numdrawnodes.value.i = 0;
|
||||
ps_hw_nodesorttime.value.p = 0;
|
||||
ps_hw_nodedrawtime.value.p = 0;
|
||||
HWR_RenderDrawNodes();
|
||||
}
|
||||
// free memory from portal list allocated by calls to Add2Lines
|
||||
@@ -5713,6 +5874,7 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
// TODO: is it okay if stencil test is on all the time even when its not needed?
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// Render the current frame.
|
||||
// ==========================================================================
|
||||
@@ -5815,6 +5977,8 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
if (skybox)
|
||||
drewsky = true;
|
||||
|
||||
current_bsp_culling_distance = 0;
|
||||
|
||||
if (!skybox && cv_grrenderdistance.value)
|
||||
{
|
||||
HWD.pfnGClipRect((INT32)gr_viewwindowx,
|
||||
@@ -5831,7 +5995,6 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
HWD.pfnSetSpecialState(HWD_SET_SHADERS, cv_grshaders.value);
|
||||
HWD.pfnSetShader(0);
|
||||
|
||||
//drawcount = 0;
|
||||
validcount++;
|
||||
|
||||
portalclipline = NULL;
|
||||
@@ -5869,18 +6032,8 @@ void HWR_RenderSinglePortal(portal_t *portal, size_t portalnum, float fpov, play
|
||||
portalcullsector = gr_portalcullsectors[portalnum];
|
||||
HWR_RenderBSPNode((INT32)numnodes - 1);
|
||||
|
||||
// Draw MD2 and sprites
|
||||
ps_numsprites.value.i = gr_visspritecount;
|
||||
PS_START_TIMING(ps_hw_spritesorttime);
|
||||
HWR_SortVisSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritesorttime);
|
||||
PS_START_TIMING(ps_hw_spritedrawtime);
|
||||
HWR_DrawSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritedrawtime);
|
||||
|
||||
ps_numdrawnodes.value.i = 0;
|
||||
ps_hw_nodesorttime.value.p = 0;
|
||||
ps_hw_nodedrawtime.value.p = 0;
|
||||
HWR_RenderDrawNodes();
|
||||
}
|
||||
|
||||
@@ -5949,6 +6102,8 @@ void HWR_AddCommands(void)
|
||||
CV_RegisterVar(&cv_portalline);
|
||||
CV_RegisterVar(&cv_portalonly);
|
||||
CV_RegisterVar(&cv_secbright);
|
||||
CV_RegisterVar(&cv_grpaletteshader);
|
||||
CV_RegisterVar(&cv_grflashpal);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -5990,7 +6145,6 @@ void HWR_Startup(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Free resources allocated by the hardware renderer
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -6012,8 +6166,6 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend,
|
||||
|
||||
pSurf->PolyColor.s.alpha = alpha; // put the alpha back after lighting
|
||||
|
||||
HWD.pfnSetShader(2); // wall shader
|
||||
|
||||
if (blend & PF_Environment)
|
||||
blendmode |= PF_Occlude; // PF_Occlude must be used for solid objects
|
||||
|
||||
@@ -6025,7 +6177,9 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend,
|
||||
|
||||
blendmode |= PF_Modulated; // No PF_Occlude means overlapping (incorrect) transparency
|
||||
|
||||
HWD.pfnDrawPolygon(pSurf, wallVerts, 4, blendmode);
|
||||
if (!fogwall)
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader
|
||||
HWD.pfnDrawPolygon(pSurf, wallVerts, 4, blendmode, false);
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
if (gr_curline->linedef->splats && cv_splats.value)
|
||||
@@ -6056,7 +6210,7 @@ void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
// Armageddon Blast Flash!
|
||||
// Could this even be considered postprocessor?
|
||||
if (player->flashcount)
|
||||
if (player->flashcount && !cv_grpaletteshader.value || player->flashcount && cv_grpaletteshader.value && !cv_grflashpal.value)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
@@ -6076,7 +6230,7 @@ void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
Surf.PolyColor.s.alpha = 0xc0; // match software mode
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
if (!cv_grscreentextures.value) // screen textures are needed for the rest of the effects
|
||||
@@ -6185,6 +6339,8 @@ void HWR_MakeScreenFinalTexture(void)
|
||||
|
||||
void HWR_DrawScreenFinalTexture(int width, int height)
|
||||
{
|
||||
if (gr_use_palette_shader)
|
||||
HWD.pfnSetShader(11); //post processing
|
||||
HWD.pfnDrawScreenFinalTexture(width, height);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ extern unsigned msaa;
|
||||
extern boolean a2c;
|
||||
|
||||
extern FTransform atransform;
|
||||
extern float gr_viewsin, gr_viewcos;
|
||||
|
||||
// Performance stats
|
||||
extern ps_metric_t ps_hw_nodesorttime;
|
||||
@@ -97,6 +98,9 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if
|
||||
|
||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
|
||||
// Get amount of memory used by gpu textures in bytes
|
||||
INT32 HWR_GetTextureUsed(void);
|
||||
|
||||
// hw_main.c: Post-rendering
|
||||
void HWR_DoPostProcessor(player_t *player);
|
||||
void HWR_StartScreenWipe(void);
|
||||
@@ -138,6 +142,8 @@ void HWR_AddLine(seg_t *line);
|
||||
boolean HWR_CheckBBox(fixed_t *bspcoord);
|
||||
void HWR_RenderDrawNodes(void);
|
||||
|
||||
void HWR_ClearLightTableCache(void);
|
||||
|
||||
// hw_main.c: Sprites
|
||||
void HWR_AddSprites(sector_t *sec);
|
||||
void HWR_ProjectSprite(mobj_t *thing);
|
||||
@@ -175,6 +181,8 @@ extern consvar_t cv_grfallbackplayermodel;
|
||||
extern consvar_t cv_grbatching;
|
||||
extern consvar_t cv_grrenderdistance;
|
||||
extern consvar_t cv_grusecustomshaders;
|
||||
extern consvar_t cv_grpaletteshader;
|
||||
extern consvar_t cv_grflashpal;
|
||||
extern consvar_t cv_grportals;
|
||||
extern consvar_t cv_nostencil;
|
||||
extern consvar_t cv_secbright;
|
||||
|
||||
+62
-22
@@ -75,6 +75,7 @@
|
||||
|
||||
md2_t md2_models[NUMSPRITES];
|
||||
md2_t md2_playermodels[MAXSKINS];
|
||||
md2_t md2_localplayermodels[MAXSKINS];
|
||||
|
||||
|
||||
/*
|
||||
@@ -487,6 +488,13 @@ void HWR_InitMD2(void)
|
||||
md2_playermodels[s].skin = -1;
|
||||
md2_playermodels[s].notfound = true;
|
||||
md2_playermodels[s].error = false;
|
||||
|
||||
md2_localplayermodels[s].scale = -1.0f;
|
||||
md2_localplayermodels[s].model = NULL;
|
||||
md2_localplayermodels[s].grpatch = NULL;
|
||||
md2_localplayermodels[s].skin = -1;
|
||||
md2_localplayermodels[s].notfound = true;
|
||||
md2_localplayermodels[s].error = false;
|
||||
}
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
{
|
||||
@@ -559,11 +567,12 @@ md2found:
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
|
||||
void HWR_AddPlayerMD2(int skin, boolean local) // For MD2's that were added after startup
|
||||
{
|
||||
FILE *f;
|
||||
char name[20], filename[32];
|
||||
float scale, offset;
|
||||
md2_t *md2s;
|
||||
|
||||
if (nomd2s)
|
||||
return;
|
||||
@@ -585,22 +594,23 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
|
||||
}
|
||||
}
|
||||
|
||||
// Check for any MD2s that match the names of sprite names!
|
||||
md2s = ( (local) ? md2_localplayermodels : md2_playermodels );
|
||||
// Check for any MD2s that match the names of player skins!
|
||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
{
|
||||
if (stricmp(name, skins[skin].name) == 0)
|
||||
if (stricmp(name, ( (local) ? localskins : skins )[skin].name) == 0)
|
||||
{
|
||||
md2_playermodels[skin].skin = skin;
|
||||
md2_playermodels[skin].scale = scale;
|
||||
md2_playermodels[skin].offset = offset;
|
||||
md2_playermodels[skin].notfound = false;
|
||||
strcpy(md2_playermodels[skin].filename, filename);
|
||||
md2s[skin].skin = skin;
|
||||
md2s[skin].scale = scale;
|
||||
md2s[skin].offset = offset;
|
||||
md2s[skin].notfound = false;
|
||||
strcpy(md2s[skin].filename, filename);
|
||||
goto playermd2found;
|
||||
}
|
||||
}
|
||||
|
||||
//CONS_Printf("MD2 for player skin %s not found\n", skins[skin].name);
|
||||
md2_playermodels[skin].notfound = true;
|
||||
md2s[skin].notfound = true;
|
||||
playermd2found:
|
||||
fclose(f);
|
||||
}
|
||||
@@ -1144,7 +1154,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
spriteinfo_t *sprinfo;
|
||||
INT32 rollfactor = 0;
|
||||
angle_t ang;
|
||||
float finalscale;
|
||||
interpmobjstate_t interp;
|
||||
|
||||
if (R_UsingFrameInterpolation() && !paused)
|
||||
@@ -1155,6 +1164,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
md2_t *md2s;
|
||||
int skinnum;
|
||||
|
||||
// Apparently people don't like jump frames like that, so back it goes
|
||||
//if (tics > durs)
|
||||
@@ -1169,13 +1180,33 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
|
||||
/* fuck you */
|
||||
if (spr->mobj->localskin)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
{
|
||||
md2s = md2_localplayermodels;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - localskins;
|
||||
}
|
||||
else
|
||||
{
|
||||
md2s = md2_playermodels;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - skins;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
md2s = md2_playermodels;
|
||||
skinnum = (skin_t *)spr->mobj->skin - skins;
|
||||
}
|
||||
|
||||
// 1. load model+texture if not already loaded
|
||||
// 2. draw model with correct position, rotation,...
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && !md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound) // Use the player MD2 list if the mobj has a skin and is using the player sprites
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && !md2s[skinnum].notfound) // Use the player MD2 list if the mobj has a skin and is using the player sprites
|
||||
{
|
||||
md2 = &md2_playermodels[(skin_t*)spr->mobj->skin-skins];
|
||||
md2->skin = (skin_t*)spr->mobj->skin-skins;
|
||||
md2 = &md2s[skinnum];
|
||||
md2->skin = skinnum;
|
||||
sprinfo = &spriteinfo[spr->mobj->sprite];
|
||||
}
|
||||
else
|
||||
@@ -1204,7 +1235,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
return;
|
||||
}
|
||||
}
|
||||
finalscale = md2->scale;
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
gpatch = md2->grpatch;
|
||||
if (!gpatch || ((!gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded) && !gpatch->notfound))
|
||||
@@ -1241,7 +1271,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
skinnum = TC_RAINBOW;
|
||||
else
|
||||
{
|
||||
skinnum = (INT32)((skin_t*)spr->mobj->skin-skins);
|
||||
skinnum = (INT32)((skin_t*)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ) - ( (spr->mobj->skinlocal) ? localskins : skins ));
|
||||
}
|
||||
}
|
||||
else skinnum = TC_DEFAULT;
|
||||
@@ -1308,7 +1338,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
p.z = FIXED_TO_FLOAT(interp.z);
|
||||
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
sprdef = &((skin_t *)spr->mobj->skin)->spritedef;
|
||||
sprdef = &((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->spritedef;
|
||||
else
|
||||
sprdef = &sprites[spr->mobj->sprite];
|
||||
|
||||
@@ -1386,18 +1416,28 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
}
|
||||
#endif
|
||||
|
||||
// SRB2CBTODO: MD2 scaling support
|
||||
finalscale *= FIXED_TO_FLOAT(interp.scale);
|
||||
|
||||
|
||||
|
||||
p.flip = atransform.flip;
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnSetShader(4); // model shader
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, &Surf);
|
||||
{
|
||||
float this_scale = FIXED_TO_FLOAT(interp.scale);
|
||||
|
||||
float xs = this_scale * FIXED_TO_FLOAT(interp.spritexscale);
|
||||
float ys = this_scale * FIXED_TO_FLOAT(interp.spriteyscale);
|
||||
|
||||
float ox = xs * FIXED_TO_FLOAT(interp.spritexoffset);
|
||||
float oy = ys * FIXED_TO_FLOAT(interp.spriteyoffset);
|
||||
|
||||
// offset perpendicular to the camera angle
|
||||
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, &Surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,10 +37,11 @@ typedef struct
|
||||
|
||||
extern md2_t md2_models[NUMSPRITES];
|
||||
extern md2_t md2_playermodels[MAXSKINS];
|
||||
extern md2_t md2_localplayermodels[MAXSKINS];
|
||||
|
||||
void HWR_InitMD2(void);
|
||||
void HWR_DrawMD2(gr_vissprite_t *spr);
|
||||
void HWR_AddPlayerMD2(INT32 skin);
|
||||
void HWR_AddPlayerMD2(INT32 skin, boolean local);
|
||||
void HWR_AddSpriteMD2(size_t spritenum);
|
||||
|
||||
#endif // _HW_MD2_H_
|
||||
@@ -26,10 +26,15 @@
|
||||
#include "r_opengl.h"
|
||||
#include "r_vbo.h"
|
||||
|
||||
#include "../../v_video.h" // pLocalPalette
|
||||
#include "../../r_data.h" // NearestColor
|
||||
|
||||
#include "../../p_tick.h" // for leveltime (NOTE: THIS IS BAD, FIGURE OUT HOW TO PROPERLY IMPLEMENT gl_leveltime)
|
||||
#include "../../i_system.h" // for I_GetPreciseTime (batching time measurements)
|
||||
|
||||
// Eeeeh not sure is this right way, but it works
|
||||
#include "../hw_main.h"
|
||||
|
||||
// Eeeeh not sure is this right way, but it works < sry :c
|
||||
extern consvar_t cv_grusecustomshaders;
|
||||
|
||||
extern fixed_t fovtan; // also extremely bad, I'm just too lazy!!!
|
||||
@@ -44,12 +49,15 @@ struct GLRGBAFloat
|
||||
GLfloat alpha;
|
||||
};
|
||||
typedef struct GLRGBAFloat GLRGBAFloat;
|
||||
|
||||
static const GLubyte white[4] = { 255, 255, 255, 255 };
|
||||
|
||||
// ==========================================================================
|
||||
// CONSTANTS
|
||||
// ==========================================================================
|
||||
|
||||
|
||||
|
||||
// With OpenGL 1.1+, the first texture should be 1
|
||||
#define NOTEXTURE_NUM 0
|
||||
|
||||
@@ -70,8 +78,17 @@ static GLuint tex_downloaded = 0;
|
||||
static GLfloat fov = 90.0f;
|
||||
static FBITFIELD CurrentPolyFlags;
|
||||
|
||||
static FTextureInfo* gr_cachetail = NULL;
|
||||
static FTextureInfo* gr_cachehead = NULL;
|
||||
static FTextureInfo *gr_cachetail = NULL;
|
||||
static FTextureInfo *gr_cachehead = NULL;
|
||||
|
||||
typedef struct LightTableCacheEntry_s
|
||||
{
|
||||
GLuint id;
|
||||
struct LightTableCacheEntry_s *next;
|
||||
} LightTableCacheEntry_t;
|
||||
|
||||
LightTableCacheEntry_t *ltcachehead = NULL;
|
||||
LightTableCacheEntry_t *ltcachetail = NULL;
|
||||
|
||||
RGBA_t myPaletteData[256];
|
||||
GLint screen_width = 0; // used by Draw2DLine()
|
||||
@@ -235,6 +252,7 @@ FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
|
||||
#define pglTexEnvi glTexEnvi
|
||||
#define pglTexParameteri glTexParameteri
|
||||
#define pglTexImage2D glTexImage2D
|
||||
#define pglTexImage3D glTexImage3D
|
||||
|
||||
/* Fog */
|
||||
#define pglFogf glFogf
|
||||
@@ -355,6 +373,8 @@ typedef void (APIENTRY * PFNglTexParameteri) (GLenum target, GLenum pname, GLint
|
||||
static PFNglTexParameteri pglTexParameteri;
|
||||
typedef void (APIENTRY * PFNglTexImage2D) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
static PFNglTexImage2D pglTexImage2D;
|
||||
typedef void (APIENTRY * PFNglTexImage3D) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
static PFNglTexImage3D pglTexImage3D;
|
||||
|
||||
/* Fog */
|
||||
typedef void (APIENTRY * PFNglFogf) (GLenum pname, GLfloat param);
|
||||
@@ -511,6 +531,7 @@ typedef void (APIENTRY *PFNglLinkProgram) (GLuint);
|
||||
typedef void (APIENTRY *PFNglGetProgramiv) (GLuint, GLenum, GLint*);
|
||||
typedef void (APIENTRY *PFNglUseProgram) (GLuint);
|
||||
typedef void (APIENTRY *PFNglUniform1i) (GLint, GLint);
|
||||
typedef void (APIENTRY *PFNglUniform1iv) (GLint, GLsizei, const GLint*);
|
||||
typedef void (APIENTRY *PFNglUniform1f) (GLint, GLfloat);
|
||||
typedef void (APIENTRY *PFNglUniform2f) (GLint, GLfloat, GLfloat);
|
||||
typedef void (APIENTRY *PFNglUniform3f) (GLint, GLfloat, GLfloat, GLfloat);
|
||||
@@ -532,6 +553,7 @@ static PFNglLinkProgram pglLinkProgram;
|
||||
static PFNglGetProgramiv pglGetProgramiv;
|
||||
static PFNglUseProgram pglUseProgram;
|
||||
static PFNglUniform1i pglUniform1i;
|
||||
static PFNglUniform1iv pglUniform1iv;
|
||||
static PFNglUniform1f pglUniform1f;
|
||||
static PFNglUniform2f pglUniform2f;
|
||||
static PFNglUniform3f pglUniform3f;
|
||||
@@ -555,6 +577,10 @@ static boolean gl_shaderprogramchanged = true;
|
||||
|
||||
static boolean gl_batching = false;// are we currently collecting batches?
|
||||
|
||||
static GLint gl_palette[768];
|
||||
static INT32 gl_use_palette_shader = 0;
|
||||
boolean gl_palette_initialized = false;
|
||||
|
||||
static INT32 gl_enable_screen_textures = 1;
|
||||
|
||||
static GLint gl_portal_stencil_level = 0;
|
||||
@@ -571,10 +597,15 @@ typedef enum
|
||||
gluniform_lighting,
|
||||
gluniform_fade_start,
|
||||
gluniform_fade_end,
|
||||
|
||||
// misc. (custom shaders)
|
||||
|
||||
// palette rendering
|
||||
gluniform_palette,
|
||||
gluniform_color_lookup,
|
||||
gluniform_lighttable_tex,
|
||||
|
||||
// misc.
|
||||
gluniform_leveltime,
|
||||
|
||||
|
||||
gluniform_max,
|
||||
} gluniform_t;
|
||||
|
||||
@@ -594,6 +625,18 @@ static gl_shaderprogram_t gl_shaderprograms[MAXSHADERPROGRAMS];
|
||||
// GLSL Software fragment shader
|
||||
//
|
||||
|
||||
#define GLSL_DOOM_COLORMAP_floors \
|
||||
"float R_DoomColormap(float light, float z)\n" \
|
||||
"{\n" \
|
||||
"float lightnum = clamp(light / 17.0, 0.0, 15.0);\n" \
|
||||
"float lightz = clamp(z / 16.0, 0.0, 127.0);\n" \
|
||||
"float startmap = (15.0 - lightnum) * 4.0;\n" \
|
||||
"float scale = 160.0 / (lightz + 1.0);\n" \
|
||||
"return startmap * 1.06 - scale * 0.5 * 1.15;\n" \
|
||||
"}\n"
|
||||
|
||||
// 1.06 and 1.15 were chosen when trying to match software lighting in a test map
|
||||
|
||||
#define GLSL_DOOM_COLORMAP \
|
||||
"float R_DoomColormap(float light, float z)\n" \
|
||||
"{\n" \
|
||||
@@ -604,6 +647,16 @@ static gl_shaderprogram_t gl_shaderprograms[MAXSHADERPROGRAMS];
|
||||
"return startmap - scale * 0.5;\n" \
|
||||
"}\n"
|
||||
|
||||
#define GLSL_DOOM_COLORMAP_walls \
|
||||
"float R_DoomColormap(float light, float z)\n" \
|
||||
"{\n" \
|
||||
"float lightnum = clamp(light / 17.0, 0.0, 15.0);\n" \
|
||||
"float lightz = clamp(z / 16.0, 0.0, 127.0);\n" \
|
||||
"float startmap = (15.0 - lightnum) * 4.0;\n" \
|
||||
"float scale = 160.0 / (lightz + 1.0);\n" \
|
||||
"return startmap * 1.05 - scale * 1.0 * 1.1;\n" \
|
||||
"}\n"
|
||||
|
||||
#define GLSL_DOOM_LIGHT_EQUATION \
|
||||
"float R_DoomLightingEquation(float light)\n" \
|
||||
"{\n" \
|
||||
@@ -631,16 +684,16 @@ static gl_shaderprogram_t gl_shaderprograms[MAXSHADERPROGRAMS];
|
||||
"}\n" \
|
||||
"final_color = mix(final_color, fade_color, darkness);\n"
|
||||
|
||||
#define GLSL_SOFTWARE_FRAGMENT_SHADER \
|
||||
#define GLSL_SOFTWARE_UNIFORMS \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
"uniform vec4 tint_color;\n" \
|
||||
"uniform vec4 fade_color;\n" \
|
||||
"uniform float lighting;\n" \
|
||||
"uniform float fade_start;\n" \
|
||||
"uniform float fade_end;\n" \
|
||||
GLSL_DOOM_COLORMAP \
|
||||
GLSL_DOOM_LIGHT_EQUATION \
|
||||
"uniform float fade_end;\n"
|
||||
|
||||
#define GLSL_SOFTWARE_MAIN \
|
||||
"void main(void) {\n" \
|
||||
"vec4 texel = texture2D(tex, gl_TexCoord[0].st);\n" \
|
||||
"vec4 base_color = texel * poly_color;\n" \
|
||||
@@ -649,7 +702,59 @@ static gl_shaderprogram_t gl_shaderprograms[MAXSHADERPROGRAMS];
|
||||
GLSL_SOFTWARE_FADE_EQUATION \
|
||||
"final_color.a = texel.a * poly_color.a;\n" \
|
||||
"gl_FragColor = final_color;\n" \
|
||||
"}\0"
|
||||
"}\n"
|
||||
|
||||
#define GLSL_SOFTWARE_FRAGMENT_SHADER_FLOORS \
|
||||
GLSL_SOFTWARE_UNIFORMS \
|
||||
GLSL_DOOM_COLORMAP_floors \
|
||||
GLSL_DOOM_LIGHT_EQUATION \
|
||||
GLSL_SOFTWARE_MAIN \
|
||||
"\0"
|
||||
|
||||
#define GLSL_SOFTWARE_FRAGMENT_SHADER_WALLS \
|
||||
GLSL_SOFTWARE_UNIFORMS \
|
||||
GLSL_DOOM_COLORMAP_walls \
|
||||
GLSL_DOOM_LIGHT_EQUATION \
|
||||
GLSL_SOFTWARE_MAIN \
|
||||
"\0"
|
||||
|
||||
#define GLSL_SOFTWARE_PAL_UNIFORMS \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform sampler2D lighttable_tex;\n" \
|
||||
"uniform sampler3D lookup_tex;\n" \
|
||||
"uniform int palette[768];\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
"uniform float lighting;\n" \
|
||||
|
||||
#define GLSL_SOFTWARE_PAL_MAIN \
|
||||
"void main(void) {\n" \
|
||||
"vec4 texel = texture2D(tex, gl_TexCoord[0].st);\n" \
|
||||
"int tex_pal_idx = int(texture3D(lookup_tex, vec3((texel * 63.0 + 0.5) / 64.0))[0] * 255.0);\n" \
|
||||
"float z = gl_FragCoord.z / gl_FragCoord.w;\n" \
|
||||
"int light_y = int(clamp(floor(R_DoomColormap(lighting, z)), 0.0, 31.0));\n" \
|
||||
"vec2 lighttable_coord = vec2((float(tex_pal_idx) + 0.5) / 256.0, (float(light_y) + 0.5) / 32.0);\n" \
|
||||
"int final_idx = int(texture2D(lighttable_tex, lighttable_coord)[0] * 255.0);\n" \
|
||||
"vec4 final_color = vec4(float(palette[final_idx*3])/255.0, float(palette[final_idx*3+1])/255.0, float(palette[final_idx*3+2])/255.0, 1.0);\n" \
|
||||
"final_color.a = texel.a * poly_color.a;\n" \
|
||||
"gl_FragColor = final_color;\n" \
|
||||
"}\n"
|
||||
|
||||
#define GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_FLOORS \
|
||||
GLSL_SOFTWARE_PAL_UNIFORMS \
|
||||
GLSL_DOOM_COLORMAP_floors \
|
||||
GLSL_SOFTWARE_PAL_MAIN \
|
||||
"\0"
|
||||
|
||||
#define GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_WALLS \
|
||||
GLSL_SOFTWARE_PAL_UNIFORMS \
|
||||
GLSL_DOOM_COLORMAP_walls \
|
||||
GLSL_SOFTWARE_PAL_MAIN \
|
||||
"\0"
|
||||
|
||||
#define GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_POSTPROCESS \
|
||||
GLSL_SOFTWARE_PAL_UNIFORMS \
|
||||
GLSL_SOFTWARE_PAL_MAIN \
|
||||
"\0"
|
||||
|
||||
//
|
||||
// Water surface shader
|
||||
@@ -708,6 +813,20 @@ static gl_shaderprogram_t gl_shaderprograms[MAXSHADERPROGRAMS];
|
||||
GLSL_SOFTWARE_FADE_EQUATION \
|
||||
"gl_FragColor = final_color;\n" \
|
||||
"}\0"
|
||||
|
||||
//
|
||||
// Palette color quantization shader
|
||||
//
|
||||
|
||||
#define GLSL_PALETTE_FRAGMENT_SHADER \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform sampler3D lookup_tex;\n" \
|
||||
"uniform int palette[768];\n" \
|
||||
"void main(void) {\n" \
|
||||
"vec3 texel = vec3(texture2D(tex, gl_TexCoord[0].st));\n" \
|
||||
"int pal_idx = int(texture3D(lookup_tex, vec3((63.0/64.0) * texel + 1.0 / 128.0))[0] * 255.0);\n" \
|
||||
"gl_FragColor = vec4(float(palette[pal_idx*3])/255.0, float(palette[pal_idx*3+1])/255.0, float(palette[pal_idx*3+2])/255.0, 1.0);\n" \
|
||||
"}\0"
|
||||
|
||||
//
|
||||
// GLSL generic fragment shader
|
||||
@@ -725,16 +844,16 @@ static const char *fragment_shaders[] = {
|
||||
GLSL_DEFAULT_FRAGMENT_SHADER,
|
||||
|
||||
// Floor fragment shader
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER,
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER_FLOORS,
|
||||
|
||||
// Wall fragment shader
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER,
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER_WALLS,
|
||||
|
||||
// Sprite fragment shader
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER,
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER_WALLS,
|
||||
|
||||
// Model fragment shader
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER,
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER_WALLS,
|
||||
|
||||
// Water fragment shader
|
||||
GLSL_WATER_FRAGMENT_SHADER,
|
||||
@@ -747,6 +866,15 @@ static const char *fragment_shaders[] = {
|
||||
"void main(void) {\n"
|
||||
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st);\n"
|
||||
"}\0",
|
||||
|
||||
// Palette fragment shader
|
||||
GLSL_PALETTE_FRAGMENT_SHADER,
|
||||
|
||||
GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_FLOORS,
|
||||
|
||||
GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_WALLS,
|
||||
|
||||
GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_POSTPROCESS,
|
||||
|
||||
NULL,
|
||||
};
|
||||
@@ -792,6 +920,13 @@ static const char *vertex_shaders[] = {
|
||||
|
||||
// Sky vertex shader
|
||||
GLSL_DEFAULT_VERTEX_SHADER,
|
||||
|
||||
// Palette vertex shader
|
||||
GLSL_DEFAULT_VERTEX_SHADER,
|
||||
|
||||
GLSL_DEFAULT_VERTEX_SHADER,
|
||||
|
||||
GLSL_DEFAULT_VERTEX_SHADER,
|
||||
|
||||
NULL,
|
||||
};
|
||||
@@ -800,6 +935,7 @@ static const char *vertex_shaders[] = {
|
||||
|
||||
void SetupGLFunc4(void)
|
||||
{
|
||||
pglTexImage3D = GetGLFunc("glTexImage3D");
|
||||
pglActiveTexture = GetGLFunc("glActiveTexture");
|
||||
pglMultiTexCoord2f = GetGLFunc("glMultiTexCoord2f");
|
||||
pglClientActiveTexture = GetGLFunc("glClientActiveTexture");
|
||||
@@ -826,6 +962,7 @@ void SetupGLFunc4(void)
|
||||
pglGetProgramiv = GetGLFunc("glGetProgramiv");
|
||||
pglUseProgram = GetGLFunc("glUseProgram");
|
||||
pglUniform1i = GetGLFunc("glUniform1i");
|
||||
pglUniform1iv = GetGLFunc("glUniform1iv");
|
||||
pglUniform1f = GetGLFunc("glUniform1f");
|
||||
pglUniform2f = GetGLFunc("glUniform2f");
|
||||
pglUniform3f = GetGLFunc("glUniform3f");
|
||||
@@ -858,12 +995,13 @@ EXPORT boolean HWRAPI(LoadShaders) (void)
|
||||
const GLchar* vert_shader = vertex_shaders[i];
|
||||
const GLchar* frag_shader = fragment_shaders[i];
|
||||
boolean custom = cv_grusecustomshaders.value && ((gl_customvertexshaders[i] || gl_customfragmentshaders[i]) && (i > 0));
|
||||
|
||||
|
||||
// 18032019
|
||||
if (cv_grusecustomshaders.value && gl_customvertexshaders[i])
|
||||
vert_shader = gl_customvertexshaders[i];
|
||||
if (cv_grusecustomshaders.value && gl_customfragmentshaders[i])
|
||||
frag_shader = gl_customfragmentshaders[i];
|
||||
|
||||
|
||||
if (i >= MAXSHADERS)
|
||||
break;
|
||||
@@ -946,11 +1084,38 @@ EXPORT boolean HWRAPI(LoadShaders) (void)
|
||||
shader->uniforms[gluniform_lighting] = GETUNI("lighting");
|
||||
shader->uniforms[gluniform_fade_start] = GETUNI("fade_start");
|
||||
shader->uniforms[gluniform_fade_end] = GETUNI("fade_end");
|
||||
|
||||
|
||||
// palette rendering
|
||||
shader->uniforms[gluniform_palette] = GETUNI("palette");
|
||||
shader->uniforms[gluniform_color_lookup] = GETUNI("lookup_tex");
|
||||
shader->uniforms[gluniform_lighttable_tex] = GETUNI("lighttable_tex");
|
||||
|
||||
// misc. (custom shaders)
|
||||
shader->uniforms[gluniform_leveltime] = GETUNI("leveltime");
|
||||
|
||||
|
||||
#undef GETUNI
|
||||
|
||||
// set permanent uniform values
|
||||
#define UNIFORM_1(uniform, a, function) \
|
||||
if (uniform != -1) \
|
||||
function (uniform, a);
|
||||
|
||||
#define UNIFORM_2(uniform, a, b, function) \
|
||||
if (uniform != -1) \
|
||||
function (uniform, a, b);
|
||||
|
||||
pglUseProgram(shader->program);
|
||||
|
||||
// texture unit numbers for the samplers used for palette rendering
|
||||
UNIFORM_2(shader->uniforms[gluniform_palette], 768, gl_palette, pglUniform1iv);
|
||||
UNIFORM_1(shader->uniforms[gluniform_color_lookup], 1, pglUniform1i);
|
||||
UNIFORM_1(shader->uniforms[gluniform_lighttable_tex], 2, pglUniform1i);
|
||||
|
||||
pglUseProgram(0);
|
||||
|
||||
#undef UNIFORM_1
|
||||
#undef UNIFORM_2
|
||||
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
@@ -962,7 +1127,9 @@ EXPORT boolean HWRAPI(LoadShaders) (void)
|
||||
EXPORT void HWRAPI(LoadCustomShader) (int number, char *shader, size_t size, boolean fragment)
|
||||
{
|
||||
#ifdef GL_SHADERS
|
||||
if (!pglUseProgram) return;
|
||||
if (!pglUseProgram)
|
||||
return;
|
||||
|
||||
if (number < 1 || number > MAXSHADERS)
|
||||
I_Error("LoadCustomShader(): cannot load shader %d (max %d)", number, MAXSHADERS);
|
||||
|
||||
@@ -984,8 +1151,14 @@ EXPORT void HWRAPI(LoadCustomShader) (int number, char *shader, size_t size, boo
|
||||
EXPORT void HWRAPI(InitCustomShaders) (void)
|
||||
{
|
||||
#ifdef GL_SHADERS
|
||||
|
||||
KillShaders();
|
||||
LoadShaders();
|
||||
|
||||
if (gl_use_palette_shader)
|
||||
{
|
||||
InitPalette(0, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1022,6 +1195,105 @@ EXPORT void HWRAPI(KillShaders) (void)
|
||||
// unused.........................
|
||||
}
|
||||
|
||||
GLuint palette_tex_num;
|
||||
// length of one side of lookup texture
|
||||
// smallest separation between all the colors in the srb2 palette is 6, so
|
||||
// possibly a 64x64x64 lookup texture might be enough for 100% correct colors
|
||||
// (min separation for 64^3 size is 4)
|
||||
#define LUT_SIZE 64
|
||||
#define STEP_SIZE (256/LUT_SIZE)
|
||||
// the +2 in the NearestColor call also needs to be adjusted if LUT_SIZE is changed!
|
||||
// the hardcoded values in the shader also need to be adjusted if LUT_SIZE is changed!
|
||||
|
||||
void InitPalette(int flashnum, boolean skiplut)
|
||||
{
|
||||
int i, r, g, b;
|
||||
|
||||
//Hudler: 16/10/99: added for OpenGL gamma correction
|
||||
RGBA_t gamma_correction = {0x7F7F7F7F};
|
||||
|
||||
//Hurdler 16/10/99: added for OpenGL gamma correction
|
||||
gamma_correction.s.red = (UINT8)cv_grgammared.value;
|
||||
gamma_correction.s.green = (UINT8)cv_grgammagreen.value;
|
||||
gamma_correction.s.blue = (UINT8)cv_grgammablue.value;
|
||||
|
||||
// init the palette
|
||||
int flashoffset = flashnum*256;
|
||||
for (i = 0+flashoffset; i < 256+flashoffset; i++)
|
||||
{
|
||||
int fi = i-flashoffset;
|
||||
|
||||
// gamma correction
|
||||
int pr, pg, pb;
|
||||
pr = (UINT8)MIN((pLocalPalette[i].s.red*gamma_correction.s.red)/127, 255);
|
||||
pg = (UINT8)MIN((pLocalPalette[i].s.green*gamma_correction.s.green)/127, 255);
|
||||
pb = (UINT8)MIN((pLocalPalette[i].s.blue*gamma_correction.s.blue)/127, 255);
|
||||
|
||||
// crush to 16-bit rgb565, like software currently does
|
||||
float fred = (float)(pr >> 3);
|
||||
float fgreen = (float)(pg >> 2);
|
||||
float fblue = (float)(pb >> 3);
|
||||
// restore to rgb888
|
||||
gl_palette[fi*3] = (GLint)(fred / 31.0f * 255.0f);
|
||||
gl_palette[fi*3+1] = (GLint)(fgreen / 63.0f * 255.0f);
|
||||
gl_palette[fi*3+2] = (GLint)(fblue / 31.0f * 255.0f);
|
||||
}
|
||||
|
||||
if (!skiplut)
|
||||
{
|
||||
// init the palette conversion lookup texture
|
||||
GLubyte *pal_lookup_tex = malloc(LUT_SIZE*LUT_SIZE*LUT_SIZE*sizeof(GLubyte));
|
||||
|
||||
if (!pal_lookup_tex)
|
||||
I_Error("Failed to allocate memory for generating palette lookup texture.");
|
||||
|
||||
for (b = 0; b < LUT_SIZE; b++)
|
||||
{
|
||||
for (g = 0; g < LUT_SIZE; g++)
|
||||
{
|
||||
for (r = 0; r < LUT_SIZE; r++)
|
||||
{
|
||||
pal_lookup_tex[b*LUT_SIZE*LUT_SIZE+g*LUT_SIZE+r] = NearestColor(r*STEP_SIZE+0, g*STEP_SIZE+0, b*STEP_SIZE+0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pglGenTextures(1, &palette_tex_num);
|
||||
pglBindTexture(GL_TEXTURE_3D, palette_tex_num);
|
||||
pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
if (!pglTexImage3D)
|
||||
I_Error("pglTexImage3D is NULL!");
|
||||
pglTexImage3D(GL_TEXTURE_3D, 0, GL_R8, LUT_SIZE, LUT_SIZE, LUT_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, pal_lookup_tex);
|
||||
free(pal_lookup_tex);
|
||||
}
|
||||
#undef STEP_SIZE
|
||||
|
||||
pglUseProgram(gl_shaderprograms[8].program);
|
||||
pglUniform1i(gl_shaderprograms[8].uniforms[gluniform_color_lookup], 1); // bind sampler to second texture unit
|
||||
pglUniform1iv(gl_shaderprograms[8].uniforms[gluniform_palette], 768, gl_palette);
|
||||
// bind the palette to the fancy shader here
|
||||
pglUseProgram(gl_shaderprograms[9].program);
|
||||
pglUniform1iv(gl_shaderprograms[9].uniforms[gluniform_palette], 768, gl_palette);
|
||||
// bind tex unit 2 to lighttable tex
|
||||
pglUniform1i(gl_shaderprograms[9].uniforms[gluniform_lighttable_tex], 2);
|
||||
pglUniform1i(gl_shaderprograms[9].uniforms[gluniform_color_lookup], 1);
|
||||
// bind the palette to the fancy shader here
|
||||
pglUseProgram(gl_shaderprograms[10].program);
|
||||
pglUniform1iv(gl_shaderprograms[10].uniforms[gluniform_palette], 768, gl_palette);
|
||||
// bind tex unit 2 to lighttable tex
|
||||
pglUniform1i(gl_shaderprograms[10].uniforms[gluniform_lighttable_tex], 2);
|
||||
pglUniform1i(gl_shaderprograms[10].uniforms[gluniform_color_lookup], 1);
|
||||
pglUseProgram(0);
|
||||
pglBindTexture(GL_TEXTURE_3D, 0);
|
||||
|
||||
// bind 3d lookup to unit 1, maybe it can stay there
|
||||
pglActiveTexture(GL_TEXTURE1);
|
||||
pglBindTexture(GL_TEXTURE_3D, palette_tex_num);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
gl_palette_initialized = true;
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// SetNoTexture : Disable texture
|
||||
// -----------------+
|
||||
@@ -1201,6 +1473,46 @@ EXPORT void HWRAPI(ClearMipMapCache) (void)
|
||||
Flush();
|
||||
}
|
||||
|
||||
EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable)
|
||||
{
|
||||
LightTableCacheEntry_t *cache_entry = malloc(sizeof(LightTableCacheEntry_t));
|
||||
if (!ltcachetail)
|
||||
{
|
||||
ltcachehead = ltcachetail = cache_entry;
|
||||
}
|
||||
else
|
||||
{
|
||||
ltcachetail->next = cache_entry;
|
||||
ltcachetail = cache_entry;
|
||||
}
|
||||
ltcachetail->next = NULL;
|
||||
pglGenTextures(1, <cachetail->id);
|
||||
if (!ltcachetail->id)
|
||||
I_Error("hwr lighttable cache entry id is zero");
|
||||
pglBindTexture(GL_TEXTURE_2D, ltcachetail->id);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 256, 32, 0, GL_RED, GL_UNSIGNED_BYTE, lighttable);
|
||||
|
||||
// restore previously bound texture
|
||||
if (!gl_batching)
|
||||
pglBindTexture(GL_TEXTURE_2D, tex_downloaded);
|
||||
|
||||
return ltcachetail->id;
|
||||
}
|
||||
|
||||
// Delete light table textures, ids given before become invalid and must not be used.
|
||||
EXPORT void HWRAPI(ClearLightTableCache) (void)
|
||||
{
|
||||
while (ltcachehead)
|
||||
{
|
||||
pglDeleteTextures(1, <cachehead->id);
|
||||
LightTableCacheEntry_t *next = ltcachehead->next;
|
||||
free(ltcachehead);
|
||||
ltcachehead = next;
|
||||
}
|
||||
ltcachetail = NULL;
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// ReadRect : Read a rectangle region of the truecolor framebuffer
|
||||
@@ -1312,6 +1624,9 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
pglClear(ClearMask);
|
||||
pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one
|
||||
pglEnableClientState(GL_TEXTURE_COORD_ARRAY); // And mostly this one, too
|
||||
|
||||
if (!gl_palette_initialized)
|
||||
InitPalette(0, false); // just gonna put this here for now
|
||||
}
|
||||
|
||||
|
||||
@@ -1822,6 +2137,8 @@ typedef struct
|
||||
FBITFIELD polyFlags;
|
||||
GLuint texNum;
|
||||
GLuint shader;
|
||||
// this tells batching that the plane belongs to a horizon line and must be drawn in correct order with the skywalls
|
||||
boolean horizonSpecial;
|
||||
} PolygonArrayEntry;
|
||||
|
||||
FOutVector* finalVertexArray = NULL;// contains subset of sorted vertices and texture coordinates to be sent to gpu
|
||||
@@ -1861,23 +2178,35 @@ EXPORT void HWRAPI(StartBatching) (void)
|
||||
|
||||
static int comparePolygons(const void *p1, const void *p2)
|
||||
{
|
||||
PolygonArrayEntry* poly1 = &polygonArray[*(const unsigned int*)p1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[*(const unsigned int*)p2];
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
int shader1 = poly1->shader;
|
||||
int shader2 = poly2->shader;
|
||||
// make skywalls first in order
|
||||
if (poly1->polyFlags & PF_NoTexture)
|
||||
// make skywalls and horizon lines first in order
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
shader1 = -1;
|
||||
if (poly2->polyFlags & PF_NoTexture)
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
shader2 = -1;
|
||||
diff = shader1 - shader2;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (shader1 == -1 && shader2 == -1)
|
||||
return index1 - index2;
|
||||
|
||||
diff = poly1->texNum - poly2->texNum;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
if (gl_use_palette_shader)
|
||||
{
|
||||
diff = poly1->surf.LightTableId - poly2->surf.LightTableId;
|
||||
if (diff != 0) return diff;
|
||||
}
|
||||
|
||||
diff = poly1->polyFlags - poly2->polyFlags;
|
||||
if (diff != 0) return diff;
|
||||
@@ -1899,20 +2228,26 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
|
||||
static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
{
|
||||
PolygonArrayEntry* poly1 = &polygonArray[*(const unsigned int*)p1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[*(const unsigned int*)p2];
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
GLuint texNum1 = poly1->texNum;
|
||||
GLuint texNum2 = poly2->texNum;
|
||||
if (poly1->polyFlags & PF_NoTexture)
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
texNum1 = 0;
|
||||
if (poly2->polyFlags & PF_NoTexture)
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
texNum2 = 0;
|
||||
diff = texNum1 - texNum2;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (texNum1 == 0 && texNum2 == 0)
|
||||
return index1 - index2;
|
||||
|
||||
diff = poly1->polyFlags - poly2->polyFlags;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
@@ -2010,7 +2345,15 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
firstFade.alpha = byte2float[currentSurfaceInfo.FadeColor.s.alpha];
|
||||
|
||||
if (gl_allowshaders)
|
||||
{
|
||||
load_shaders(¤tSurfaceInfo, &firstPoly, &firstTint, &firstFade);
|
||||
if (gl_use_palette_shader)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
|
||||
pglBindTexture(GL_TEXTURE_2D, currentSurfaceInfo.LightTableId);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = 0;
|
||||
@@ -2121,7 +2464,21 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
changeState = true;
|
||||
changePolyFlags = true;
|
||||
}
|
||||
if (gl_allowshaders)
|
||||
if ((gl_allowshaders) && (gl_use_palette_shader))
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba ||
|
||||
currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level ||
|
||||
currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start ||
|
||||
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end ||
|
||||
currentSurfaceInfo.LightTableId != nextSurfaceInfo.LightTableId)
|
||||
{
|
||||
changeState = true;
|
||||
changeSurfaceInfo = true;
|
||||
}
|
||||
}
|
||||
else if ((gl_allowshaders) && (!gl_use_palette_shader))
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
@@ -2251,7 +2608,15 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
fade.alpha = byte2float[nextSurfaceInfo.FadeColor.s.alpha];
|
||||
|
||||
load_shaders(&nextSurfaceInfo, &poly, &tint, &fade);
|
||||
|
||||
if (gl_use_palette_shader)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
|
||||
pglBindTexture(GL_TEXTURE_2D, nextSurfaceInfo.LightTableId);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
}
|
||||
|
||||
currentSurfaceInfo = nextSurfaceInfo;
|
||||
changeSurfaceInfo = false;
|
||||
|
||||
@@ -2269,7 +2634,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
// -----------------+
|
||||
// DrawPolygon : Render a polygon, set the texture, set render mode
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, boolean horizonSpecial)
|
||||
{
|
||||
if (gl_batching)
|
||||
{
|
||||
@@ -2309,6 +2674,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
polygonArray[polygonArraySize].polyFlags = PolyFlags;
|
||||
polygonArray[polygonArraySize].texNum = tex_downloaded;
|
||||
polygonArray[polygonArraySize].shader = gl_currentshaderprogram;
|
||||
polygonArray[polygonArraySize].horizonSpecial = horizonSpecial;
|
||||
polygonArraySize++;
|
||||
|
||||
memcpy(&unsortedVertexArray[unsortedVertexArraySize], pOutVerts, iNumPts * sizeof(FOutVector));
|
||||
@@ -2350,6 +2716,13 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
fade.green = byte2float[pSurf->FadeColor.s.green];
|
||||
fade.blue = byte2float[pSurf->FadeColor.s.blue];
|
||||
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
|
||||
|
||||
if (gl_use_palette_shader && gl_allowshaders)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
}
|
||||
|
||||
load_shaders(pSurf, &poly, &tint, &fade);
|
||||
@@ -2692,6 +3065,10 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case HWD_SET_PALETTE_SHADER_ENABLED:
|
||||
gl_use_palette_shader = Value;
|
||||
break;
|
||||
|
||||
case HWD_SET_TEXTUREFILTERMODE:
|
||||
switch (Value)
|
||||
@@ -3040,67 +3417,26 @@ EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
||||
|
||||
#define BUFFER_OFFSET(i) ((char*)(i))
|
||||
|
||||
static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface)
|
||||
static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, FSurfaceInfo *Surface)
|
||||
{
|
||||
static GLRGBAFloat poly = {0,0,0,0};
|
||||
static GLRGBAFloat tint = {0,0,0,0};
|
||||
static GLRGBAFloat fade = {0,0,0,0};
|
||||
|
||||
const float radians = (float)(M_PIl / 180.0f);
|
||||
float pol = 0.0f;
|
||||
float scalex, scaley, scalez;
|
||||
float sprxscale, spryscale;
|
||||
float scalediffx, scalediffy;
|
||||
int dfx, dfy;
|
||||
float rollradian;
|
||||
float scalecosx, scalesinx, scalecosy, scalesiny;
|
||||
|
||||
boolean useTinyFrames;
|
||||
|
||||
int i;
|
||||
|
||||
sprxscale = pos->spritexscale;
|
||||
spryscale = pos->spriteyscale;
|
||||
|
||||
rollradian = 0;
|
||||
|
||||
rollradian = (pos->rollangle)*radians;
|
||||
|
||||
// Affect input model scaling
|
||||
hscale *= 0.5f;
|
||||
vscale *= 0.5f;
|
||||
scalex = hscale;
|
||||
scaley = vscale;
|
||||
scalez = hscale;
|
||||
|
||||
// this is hilariously insane but it's late as fuck and I can't be inclined to care
|
||||
scalediffx = (sprxscale*scale) - scale;
|
||||
scalediffy = (spryscale*scale) - scale;
|
||||
|
||||
scale *= 0.5f;
|
||||
sprxscale *= 1.5f;
|
||||
spryscale *= 1.5f;
|
||||
|
||||
scalediffx *= 0.5f;
|
||||
scalediffy *= 0.5f;
|
||||
|
||||
|
||||
dfx = 1;
|
||||
dfy = 1;
|
||||
|
||||
if (scalediffx < 0)
|
||||
dfx = -1;
|
||||
if (scalediffy < 0)
|
||||
dfy = -1;
|
||||
|
||||
|
||||
scalecosx = (fabs(scalediffx*cos(rollradian))*dfx);
|
||||
scalesinx = (fabs(scalediffx*sin(rollradian))*dfx);
|
||||
|
||||
|
||||
scalecosy = (fabs(scalediffy*sin(rollradian))*dfy);
|
||||
scalesiny = (fabs(scalediffy*cos(rollradian))*dfy);
|
||||
|
||||
// "sprite accurate" model scaling, so that stretchy things don't look all that funky from any angle not the default
|
||||
scalex = scale+scalecosx+scalecosy;
|
||||
scaley = scale+scalesinx+scalesiny;
|
||||
scalez = scale+scalecosx+scalecosy;
|
||||
|
||||
if (duration > 0.0 && tics >= 0.0) // don't interpolate if instantaneous or infinite in length
|
||||
{
|
||||
float newtime = (duration - tics); // + 1;
|
||||
@@ -3293,9 +3629,9 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||
// -----------------+
|
||||
// HWRAPI DrawModel : Draw a model
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface)
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, FSurfaceInfo *Surface)
|
||||
{
|
||||
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, scale, flipped, Surface);
|
||||
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, Surface);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -3801,6 +4137,12 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
|
||||
clearColour.alpha = 1;
|
||||
ClearBuffer(true, false, false, &clearColour);
|
||||
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
|
||||
|
||||
if (gl_use_palette_shader && cv_grshaders.value)
|
||||
{
|
||||
pglUseProgram(gl_shaderprograms[8].program); // palette shader
|
||||
pglActiveTexture(GL_TEXTURE1);
|
||||
}
|
||||
|
||||
pglColor4ubv(white);
|
||||
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||
@@ -3809,6 +4151,12 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
tex_downloaded = finalScreenTexture;
|
||||
|
||||
if (gl_use_palette_shader && cv_grshaders.value)
|
||||
{
|
||||
pglUseProgram(0);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
@@ -133,4 +133,8 @@ typedef enum
|
||||
GLF_NOTEXENV = 0x02,
|
||||
} oglflags_t;
|
||||
|
||||
// in order for custom playpals n shit to work properly
|
||||
extern boolean gl_palette_initialized;
|
||||
void InitPalette(int flashnum, boolean skiplut);
|
||||
|
||||
#endif
|
||||
+133
-139
@@ -81,6 +81,8 @@ patch_t *pingnum[10];
|
||||
patch_t *pinggfx[5]; // small ping graphic
|
||||
patch_t *pingmeasure[2]; // ping measurement graphic
|
||||
|
||||
patch_t *ranknum[10]; // rank numbers
|
||||
|
||||
patch_t *framecounter;
|
||||
patch_t *frameslash; // framerate stuff. Used in screen.c
|
||||
|
||||
@@ -281,6 +283,8 @@ void HU_LoadGraphics(void)
|
||||
nightsnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
|
||||
sprintf(buffer, "PINGN%d", i);
|
||||
pingnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
|
||||
sprintf(buffer, "OPPRNK0%d", i);
|
||||
ranknum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
|
||||
// minus for negative tallnums
|
||||
@@ -682,6 +686,134 @@ static void Command_CSay_f(void)
|
||||
}
|
||||
static tic_t stop_spamming[MAXPLAYERS];
|
||||
|
||||
const char *HU_SkinColorToConsoleColor(skincolors_t color)
|
||||
{
|
||||
// Move this ugly switch into a function you can collapse.
|
||||
switch (color)
|
||||
{
|
||||
case SKINCOLOR_WHITE:
|
||||
case SKINCOLOR_SILVER:
|
||||
case SKINCOLOR_SLATE:
|
||||
return "\x80"; // White
|
||||
case SKINCOLOR_GREY:
|
||||
case SKINCOLOR_NICKEL:
|
||||
case SKINCOLOR_BLACK:
|
||||
case SKINCOLOR_SKUNK:
|
||||
case SKINCOLOR_JET:
|
||||
return "\x86"; // V_GRAYMAP
|
||||
case SKINCOLOR_SEPIA:
|
||||
case SKINCOLOR_BEIGE:
|
||||
case SKINCOLOR_WALNUT:
|
||||
case SKINCOLOR_BROWN:
|
||||
case SKINCOLOR_LEATHER:
|
||||
case SKINCOLOR_RUST:
|
||||
case SKINCOLOR_WRISTWATCH:
|
||||
return "\x8e"; // V_BROWNMAP
|
||||
case SKINCOLOR_FAIRY:
|
||||
case SKINCOLOR_SALMON:
|
||||
case SKINCOLOR_PINK:
|
||||
case SKINCOLOR_ROSE:
|
||||
case SKINCOLOR_BRICK:
|
||||
case SKINCOLOR_LEMONADE:
|
||||
case SKINCOLOR_BUBBLEGUM:
|
||||
case SKINCOLOR_LILAC:
|
||||
return "\x8d"; // V_PINKMAP
|
||||
case SKINCOLOR_CINNAMON:
|
||||
case SKINCOLOR_RUBY:
|
||||
case SKINCOLOR_RASPBERRY:
|
||||
case SKINCOLOR_CHERRY:
|
||||
case SKINCOLOR_RED:
|
||||
case SKINCOLOR_CRIMSON:
|
||||
case SKINCOLOR_MAROON:
|
||||
case SKINCOLOR_FLAME:
|
||||
case SKINCOLOR_SCARLET:
|
||||
case SKINCOLOR_KETCHUP:
|
||||
return "\x85"; // V_REDMAP
|
||||
case SKINCOLOR_DAWN:
|
||||
case SKINCOLOR_SUNSET:
|
||||
case SKINCOLOR_CREAMSICLE:
|
||||
case SKINCOLOR_ORANGE:
|
||||
case SKINCOLOR_PUMPKIN:
|
||||
case SKINCOLOR_ROSEWOOD:
|
||||
case SKINCOLOR_BURGUNDY:
|
||||
case SKINCOLOR_TANGERINE:
|
||||
return "\x87"; // V_ORANGEMAP
|
||||
case SKINCOLOR_PEACH:
|
||||
case SKINCOLOR_CARAMEL:
|
||||
case SKINCOLOR_CREAM:
|
||||
return "\x8f"; // V_PEACHMAP
|
||||
case SKINCOLOR_GOLD:
|
||||
case SKINCOLOR_ROYAL:
|
||||
case SKINCOLOR_BRONZE:
|
||||
case SKINCOLOR_COPPER:
|
||||
case SKINCOLOR_THUNDER:
|
||||
return "\x8A"; // V_GOLDMAP
|
||||
case SKINCOLOR_POPCORN:
|
||||
case SKINCOLOR_QUARRY:
|
||||
case SKINCOLOR_YELLOW:
|
||||
case SKINCOLOR_MUSTARD:
|
||||
case SKINCOLOR_CROCODILE:
|
||||
case SKINCOLOR_OLIVE:
|
||||
return "\x82"; // V_YELLOWMAP
|
||||
case SKINCOLOR_ARTICHOKE:
|
||||
case SKINCOLOR_VOMIT:
|
||||
case SKINCOLOR_GARDEN:
|
||||
case SKINCOLOR_TEA:
|
||||
case SKINCOLOR_PISTACHIO:
|
||||
return "\x8b"; // V_TEAMAP
|
||||
case SKINCOLOR_LIME:
|
||||
case SKINCOLOR_HANDHELD:
|
||||
case SKINCOLOR_MOSS:
|
||||
case SKINCOLOR_CAMOUFLAGE:
|
||||
case SKINCOLOR_ROBOHOOD:
|
||||
case SKINCOLOR_MINT:
|
||||
case SKINCOLOR_GREEN:
|
||||
case SKINCOLOR_PINETREE:
|
||||
case SKINCOLOR_EMERALD:
|
||||
case SKINCOLOR_SWAMP:
|
||||
case SKINCOLOR_DREAM:
|
||||
case SKINCOLOR_PLAGUE:
|
||||
case SKINCOLOR_ALGAE:
|
||||
return "\x83"; // V_GREENMAP
|
||||
case SKINCOLOR_CARIBBEAN:
|
||||
case SKINCOLOR_AZURE:
|
||||
case SKINCOLOR_AQUA:
|
||||
case SKINCOLOR_TEAL:
|
||||
case SKINCOLOR_CYAN:
|
||||
case SKINCOLOR_JAWZ:
|
||||
case SKINCOLOR_CERULEAN:
|
||||
case SKINCOLOR_NAVY:
|
||||
case SKINCOLOR_SAPPHIRE:
|
||||
return "\x88"; // V_SKYMAP
|
||||
case SKINCOLOR_PIGEON:
|
||||
case SKINCOLOR_PLATINUM:
|
||||
case SKINCOLOR_STEEL:
|
||||
return "\x8c"; // V_STEELMAP
|
||||
case SKINCOLOR_PERIWINKLE:
|
||||
case SKINCOLOR_BLUE:
|
||||
case SKINCOLOR_BLUEBERRY:
|
||||
case SKINCOLOR_NOVA:
|
||||
return "\x84"; // V_BLUEMAP
|
||||
case SKINCOLOR_ULTRAVIOLET:
|
||||
case SKINCOLOR_PURPLE:
|
||||
case SKINCOLOR_FUCHSIA:
|
||||
return "\x81"; // V_PURPLEMAP
|
||||
case SKINCOLOR_PASTEL:
|
||||
case SKINCOLOR_MOONSLAM:
|
||||
case SKINCOLOR_DUSK:
|
||||
case SKINCOLOR_TOXIC:
|
||||
case SKINCOLOR_MAUVE:
|
||||
case SKINCOLOR_LAVENDER:
|
||||
case SKINCOLOR_BYZANTIUM:
|
||||
case SKINCOLOR_POMEGRANATE:
|
||||
return "\x89"; // V_LAVENDERMAP
|
||||
|
||||
default:
|
||||
return "\x83";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Receives a message, processing an ::XD_SAY command.
|
||||
* \sa DoSayCommand
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
@@ -828,145 +960,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
const UINT8 color = players[playernum].skincolor;
|
||||
|
||||
cstart = "\x83";
|
||||
|
||||
switch (color)
|
||||
{
|
||||
case SKINCOLOR_WHITE:
|
||||
case SKINCOLOR_SILVER:
|
||||
case SKINCOLOR_SLATE:
|
||||
cstart = "\x80"; // White
|
||||
break;
|
||||
case SKINCOLOR_GREY:
|
||||
case SKINCOLOR_NICKEL:
|
||||
case SKINCOLOR_BLACK:
|
||||
case SKINCOLOR_SKUNK:
|
||||
case SKINCOLOR_JET:
|
||||
cstart = "\x86"; // V_GRAYMAP
|
||||
break;
|
||||
case SKINCOLOR_SEPIA:
|
||||
case SKINCOLOR_BEIGE:
|
||||
case SKINCOLOR_WALNUT:
|
||||
case SKINCOLOR_BROWN:
|
||||
case SKINCOLOR_LEATHER:
|
||||
case SKINCOLOR_RUST:
|
||||
case SKINCOLOR_WRISTWATCH:
|
||||
cstart = "\x8e"; // V_BROWNMAP
|
||||
break;
|
||||
case SKINCOLOR_FAIRY:
|
||||
case SKINCOLOR_SALMON:
|
||||
case SKINCOLOR_PINK:
|
||||
case SKINCOLOR_ROSE:
|
||||
case SKINCOLOR_BRICK:
|
||||
case SKINCOLOR_LEMONADE:
|
||||
case SKINCOLOR_BUBBLEGUM:
|
||||
case SKINCOLOR_LILAC:
|
||||
cstart = "\x8d"; // V_PINKMAP
|
||||
break;
|
||||
case SKINCOLOR_CINNAMON:
|
||||
case SKINCOLOR_RUBY:
|
||||
case SKINCOLOR_RASPBERRY:
|
||||
case SKINCOLOR_CHERRY:
|
||||
case SKINCOLOR_RED:
|
||||
case SKINCOLOR_CRIMSON:
|
||||
case SKINCOLOR_MAROON:
|
||||
case SKINCOLOR_FLAME:
|
||||
case SKINCOLOR_SCARLET:
|
||||
case SKINCOLOR_KETCHUP:
|
||||
cstart = "\x85"; // V_REDMAP
|
||||
break;
|
||||
case SKINCOLOR_DAWN:
|
||||
case SKINCOLOR_SUNSET:
|
||||
case SKINCOLOR_CREAMSICLE:
|
||||
case SKINCOLOR_ORANGE:
|
||||
case SKINCOLOR_PUMPKIN:
|
||||
case SKINCOLOR_ROSEWOOD:
|
||||
case SKINCOLOR_BURGUNDY:
|
||||
case SKINCOLOR_TANGERINE:
|
||||
cstart = "\x87"; // V_ORANGEMAP
|
||||
break;
|
||||
case SKINCOLOR_PEACH:
|
||||
case SKINCOLOR_CARAMEL:
|
||||
case SKINCOLOR_CREAM:
|
||||
cstart = "\x8f"; // V_PEACHMAP
|
||||
break;
|
||||
case SKINCOLOR_GOLD:
|
||||
case SKINCOLOR_ROYAL:
|
||||
case SKINCOLOR_BRONZE:
|
||||
case SKINCOLOR_COPPER:
|
||||
case SKINCOLOR_THUNDER:
|
||||
cstart = "\x8A"; // V_GOLDMAP
|
||||
break;
|
||||
case SKINCOLOR_POPCORN:
|
||||
case SKINCOLOR_QUARRY:
|
||||
case SKINCOLOR_YELLOW:
|
||||
case SKINCOLOR_MUSTARD:
|
||||
case SKINCOLOR_CROCODILE:
|
||||
case SKINCOLOR_OLIVE:
|
||||
cstart = "\x82"; // V_YELLOWMAP
|
||||
break;
|
||||
case SKINCOLOR_ARTICHOKE:
|
||||
case SKINCOLOR_VOMIT:
|
||||
case SKINCOLOR_GARDEN:
|
||||
case SKINCOLOR_TEA:
|
||||
case SKINCOLOR_PISTACHIO:
|
||||
cstart = "\x8b"; // V_TEAMAP
|
||||
break;
|
||||
case SKINCOLOR_LIME:
|
||||
case SKINCOLOR_HANDHELD:
|
||||
case SKINCOLOR_MOSS:
|
||||
case SKINCOLOR_CAMOUFLAGE:
|
||||
case SKINCOLOR_ROBOHOOD:
|
||||
case SKINCOLOR_MINT:
|
||||
case SKINCOLOR_GREEN:
|
||||
case SKINCOLOR_PINETREE:
|
||||
case SKINCOLOR_EMERALD:
|
||||
case SKINCOLOR_SWAMP:
|
||||
case SKINCOLOR_DREAM:
|
||||
case SKINCOLOR_PLAGUE:
|
||||
case SKINCOLOR_ALGAE:
|
||||
cstart = "\x83"; // V_GREENMAP
|
||||
break;
|
||||
case SKINCOLOR_CARIBBEAN:
|
||||
case SKINCOLOR_AZURE:
|
||||
case SKINCOLOR_AQUA:
|
||||
case SKINCOLOR_TEAL:
|
||||
case SKINCOLOR_CYAN:
|
||||
case SKINCOLOR_JAWZ:
|
||||
case SKINCOLOR_CERULEAN:
|
||||
case SKINCOLOR_NAVY:
|
||||
case SKINCOLOR_SAPPHIRE:
|
||||
cstart = "\x88"; // V_SKYMAP
|
||||
break;
|
||||
case SKINCOLOR_PIGEON:
|
||||
case SKINCOLOR_PLATINUM:
|
||||
case SKINCOLOR_STEEL:
|
||||
cstart = "\x8c"; // V_STEELMAP
|
||||
break;
|
||||
case SKINCOLOR_PERIWINKLE:
|
||||
case SKINCOLOR_BLUE:
|
||||
case SKINCOLOR_BLUEBERRY:
|
||||
case SKINCOLOR_NOVA:
|
||||
cstart = "\x84"; // V_BLUEMAP
|
||||
break;
|
||||
case SKINCOLOR_ULTRAVIOLET:
|
||||
case SKINCOLOR_PURPLE:
|
||||
case SKINCOLOR_FUCHSIA:
|
||||
cstart = "\x81"; // V_PURPLEMAP
|
||||
break;
|
||||
case SKINCOLOR_PASTEL:
|
||||
case SKINCOLOR_MOONSLAM:
|
||||
case SKINCOLOR_DUSK:
|
||||
case SKINCOLOR_TOXIC:
|
||||
case SKINCOLOR_MAUVE:
|
||||
case SKINCOLOR_LAVENDER:
|
||||
case SKINCOLOR_BYZANTIUM:
|
||||
case SKINCOLOR_POMEGRANATE:
|
||||
cstart = "\x89"; // V_LAVENDERMAP
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cstart = HU_SkinColorToConsoleColor(color);
|
||||
}
|
||||
|
||||
prefix = cstart;
|
||||
|
||||
@@ -83,6 +83,7 @@ extern patch_t *hu_font[HU_FONTSIZE], *kart_font[KART_FONTSIZE], *tny_font[HU_FO
|
||||
extern patch_t *tallnum[10];
|
||||
extern patch_t *pingnum[10];
|
||||
extern patch_t *pinggfx[5];
|
||||
extern patch_t *ranknum[10];
|
||||
extern patch_t *nightsnum[10];
|
||||
extern patch_t *framecounter;
|
||||
extern patch_t *frameslash;
|
||||
@@ -121,6 +122,7 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); // Lat': Ping draw
|
||||
//void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
|
||||
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol);
|
||||
void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds);
|
||||
const char *HU_SkinColorToConsoleColor(skincolors_t color);
|
||||
|
||||
INT32 HU_CreateTeamScoresTbl(playersort_t *tab, UINT32 dmtotals[]);
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ extern UINT8 keyboard_started;
|
||||
|
||||
\return free memory in the system
|
||||
*/
|
||||
UINT32 I_GetFreeMem(UINT32 *total);
|
||||
size_t I_GetFreeMem(size_t *total);
|
||||
|
||||
/** \brief Returns precise time value for performance measurement. The precise
|
||||
time should be a monotonically increasing counter, and will wrap.
|
||||
|
||||
+216
-48
@@ -22,6 +22,7 @@
|
||||
#include "f_finale.h"
|
||||
#include "lua_hud.h" // For Lua hud checks
|
||||
#include "lua_hook.h" // For MobjDamage and ShouldDamage
|
||||
#include "d_main.h" // found_extra_kart
|
||||
|
||||
// Hud offset cvars
|
||||
consvar_t cv_item_xoffset = {"hud_item_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -53,6 +54,13 @@ consvar_t cv_mini_yoffset = {"hud_minimap_yoffset", "0", CV_SAVE, NULL, NULL, 0,
|
||||
consvar_t cv_want_xoffset = {"hud_wanted_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_want_yoffset = {"hud_wanted_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_newspeedometer = {"newspeedometer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
|
||||
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
|
||||
// franticitems is Frantic Mode items, bool
|
||||
@@ -496,7 +504,7 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
||||
|
||||
\return void
|
||||
*/
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color)
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 starttranscolor;
|
||||
@@ -532,7 +540,7 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color)
|
||||
return;
|
||||
}
|
||||
|
||||
starttranscolor = (skinnum != TC_DEFAULT) ? skins[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
|
||||
starttranscolor = (skinnum != TC_DEFAULT) ? ( (local) ? localskins : skins )[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
|
||||
|
||||
// Fill in the entries of the palette that are fixed
|
||||
for (i = 0; i < starttranscolor; i++)
|
||||
@@ -3000,6 +3008,15 @@ static void K_StretchPlayerGravity(player_t *p)
|
||||
I_Assert(p != NULL);
|
||||
I_Assert(p->mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(p->mo));
|
||||
|
||||
if (p->mo->slamsoundtimer)
|
||||
p->mo->slamsoundtimer--;
|
||||
|
||||
if (cv_slamsound.value == 1 && (p->mo->eflags & MFE_JUSTHITFLOOR) && p->mo->stretchslam > 4*mos && !p->mo->slamsoundtimer)
|
||||
{
|
||||
S_StartSound(p->mo, sfx_s3k4c);
|
||||
p->mo->slamsoundtimer = TICRATE;
|
||||
}
|
||||
|
||||
if (!P_IsObjectOnGround(p->mo))
|
||||
{
|
||||
@@ -3037,6 +3054,67 @@ static void K_StretchPlayerGravity(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 :/
|
||||
|
||||
// ready?
|
||||
if (!p->kartstuff[k_jmp]) {
|
||||
p->mo->salty_ready = true;
|
||||
p->mo->salty_tapping = false;
|
||||
} else if (p->mo->salty_ready) {
|
||||
p->mo->salty_ready = false;
|
||||
p->mo->salty_tapping = true;
|
||||
} else {
|
||||
p->mo->salty_tapping = false;
|
||||
}
|
||||
|
||||
// GO!
|
||||
if (!p->mo->init_salty) {
|
||||
p->mo->salty_jump = false;
|
||||
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;
|
||||
} else if (P_IsObjectOnGround(p->mo)) {
|
||||
p->mo->salty_zoffset += p->mo->salty_momz;
|
||||
p->mo->salty_momz -= (mos*3/2);
|
||||
} else {
|
||||
p->mo->salty_zoffset *= (49/50)*mos;
|
||||
p->mo->salty_momz = 0;
|
||||
}
|
||||
if (p->mo->salty_zoffset <= 0) {
|
||||
if (!(p->mo->eflags & MFE_JUSTHITFLOOR) && P_IsObjectOnGround(p->mo) && cv_saltyhopsfx.value)
|
||||
S_StartSound(p->mo, sfx_s268);
|
||||
p->mo->salty_jump = false;
|
||||
p->mo->salty_zoffset = 0;
|
||||
p->mo->salty_momz = 0;
|
||||
// shlamma damma
|
||||
p->mo->stretchslam += cv_saltysquish.value ? (8*mos) : 0;
|
||||
} else if (p->mo->salty_zoffset >= 0 && cv_saltysquish.value) {
|
||||
// goofy ahh hack
|
||||
p->mo->spriteyscale += (mos/8);
|
||||
p->mo->spritexscale -= (mos/8);
|
||||
}
|
||||
p->mo->spriteyoffset = p->mo->salty_zoffset;
|
||||
if (S_SoundPlaying(p->mo, sfx_screec))
|
||||
S_StopSoundByID(p->mo, sfx_screec);
|
||||
if (S_SoundPlaying(p->mo, sfx_drift))
|
||||
S_StopSoundByID(p->mo, sfx_drift);
|
||||
}
|
||||
else if (p->mo->salty_tapping && P_IsObjectOnGround(p->mo) && !p->kartstuff[k_spinouttimer] && !p->kartstuff[k_squishedtimer]) {
|
||||
p->mo->salty_jump = true;
|
||||
p->mo->salty_zoffset = 0;
|
||||
p->mo->salty_momz = 6*mos;
|
||||
if (cv_saltyhopsfx.value)
|
||||
S_StartSound(p->mo, sfx_s25a);
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 K_FindPlayerNum(player_t *plyr)
|
||||
{
|
||||
INT32 i;
|
||||
@@ -3054,6 +3132,7 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes
|
||||
angle_t zangle = 0;
|
||||
angle_t xydirection = 0;
|
||||
angle_t an;
|
||||
angle_t final_slope;
|
||||
INT32 pNum = K_FindPlayerNum(p);
|
||||
|
||||
I_Assert(p != NULL);
|
||||
@@ -3093,7 +3172,14 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes
|
||||
zangle = InvAngle(zangle);
|
||||
|
||||
an = (lookAngle - xydirection);
|
||||
return FixedMul(zangle, FINESINE(an>>ANGLETOFINESHIFT));
|
||||
final_slope = -(FixedMul(FINESINE(an>>ANGLETOFINESHIFT), zangle));
|
||||
an = (INT32)(final_slope - p->tilt_sprite) / 3; // instead of just a direct snap
|
||||
|
||||
if (an)
|
||||
p->tilt_sprite += an;
|
||||
else
|
||||
p->tilt_sprite = final_slope;
|
||||
return -p->tilt_sprite;
|
||||
}
|
||||
|
||||
static void K_RollPlayerBySlopes(player_t *p, boolean usedistance)
|
||||
@@ -6392,6 +6478,16 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
|
||||
player->kartstuff[k_boostcharge] = 0;
|
||||
}
|
||||
|
||||
// salty hop! i wanna die
|
||||
if (cv_saltyhop.value)
|
||||
K_QuiteSaltyHop(player);
|
||||
else {
|
||||
player->mo->spriteyoffset = 0;
|
||||
player->mo->salty_jump = false;
|
||||
player->mo->salty_zoffset = 0;
|
||||
player->mo->salty_momz = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void K_CalculateBattleWanted(void)
|
||||
@@ -6559,7 +6655,7 @@ void K_CheckBumpers(void)
|
||||
if (winnernum > -1 && playeringame[winnernum])
|
||||
{
|
||||
players[winnernum].marescore += winnerscoreadd;
|
||||
CONS_Printf(M_GetText("%s recieved %d point%s for winning!\n"), player_names[winnernum], winnerscoreadd, (winnerscoreadd == 1 ? "" : "s"));
|
||||
CONS_Printf(M_GetText("%s received %d point%s for winning!\n"), player_names[winnernum], winnerscoreadd, (winnerscoreadd == 1 ? "" : "s"));
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++) // This can't go in the earlier loop because winning adds points
|
||||
@@ -6817,6 +6913,9 @@ static patch_t *kp_lapanim_hand[3];
|
||||
|
||||
static patch_t *kp_yougotem;
|
||||
|
||||
static patch_t *skp_smallsticker;
|
||||
static patch_t *skp_speedpatches[5];
|
||||
|
||||
void K_LoadKartHUDGraphics(void)
|
||||
{
|
||||
INT32 i, j;
|
||||
@@ -7063,6 +7162,16 @@ void K_LoadKartHUDGraphics(void)
|
||||
}
|
||||
|
||||
kp_yougotem = (patch_t *) W_CachePatchName("YOUGOTEM", PU_HUDGFX);
|
||||
|
||||
if (found_extra_kart) // snowy speedometer
|
||||
{
|
||||
skp_smallsticker = W_CachePatchName("SP_SMSTC", PU_HUDGFX);
|
||||
skp_speedpatches[0] = W_CachePatchName("K_TRNULL", PU_HUDGFX); // lolxd
|
||||
skp_speedpatches[1] = W_CachePatchName("SP_MKMH", PU_HUDGFX);
|
||||
skp_speedpatches[2] = W_CachePatchName("SP_MMPH", PU_HUDGFX);
|
||||
skp_speedpatches[3] = W_CachePatchName("SP_MFRAC", PU_HUDGFX);
|
||||
skp_speedpatches[4] = W_CachePatchName("SP_MPERC", PU_HUDGFX);
|
||||
}
|
||||
}
|
||||
|
||||
// For the item toggle menu
|
||||
@@ -7775,6 +7884,7 @@ static void K_DrawKartPositionNum(INT32 num)
|
||||
patch_t *localpatch = kp_positionnum[0][0];
|
||||
//INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT);
|
||||
INT32 fx = 0, fy = 0, fflags = 0;
|
||||
INT32 xoffs = (cv_showinput.value) ? -48 : 0;
|
||||
boolean flipdraw = false; // flip the order we draw it in for MORE splitscreen bs. fun.
|
||||
boolean flipvdraw = false; // used only for 2p splitscreen so overtaking doesn't make 1P's position fly off the screen.
|
||||
boolean overtake = false;
|
||||
@@ -7786,13 +7896,15 @@ static void K_DrawKartPositionNum(INT32 num)
|
||||
}
|
||||
if (splitscreen)
|
||||
scale /= 2;
|
||||
if (cv_showinput.value && !splitscreen) // anuther one.
|
||||
scale /= 2;
|
||||
|
||||
W = FixedMul(W<<FRACBITS, scale)>>FRACBITS;
|
||||
|
||||
// pain and suffering defined below
|
||||
if (!splitscreen)
|
||||
{
|
||||
fx = POSI_X;
|
||||
fx = POSI_X + xoffs;
|
||||
fy = BASEVIDHEIGHT - 8;
|
||||
fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
||||
}
|
||||
@@ -7986,7 +8098,11 @@ static boolean K_drawKartPositionFaces(void)
|
||||
else
|
||||
colormap = R_GetTranslationColormap(players[rankplayer[i]].skin, players[rankplayer[i]].mo->color, GTC_CACHE);
|
||||
|
||||
V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, facerankprefix[players[rankplayer[i]].skin], colormap);
|
||||
{
|
||||
player_t *p;
|
||||
p = &players[rankplayer[i]];
|
||||
V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_battlebumpers))
|
||||
@@ -8072,7 +8188,11 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
||||
else
|
||||
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo->color, GTC_CACHE);
|
||||
|
||||
V_DrawMappedPatch(x, y-4, 0, facerankprefix[players[tab[i].num].skin], colormap);
|
||||
{
|
||||
player_t *p;
|
||||
p = &players[tab[i].num];
|
||||
V_DrawMappedPatch(x, y-4, 0, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap);
|
||||
}
|
||||
/*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this
|
||||
{
|
||||
INT32 bumperx = x+19;
|
||||
@@ -8202,35 +8322,62 @@ static void K_drawKartLaps(void)
|
||||
|
||||
static void K_drawKartSpeedometer(void)
|
||||
{
|
||||
fixed_t convSpeed;
|
||||
// why?
|
||||
if (cv_kartspeedometer.value == 0)
|
||||
return;
|
||||
|
||||
fixed_t convSpeed = 0;
|
||||
INT32 speedtype = 0;
|
||||
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||
|
||||
if (cv_kartspeedometer.value == 1) // Kilometers
|
||||
switch (cv_kartspeedometer.value)
|
||||
{
|
||||
convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale)/FRACUNIT; // 2.172409058
|
||||
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d km/h", convSpeed));
|
||||
case 1:
|
||||
convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale)/FRACUNIT; // 2.172409058
|
||||
speedtype = 1;
|
||||
break;
|
||||
case 2:
|
||||
convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapobjectscale)/FRACUNIT; // 1.349868774
|
||||
speedtype = 2;
|
||||
break;
|
||||
case 3:
|
||||
convSpeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT;
|
||||
speedtype = 3;
|
||||
break;
|
||||
case 4:
|
||||
if (stplyr->mo)
|
||||
convSpeed = (FixedDiv(stplyr->speed, FixedMul(K_GetKartSpeed(stplyr, false), ORIG_FRICTION))*100)>>FRACBITS;
|
||||
speedtype = 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else if (cv_kartspeedometer.value == 2) // Miles
|
||||
|
||||
// man.
|
||||
if ((!cv_newspeedometer.value) || (cv_newspeedometer.value && !found_extra_kart))
|
||||
{
|
||||
convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapobjectscale)/FRACUNIT; // 1.349868774
|
||||
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d mph", convSpeed));
|
||||
}
|
||||
else if (cv_kartspeedometer.value == 3) // Fracunits
|
||||
{
|
||||
convSpeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT;
|
||||
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d fu/t", convSpeed));
|
||||
}
|
||||
else if (cv_kartspeedometer.value == 4) // Percent
|
||||
{
|
||||
// so code breaks if someone attempts to join from spectator since it sets
|
||||
// their mo to NULL
|
||||
// so can we just check if their mo is NULL????
|
||||
if (stplyr->mo)
|
||||
{
|
||||
convSpeed = (FixedDiv(stplyr->speed, FixedMul(K_GetKartSpeed(stplyr, false), ORIG_FRICTION))*100)>>FRACBITS;
|
||||
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d P", convSpeed));
|
||||
switch (speedtype) {
|
||||
case 1:
|
||||
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d km/h", convSpeed));
|
||||
break;
|
||||
case 2:
|
||||
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d mph", convSpeed));
|
||||
break;
|
||||
case 3:
|
||||
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d fu/t", convSpeed));
|
||||
break;
|
||||
case 4: // if extra.kart is found, use its included % symbol
|
||||
if (!found_extra_kart)
|
||||
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d P", convSpeed));
|
||||
else
|
||||
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d %%", convSpeed));
|
||||
}
|
||||
}
|
||||
else if (cv_newspeedometer.value && found_extra_kart) { // why bother if we dont?
|
||||
V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_smallsticker);
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
static void K_drawKartBumpersOrKarma(void)
|
||||
@@ -8392,7 +8539,7 @@ static void K_drawKartWanted(void)
|
||||
if (players[battlewanted[i]].skincolor)
|
||||
{
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE);
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? ( (p->skinlocal) ? localfacewantprefix : facewantprefix )[( (p->localskin) ? p->localskin-1 : p->skin )] : ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )]), colormap);
|
||||
/*if (basey2) // again with 4p stuff
|
||||
V_DrawFixedPatch(x<<FRACBITS, (y - (basey-basey2))<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SNAPTOTOP, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);*/
|
||||
}
|
||||
@@ -8459,6 +8606,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
|
||||
// it, they wouldn't 'spawn' on the top-right side of the HUD.
|
||||
|
||||
UINT8 skin = 0;
|
||||
boolean skinlocal = mo->skinlocal;
|
||||
|
||||
fixed_t amnumxpos, amnumypos;
|
||||
INT32 amxpos, amypos;
|
||||
@@ -8471,7 +8619,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
|
||||
fixed_t xscale, yscale, zoom;
|
||||
|
||||
if (mo->skin)
|
||||
skin = ((skin_t*)mo->skin)-skins;
|
||||
skin = ((skin_t*)( (mo->localskin) ? mo->localskin : mo->skin ))-( (skinlocal) ? localskins : skins );
|
||||
|
||||
maxx = maxy = INT32_MAX;
|
||||
minx = miny = INT32_MIN;
|
||||
@@ -8515,30 +8663,38 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
|
||||
if (encoremode)
|
||||
amnumxpos = -amnumxpos;
|
||||
|
||||
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (facemmapprefix[skin]->width/2))<<FRACBITS);
|
||||
amypos = amnumypos + ((y + AutomapPic->height/2 - (facemmapprefix[skin]->height/2))<<FRACBITS);
|
||||
|
||||
// do we want this? it feels unnecessary. easier to just modify the amnumxpos?
|
||||
/*if (encoremode)
|
||||
{
|
||||
flags |= V_FLIP;
|
||||
amxpos = -amnumxpos + ((x + AutomapPic->width/2 + (facemmapprefix[skin]->width/2))<<FRACBITS);
|
||||
}*/
|
||||
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->width/2))<<FRACBITS);
|
||||
amypos = amnumypos + ((y + AutomapPic->height/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->height/2))<<FRACBITS);
|
||||
|
||||
if (!mo->color) // 'default' color
|
||||
V_DrawSciencePatch(amxpos, amypos, flags, facemmapprefix[skin], FRACUNIT);
|
||||
V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT);
|
||||
else
|
||||
{
|
||||
UINT8 *colormap;
|
||||
if (mo->colorized)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE);
|
||||
else
|
||||
colormap = R_GetTranslationColormap(skin, mo->color, GTC_CACHE);
|
||||
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, facemmapprefix[skin], colormap);
|
||||
UINT8 *colormap = R_GetTranslationColormap((mo->colorized) ? TC_RAINBOW : skin, mo->color, GTC_CACHE);
|
||||
|
||||
if (cv_minihead.value == 1)
|
||||
{
|
||||
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
|
||||
V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap);
|
||||
}
|
||||
else if (cv_minihead.value == 0)
|
||||
{
|
||||
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
|
||||
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))))
|
||||
{
|
||||
if (cv_minihead.value == 1)
|
||||
V_DrawFixedPatch(amxpos, amypos, FRACUNIT / 2, flags, kp_wantedreticle, NULL);
|
||||
else if (cv_minihead.value == 0)
|
||||
V_DrawFixedPatch(amxpos - (4<<FRACBITS), amypos - (4<<FRACBITS), FRACUNIT, flags, kp_wantedreticle, NULL);
|
||||
}
|
||||
}
|
||||
@@ -9004,9 +9160,12 @@ static void K_drawKartFirstPerson(void)
|
||||
// doesn't need to ever support 4p
|
||||
static void K_drawInput(void)
|
||||
{
|
||||
if (!cv_showinput.value && !modeattacking) // dont bother
|
||||
return;
|
||||
|
||||
static INT32 pn = 0;
|
||||
INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT);
|
||||
INT32 x = BASEVIDWIDTH - 32, y = BASEVIDHEIGHT-24, offs, col;
|
||||
INT32 x = BASEVIDWIDTH - 32 + cv_posi_xoffset.value, y = BASEVIDHEIGHT-24 + cv_posi_yoffset.value, offs, col;
|
||||
const INT32 accent1 = splitflags|colortranslations[stplyr->skincolor][5];
|
||||
const INT32 accent2 = splitflags|colortranslations[stplyr->skincolor][9];
|
||||
ticcmd_t *cmd = &stplyr->cmd;
|
||||
@@ -9112,6 +9271,9 @@ static void K_drawChallengerScreen(void)
|
||||
|
||||
static void K_drawLapStartAnim(void)
|
||||
{
|
||||
if (! cv_showlapemblem.value)
|
||||
return;
|
||||
|
||||
// This is an EVEN MORE insanely complicated animation.
|
||||
const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation];
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE);
|
||||
@@ -9388,6 +9550,12 @@ void K_drawKartHUD(void)
|
||||
|
||||
if (!stplyr->spectator && !demo.freecam) // Bottom of the screen elements, don't need in spectate mode
|
||||
{
|
||||
if (!(splitscreen || demo.title))
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_position))
|
||||
#endif
|
||||
K_drawInput();
|
||||
|
||||
if (demo.title) // Draw title logo instead in demo.titles
|
||||
{
|
||||
INT32 x = BASEVIDWIDTH - 32, y = 128, offs;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ extern UINT8 colortranslations[MAXTRANSLATIONS][16];
|
||||
extern const char *KartColor_Names[MAXSKINCOLORS];
|
||||
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
|
||||
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color);
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local);
|
||||
UINT8 K_GetKartColorByName(const char *name);
|
||||
|
||||
void K_RegisterKartStuff(void);
|
||||
|
||||
@@ -293,6 +293,8 @@ static void Lua_OnChange(void)
|
||||
//lua_settop(gL, 0); // Just in case...
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
int error_handler_i = abs_index(gL, -1);
|
||||
|
||||
// From CV_OnChange registry field, get the function for this cvar by name.
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "CV_OnChange");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
@@ -304,7 +306,7 @@ static void Lua_OnChange(void)
|
||||
lua_getfield(gL, -1, cvname); // get consvar_t* userdata.
|
||||
lua_remove(gL, -2); // pop the CV_Vars table.
|
||||
|
||||
LUA_Call(gL, 1, 0, 1); // call function(cvar)
|
||||
LUA_Call(gL, 1, 0, error_handler_i); // call function(cvar)
|
||||
lua_pop(gL, 2); // pop CV_OnChange table and error handler
|
||||
}
|
||||
|
||||
|
||||
@@ -44,5 +44,6 @@ boolean LUA_HudEnabled(enum hud option);
|
||||
void LUAh_GameHUD(player_t *stplyr, huddrawlist_h list);
|
||||
void LUAh_ScoresHUD(huddrawlist_h list);
|
||||
void LUAh_IntermissionHUD(huddrawlist_h list);
|
||||
void LUAh_VoteHUD(huddrawlist_h list);
|
||||
|
||||
#endif // __LUA_HUD_H__
|
||||
+77
-3
@@ -15,6 +15,7 @@
|
||||
#include "r_defs.h"
|
||||
#include "r_local.h"
|
||||
#include "st_stuff.h" // hudinfo[]
|
||||
#include "y_inter.h"
|
||||
#include "g_game.h"
|
||||
#include "i_video.h" // rendermode
|
||||
#include "p_local.h" // camera_t
|
||||
@@ -86,11 +87,13 @@ enum hudhook {
|
||||
hudhook_game = 0,
|
||||
hudhook_scores = 1,
|
||||
hudhook_intermission = 2,
|
||||
hudhook_vote = 3,
|
||||
};
|
||||
static const char *const hudhook_opt[] = {
|
||||
"game",
|
||||
"scores",
|
||||
"intermission",
|
||||
"vote",
|
||||
NULL};
|
||||
|
||||
// alignment types for v.drawString
|
||||
@@ -964,11 +967,46 @@ static int lib_hudadd(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_hudsetvotebackground(lua_State *L)
|
||||
{
|
||||
if (lua_isnoneornil(L, 1))
|
||||
{
|
||||
if (luaVoteScreen)
|
||||
{
|
||||
free(luaVoteScreen);
|
||||
}
|
||||
|
||||
luaVoteScreen = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *prefix = luaL_checkstring(L, 1);
|
||||
|
||||
if (strlen(prefix) != 4)
|
||||
{
|
||||
return luaL_argerror(L, 1, "prefix should 4 characters wide");
|
||||
}
|
||||
|
||||
if (!luaVoteScreen)
|
||||
{
|
||||
luaVoteScreen = (char*)malloc(5);
|
||||
luaVoteScreen[4] = 0;
|
||||
}
|
||||
|
||||
strncpy(luaVoteScreen, prefix, 4);
|
||||
|
||||
strupr(luaVoteScreen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static luaL_Reg lib_hud[] = {
|
||||
{"enable", lib_hudenable},
|
||||
{"disable", lib_huddisable},
|
||||
{"enabled", lib_hudenabled},
|
||||
{"add", lib_hudadd},
|
||||
{"setVoteBackground", lib_hudsetvotebackground},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -993,6 +1031,9 @@ int LUA_HudLib(lua_State *L)
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 4); // HUD[4] = intermission rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 5); // HUD[5] = vote rendering functions array
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||
|
||||
luaL_newmetatable(L, META_HUDINFO);
|
||||
@@ -1061,7 +1102,7 @@ void LUAh_GameHUD(player_t *stplayr, huddrawlist_h list)
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, 2); // HUD[2] = rendering funcs
|
||||
lua_rawgeti(gL, -1, hudhook_game+2); // HUD[2] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
@@ -1119,7 +1160,7 @@ void LUAh_ScoresHUD(huddrawlist_h list)
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, 3); // HUD[3] = rendering funcs
|
||||
lua_rawgeti(gL, -1, hudhook_scores+2); // HUD[3] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
@@ -1152,7 +1193,40 @@ void LUAh_IntermissionHUD(huddrawlist_h list)
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, 4); // HUD[4] = rendering funcs
|
||||
lua_rawgeti(gL, -1, hudhook_intermission+2); // HUD[4] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_VoteHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_vote)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_vote+2); // HUD[5] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
|
||||
@@ -84,7 +84,7 @@ huddrawlist_h LUA_HUD_CreateDrawList(void)
|
||||
{
|
||||
huddrawlist_h drawlist;
|
||||
|
||||
drawlist = (huddrawlist_h) Z_Calloc(sizeof(struct huddrawlist_s), PU_STATIC, NULL);
|
||||
drawlist = (huddrawlist_h) Z_CallocAlign(sizeof(struct huddrawlist_s), PU_STATIC, NULL, 64);
|
||||
drawlist->items = NULL;
|
||||
drawlist->items_capacity = 0;
|
||||
drawlist->items_len = 0;
|
||||
@@ -145,7 +145,7 @@ static size_t AllocateDrawItem(huddrawlist_h list)
|
||||
{
|
||||
if (list->items_capacity == 0) list->items_capacity = 128;
|
||||
else list->items_capacity *= 2;
|
||||
list->items = (drawitem_t *) Z_Realloc(list->items, sizeof(struct drawitem_s) * list->items_capacity, PU_STATIC, NULL);
|
||||
list->items = (drawitem_t *) Z_ReallocAlign(list->items, sizeof(struct drawitem_s) * list->items_capacity, PU_STATIC, NULL, 64);
|
||||
}
|
||||
|
||||
return list->items_len++;
|
||||
@@ -164,7 +164,7 @@ static size_t CopyString(huddrawlist_h list, const char* str)
|
||||
{
|
||||
if (list->strbuf_capacity == 0) list->strbuf_capacity = 256;
|
||||
else list->strbuf_capacity *= 2;
|
||||
list->strbuf = (char*) Z_Realloc(list->strbuf, sizeof(char) * list->strbuf_capacity, PU_STATIC, NULL);
|
||||
list->strbuf = (char*) Z_ReallocAlign(list->strbuf, sizeof(char) * list->strbuf_capacity, PU_STATIC, NULL, 8);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
+60
-16
@@ -16,9 +16,12 @@
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "r_things.h"
|
||||
#include "r_main.h"
|
||||
#include "p_local.h"
|
||||
#include "g_game.h"
|
||||
#include "p_setup.h"
|
||||
#include "doomdef.h"
|
||||
#include "d_netcmd.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
@@ -36,8 +39,8 @@ int mobj_snext_noset(lua_State *L);
|
||||
int mobj_z_setter(lua_State *L);
|
||||
int mobj_sprev_unimplemented(lua_State *L);
|
||||
int mobj_angle_setter(lua_State *L);
|
||||
//int mobj_sloperoll_noset(lua_State *L);
|
||||
//int mobj_spritescale_setter(lua_State *L);
|
||||
int mobj_sloperoll_noop(lua_State *L);
|
||||
int mobj_spritescale_setter(lua_State *L);
|
||||
int mobj_touching_sectorlist_unimplemented(lua_State *L);
|
||||
int mobj_radius_setter(lua_State *L);
|
||||
int mobj_height_setter(lua_State *L);
|
||||
@@ -65,6 +68,8 @@ int mobj_mobjnum_unimplemented(lua_State *L);
|
||||
int mobj_scale_setter(lua_State *L);
|
||||
int mobj_destscale_setter(lua_State *L);
|
||||
int mobj_standingslope_noset(lua_State *L);
|
||||
int mobj_rollsum_getter(lua_State *L);
|
||||
int mobj_rollsum_noset(lua_State *L);
|
||||
|
||||
static const char *const array_opt[] ={"iterate",NULL};
|
||||
|
||||
@@ -76,15 +81,17 @@ static const udata_field_t mobj_fields[] = {
|
||||
FIELD(mobj_t, snext, udatalib_getter_mobj, mobj_snext_noset),
|
||||
FIELD(mobj_t, sprev, mobj_sprev_unimplemented, mobj_sprev_unimplemented),
|
||||
FIELD(mobj_t, angle, udatalib_getter_angle, mobj_angle_setter),
|
||||
//FIELD(mobj_t, rollangle, udatalib_getter_angle, udatalib_setter_angle),
|
||||
//FIELD(mobj_t, sloperoll, udatalib_getter_angle, mobj_sloperoll_noset),
|
||||
FIELD(mobj_t, rollangle, udatalib_getter_angle, udatalib_setter_angle),
|
||||
FIELD(mobj_t, sloperoll, udatalib_getter_angle, mobj_sloperoll_noop),
|
||||
// Macro fails here
|
||||
{ "rollsum", 0, mobj_rollsum_getter, mobj_rollsum_noset },
|
||||
FIELD(mobj_t, sprite, udatalib_getter_spritenum, udatalib_setter_spritenum),
|
||||
FIELD(mobj_t, frame, udatalib_getter_uint32, udatalib_setter_uint32),
|
||||
FIELD(mobj_t, anim_duration, udatalib_getter_uint16, udatalib_setter_uint16),
|
||||
//FIELD(mobj_t, spritexscale, udatalib_getter_fixed, mobj_spritescale_setter),
|
||||
//FIELD(mobj_t, spriteyscale, udatalib_getter_fixed, mobj_spritescale_setter),
|
||||
//FIELD(mobj_t, spritexoffset, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
//FIELD(mobj_t, spriteyoffset, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(mobj_t, spritexscale, udatalib_getter_fixed, mobj_spritescale_setter),
|
||||
FIELD(mobj_t, spriteyscale, udatalib_getter_fixed, mobj_spritescale_setter),
|
||||
FIELD(mobj_t, spritexoffset, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(mobj_t, spriteyoffset, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(mobj_t, touching_sectorlist, mobj_touching_sectorlist_unimplemented, mobj_touching_sectorlist_unimplemented),
|
||||
FIELD(mobj_t, subsector, udatalib_getter_subsector, mobj_nosetpos_subsector),
|
||||
FIELD(mobj_t, floorz, udatalib_getter_fixed, mobj_nosetpos_floorz),
|
||||
@@ -133,7 +140,7 @@ static const udata_field_t mobj_fields[] = {
|
||||
FIELD(mobj_t, cvmem, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(mobj_t, standingslope, udatalib_getter_slope, mobj_standingslope_noset),
|
||||
FIELD(mobj_t, colorized, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
//FIELD(mobj_t, rollmodel, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, rollmodel, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
{ NULL },
|
||||
};
|
||||
#undef FIELD
|
||||
@@ -174,14 +181,21 @@ int mobj_ ## field ## _noset(lua_State *L) \
|
||||
return luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " should not be set directly.", #field); \
|
||||
}
|
||||
|
||||
//NOSET(sloperoll)
|
||||
#define NOSET_USE(field, use) \
|
||||
int mobj_ ## field ## _noset(lua_State *L) \
|
||||
{ \
|
||||
return luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " should not be set directly. Use " LUA_QL(use) " instead.", #field); \
|
||||
}
|
||||
|
||||
NOSET(snext)
|
||||
NOSET(bnext)
|
||||
NOSET(info)
|
||||
NOSET(player)
|
||||
NOSET(standingslope)
|
||||
NOSET_USE(rollsum, "rollangle")
|
||||
|
||||
#undef NOSET
|
||||
#undef NOSET_USE
|
||||
|
||||
// Unimplemented fields (why would you need to set them like that explicitly?
|
||||
// No idea, i'm keeping it for synch reasons)
|
||||
@@ -198,6 +212,10 @@ UNIMPLEMENTED(mobjnum)
|
||||
|
||||
#undef UNIMPLEMENTED
|
||||
|
||||
// For some dumb reason it is valid to set sloperoll, even though it is read
|
||||
// only
|
||||
int mobj_sloperoll_noop(lua_State *L) { return 0; }
|
||||
|
||||
// Now other getters/setters with arbitary logic
|
||||
|
||||
// Getters get light userdata, which in this case is just mobj_t pointer
|
||||
@@ -233,7 +251,7 @@ int mobj_angle_setter(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*int mobj_spritescale_setter(lua_State *L)
|
||||
int mobj_spritescale_setter(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = GETMO();
|
||||
|
||||
@@ -251,7 +269,7 @@ int mobj_angle_setter(lua_State *L)
|
||||
mo->realyscale = luaL_checkfixed(L, 2);
|
||||
}
|
||||
return 0;
|
||||
}*/
|
||||
}
|
||||
|
||||
int mobj_radius_setter(lua_State *L)
|
||||
{
|
||||
@@ -347,8 +365,14 @@ int mobj_skin_getter(lua_State *L)
|
||||
if (!mo->skin)
|
||||
return 0;
|
||||
|
||||
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
||||
|
||||
if (hud_running && cv_luaimmersion.value) {
|
||||
if (mo->localskin) // HUD ONLY!!!!!!!!!!
|
||||
lua_pushstring(L, ((skin_t *)mo->localskin)->name);
|
||||
else
|
||||
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
||||
} else {
|
||||
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -360,7 +384,7 @@ int mobj_skin_setter(lua_State *L)
|
||||
char skin[SKINNAMESIZE+1]; // all skin names are limited to this length
|
||||
strlcpy(skin, luaL_checkstring(L, 2), sizeof skin);
|
||||
strlwr(skin); // all skin names are lowercase
|
||||
for (i = 0; i < numskins; i++)
|
||||
for (i = 0; i < numskins; i++) {
|
||||
{
|
||||
if (fastcmp(skins[i].name, skin))
|
||||
{
|
||||
@@ -369,7 +393,9 @@ int mobj_skin_setter(lua_State *L)
|
||||
}
|
||||
}
|
||||
|
||||
return luaL_error(L, "mobj.skin '%s' not found!", skin);
|
||||
}
|
||||
|
||||
return luaL_error(L, "mobj.skin '%s' not found!", skin);
|
||||
}
|
||||
|
||||
int mobj_color_setter(lua_State *L)
|
||||
@@ -536,6 +562,24 @@ int mobj_destscale_setter(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// WARNING: Not synch safe!
|
||||
// Don't use this field in game logic code!
|
||||
int mobj_rollsum_getter(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = GETMO();
|
||||
|
||||
angle_t rollsum = mo->rollangle + cv_sloperoll.value ? mo->sloperoll : 0;
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
rollsum += R_PlayerSliptideAngle(mo->player);
|
||||
}
|
||||
|
||||
lua_pushangle(L, rollsum);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int mobj_get(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "r_main.h"
|
||||
#include "p_mobj.h"
|
||||
#include "d_player.h"
|
||||
#include "g_game.h"
|
||||
@@ -44,6 +45,10 @@ int player_splitscreenindex_noset(lua_State *L);
|
||||
int player_ping_getter(lua_State *L);
|
||||
int player_ping_noset(lua_State *L);
|
||||
|
||||
// Non synch safe!
|
||||
int player_sliproll_getter(lua_State *L);
|
||||
int player_sliproll_noset(lua_State *L);
|
||||
|
||||
#define FIELD(type, field_name, getter, setter) { #field_name, offsetof(type, field_name), getter, setter }
|
||||
static const udata_field_t player_fields[] = {
|
||||
// Player doesn't actually have field "name" so macro fails. Need to declare field manually.
|
||||
@@ -150,6 +155,7 @@ static const udata_field_t player_fields[] = {
|
||||
FIELD(player_t, fovadd, udatalib_getter_fixed, udatalib_setter_fixed), // Mmm yeah thats definitely synch safe
|
||||
#endif
|
||||
// Same as player.name
|
||||
{ "sliproll", 0, player_sliproll_getter, player_sliproll_noset },
|
||||
{ "ping", 0, player_ping_getter, player_ping_noset }, // Hmm originally setter doesn't exist so data is written as unreachable custom field...
|
||||
{ NULL },
|
||||
};
|
||||
@@ -207,6 +213,7 @@ NOSET(kartstuff)
|
||||
NOSET(bot)
|
||||
NOSET(splitscreenindex)
|
||||
NOSET(ping)
|
||||
NOSET(sliproll)
|
||||
|
||||
#undef NOSET
|
||||
|
||||
@@ -331,6 +338,15 @@ int player_ping_getter(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int player_sliproll_getter(lua_State *L)
|
||||
{
|
||||
player_t *plr = GETPLAYER();
|
||||
|
||||
lua_pushangle(L, R_PlayerSliptideAngle(plr));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_iteratePlayers(lua_State *L)
|
||||
{
|
||||
INT32 i = -1;
|
||||
@@ -516,7 +532,9 @@ static int player_get(lua_State *L)
|
||||
}
|
||||
lua_getfield(L, -1, field);
|
||||
if (lua_isnil(L, -1)) // no value for this field
|
||||
{
|
||||
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "player_t", field);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
|
||||
LUA_LoadFile(&f, name); // actually load file!
|
||||
|
||||
// Okay, we've modified the game beyond the point of no return.
|
||||
G_SetGameModified(multiplayer, true);
|
||||
G_SetWadModified(multiplayer, true, wad);
|
||||
|
||||
free(name);
|
||||
Z_Free(f.data);
|
||||
|
||||
+9
-9
@@ -166,14 +166,14 @@ static int lib_iterateSkins(lua_State *L)
|
||||
lua_remove(L, 1); // state is unused.
|
||||
|
||||
if (!lua_isnil(L, 1))
|
||||
i = (INT32)(*((skin_t **)luaL_checkudata(L, 1, META_SKIN)) - skins) + 1;
|
||||
i = (INT32)(*((skin_t **)luaL_checkudata(L, 1, META_SKIN)) - allskins) + 1;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
// skins are always valid, only added, never removed
|
||||
if (i < numskins)
|
||||
if (i < numallskins)
|
||||
{
|
||||
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
||||
LUA_PushUserdata(L, &allskins[i], META_SKIN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -191,9 +191,9 @@ static int lib_getSkin(lua_State *L)
|
||||
i = luaL_checkinteger(L, 2);
|
||||
if (i < 0 || i >= MAXSKINS)
|
||||
return luaL_error(L, "skins[] index %d out of range (0 - %d)", i, MAXSKINS-1);
|
||||
if (i >= numskins)
|
||||
if (i >= numallskins)
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
||||
LUA_PushUserdata(L, &allskins[i], META_SKIN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -207,10 +207,10 @@ static int lib_getSkin(lua_State *L)
|
||||
}
|
||||
|
||||
// find skin by name
|
||||
for (i = 0; i < numskins; i++)
|
||||
if (fastcmp(skins[i].name, field))
|
||||
for (i = 0; i < numallskins; i++)
|
||||
if (fastcmp(allskins[i].name, field))
|
||||
{
|
||||
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
||||
LUA_PushUserdata(L, &allskins[i], META_SKIN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ static int lib_getSkin(lua_State *L)
|
||||
|
||||
static int lib_numSkins(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, numskins);
|
||||
lua_pushinteger(L, numallskins);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ int udatalib_setter_boolean_nocheck(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(boolean, lua_toboolean)
|
||||
|
||||
int udatalib_setter_spritenum(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(spritenum_t, (spritenum_t)luaL_checkinteger)
|
||||
UDATALIB_SIMPLE_SETTER(spritenum_t, luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_tic(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(tic_t, (tic_t)luaL_checkinteger)
|
||||
|
||||
+3
-5
@@ -1,8 +1,6 @@
|
||||
#ifndef __LUA_UDATALIB_H__
|
||||
#define __LUA_UDATALIB_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
|
||||
#include "doomdef.h"
|
||||
@@ -16,7 +14,7 @@
|
||||
|
||||
typedef struct udata_field_s {
|
||||
const char *name;
|
||||
intptr_t offset;
|
||||
size_t offset;
|
||||
lua_CFunction getter;
|
||||
lua_CFunction setter;
|
||||
} udata_field_t;
|
||||
@@ -82,8 +80,8 @@ void udatalib_addfields(lua_State *L, int mt, const udata_field_t fields[]);
|
||||
// Get pointer to field value within getter or setter
|
||||
#define UDATALIB_GETFIELD(type, field) \
|
||||
{ \
|
||||
intptr_t offset = lua_tointeger(L, lua_upvalueindex(1)); \
|
||||
field = (type*)((intptr_t)lua_touserdata(L, 1) + offset); \
|
||||
size_t offset = lua_tointeger(L, lua_upvalueindex(1)); \
|
||||
field = (type*)((uint8_t*)lua_touserdata(L, 1) + offset); \
|
||||
}
|
||||
|
||||
// Creates implementation for simple getter and setter. Super lazy, yes.
|
||||
|
||||
+300
-47
@@ -145,6 +145,8 @@ INT32 mapwads[NUMMAPS];
|
||||
//static char *char_notes = NULL;
|
||||
//static fixed_t char_scroll = 0;
|
||||
|
||||
boolean browselocalskins = false;
|
||||
|
||||
boolean menuactive = false;
|
||||
boolean fromlevelselect = false;
|
||||
|
||||
@@ -234,6 +236,8 @@ menu_t SR_MainDef, SR_UnlockChecklistDef;
|
||||
static void M_SinglePlayerMenu(INT32 choice);
|
||||
#endif
|
||||
static void M_Options(INT32 choice);
|
||||
static void M_LocalSkinMenu(INT32 choice);
|
||||
static void M_LocalSkinChange(INT32 choice);
|
||||
static void M_Manual(INT32 choice);
|
||||
static void M_SelectableClearMenus(INT32 choice);
|
||||
static void M_Retry(INT32 choice);
|
||||
@@ -336,7 +340,9 @@ menu_t OP_MonitorToggleDef;
|
||||
static void M_ScreenshotOptions(INT32 choice);
|
||||
static void M_EraseData(INT32 choice);
|
||||
|
||||
static void M_AddonsInternal();
|
||||
static void M_Addons(INT32 choice);
|
||||
static void M_LocalSkins(INT32 choice);
|
||||
static void M_AddonsOptions(INT32 choice);
|
||||
static patch_t *addonsp[NUM_EXT+5];
|
||||
|
||||
@@ -350,6 +356,9 @@ menu_t OP_SaturnCreditsDef;
|
||||
|
||||
// Bird
|
||||
menu_t OP_BirdDef;
|
||||
// Stuff, yknow.
|
||||
menu_t OP_ForkedBirdDef;
|
||||
menu_t OP_LocalSkinDef;
|
||||
menu_t OP_TiltDef;
|
||||
menu_t OP_AdvancedBirdDef;
|
||||
|
||||
@@ -407,6 +416,7 @@ static void M_DrawConnectMenu(void);
|
||||
#endif
|
||||
static void M_DrawJoystick(void);
|
||||
static void M_DrawSetupMultiPlayerMenu(void);
|
||||
static void M_DrawLocalSkinMenu(void);
|
||||
|
||||
// Handling functions
|
||||
#ifndef NONET
|
||||
@@ -627,12 +637,13 @@ typedef enum
|
||||
// ---------------------
|
||||
static menuitem_t MPauseMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Addons...", M_Addons, 8},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 16},
|
||||
{IT_STRING | IT_CALL, NULL, "Switch Map..." , M_MapChange, 24},
|
||||
{IT_STRING | IT_CALL, NULL, "Addons...", M_Addons, 8},
|
||||
{IT_STRING | IT_CALL, NULL, "Add local skins...", M_LocalSkins, 16},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 24},
|
||||
{IT_STRING | IT_CALL, NULL, "Switch Map..." , M_MapChange, 32},
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Ask To Join Requests...", &MISC_DiscordRequestsDef, 24},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Ask To Join Requests...", &MISC_DiscordRequestsDef, 32},
|
||||
#endif
|
||||
|
||||
{IT_CALL | IT_STRING, NULL, "Continue", M_SelectableClearMenus, 40},
|
||||
@@ -647,15 +658,17 @@ static menuitem_t MPauseMenu[] =
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Enter/Spectate...", &MISC_ChangeSpectateDef,48},
|
||||
{IT_CALL | IT_STRING, NULL, "Player Setup...", M_SetupMultiPlayer, 56}, // alone
|
||||
{IT_CALL | IT_STRING, NULL, "Options", M_Options, 64},
|
||||
{IT_CALL | IT_STRING, NULL, "Local Skin...", M_LocalSkinMenu, 64}, // alone
|
||||
{IT_CALL | IT_STRING, NULL, "Options", M_Options, 72},
|
||||
|
||||
{IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 80},
|
||||
{IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 88},
|
||||
{IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 88},
|
||||
{IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 96},
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
mpause_addons = 0,
|
||||
mpause_addlocalskins,
|
||||
mpause_scramble,
|
||||
mpause_switchmap,
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
@@ -674,6 +687,7 @@ typedef enum
|
||||
mpause_switchteam,
|
||||
mpause_switchspectate,
|
||||
mpause_psetup,
|
||||
mpause_localskin,
|
||||
mpause_options,
|
||||
|
||||
mpause_title,
|
||||
@@ -1128,6 +1142,7 @@ static menuitem_t OP_MainMenu[] =
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Options...", &OP_SaturnDef, 140},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Bird", &OP_BirdDef, 150},
|
||||
{IT_CALL|IT_STRING, NULL, "Local Skin Options...", M_LocalSkinMenu, 160},
|
||||
};
|
||||
|
||||
static menuitem_t OP_ControlsMenu[] =
|
||||
@@ -1347,7 +1362,8 @@ static menuitem_t OP_OpenGLOptionsMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "3D Models", &cv_grmdls, 5},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_grfallbackplayermodel, 15},
|
||||
{IT_STRING|IT_CVAR, NULL, "Shaders", &cv_grshaders, 25},
|
||||
{IT_STRING|IT_CVAR, NULL, "Use custom Shaders", &cv_grusecustomshaders, 35},
|
||||
//{IT_STRING|IT_CVAR, NULL, "Use custom Shaders", &cv_grusecustomshaders, 35},
|
||||
{IT_STRING|IT_CVAR, NULL, "Palette Rendering", &cv_grpaletteshader, 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 45},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 65},
|
||||
@@ -1404,24 +1420,27 @@ static menuitem_t OP_SoundOptionsMenu[] =
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Play Music While Unfocused", &cv_playmusicifunfocused, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Play SFX While Unfocused", &cv_playsoundifunfocused, 135},
|
||||
#ifdef HAVE_OPENMPT
|
||||
{IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 155}
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
static menuitem_t OP_SoundAdvancedMenu[] =
|
||||
{
|
||||
#ifdef HAVE_OPENMPT
|
||||
{IT_HEADER, NULL, "Tracker Module Options", NULL, 10},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Instrument Filter", &cv_modfilter, 42},
|
||||
{IT_STRING | IT_CVAR, NULL, "Amiga Resampler", &cv_amigafilter, 62},
|
||||
{IT_STRING | IT_CVAR, NULL, "Instrument Filter", &cv_modfilter, 22},
|
||||
{IT_STRING | IT_CVAR, NULL, "Amiga Resampler", &cv_amigafilter, 42},
|
||||
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
|
||||
{IT_STRING | IT_CVAR, NULL, "Amiga Type", &cv_amigatype, 82},
|
||||
{IT_STRING | IT_CVAR, NULL, "Amiga Type", &cv_amigatype, 62},
|
||||
#endif
|
||||
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 102},
|
||||
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 82},
|
||||
#endif
|
||||
{IT_HEADER, NULL, "Misc", NULL, 105},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Grow Music", &cv_growmusic, 117},
|
||||
{IT_STRING | IT_CVAR, NULL, "Invulnerability Music", &cv_supermusic, 137},
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
static menuitem_t OP_DataOptionsMenu[] =
|
||||
{
|
||||
@@ -1694,14 +1713,35 @@ static menuitem_t OP_MonitorToggleMenu[] =
|
||||
static menuitem_t OP_SaturnMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Saturn Options", NULL, 0},
|
||||
{IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 30},
|
||||
//{IT_STRING | IT_CVAR, NULL, "Addon Download Speed", &cv_downloadspeed, 55}, //no idea why you would wanna change it anyways
|
||||
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "No Midnight Channel Flicker", &cv_lessflicker, 75},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 100},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 115},
|
||||
{IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Small Speedometer", &cv_newspeedometer, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flashpals in Palette Renderer", &cv_grflashpal, 120},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 140},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 155},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 155}, // uwu
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 170}, // uwu
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
sm_header,
|
||||
sm_waittime,
|
||||
sm_skinselspeed,
|
||||
sm_input,
|
||||
sm_speedometer,
|
||||
sm_lapemblem,
|
||||
sm_mapnames,
|
||||
sm_smallmap,
|
||||
sm_pisschannel,
|
||||
sm_distortionmenu,
|
||||
sm_hudoffsets,
|
||||
sm_credits,
|
||||
};
|
||||
|
||||
static menuitem_t OP_PlayerDistortMenu[] =
|
||||
@@ -1712,6 +1752,10 @@ static menuitem_t OP_PlayerDistortMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Slope rotation distance", &cv_sloperolldist, 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate players when sliptiding", &cv_sliptideroll, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Player stretch factor", &cv_gravstretch, 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Squish Sound Effect", &cv_slamsound, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 125},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 140},
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -1745,25 +1789,27 @@ static menuitem_t OP_SaturnCreditsMenu[] =
|
||||
|
||||
{IT_HEADER, NULL, "Main Devs <3", NULL, 20},
|
||||
|
||||
{IT_STRING, NULL, "alufolie91 aka Alug", NULL, 30},
|
||||
{IT_STRING, NULL, "Indev", NULL, 40},
|
||||
{IT_STRING2+IT_SPACE, NULL, "alufolie91 aka Alug", NULL, 30},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 40},
|
||||
|
||||
{IT_HEADER, NULL, "Testers <3", NULL, 60},
|
||||
|
||||
{IT_STRING, NULL, "Sunflower aka AnimeSonic", NULL, 70},
|
||||
{IT_STRING, NULL, "Yuz aka Yuzler", NULL, 80},
|
||||
{IT_STRING, NULL, "Democrab", NULL, 90},
|
||||
{IT_STRING, NULL, "EXpand aka Maver", NULL, 100},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Sunflower aka AnimeSonic", NULL, 70},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Yuz aka Yuzler", NULL, 80},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Democrab", NULL, 90},
|
||||
{IT_STRING2+IT_SPACE, NULL, "EXpand aka Maver", NULL, 100},
|
||||
|
||||
{IT_HEADER, NULL, "Special Thanks <3", NULL, 120},
|
||||
|
||||
{IT_STRING, NULL, "xyzzy", NULL, 130},
|
||||
{IT_STRING, NULL, "Haya", NULL, 140},
|
||||
{IT_STRING, NULL, "Galactice", NULL, 150},
|
||||
{IT_STRING, NULL, "Himie and", NULL, 160},
|
||||
{IT_STRING, NULL, "The Moe Mansion / Birdhouse Team", NULL, 170},
|
||||
{IT_STRING, NULL, "All of Sunflower's Garden", NULL, 180},
|
||||
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 130},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 140},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Galactice", NULL, 150},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Himie and", NULL, 160},
|
||||
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion / Birdhouse Team", NULL, 170},
|
||||
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 180},
|
||||
|
||||
{IT_STRING+IT_SPACE, NULL, "", NULL, 190}, // dummy text
|
||||
{IT_STRING, NULL, "", NULL, 200}, // dummy text II
|
||||
};
|
||||
|
||||
static menuitem_t OP_BirdMenu[] =
|
||||
@@ -1786,6 +1832,17 @@ static menuitem_t OP_BirdMenu[] =
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 120},
|
||||
};
|
||||
|
||||
static menuitem_t OP_ForkedBirdMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Local Skins", NULL, 0},
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Local Skin Name", &cv_fakelocalskin, 10},
|
||||
{IT_STRING2 | IT_SPACE, NULL, "Set to None for no Local Skin", NULL, 20},
|
||||
{IT_STRING | IT_CALL, NULL, "Apply to All Players", M_LocalSkinChange, 140},
|
||||
{IT_STRING | IT_CALL, NULL, "Apply to Displaying Player", M_LocalSkinChange, 150},
|
||||
{IT_STRING | IT_CALL, NULL, "Apply to Yourself", M_LocalSkinChange, 160},
|
||||
{IT_STRING | IT_CVAR, NULL, "Lua Immersion", &cv_luaimmersion, 170},
|
||||
};
|
||||
|
||||
static menuitem_t OP_TiltMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Tilting", &cv_tilting, 0},
|
||||
@@ -2340,8 +2397,8 @@ menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(NULL, OP_DiscordOptionsMenu, &OP_
|
||||
#endif
|
||||
menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 30, 30);
|
||||
|
||||
menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30);
|
||||
menu_t OP_PlayerDistortDef = DEFAULTMENUSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 60);
|
||||
menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 15);
|
||||
menu_t OP_PlayerDistortDef = DEFAULTMENUSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30);
|
||||
menu_t OP_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 20);
|
||||
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 10);
|
||||
|
||||
@@ -2349,6 +2406,20 @@ menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30);
|
||||
menu_t OP_TiltDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_BirdDef, 30, 60);
|
||||
menu_t OP_AdvancedBirdDef = DEFAULTMENUSTYLE(NULL, OP_AdvancedBirdMenu, &OP_BirdDef, 30, 60);
|
||||
|
||||
menu_t OP_ForkedBirdDef = {
|
||||
NULL,
|
||||
sizeof(OP_ForkedBirdMenu)/sizeof(menuitem_t),
|
||||
&OP_MainDef,
|
||||
OP_ForkedBirdMenu,
|
||||
M_DrawLocalSkinMenu,
|
||||
30, 6,
|
||||
0,
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t OP_LocalSkinDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_ForkedBirdDef, 30, 60);
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// CVAR ONCHANGE EVENTS GO HERE
|
||||
// ==========================================================================
|
||||
@@ -3437,6 +3508,18 @@ void M_Drawer(void)
|
||||
#else // Regular build
|
||||
V_DrawThinString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING));
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
V_DrawThinString(0, 0, V_GREENMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Opengl"));
|
||||
}
|
||||
#endif
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
V_DrawThinString(0, 0, V_REDMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Software"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3550,14 +3633,16 @@ void M_StartControlPanel(void)
|
||||
|
||||
// Reset these in case splitscreen messes things up
|
||||
MPauseMenu[mpause_addons].alphaKey = 8;
|
||||
MPauseMenu[mpause_addlocalskins].alphaKey = 16;
|
||||
MPauseMenu[mpause_scramble].alphaKey = 8;
|
||||
MPauseMenu[mpause_switchmap].alphaKey = 24;
|
||||
|
||||
MPauseMenu[mpause_switchteam].alphaKey = 48;
|
||||
MPauseMenu[mpause_switchspectate].alphaKey = 48;
|
||||
MPauseMenu[mpause_options].alphaKey = 64;
|
||||
MPauseMenu[mpause_title].alphaKey = 80;
|
||||
MPauseMenu[mpause_quit].alphaKey = 88;
|
||||
MPauseMenu[mpause_localskin].alphaKey = 64;
|
||||
MPauseMenu[mpause_options].alphaKey = 72;
|
||||
MPauseMenu[mpause_title].alphaKey = 88;
|
||||
MPauseMenu[mpause_quit].alphaKey = 96;
|
||||
|
||||
Dummymenuplayer_OnChange();
|
||||
|
||||
@@ -3580,6 +3665,7 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU;
|
||||
MPauseMenu[mpause_switchteam].alphaKey += ((splitscreen+1) * 8);
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
@@ -3588,6 +3674,7 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_switchspectate].status = IT_STRING | IT_SUBMENU;
|
||||
MPauseMenu[mpause_switchspectate].alphaKey += ((splitscreen+1) * 8);
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
@@ -3598,6 +3685,7 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_psetupsplit3].status = IT_STRING | IT_CALL;
|
||||
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
@@ -3605,6 +3693,7 @@ void M_StartControlPanel(void)
|
||||
if (splitscreen > 2)
|
||||
{
|
||||
MPauseMenu[mpause_psetupsplit4].status = IT_STRING | IT_CALL;
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
@@ -3826,6 +3915,9 @@ void M_Init(void)
|
||||
OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED;
|
||||
#endif
|
||||
|
||||
if (!found_extra_kart) // why bother?
|
||||
OP_SaturnMenu[sm_speedometer].status = IT_GRAYEDOUT;
|
||||
|
||||
#ifndef NONET
|
||||
CV_RegisterVar(&cv_serversort);
|
||||
#endif
|
||||
@@ -4242,7 +4334,7 @@ static void M_DrawGenericMenu(void)
|
||||
y += STRINGHEIGHT;
|
||||
break;
|
||||
case IT_STRING2:
|
||||
V_DrawString(x, y, lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawString(((BASEVIDWIDTH - V_StringWidth(currentMenu->menuitems[i].text, 0))>>1), y, 0, currentMenu->menuitems[i].text);
|
||||
/* FALLTHRU */
|
||||
case IT_DYLITLSPACE:
|
||||
y += SMALLLINEHEIGHT;
|
||||
@@ -5069,12 +5161,10 @@ static void M_AddonsOptions(INT32 choice)
|
||||
#define LOCATIONSTRING1 "Visit \x83SRB2.ORG/MODS\x80 to get & make addons!"
|
||||
#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/MODS\x80 to get & make addons!"
|
||||
|
||||
static void M_Addons(INT32 choice)
|
||||
static void M_AddonsInternal()
|
||||
{
|
||||
const char *pathname = ".";
|
||||
|
||||
(void)choice;
|
||||
|
||||
#if 1
|
||||
if (cv_addons_option.value == 0)
|
||||
pathname = usehome ? srb2home : srb2path;
|
||||
@@ -5135,6 +5225,20 @@ static void M_Addons(INT32 choice)
|
||||
M_SetupNextMenu(&MISC_AddonsDef);
|
||||
}
|
||||
|
||||
static void M_Addons(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
browselocalskins = false;
|
||||
M_AddonsInternal();
|
||||
}
|
||||
|
||||
static void M_LocalSkins(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
browselocalskins = true;
|
||||
M_AddonsInternal();
|
||||
}
|
||||
|
||||
#define width 4
|
||||
#define vpadding 27
|
||||
#define h (BASEVIDHEIGHT-(2*vpadding))
|
||||
@@ -5287,7 +5391,12 @@ static void M_DrawAddons(void)
|
||||
}
|
||||
|
||||
if (Playing())
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, warningflags, "Adding files mid-game may cause problems.");
|
||||
{
|
||||
if (browselocalskins)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, V_ALLOWLOWERCASE, "Load \x83local skins\x80 from addons!");
|
||||
else
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, warningflags, "Adding files mid-game may cause problems.");
|
||||
}
|
||||
else
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, 0, (recommendedflags == V_SKYMAP ? LOCATIONSTRING2 : LOCATIONSTRING1));
|
||||
|
||||
@@ -5458,6 +5567,14 @@ static boolean M_ChangeStringAddons(INT32 choice)
|
||||
}
|
||||
#undef len
|
||||
|
||||
// i hate myself
|
||||
static boolean DumbStartsWith(const char *pre, const char *str)
|
||||
{
|
||||
size_t lenpre = strlen(pre),
|
||||
lenstr = strlen(str);
|
||||
return lenstr < lenpre ? false : memcmp(pre, str, lenpre) == 0;
|
||||
}
|
||||
|
||||
static void M_HandleAddons(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
@@ -5576,7 +5693,16 @@ static void M_HandleAddons(INT32 choice)
|
||||
case EXT_KART:
|
||||
#endif
|
||||
case EXT_PK3:
|
||||
COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
|
||||
if (browselocalskins) {
|
||||
if (DumbStartsWith("KC_", dirmenu[dir_on[menudepthleft]]+DIR_STRING)) {
|
||||
M_StartMessage(va("%c%s\x80\nYou are loading a local skin.\nLocal skins will not be usable\nafter going back from\nthe title screen.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
|
||||
COM_BufAddText(va("addskins \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
|
||||
}
|
||||
else
|
||||
S_StartSound(NULL, sfx_s26d);
|
||||
}
|
||||
else
|
||||
COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
|
||||
break;
|
||||
default:
|
||||
S_StartSound(NULL, sfx_s26d);
|
||||
@@ -11050,7 +11176,7 @@ static void M_DrawJoystick(void)
|
||||
compareval4 = cv_usejoystick4.value;
|
||||
compareval3 = cv_usejoystick3.value;
|
||||
compareval2 = cv_usejoystick2.value;
|
||||
compareval = cv_usejoystick.value
|
||||
compareval = cv_usejoystick.value;
|
||||
#endif
|
||||
|
||||
if ((setupcontrolplayer == 4 && (i == compareval4))
|
||||
@@ -11854,6 +11980,133 @@ static void M_DrawHUDOptions(void)
|
||||
V_DrawRightAlignedString(x, y, highlightflags, "(");
|
||||
}
|
||||
|
||||
static void M_LocalSkinMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
multi_state = &states[mobjinfo[MT_PLAYER].seestate];
|
||||
multi_tics = multi_state->tics;
|
||||
|
||||
OP_ForkedBirdDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&OP_ForkedBirdDef);
|
||||
}
|
||||
|
||||
static void M_LocalSkinChange(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
switch (itemOn) {
|
||||
case 3:
|
||||
COM_BufAddText(va("localskin -a %s", cv_fakelocalskin.string));
|
||||
break;
|
||||
case 4:
|
||||
COM_BufAddText(va("localskin -d 0 %s", cv_fakelocalskin.string));
|
||||
break;
|
||||
case 5:
|
||||
COM_BufAddText(va("localskin %s", cv_fakelocalskin.string));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
S_StartSound(NULL, sfx_s221);
|
||||
}
|
||||
|
||||
// Display our localskin in our goofy ahhhh local skin menu
|
||||
static void M_DrawLocalSkinMenu(void)
|
||||
{
|
||||
INT32 mx, my, st, flags = 0;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
patch_t *patch;
|
||||
UINT8 frame;
|
||||
UINT8 skintodisplay;
|
||||
UINT32 speenframe;
|
||||
|
||||
mx = OP_ForkedBirdDef.x;
|
||||
my = OP_ForkedBirdDef.y;
|
||||
|
||||
// use generic drawer for cursor, items and title
|
||||
M_DrawGenericMenu();
|
||||
|
||||
#define charw 72
|
||||
|
||||
// anim the player in the box
|
||||
if (--multi_tics <= 0)
|
||||
{
|
||||
st = multi_state->nextstate;
|
||||
if (st != S_NULL)
|
||||
multi_state = &states[st];
|
||||
multi_tics = multi_state->tics;
|
||||
if (multi_tics == -1)
|
||||
multi_tics = 15;
|
||||
}
|
||||
|
||||
// skin 0 is default player sprite
|
||||
if (R_AnySkinAvailable(cv_fakelocalskin.string) != -1)
|
||||
{
|
||||
sprdef = &allskins[R_AnySkinAvailable(cv_fakelocalskin.string)].spritedef;
|
||||
skintodisplay = R_AnySkinAvailable(cv_fakelocalskin.string);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ATTEMPT TO FIND REAL SKIN
|
||||
if (R_AnySkinAvailable(cv_skin.string) != -1)
|
||||
{
|
||||
sprdef = &allskins[R_AnySkinAvailable(cv_skin.string)].spritedef;
|
||||
skintodisplay = R_AnySkinAvailable(cv_skin.string);
|
||||
} else { // STILL NOTHIN? use sonic instead
|
||||
sprdef = &allskins[0].spritedef;
|
||||
skintodisplay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sprdef->numframes) // No frames ??
|
||||
return; // Can't render!
|
||||
|
||||
frame = multi_state->frame & FF_FRAMEMASK;
|
||||
if (frame >= sprdef->numframes) // Walking animation missing
|
||||
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()*4/TICRATE + 1)%8;
|
||||
|
||||
//this is a very shitty solution for checking if a sprite needs flipping
|
||||
//but it works
|
||||
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4)) {
|
||||
flags = V_FLIP; // This sprite is left/right flipped!
|
||||
}
|
||||
patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_CACHE);
|
||||
|
||||
// draw box around guy
|
||||
V_DrawFill(mx + 220 - (charw/2), my+54, charw, 84, 239);
|
||||
|
||||
// draw player sprite
|
||||
UINT8 *colormap = R_GetTranslationColormap(skintodisplay, cv_playercolor.value, GTC_MENUCACHE);
|
||||
colormap = R_GetLocalTranslationColormap(&skins[allskins[skintodisplay].localnum], (allskins[skintodisplay].localskin ? &localskins[allskins[skintodisplay].localnum] : NULL), cv_playercolor.value, GTC_MENUCACHE, allskins[skintodisplay].localskin);
|
||||
|
||||
V_DrawMappedPatch(mx, my+50, 0, W_CachePatchName(allskins[skintodisplay].facewant, PU_CACHE), colormap);
|
||||
V_DrawMappedPatch(mx+8, my+85, 0, W_CachePatchName(allskins[skintodisplay].facerank, PU_CACHE), colormap);
|
||||
V_DrawString(mx, my+108, V_ALLOWLOWERCASE, "Character");
|
||||
if (strlen(allskins[skintodisplay].realname) > 10)
|
||||
V_DrawThinString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, allskins[skintodisplay].realname);
|
||||
else
|
||||
V_DrawString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, allskins[skintodisplay].realname);
|
||||
|
||||
if (allskins[skintodisplay].flags & SF_HIRES)
|
||||
{
|
||||
V_DrawFixedPatch((mx+220)<<FRACBITS,
|
||||
(my+120)<<FRACBITS,
|
||||
allskins[skintodisplay].highresscale,
|
||||
flags, patch, colormap);
|
||||
}
|
||||
else
|
||||
V_DrawMappedPatch(mx+220, my+120, flags, patch, colormap);
|
||||
#undef charw
|
||||
}
|
||||
|
||||
// Draw the video modes list, a-la-Quake
|
||||
static void M_DrawVideoMode(void)
|
||||
{
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ fixed_t P_RandomFixedD(const char *rfile, INT32 rline)
|
||||
{
|
||||
CONS_Printf("P_RandomFixed() at: %sp %d\n", rfile, rline);
|
||||
#endif
|
||||
return (INT32)((INT64)__internal_prng__());
|
||||
return __internal_prng__();
|
||||
}
|
||||
|
||||
/** Provides a random byte. Distribution is uniform.
|
||||
|
||||
+19
-6
@@ -2608,6 +2608,7 @@ void A_MonitorPop(mobj_t *actor)
|
||||
remains->fuse = actor->fuse; // Transfer respawn timer
|
||||
remains->threshold = 68;
|
||||
remains->skin = NULL;
|
||||
remains->localskin = NULL;
|
||||
|
||||
P_SetTarget(&tmthing, remains);
|
||||
|
||||
@@ -4167,6 +4168,18 @@ void A_SignPlayer(mobj_t *actor)
|
||||
P_SetTarget(&ov->target, actor);
|
||||
ov->color = actor->target->player->skincolor;
|
||||
ov->skin = &skins[actor->target->player->skin];
|
||||
if (actor->target->skinlocal) {
|
||||
// needs - 1 or else it pukes an error out
|
||||
// same thing happens on p_mobj.c
|
||||
ov->localskin = &localskins[actor->target->player->localskin - 1];
|
||||
ov->skinlocal = actor->target->skinlocal;
|
||||
} else {
|
||||
// needs - 1 or else it pukes an error out
|
||||
// same thing happens on p_mobj.c
|
||||
if (actor->target->player->localskin)
|
||||
ov->localskin = &skins[actor->target->player->localskin - 1];
|
||||
ov->skinlocal = actor->target->skinlocal;
|
||||
}
|
||||
P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN
|
||||
}
|
||||
|
||||
@@ -7444,10 +7457,10 @@ void A_RollAngle(mobj_t *actor)
|
||||
INT32 locvar2 = var2;
|
||||
const angle_t angle = FixedAngle(locvar1*FRACUNIT);
|
||||
|
||||
/*#ifdef HAVE_BLUA
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_RollAngle", actor))
|
||||
return;
|
||||
#endif*/
|
||||
#endif
|
||||
|
||||
// relative (default)
|
||||
if (!locvar2)
|
||||
@@ -7470,10 +7483,10 @@ void A_ChangeRollAngleRelative(mobj_t *actor)
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
/*#ifdef HAVE_BLUA
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_ChangeRollAngleRelative", actor))
|
||||
return;
|
||||
#endif*/
|
||||
#endif
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
@@ -7496,10 +7509,10 @@ void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
/*#ifdef HAVE_BLUA
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_ChangeRollAngleAbsolute", actor))
|
||||
return;
|
||||
#endif*/
|
||||
#endif
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
|
||||
+24
-13
@@ -3792,12 +3792,11 @@ void P_NullPrecipThinker(precipmobj_t *mobj)
|
||||
{
|
||||
//(void)mobj;
|
||||
mobj->precipflags &= ~PCF_THUNK;
|
||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||
}
|
||||
|
||||
void P_SnowThinker(precipmobj_t *mobj)
|
||||
{
|
||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||
|
||||
P_CycleStateAnimation((mobj_t *)mobj);
|
||||
|
||||
// adjust height
|
||||
@@ -3810,8 +3809,6 @@ void P_SnowThinker(precipmobj_t *mobj)
|
||||
|
||||
void P_RainThinker(precipmobj_t *mobj)
|
||||
{
|
||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||
|
||||
P_CycleStateAnimation((mobj_t *)mobj);
|
||||
|
||||
if (mobj->state != &states[S_RAIN1])
|
||||
@@ -3838,17 +3835,18 @@ void P_RainThinker(precipmobj_t *mobj)
|
||||
}
|
||||
|
||||
// adjust height
|
||||
if ((mobj->z += mobj->momz) <= mobj->floorz)
|
||||
if ((mobj->z += mobj->momz) > mobj->floorz)
|
||||
return;
|
||||
|
||||
// no splashes on sky or bottomless pits
|
||||
if (mobj->precipflags & PCF_PIT)
|
||||
{
|
||||
// no splashes on sky or bottomless pits
|
||||
if (mobj->precipflags & PCF_PIT)
|
||||
mobj->z = mobj->ceilingz;
|
||||
else
|
||||
{
|
||||
mobj->z = mobj->floorz;
|
||||
P_SetPrecipMobjState(mobj, S_SPLASH1);
|
||||
}
|
||||
mobj->z = mobj->ceilingz;
|
||||
return;
|
||||
}
|
||||
|
||||
mobj->z = mobj->floorz;
|
||||
P_SetPrecipMobjState(mobj, S_SPLASH1);
|
||||
}
|
||||
|
||||
static void P_RingThinker(mobj_t *mobj)
|
||||
@@ -9564,6 +9562,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
mobj->spriteyscale = mobj->realyscale;
|
||||
mobj->spritexoffset = mobj->spriteyoffset = 0;
|
||||
|
||||
// Funni slam sound when landing
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
// set subsector and/or block links
|
||||
P_SetThingPosition(mobj);
|
||||
I_Assert(mobj->subsector != NULL);
|
||||
@@ -10771,6 +10772,16 @@ 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];
|
||||
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;
|
||||
p->playerstate = PST_LIVE;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
// We need the WAD data structure for Map things, from the THINGS lump.
|
||||
#include "doomdata.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
// States are tied to finite states are tied to animation frames.
|
||||
// Needs precompiled tables/data structures.
|
||||
@@ -326,6 +327,8 @@ typedef struct mobj_s
|
||||
UINT16 eflags; // extra flags
|
||||
|
||||
void *skin; // overrides 'sprite' when non-NULL (for player bodies to 'remember' the skin)
|
||||
void *localskin;
|
||||
boolean skinlocal;
|
||||
// Player and mobj sprites in multiplayer modes are modified
|
||||
// using an internal color lookup table for re-indexing.
|
||||
UINT8 color; // This replaces MF_TRANSLATION. Use 0 for default (no translation).
|
||||
@@ -394,6 +397,16 @@ typedef struct mobj_s
|
||||
boolean colorized; // Whether the mobj uses the rainbow colormap
|
||||
boolean rollmodel; // OpenGL: Should this model rotate?
|
||||
|
||||
tic_t slamsoundtimer;
|
||||
|
||||
// saltyhop! hardcode edition
|
||||
boolean salty_ready;
|
||||
boolean salty_tapping;
|
||||
fixed_t salty_zoffset;
|
||||
fixed_t salty_momz;
|
||||
boolean salty_jump;
|
||||
boolean init_salty;
|
||||
|
||||
// WARNING: New fields must be added separately to savegame and Lua.
|
||||
} mobj_t;
|
||||
|
||||
|
||||
@@ -1984,6 +1984,7 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
||||
mobj->spritexscale = mobj->spriteyscale = mobj->old_spritexscale = mobj->old_spriteyscale = FRACUNIT;
|
||||
mobj->realxscale = mobj->realyscale = FRACUNIT;
|
||||
mobj->stretchslam = 0;
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
mobj->sloperoll = mobj->reservezangle = mobj->reservexydir = 0;
|
||||
|
||||
|
||||
+10
-5
@@ -3433,7 +3433,7 @@ boolean P_RunSOC(const char *socfilename)
|
||||
lumpnum_t lump;
|
||||
|
||||
if (strstr(socfilename, ".soc") != NULL)
|
||||
return P_AddWadFile(socfilename);
|
||||
return P_AddWadFile(socfilename, false);
|
||||
|
||||
lump = W_CheckNumForName(socfilename);
|
||||
if (lump == LUMPERROR)
|
||||
@@ -3449,11 +3449,11 @@ boolean P_RunSOC(const char *socfilename)
|
||||
// Add a wadfile to the active wad files,
|
||||
// replace sounds, musics, patches, textures, sprites and maps
|
||||
//
|
||||
boolean P_AddWadFile(const char *wadfilename)
|
||||
boolean P_AddWadFile(const char *wadfilename, boolean local)
|
||||
{
|
||||
UINT16 wadnum;
|
||||
|
||||
if ((wadnum = P_PartialAddWadFile(wadfilename, false)) == UINT16_MAX)
|
||||
if ((wadnum = P_PartialAddWadFile(wadfilename, local)) == UINT16_MAX)
|
||||
return false;
|
||||
|
||||
P_MultiSetupWadFiles(true);
|
||||
@@ -3483,7 +3483,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
boolean mapsadded = false;
|
||||
lumpinfo_t *lumpinfo;
|
||||
|
||||
if ((numlumps = W_InitFile(wadfilename, local)) == INT16_MAX)
|
||||
if ((numlumps = W_InitFile(wadfilename, 0, &wadnum, local)) == INT16_MAX)
|
||||
{
|
||||
refreshdirmenu |= REFRESHDIR_NOTLOADED;
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
|
||||
@@ -3493,6 +3493,11 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
|
||||
if (wadfiles[wadnum]->important)
|
||||
partadd_important = true;
|
||||
|
||||
if (local)
|
||||
wadfiles[wadnum]->localfile = true;
|
||||
else
|
||||
wadfiles[wadnum]->localfile = false;
|
||||
|
||||
//
|
||||
// search for sound replacements
|
||||
@@ -3545,7 +3550,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
//
|
||||
// look for skins
|
||||
//
|
||||
R_AddSkins(wadnum); // faB: wadfile index in wadfiles[]
|
||||
R_AddSkins(wadnum, local); // faB: wadfile index in wadfiles[]
|
||||
|
||||
//
|
||||
// edit music defs
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
||||
#endif
|
||||
void P_LoadThingsOnly(void);
|
||||
boolean P_SetupLevel(boolean skipprecip);
|
||||
boolean P_AddWadFile(const char *wadfilename);
|
||||
boolean P_AddWadFile(const char *wadfilename, boolean local);
|
||||
boolean P_AddWadFileLocal(const char *wadfilename);
|
||||
#ifdef DELFILE
|
||||
boolean P_DelWadFile(void);
|
||||
|
||||
+17
-6
@@ -1278,13 +1278,13 @@ void P_RestoreMusic(player_t *player)
|
||||
}
|
||||
|
||||
// Item - Grow
|
||||
if (wantedmus == 2)
|
||||
if (wantedmus == 2 && cv_growmusic.value)
|
||||
{
|
||||
S_ChangeMusicInternal("kgrow", true);
|
||||
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
|
||||
}
|
||||
// Item - Invincibility
|
||||
else if (wantedmus == 1)
|
||||
else if (wantedmus == 1 && cv_supermusic.value)
|
||||
{
|
||||
S_ChangeMusicInternal("kinvnc", true);
|
||||
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
|
||||
@@ -1696,6 +1696,8 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||
|
||||
ghost->fuse = ghost->info->damage;
|
||||
ghost->skin = mobj->skin;
|
||||
ghost->localskin = mobj->localskin;
|
||||
ghost->skinlocal = mobj->skinlocal;
|
||||
|
||||
if (mobj->flags2 & MF2_OBJECTFLIP)
|
||||
ghost->flags |= MF2_OBJECTFLIP;
|
||||
@@ -1737,10 +1739,19 @@ void P_DoPlayerExit(player_t *player)
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
sfxenum_t sfx_id;
|
||||
if (K_IsPlayerLosing(player))
|
||||
sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_klose].skinsound];
|
||||
else
|
||||
sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_kwin].skinsound];
|
||||
// fix godjjsa win sounds
|
||||
if (K_IsPlayerLosing(player)) {
|
||||
if (player->mo->localskin)
|
||||
sfx_id = ((skin_t *)player->mo->localskin)->soundsid[S_sfx[sfx_klose].skinsound];
|
||||
else
|
||||
sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_klose].skinsound];
|
||||
}
|
||||
else {
|
||||
if (player->mo->localskin)
|
||||
sfx_id = ((skin_t *)player->mo->localskin)->soundsid[S_sfx[sfx_kwin].skinsound];
|
||||
else
|
||||
sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_kwin].skinsound];
|
||||
}
|
||||
S_StartSound(NULL, sfx_id);
|
||||
}
|
||||
else
|
||||
|
||||
+13
-5
@@ -26,6 +26,10 @@
|
||||
#include "v_video.h" // pLocalPalette
|
||||
#include "dehacked.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32) || defined (_WIN32_WCE)
|
||||
#include <malloc.h> // alloca(sizeof)
|
||||
#endif
|
||||
@@ -1137,6 +1141,10 @@ void R_ClearColormaps(void)
|
||||
foundcolormaps[i] = LUMPERROR;
|
||||
|
||||
memset(extra_colormaps, 0, sizeof (extra_colormaps));
|
||||
|
||||
#ifdef HWRENDER
|
||||
HWR_ClearLightTableCache();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*INT32 R_ColormapNumForName(char *name)
|
||||
@@ -1316,13 +1324,13 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||
extra_colormaps[mapnum].fadestart = (UINT16)fadestart;
|
||||
extra_colormaps[mapnum].fadeend = (UINT16)fadeend;
|
||||
extra_colormaps[mapnum].fog = fog;
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
|
||||
if (rendermode == render_soft || rendermode == render_opengl)
|
||||
{
|
||||
double r, g, b, cbrightness;
|
||||
int p;
|
||||
lighttable_t *colormap_p;
|
||||
|
||||
|
||||
// Initialise the map and delta arrays
|
||||
// map[i] stores an RGB color (as double) for index i,
|
||||
// which is then converted to SRB2's palette later
|
||||
@@ -1402,7 +1410,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (INT32)mapnum;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,6 +104,4 @@ UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
||||
|
||||
extern INT32 numtextures;
|
||||
|
||||
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
||||
|
||||
#endif
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
// We rely on the thinker data struct to handle sound origins in sectors.
|
||||
#include "d_think.h"
|
||||
|
||||
// SECTORS do store MObjs anyway.
|
||||
#include "p_mobj.h"
|
||||
|
||||
@@ -62,6 +63,12 @@ typedef struct
|
||||
INT32 fadergba; // The colour the colourmaps fade to
|
||||
|
||||
lighttable_t *colormap;
|
||||
|
||||
|
||||
#ifdef HWRENDER
|
||||
// The id of the hardware lighttable. Zero means it does not exist yet.
|
||||
UINT32 gl_lighttable_id;
|
||||
#endif
|
||||
} extracolormap_t;
|
||||
|
||||
//
|
||||
|
||||
+43
-14
@@ -18,6 +18,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "r_local.h"
|
||||
#include "r_things.h"
|
||||
#include "st_stuff.h" // need ST_HEIGHT
|
||||
#include "i_video.h"
|
||||
#include "v_video.h"
|
||||
@@ -141,6 +142,7 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
|
||||
#define NUM_PALETTE_ENTRIES 256
|
||||
|
||||
static UINT8** translationtablecache[TT_CACHE_SIZE] = {NULL};
|
||||
static UINT8** localtranslationtablecache[MAXSKINS] = {NULL};
|
||||
|
||||
|
||||
// See also the enum skincolors_t
|
||||
@@ -519,29 +521,39 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
|
||||
|
||||
\return Colormap. If not cached, caller should Z_Free.
|
||||
*/
|
||||
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
static UINT8* RGetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags, boolean local)
|
||||
{
|
||||
UINT8 ***tt;
|
||||
UINT8* ret;
|
||||
INT32 skintableindex;
|
||||
|
||||
// Adjust if we want the default colormap
|
||||
if (skinnum == TC_DEFAULT) skintableindex = DEFAULT_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BOSS) skintableindex = BOSS_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX;
|
||||
else skintableindex = skinnum;
|
||||
if (local)
|
||||
{
|
||||
tt = localtranslationtablecache;
|
||||
skintableindex = skinnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
tt = translationtablecache;
|
||||
// Adjust if we want the default colormap
|
||||
if (skinnum == TC_DEFAULT) skintableindex = DEFAULT_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BOSS) skintableindex = BOSS_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX;
|
||||
else skintableindex = skinnum;
|
||||
}
|
||||
|
||||
if (flags & GTC_CACHE)
|
||||
{
|
||||
|
||||
// Allocate table for skin if necessary
|
||||
if (!translationtablecache[skintableindex])
|
||||
translationtablecache[skintableindex] = Z_Calloc(MAXTRANSLATIONS * sizeof(UINT8**), PU_STATIC, NULL);
|
||||
if (!tt[skintableindex])
|
||||
tt[skintableindex] = Z_Calloc(MAXTRANSLATIONS * sizeof(UINT8**), PU_STATIC, NULL);
|
||||
|
||||
// Get colormap
|
||||
ret = translationtablecache[skintableindex][color];
|
||||
ret = tt[skintableindex][color];
|
||||
}
|
||||
else ret = NULL;
|
||||
|
||||
@@ -549,16 +561,29 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
if (!ret)
|
||||
{
|
||||
ret = Z_MallocAlign(NUM_PALETTE_ENTRIES, (flags & GTC_CACHE) ? PU_LEVEL : PU_STATIC, NULL, 8);
|
||||
K_GenerateKartColormap(ret, skinnum, color); //R_GenerateTranslationColormap(ret, skinnum, color); // SRB2kart
|
||||
K_GenerateKartColormap(ret, skinnum, color, local); //R_GenerateTranslationColormap(ret, skinnum, color); // SRB2kart
|
||||
|
||||
// Cache the colormap if desired
|
||||
if (flags & GTC_CACHE)
|
||||
translationtablecache[skintableindex][color] = ret;
|
||||
tt[skintableindex][color] = ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
{
|
||||
return RGetTranslationColormap(skinnum, color, flags, false);
|
||||
}
|
||||
|
||||
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local)
|
||||
{
|
||||
if (localskin)
|
||||
return RGetTranslationColormap(( localskin - ( (local) ? localskins : skins ) ), color, flags, local);
|
||||
else
|
||||
return RGetTranslationColormap(( skin - skins ), color, flags, false);
|
||||
}
|
||||
|
||||
/** \brief Flushes cache of translation colormaps.
|
||||
|
||||
Flushes cache of translation colormaps, but doesn't actually free the
|
||||
@@ -574,6 +599,10 @@ void R_FlushTranslationColormapCache(void)
|
||||
for (i = 0; i < (INT32)(sizeof(translationtablecache) / sizeof(translationtablecache[0])); i++)
|
||||
if (translationtablecache[i])
|
||||
memset(translationtablecache[i], 0, MAXTRANSLATIONS * sizeof(UINT8**));
|
||||
|
||||
for (i = 0; i < (INT32)(sizeof(localtranslationtablecache) / sizeof(localtranslationtablecache[0])); i++)
|
||||
if (localtranslationtablecache[i])
|
||||
memset(localtranslationtablecache[i], 0, MAXTRANSLATIONS * sizeof(UINT8**));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define __R_DRAW__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "r_things.h"
|
||||
|
||||
// -------------------------------
|
||||
// COMMON STUFF FOR 8bpp AND 16bpp
|
||||
@@ -115,6 +116,7 @@ extern lumpnum_t viewborderlump[8];
|
||||
// Initialize color translation tables, for player rendering etc.
|
||||
void R_InitTranslationTables(void);
|
||||
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags);
|
||||
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local);
|
||||
void R_FlushTranslationColormapCache(void);
|
||||
UINT8 R_GetColorByName(const char *name);
|
||||
|
||||
|
||||
+13
-8
@@ -298,8 +298,8 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
|
||||
// Sprite offsets are not interpolated until we have a way to interpolate them explicitly in Lua.
|
||||
// It seems existing mods visually break more often than not if it is interpolated.
|
||||
out->spritexoffset = mobj->spritexoffset;
|
||||
out->spriteyoffset = mobj->spriteyoffset;
|
||||
//out->spritexoffset = mobj->spritexoffset;
|
||||
//out->spriteyoffset = mobj->spriteyoffset;
|
||||
|
||||
out->subsector = R_PointInSubsector(out->x, out->y);
|
||||
|
||||
@@ -357,11 +357,12 @@ static void AddInterpolator(levelinterpolator_t* interpolator)
|
||||
levelinterpolators_size *= 2;
|
||||
}
|
||||
|
||||
levelinterpolators = Z_Realloc(
|
||||
levelinterpolators = Z_ReallocAlign(
|
||||
(void*) levelinterpolators,
|
||||
sizeof(levelinterpolator_t*) * levelinterpolators_size,
|
||||
PU_LEVEL,
|
||||
NULL
|
||||
NULL,
|
||||
sizeof(levelinterpolator_t*) * 8
|
||||
);
|
||||
}
|
||||
|
||||
@@ -371,8 +372,11 @@ static void AddInterpolator(levelinterpolator_t* interpolator)
|
||||
|
||||
static levelinterpolator_t *CreateInterpolator(levelinterpolator_type_e type, thinker_t *thinker)
|
||||
{
|
||||
levelinterpolator_t *ret = (levelinterpolator_t*) Z_Calloc(
|
||||
sizeof(levelinterpolator_t), PU_LEVEL, NULL
|
||||
levelinterpolator_t *ret = (levelinterpolator_t*) Z_CallocAlign(
|
||||
sizeof(levelinterpolator_t),
|
||||
PU_LEVEL,
|
||||
NULL,
|
||||
sizeof(levelinterpolator_t) * 8
|
||||
);
|
||||
|
||||
ret->type = type;
|
||||
@@ -687,11 +691,12 @@ void R_AddMobjInterpolator(mobj_t *mobj)
|
||||
interpolated_mobjs_capacity *= 2;
|
||||
}
|
||||
|
||||
interpolated_mobjs = Z_Realloc(
|
||||
interpolated_mobjs = Z_ReallocAlign(
|
||||
interpolated_mobjs,
|
||||
sizeof(mobj_t *) * interpolated_mobjs_capacity,
|
||||
PU_LEVEL,
|
||||
NULL
|
||||
NULL,
|
||||
64
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ static CV_PossibleValue_t drawdist_cons_t[] = {
|
||||
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
|
||||
{256, "256"}, {512, "512"}, {768, "768"},
|
||||
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
||||
{3072, "3072"}, {4096, "4096"},
|
||||
{0, "None"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t fov_cons_t[] = {{5*FRACUNIT, "MIN"}, {178*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
@@ -438,6 +439,60 @@ fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1)
|
||||
return FixedHypot(px1 - px2, py1 - py2);
|
||||
}
|
||||
|
||||
angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
{
|
||||
mobj_t *mo = player->mo;
|
||||
|
||||
if (!cv_sliptideroll.value || !mo || P_MobjWasRemoved(mo)) return 0;
|
||||
|
||||
size_t rot = mo->frame&FF_FRAMEMASK;
|
||||
boolean papersprite = (mo->frame & FF_PAPERSPRITE);
|
||||
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
// Yes.
|
||||
if (R_UsingFrameInterpolation() && !paused)
|
||||
{
|
||||
R_InterpolateMobjState(mo, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(mo, FRACUNIT, &interp);
|
||||
}
|
||||
|
||||
if (mo->skin && mo->sprite == SPR_PLAY)
|
||||
{
|
||||
sprdef = &((skin_t *)mo->skin)->spritedef;
|
||||
|
||||
if (rot >= sprdef->numframes)
|
||||
sprdef = &sprites[mo->sprite];
|
||||
}
|
||||
else
|
||||
{
|
||||
sprdef = &sprites[mo->sprite];
|
||||
}
|
||||
|
||||
if (rot >= sprdef->numframes)
|
||||
{
|
||||
sprdef = &sprites[states[S_UNKNOWN].sprite];
|
||||
rot = states[S_UNKNOWN].frame&FF_FRAMEMASK;
|
||||
}
|
||||
|
||||
sprframe = &sprdef->spriteframes[rot];
|
||||
|
||||
// No sprite frame? I guess it is possible
|
||||
if (!sprframe) return 0;
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite)
|
||||
ang = R_PointToAngle(interp.x, interp.y) - interp.angle;
|
||||
|
||||
return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mo->player->sliproll*(mo->player->sliptidemem));
|
||||
}
|
||||
|
||||
// Little extra utility. Works in the same way as R_PointToAngle2
|
||||
fixed_t R_PointToDist(fixed_t x, fixed_t y)
|
||||
{
|
||||
@@ -1954,6 +2009,8 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_grshearing);
|
||||
CV_RegisterVar(&cv_grshaders);
|
||||
CV_RegisterVar(&cv_grusecustomshaders);
|
||||
CV_RegisterVar(&cv_grpaletteshader);
|
||||
CV_RegisterVar(&cv_grflashpal);
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
@@ -73,6 +73,7 @@ angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1);
|
||||
fixed_t R_PointToDist(fixed_t x, fixed_t y);
|
||||
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PlayerSliptideAngle(player_t *player);
|
||||
|
||||
fixed_t R_ScaleFromGlobalAngle(angle_t visangle);
|
||||
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
|
||||
|
||||
+1018
-1102
File diff suppressed because it is too large.
Load diff
+68
-69
@@ -1,69 +1,68 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 2018-2019 by Jaime "Lactozilla" Passos.
|
||||
// Copyright (C) 2019 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_patch.h
|
||||
/// \brief Patch generation.
|
||||
|
||||
#ifndef __R_PATCH__
|
||||
#define __R_PATCH__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "doomdef.h"
|
||||
|
||||
// Structs
|
||||
typedef enum
|
||||
{
|
||||
ROTAXIS_X, // Roll (the default)
|
||||
ROTAXIS_Y, // Pitch
|
||||
ROTAXIS_Z // Yaw
|
||||
} rotaxis_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT32 x, y;
|
||||
rotaxis_t rotaxis;
|
||||
} spriteframepivot_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
spriteframepivot_t pivot[64];
|
||||
boolean available;
|
||||
} spriteinfo_t;
|
||||
|
||||
// Conversions between patches / flats / textures...
|
||||
boolean R_CheckIfPatch(lumpnum_t lump);
|
||||
void R_TextureToFlat(size_t tex, UINT8 *flat);
|
||||
void R_PatchToFlat(patch_t *patch, UINT8 *flat);
|
||||
void R_PatchToMaskedFlat(patch_t *patch, UINT16 *raw, boolean flip);
|
||||
patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize, boolean transparency);
|
||||
patch_t *R_MaskedFlatToPatch(UINT16 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize);
|
||||
|
||||
// SpriteInfo
|
||||
extern spriteinfo_t spriteinfo[NUMSPRITES];
|
||||
void R_LoadSpriteInfoLumps(UINT16 wadnum, UINT16 numlumps);
|
||||
void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
|
||||
|
||||
// Sprite rotation
|
||||
#ifdef ROTSPRITE
|
||||
INT32 R_GetRollAngle(angle_t rollangle);
|
||||
patch_t *Patch_GetRotatedSprite(
|
||||
spriteframe_t *sprite,
|
||||
size_t frame, size_t spriteangle,
|
||||
boolean flip, void *info,
|
||||
INT32 rotationangle);
|
||||
rotsprite_t *RotatedPatch_Create(INT32 numangles);
|
||||
void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle, INT32 xpivot, INT32 ypivot, UINT8 flip);
|
||||
//void R_FreeSkinRotSprite(size_t skinnum);
|
||||
extern fixed_t rollcosang[ROTANGLES];
|
||||
extern fixed_t rollsinang[ROTANGLES];
|
||||
void R_FreeAllRotSprite(void);
|
||||
#endif
|
||||
|
||||
#endif // __R_PATCH__
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 2018-2019 by Jaime "Lactozilla" Passos.
|
||||
// Copyright (C) 2019 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_patch.h
|
||||
/// \brief Patch generation.
|
||||
|
||||
#ifndef __R_PATCH__
|
||||
#define __R_PATCH__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "doomdef.h"
|
||||
|
||||
// Structs
|
||||
typedef enum
|
||||
{
|
||||
ROTAXIS_X, // Roll (the default)
|
||||
ROTAXIS_Y, // Pitch
|
||||
ROTAXIS_Z // Yaw
|
||||
} rotaxis_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT32 x, y;
|
||||
rotaxis_t rotaxis;
|
||||
} spriteframepivot_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
spriteframepivot_t pivot[64];
|
||||
boolean available;
|
||||
} spriteinfo_t;
|
||||
|
||||
// Conversions between patches / flats / textures...
|
||||
boolean R_CheckIfPatch(lumpnum_t lump);
|
||||
void R_TextureToFlat(size_t tex, UINT8 *flat);
|
||||
void R_PatchToFlat(patch_t *patch, UINT8 *flat);
|
||||
void R_PatchToMaskedFlat(patch_t *patch, UINT16 *raw, boolean flip);
|
||||
patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize, boolean transparency);
|
||||
patch_t *R_MaskedFlatToPatch(UINT16 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize);
|
||||
|
||||
// SpriteInfo
|
||||
extern spriteinfo_t spriteinfo[NUMSPRITES];
|
||||
void R_LoadSpriteInfoLumps(UINT16 wadnum, UINT16 numlumps);
|
||||
void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
|
||||
|
||||
// Sprite rotation
|
||||
#ifdef ROTSPRITE
|
||||
INT32 R_GetRollAngle(angle_t rollangle);
|
||||
patch_t *Patch_GetRotatedSprite(
|
||||
spriteframe_t *sprite,
|
||||
size_t frame, size_t spriteangle,
|
||||
boolean flip, boolean adjustfeet,
|
||||
void *info, INT32 rotationangle);
|
||||
rotsprite_t *RotatedPatch_Create(INT32 numangles);
|
||||
void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle, INT32 xpivot, INT32 ypivot, boolean flip);
|
||||
|
||||
extern fixed_t rollcosang[ROTANGLES];
|
||||
extern fixed_t rollsinang[ROTANGLES];
|
||||
#endif
|
||||
|
||||
#endif // __R_PATCH__
|
||||
@@ -1769,6 +1769,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
while (need > maxopenings);
|
||||
openings = Z_Realloc(openings, maxopenings * sizeof (*openings), PU_STATIC, NULL);
|
||||
lastopening = openings + pos;
|
||||
|
||||
if (oldopenings == NULL)
|
||||
return;
|
||||
|
||||
// borrowed fix from *cough* zdoom *cough*
|
||||
// [RH] We also need to adjust the openings pointers that
|
||||
|
||||
+183
-50
@@ -643,7 +643,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++)
|
||||
R_AddSkins((UINT16)i);
|
||||
R_AddSkins((UINT16)i, false);
|
||||
|
||||
//
|
||||
// check if all sprites have frames
|
||||
@@ -851,6 +851,15 @@ 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
|
||||
if (vis->startfrac < 0 || vis->startfrac > (patch->width << FRACBITS))
|
||||
{
|
||||
// never draw vissprites with startfrac out of patch range
|
||||
return;
|
||||
}
|
||||
|
||||
colfunc = basecolfunc; // hack: this isn't resetting properly somewhere.
|
||||
dc_colormap = vis->colormap;
|
||||
@@ -872,10 +881,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
if (vis->mobj->colorized)
|
||||
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
|
||||
else if (vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // MT_GHOST LOOKS LIKE A PLAYER SO USE THE PLAYER TRANSLATION TABLES. >_>
|
||||
{
|
||||
size_t skinnum = (skin_t*)vis->mobj->skin-skins;
|
||||
dc_translation = R_GetTranslationColormap((INT32)skinnum, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
dc_translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
|
||||
else // Use the defaults
|
||||
dc_translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
@@ -893,10 +899,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
if (vis->mobj->colorized)
|
||||
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
|
||||
else if (vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // This thing is a player!
|
||||
{
|
||||
size_t skinnum = (skin_t*)vis->mobj->skin-skins;
|
||||
dc_translation = R_GetTranslationColormap((INT32)skinnum, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
dc_translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
|
||||
else // Use the defaults
|
||||
dc_translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
@@ -925,7 +928,9 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
frac = vis->startfrac;
|
||||
windowtop = windowbottom = sprbotscreen = INT32_MAX;
|
||||
|
||||
if (vis->mobj->skin && ((skin_t *)vis->mobj->skin)->flags & SF_HIRES)
|
||||
if (vis->mobj->localskin && ((skin_t *)vis->mobj->localskin)->flags & SF_HIRES)
|
||||
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;
|
||||
@@ -1274,7 +1279,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if (thing->skin && thing->sprite == SPR_PLAY)
|
||||
{
|
||||
sprdef = &((skin_t *)thing->skin)->spritedef;
|
||||
sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef;
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[thing->sprite];
|
||||
#endif
|
||||
@@ -1348,7 +1353,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
|
||||
I_Assert(lump < max_spritelumps);
|
||||
|
||||
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||
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)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)thing->skin)->highresscale);
|
||||
|
||||
spr_width = spritecachedinfo[lump].width;
|
||||
@@ -1373,7 +1380,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
rollsum = (thing->rollangle) + (thing->sloperoll);
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, sprinfo, rollangle);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
@@ -1796,17 +1803,6 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
return;
|
||||
}
|
||||
|
||||
// okay, we can't return now except for vertical clipping... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!(thing->precipflags & PCF_THUNK))
|
||||
{
|
||||
if (thing->precipflags & PCF_RAIN)
|
||||
P_RainThinker(thing);
|
||||
else
|
||||
P_SnowThinker(thing);
|
||||
thing->precipflags |= PCF_THUNK;
|
||||
}
|
||||
|
||||
|
||||
//SoM: 3/17/2000: Disregard sprites that are out of view..
|
||||
gzt = interp.z + spritecachedinfo[lump].topoffset;
|
||||
gz = gzt - spritecachedinfo[lump].height;
|
||||
@@ -1814,7 +1810,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
if (thing->subsector->sector->cullheight)
|
||||
{
|
||||
if (R_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, viewz, gz, gzt))
|
||||
return;
|
||||
goto weatherthink;
|
||||
}
|
||||
|
||||
// store information in a vissprite
|
||||
@@ -1878,6 +1874,18 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
vis->precip = true;
|
||||
vis->vflip = false;
|
||||
vis->isScaled = false;
|
||||
|
||||
weatherthink:
|
||||
// okay... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!(thing->precipflags & PCF_THUNK))
|
||||
{
|
||||
if (thing->precipflags & PCF_RAIN)
|
||||
P_RainThinker(thing);
|
||||
else
|
||||
P_SnowThinker(thing);
|
||||
thing->precipflags |= PCF_THUNK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// R_AddSprites
|
||||
@@ -2783,6 +2791,8 @@ void R_DrawMasked(void)
|
||||
// ==========================================================================
|
||||
|
||||
INT32 numskins = 0;
|
||||
INT32 numallskins = 0;
|
||||
INT32 numlocalskins = 0;
|
||||
skin_t skins[MAXSKINS];
|
||||
UINT8 skinstats[9][9][MAXSKINS];
|
||||
UINT8 skinstatscount[9][9] = {
|
||||
@@ -2797,13 +2807,16 @@ UINT8 skinstatscount[9][9] = {
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
UINT8 skinsorted[MAXSKINS];
|
||||
skin_t localskins[MAXSKINS];
|
||||
skin_t allskins[MAXSKINS*2];
|
||||
// FIXTHIS: don't work because it must be inistilised before the config load
|
||||
//#define SKINVALUES
|
||||
#ifdef SKINVALUES
|
||||
CV_PossibleValue_t skin_cons_t[MAXSKINS+1];
|
||||
CV_PossibleValue_t localskin_cons_t[MAXSKINS+1];
|
||||
#endif
|
||||
|
||||
static void Sk_SetDefaultValue(skin_t *skin)
|
||||
static void Sk_SetDefaultValue(skin_t *skin, boolean local)
|
||||
{
|
||||
INT32 i;
|
||||
//
|
||||
@@ -2811,7 +2824,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
|
||||
//
|
||||
memset(skin, 0, sizeof (skin_t));
|
||||
snprintf(skin->name,
|
||||
sizeof skin->name, "skin %u", (UINT32)(skin-skins));
|
||||
sizeof skin->name, "skin %u", (UINT32)(skin-( (local) ? localskins : skins )));
|
||||
skin->name[sizeof skin->name - 1] = '\0';
|
||||
skin->wadnum = INT16_MAX;
|
||||
strcpy(skin->sprite, "");
|
||||
@@ -2852,13 +2865,15 @@ void R_InitSkins(void)
|
||||
{
|
||||
skin_cons_t[i].value = 0;
|
||||
skin_cons_t[i].strvalue = NULL;
|
||||
localskin_cons_t[i].value = 0;
|
||||
localskin_cons_t[i].strvalue = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
// skin[0] = Sonic skin
|
||||
skin = &skins[0];
|
||||
numskins = 1;
|
||||
Sk_SetDefaultValue(skin);
|
||||
Sk_SetDefaultValue(skin, false);
|
||||
memset(skinstats, 0, sizeof(skinstats));
|
||||
memset(skinsorted, 0, sizeof(skinsorted));
|
||||
|
||||
@@ -2874,7 +2889,10 @@ void R_InitSkins(void)
|
||||
strncpy(skin->facerank, "PLAYRANK", 9);
|
||||
strncpy(skin->facewant, "PLAYWANT", 9);
|
||||
strncpy(skin->facemmap, "PLAYMMAP", 9);
|
||||
skin->wadnum = 0; // god what have you brought to this world
|
||||
skin->prefcolor = SKINCOLOR_BLUE;
|
||||
skin->localskin = false;
|
||||
skin->localnum = 0;
|
||||
|
||||
// SRB2kart
|
||||
skin->kartspeed = 8;
|
||||
@@ -2892,8 +2910,12 @@ void R_InitSkins(void)
|
||||
//MD2 for sonic doesn't want to load in Linux.
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_AddPlayerMD2(0);
|
||||
HWR_AddPlayerMD2(0, false);
|
||||
#endif
|
||||
|
||||
// lets set it
|
||||
allskins[0] = skins[0];
|
||||
numallskins = 1;
|
||||
}
|
||||
|
||||
// returns true if the skin name is found (loaded from pwad)
|
||||
@@ -2910,6 +2932,37 @@ INT32 R_SkinAvailable(const char *name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// returns true if the skin name is found (loaded from pwad)
|
||||
// warning return -1 if not found
|
||||
INT32 R_AnySkinAvailable(const char *name)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < numallskins; i++)
|
||||
{
|
||||
if (stricmp(allskins[i].name,name)==0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
INT32 R_LocalSkinAvailable(const char *name, boolean local)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
if (local)
|
||||
{
|
||||
for (i = 0; i < numlocalskins; i++)
|
||||
{
|
||||
if (stricmp(localskins[i].name,name)==0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return R_SkinAvailable(name);
|
||||
}
|
||||
|
||||
// network code calls this when a 'skin change' is received
|
||||
boolean SetPlayerSkin(INT32 playernum, const char *skinname)
|
||||
{
|
||||
@@ -2935,6 +2988,67 @@ boolean SetPlayerSkin(INT32 playernum, const char *skinname)
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
|
||||
{
|
||||
player_t *player = &players[playernum];
|
||||
INT32 i;
|
||||
|
||||
if (strcasecmp(skinname, "none"))
|
||||
{
|
||||
for (i = 0; i < numlocalskins; i++)
|
||||
{
|
||||
// search in the skin list
|
||||
if (stricmp(localskins[i].name, skinname) == 0)
|
||||
{
|
||||
player->localskin = 1 + i;
|
||||
player->skinlocal = true;
|
||||
if (player->mo)
|
||||
{
|
||||
player->mo->localskin = &localskins[i];
|
||||
player->mo->skinlocal = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < numskins; i++)
|
||||
{
|
||||
// search in the skin list
|
||||
if (stricmp(skins[i].name, skinname) == 0)
|
||||
{
|
||||
player->localskin = 1 + i;
|
||||
player->skinlocal = false;
|
||||
if (player->mo)
|
||||
{
|
||||
player->mo->localskin = &skins[i];
|
||||
player->mo->skinlocal = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player->localskin = 0;
|
||||
player->skinlocal = false;
|
||||
if (player->mo)
|
||||
{
|
||||
player->mo->localskin = 0;
|
||||
player->mo->skinlocal = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (cvar != NULL) {
|
||||
if (player->localskin > 0) {
|
||||
CV_StealthSet(&cv_fakelocalskin, ( (player->skinlocal) ? localskins : skins )[player->localskin - 1].name);
|
||||
CV_StealthSet(cvar, ( (player->skinlocal) ? localskins : skins )[player->localskin - 1].name);
|
||||
}
|
||||
else {
|
||||
CV_StealthSet(&cv_fakelocalskin, "none");
|
||||
CV_StealthSet(cvar, "none");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Same as SetPlayerSkin, but uses the skin #.
|
||||
// network code calls this when a 'skin change' is received
|
||||
void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
||||
@@ -3119,7 +3233,7 @@ void sortSkinGrid(void)
|
||||
//
|
||||
// Find skin sprites, sounds & optional status bar face, & add them
|
||||
//
|
||||
void R_AddSkins(UINT16 wadnum)
|
||||
void R_AddSkins(UINT16 wadnum, boolean local)
|
||||
{
|
||||
UINT16 lump, lastlump = 0;
|
||||
char *buf;
|
||||
@@ -3139,7 +3253,7 @@ void R_AddSkins(UINT16 wadnum)
|
||||
// advance by default
|
||||
lastlump = lump + 1;
|
||||
|
||||
if (numskins >= MAXSKINS)
|
||||
if (( (local) ? numlocalskins : 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
|
||||
@@ -3155,8 +3269,8 @@ void R_AddSkins(UINT16 wadnum)
|
||||
buf2[size] = '\0';
|
||||
|
||||
// set defaults
|
||||
skin = &skins[numskins];
|
||||
Sk_SetDefaultValue(skin);
|
||||
skin = &( (local) ? localskins : skins )[( (local) ? numlocalskins : numskins )];
|
||||
Sk_SetDefaultValue(skin, local);
|
||||
skin->wadnum = wadnum;
|
||||
hudname = realname = false;
|
||||
// parse
|
||||
@@ -3180,7 +3294,7 @@ void R_AddSkins(UINT16 wadnum)
|
||||
// the skin name must uniquely identify a single skin
|
||||
// I'm lazy so if name is already used I leave the 'skin x'
|
||||
// default skin name set in Sk_SetDefaultValue
|
||||
if (R_SkinAvailable(value) == -1)
|
||||
if (R_LocalSkinAvailable(value, local) == -1)
|
||||
{
|
||||
STRBUFCPY(skin->name, value);
|
||||
strlwr(skin->name);
|
||||
@@ -3190,12 +3304,12 @@ void R_AddSkins(UINT16 wadnum)
|
||||
else
|
||||
{
|
||||
const size_t stringspace =
|
||||
strlen(value) + sizeof (numskins) + 1;
|
||||
strlen(value) + sizeof (( (local) ? numlocalskins : numskins )) + 1;
|
||||
char *value2 = Z_Malloc(stringspace, PU_STATIC, NULL);
|
||||
snprintf(value2, stringspace,
|
||||
"%s%d", value, numskins);
|
||||
"%s%d", value, ( (local) ? numlocalskins : numskins ));
|
||||
value2[stringspace - 1] = '\0';
|
||||
if (R_SkinAvailable(value2) == -1)
|
||||
if (R_LocalSkinAvailable(value2, local) == -1)
|
||||
{
|
||||
STRBUFCPY(skin->name,
|
||||
value2);
|
||||
@@ -3378,29 +3492,48 @@ next_token:
|
||||
|
||||
CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name);
|
||||
#ifdef SKINVALUES
|
||||
skin_cons_t[numskins].value = numskins;
|
||||
skin_cons_t[numskins].strvalue = skin->name;
|
||||
( (local) ? localskin_cons_t : skin_cons_t )[( (local) ? numlocalskins : numskins )].value = ( (local) ? numlocalskins : numskins );
|
||||
( (local) ? localskin_cons_t : skin_cons_t )[( (local) ? numlocalskins : numskins )].strvalue = skin->name;
|
||||
#endif
|
||||
|
||||
// Update the forceskin possiblevalues
|
||||
Forceskin_cons_t[numskins+1].value = numskins;
|
||||
Forceskin_cons_t[numskins+1].strvalue = skins[numskins].name;
|
||||
if (!local)
|
||||
{
|
||||
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
|
||||
if (local)
|
||||
skin->localnum = numlocalskins;
|
||||
else
|
||||
skin->localnum = numskins;
|
||||
|
||||
// add face graphics
|
||||
ST_LoadFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, numskins);
|
||||
if (local) {
|
||||
ST_LoadLocalFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, numlocalskins);
|
||||
} else {
|
||||
ST_LoadFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, numskins);
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_AddPlayerMD2(numskins);
|
||||
HWR_AddPlayerMD2(( (local) ? numlocalskins : numskins ), local);
|
||||
#endif
|
||||
skinstats[skin->kartspeed-1][skin->kartweight-1][skinstatscount[skin->kartspeed-1][skin->kartweight-1]] = numskins;
|
||||
CONS_Debug(DBG_SETUP, M_GetText("Added %d to %d, %d\n"), numskins, skin->kartweight, skin->kartweight);
|
||||
skinstatscount[skin->kartspeed-1][skin->kartweight-1]++;
|
||||
CONS_Debug(DBG_SETUP, M_GetText("Incremented %d, %d to %d\n"), skin->kartspeed, skin->kartweight, skinstatscount[skin->kartspeed - 1][skin->kartweight - 1]);
|
||||
if (!local) {
|
||||
skinstats[skin->kartspeed-1][skin->kartweight-1][skinstatscount[skin->kartspeed-1][skin->kartweight-1]] = numskins;
|
||||
CONS_Debug(DBG_SETUP, M_GetText("Added %d to %d, %d\n"), numskins, skin->kartweight, skin->kartweight);
|
||||
skinstatscount[skin->kartspeed-1][skin->kartweight-1]++;
|
||||
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 )];
|
||||
|
||||
skinsorted[numskins] = numskins;
|
||||
|
||||
numskins++;
|
||||
( (local) ? numlocalskins++ : numskins++ );
|
||||
numallskins++;
|
||||
}
|
||||
|
||||
sortSkinGrid();
|
||||
|
||||
+11
-8
@@ -97,6 +97,9 @@ typedef struct
|
||||
|
||||
// specific sounds per skin
|
||||
sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table
|
||||
|
||||
boolean localskin;
|
||||
INT32 localnum;
|
||||
} skin_t;
|
||||
|
||||
extern CV_PossibleValue_t Forceskin_cons_t[];
|
||||
@@ -138,11 +141,6 @@ typedef struct vissprite_s
|
||||
|
||||
angle_t centerangle; // for paper sprites
|
||||
|
||||
struct {
|
||||
fixed_t tan; // The amount to shear the sprite vertically per row
|
||||
INT32 offset; // The center of the shearing location offset from x1
|
||||
} shear;
|
||||
|
||||
fixed_t texturemid;
|
||||
patch_t *patch;
|
||||
|
||||
@@ -157,8 +155,6 @@ typedef struct vissprite_s
|
||||
|
||||
extracolormap_t *extra_colormap; // global colormaps
|
||||
|
||||
//fixed_t xscale;
|
||||
|
||||
// Precalculated top and bottom screen coords for the sprite.
|
||||
fixed_t thingheight; // The actual height of the thing (for 3D floors)
|
||||
sector_t *sector; // The sector containing the thing.
|
||||
@@ -206,17 +202,24 @@ typedef struct drawnode_s
|
||||
} drawnode_t;
|
||||
|
||||
extern INT32 numskins;
|
||||
extern INT32 numlocalskins;
|
||||
extern INT32 numallskins;
|
||||
extern skin_t skins[MAXSKINS];
|
||||
extern UINT8 skinstats[9][9][MAXSKINS];
|
||||
extern UINT8 skinstatscount[9][9];
|
||||
extern UINT8 skinsorted[MAXSKINS];
|
||||
|
||||
void sortSkinGrid(void);
|
||||
extern skin_t localskins[MAXSKINS];
|
||||
extern skin_t allskins[MAXSKINS*2];
|
||||
|
||||
boolean SetPlayerSkin(INT32 playernum,const char *skinname);
|
||||
void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
|
||||
void SetLocalPlayerSkin(INT32 playernum,const char *skinname, consvar_t *cvar);
|
||||
INT32 R_SkinAvailable(const char *name);
|
||||
void R_AddSkins(UINT16 wadnum);
|
||||
INT32 R_AnySkinAvailable(const char *name);
|
||||
INT32 R_LocalSkinAvailable(const char *name, boolean local);
|
||||
void R_AddSkins(UINT16 wadnum, boolean local);
|
||||
|
||||
#ifdef DELFILE
|
||||
void R_DelSkins(UINT16 wadnum);
|
||||
|
||||
+62
-18
@@ -54,6 +54,7 @@ static void SetChannelsNum(void);
|
||||
static void Command_Tunes_f(void);
|
||||
static void Command_RestartAudio_f(void);
|
||||
static void Command_RestartMusic_f(void); //mhhhm amiga type filters here i come uwu
|
||||
static void Command_ShowMusicCredit_f(void);
|
||||
|
||||
// Sound system toggles
|
||||
#ifndef NO_MIDI
|
||||
@@ -154,7 +155,7 @@ consvar_t cv_amigafilter = {"amigafilter", "1", CV_SAVE|CV_CALL, amigafilter_con
|
||||
|
||||
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
|
||||
static CV_PossibleValue_t amigatype_cons_t[] = {{0, "auto"}, {1, "a500"}, {2, "a1200"}, {0, NULL}};
|
||||
consvar_t cv_amigatype = {"amigatype", "0", CV_SAVE|CV_CALL, amigatype_cons_t, AmigaType_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_amigatype = {"amigatype", "0", CV_SAVE|CV_CALL|CV_NOINIT, amigatype_cons_t, AmigaType_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -322,6 +323,7 @@ void S_RegisterSoundStuff(void)
|
||||
COM_AddCommand("tunes", Command_Tunes_f);
|
||||
COM_AddCommand("restartaudio", Command_RestartAudio_f);
|
||||
COM_AddCommand("restartmusic", Command_RestartMusic_f);
|
||||
COM_AddCommand("showmusiccredit", Command_ShowMusicCredit_f);
|
||||
|
||||
|
||||
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
|
||||
@@ -576,7 +578,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
if (sfx->skinsound != -1 && origin && origin->skin)
|
||||
{
|
||||
// redirect player sound to the sound in the skin table
|
||||
sfx_id = ((skin_t *)origin->skin)->soundsid[sfx->skinsound];
|
||||
sfx_id = ((skin_t *)( (origin->localskin) ? origin->localskin : origin->skin ))->soundsid[sfx->skinsound];
|
||||
sfx = &S_sfx[sfx_id];
|
||||
}
|
||||
|
||||
@@ -1514,6 +1516,32 @@ void S_InitMusicDefs(void)
|
||||
S_LoadMusicDefs(i);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// S_FindMusicCredit
|
||||
//
|
||||
// Returns musicdef of specified song, or null if musicdef for it doesn't exist
|
||||
//
|
||||
musicdef_t *S_FindMusicCredit(const char *musname)
|
||||
{
|
||||
musicdef_t *def = musicdefstart;
|
||||
|
||||
if (!def) // No definitions
|
||||
return NULL;
|
||||
|
||||
while (def)
|
||||
{
|
||||
if (!stricmp(def->name, musname))
|
||||
{
|
||||
return def;
|
||||
}
|
||||
else
|
||||
def = def->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// S_ShowSpecifiedMusicCredit
|
||||
//
|
||||
@@ -1521,26 +1549,21 @@ void S_InitMusicDefs(void)
|
||||
//
|
||||
void S_ShowSpecifiedMusicCredit(const char *musname)
|
||||
{
|
||||
musicdef_t *def = musicdefstart;
|
||||
musicdef_t *def;
|
||||
|
||||
if (digital_disabled) return;
|
||||
|
||||
if (!cv_songcredits.value || demo.rewinding)
|
||||
return;
|
||||
|
||||
if (!def) // No definitions
|
||||
return;
|
||||
def = S_FindMusicCredit(musname);
|
||||
|
||||
while (def)
|
||||
if (def)
|
||||
{
|
||||
if (!stricmp(def->name, musname))
|
||||
{
|
||||
cursongcredit.def = def;
|
||||
cursongcredit.anim = 5*TICRATE;
|
||||
cursongcredit.x = 0;
|
||||
cursongcredit.trans = NUMTRANSMAPS;
|
||||
return;
|
||||
}
|
||||
else
|
||||
def = def->next;
|
||||
cursongcredit.def = def;
|
||||
cursongcredit.anim = 5*TICRATE;
|
||||
cursongcredit.x = 0;
|
||||
cursongcredit.trans = NUMTRANSMAPS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2175,6 +2198,26 @@ static void Command_RestartMusic_f(void) //same as RestartAudio but only music g
|
||||
S_RestartMusic();
|
||||
}
|
||||
|
||||
static void Command_ShowMusicCredit_f(void)
|
||||
{
|
||||
const char *musname = music_name;
|
||||
|
||||
if (COM_Argc() > 1)
|
||||
{
|
||||
musname = COM_Argv(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
S_ShowMusicCredit();
|
||||
}
|
||||
|
||||
musicdef_t *def = S_FindMusicCredit(musname);
|
||||
|
||||
if (def) {
|
||||
CONS_Printf("%.6s - %.255s\n", musname, def->source);
|
||||
}
|
||||
}
|
||||
|
||||
void GameSounds_OnChange(void)
|
||||
{
|
||||
if (M_CheckParm("-nosound") || M_CheckParm("-noaudio"))
|
||||
@@ -2257,9 +2300,10 @@ void AmigaFilter_OnChange(void)
|
||||
void AmigaType_OnChange(void)
|
||||
{
|
||||
if (openmpt_mhandle)
|
||||
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigatype.string);
|
||||
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga_type", cv_amigatype.string);
|
||||
|
||||
S_RestartMusic(); //need to restart the music system or else it wont work
|
||||
if (sound_started)
|
||||
S_RestartMusic(); //need to restart the music system or else it wont work
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -172,6 +172,7 @@ extern musicdef_t *musicdefstart;
|
||||
|
||||
void S_LoadMusicDefs(UINT16 wadnum);
|
||||
void S_InitMusicDefs(void);
|
||||
musicdef_t *S_FindMusicCredit(const char *musname);
|
||||
void S_ShowSpecifiedMusicCredit(const char *musname);
|
||||
void S_ShowMusicCredit(void);
|
||||
|
||||
|
||||
+4
-2
@@ -137,10 +137,12 @@ void SCR_SetMode(void)
|
||||
{
|
||||
if (R_MMX)
|
||||
{
|
||||
colfunc = basecolfunc = R_DrawColumn_8_MMX;
|
||||
//colfunc = basecolfunc = R_DrawColumn_8_MMX; Can we please not use this function it seems to break sometimes????
|
||||
colfunc = basecolfunc = R_DrawColumn_8_ASM;
|
||||
//shadecolfunc = R_DrawShadeColumn_8_ASM;
|
||||
//fuzzcolfunc = R_DrawTranslucentColumn_8_ASM;
|
||||
walldrawerfunc = R_DrawWallColumn_8_MMX;
|
||||
//walldrawerfunc = R_DrawWallColumn_8_MMX; This is just an alias to R_DrawColumn_8_MMX
|
||||
walldrawerfunc = R_DrawWallColumn_8_ASM;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_MMX;
|
||||
spanfunc = basespanfunc = R_DrawSpan_8_MMX;
|
||||
}
|
||||
|
||||
@@ -113,6 +113,9 @@ void *hwSym(const char *funcName,void *handle)
|
||||
|
||||
GETFUNC(StartBatching);
|
||||
GETFUNC(RenderBatches);
|
||||
|
||||
GETFUNC(AddLightTable);
|
||||
GETFUNC(ClearLightTableCache);
|
||||
|
||||
#else //HWRENDER
|
||||
if (0 == strcmp("FinishUpdate", funcName))
|
||||
|
||||
+6
-7
@@ -3806,8 +3806,7 @@ static long get_entry(const char* name, const char* buf)
|
||||
}
|
||||
#endif
|
||||
|
||||
// quick fix for compil
|
||||
UINT32 I_GetFreeMem(UINT32 *total)
|
||||
size_t I_GetFreeMem(size_t *total)
|
||||
{
|
||||
#ifdef FREEBSD
|
||||
struct vmmeter sum;
|
||||
@@ -3855,8 +3854,8 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
||||
info.dwLength = sizeof (MEMORYSTATUS);
|
||||
GlobalMemoryStatus( &info );
|
||||
if (total)
|
||||
*total = (UINT32)info.dwTotalPhys;
|
||||
return (UINT32)info.dwAvailPhys;
|
||||
*total = (size_t)info.dwTotalPhys;
|
||||
return (size_t)info.dwAvailPhys;
|
||||
#elif defined (__OS2__)
|
||||
UINT32 pr_arena;
|
||||
|
||||
@@ -3871,8 +3870,8 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
||||
/* Linux */
|
||||
char buf[1024];
|
||||
char *memTag;
|
||||
UINT32 freeKBytes;
|
||||
UINT32 totalKBytes;
|
||||
size_t freeKBytes;
|
||||
size_t totalKBytes;
|
||||
INT32 n;
|
||||
INT32 meminfo_fd = -1;
|
||||
long Cached;
|
||||
@@ -3903,7 +3902,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
||||
}
|
||||
|
||||
memTag += sizeof (MEMTOTAL);
|
||||
totalKBytes = atoi(memTag);
|
||||
totalKBytes = (size_t)atoi(memTag);
|
||||
|
||||
if ((memTag = strstr(buf, MEMAVAILABLE)) == NULL)
|
||||
{
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#endif
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../p_setup.h"
|
||||
#include "../i_system.h"
|
||||
#include "../v_video.h"
|
||||
#include "../m_argv.h"
|
||||
@@ -969,6 +970,7 @@ static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint
|
||||
void I_GetEvent(void)
|
||||
{
|
||||
SDL_Event evt;
|
||||
char* dropped_filedir;
|
||||
// We only want the first motion event,
|
||||
// otherwise we'll end up catching the warp back to center.
|
||||
//int mouseMotionOnce = 0;
|
||||
@@ -1293,6 +1295,11 @@ void I_GetEvent(void)
|
||||
if (currentMenu == &OP_JoystickSetDef)
|
||||
M_SetupJoystickMenu(0);
|
||||
break;
|
||||
case SDL_DROPFILE:
|
||||
dropped_filedir = evt.drop.file;
|
||||
P_AddWadFile(dropped_filedir, false);
|
||||
SDL_free(dropped_filedir); // Free dropped_filedir memory
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
I_Quit();
|
||||
M_QuitResponse('y');
|
||||
@@ -2059,8 +2066,13 @@ void I_StartupGraphics(void)
|
||||
#endif
|
||||
if (rendermode == render_none)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
rendermode = render_opengl;
|
||||
CONS_Printf("Defaulting to OpenGL renderer.\n");
|
||||
#else
|
||||
rendermode = render_soft;
|
||||
CONS_Printf("Using default software renderer.\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2136,6 +2148,9 @@ void I_StartupGraphics(void)
|
||||
|
||||
HWD.pfnStartBatching = hwSym("StartBatching",NULL);
|
||||
HWD.pfnRenderBatches = hwSym("RenderBatches",NULL);
|
||||
|
||||
HWD.pfnAddLightTable = hwSym("AddLightTable",NULL);
|
||||
HWD.pfnClearLightTableCache = hwSym("ClearLightTableCache",NULL);
|
||||
|
||||
if (!HWD.pfnInit()) // load the OpenGL library
|
||||
rendermode = render_soft;
|
||||
|
||||
@@ -121,12 +121,11 @@ static UINT16 current_track;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
static openmpt_module *mod = 0;
|
||||
int mod_err = OPENMPT_ERROR_OK;
|
||||
static int mod_err = OPENMPT_ERROR_OK;
|
||||
static const char *mod_err_str;
|
||||
static UINT16 current_subsong;
|
||||
size_t probesize;
|
||||
int result;
|
||||
static size_t probesize;
|
||||
static int result;
|
||||
#endif
|
||||
|
||||
static void var_cleanup(void)
|
||||
@@ -1137,7 +1136,7 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
/*
|
||||
If the size of the data to be checked is bigger than the recommended size (> 2048)
|
||||
If the size of the data to be checked is bigger than the recommended size (> 2048 bytes)
|
||||
Let's just set the probe size to the recommended size
|
||||
Otherwise let's give it the full data size
|
||||
*/
|
||||
@@ -1421,6 +1420,8 @@ boolean I_SetSongTrack(int track)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
if (I_SongType() == MU_MOD)
|
||||
return !Mix_SetMusicPosition(track);
|
||||
(void)track;
|
||||
return false;
|
||||
}
|
||||
|
||||
+45
-6
@@ -58,6 +58,18 @@ patch_t *facerankprefix[MAXSKINS]; // ranking
|
||||
patch_t *facewantprefix[MAXSKINS]; // wanted
|
||||
patch_t *facemmapprefix[MAXSKINS]; // minimap
|
||||
|
||||
patch_t *localfacerankprefix[MAXSKINS]; // ranking
|
||||
patch_t *localfacewantprefix[MAXSKINS]; // wanted
|
||||
patch_t *localfacemmapprefix[MAXSKINS]; // minimap
|
||||
|
||||
char *facerankprefix_name[MAXSKINS]; // ranking
|
||||
char *facewantprefix_name[MAXSKINS]; // wanted
|
||||
char *facemmapprefix_name[MAXSKINS]; // minimap
|
||||
|
||||
char *localfacerankprefix_name[MAXSKINS]; // ranking
|
||||
char *localfacewantprefix_name[MAXSKINS]; // wanted
|
||||
char *localfacemmapprefix_name[MAXSKINS]; // minimap
|
||||
|
||||
// ------------------------------------------
|
||||
// status bar overlay
|
||||
// ------------------------------------------
|
||||
@@ -232,18 +244,22 @@ void ST_doPaletteStuff(void)
|
||||
else
|
||||
palette = 0;
|
||||
|
||||
palette = min(max(palette, 0), 13);
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
if (rendermode == render_opengl && !cv_grpaletteshader.value || rendermode == render_opengl && cv_grpaletteshader.value && !cv_grflashpal.value)
|
||||
palette = 0; // No flashpals here in OpenGL
|
||||
#endif
|
||||
|
||||
palette = min(max(palette, 0), 13);
|
||||
|
||||
if (palette != st_palette)
|
||||
{
|
||||
st_palette = palette;
|
||||
|
||||
if (rendermode == render_soft)
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_none && cv_grpaletteshader.value && cv_grflashpal.value)
|
||||
#else
|
||||
if (rendermode != render_none)
|
||||
#endif
|
||||
{
|
||||
//V_SetPaletteLump(GetPalette()); // Reset the palette -- is this needed?
|
||||
if (!splitscreen)
|
||||
@@ -378,6 +394,25 @@ void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 skin
|
||||
facerankprefix[skinnum] = W_CachePatchName(rankstr, PU_HUDGFX);
|
||||
facewantprefix[skinnum] = W_CachePatchName(wantstr, PU_HUDGFX);
|
||||
facemmapprefix[skinnum] = W_CachePatchName(mmapstr, PU_HUDGFX);
|
||||
|
||||
facerankprefix_name[skinnum] = rankstr;
|
||||
facewantprefix_name[skinnum] = wantstr;
|
||||
facemmapprefix_name[skinnum] = mmapstr;
|
||||
}
|
||||
|
||||
void ST_LoadLocalFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 skinnum)
|
||||
{
|
||||
localfacerankprefix[skinnum] = W_CachePatchName(rankstr, PU_HUDGFX);
|
||||
localfacewantprefix[skinnum] = W_CachePatchName(wantstr, PU_HUDGFX);
|
||||
localfacemmapprefix[skinnum] = W_CachePatchName(mmapstr, PU_HUDGFX);
|
||||
|
||||
localfacerankprefix_name[skinnum] = rankstr;
|
||||
localfacewantprefix_name[skinnum] = wantstr;
|
||||
localfacemmapprefix_name[skinnum] = mmapstr;
|
||||
|
||||
//CONS_Printf("Added rank prefix %s\n", rankstr);
|
||||
//CONS_Printf("Added want prefix %s\n", wantstr);
|
||||
//CONS_Printf("Added mmap prefix %s\n", mmapstr);
|
||||
}
|
||||
|
||||
void ST_ReloadSkinFaceGraphics(void)
|
||||
@@ -386,6 +421,10 @@ void ST_ReloadSkinFaceGraphics(void)
|
||||
|
||||
for (i = 0; i < numskins; i++)
|
||||
ST_LoadFaceGraphics(skins[i].facerank, skins[i].facewant, skins[i].facemmap, i);
|
||||
|
||||
for (i = 0; i < numlocalskins; i++) {
|
||||
ST_LoadLocalFaceGraphics(localskins[i].facerank, localskins[i].facewant, localskins[i].facemmap, i);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ST_InitData(void)
|
||||
@@ -2167,9 +2206,9 @@ void ST_Drawer(void)
|
||||
//25/08/99: Hurdler: palette changes is done for all players,
|
||||
// not only player1! That's why this part
|
||||
// of code is moved somewhere else.
|
||||
if (rendermode == render_soft)
|
||||
if (rendermode == render_soft || rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value)
|
||||
#endif
|
||||
if (rendermode != render_none) ST_doPaletteStuff();
|
||||
if (rendermode != render_none) ST_doPaletteStuff();
|
||||
|
||||
if (st_overlay)
|
||||
{
|
||||
|
||||
@@ -51,6 +51,7 @@ void ST_LoadGraphics(void);
|
||||
|
||||
// face load graphics, called when skin changes
|
||||
void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 playernum);
|
||||
void ST_LoadLocalFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 playernum);
|
||||
void ST_ReloadSkinFaceGraphics(void);
|
||||
#ifdef DELFILE
|
||||
void ST_UnLoadFaceGraphics(INT32 skinnum);
|
||||
@@ -78,6 +79,15 @@ extern patch_t *sboperiod;
|
||||
extern patch_t *facerankprefix[MAXSKINS]; // ranking
|
||||
extern patch_t *facewantprefix[MAXSKINS]; // wanted
|
||||
extern patch_t *facemmapprefix[MAXSKINS]; // minimap
|
||||
extern patch_t *localfacerankprefix[MAXSKINS]; // ranking
|
||||
extern patch_t *localfacewantprefix[MAXSKINS]; // wanted
|
||||
extern patch_t *localfacemmapprefix[MAXSKINS]; // minimap
|
||||
extern char *facerankprefix_name[MAXSKINS]; // ranking
|
||||
extern char *facewantprefix_name[MAXSKINS]; // wanted
|
||||
extern char *facemmapprefix_name[MAXSKINS]; // minimap
|
||||
extern char *localfacerankprefix_name[MAXSKINS]; // ranking
|
||||
extern char *localfacewantprefix_name[MAXSKINS]; // wanted
|
||||
extern char *localfacemmapprefix_name[MAXSKINS]; // minimap
|
||||
extern patch_t *livesback;
|
||||
extern patch_t *ngradeletters[7];
|
||||
|
||||
|
||||
+308
-5
@@ -28,6 +28,7 @@
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#include "hardware/r_opengl/r_opengl.h"
|
||||
#endif
|
||||
|
||||
// Each screen is [vid.width*vid.height];
|
||||
@@ -73,7 +74,7 @@ consvar_t cv_grgammablue = {"gr_gammablue", "127", CV_SAVE|CV_CALL, grgamma_cons
|
||||
|
||||
//static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}};
|
||||
// console variables in development
|
||||
consvar_t cv_grmdls = {"gr_mdls", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grmdls = {"gr_mdls", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grshearing = {"gr_shearing", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -224,8 +225,17 @@ void V_SetPalette(INT32 palettenum)
|
||||
LoadMapPalette();
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
HWR_SetPalette(&pLocalPalette[palettenum*256]);
|
||||
if (rendermode != render_soft && rendermode != render_none) {
|
||||
// in palette rendering mode, we already manage our palette ourselves
|
||||
if (cv_grpaletteshader.value == 1)
|
||||
{
|
||||
// reset our palette lookups n shit
|
||||
gl_palette_initialized = false;
|
||||
InitPalette(palettenum, true);
|
||||
}
|
||||
else
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
}
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
else
|
||||
#endif
|
||||
@@ -238,8 +248,16 @@ void V_SetPaletteLump(const char *pal)
|
||||
{
|
||||
LoadPalette(pal);
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
if (rendermode != render_soft && rendermode != render_none) {
|
||||
if (cv_grpaletteshader.value == 1)
|
||||
{
|
||||
// reset our palette lookups n shit
|
||||
gl_palette_initialized = false;
|
||||
InitPalette(0, false);
|
||||
}
|
||||
else
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
}
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
else
|
||||
#endif
|
||||
@@ -1770,6 +1788,12 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
x -= V_SmallStringWidth(string, option)/2;
|
||||
V_DrawSmallString(x, y, option, string);
|
||||
}
|
||||
|
||||
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
x -= V_SmallStringWidth(string, option);
|
||||
@@ -1983,6 +2007,102 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
}
|
||||
}
|
||||
|
||||
// Jaden: awesome!
|
||||
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
fixed_t cx = x, cy = y;
|
||||
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
INT32 spacewidth = 2, charwidth = 0;
|
||||
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
||||
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
scrwidth -= left;
|
||||
}
|
||||
if (option & V_NOSCALEPATCH)
|
||||
scrwidth *= vid.dupx;
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
case V_MONOSPACE:
|
||||
spacewidth = 4;
|
||||
/* FALLTHRU */
|
||||
case V_OLDSPACING:
|
||||
charwidth = 4;
|
||||
break;
|
||||
case V_6WIDTHSPACE:
|
||||
spacewidth = 3;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!*ch)
|
||||
break;
|
||||
if (*ch & 0x80) //color parsing -x 2.16.09
|
||||
{
|
||||
// manually set flags override color codes
|
||||
if (!(option & V_CHARCOLORMASK))
|
||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
continue;
|
||||
}
|
||||
if (*ch == '\n')
|
||||
{
|
||||
cx = x;
|
||||
if (option & V_RETURN8)
|
||||
cy += (4*dupy)<<FRACBITS;
|
||||
else
|
||||
cy += (6*dupy)<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
c = *ch;
|
||||
if (!lowercase)
|
||||
c = toupper(c);
|
||||
c -= HU_FONTSTART;
|
||||
// character does not exist or is a space
|
||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
||||
{
|
||||
cx += (spacewidth * dupx)<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
if (charwidth)
|
||||
{
|
||||
w = charwidth * dupx;
|
||||
center = w/2 - hu_font[c]->width*(dupx/4);
|
||||
}
|
||||
else
|
||||
w = hu_font[c]->width * dupx / 2;
|
||||
if ((cx>>FRACBITS) > scrwidth)
|
||||
break;
|
||||
if ((cx>>FRACBITS)+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
colormap = V_GetStringColormap(charflags);
|
||||
V_DrawFixedPatch(cx + (center<<FRACBITS), cy, FRACUNIT/2, option, hu_font[c], colormap);
|
||||
cx += w<<FRACBITS;
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
x -= (V_SmallStringWidth(string, option) / 2)<<FRACBITS;
|
||||
V_DrawSmallStringAtFixed(x, y, option, string);
|
||||
}
|
||||
|
||||
// Draws a tallnum. Replaces two functions in y_inter and st_stuff
|
||||
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num)
|
||||
{
|
||||
@@ -2053,6 +2173,28 @@ INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *color
|
||||
return x;
|
||||
}
|
||||
|
||||
// Jaden: Draw a number using the position numbers.
|
||||
//
|
||||
void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const UINT8 *colormap)
|
||||
{
|
||||
INT32 w = SHORT(ranknum[0]->width) - 1;
|
||||
|
||||
if (flags & V_NOSCALESTART)
|
||||
w *= vid.dupx;
|
||||
|
||||
if (num < 0)
|
||||
num = -num;
|
||||
|
||||
// draw the number
|
||||
do
|
||||
{
|
||||
x -= (w - 1);
|
||||
|
||||
V_DrawFixedPatch(x << FRACBITS, y << FRACBITS, FRACUNIT, flags, ranknum[num % 10], colormap);
|
||||
num /= 10;
|
||||
} while (--digits);
|
||||
}
|
||||
|
||||
// Write a string using the credit font
|
||||
// NOTE: the text is centered for screens larger than the base width
|
||||
//
|
||||
@@ -2347,6 +2489,167 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
|
||||
return w;
|
||||
}
|
||||
|
||||
char V_GetSkincolorChar(INT32 color)
|
||||
{
|
||||
char cstart = 0x80;
|
||||
|
||||
switch (color)
|
||||
{
|
||||
case SKINCOLOR_WHITE:
|
||||
case SKINCOLOR_SILVER:
|
||||
case SKINCOLOR_SLATE:
|
||||
cstart = 0x80; // White
|
||||
break;
|
||||
|
||||
case SKINCOLOR_GREY:
|
||||
case SKINCOLOR_NICKEL:
|
||||
case SKINCOLOR_BLACK:
|
||||
case SKINCOLOR_SKUNK:
|
||||
case SKINCOLOR_JET:
|
||||
cstart = 0x86; // V_GRAYMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_SEPIA:
|
||||
case SKINCOLOR_BEIGE:
|
||||
case SKINCOLOR_WALNUT:
|
||||
case SKINCOLOR_BROWN:
|
||||
case SKINCOLOR_LEATHER:
|
||||
case SKINCOLOR_RUST:
|
||||
case SKINCOLOR_WRISTWATCH:
|
||||
cstart = 0x8e; // V_BROWNMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_FAIRY:
|
||||
case SKINCOLOR_SALMON:
|
||||
case SKINCOLOR_PINK:
|
||||
case SKINCOLOR_ROSE:
|
||||
case SKINCOLOR_BRICK:
|
||||
case SKINCOLOR_LEMONADE:
|
||||
case SKINCOLOR_BUBBLEGUM:
|
||||
case SKINCOLOR_LILAC:
|
||||
cstart = 0x8d; // V_PINKMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_CINNAMON:
|
||||
case SKINCOLOR_RUBY:
|
||||
case SKINCOLOR_RASPBERRY:
|
||||
case SKINCOLOR_CHERRY:
|
||||
case SKINCOLOR_RED:
|
||||
case SKINCOLOR_CRIMSON:
|
||||
case SKINCOLOR_MAROON:
|
||||
case SKINCOLOR_FLAME:
|
||||
case SKINCOLOR_SCARLET:
|
||||
case SKINCOLOR_KETCHUP:
|
||||
cstart = 0x85; // V_REDMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_DAWN:
|
||||
case SKINCOLOR_SUNSET:
|
||||
case SKINCOLOR_CREAMSICLE:
|
||||
case SKINCOLOR_ORANGE:
|
||||
case SKINCOLOR_PUMPKIN:
|
||||
case SKINCOLOR_ROSEWOOD:
|
||||
case SKINCOLOR_BURGUNDY:
|
||||
case SKINCOLOR_TANGERINE:
|
||||
cstart = 0x87; // V_ORANGEMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_PEACH:
|
||||
case SKINCOLOR_CARAMEL:
|
||||
case SKINCOLOR_CREAM:
|
||||
cstart = 0x8f; // V_PEACHMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_GOLD:
|
||||
case SKINCOLOR_ROYAL:
|
||||
case SKINCOLOR_BRONZE:
|
||||
case SKINCOLOR_COPPER:
|
||||
case SKINCOLOR_THUNDER:
|
||||
cstart = 0x8a; // V_GOLDMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_POPCORN:
|
||||
case SKINCOLOR_QUARRY:
|
||||
case SKINCOLOR_YELLOW:
|
||||
case SKINCOLOR_MUSTARD:
|
||||
case SKINCOLOR_CROCODILE:
|
||||
case SKINCOLOR_OLIVE:
|
||||
cstart = 0x82; // V_YELLOWMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_ARTICHOKE:
|
||||
case SKINCOLOR_VOMIT:
|
||||
case SKINCOLOR_GARDEN:
|
||||
case SKINCOLOR_TEA:
|
||||
case SKINCOLOR_PISTACHIO:
|
||||
cstart = 0x8b; // V_TEAMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_LIME:
|
||||
case SKINCOLOR_HANDHELD:
|
||||
case SKINCOLOR_MOSS:
|
||||
case SKINCOLOR_CAMOUFLAGE:
|
||||
case SKINCOLOR_ROBOHOOD:
|
||||
case SKINCOLOR_MINT:
|
||||
case SKINCOLOR_GREEN:
|
||||
case SKINCOLOR_PINETREE:
|
||||
case SKINCOLOR_EMERALD:
|
||||
case SKINCOLOR_SWAMP:
|
||||
case SKINCOLOR_DREAM:
|
||||
case SKINCOLOR_PLAGUE:
|
||||
case SKINCOLOR_ALGAE:
|
||||
cstart = 0x83; // V_GREENMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_CARIBBEAN:
|
||||
case SKINCOLOR_AZURE:
|
||||
case SKINCOLOR_AQUA:
|
||||
case SKINCOLOR_TEAL:
|
||||
case SKINCOLOR_CYAN:
|
||||
case SKINCOLOR_JAWZ:
|
||||
case SKINCOLOR_CERULEAN:
|
||||
case SKINCOLOR_NAVY:
|
||||
case SKINCOLOR_SAPPHIRE:
|
||||
cstart = 0x88; // V_SKYMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_PIGEON:
|
||||
case SKINCOLOR_PLATINUM:
|
||||
case SKINCOLOR_STEEL:
|
||||
cstart = 0x8c; // V_STEELMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_PERIWINKLE:
|
||||
case SKINCOLOR_BLUE:
|
||||
case SKINCOLOR_BLUEBERRY:
|
||||
case SKINCOLOR_NOVA:
|
||||
cstart = 0x84; // V_BLUEMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_ULTRAVIOLET:
|
||||
case SKINCOLOR_PURPLE:
|
||||
case SKINCOLOR_FUCHSIA:
|
||||
cstart = 0x81; // V_PURPLEMAP
|
||||
break;
|
||||
|
||||
case SKINCOLOR_PASTEL:
|
||||
case SKINCOLOR_MOONSLAM:
|
||||
case SKINCOLOR_DUSK:
|
||||
case SKINCOLOR_TOXIC:
|
||||
case SKINCOLOR_MAUVE:
|
||||
case SKINCOLOR_LAVENDER:
|
||||
case SKINCOLOR_BYZANTIUM:
|
||||
case SKINCOLOR_POMEGRANATE:
|
||||
cstart = 0x89; // V_LAVENDERMAP
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return cstart;
|
||||
}
|
||||
|
||||
boolean *heatshifter = NULL;
|
||||
INT32 lastheight = 0;
|
||||
INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
|
||||
|
||||
@@ -191,6 +191,7 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string
|
||||
|
||||
// draw a string using the hu_font, 0.5x scale
|
||||
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the tny_font
|
||||
@@ -200,6 +201,9 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st
|
||||
|
||||
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
// Draw tall nums, used for menu, HUD, intermission
|
||||
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);
|
||||
void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits);
|
||||
@@ -212,6 +216,9 @@ INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *color
|
||||
INT32 V_LevelNameWidth(const char *string);
|
||||
INT32 V_LevelNameHeight(const char *string);
|
||||
|
||||
// Rank numbers.
|
||||
void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const UINT8 *colormap);
|
||||
|
||||
void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
INT32 V_CreditStringWidth(const char *string);
|
||||
|
||||
@@ -222,6 +229,8 @@ INT32 V_SmallStringWidth(const char *string, INT32 option);
|
||||
// Find string width from tny_font chars
|
||||
INT32 V_ThinStringWidth(const char *string, INT32 option);
|
||||
|
||||
char V_GetSkincolorChar(INT32 color);
|
||||
|
||||
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
|
||||
|
||||
void V_DrawPatchFill(patch_t *pat);
|
||||
|
||||
+50
-9
@@ -65,6 +65,7 @@
|
||||
#include "i_system.h"
|
||||
#include "md5.h"
|
||||
#include "lua_script.h"
|
||||
#include "st_stuff.h"
|
||||
#ifdef SCANTHINGS
|
||||
#include "p_setup.h" // P_ScanThings
|
||||
#endif
|
||||
@@ -148,6 +149,40 @@ void W_Shutdown(void)
|
||||
|
||||
static char filenamebuf[MAX_WADPATH];
|
||||
|
||||
// This #if is copied from filesrch.c, so not sure if it is 100% suitable for
|
||||
// this
|
||||
#if defined (_WIN32) && !defined (_XBOX)
|
||||
//#define WIN32_LEAN_AND_MEAN
|
||||
#define RPC_NO_WINDOWS_H
|
||||
#include <windows.h>
|
||||
|
||||
// Windows can't open utf-8 path so it must be converted to utf-16
|
||||
FILE* fopen_utf8(const char* filename, const char* mode)
|
||||
{
|
||||
static const int MY_PATH_MAX = 2048;
|
||||
WCHAR nameW[MY_PATH_MAX];
|
||||
memset(nameW, 0, sizeof(WCHAR)*MY_PATH_MAX);
|
||||
WCHAR modeW[16];
|
||||
memset(modeW, 0, sizeof(WCHAR)*16);
|
||||
// the following function converts the UTF-8 filename to UTF-16 (WCHAR) nameW
|
||||
int len = MultiByteToWideChar(CP_UTF8, 0, filename, -1, nameW, MY_PATH_MAX);
|
||||
if(len > 0 && MultiByteToWideChar(CP_UTF8, 0, mode, -1, modeW, 16) > 0)
|
||||
{
|
||||
// using _wfopen_s() shuts up MSVC's complaints
|
||||
// about _wfopen() being unsafe..
|
||||
FILE* ret = NULL;
|
||||
if(_wfopen_s(&ret, nameW, modeW) == 0)
|
||||
return ret;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define fopen_utf8 fopen
|
||||
|
||||
#endif
|
||||
|
||||
// W_OpenWadFile
|
||||
// Helper function for opening the WAD file.
|
||||
// Returns the FILE * handle for the file, or NULL if not found or could not be opened
|
||||
@@ -165,7 +200,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
|
||||
*filename = filenamebuf;
|
||||
|
||||
// open wad file
|
||||
if ((handle = fopen(*filename, "rb")) == NULL)
|
||||
if ((handle = fopen_utf8(*filename, "rb")) == NULL)
|
||||
{
|
||||
// If we failed to load the file with the path as specified by
|
||||
// the user, strip the directories and search for the file.
|
||||
@@ -175,7 +210,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
|
||||
// in filenamebuf == *filename.
|
||||
if (findfile(filenamebuf, NULL, true))
|
||||
{
|
||||
if ((handle = fopen(*filename, "rb")) == NULL)
|
||||
if ((handle = fopen_utf8(*filename, "rb")) == NULL)
|
||||
{
|
||||
if (useerrors)
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Can't open %s\n"), *filename);
|
||||
@@ -690,7 +725,7 @@ static void W_ReadFileShaders(wadfile_t *wadfile)
|
||||
//
|
||||
// Can now load dehacked files (.soc)
|
||||
//
|
||||
UINT16 W_InitFile(const char *filename, boolean local)
|
||||
UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, boolean local)
|
||||
{
|
||||
FILE *handle;
|
||||
lumpinfo_t *lumpinfo = NULL;
|
||||
@@ -743,10 +778,13 @@ UINT16 W_InitFile(const char *filename, boolean local)
|
||||
{
|
||||
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||
if (handle)
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
if (!local) {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||
if (handle)
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
}
|
||||
CONS_Alert(CONS_WARNING, M_GetText("%s is a local skin that is already loaded\n"), filename);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -789,6 +827,7 @@ UINT16 W_InitFile(const char *filename, boolean local)
|
||||
fseek(handle, 0, SEEK_END);
|
||||
wadfile->filesize = (unsigned)ftell(handle);
|
||||
wadfile->type = type;
|
||||
wadfile->majormod = false;
|
||||
|
||||
// already generated, just copy it over
|
||||
M_Memcpy(&wadfile->md5sum, &md5sum, 16);
|
||||
@@ -898,7 +937,7 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons)
|
||||
G_SetGameModified(true, false);
|
||||
|
||||
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
||||
rc = W_InitFile(*filenames, false);
|
||||
rc = W_InitFile(*filenames, 0, 0, false);
|
||||
if (rc == INT16_MAX)
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames);
|
||||
overallrc &= (rc != INT16_MAX) ? 1 : 0;
|
||||
@@ -1727,7 +1766,9 @@ void *W_CachePatchName(const char *name, INT32 tag)
|
||||
{
|
||||
lumpnum_t num;
|
||||
|
||||
num = W_CheckNumForName(name);
|
||||
const char *finalname = name;
|
||||
|
||||
num = W_CheckNumForName(finalname);
|
||||
|
||||
if (num == LUMPERROR)
|
||||
return W_CachePatchNum(W_GetNumForName("MISSING"), tag);
|
||||
|
||||
+3
-1
@@ -114,6 +114,8 @@ typedef struct wadfile_s
|
||||
UINT32 filesize; // for network
|
||||
UINT8 md5sum[16];
|
||||
boolean important;
|
||||
boolean majormod;
|
||||
boolean localfile; // only for skins
|
||||
} wadfile_t;
|
||||
|
||||
#define WADFILENUM(lumpnum) (UINT16)((lumpnum)>>16) // wad flumpnum>>16) // wad file number in upper word
|
||||
@@ -132,7 +134,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors);
|
||||
//
|
||||
// if local is true, it wouldn't check if file adds complex things, therefore
|
||||
// allowing to still join server without the "you have wrong addons loaded" error
|
||||
UINT16 W_InitFile(const char *filename, boolean local);
|
||||
UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, boolean local);
|
||||
#ifdef DELFILE
|
||||
void W_UnloadWadFile(UINT16 num);
|
||||
#endif
|
||||
|
||||
+164
-19
@@ -116,11 +116,25 @@ static INT32 intertic;
|
||||
static INT32 endtic = -1;
|
||||
static INT32 sorttic = -1;
|
||||
|
||||
patch_t *animVoteFramesPatches = NULL;
|
||||
// VEXTRN - Vote (V) Extra (EXT) Race (R) Normal (N - Normal sized patch)
|
||||
// VEXTBN - Vote (V) Extra (EXT) Battle (B) Normal (N - Normal sized patch)
|
||||
// VEXTBW - Vote (V) Extra (EXT) Battle (B) Normal (W - Wide patch used in software)
|
||||
// VEXTRW - Vote (V) Extra (EXT) Race (R) Normal (W - Wide patch used in software)
|
||||
char animPrefix[] = "INTSC";
|
||||
char animWidePrefix[] = "INTSW";
|
||||
char *luaVoteScreen = NULL;
|
||||
|
||||
INT32 currentAnimFrame = 0;
|
||||
static INT32 foundAnimVoteFrames = 0;
|
||||
static INT32 foundAnimVoteWideFrames = 0;
|
||||
|
||||
intertype_t intertype = int_none;
|
||||
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
static huddrawlist_h luahuddrawlist_intermission = NULL;
|
||||
static huddrawlist_h luahuddrawlist_vote = NULL;
|
||||
#endif
|
||||
|
||||
static void Y_FollowIntermission(void);
|
||||
@@ -158,6 +172,7 @@ typedef struct
|
||||
static y_votelvlinfo levelinfo[5];
|
||||
static y_voteclient voteclient;
|
||||
static INT32 votetic;
|
||||
static INT32 lastvotetic;
|
||||
static INT32 voteendtic = -1;
|
||||
static patch_t *cursor = NULL;
|
||||
static patch_t *cursor1 = NULL;
|
||||
@@ -324,6 +339,54 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Y_AnimatedVoteScreenCheck
|
||||
//
|
||||
// Check if the lumps exist (checking for VEXTR(N|W)xx for race and VEXTRB(N|W)xx for battle)
|
||||
void Y_AnimatedVoteScreenCheck(void)
|
||||
{
|
||||
char tmpPrefix[] = "INTS";
|
||||
boolean stopSearching = false;
|
||||
|
||||
if (luaVoteScreen)
|
||||
{
|
||||
strncpy(tmpPrefix, luaVoteScreen, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(G_BattleGametype()) {
|
||||
strcpy(tmpPrefix, "BTLS");
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(animPrefix, tmpPrefix, 4);
|
||||
animPrefix[4] = 'C';
|
||||
strncpy(animWidePrefix, tmpPrefix, 4);
|
||||
animWidePrefix[4] = 'W';
|
||||
|
||||
foundAnimVoteFrames = 0;
|
||||
foundAnimVoteWideFrames = 0;
|
||||
currentAnimFrame = 0;
|
||||
|
||||
INT32 i = 1;
|
||||
while(!stopSearching){
|
||||
boolean normalLumpExists = W_LumpExists(va("%sC%d", tmpPrefix, i));
|
||||
boolean wideLumpExists = W_LumpExists(va("%sW%d", tmpPrefix, i));
|
||||
|
||||
if(normalLumpExists || wideLumpExists){
|
||||
if(normalLumpExists){
|
||||
foundAnimVoteFrames++;
|
||||
}
|
||||
if(wideLumpExists){
|
||||
foundAnimVoteWideFrames++;
|
||||
}
|
||||
} else { // If we don't find at least frame 1 (e.g VEXTRN1), let's just stop looking
|
||||
stopSearching = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Y_IntermissionDrawer
|
||||
//
|
||||
@@ -366,15 +429,6 @@ void Y_IntermissionDrawer(void)
|
||||
if (usebuffer) // Fade everything out
|
||||
V_DrawFadeScreen(0xFF00, 22);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_intermission);
|
||||
LUAh_IntermissionHUD(luahuddrawlist_intermission);
|
||||
}
|
||||
LUA_HUD_DrawList(luahuddrawlist_intermission);
|
||||
#endif
|
||||
|
||||
if (!splitscreen)
|
||||
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
|
||||
|
||||
@@ -490,7 +544,15 @@ void Y_IntermissionDrawer(void)
|
||||
if (data.match.color[i])
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(*data.match.character[i], *data.match.color[i], GTC_CACHE);
|
||||
V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[*data.match.character[i]], colormap);
|
||||
// i fucking hate this i fucking hate this i hate this so much
|
||||
if (!players[data.match.num[i]].skinlocal) {
|
||||
if (!players[data.match.num[i]].localskin)
|
||||
V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[*data.match.character[i]], colormap);
|
||||
else
|
||||
V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[players[data.match.num[i]].localskin - 1], colormap);
|
||||
} else {
|
||||
V_DrawMappedPatch(x+16, y-4, 0, localfacerankprefix[players[data.match.num[i]].localskin - 1], colormap);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.match.num[i] == whiteplayer)
|
||||
@@ -609,6 +671,15 @@ dotimer:
|
||||
// Make it obvious that scrambling is happening next round.
|
||||
if (cv_scrambleonchange.value && cv_teamscramble.value && (intertic/TICRATE % 2 == 0))
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, hilicol, M_GetText("Teams will be scrambled next round!"));
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_intermission);
|
||||
LUAh_IntermissionHUD(luahuddrawlist_intermission);
|
||||
}
|
||||
LUA_HUD_DrawList(luahuddrawlist_intermission);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -977,6 +1048,42 @@ static void Y_UnloadData(void)
|
||||
|
||||
// SRB2Kart: Voting!
|
||||
|
||||
// Y_DrawAnimatedVoteScreenPatch
|
||||
//
|
||||
// Draw animated patch based on frame counter on vote screen
|
||||
//
|
||||
void Y_DrawAnimatedVoteScreenPatch(boolean widePatch){
|
||||
char tempAnimPrefix[7];
|
||||
(widePatch) ? strcpy(tempAnimPrefix, animWidePrefix) : strcpy(tempAnimPrefix, animPrefix);
|
||||
INT32 tempFoundAnimVoteFrames = (widePatch) ? foundAnimVoteWideFrames : foundAnimVoteFrames;
|
||||
INT32 flags = V_SNAPTOBOTTOM | V_SNAPTOTOP;
|
||||
|
||||
// Just in case someone provides LESS widescreen frames than normal frames or vice versa, reset the frame counter to 0
|
||||
if(widePatch) {
|
||||
if(currentAnimFrame > foundAnimVoteWideFrames-1){
|
||||
currentAnimFrame = 0;
|
||||
}
|
||||
} else {
|
||||
if(currentAnimFrame > foundAnimVoteFrames-1){
|
||||
currentAnimFrame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*patch_t *currPatch = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame+1), PU_CACHE);
|
||||
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(currPatch->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?)
|
||||
(vid.height / vid.dupy) - SHORT(currPatch->height),
|
||||
V_SNAPTOTOP|V_SNAPTOLEFT, currPatch);
|
||||
if(votetic % 3 == 0 && !paused){*/
|
||||
|
||||
{
|
||||
patch_t *background = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_CACHE);
|
||||
V_DrawScaledPatch(160 - (background->width / 2), (200 - (background->height)), flags, background);
|
||||
}
|
||||
if (lastvotetic != votetic && lastvotetic % 2 == 0) {
|
||||
currentAnimFrame = (currentAnimFrame+1 > tempFoundAnimVoteFrames-1) ? 0 : currentAnimFrame + 1; // jeez no fucking idea how to make this shit not go nuts with interpolation
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Y_VoteDrawer
|
||||
//
|
||||
@@ -1005,14 +1112,34 @@ void Y_VoteDrawer(void)
|
||||
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
if (widebgpatch && rendermode == render_soft && vid.width / vid.dupx > 320)
|
||||
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(widebgpatch->width)/2),
|
||||
(vid.height / vid.dupy) - SHORT(widebgpatch->height),
|
||||
V_SNAPTOTOP|V_SNAPTOLEFT, widebgpatch);
|
||||
else
|
||||
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(bgpatch->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?)
|
||||
(vid.height / vid.dupy) - SHORT(bgpatch->height),
|
||||
V_SNAPTOTOP|V_SNAPTOLEFT, bgpatch);
|
||||
if (widebgpatch && vid.width / vid.dupx > 320) {
|
||||
|
||||
if(foundAnimVoteWideFrames == 0){
|
||||
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(widebgpatch->width)/2),
|
||||
(vid.height / vid.dupy) - SHORT(widebgpatch->height),
|
||||
V_SNAPTOTOP|V_SNAPTOLEFT, widebgpatch);
|
||||
} else {
|
||||
// patch_t *currPatch = W_CachePatchName(va("%s%d", animPrefix, currentAnimFrame+1), PU_CACHE);
|
||||
// V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(currPatch->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?)
|
||||
// (vid.height / vid.dupy) - SHORT(currPatch->height),
|
||||
// V_SNAPTOTOP|V_SNAPTOLEFT, currPatch);
|
||||
// if(votetic % 4 == 0 && !paused){
|
||||
// currentAnimFrame = (currentAnimFrame+1 > foundAnimVoteFrames-1) ? 0 : currentAnimFrame + 1;
|
||||
// }
|
||||
Y_DrawAnimatedVoteScreenPatch(true);
|
||||
}
|
||||
} else {
|
||||
if(foundAnimVoteFrames == 0) {
|
||||
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(bgpatch->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?)
|
||||
(vid.height / vid.dupy) - SHORT(bgpatch->height),
|
||||
V_SNAPTOTOP|V_SNAPTOLEFT, bgpatch);
|
||||
} else {
|
||||
Y_DrawAnimatedVoteScreenPatch(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++) // First, we need to figure out the height of this thing...
|
||||
{
|
||||
@@ -1199,7 +1326,7 @@ void Y_VoteDrawer(void)
|
||||
if (players[i].skincolor)
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(players[i].skin, players[i].skincolor, GTC_CACHE);
|
||||
V_DrawMappedPatch(x+24, y+9, V_SNAPTOLEFT, facerankprefix[players[i].skin], colormap);
|
||||
V_DrawMappedPatch(x+24, y+9, V_SNAPTOLEFT, (players[i].skinlocal ? localfacerankprefix : facerankprefix)[((players[i].localskin) ? players[i].localskin-1 : players[i].skin)], colormap);
|
||||
}
|
||||
|
||||
if (!splitscreen && i == consoleplayer)
|
||||
@@ -1230,6 +1357,17 @@ void Y_VoteDrawer(void)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol,
|
||||
va("Vote ends in %d", tickdown));
|
||||
}
|
||||
|
||||
lastvotetic = votetic;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_vote);
|
||||
LUAh_VoteHUD(luahuddrawlist_vote);
|
||||
}
|
||||
LUA_HUD_DrawList(luahuddrawlist_vote);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1477,6 +1615,8 @@ void Y_StartVote(void)
|
||||
I_Error("voteendtic is dirty");
|
||||
#endif
|
||||
|
||||
Y_AnimatedVoteScreenCheck();
|
||||
|
||||
widebgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCW" : "INTERSCW"), PU_STATIC);
|
||||
bgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCR" : "INTERSCR"), PU_STATIC);
|
||||
cursor = W_CachePatchName("M_CURSOR", PU_STATIC);
|
||||
@@ -1559,6 +1699,11 @@ void Y_StartVote(void)
|
||||
}
|
||||
|
||||
voteclient.loaded = true;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_HUD_DestroyDrawList(luahuddrawlist_vote);
|
||||
luahuddrawlist_vote = LUA_HUD_CreateDrawList();
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
/// \brief Tally screens, or "Intermissions" as they were formally called in Doom
|
||||
|
||||
extern boolean usebuffer;
|
||||
extern char *luaVoteScreen;
|
||||
|
||||
void Y_IntermissionDrawer(void);
|
||||
void Y_Ticker(void);
|
||||
|
||||
+245
-246
@@ -1,7 +1,7 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2006 by Graue.
|
||||
// Copyright (C) 2006-2023 by Sonic Team Junior.
|
||||
// Copyright (C) 2006-2018 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "r_patch.h"
|
||||
#include "i_system.h" // I_GetFreeMem
|
||||
#include "i_video.h" // rendermode
|
||||
#include "z_zone.h"
|
||||
@@ -50,11 +49,27 @@ static boolean Z_calloc = false;
|
||||
//#define ZDEBUG2
|
||||
#endif
|
||||
|
||||
struct memblock_s;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct memblock_s *block; // Describing this memory
|
||||
UINT32 id; // Should be ZONEID
|
||||
} ATTRPACK memhdr_t;
|
||||
|
||||
// Some code might want aligned memory. Assume it wants memory n bytes
|
||||
// aligned -- then we allocate n-1 extra bytes and return a pointer to
|
||||
// the first byte aligned as requested.
|
||||
// Thus, "real" is the pointer we get from malloc() and will free()
|
||||
// later, but "hdr" is where the memhdr_t starts.
|
||||
// For non-aligned allocations they will be the same.
|
||||
typedef struct memblock_s
|
||||
{
|
||||
void *real;
|
||||
memhdr_t *hdr;
|
||||
|
||||
void **user;
|
||||
INT32 tag; // purgelevel
|
||||
UINT32 id; // Should be ZONEID
|
||||
|
||||
size_t size; // including the header and blocks
|
||||
size_t realsize; // size of real data only
|
||||
@@ -65,31 +80,64 @@ typedef struct memblock_s
|
||||
#endif
|
||||
|
||||
struct memblock_s *next, *prev;
|
||||
} memblock_t;
|
||||
} ATTRPACK memblock_t;
|
||||
|
||||
#define MEMORY(x) (void *)((uintptr_t)(x) + sizeof(memblock_t))
|
||||
#define MEMBLOCK(x) (memblock_t *)((uintptr_t)(x) - sizeof(memblock_t))
|
||||
#ifdef ZDEBUG
|
||||
#define Ptr2Memblock(s, f) Ptr2Memblock2(s, f, __FILE__, __LINE__)
|
||||
static memblock_t *Ptr2Memblock2(void *ptr, const char* func, const char *file, INT32 line)
|
||||
#else
|
||||
static memblock_t *Ptr2Memblock(void *ptr, const char* func)
|
||||
#endif
|
||||
{
|
||||
memhdr_t *hdr;
|
||||
memblock_t *block;
|
||||
|
||||
if (ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef ZDEBUG2
|
||||
CONS_Printf("%s %s:%d\n", func, file, line);
|
||||
#endif
|
||||
|
||||
hdr = (memhdr_t *)((UINT8 *)ptr - sizeof *hdr);
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_DEFINED
|
||||
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
#ifdef VALGRIND_MEMPOOL_EXISTS
|
||||
if (!VALGRIND_MEMPOOL_EXISTS(hdr->block))
|
||||
{
|
||||
#ifdef ZDEBUG
|
||||
I_Error("%s: bad memblock from %s:%d", func, file, line);
|
||||
#else
|
||||
I_Error("%s: bad memblock", func);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (hdr->id != ZONEID)
|
||||
{
|
||||
#ifdef ZDEBUG
|
||||
I_Error("%s: wrong id from %s:%d", func, file, line);
|
||||
#else
|
||||
I_Error("%s: wrong id", func);
|
||||
#endif
|
||||
}
|
||||
block = hdr->block;
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
#endif
|
||||
return block;
|
||||
|
||||
}
|
||||
|
||||
// both the head and tail of the zone memory block list
|
||||
static memblock_t head;
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
static void Command_Memfree_f(void);
|
||||
#ifdef ZDEBUG
|
||||
static void Command_Memdump_f(void);
|
||||
#endif
|
||||
|
||||
// --------------------------
|
||||
// Zone memory initialisation
|
||||
// --------------------------
|
||||
|
||||
/** Initialises zone memory.
|
||||
* Used at game startup.
|
||||
*
|
||||
* \sa I_GetFreeMem, Command_Memfree_f, Command_Memdump_f
|
||||
*/
|
||||
void Z_Init(void)
|
||||
{
|
||||
size_t total, memfree;
|
||||
@@ -109,17 +157,6 @@ void Z_Init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// ----------------------
|
||||
// Zone memory allocation
|
||||
// ----------------------
|
||||
|
||||
/** Frees allocated memory.
|
||||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* \sa Z_FreeTags
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void Z_Free2(void *ptr, const char *file, INT32 line)
|
||||
#else
|
||||
@@ -135,14 +172,10 @@ void Z_Free(void *ptr)
|
||||
CONS_Debug(DBG_MEMORY, "Z_Free %s:%d\n", file, line);
|
||||
#endif
|
||||
|
||||
block = MEMBLOCK(ptr);
|
||||
#ifdef PARANOIA
|
||||
if (block->id != ZONEID)
|
||||
#ifdef ZDEBUG
|
||||
I_Error("Z_Free at %s:%d: wrong id", file, line);
|
||||
block = Ptr2Memblock2(ptr, "Z_Free", file, line);
|
||||
#else
|
||||
I_Error("Z_Free: wrong id");
|
||||
#endif
|
||||
block = Ptr2Memblock(ptr, "Z_Free");
|
||||
#endif
|
||||
|
||||
#ifdef ZDEBUG
|
||||
@@ -150,9 +183,11 @@ void Z_Free(void *ptr)
|
||||
CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// anything that isn't by lua gets passed to lua just in case.
|
||||
if (block->tag != PU_LUA)
|
||||
LUA_InvalidateUserdata(ptr);
|
||||
#endif
|
||||
|
||||
// TODO: if zdebugging, make sure no other block has a user
|
||||
// that is about to be freed.
|
||||
@@ -161,27 +196,21 @@ void Z_Free(void *ptr)
|
||||
if (block->user != NULL)
|
||||
*block->user = NULL;
|
||||
|
||||
#ifdef VALGRIND_DESTROY_MEMPOOL
|
||||
VALGRIND_DESTROY_MEMPOOL(block);
|
||||
#endif
|
||||
// Free the memory and get rid of the block.
|
||||
free(block->real);
|
||||
block->prev->next = block->next;
|
||||
block->next->prev = block->prev;
|
||||
free(block);
|
||||
#ifdef VALGRIND_DESTROY_MEMPOOL
|
||||
VALGRIND_DESTROY_MEMPOOL(block);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** malloc() that doesn't accept failure.
|
||||
*
|
||||
* \param size Amount of memory to be allocated, in bytes.
|
||||
* \return A pointer to the allocated memory.
|
||||
*/
|
||||
// malloc() that doesn't accept failure.
|
||||
static void *xm(size_t size)
|
||||
{
|
||||
const size_t padedsize = size+sizeof (size_t);
|
||||
void *p;
|
||||
|
||||
if (padedsize < size)/* overflow check */
|
||||
I_Error("You are allocating memory too large!");
|
||||
p = malloc(padedsize);
|
||||
void *p = malloc(padedsize);
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
@@ -191,6 +220,10 @@ static void *xm(size_t size)
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
#if defined (_NDS) | defined (_PSP)
|
||||
// Temporary-ish debugging measure
|
||||
Command_Memfree_f();
|
||||
#endif
|
||||
I_Error("Out of memory allocating %s bytes", sizeu1(size));
|
||||
}
|
||||
}
|
||||
@@ -198,18 +231,10 @@ static void *xm(size_t size)
|
||||
return p;
|
||||
}
|
||||
|
||||
/** The Z_MallocAlign function.
|
||||
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
|
||||
*
|
||||
* \param size Amount of memory to be allocated, in bytes.
|
||||
* \param tag Purge tag.
|
||||
* \param user The address of a pointer to the memory to be allocated.
|
||||
* When the memory is freed by Z_Free later,
|
||||
* the pointer at this address will then be automatically set to NULL.
|
||||
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
|
||||
* \note You can pass Z_Malloc() a NULL user if the tag is less than PU_PURGELEVEL.
|
||||
* \sa Z_CallocAlign, Z_ReallocAlign
|
||||
*/
|
||||
// Z_Malloc
|
||||
// You can pass Z_Malloc() a NULL user if the tag is less than
|
||||
// PU_PURGELEVEL.
|
||||
|
||||
#ifdef ZDEBUG
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits,
|
||||
const char *file, INT32 line)
|
||||
@@ -217,67 +242,75 @@ void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits,
|
||||
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
#endif
|
||||
{
|
||||
size_t extrabytes = (1<<alignbits) - 1;
|
||||
size_t padsize = 0;
|
||||
memblock_t *block;
|
||||
void *ptr;
|
||||
(void)(alignbits); // no longer used, so silence warnings.
|
||||
memhdr_t *hdr;
|
||||
void *given;
|
||||
size_t blocksize = extrabytes + sizeof *hdr + size;
|
||||
|
||||
#ifdef ZDEBUG2
|
||||
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
|
||||
#endif
|
||||
|
||||
block = xm(sizeof (memblock_t) + size);
|
||||
ptr = MEMORY(block);
|
||||
I_Assert((intptr_t)ptr % sizeof (void *) == 0);
|
||||
|
||||
block = xm(sizeof *block);
|
||||
#ifdef HAVE_VALGRIND
|
||||
padsize += (1<<sizeof(size_t))*2;
|
||||
#endif
|
||||
ptr = xm(blocksize + padsize*2);
|
||||
|
||||
// This horrible calculation makes sure that "given" is aligned
|
||||
// properly.
|
||||
given = (void *)((size_t)((UINT8 *)ptr + extrabytes + sizeof *hdr + padsize/2)
|
||||
& ~extrabytes);
|
||||
|
||||
// The mem header lives 'sizeof (memhdr_t)' bytes before given.
|
||||
hdr = (memhdr_t *)((UINT8 *)given - sizeof *hdr);
|
||||
|
||||
#ifdef VALGRIND_CREATE_MEMPOOL
|
||||
VALGRIND_CREATE_MEMPOOL(block, padsize, Z_calloc);
|
||||
Z_calloc = false;
|
||||
#endif
|
||||
#ifdef VALGRIND_MEMPOOL_ALLOC
|
||||
VALGRIND_MEMPOOL_ALLOC(block, hdr, size + sizeof *hdr);
|
||||
#endif
|
||||
|
||||
block->next = head.next;
|
||||
block->prev = &head;
|
||||
head.next = block;
|
||||
block->next->prev = block;
|
||||
|
||||
block->real = ptr;
|
||||
block->hdr = hdr;
|
||||
block->tag = tag;
|
||||
block->user = NULL;
|
||||
#ifdef ZDEBUG
|
||||
block->ownerline = line;
|
||||
block->ownerfile = file;
|
||||
#endif
|
||||
block->size = sizeof (memblock_t) + size;
|
||||
block->size = blocksize;
|
||||
block->realsize = size;
|
||||
|
||||
#ifdef VALGRIND_CREATE_MEMPOOL
|
||||
VALGRIND_CREATE_MEMPOOL(block, size, Z_calloc);
|
||||
#endif
|
||||
hdr->id = ZONEID;
|
||||
hdr->block = block;
|
||||
|
||||
block->id = ZONEID;
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
if (user != NULL)
|
||||
{
|
||||
block->user = user;
|
||||
*(void **)user = ptr;
|
||||
*(void **)user = given;
|
||||
}
|
||||
else if (tag >= PU_PURGELEVEL)
|
||||
I_Error("Z_Malloc: attempted to allocate purgable block "
|
||||
"(size %s) with no user", sizeu1(size));
|
||||
|
||||
return ptr;
|
||||
return given;
|
||||
}
|
||||
|
||||
/** The Z_CallocAlign function.
|
||||
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
|
||||
* Unlike Z_MallocAlign, this also initialises the bytes to zero.
|
||||
*
|
||||
* \param size Amount of memory to be allocated, in bytes.
|
||||
* \param tag Purge tag.
|
||||
* \param user The address of a pointer to the memory to be allocated.
|
||||
* When the memory is freed by Z_Free later,
|
||||
* the pointer at this address will then be automatically set to NULL.
|
||||
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
|
||||
* \note You can pass Z_Calloc() a NULL user if the tag is less than PU_PURGELEVEL.
|
||||
* \sa Z_MallocAlign, Z_ReallocAlign
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
|
||||
#else
|
||||
@@ -294,26 +327,10 @@ void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
#endif
|
||||
}
|
||||
|
||||
/** The Z_ReallocAlign function.
|
||||
* Reallocates a block of memory with a new size.
|
||||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* If NULL, this function instead acts as a wrapper for Z_CallocAlign.
|
||||
* \param size New size of memory block, in bytes.
|
||||
* If zero, then the memory is freed and NULL is returned.
|
||||
* \param tag New purge tag.
|
||||
* \param user The address of a pointer to the memory to be reallocated.
|
||||
* This can be a different user to the one originally assigned to the memory block.
|
||||
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
|
||||
* \return A pointer to the reallocated memory. Can be NULL if memory was freed.
|
||||
* \note You can pass Z_Realloc() a NULL user if the tag is less than PU_PURGELEVEL.
|
||||
* \sa Z_MallocAlign, Z_CallocAlign
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
|
||||
#else
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
void *Z_ReallocAlign(void *ptr, size_t size,INT32 tag, void *user, INT32 alignbits)
|
||||
#endif
|
||||
{
|
||||
void *rez;
|
||||
@@ -339,14 +356,10 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
|
||||
#endif
|
||||
}
|
||||
|
||||
block = MEMBLOCK(ptr);
|
||||
#ifdef PARANOIA
|
||||
if (block->id != ZONEID)
|
||||
#ifdef ZDEBUG
|
||||
I_Error("Z_ReallocAlign at %s:%d: wrong id", file, line);
|
||||
block = Ptr2Memblock2(ptr, "Z_Realloc", file, line);
|
||||
#else
|
||||
I_Error("Z_ReallocAlign: wrong id");
|
||||
#endif
|
||||
block = Ptr2Memblock(ptr, "Z_Realloc");
|
||||
#endif
|
||||
|
||||
if (block == NULL)
|
||||
@@ -384,11 +397,6 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
|
||||
return rez;
|
||||
}
|
||||
|
||||
/** Frees all memory for a given set of tags.
|
||||
*
|
||||
* \param lowtag The lowest tag to consider.
|
||||
* \param hightag The highest tag to consider.
|
||||
*/
|
||||
void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
||||
{
|
||||
memblock_t *block, *next;
|
||||
@@ -397,57 +405,28 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
||||
for (block = head.next; block != &head; block = next)
|
||||
{
|
||||
next = block->next; // get link before freeing
|
||||
|
||||
if (block->tag >= lowtag && block->tag <= hightag)
|
||||
Z_Free(MEMORY(block));
|
||||
Z_Free((UINT8 *)block->hdr + sizeof *block->hdr);
|
||||
}
|
||||
}
|
||||
|
||||
/** Iterates through all memory for a given set of tags.
|
||||
*
|
||||
* \param lowtag The lowest tag to consider.
|
||||
* \param hightag The highest tag to consider.
|
||||
* \param iterfunc The iterator function.
|
||||
*/
|
||||
void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *))
|
||||
{
|
||||
memblock_t *block, *next;
|
||||
//
|
||||
// Z_CheckMemCleanup
|
||||
//
|
||||
// TODO: Currently blocks >= PU_PURGELEVEL are freed every
|
||||
// CLEANUPCOUNT. It might be better to keep track of
|
||||
// the total size of all purgable memory and free it when the
|
||||
// size exceeds some value.
|
||||
//
|
||||
// This was in Z_Malloc, but was freeing data at
|
||||
// unsafe times. Now it is only called when it is safe
|
||||
// to cleanup memory.
|
||||
|
||||
if (!iterfunc)
|
||||
I_Error("Z_IterateTags: no iterator function was given");
|
||||
|
||||
for (block = head.next; block != &head; block = next)
|
||||
{
|
||||
next = block->next; // get link before possibly freeing
|
||||
|
||||
if (block->tag >= lowtag && block->tag <= hightag)
|
||||
{
|
||||
void *mem = MEMORY(block);
|
||||
boolean free = iterfunc(mem);
|
||||
if (free)
|
||||
Z_Free(mem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// Utility functions
|
||||
// -----------------
|
||||
|
||||
// starting value of nextcleanup
|
||||
#define CLEANUPCOUNT 2000
|
||||
|
||||
// number of function calls left before next cleanup
|
||||
static INT32 nextcleanup = CLEANUPCOUNT;
|
||||
|
||||
/** This was in Z_Malloc, but was freeing data at
|
||||
* unsafe times. Now it is only called when it is safe
|
||||
* to cleanup memory.
|
||||
*
|
||||
* \todo Currently blocks >= PU_PURGELEVEL are freed every
|
||||
* CLEANUPCOUNT. It might be better to keep track of
|
||||
* the total size of all purgable memory and free it when the
|
||||
* size exceeds some value.
|
||||
*/
|
||||
void Z_CheckMemCleanup(void)
|
||||
{
|
||||
if (nextcleanup-- == 0)
|
||||
@@ -466,13 +445,15 @@ void Z_CheckMemCleanup(void)
|
||||
void Z_CheckHeap(INT32 i)
|
||||
{
|
||||
memblock_t *block;
|
||||
memhdr_t *hdr;
|
||||
UINT32 blocknumon = 0;
|
||||
void *given;
|
||||
|
||||
for (block = head.next; block != &head; block = block->next)
|
||||
{
|
||||
blocknumon++;
|
||||
given = MEMORY(block);
|
||||
hdr = block->hdr;
|
||||
given = (UINT8 *)hdr + sizeof *hdr;
|
||||
#ifdef ZDEBUG2
|
||||
CONS_Debug(DBG_MEMORY, "block %u owned by %s:%d\n",
|
||||
blocknumon, block->ownerfile, block->ownerline);
|
||||
@@ -488,7 +469,7 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
#endif
|
||||
if (block->user != NULL && *(block->user) != given)
|
||||
@@ -501,7 +482,7 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
if (block->next->prev != block)
|
||||
{
|
||||
@@ -513,7 +494,7 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
if (block->prev->next != block)
|
||||
{
|
||||
@@ -525,9 +506,25 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
if (block->id != ZONEID)
|
||||
#ifdef VALGRIND_MAKE_MEM_DEFINED
|
||||
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
|
||||
#endif
|
||||
if (hdr->block != block)
|
||||
{
|
||||
I_Error("Z_CheckHeap %d: block %u"
|
||||
#ifdef ZDEBUG
|
||||
"(owned by %s:%d)"
|
||||
#endif
|
||||
" doesn't have linkback from allocated memory",
|
||||
i, blocknumon
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
}
|
||||
if (hdr->id != ZONEID)
|
||||
{
|
||||
I_Error("Z_CheckHeap %d: block %u"
|
||||
#ifdef ZDEBUG
|
||||
@@ -537,37 +534,50 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Zone memory modification
|
||||
// ------------------------
|
||||
|
||||
/** Changes a memory block's purge tag.
|
||||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* \param tag The new tag.
|
||||
* \sa Z_SetUser
|
||||
*/
|
||||
#ifdef PARANOIA
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line)
|
||||
#else
|
||||
void Z_ChangeTag(void *ptr, INT32 tag)
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
memhdr_t *hdr;
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
block = MEMBLOCK(ptr);
|
||||
hdr = (memhdr_t *)((UINT8 *)ptr - sizeof *hdr);
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_DEFINED
|
||||
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
#ifdef VALGRIND_MEMPOOL_EXISTS
|
||||
if (!VALGRIND_MEMPOOL_EXISTS(hdr->block))
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
if (block->id != ZONEID) I_Error("Z_ChangeTag at %s:%d: wrong id", file, line);
|
||||
I_Error("Z_CT at %s:%d: bad memblock", file, line);
|
||||
#else
|
||||
I_Error("Z_CT: bad memblock");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifdef PARANOIA
|
||||
if (hdr->id != ZONEID) I_Error("Z_CT at %s:%d: wrong id", file, line);
|
||||
#endif
|
||||
|
||||
block = hdr->block;
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
if (tag >= PU_PURGELEVEL && block->user == NULL)
|
||||
@@ -577,48 +587,12 @@ void Z_ChangeTag(void *ptr, INT32 tag)
|
||||
block->tag = tag;
|
||||
}
|
||||
|
||||
/** Changes a memory block's user.
|
||||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* \param newuser The new user for the memory block.
|
||||
* \sa Z_ChangeTag
|
||||
*/
|
||||
#ifdef PARANOIA
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line)
|
||||
#else
|
||||
void Z_SetUser(void *ptr, void **newuser)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
block = MEMBLOCK(ptr);
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (block->id != ZONEID) I_Error("Z_SetUser at %s:%d: wrong id", file, line);
|
||||
#endif
|
||||
|
||||
if (block->tag >= PU_PURGELEVEL && newuser == NULL)
|
||||
I_Error("Internal memory management error: "
|
||||
"tried to make block purgable but it has no owner");
|
||||
|
||||
block->user = (void*)newuser;
|
||||
*newuser = ptr;
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// Zone memory usage
|
||||
// -----------------
|
||||
|
||||
/** Calculates memory usage for a given set of tags.
|
||||
*
|
||||
* \param lowtag The lowest tag to consider.
|
||||
* \param hightag The highest tag to consider.
|
||||
* \return Number of bytes currently allocated in the heap for the
|
||||
* given tags.
|
||||
* \sa Z_TagUsage
|
||||
*/
|
||||
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag)
|
||||
{
|
||||
@@ -635,37 +609,36 @@ size_t Z_TagsUsage(INT32 lowtag, INT32 hightag)
|
||||
return cnt;
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// Miscellaneous functions
|
||||
// -----------------------
|
||||
size_t Z_TagUsage(INT32 tagnum)
|
||||
{
|
||||
return Z_TagsUsage(tagnum, tagnum);
|
||||
}
|
||||
|
||||
/** The function called by the "memfree" console command.
|
||||
* Prints the memory being used by each part of the game to the console.
|
||||
*/
|
||||
static void Command_Memfree_f(void)
|
||||
void Command_Memfree_f(void)
|
||||
{
|
||||
size_t freebytes, totalbytes;
|
||||
|
||||
Z_CheckHeap(-1);
|
||||
CONS_Printf("\x82%s", M_GetText("Memory Info\n"));
|
||||
CONS_Printf(M_GetText("Total heap used : %7s KB\n"), sizeu1(Z_TotalUsage()>>10));
|
||||
CONS_Printf(M_GetText("Static : %7s KB\n"), sizeu1(Z_TagUsage(PU_STATIC)>>10));
|
||||
CONS_Printf(M_GetText("Static (sound) : %7s KB\n"), sizeu1(Z_TagUsage(PU_SOUND)>>10));
|
||||
CONS_Printf(M_GetText("Static (music) : %7s KB\n"), sizeu1(Z_TagUsage(PU_MUSIC)>>10));
|
||||
CONS_Printf(M_GetText("Locked cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_CACHE)>>10));
|
||||
CONS_Printf(M_GetText("Level : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVEL)>>10));
|
||||
CONS_Printf(M_GetText("Special thinker : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVSPEC)>>10));
|
||||
CONS_Printf(M_GetText("All purgable : %7s KB\n"),
|
||||
CONS_Printf(M_GetText("Total heap used : %7s KB\n"), sizeu1(Z_TagsUsage(0, INT32_MAX)>>10));
|
||||
CONS_Printf(M_GetText("Static : %7s KB\n"), sizeu1(Z_TagUsage(PU_STATIC)>>10));
|
||||
CONS_Printf(M_GetText("Lua : %7s KB\n"), sizeu1(Z_TagUsage(PU_LUA)>>10));
|
||||
CONS_Printf(M_GetText("Static (sound) : %7s KB\n"), sizeu1(Z_TagUsage(PU_SOUND)>>10));
|
||||
CONS_Printf(M_GetText("Static (music) : %7s KB\n"), sizeu1(Z_TagUsage(PU_MUSIC)>>10));
|
||||
CONS_Printf(M_GetText("Locked cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_CACHE)>>10));
|
||||
CONS_Printf(M_GetText("Level : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVEL)>>10));
|
||||
CONS_Printf(M_GetText("Special thinker : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVSPEC)>>10));
|
||||
CONS_Printf(M_GetText("All purgable : %7s KB\n"),
|
||||
sizeu1(Z_TagsUsage(PU_PURGELEVEL, INT32_MAX)>>10));
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
CONS_Printf(M_GetText("Patch info headers : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHINFO)>>10));
|
||||
CONS_Printf(M_GetText("Cached textures : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
|
||||
CONS_Printf(M_GetText("Texture colormaps : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10));
|
||||
CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
|
||||
CONS_Printf(M_GetText("All GPU textures : %7d KB\n"), HWR_GetTextureUsed()>>10);
|
||||
CONS_Printf(M_GetText("Patch info headers: %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHINFO)>>10));
|
||||
CONS_Printf(M_GetText("Mipmap patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10));
|
||||
CONS_Printf(M_GetText("HW Texture cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
|
||||
CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
|
||||
CONS_Printf(M_GetText("All GPU textures : %7s KB\n"), sizeu1(HWR_GetTextureUsed()>>10));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -675,14 +648,7 @@ static void Command_Memfree_f(void)
|
||||
CONS_Printf(M_GetText("Available physical memory: %s KB\n"), sizeu1(freebytes>>10));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef ZDEBUG
|
||||
/** The function called by the "memdump" console command.
|
||||
* Prints zone memory debugging information (i.e. tag, size, location in code allocated).
|
||||
* Can be all memory allocated in game, or between a set of tags (if -min/-max args used).
|
||||
* This command is available only if ZDEBUG is enabled.
|
||||
*/
|
||||
static void Command_Memdump_f(void)
|
||||
{
|
||||
memblock_t *block;
|
||||
@@ -704,12 +670,45 @@ static void Command_Memdump_f(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Creates a copy of a string.
|
||||
*
|
||||
* \param s The string to be copied.
|
||||
* \return A copy of the string, allocated in zone memory.
|
||||
*/
|
||||
// Creates a copy of a string.
|
||||
char *Z_StrDup(const char *s)
|
||||
{
|
||||
return strcpy(ZZ_Alloc(strlen(s) + 1), s);
|
||||
}
|
||||
|
||||
|
||||
#ifdef PARANOIA
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line)
|
||||
#else
|
||||
void Z_SetUser2(void *ptr, void **newuser)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
memhdr_t *hdr;
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
hdr = (memhdr_t *)((UINT8 *)ptr - sizeof *hdr);
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_DEFINED
|
||||
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (hdr->id != ZONEID) I_Error("Z_CT at %s:%d: wrong id", file, line);
|
||||
#endif
|
||||
|
||||
block = hdr->block;
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
if (block->tag >= PU_PURGELEVEL && newuser == NULL)
|
||||
I_Error("Internal memory management error: "
|
||||
"tried to make block purgable but it has no owner");
|
||||
|
||||
block->user = (void*)newuser;
|
||||
*newuser = ptr;
|
||||
}
|
||||
+64
-88
@@ -2,7 +2,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2023 by Sonic Team Junior.
|
||||
// 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.
|
||||
@@ -15,7 +15,6 @@
|
||||
#define __Z_ZONE__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
#ifdef __GNUC__ // __attribute__ ((X))
|
||||
@@ -31,120 +30,97 @@
|
||||
//#define ZDEBUG
|
||||
|
||||
//
|
||||
// Purge tags
|
||||
//
|
||||
// Now they are an enum! -- Monster Iestyn 15/02/18
|
||||
//
|
||||
enum
|
||||
{
|
||||
// Tags < PU_LEVEL are not purged until freed explicitly.
|
||||
PU_STATIC = 1, // static entire execution time
|
||||
PU_LUA = 2, // static entire execution time -- used by lua so it doesn't get caught in loops forever
|
||||
PU_PERFSTATS = 3, // static between changes to ps_samplesize cvar
|
||||
// ZONE MEMORY
|
||||
// PU - purge tags.
|
||||
// Tags < PU_LEVEL are not purged until freed explicitly.
|
||||
#define PU_STATIC 1 // static entire execution time
|
||||
#define PU_LUA 2 // static entire execution time -- used by lua so it doesn't get caught in loops forever
|
||||
#define PU_PERFSTATS 3 // static between changes to ps_samplesize cvar
|
||||
|
||||
PU_SOUND = 11, // static while playing
|
||||
PU_MUSIC = 12, // static while playing
|
||||
PU_HUDGFX = 13, // static until WAD added
|
||||
#define PU_SOUND 11 // static while playing
|
||||
#define PU_MUSIC 12 // static while playing
|
||||
#define PU_HUDGFX 13 // static until WAD added
|
||||
|
||||
PU_HWRPATCHINFO = 21, // Hardware GLPatch_t struct for OpenGL texture cache
|
||||
PU_HWRPATCHCOLMIPMAP = 22, // Hardware GLMipmap_t struct colormap variation of patch
|
||||
#define PU_HWRPATCHINFO 21 // Hardware GLPatch_t struct for OpenGL texture cache
|
||||
#define PU_HWRPATCHCOLMIPMAP 22 // Hardware GLMipmap_t struct colromap variation of patch
|
||||
|
||||
PU_HWRCACHE = 48, // static until unlocked
|
||||
PU_CACHE = 49, // static until unlocked
|
||||
#define PU_HWRCACHE 48 // static until unlocked
|
||||
#define PU_CACHE 49 // static until unlocked
|
||||
|
||||
// Tags s.t. PU_LEVEL <= tag < PU_PURGELEVEL are purged at level start
|
||||
PU_LEVEL = 50, // static until level exited
|
||||
PU_LEVSPEC = 51, // a special thinker in a level
|
||||
PU_HWRPLANE = 52, // if ZPLANALLOC is enabled in hw_bsp.c, this is used to alloc polygons for OpenGL
|
||||
// Tags s.t. PU_LEVEL <= tag < PU_PURGELEVEL are purged at level start
|
||||
#define PU_LEVEL 50 // static until level exited
|
||||
#define PU_LEVSPEC 51 // a special thinker in a level
|
||||
#define PU_HWRPLANE 52
|
||||
|
||||
// Tags >= PU_PURGELEVEL are purgable whenever needed
|
||||
PU_PURGELEVEL = 100, // Note: this is never actually used as a tag
|
||||
PU_CACHE_UNLOCKED = 101, // Note: unused
|
||||
PU_HWRCACHE_UNLOCKED = 102, // 'unlocked' PU_HWRCACHE memory:
|
||||
// 'second-level' cache for graphics
|
||||
// stored in hardware format and downloaded as needed
|
||||
PU_HWRPATCHINFO_UNLOCKED = 103, // 'unlocked' PU_HWRMODELTEXTURE memory
|
||||
};
|
||||
// Tags >= PU_PURGELEVEL are purgable whenever needed
|
||||
#define PU_PURGELEVEL 100
|
||||
#define PU_CACHE_UNLOCKED 101
|
||||
#define PU_HWRCACHE_UNLOCKED 102 // 'second-level' cache for graphics
|
||||
// stored in hardware format and downloaded as needed
|
||||
#define PU_HWRPATCHINFO_UNLOCKED 103
|
||||
|
||||
//
|
||||
// Zone memory initialisation
|
||||
//
|
||||
void Z_Init(void);
|
||||
void Z_FreeTags(INT32 lowtag, INT32 hightag);
|
||||
void Z_CheckMemCleanup(void);
|
||||
void Z_CheckHeap(INT32 i);
|
||||
#ifdef PARANOIA
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line);
|
||||
#else
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Zone memory allocation
|
||||
//
|
||||
// enable ZDEBUG to get the file + line the functions were called from
|
||||
// for ZZ_Alloc, see doomdef.h
|
||||
//
|
||||
#ifdef PARANOIA
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line);
|
||||
#else
|
||||
void Z_SetUser2(void *ptr, void **newuser);
|
||||
#endif
|
||||
|
||||
// Z_Free and alloc with alignment
|
||||
#ifdef ZDEBUG
|
||||
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
||||
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_ReallocAlign(p,s,t,u,a) Z_Realloc2(p,s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
||||
void Z_Free2(void *ptr, const char *file, INT32 line);
|
||||
#define Z_Malloc(s,t,u) Z_Malloc2(s, t, u, 0, __FILE__, __LINE__)
|
||||
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
#define Z_Calloc(s,t,u) Z_Calloc2(s, t, u, 0, __FILE__, __LINE__)
|
||||
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
#define Z_Realloc(p,s,t,u) Z_Realloc2(p, s, t, u, 0, __FILE__, __LINE__)
|
||||
#define Z_ReallocAlign(p,s,t,u,a) Z_Realloc2(p,s, t, u, a, __FILE__, __LINE__)
|
||||
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(2);
|
||||
#else
|
||||
void Z_Free(void *ptr);
|
||||
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
|
||||
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, 0)
|
||||
void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2);
|
||||
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, 0)
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2) ;
|
||||
#define Z_Realloc(p, s,t,u) Z_ReallocAlign(p, s, t, u, 0)
|
||||
#endif
|
||||
|
||||
// Alloc with standard alignment
|
||||
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, sizeof(void *))
|
||||
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, sizeof(void *))
|
||||
#define Z_Realloc(p,s,t,u) Z_ReallocAlign(p, s, t, u, sizeof(void *))
|
||||
size_t Z_TagUsage(INT32 tagnum);
|
||||
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag);
|
||||
|
||||
// Free all memory by tag
|
||||
// these don't give line numbers for ZDEBUG currently though
|
||||
// (perhaps this should be changed in future?)
|
||||
#define Z_FreeTag(tagnum) Z_FreeTags(tagnum, tagnum)
|
||||
void Z_FreeTags(INT32 lowtag, INT32 hightag);
|
||||
char *Z_StrDup(const char *in);
|
||||
|
||||
// Iterate memory by tag
|
||||
#define Z_IterateTag(tagnum, func) Z_IterateTags(tagnum, tagnum, func)
|
||||
void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *));
|
||||
|
||||
//
|
||||
// Utility functions
|
||||
//
|
||||
void Z_CheckMemCleanup(void);
|
||||
void Z_CheckHeap(INT32 i);
|
||||
|
||||
//
|
||||
// Zone memory modification
|
||||
//
|
||||
// enable PARANOIA to get the file + line the functions were called from
|
||||
// This is used to get the local FILE : LINE info from CPP
|
||||
// prior to really call the function in question.
|
||||
//
|
||||
#ifdef PARANOIA
|
||||
#define Z_ChangeTag(p,t) Z_ChangeTag2(p, t, __FILE__, __LINE__)
|
||||
#define Z_SetUser(p,u) Z_SetUser2(p, u, __FILE__, __LINE__)
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line);
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line);
|
||||
#else
|
||||
void Z_ChangeTag(void *ptr, INT32 tag);
|
||||
void Z_SetUser(void *ptr, void **newuser);
|
||||
#define Z_ChangeTag(p,t) Z_ChangeTag2(p, t)
|
||||
#endif
|
||||
|
||||
//
|
||||
// Zone memory usage
|
||||
//
|
||||
// Note: These give the memory used in bytes,
|
||||
// shift down by 10 to convert to KB
|
||||
//
|
||||
#define Z_TagUsage(tagnum) Z_TagsUsage(tagnum, tagnum)
|
||||
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag);
|
||||
#define Z_TotalUsage() Z_TagsUsage(0, INT32_MAX)
|
||||
#ifdef PARANOIA
|
||||
#define Z_SetUser(p,u) Z_SetUser2(p, u, __FILE__, __LINE__)
|
||||
#else
|
||||
#define Z_SetUser(p,u) Z_SetUser2(p, u)
|
||||
#endif
|
||||
|
||||
//
|
||||
// Miscellaneous functions
|
||||
//
|
||||
char *Z_StrDup(const char *in);
|
||||
#define Z_Unlock(p) (void)p // TODO: remove this now that NDS code has been removed
|
||||
#ifdef _NDS ///TODO: need a lock reference system
|
||||
#define Z_Unlock(p) Z_ChangeTag(p, PU_CACHE_UNLOCKED)
|
||||
#else
|
||||
#define Z_Unlock(p) (void)p
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user