Compare commits
61
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41ee6de784 | ||
|
|
0a6a40741b | ||
|
|
b7ffaf4243 | ||
|
|
2321e4aa7f | ||
|
|
6304a46c84 | ||
|
|
32cc37a424 | ||
|
|
7242c3c778 | ||
|
|
07481fc2aa | ||
|
|
77577530da | ||
|
|
213718d1bd | ||
|
|
9bf10bf35b | ||
|
|
cb0c75e9a8 | ||
|
|
cf78516c77 | ||
|
|
39489fc6f1 | ||
|
|
910e20b542 | ||
|
|
7f78873a8a | ||
|
|
26938c20db | ||
|
|
8562c9ad7d | ||
|
|
d81640c57e | ||
|
|
619fe7bdaf | ||
|
|
05b74102c0 | ||
|
|
5d699d4cf3 | ||
|
|
17c4a35df5 | ||
|
|
a304229511 | ||
|
|
b55fc95ce8 | ||
|
|
f2faa87e51 | ||
|
|
d79d754b15 | ||
|
|
1babed3d66 | ||
|
|
5ec64e50ef | ||
|
|
793e8bfdcb | ||
|
|
7a4d5ac1c1 | ||
|
|
728cf1eca9 | ||
|
|
9a1883cd66 | ||
|
|
ea49c2a557 | ||
|
|
647641214a | ||
|
|
8e6023d850 | ||
|
|
ca288b89b3 | ||
|
|
0e12ad0189 | ||
|
|
c163f25319 | ||
|
|
a926cdf7c1 | ||
|
|
134364eee3 | ||
|
|
142d678e8c | ||
|
|
86394e2c43 | ||
|
|
405de4e597 | ||
|
|
1a6893289c | ||
|
|
3297a885eb | ||
|
|
590440ff82 | ||
|
|
37187c7753 | ||
|
|
1b8b92925a | ||
|
|
b87b55ec45 | ||
|
|
0a38a2fd89 | ||
|
|
ea3fc8f526 | ||
|
|
bccc79fe4b | ||
|
|
2a6f551f7a | ||
|
|
f7f3b6497b | ||
|
|
0dca9f9537 | ||
|
|
d07e7ade4a | ||
|
|
8dcdbecf0c | ||
|
|
c7c645de00 | ||
|
|
23c7aaeff2 | ||
|
|
cdde33843e |
No files matched your search
@@ -0,0 +1,20 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=Sonic Robo Blast 2 Kart Saturn
|
||||
Comment=A kart racing mod based on the 3D Sonic the Hedgehog fangame Sonic Robo Blast 2
|
||||
TryExec=srb2kart.sh
|
||||
Exec=srb2kart.sh
|
||||
Icon=org.srb2.SRB2Kart-Saturn
|
||||
Terminal=false
|
||||
Categories=Game;SportsGame;
|
||||
Keywords=kart;sonic;racer;multiplayer;doom;
|
||||
Actions=OpenGL;Software;
|
||||
|
||||
[Desktop Action OpenGL]
|
||||
Name=OpenGL renderer
|
||||
Exec=srb2kart.sh -opengl
|
||||
|
||||
[Desktop Action Software]
|
||||
Name=Software renderer
|
||||
Exec=srb2kart.sh -software
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Copyright 2023 Flathub maintainers -->
|
||||
<component type="desktop-application">
|
||||
<id>org.srb2.SRB2Kart-Saturn</id>
|
||||
<metadata_license>FSFAP</metadata_license>
|
||||
<project_license>GPL-2.0+</project_license>
|
||||
<name>Sonic Robo Blast 2 Kart Saturn</name>
|
||||
<summary>Modded SRB2Kart adding many custom features</summary>
|
||||
<description>
|
||||
<p>
|
||||
A modded net-compatible version of SRB2Kart v1.6 that offers multiple code optimizations, palette rendering, player sprite rotation, base Kart HUD customization, and many more.
|
||||
</p>
|
||||
</description>
|
||||
<launchable type="desktop-id">org.srb2.SRB2Kart-Saturn.desktop</launchable>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>https://wiki.srb2.org/w/images/a/ac/Srb2kart_title.png</image>
|
||||
<caption>Title screen</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://user-images.githubusercontent.com/15758649/227740700-26e0962b-5572-486c-b633-7d4990d86f89.png</image>
|
||||
<caption>Game modes</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://user-images.githubusercontent.com/1964655/82821921-3d180c00-9ea5-11ea-937b-e1f53fe6c686.png</image>
|
||||
<caption>Game play as Sonic</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://user-images.githubusercontent.com/1964655/82821933-41442980-9ea5-11ea-9146-38998161edae.png</image>
|
||||
<caption>Game play as Tails</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://user-images.githubusercontent.com/1964655/82821966-502adc00-9ea5-11ea-9cbd-274d7adb479e.png</image>
|
||||
<caption>Game play as Eggman</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://user-images.githubusercontent.com/1964655/82821980-5620bd00-9ea5-11ea-9eec-2835ebb2a262.png</image>
|
||||
<caption>Game play as Metal Sonic</caption>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<url type="homepage">https://github.com/Indev450/SRB2Kart-Saturn</url>
|
||||
<url type="bugtracker">https://github.com/Indev450/SRB2Kart-Saturn/issues</url>
|
||||
<developer_name>Indev450</developer_name>
|
||||
<provides>
|
||||
<binary>srb2kart</binary>
|
||||
</provides>
|
||||
<releases>
|
||||
<release version="5.1" date="2023-12-20">
|
||||
<description>
|
||||
<p>The complete changelog can be found on the build's GitHub repository.</p>
|
||||
</description>
|
||||
<url>https://github.com/Indev450/SRB2Kart-Saturn/releases/tag/v5.1</url>
|
||||
</release>
|
||||
<release version="5.0" date="2023-12-17">
|
||||
<description>
|
||||
<p>The complete changelog can be found on the build's GitHub repository.</p>
|
||||
</description>
|
||||
<url>https://github.com/Indev450/SRB2Kart-Saturn/releases/tag/v5</url>
|
||||
</release>
|
||||
</releases>
|
||||
<categories>
|
||||
<category>Game</category>
|
||||
<category>SportsGame</category>
|
||||
</categories>
|
||||
<recommends>
|
||||
<control>keyboard</control>
|
||||
<control>gamepad</control>
|
||||
</recommends>
|
||||
<content_rating type="oars-1.1">
|
||||
<content_attribute id="violence-cartoon">moderate</content_attribute>
|
||||
<content_attribute id="language-humor">mild</content_attribute>
|
||||
<content_attribute id="social-chat">intense</content_attribute>
|
||||
<content_attribute id="social-info">mild</content_attribute>
|
||||
</content_rating>
|
||||
<keywords>
|
||||
<keyword>doom</keyword>
|
||||
<keyword>multiplayer</keyword>
|
||||
<keyword>racing</keyword>
|
||||
</keywords>
|
||||
</component>
|
||||
@@ -3,7 +3,6 @@
|
||||
# Core sources
|
||||
set(SRB2_CORE_SOURCES
|
||||
am_map.c
|
||||
args.c
|
||||
b_bot.c
|
||||
command.c
|
||||
comptime.c
|
||||
@@ -53,7 +52,6 @@ set(SRB2_CORE_SOURCES
|
||||
|
||||
set(SRB2_CORE_HEADERS
|
||||
am_map.h
|
||||
args.h
|
||||
b_bot.h
|
||||
byteptr.h
|
||||
command.h
|
||||
@@ -107,7 +105,6 @@ set(SRB2_CORE_HEADERS
|
||||
m_swap.h
|
||||
md5.h
|
||||
mserv.h
|
||||
p5prof.h
|
||||
s_sound.h
|
||||
screen.h
|
||||
sounds.h
|
||||
|
||||
@@ -538,7 +538,6 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/i_time.o \
|
||||
$(OBJDIR)/lzf.o \
|
||||
$(OBJDIR)/b_bot.o \
|
||||
$(OBJDIR)/args.o \
|
||||
$(i_net_o) \
|
||||
$(i_system_o) \
|
||||
$(i_sound_o) \
|
||||
|
||||
-1309
File diff suppressed because it is too large.
Load diff
-206
@@ -1,206 +0,0 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// Args: a C99 library for parsing command line arguments.
|
||||
// Version: 2.8.0
|
||||
// Notes: This has been edited to work properly within SRB2.
|
||||
// Licensed under the 0BSD license.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#ifndef args_h
|
||||
#define args_h
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Types.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// An ArgParser instance stores registered flags, options and commands.
|
||||
typedef struct ArgParser ArgParser;
|
||||
|
||||
// A command callback function should accept two arguments: the command's name
|
||||
// and the command's ArgParser instance.
|
||||
typedef void (*ap_callback_t)(char* cmd_name, ArgParser* cmd_parser);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Initialization, parsing, teardown.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Initializes a new ArgParser instance. Returns NULL if sufficient memory
|
||||
// cannot be allocated for the new parser.
|
||||
ArgParser* ap_new();
|
||||
|
||||
// Specifies a helptext string for the parser. If [helptext] is not NULL, this
|
||||
// activates an automatic --help/-h flag. (Either --help or -h can be overridden
|
||||
// by explicitly registered flags.) The parser stores and manages its own copy
|
||||
// of the [helptext] string so [helptext] can be freed immediately after this
|
||||
// call if it was dynamically constructed.
|
||||
void ap_set_helptext(ArgParser* parser, const char* helptext);
|
||||
|
||||
// Returns a pointer to the parser's helptext string.
|
||||
char* ap_get_helptext(ArgParser* parser);
|
||||
|
||||
// Specifies a version string for the parser. If [version] is not NULL, this
|
||||
// activates an automatic --version/-v flag. (Either --version or -v can be
|
||||
// overridden by explicitly registered flags.) The parser stores and manages its
|
||||
// own copy of the [version] string so [version] can be freed immediately after
|
||||
// this call if it was dynamically constructed.
|
||||
void ap_set_version(ArgParser* parser, const char* version);
|
||||
|
||||
// Returns a pointer to the parser's version string.
|
||||
char* ap_get_version(ArgParser* parser);
|
||||
|
||||
// If toggled to true, the first positional argument ends option parsing; all
|
||||
// subsequent arguments will be treated as positionals. Defaults to false.
|
||||
void ap_first_pos_arg_ends_options(ArgParser* parser, boolean enable);
|
||||
|
||||
// Parses the application's command line arguments. The parameters are assumed
|
||||
// to be [argc] and [argv] as supplied to main(), i.e. the first element of the
|
||||
// array is assumed to be the binary name and is therefore ignored. Returns true
|
||||
// if the arguments were successfully parsed. Returns false if parsing failed
|
||||
// due to a memory allocation error. (This memory allocation error may have
|
||||
// occured during set-up rather than during parsing.)
|
||||
boolean ap_parse(ArgParser* parser, int argc, char** argv);
|
||||
|
||||
// Frees the memory associated with the parser and any subparsers.
|
||||
void ap_free(ArgParser* parser);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Register flags and options.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Registers a new flag.
|
||||
void ap_flag(ArgParser* parser, const char* name);
|
||||
|
||||
// Registers a new string-valued option.
|
||||
void ap_str_opt(ArgParser* parser, const char* name, const char* fallback);
|
||||
|
||||
// Registers a new integer-valued option.
|
||||
void ap_int_opt(ArgParser* parser, const char* name, int fallback);
|
||||
|
||||
// Registers a new double-valued option.
|
||||
void ap_dbl_opt(ArgParser* parser, const char* name, double fallback);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Inspect flags and options.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Returns the number of times the specified flag or option was found.
|
||||
int ap_count(ArgParser* parser, const char* name);
|
||||
|
||||
// Returns true if the specified flag or option was found.
|
||||
boolean ap_found(ArgParser* parser, const char* name);
|
||||
|
||||
// Returns the value of a string option.
|
||||
char* ap_str_value(ArgParser* parser, const char* name);
|
||||
|
||||
// Returns the string value at the specified index.
|
||||
char* ap_str_value_at_index(ArgParser* parser, const char* name, int index);
|
||||
|
||||
// Returns the value of an integer option.
|
||||
int ap_int_value(ArgParser* parser, const char* name);
|
||||
|
||||
// Returns the integer value at the specified index.
|
||||
int ap_int_value_at_index(ArgParser* parser, const char* name, int index);
|
||||
|
||||
// Returns the value of a floating-point option.
|
||||
double ap_dbl_value(ArgParser* parser, const char* name);
|
||||
|
||||
// Returns the floating-point value at the specified index.
|
||||
double ap_dbl_value_at_index(ArgParser* parser, const char* name, int index);
|
||||
|
||||
// Returns an option's values as a freshly-allocated array of string
|
||||
// pointers. The array's memory is not affected by calls to ap_free().
|
||||
// Returns NULL if memory allocation fails.
|
||||
char** ap_str_values(ArgParser* parser, const char* name);
|
||||
|
||||
// Returns an option's values as a freshly-allocated array of integers.
|
||||
// The array's memory is not affected by calls to ap_free().
|
||||
// Returns NULL if memory allocation fails.
|
||||
int* ap_int_values(ArgParser* parser, const char* name);
|
||||
|
||||
// Returns an option's values as a freshly-allocated array of doubles.
|
||||
// The array's memory is not affected by calls to ap_free().
|
||||
// Returns NULL if memory allocation fails.
|
||||
double* ap_dbl_values(ArgParser* parser, const char* name);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Positional arguments.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Returns true if the parser has found one or more positional arguments.
|
||||
boolean ap_has_args(ArgParser* parser);
|
||||
|
||||
// Returns the number of positional arguments.
|
||||
int ap_count_args(ArgParser* parser);
|
||||
|
||||
// Returns the positional argument at the specified index.
|
||||
char* ap_arg(ArgParser* parser, int index);
|
||||
|
||||
// Returns the positional arguments as a freshly-allocated array of string
|
||||
// pointers. The memory occupied by the returned array is not affected by
|
||||
// calls to ap_free(). Returns NULL if memory allocation fails.
|
||||
char** ap_args(ArgParser* parser);
|
||||
|
||||
// Attempts to parse and return the positional arguments as a freshly allocated
|
||||
// array of integers. Exits with an error message on failure. The memory
|
||||
// occupied by the returned array is not affected by calls to ap_free().
|
||||
// Returns NULL if memory allocation fails.
|
||||
int* ap_args_as_ints(ArgParser* parser);
|
||||
|
||||
// Attempts to parse and return the positional arguments as a freshly allocated
|
||||
// array of doubles. Exits with an error message on failure. The memory
|
||||
// occupied by the returned array is not affected by calls to ap_free().
|
||||
// Returns NULL if memory allocation fails.
|
||||
double* ap_args_as_doubles(ArgParser* parser);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Commands.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Registers a new command. Returns the ArgParser instance for the command.
|
||||
// Returns NULL if sufficient memory cannot be allocated for the new parser.
|
||||
ArgParser* ap_cmd(ArgParser* parser, const char* name);
|
||||
|
||||
// Registers a callback function on a command parser. The function will be
|
||||
// called if the command is found.
|
||||
void ap_callback(ArgParser* parser, ap_callback_t function);
|
||||
|
||||
// Returns true if the parser has found a command.
|
||||
boolean ap_has_cmd(ArgParser* parser);
|
||||
|
||||
// Returns the command name, if the parser has found a command.
|
||||
char* ap_cmd_name(ArgParser* parser);
|
||||
|
||||
// Returns the command's parser instance, if the parser has found a command.
|
||||
ArgParser* ap_cmd_parser(ArgParser* parser);
|
||||
|
||||
// This booleanean switch toggles support for an automatic 'help' command that
|
||||
// prints subcommand helptext. The value defaults to false but gets toggled
|
||||
// automatically to true whenever a command is registered. You can use this
|
||||
// function to disable the feature if required.
|
||||
void ap_enable_help_command(ArgParser* parser, boolean enable);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Debugging utilities.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Dump a parser instance for debugging.
|
||||
void ap_print(ArgParser* parser);
|
||||
|
||||
// True if an attempt to allocate memory failed.
|
||||
boolean ap_had_memory_error(ArgParser* parser);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Deprecated.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Replaced by ap_enable_help_command().
|
||||
void ap_cmd_help(ArgParser* parser, boolean enable);
|
||||
|
||||
// Replaced by ap_set_helptext().
|
||||
void ap_helptext(ArgParser* parser, const char* helptext);
|
||||
|
||||
// Replaced by ap_set_version().
|
||||
void ap_version(ArgParser* parser, const char* version);
|
||||
|
||||
#endif
|
||||
+3
-2
@@ -1641,10 +1641,11 @@ void D_SRB2Main(void)
|
||||
I_StartupSound();
|
||||
I_InitMusic();
|
||||
S_InitSfxChannels(cv_soundvolume.value);
|
||||
S_InitMusicDefs();
|
||||
S_InitMTDefs();
|
||||
}
|
||||
|
||||
S_InitMusicDefs();
|
||||
S_InitMTDefs();
|
||||
|
||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
ST_Init();
|
||||
|
||||
|
||||
+28
-34
@@ -484,6 +484,10 @@ 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_pingicon = {"pingicon", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t cv_pingstyle_cons_t[] = {{0, "New"}, {1, "Old"}, {0, NULL}};
|
||||
consvar_t cv_pingstyle = {"pingstyle", "New", CV_SAVE, cv_pingstyle_cons_t, 0, 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};
|
||||
@@ -795,6 +799,7 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_showping);
|
||||
CV_RegisterVar(&cv_pingmeasurement);
|
||||
CV_RegisterVar(&cv_pingicon);
|
||||
CV_RegisterVar(&cv_pingstyle);
|
||||
|
||||
#ifdef SEENAMES
|
||||
CV_RegisterVar(&cv_allowseenames);
|
||||
@@ -4605,14 +4610,6 @@ 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
|
||||
@@ -4649,16 +4646,13 @@ Command_Addskins (void)
|
||||
*/
|
||||
}
|
||||
|
||||
// args n stuff
|
||||
#include "args.h"
|
||||
|
||||
static void Command_GLocalSkin (void)
|
||||
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");
|
||||
@@ -4686,31 +4680,27 @@ static void Command_GLocalSkin (void)
|
||||
|
||||
fuck = ConcatCommandArgv(1, first_option);
|
||||
|
||||
char* player_name = player_names[consoleplayer];
|
||||
char* display_num = "0";
|
||||
const char* player_name = player_names[consoleplayer];
|
||||
const 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] != "-")
|
||||
if (COM_Argc() >= option_display)
|
||||
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);
|
||||
dnum = atoi(display_num);
|
||||
if (dnum > 3) // nuh uh
|
||||
dnum = 0;
|
||||
|
||||
CONS_Printf("Successfully applied localskin to displayed player.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Could not apply localskin.\n");
|
||||
|
||||
SetLocalPlayerSkin(displayplayers[dnum], fuck, NULL);
|
||||
|
||||
CONS_Printf("Successfully applied localskin to displayed player.\n");
|
||||
|
||||
Z_Free(fuck);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (option_all) // -all
|
||||
{
|
||||
int i;
|
||||
@@ -4723,34 +4713,38 @@ static void Command_GLocalSkin (void)
|
||||
}
|
||||
CONS_Printf("Successfully applied localskin to all players.\n");
|
||||
|
||||
Z_Free(fuck);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else // -player or no other arguments
|
||||
{
|
||||
if (option_player)
|
||||
if (option_player)
|
||||
{
|
||||
int i;
|
||||
player_name = COM_Argv(option_player + 1);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
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");
|
||||
|
||||
Z_Free(fuck);
|
||||
return;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalPlayerSkin(consoleplayer, fuck, &cv_localskin);
|
||||
CONS_Printf("Successfully applied localskin.\n");
|
||||
|
||||
Z_Free(fuck);
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Could not apply localskin.\n");
|
||||
|
||||
Z_Free(fuck);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +156,7 @@ extern consvar_t cv_pingtimeout;
|
||||
extern consvar_t cv_showping;
|
||||
extern consvar_t cv_pingmeasurement;
|
||||
extern consvar_t cv_pingicon;
|
||||
extern consvar_t cv_pingstyle;
|
||||
|
||||
//extern consvar_t cv_smallpos;
|
||||
extern consvar_t cv_showminimapnames;
|
||||
|
||||
+5
-5
@@ -496,17 +496,12 @@ consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_c
|
||||
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
||||
static CV_PossibleValue_t stretchfactor_t[] = {
|
||||
{0, "Off"}, {FRACUNIT/8, "0.125"}, {FRACUNIT/4, "0.250"},
|
||||
{3*FRACUNIT/8, "0.375"}, {FRACUNIT/2, "0.500"}, {5*FRACUNIT/8, "0.625"},
|
||||
{3*FRACUNIT/4, "0.750"}, {7*FRACUNIT/8, "0.875"}, {FRACUNIT, "Max"}, {0, NULL}};
|
||||
consvar_t cv_gravstretch = {"gravstretch", "0", 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};
|
||||
|
||||
@@ -516,6 +511,11 @@ static CV_PossibleValue_t sloperolldist_cons_t[] = {
|
||||
{3072, "3072"}, {4096, "4096"}, {6144, "6144"},
|
||||
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
|
||||
consvar_t cv_sloperolldist = {"sloperolldist", "Infinite", CV_SAVE, sloperolldist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t sloperoll_cons_t[] = {{0, "Off"}, {1, "Players"}, {2, "Everything"}, {0, NULL}};
|
||||
consvar_t cv_spriteroll = {"spriteroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, sloperoll_cons_t, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_sparkroll = {"sparkroll", "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};
|
||||
|
||||
consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
||||
+29
-19
@@ -127,25 +127,33 @@ extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
// Hud offsets
|
||||
extern consvar_t cv_item_xoffset;
|
||||
extern consvar_t cv_item_yoffset;
|
||||
extern consvar_t cv_time_xoffset;
|
||||
extern consvar_t cv_time_yoffset;
|
||||
extern consvar_t cv_laps_xoffset;
|
||||
extern consvar_t cv_laps_yoffset;
|
||||
extern consvar_t cv_spdm_xoffset;
|
||||
extern consvar_t cv_spdm_yoffset;
|
||||
extern consvar_t cv_posi_xoffset;
|
||||
extern consvar_t cv_posi_yoffset;
|
||||
extern consvar_t cv_face_xoffset;
|
||||
extern consvar_t cv_face_yoffset;
|
||||
extern consvar_t cv_stcd_xoffset;
|
||||
extern consvar_t cv_stcd_yoffset;
|
||||
extern consvar_t cv_chek_yoffset;
|
||||
extern consvar_t cv_mini_xoffset;
|
||||
extern consvar_t cv_mini_yoffset;
|
||||
extern consvar_t cv_want_xoffset;
|
||||
extern consvar_t cv_want_yoffset;
|
||||
#define DECL_HUD_OFFSET_X(name)\
|
||||
extern consvar_t cv_##name##_xoffset;
|
||||
|
||||
#define DECL_HUD_OFFSET_Y(name)\
|
||||
extern consvar_t cv_##name##_yoffset;
|
||||
|
||||
#define DECL_HUD_OFFSET(name)\
|
||||
DECL_HUD_OFFSET_X(name)\
|
||||
DECL_HUD_OFFSET_Y(name)
|
||||
|
||||
DECL_HUD_OFFSET(item); // Item box
|
||||
DECL_HUD_OFFSET(time); // Time
|
||||
DECL_HUD_OFFSET(laps); // Number of laps
|
||||
DECL_HUD_OFFSET(dnft); // Countdown (did not finish timer)
|
||||
DECL_HUD_OFFSET(spdm); // Speedometer
|
||||
DECL_HUD_OFFSET(posi); // Position in race
|
||||
DECL_HUD_OFFSET(face); // Mini rankings
|
||||
DECL_HUD_OFFSET(stcd); // Starting countdown
|
||||
DECL_HUD_OFFSET_Y(chek); // Check gfx
|
||||
DECL_HUD_OFFSET(mini); // Minimap
|
||||
DECL_HUD_OFFSET(want); // Wanted
|
||||
DECL_HUD_OFFSET(stat); // Stats
|
||||
|
||||
#undef DECL_HUD_OFFSET
|
||||
#undef DECL_HUD_OFFSET_X
|
||||
#undef DECL_HUD_OFFSET_Y
|
||||
|
||||
extern consvar_t cv_showinput;
|
||||
extern consvar_t cv_newspeedometer;
|
||||
|
||||
@@ -156,9 +164,11 @@ extern consvar_t cv_saltysquish;
|
||||
extern consvar_t cv_driftsparkpulse;
|
||||
extern consvar_t cv_gravstretch;
|
||||
extern consvar_t cv_sloperoll;
|
||||
extern consvar_t cv_spriteroll;
|
||||
extern consvar_t cv_sliptideroll;
|
||||
extern consvar_t cv_slamsound;
|
||||
extern consvar_t cv_sloperolldist;
|
||||
extern consvar_t cv_sparkroll;
|
||||
|
||||
extern consvar_t cv_cechotoggle;
|
||||
|
||||
|
||||
@@ -672,14 +672,6 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||
grmip->colormap += (256*32);
|
||||
#endif
|
||||
|
||||
grmip->colormap = colormaps;
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (!noencoremap && encoremap)
|
||||
grmip->colormap += (256*32);
|
||||
#endif
|
||||
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
|
||||
|
||||
@@ -129,8 +129,10 @@ typedef struct
|
||||
FLOAT x,y,z; // position
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
||||
FLOAT anglex2,anglez2; // secondaries
|
||||
#else
|
||||
FLOAT anglex,angley; // aimingangle / viewangle
|
||||
FLOAT anglex2; // secondaries
|
||||
#endif
|
||||
FLOAT scalex,scaley,scalez;
|
||||
FLOAT spritexscale,spriteyscale;
|
||||
@@ -232,7 +234,7 @@ typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
HWD_SET_SHADERS,
|
||||
HWD_SET_PALETTE_SHADER_ENABLED,
|
||||
HWD_PAL_SHADER,
|
||||
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
|
||||
+18
-3
@@ -567,9 +567,14 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
Surf.PolyColor.rgba = pLocalPalette[color].rgba;
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
Surf.PolyColor.rgba = pLocalPalette[color&0xFF].rgba;
|
||||
else
|
||||
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, false);
|
||||
}
|
||||
|
||||
@@ -960,11 +965,13 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
// -----------------+
|
||||
// HWR_DrawFill : draw flat coloured rectangle, with no texture
|
||||
// -----------------+
|
||||
// alug: now with translucency support X)
|
||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
float fx, fy, fw, fh;
|
||||
UINT8 alphalevel = ((color & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
|
||||
if (w < 0 || h < 0)
|
||||
return; // consistency w/ software
|
||||
@@ -1061,8 +1068,16 @@ 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, false);
|
||||
if (alphalevel)
|
||||
{
|
||||
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans];
|
||||
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans];
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_NoTexture|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
@@ -84,6 +84,7 @@ EXPORT boolean 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 void HWRAPI(InitPalette) (int flashnum, boolean skiplut);
|
||||
EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable);
|
||||
EXPORT void HWRAPI(ClearLightTableCache) (void);
|
||||
|
||||
@@ -138,6 +139,7 @@ struct hwdriver_s
|
||||
StartBatching pfnStartBatching;
|
||||
RenderBatches pfnRenderBatches;
|
||||
|
||||
InitPalette pfnInitPalette;
|
||||
AddLightTable pfnAddLightTable;
|
||||
ClearLightTableCache pfnClearLightTableCache;
|
||||
};
|
||||
|
||||
+181
-397
@@ -183,9 +183,9 @@ static void CV_grshaders_OnChange(void)
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
InitPalette(0, false);
|
||||
}
|
||||
HWR_InitPalette(0, false);
|
||||
|
||||
HWD.pfnSetSpecialState(HWD_PAL_SHADER, HWR_ShouldUsePaletteRendering());
|
||||
|
||||
V_SetPalette(0);
|
||||
}
|
||||
@@ -197,6 +197,9 @@ static void CV_useCustomShaders_ONChange(void)
|
||||
{
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnInitCustomShaders();
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
HWR_InitPalette(0, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +210,11 @@ static void CV_Gammaxxx_ONChange(void)
|
||||
V_SetPalette(0);
|
||||
}
|
||||
|
||||
void HWR_InitPalette(int flashnum, boolean skiplut)
|
||||
{
|
||||
HWD.pfnInitPalette(flashnum, skiplut);
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// Globals
|
||||
@@ -273,20 +281,24 @@ static fixed_t dup_viewx, dup_viewy, dup_viewz;
|
||||
static angle_t gr_aimingangle;
|
||||
static float gr_viewludsin, gr_viewludcos;
|
||||
|
||||
//
|
||||
// PORTALS
|
||||
//
|
||||
// ==========================================================================
|
||||
// Visual portals (attr. Hannu Hanhi)
|
||||
// ==========================================================================
|
||||
|
||||
#define MAX_GRPORTALS 13
|
||||
// Note: portal sorting has not been ported to this
|
||||
//#define PORTALSORTING // Breaks recursive portals :[
|
||||
|
||||
|
||||
// for porting gonna add stuff from r_portal here with adjustments
|
||||
|
||||
typedef struct portal_s
|
||||
enum
|
||||
{
|
||||
struct portal_s *next;
|
||||
GRPORTAL_OFF,
|
||||
GRPORTAL_SEARCH,
|
||||
GRPORTAL_STENCIL,
|
||||
GRPORTAL_DEPTH,
|
||||
GRPORTAL_INSIDE,
|
||||
};
|
||||
|
||||
static int gr_portal = GRPORTAL_OFF;
|
||||
static boolean gl_drawing_stencil = false;
|
||||
typedef struct gl_portal_s
|
||||
{
|
||||
struct gl_portal_s *next;
|
||||
|
||||
// Viewport.
|
||||
fixed_t viewx;
|
||||
@@ -300,36 +312,38 @@ typedef struct portal_s
|
||||
INT32 drawcount; /**< For OpenGL. */
|
||||
|
||||
seg_t *seg;
|
||||
} portal_t;
|
||||
} gl_portal_t;
|
||||
|
||||
typedef struct portallist_s
|
||||
typedef struct gl_portallist_s
|
||||
{
|
||||
portal_t *base;
|
||||
portal_t *cap;
|
||||
} portallist_t;
|
||||
gl_portal_t *base;
|
||||
gl_portal_t *cap;
|
||||
} gl_portallist_t;
|
||||
|
||||
// new thing
|
||||
portallist_t *currentportallist;
|
||||
gl_portallist_t *currentportallist;
|
||||
|
||||
INT32 portalviewside;
|
||||
|
||||
// Linked list for portals.
|
||||
portal_t *portal_base_gl, *portal_cap_gl;
|
||||
gl_portal_t *portal_base_gl, *portal_cap_gl;
|
||||
|
||||
/* For now, these aren't used.
|
||||
// maybe at some point these could be organized better
|
||||
void HWR_Portal_InitList (void)
|
||||
static void HWR_Portal_InitList (void)
|
||||
{
|
||||
portalrender = 0;
|
||||
portal_base_gl = portal_cap_gl = NULL;
|
||||
}
|
||||
|
||||
void HWR_Portal_Remove (portal_t* portal)
|
||||
static void HWR_Portal_Remove(gl_portal_t* portal)
|
||||
{
|
||||
portal_base_gl = portal->next;
|
||||
Z_Free(portal);
|
||||
}
|
||||
*/
|
||||
|
||||
void HWR_Portal_Add2Lines (const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
static void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
{
|
||||
line_t *start, *dest;
|
||||
|
||||
@@ -340,17 +354,9 @@ void HWR_Portal_Add2Lines (const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
|
||||
vertex_t dest_c, start_c;
|
||||
|
||||
portal_t *portal;
|
||||
gl_portal_t *portal;
|
||||
|
||||
// check for duplicate
|
||||
/*if (currentportallist->base && currentportallist->cap->startline == line1 && currentportallist->cap->clipline == line2)
|
||||
{
|
||||
if (printportals)
|
||||
CONS_Printf("Duplicate portal skipped\n");
|
||||
return;
|
||||
}*/
|
||||
|
||||
portal = Z_Malloc(sizeof(portal_t), PU_STATIC, NULL);
|
||||
portal = Z_Malloc(sizeof(gl_portal_t), PU_STATIC, NULL);
|
||||
|
||||
// Linked list.
|
||||
if (!currentportallist->base)
|
||||
@@ -404,7 +410,7 @@ void HWR_Portal_Add2Lines (const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
portal->clipline = line2;
|
||||
}
|
||||
|
||||
void HWR_PortalFrame(portal_t* portal)
|
||||
static void HWR_PortalFrame(gl_portal_t* portal)
|
||||
{
|
||||
viewx = portal->viewx;
|
||||
viewy = portal->viewy;
|
||||
@@ -429,42 +435,6 @@ void HWR_PortalFrame(portal_t* portal)
|
||||
}
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
GRPORTAL_OFF,
|
||||
GRPORTAL_SEARCH,
|
||||
GRPORTAL_STENCIL,
|
||||
GRPORTAL_DEPTH,
|
||||
GRPORTAL_INSIDE,
|
||||
};
|
||||
|
||||
void HWR_RenderSinglePortal(portal_t *portal, size_t portalnum, float fpov, player_t *player);
|
||||
|
||||
#ifdef PORTALSORTING
|
||||
static portal_t gr_portals[MAX_GRPORTALS];
|
||||
static size_t gr_numportals = 0;
|
||||
|
||||
static void HWR_AddPortal(portal_t *portal);
|
||||
static void HWR_SortPortals(player_t *player, float fpov, INT32 viewnumber, postimg_t *ptype);
|
||||
#endif
|
||||
|
||||
static int gr_portal = GRPORTAL_OFF;
|
||||
static boolean gl_drawing_stencil = false;
|
||||
|
||||
// Culling
|
||||
typedef struct
|
||||
{
|
||||
seg_t *seg;
|
||||
sector_t *frontsector;
|
||||
sector_t *backsector;
|
||||
} gr_portalcullinfo_t;
|
||||
|
||||
static gr_portalcullinfo_t gr_portalsegs[MAX_GRPORTALS];
|
||||
static size_t gr_numportalsegs = 0;
|
||||
|
||||
static sector_t *gr_portalcullsectors[MAX_GRPORTALS];
|
||||
static size_t gr_numportalcullsectors = 0;
|
||||
|
||||
// ==========================================================================
|
||||
// Lighting
|
||||
// ==========================================================================
|
||||
@@ -566,7 +536,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_ClearLightTableCache()
|
||||
void HWR_ClearLightTableCache(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnClearLightTableCache();
|
||||
@@ -1178,8 +1148,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
colormap = pfloor->master->frontsector->extra_colormap;
|
||||
lightnum = pfloor->master->frontsector->lightlevel;
|
||||
colormap = pfloor->master->frontsector->extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y);
|
||||
}else{
|
||||
lightnum = HWR_CalcWallLight(pfloor->master->frontsector->lightlevel, v1x, v1y, v2x, v2y);
|
||||
@@ -1190,8 +1160,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
colormap = list[i].extra_colormap;
|
||||
lightnum = *list[i].lightlevel;
|
||||
colormap = list[i].extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y);
|
||||
}else{
|
||||
lightnum = HWR_CalcWallLight(*list[i].lightlevel, v1x, v1y, v2x, v2y);
|
||||
@@ -1427,12 +1397,12 @@ int skyWallVertexArrayAllocSize = 65536;// what a mouthful
|
||||
|
||||
boolean gr_collect_skywalls = false;
|
||||
|
||||
void HWR_SkyWallList_Clear()
|
||||
static void HWR_SkyWallList_Clear(void)
|
||||
{
|
||||
skyWallVertexArraySize = 0;
|
||||
}
|
||||
|
||||
void HWR_SkyWallList_Add(FOutVector *wallVerts)
|
||||
static void HWR_SkyWallList_Add(FOutVector *wallVerts)
|
||||
{
|
||||
if (!skyWallVertexArray)
|
||||
{
|
||||
@@ -1451,7 +1421,7 @@ void HWR_SkyWallList_Add(FOutVector *wallVerts)
|
||||
skyWallVertexArraySize++;
|
||||
}
|
||||
|
||||
void HWR_DrawSkyWallList()
|
||||
static void HWR_DrawSkyWallList(void)
|
||||
{
|
||||
int i;
|
||||
FSurfaceInfo surf;
|
||||
@@ -1491,68 +1461,6 @@ void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf)
|
||||
// PF_Occlude is set in HWR_ProjectWall to draw into the depth buffer
|
||||
}
|
||||
|
||||
// HWR_DrawPortalClipWall
|
||||
// Draws an invisible wall that extends to nowhere,
|
||||
// so that portals can be clipped correctly.
|
||||
static void HWR_DrawPortalClipWall(line_t *line)
|
||||
{
|
||||
FOutVector wallVerts[4];
|
||||
FSurfaceInfo Surf;
|
||||
v2d_t vs, ve;
|
||||
fixed_t length = 1000*FRACUNIT;
|
||||
fixed_t temp = 0;
|
||||
|
||||
angle_t angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y);
|
||||
angle_t lineangle = 0;
|
||||
|
||||
// no texture
|
||||
HWD.pfnSetTexture(NULL);
|
||||
wallVerts[3].t = wallVerts[2].t = 0;
|
||||
wallVerts[0].t = wallVerts[1].t = 0;
|
||||
wallVerts[0].s = wallVerts[3].s = 0;
|
||||
wallVerts[2].s = wallVerts[1].s = 0;
|
||||
|
||||
//wallVerts[0].w = wallVerts[1].w = wallVerts[2].w = wallVerts[3].w = 1.0f; whatever this is i guess it cant be here
|
||||
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN);
|
||||
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX);
|
||||
|
||||
// first
|
||||
vs.x = FIXED_TO_FLOAT(line->v1->x);
|
||||
vs.y = FIXED_TO_FLOAT(line->v1->y);
|
||||
|
||||
angle -= ANGLE_180;
|
||||
lineangle = (angle >> ANGLETOFINESHIFT);
|
||||
temp = FixedMul(length, FINECOSINE(lineangle));
|
||||
ve.x = vs.x + FIXED_TO_FLOAT(temp);
|
||||
temp = FixedMul(length, FINESINE(lineangle));
|
||||
ve.y = vs.y + FIXED_TO_FLOAT(temp);
|
||||
|
||||
wallVerts[0].x = wallVerts[3].x = ve.x;
|
||||
wallVerts[0].z = wallVerts[3].z = ve.y;
|
||||
wallVerts[2].x = wallVerts[1].x = vs.x;
|
||||
wallVerts[2].z = wallVerts[1].z = vs.y;
|
||||
|
||||
HWR_ProjectWall(wallVerts, &Surf, PF_NoTexture, 255, NULL);
|
||||
|
||||
// second
|
||||
vs.x = FIXED_TO_FLOAT(line->v2->x);
|
||||
vs.y = FIXED_TO_FLOAT(line->v2->y);
|
||||
|
||||
angle += ANGLE_180;
|
||||
lineangle = (angle >> ANGLETOFINESHIFT);
|
||||
temp = FixedMul(length, FINECOSINE(lineangle));
|
||||
ve.x = vs.x + FIXED_TO_FLOAT(temp);
|
||||
temp = FixedMul(length, FINESINE(lineangle));
|
||||
ve.y = vs.y + FIXED_TO_FLOAT(temp);
|
||||
|
||||
wallVerts[0].x = wallVerts[3].x = ve.x;
|
||||
wallVerts[0].z = wallVerts[3].z = ve.y;
|
||||
wallVerts[2].x = wallVerts[1].x = vs.x;
|
||||
wallVerts[2].z = wallVerts[1].z = vs.y;
|
||||
|
||||
HWR_ProjectWall(wallVerts, &Surf, PF_NoTexture, 255, NULL);
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_ProcessSeg
|
||||
// A portion or all of a wall segment will be drawn, from startfrac to endfrac,
|
||||
@@ -1652,8 +1560,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
colormap = gr_frontsector->extra_colormap;
|
||||
lightnum = gr_frontsector->lightlevel;
|
||||
colormap = gr_frontsector->extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
|
||||
}else{
|
||||
lightnum = HWR_CalcWallLight(gr_frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y);
|
||||
@@ -2414,7 +2322,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
{
|
||||
ffloor_t * rover;
|
||||
fixed_t highcut = 0, lowcut = 0;
|
||||
fixed_t lowcutslope, highcutslope;
|
||||
fixed_t lowcutslope = 0, highcutslope = 0;
|
||||
|
||||
// Used for height comparisons and etc across FOFs and slopes
|
||||
fixed_t high1, highslope1, low1, lowslope1;
|
||||
@@ -2600,8 +2508,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
lightnum = rover->master->frontsector->lightlevel;
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
|
||||
}else{
|
||||
lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y);
|
||||
@@ -2751,8 +2659,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
lightnum = rover->master->frontsector->lightlevel;
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
|
||||
}else{
|
||||
lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y);
|
||||
@@ -2879,15 +2787,7 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
|
||||
viewc1 = backc1;
|
||||
viewc2 = backc2;
|
||||
}
|
||||
/*
|
||||
// dont clip viewsector when rendering portal contents
|
||||
if (portalclipline)
|
||||
{
|
||||
if (printportals)
|
||||
CONS_Printf("Clipping skipped on portal viewsector\n");
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
// check if camera is outside the bounds of the floor and the ceiling (noclipping)
|
||||
// either above the ceiling or below the floor
|
||||
if ((viewz > viewc1 && viewz > viewc2) || (viewz < viewf1 && viewz < viewf2))
|
||||
@@ -3002,20 +2902,7 @@ void HWR_AddLine(seg_t *line)
|
||||
{
|
||||
vertex_t closest_point;
|
||||
boolean pass = false;
|
||||
/*
|
||||
if (P_PointOnLineSide(line->v1->x, line->v1->y, portalclipline) != portalviewside)
|
||||
{
|
||||
P_ClosestPointOnLine(line->v1->x, line->v1->y, portalclipline, &closest_point);
|
||||
if (closest_point.x != line->v1->x || closest_point.y != line->v1->y)
|
||||
pass = true;
|
||||
}
|
||||
if (!pass && P_PointOnLineSide(line->v2->x, line->v2->y, portalclipline) != portalviewside)
|
||||
{
|
||||
P_ClosestPointOnLine(line->v2->x, line->v2->y, portalclipline, &closest_point);
|
||||
if (closest_point.x != line->v2->x || closest_point.y != line->v2->y)
|
||||
pass = true;
|
||||
}
|
||||
*/
|
||||
|
||||
// similar idea than in PortalCheckBBox, but checking the line vertices instead
|
||||
// TODO could make the check more efficient and not check anything if pass==true from earlier or something
|
||||
P_ClosestPointOnLine(line->v1->x, line->v1->y, portalclipline, &closest_point);
|
||||
@@ -3029,19 +2916,7 @@ void HWR_AddLine(seg_t *line)
|
||||
{
|
||||
if (P_PointOnLineSide(line->v2->x, line->v2->y, portalclipline) != portalviewside)
|
||||
pass = true;
|
||||
}/*
|
||||
P_ClosestPointOnLine(v1x, v1y, portalclipline, &closest_point);
|
||||
if (closest_point.x != v1x || closest_point.y != v1y)
|
||||
{
|
||||
if (P_PointOnLineSide(v1x, v1y, portalclipline) != portalviewside)
|
||||
pass = true;
|
||||
}
|
||||
P_ClosestPointOnLine(v2x, v2y, portalclipline, &closest_point);
|
||||
if (closest_point.x != v2x || closest_point.y != v2y)
|
||||
{
|
||||
if (P_PointOnLineSide(v2x, v2y, portalclipline) != portalviewside)
|
||||
pass = true;
|
||||
}*/
|
||||
if (!pass)
|
||||
return;
|
||||
}
|
||||
@@ -3064,83 +2939,6 @@ void HWR_AddLine(seg_t *line)
|
||||
|
||||
gr_backsector = line->backsector;
|
||||
|
||||
// Portal line
|
||||
/*
|
||||
if (cv_grportals.value && line->linedef->special == 40 && line->side == 0)
|
||||
{
|
||||
if (portalrender < cv_maxportals.value)
|
||||
{
|
||||
// Find the other side!
|
||||
INT32 line2 = P_FindSpecialLineFromTag(40, line->linedef->tag, -1);
|
||||
if (line->linedef == &lines[line2])
|
||||
line2 = P_FindSpecialLineFromTag(40, line->linedef->tag, line2);
|
||||
if (line2 >= 0) // found it!
|
||||
{
|
||||
// oh no :DD
|
||||
if (gr_portal == GRPORTAL_PROCESS)
|
||||
{
|
||||
gr_portal = GRPORTAL_FOUND;
|
||||
return;
|
||||
}
|
||||
|
||||
// Portal processing
|
||||
if ((gr_portal == GRPORTAL_MASKING) || (gr_portal == GRPORTAL_INSIDE))
|
||||
{
|
||||
// masking the view 1
|
||||
if (gr_portal == GRPORTAL_MASKING)
|
||||
{
|
||||
size_t numportal = gr_numportalsegs;
|
||||
if (numportal < MAX_GRPORTALS)
|
||||
{
|
||||
gr_portalsegs[numportal].seg = line;
|
||||
gr_portalsegs[numportal].frontsector = gr_frontsector;
|
||||
gr_portalsegs[numportal].backsector = gr_backsector;
|
||||
gr_numportalsegs++;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the portal
|
||||
HWR_Portal_Add2Lines(line->linedef-lines, line2);
|
||||
|
||||
// masking the view 2
|
||||
if (gr_portal == GRPORTAL_MASKING)
|
||||
{
|
||||
// portal_cap_gl = last added portal
|
||||
portal_t *lastportal = portal_cap_gl;
|
||||
lastportal->drawcount = drawcount++;
|
||||
|
||||
// extend clipping
|
||||
HWR_DrawPortalClipWall(line->linedef);
|
||||
|
||||
// add cull sector
|
||||
if (gr_numportalcullsectors < MAX_GRPORTALS)
|
||||
{
|
||||
sector_t *cullsec = NULL;
|
||||
if (lastportal->clipline != -1)
|
||||
{
|
||||
line_t *grclipline = &lines[lastportal->clipline];
|
||||
cullsec = grclipline->frontsector;
|
||||
}
|
||||
gr_portalcullsectors[gr_numportalcullsectors] = cullsec;
|
||||
gr_numportalcullsectors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gld_clipper_SafeAddClipRange(angle2, angle1);
|
||||
|
||||
if (gr_portal != GRPORTAL_OUTSIDE)
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Recursed TOO FAR (viewing a portal within a portal)
|
||||
// So uhhh, render it as a normal wall instead or something ???
|
||||
}
|
||||
#ifndef PORTALSORTING
|
||||
else if (gr_portal == GRPORTAL_MASKING)
|
||||
return;
|
||||
#endif
|
||||
*/
|
||||
if (line->linedef->special == 40)
|
||||
{
|
||||
if (line->side == 0)
|
||||
@@ -3947,7 +3745,7 @@ skip_stuff_for_portals:
|
||||
// use returned value as multiplier for the added values from p_thrust thing
|
||||
// P_InterceptVector needs divlines which need dx and dy, dx=x2-x1 dy=y2-y1
|
||||
|
||||
boolean HWR_PortalCheckBBox(fixed_t *bspcoord)
|
||||
static boolean HWR_PortalCheckBBox(fixed_t *bspcoord)
|
||||
{
|
||||
vertex_t closest_point;
|
||||
if (!portalclipline)
|
||||
@@ -4020,10 +3818,6 @@ void HWR_RenderBSPNode(INT32 bspnum)
|
||||
return;
|
||||
}
|
||||
|
||||
// in portal checking phase we can stop after one is found
|
||||
//if (gr_portal == GRPORTAL_FOUND)
|
||||
// return;
|
||||
|
||||
// Decide which side the view point is on.
|
||||
side = R_PointOnSide(viewx, viewy, bsp);
|
||||
|
||||
@@ -4031,10 +3825,6 @@ void HWR_RenderBSPNode(INT32 bspnum)
|
||||
if (HWR_PortalCheckBBox(bsp->bbox[side]))
|
||||
HWR_RenderBSPNode(bsp->children[side]);
|
||||
|
||||
// in portal checking phase we can stop after one is found
|
||||
//if (gr_portal == GRPORTAL_FOUND)
|
||||
// return;
|
||||
|
||||
// Possibly divide back space.
|
||||
if (HWR_CheckBBox(bsp->bbox[side^1]) && HWR_PortalCheckBBox(bsp->bbox[side^1]))
|
||||
HWR_RenderBSPNode(bsp->children[side^1]);
|
||||
@@ -4331,7 +4121,7 @@ static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused)
|
||||
{
|
||||
if (spr->precip)
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
@@ -4342,7 +4132,7 @@ static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts
|
||||
}
|
||||
else
|
||||
{
|
||||
if (spr->precip)
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
@@ -5515,10 +5305,9 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
boolean mirrored = thing->mirrored;
|
||||
boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
|
||||
|
||||
angle_t ang;
|
||||
angle_t ang, camang;
|
||||
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
INT32 heightsec, phs;
|
||||
vector3_t pos;
|
||||
|
||||
fixed_t spr_width, spr_height;
|
||||
fixed_t spr_offset, spr_topoffset;
|
||||
@@ -5529,8 +5318,6 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
angle_t sliptiderollangle = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
@@ -5616,6 +5403,8 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
#endif
|
||||
|
||||
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
|
||||
camang = R_PointToAngle (interp.x, interp.y);
|
||||
|
||||
if (mirrored)
|
||||
ang = InvAngle(ang);
|
||||
|
||||
@@ -5666,29 +5455,38 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
spr_topoffset = spritecachedinfo[lumpoff].topoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if ((thing->rollangle)||(thing->sloperoll)||(thing->player && thing->player->sliproll))
|
||||
if (cv_spriteroll.value)
|
||||
{
|
||||
if (thing->player)
|
||||
{
|
||||
sliptiderollangle = cv_sliptideroll.value ? thing->player->sliproll*(thing->player->sliptidemem) : 0;
|
||||
rollsum = (thing->rollangle)+(thing->sloperoll)+FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
}
|
||||
else
|
||||
rollsum = (thing->rollangle)+(thing->sloperoll);
|
||||
rollangle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp.roll)
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp.pitch)
|
||||
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp.sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp.slopepitch)
|
||||
+ thing->rollangle;
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
if ((rollangle)||(thing->player && thing->player->sliproll))
|
||||
{
|
||||
spr_width = rotsprite->width << FRACBITS;
|
||||
spr_height = rotsprite->height << FRACBITS;
|
||||
spr_offset = rotsprite->leftoffset << FRACBITS;
|
||||
spr_topoffset = rotsprite->topoffset << FRACBITS;
|
||||
spr_topoffset += FEETADJUST;
|
||||
|
||||
// flip -> rotate, not rotate -> flip
|
||||
flip = 0;
|
||||
if (thing->player)
|
||||
{
|
||||
sliptiderollangle = cv_sliptideroll.value ? thing->player->sliproll*(thing->player->sliptidemem) : 0;
|
||||
rollsum = rollangle+FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
}
|
||||
else
|
||||
rollsum = rollangle;
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
spr_width = rotsprite->width << FRACBITS;
|
||||
spr_height = rotsprite->height << FRACBITS;
|
||||
spr_offset = rotsprite->leftoffset << FRACBITS;
|
||||
spr_topoffset = rotsprite->topoffset << FRACBITS;
|
||||
spr_topoffset += FEETADJUST;
|
||||
|
||||
// flip -> rotate, not rotate -> flip
|
||||
flip = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -5794,7 +5592,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
vis->spriteyoffset = FIXED_TO_FLOAT(spr_topoffset);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (rotsprite)
|
||||
if ((rotsprite) && (cv_spriteroll.value))
|
||||
vis->gpatch = (GLPatch_t *)rotsprite;
|
||||
else
|
||||
#endif
|
||||
@@ -6142,7 +5940,7 @@ void HWR_ClearClipper(void)
|
||||
}
|
||||
|
||||
// Adds an entry to the clipper for portal rendering
|
||||
void HWR_PortalClipping(portal_t *portal)
|
||||
static void HWR_PortalClipping(gl_portal_t *portal)
|
||||
{
|
||||
angle_t angle1, angle2;
|
||||
|
||||
@@ -6155,14 +5953,84 @@ void HWR_PortalClipping(portal_t *portal)
|
||||
gld_clipper_SafeAddClipRange(angle2, angle1);
|
||||
}
|
||||
|
||||
//
|
||||
// Render portals recursively depth first. With portals disabled only current scene is rendered.
|
||||
//
|
||||
void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals)
|
||||
enum
|
||||
{
|
||||
portallist_t portallist;
|
||||
portal_t *portal;
|
||||
portal_t *portal_temp;
|
||||
HWR_STENCIL_NORMAL,
|
||||
HWR_STENCIL_BEGIN,
|
||||
HWR_STENCIL_REVERSE,
|
||||
HWR_STENCIL_DEPTH,
|
||||
HWR_STENCIL_SKY
|
||||
};
|
||||
|
||||
// Changes the current stencil state.
|
||||
static void HWR_SetStencilState(int state, int level)
|
||||
{
|
||||
if (!cv_nostencil.value && level > -1)
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
}
|
||||
|
||||
// Renders a portal segment.
|
||||
static void HWR_RenderPortalSeg(gl_portal_t* portal, int state)
|
||||
{
|
||||
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
|
||||
// set our portal state and prepare to render the seg
|
||||
gr_portal = state;
|
||||
gr_curline = portal->seg;
|
||||
gr_frontsector = portal->seg->frontsector;
|
||||
gr_backsector = portal->seg->backsector;
|
||||
HWR_ProcessSeg();
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
|
||||
// Renders the current viewpoint, though takes portal arguments for recursive portals.
|
||||
static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
|
||||
|
||||
// Renders a single portal from the current viewpoint.
|
||||
static void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
|
||||
{
|
||||
// draw portal seg to stencil buffer with increment
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GRPORTAL_STENCIL);
|
||||
|
||||
// go to portal frame lmao
|
||||
HWR_PortalFrame(portal);
|
||||
// call HWR_RenderViewpoint
|
||||
HWR_RenderViewpoint(portal, fpov, player, stencil_level + 1, true);
|
||||
// return to current frame
|
||||
if (rootportal)
|
||||
HWR_PortalFrame(rootportal);
|
||||
else // current frame is not a portal frame but the main view!
|
||||
{
|
||||
R_SetupFrame(player, false);
|
||||
portalclipline = NULL;
|
||||
}
|
||||
|
||||
// remove portal seg from stencil buffer
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GRPORTAL_STENCIL);
|
||||
|
||||
// draw portal seg to depth buffer
|
||||
HWR_ClearClipper();
|
||||
HWR_SetStencilState(HWR_STENCIL_DEPTH, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GRPORTAL_DEPTH);
|
||||
}
|
||||
|
||||
// Renders the current viewpoint, though takes portal arguments for recursive portals.
|
||||
static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals)
|
||||
{
|
||||
gl_portallist_t portallist;
|
||||
gl_portal_t *portal;
|
||||
gl_portal_t *gl_portal_temp;
|
||||
portallist.base = portallist.cap = NULL;
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
|
||||
@@ -6186,75 +6054,14 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
{
|
||||
if (cv_portalline.value && cv_portalline.value != portal->startline)
|
||||
continue;
|
||||
if (!cv_nostencil.value)
|
||||
{
|
||||
// draw portal seg to stencil buffer with increment
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
gl_drawing_stencil = true;
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, stencil_level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_STENCIL_SEGS);
|
||||
gr_portal = GRPORTAL_STENCIL;
|
||||
gr_frontsector = portal->seg->frontsector;
|
||||
validcount++;
|
||||
HWR_AddLine(portal->seg);
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
// go to portal frame
|
||||
HWR_PortalFrame(portal);
|
||||
// call RecursivePortalRendering
|
||||
RecursivePortalRendering(portal, fpov, player, stencil_level + 1, true);
|
||||
// return to current frame
|
||||
if (rootportal)
|
||||
HWR_PortalFrame(rootportal);
|
||||
else// current frame is not a portal frame but the main view!
|
||||
{
|
||||
R_SetupFrame(player, false);
|
||||
portalclipline = NULL;
|
||||
}
|
||||
if (!cv_nostencil.value)
|
||||
{
|
||||
// remove portal seg from stencil buffer
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
gl_drawing_stencil = true;
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, stencil_level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_STENCIL_REVERSE_SEGS);
|
||||
gr_portal = GRPORTAL_STENCIL;
|
||||
gr_frontsector = portal->seg->frontsector;
|
||||
validcount++;
|
||||
HWR_AddLine(portal->seg);
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
// draw portal seg to depth buffer
|
||||
HWR_ClearClipper();
|
||||
gl_drawing_stencil = true;
|
||||
if (!cv_nostencil.value)
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, stencil_level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_DEPTH_SEGS);
|
||||
gr_portal = GRPORTAL_DEPTH;
|
||||
gr_frontsector = portal->seg->frontsector;
|
||||
validcount++;
|
||||
HWR_AddLine(portal->seg);
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
HWR_RenderPortal(portal, rootportal, fpov, player, stencil_level);
|
||||
}
|
||||
gr_portal = GRPORTAL_INSIDE;// when portal walls are encountered in following bsp traversal, nothing should be drawn
|
||||
}
|
||||
else
|
||||
gr_portal = GRPORTAL_OFF;// there may be portals and they need to be drawn as regural walls
|
||||
// draw normal things in current frame in current incremented stencil buffer area
|
||||
if (!cv_nostencil.value)
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, stencil_level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_NORMAL);
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
|
||||
if (!cv_portalonly.value || rootportal)
|
||||
{
|
||||
HWR_ClearClipper();
|
||||
@@ -6282,14 +6089,14 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
|
||||
// HAYA: Save the old portal state, and turn portals off while normally rendering the BSP tree.
|
||||
// This fixes specific effects not working, such as horizon lines.
|
||||
int oldportal_state = gr_portal;
|
||||
int oldgl_portal_state = gr_portal;
|
||||
|
||||
if (gr_portal != GRPORTAL_OFF) // if we already haven't hit the recursion limit or we already ended our portal shenanigans
|
||||
gr_portal = GRPORTAL_INSIDE; // TURN IT OFF
|
||||
// Recursively "render" the BSP tree.
|
||||
HWR_RenderBSPNode((INT32)numnodes-1);
|
||||
// woo we back
|
||||
gr_portal = oldportal_state;
|
||||
gr_portal = oldgl_portal_state;
|
||||
|
||||
PS_STOP_TIMING(ps_bsptime);
|
||||
|
||||
@@ -6302,15 +6109,13 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
}
|
||||
if (skyWallVertexArraySize)// if there are skywalls to draw using the alternate method
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_SKY_STENCIL_SEGS);
|
||||
HWR_SetStencilState(HWR_STENCIL_SKY, -1);
|
||||
HWR_DrawSkyWallList();
|
||||
HWR_SkyWallList_Clear();
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, 1);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_NORMAL);
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 1);
|
||||
drewsky = false;
|
||||
HWR_DrawSkyBackground(fpov);
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, 0);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_NORMAL);
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
|
||||
HWD.pfnClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
}
|
||||
@@ -6330,12 +6135,12 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
HWR_RenderDrawNodes();
|
||||
}
|
||||
// free memory from portal list allocated by calls to Add2Lines
|
||||
portal_temp = portallist.base;
|
||||
while (portal_temp)
|
||||
gl_portal_temp = portallist.base;
|
||||
while (gl_portal_temp)
|
||||
{
|
||||
portal_t *nextportal = portal_temp->next;
|
||||
Z_Free(portal_temp);
|
||||
portal_temp = nextportal;
|
||||
gl_portal_t *nextportal = gl_portal_temp->next;
|
||||
Z_Free(gl_portal_temp);
|
||||
gl_portal_temp = nextportal;
|
||||
}
|
||||
|
||||
// TODO: batching at some point
|
||||
@@ -6348,7 +6153,6 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
// ==========================================================================
|
||||
void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
{
|
||||
angle_t a1;
|
||||
const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd);
|
||||
postimg_t *postprocessor = &postimgtype[0];
|
||||
INT32 i;
|
||||
@@ -6466,7 +6270,7 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
validcount++;
|
||||
|
||||
portalclipline = NULL;
|
||||
RecursivePortalRendering(NULL, fpov, player, 0, !skybox);
|
||||
HWR_RenderViewpoint(NULL, fpov, player, 0, !skybox);
|
||||
HWR_SetTransform(fpov, player);// not sure if needed
|
||||
|
||||
// Unset transform and shader
|
||||
@@ -6485,26 +6289,6 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
}
|
||||
|
||||
void HWR_RenderSinglePortal(portal_t *portal, size_t portalnum, float fpov, player_t *player)
|
||||
{
|
||||
portalrender = portal->pass; // Recursiveness depth.
|
||||
|
||||
// Apply the viewpoint stored for the portal.
|
||||
HWR_PortalFrame(portal);
|
||||
HWR_ClearClipper();
|
||||
HWR_ClearSprites();
|
||||
HWR_SetTransform(fpov, player);
|
||||
validcount++;
|
||||
|
||||
// Render the BSP from the new viewpoint.
|
||||
portalcullsector = gr_portalcullsectors[portalnum];
|
||||
HWR_RenderBSPNode((INT32)numnodes - 1);
|
||||
|
||||
HWR_SortVisSprites();
|
||||
HWR_DrawSprites();
|
||||
HWR_RenderDrawNodes();
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Render the player view.
|
||||
// ==========================================================================
|
||||
|
||||
@@ -114,6 +114,7 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void HWR_MakeScreenFinalTexture(void);
|
||||
void HWR_DrawScreenFinalTexture(int width, int height);
|
||||
void HWR_InitPalette(int flashnum, boolean skiplut);
|
||||
|
||||
// hw_main.c: Planes
|
||||
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
|
||||
|
||||
+43
-4
@@ -1401,18 +1401,55 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
|
||||
|
||||
p.anglex = 0.0f;
|
||||
p.anglex2 = 0.0f;
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
// Slope rotation from Kart
|
||||
p.anglez = 0.0f;
|
||||
p.anglez2 = 0.0f;
|
||||
|
||||
// use secondary angles for the slope rotation
|
||||
if (spr->mobj->standingslope)
|
||||
{
|
||||
fixed_t tempz = spr->mobj->standingslope->normal.z;
|
||||
fixed_t tempy = spr->mobj->standingslope->normal.y;
|
||||
fixed_t tempx = spr->mobj->standingslope->normal.x;
|
||||
fixed_t tempangle = AngleFixed(R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
|
||||
p.anglez = FIXED_TO_FLOAT(tempangle);
|
||||
p.anglez2 = FIXED_TO_FLOAT(tempangle);
|
||||
tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
|
||||
p.anglex = FIXED_TO_FLOAT(tempangle);
|
||||
p.anglex2 = FIXED_TO_FLOAT(tempangle);
|
||||
}
|
||||
else if ((spr->mobj->sloperoll || spr->mobj->slopepitch) && (!P_IsObjectOnGround(spr->mobj)) && (!paused))
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
angle_t camang = R_PointToAngle(interp.x, interp.y);
|
||||
angle_t mobjang;
|
||||
|
||||
if (spr->mobj->flags & (MF_NOTHINK|MF_SCENERY))
|
||||
mobjang = spr->mobj->angle;
|
||||
else
|
||||
mobjang = interp.angle;
|
||||
|
||||
angle_t fmoang;
|
||||
fmoang = camang - mobjang;
|
||||
|
||||
// slopepitch
|
||||
p.anglex += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINESINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.slopepitch)) );
|
||||
p.anglez -= flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINECOSINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.slopepitch)) );
|
||||
|
||||
// sloperoll
|
||||
p.anglex += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINECOSINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.sloperoll)) );
|
||||
p.anglez += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINESINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.sloperoll)) );
|
||||
p.roll = true;
|
||||
}
|
||||
|
||||
// pitch and roll
|
||||
if (interp.roll || interp.pitch)
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
p.anglex += flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.roll));
|
||||
p.anglez -= flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.pitch));
|
||||
p.roll = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1423,13 +1460,15 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
|
||||
HWD.pfnSetShader(4); // model shader
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
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);
|
||||
float ox = xs * flipfactor*FIXED_TO_FLOAT(interp.spritexoffset);
|
||||
float oy = ys * flipfactor*FIXED_TO_FLOAT(interp.spriteyoffset);
|
||||
|
||||
// offset perpendicular to the camera angle
|
||||
p.x -= ox * gr_viewsin;
|
||||
|
||||
@@ -495,6 +495,10 @@ static PFNglColorPointer pglColorPointer;
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#endif
|
||||
|
||||
#ifndef GL_TEXTURE2
|
||||
#define GL_TEXTURE2 0x84C2
|
||||
#endif
|
||||
|
||||
boolean SetupGLfunc(void)
|
||||
{
|
||||
#ifndef STATIC_OPENGL
|
||||
@@ -638,6 +642,7 @@ static boolean gl_batching = false;// are we currently collecting batches?
|
||||
|
||||
static GLint gl_palette[768];
|
||||
boolean gl_palette_initialized = false;
|
||||
static boolean gl_palshader = false;
|
||||
|
||||
static INT32 gl_enable_screen_textures = 1;
|
||||
|
||||
@@ -683,19 +688,19 @@ static float shader_leveltime = 0;
|
||||
// ========================
|
||||
|
||||
//
|
||||
// GLSL Software fragment shader
|
||||
// GLSL generic 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" \
|
||||
"float cap = (155.0 - light) * 0.26;\n" \
|
||||
"return max(startmap * 1.06 - scale * 0.5 * 1.15, cap);\n" \
|
||||
"}\n"
|
||||
#define GLSL_DEFAULT_FRAGMENT_SHADER \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
"void main(void) {\n" \
|
||||
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * poly_color;\n" \
|
||||
"}\0"
|
||||
|
||||
//
|
||||
// GLSL Software fragment shader
|
||||
//
|
||||
|
||||
#define GLSL_DOOM_COLORMAP \
|
||||
"float R_DoomColormap(float light, float z)\n" \
|
||||
@@ -704,18 +709,7 @@ static float shader_leveltime = 0;
|
||||
"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 - 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" \
|
||||
"float cap = (155.0 - light) * 0.26;\n" \
|
||||
"return max(startmap * 1.05 - scale * 0.5 * 2.2, cap);\n" \
|
||||
"return (startmap * STARTMAP_FUDGE - scale * MULT_FUDGE * SCALE_FUDGE);\n" \
|
||||
"}\n"
|
||||
|
||||
#define GLSL_DOOM_LIGHT_EQUATION \
|
||||
@@ -765,16 +759,28 @@ static float shader_leveltime = 0;
|
||||
"gl_FragColor = final_color;\n" \
|
||||
"}\n"
|
||||
|
||||
#define GLSL_FLOOR_FUDGES \
|
||||
"#define STARTMAP_FUDGE 1.06\n" \
|
||||
"#define MULT_FUDGE 0.5\n" \
|
||||
"#define SCALE_FUDGE 1.15\n"
|
||||
|
||||
#define GLSL_WALL_FUDGES \
|
||||
"#define STARTMAP_FUDGE 1.05\n" \
|
||||
"#define MULT_FUDGE 1.0\n" \
|
||||
"#define SCALE_FUDGE 1.1\n"
|
||||
|
||||
#define GLSL_SOFTWARE_FRAGMENT_SHADER_FLOORS \
|
||||
GLSL_SOFTWARE_UNIFORMS \
|
||||
GLSL_DOOM_COLORMAP_floors \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
GLSL_DOOM_COLORMAP \
|
||||
GLSL_DOOM_LIGHT_EQUATION \
|
||||
GLSL_SOFTWARE_MAIN \
|
||||
"\0"
|
||||
|
||||
#define GLSL_SOFTWARE_FRAGMENT_SHADER_WALLS \
|
||||
GLSL_SOFTWARE_UNIFORMS \
|
||||
GLSL_DOOM_COLORMAP_walls \
|
||||
GLSL_WALL_FUDGES \
|
||||
GLSL_DOOM_COLORMAP \
|
||||
GLSL_DOOM_LIGHT_EQUATION \
|
||||
GLSL_SOFTWARE_MAIN \
|
||||
"\0"
|
||||
@@ -802,13 +808,15 @@ static float shader_leveltime = 0;
|
||||
|
||||
#define GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_FLOORS \
|
||||
GLSL_SOFTWARE_PAL_UNIFORMS \
|
||||
GLSL_DOOM_COLORMAP_floors \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
GLSL_DOOM_COLORMAP \
|
||||
GLSL_SOFTWARE_PAL_MAIN \
|
||||
"\0"
|
||||
|
||||
#define GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_WALLS \
|
||||
GLSL_SOFTWARE_PAL_UNIFORMS \
|
||||
GLSL_DOOM_COLORMAP_walls \
|
||||
GLSL_WALL_FUDGES \
|
||||
GLSL_DOOM_COLORMAP \
|
||||
GLSL_SOFTWARE_PAL_MAIN \
|
||||
"\0"
|
||||
|
||||
@@ -820,6 +828,7 @@ static float shader_leveltime = 0;
|
||||
//
|
||||
|
||||
#define GLSL_WATER_FRAGMENT_SHADER \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
"uniform vec4 tint_color;\n" \
|
||||
@@ -849,33 +858,35 @@ static float shader_leveltime = 0;
|
||||
"}\0"
|
||||
|
||||
#define GLSL_PALETTE_WATER_FRAGMENT_SHADER \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
"const float freq = 0.025;\n" \
|
||||
"const float amp = 0.025;\n" \
|
||||
"const float speed = 2.0;\n" \
|
||||
"const float pi = 3.14159;\n" \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform sampler2D lighttable_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" \
|
||||
"uniform float leveltime;\n" \
|
||||
"const float freq = 0.025;\n" \
|
||||
"const float amp = 0.025;\n" \
|
||||
"const float speed = 2.0;\n" \
|
||||
"const float pi = 3.14159;\n" \
|
||||
GLSL_DOOM_COLORMAP_floors \
|
||||
GLSL_DOOM_COLORMAP \
|
||||
"void main(void) {\n" \
|
||||
"float z = (gl_FragCoord.z / gl_FragCoord.w) / 2.0;\n" \
|
||||
"float a = -pi * (z * freq) + (leveltime * speed);\n" \
|
||||
"float sdistort = sin(a) * amp;\n" \
|
||||
"float cdistort = cos(a) * amp;\n" \
|
||||
"vec4 texel = texture2D(tex, vec2(gl_TexCoord[0].s - sdistort, gl_TexCoord[0].t - cdistort));\n" \
|
||||
"int tex_pal_idx = int(texture3D(lookup_tex, vec3((texel * 63.0 + 0.5) / 64.0))[0] * 255.0);\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" \
|
||||
"float water_z = (gl_FragCoord.z / gl_FragCoord.w) / 2.0;\n" \
|
||||
"float a = -pi * (water_z * freq) + (leveltime * speed);\n" \
|
||||
"float sdistort = sin(a) * amp;\n" \
|
||||
"float cdistort = cos(a) * amp;\n" \
|
||||
"vec4 texel = texture2D(tex, vec2(gl_TexCoord[0].s - sdistort, gl_TexCoord[0].t - cdistort));\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" \
|
||||
"}\0"
|
||||
|
||||
|
||||
//
|
||||
// Fog block shader
|
||||
//
|
||||
@@ -883,12 +894,13 @@ static float shader_leveltime = 0;
|
||||
//
|
||||
|
||||
#define GLSL_FOG_FRAGMENT_SHADER \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
"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_floors \
|
||||
GLSL_DOOM_COLORMAP \
|
||||
GLSL_DOOM_LIGHT_EQUATION \
|
||||
"void main(void) {\n" \
|
||||
"vec4 base_color = gl_Color;\n" \
|
||||
@@ -913,14 +925,14 @@ static float shader_leveltime = 0;
|
||||
"}\0"
|
||||
|
||||
//
|
||||
// GLSL generic fragment shader
|
||||
//
|
||||
|
||||
#define GLSL_DEFAULT_FRAGMENT_SHADER \
|
||||
// Sky fragment shader
|
||||
// Modulates poly_color with gl_Color
|
||||
//
|
||||
#define GLSL_SKY_FRAGMENT_SHADER \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
"void main(void) {\n" \
|
||||
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * poly_color;\n" \
|
||||
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * gl_Color * poly_color;\n" \
|
||||
"}\0"
|
||||
|
||||
static const char *fragment_shaders[] = {
|
||||
@@ -946,10 +958,7 @@ static const char *fragment_shaders[] = {
|
||||
GLSL_FOG_FRAGMENT_SHADER,
|
||||
|
||||
// Sky fragment shader
|
||||
"uniform sampler2D tex;\n"
|
||||
"void main(void) {\n"
|
||||
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st);\n"
|
||||
"}\0",
|
||||
GLSL_SKY_FRAGMENT_SHADER,
|
||||
|
||||
// Palette fragment shader
|
||||
GLSL_PALETTE_FRAGMENT_SHADER,
|
||||
@@ -1286,11 +1295,6 @@ EXPORT boolean HWRAPI(InitCustomShaders) (void)
|
||||
#ifdef GL_SHADERS
|
||||
KillShaders();
|
||||
return LoadShaders();
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
InitPalette(0, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1340,7 +1344,7 @@ GLuint palette_tex_num;
|
||||
// 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)
|
||||
EXPORT void HWRAPI(InitPalette) (int flashnum, boolean skiplut)
|
||||
{
|
||||
int i, r, g, b;
|
||||
|
||||
@@ -1438,6 +1442,12 @@ void InitPalette(int flashnum, boolean skiplut)
|
||||
// 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);
|
||||
// bind stuff to wöter shader
|
||||
pglUseProgram(gl_shaderprograms[11].program);
|
||||
pglUniform1iv(gl_shaderprograms[11].uniforms[gluniform_palette], 768, gl_palette);
|
||||
pglUniform1i(gl_shaderprograms[11].uniforms[gluniform_lighttable_tex], 2);
|
||||
pglUniform1i(gl_shaderprograms[11].uniforms[gluniform_color_lookup], 1);
|
||||
|
||||
pglUseProgram(0);
|
||||
pglBindTexture(GL_TEXTURE_3D, 0);
|
||||
|
||||
@@ -1805,7 +1815,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one
|
||||
pglEnableClientState(GL_TEXTURE_COORD_ARRAY); // And mostly this one, too
|
||||
|
||||
if ((!gl_palette_initialized) && (HWR_ShouldUsePaletteRendering()))
|
||||
if ((!gl_palette_initialized) && (gl_palshader))
|
||||
InitPalette(0, false); // just gonna put this here for now
|
||||
}
|
||||
|
||||
@@ -2428,7 +2438,7 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
diff = poly1->texNum - poly2->texNum;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
diff = poly1->surf.LightTableId - poly2->surf.LightTableId;
|
||||
if (diff != 0) return diff;
|
||||
@@ -2571,7 +2581,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
if (gl_allowshaders)
|
||||
{
|
||||
Shader_Load(¤tSurfaceInfo, &firstPoly, &firstTint, &firstFade);
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
|
||||
pglBindTexture(GL_TEXTURE_2D, currentSurfaceInfo.LightTableId);
|
||||
@@ -2688,7 +2698,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
changeState = true;
|
||||
changePolyFlags = true;
|
||||
}
|
||||
if ((gl_allowshaders) && (HWR_ShouldUsePaletteRendering()))
|
||||
if (gl_allowshaders && gl_palshader)
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
@@ -2702,7 +2712,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
changeSurfaceInfo = true;
|
||||
}
|
||||
}
|
||||
else if ((gl_allowshaders) && (!HWR_ShouldUsePaletteRendering()))
|
||||
else if ((gl_allowshaders) && (!gl_palshader))
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
@@ -2833,7 +2843,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
|
||||
Shader_Load(&nextSurfaceInfo, &poly, &tint, &fade);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
|
||||
pglBindTexture(GL_TEXTURE_2D, nextSurfaceInfo.LightTableId);
|
||||
@@ -2944,7 +2954,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
|
||||
}
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering() && gl_allowshaders)
|
||||
if (gl_palshader && gl_allowshaders)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
|
||||
@@ -3292,6 +3302,10 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case HWD_PAL_SHADER:
|
||||
gl_palshader = Value;
|
||||
break;
|
||||
|
||||
case HWD_SET_TEXTUREFILTERMODE:
|
||||
switch (Value)
|
||||
@@ -3742,21 +3756,29 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||
if (hflipped)
|
||||
scalez = -scalez;
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f); // rotate by slope from Kart
|
||||
pglRotatef(pos->anglez2, 0.0f, 0.0f, -1.0f); // rotate by slope from Kart
|
||||
#endif
|
||||
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
|
||||
pglRotatef(pos->anglex2, -1.0f, 0.0f, 0.0f);
|
||||
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
|
||||
|
||||
if (pos->roll)
|
||||
{
|
||||
float roll = (1.0f * pos->rollflip);
|
||||
pglTranslatef(pos->centerx, pos->centery, 0);
|
||||
|
||||
// rotate model for pitch and roll
|
||||
pglRotatef(pos->anglex, 1.0f, 0.0f, 0.0f);
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f);
|
||||
#endif
|
||||
|
||||
if (pos->rotaxis == 2) // Z
|
||||
pglRotatef(pos->rollangle, 0.0f, 0.0f, roll);
|
||||
else if (pos->rotaxis == 1) // Y
|
||||
pglRotatef(pos->rollangle, 0.0f, roll, 0.0f);
|
||||
else // X
|
||||
pglRotatef(pos->rollangle, roll, 0.0f, 0.0f);
|
||||
|
||||
pglTranslatef(-pos->centerx, -pos->centery, 0);
|
||||
}
|
||||
|
||||
@@ -4477,14 +4499,18 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
|
||||
clearColour.red = clearColour.green = clearColour.blue = 0;
|
||||
clearColour.alpha = 1;
|
||||
ClearBuffer(true, false, false, &clearColour);
|
||||
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
Shader_SetUniforms(NULL, NULL, NULL, NULL); // prepare shader, if it is enabled
|
||||
SetBlend(PF_NoDepthTest);
|
||||
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
|
||||
}
|
||||
else
|
||||
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
|
||||
|
||||
pglUseProgram(gl_shaderprograms[8].program); // palette shader
|
||||
pglActiveTexture(GL_TEXTURE1);
|
||||
if (gl_palshader)
|
||||
{
|
||||
pglUseProgram(gl_shaderprograms[8].program); // palette postprocess shader
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
}
|
||||
|
||||
pglColor4ubv(white);
|
||||
@@ -4495,7 +4521,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
|
||||
|
||||
tex_downloaded = finalScreenTexture;
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
pglUseProgram(0);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
|
||||
@@ -135,6 +135,5 @@ typedef enum
|
||||
|
||||
// in order for custom playpals n shit to work properly
|
||||
extern boolean gl_palette_initialized;
|
||||
void InitPalette(int flashnum, boolean skiplut);
|
||||
|
||||
#endif
|
||||
+81
-43
@@ -2579,54 +2579,92 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
|
||||
UINT8 *colormap = NULL;
|
||||
INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
||||
INT32 gfxnum; // gfx to draw
|
||||
|
||||
//SRB2/Kart v1.0 style
|
||||
UINT8 numbars = 0; // how many ping bars do we draw?
|
||||
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
|
||||
SINT8 i = 0;
|
||||
SINT8 yoffset = 6;
|
||||
INT32 dx;
|
||||
|
||||
gfxnum = Ping_gfx_num(lag);
|
||||
|
||||
if (measureid == 1)
|
||||
|
||||
if (!cv_pingstyle.value)
|
||||
{
|
||||
if (cv_ticrate.value == 2){
|
||||
V_DrawScaledPatch(x+12 - pingmeasure[measureid]->width, y+22, flags, pingmeasure[measureid]);
|
||||
}else{
|
||||
if (measureid == 1)
|
||||
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
if (cv_ticrate.value == 2){
|
||||
V_DrawScaledPatch(x+2, y+13, flags, pinggfx[gfxnum]);
|
||||
}else{
|
||||
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (servermaxping && lag > servermaxping && hu_tick < 4)
|
||||
{
|
||||
// flash ping red if too high
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
}
|
||||
|
||||
if (cv_pingmeasurement.value)
|
||||
{
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
}
|
||||
|
||||
if (cv_ticrate.value == 2){
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+22, flags, lag, colormap);
|
||||
}else{
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, lag, colormap);
|
||||
}
|
||||
|
||||
if (measureid == 0){
|
||||
if (cv_ticrate.value == 2){
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+22, flags, pingmeasure[measureid]);
|
||||
}else{
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingicon.value)
|
||||
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
||||
|
||||
if (servermaxping && lag > servermaxping && hu_tick < 4)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE); // flash ping red if too high
|
||||
|
||||
if (cv_pingmeasurement.value)
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, lag, colormap);
|
||||
|
||||
if (measureid == 0)
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
}
|
||||
else if (cv_pingstyle.value) // old style ping
|
||||
{
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
if (lag < 4)
|
||||
{
|
||||
numbars = 3;
|
||||
barcolor = 184;
|
||||
}
|
||||
else if (lag < 7)
|
||||
{
|
||||
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
|
||||
barcolor = 103;
|
||||
}
|
||||
else if (lag < 10)
|
||||
{
|
||||
numbars = 1;
|
||||
barcolor = 155; // need a better red
|
||||
}
|
||||
else // brazil
|
||||
{
|
||||
numbars = 0;
|
||||
barcolor = 31;
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingmeasurement.value)
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
|
||||
if (vid.width >= 640) // how sad, we're using a shit resolution.
|
||||
{
|
||||
if (measureid == 1)
|
||||
{
|
||||
//dx = x+1 - (V_SmallStringWidth(va("%dms", lag), V_ALLOWLOWERCASE|flags)/2);
|
||||
//V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE|flags, va("%dms", lag));
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", lag));
|
||||
}
|
||||
else if (measureid == 0)
|
||||
{
|
||||
//dx = x+1 - (V_SmallStringWidth(va("d%d", lag), flags)/2);
|
||||
//V_DrawSmallString(dx, y+4, flags, va("d%d", lag));
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", lag));
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
for (i=0; (i<3); i++) // Draw the ping bar
|
||||
{
|
||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-4, 2, 8-yoffset, 31|flags);
|
||||
if (i < numbars)
|
||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-3, 1, 8-yoffset-1, barcolor|flags);
|
||||
|
||||
yoffset -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+132
-135
@@ -26,37 +26,32 @@
|
||||
#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};
|
||||
consvar_t cv_item_yoffset = {"hud_item_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#define IMPL_HUD_OFFSET_X(name)\
|
||||
consvar_t cv_##name##_xoffset = {"hud_" #name "_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_time_xoffset = {"hud_time_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_time_yoffset = {"hud_time_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#define IMPL_HUD_OFFSET_Y(name)\
|
||||
consvar_t cv_##name##_yoffset = {"hud_" #name "_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_laps_xoffset = {"hud_laps_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_laps_yoffset = {"hud_laps_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#define IMPL_HUD_OFFSET(name)\
|
||||
IMPL_HUD_OFFSET_X(name)\
|
||||
IMPL_HUD_OFFSET_Y(name)
|
||||
|
||||
consvar_t cv_spdm_xoffset = {"hud_speed_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_spdm_yoffset = {"hud_speed_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
IMPL_HUD_OFFSET(item); // Item box
|
||||
IMPL_HUD_OFFSET(time); // Time
|
||||
IMPL_HUD_OFFSET(laps); // Number of laps
|
||||
IMPL_HUD_OFFSET(dnft); // Countdown (did not finish timer)
|
||||
IMPL_HUD_OFFSET(spdm); // Speedometer
|
||||
IMPL_HUD_OFFSET(posi); // Position in race
|
||||
IMPL_HUD_OFFSET(face); // Mini rankings
|
||||
IMPL_HUD_OFFSET(stcd); // Starting countdown
|
||||
IMPL_HUD_OFFSET_Y(chek); // Check gfx
|
||||
IMPL_HUD_OFFSET(mini); // Minimap
|
||||
IMPL_HUD_OFFSET(want); // Wanted
|
||||
IMPL_HUD_OFFSET(stat); // Stats
|
||||
|
||||
consvar_t cv_posi_xoffset = {"hud_position_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_posi_yoffset = {"hud_position_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_face_xoffset = {"hud_face_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_face_yoffset = {"hud_face_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_stcd_xoffset = {"hud_startcountdown_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_stcd_yoffset = {"hud_startcountdown_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_chek_yoffset = {"hud_check_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_mini_xoffset = {"hud_minimap_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mini_yoffset = {"hud_minimap_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
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_stat_xoffset = {"hud_stat_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_stat_yoffset = {"hud_stat_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#undef IMPL_HUD_OFFSET
|
||||
#undef IMPL_HUD_OFFSET_X
|
||||
#undef IMPL_HUD_OFFSET_Y
|
||||
|
||||
//extra hud things
|
||||
consvar_t cv_showstats = {"showstats", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -675,29 +670,34 @@ void K_RegisterKartStuff(void)
|
||||
CV_RegisterVar(&cv_kartdebugcheckpoint);
|
||||
CV_RegisterVar(&cv_kartdebugnodes);
|
||||
CV_RegisterVar(&cv_kartdebugcolorize);
|
||||
|
||||
CV_RegisterVar(&cv_item_xoffset);
|
||||
CV_RegisterVar(&cv_item_yoffset);
|
||||
CV_RegisterVar(&cv_time_xoffset);
|
||||
CV_RegisterVar(&cv_time_yoffset);
|
||||
CV_RegisterVar(&cv_laps_xoffset);
|
||||
CV_RegisterVar(&cv_laps_yoffset);
|
||||
CV_RegisterVar(&cv_spdm_xoffset);
|
||||
CV_RegisterVar(&cv_spdm_yoffset);
|
||||
CV_RegisterVar(&cv_posi_xoffset);
|
||||
CV_RegisterVar(&cv_posi_yoffset);
|
||||
CV_RegisterVar(&cv_face_xoffset);
|
||||
CV_RegisterVar(&cv_face_yoffset);
|
||||
CV_RegisterVar(&cv_stcd_xoffset);
|
||||
CV_RegisterVar(&cv_stcd_yoffset);
|
||||
CV_RegisterVar(&cv_chek_yoffset);
|
||||
CV_RegisterVar(&cv_mini_xoffset);
|
||||
CV_RegisterVar(&cv_mini_yoffset);
|
||||
CV_RegisterVar(&cv_want_xoffset);
|
||||
CV_RegisterVar(&cv_want_yoffset);
|
||||
CV_RegisterVar(&cv_stat_xoffset);
|
||||
CV_RegisterVar(&cv_stat_yoffset);
|
||||
|
||||
|
||||
#define REG_HUD_OFFSET_X(name)\
|
||||
CV_RegisterVar(&cv_##name##_xoffset);
|
||||
|
||||
#define REG_HUD_OFFSET_Y(name)\
|
||||
CV_RegisterVar(&cv_##name##_yoffset);
|
||||
|
||||
#define REG_HUD_OFFSET(name)\
|
||||
REG_HUD_OFFSET_X(name)\
|
||||
REG_HUD_OFFSET_Y(name)
|
||||
|
||||
REG_HUD_OFFSET(item); // Item box
|
||||
REG_HUD_OFFSET(time); // Time
|
||||
REG_HUD_OFFSET(laps); // Number of laps
|
||||
REG_HUD_OFFSET(dnft); // Countdown (did not finish timer)
|
||||
REG_HUD_OFFSET(spdm); // Speedometer
|
||||
REG_HUD_OFFSET(posi); // Position in race
|
||||
REG_HUD_OFFSET(face); // Mini rankings
|
||||
REG_HUD_OFFSET(stcd); // Starting countdown
|
||||
REG_HUD_OFFSET_Y(chek); // Check gfx
|
||||
REG_HUD_OFFSET(mini); // Minimap
|
||||
REG_HUD_OFFSET(want); // Wanted
|
||||
REG_HUD_OFFSET(stat); // Stats
|
||||
|
||||
#undef REG_HUD_OFFSET
|
||||
#undef REG_HUD_OFFSET_X
|
||||
#undef REG_HUD_OFFSET_Y
|
||||
|
||||
CV_RegisterVar(&cv_showstats);
|
||||
CV_RegisterVar(&cv_showinput);
|
||||
CV_RegisterVar(&cv_newspeedometer);
|
||||
@@ -3005,6 +3005,13 @@ static void K_SpawnDriftSparks(player_t *player)
|
||||
spark->momy = player->mo->momy/2;
|
||||
//spark->momz = player->mo->momz/2;
|
||||
|
||||
// rotate the sparks based on pitch and roll; it just looks neat
|
||||
if (cv_sparkroll.value == 1)
|
||||
{
|
||||
spark->slopepitch = player->mo->slopepitch;
|
||||
spark->sloperoll = player->mo->sloperoll;
|
||||
}
|
||||
|
||||
if (player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(player)*4)
|
||||
{
|
||||
spark->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||
@@ -3214,7 +3221,7 @@ static void K_QuiteSaltyHop(player_t *p)
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 K_FindPlayerNum(player_t *plyr)
|
||||
/*static INT32 K_FindPlayerNum(player_t *plyr)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
@@ -3224,95 +3231,62 @@ static INT32 K_FindPlayerNum(player_t *plyr)
|
||||
return i;
|
||||
}
|
||||
return 0; // technically defaulting to player 1 but fuck it
|
||||
}
|
||||
}*/
|
||||
|
||||
static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useReserves)
|
||||
#define SLOPEROLL_DIV 3
|
||||
|
||||
void K_RollMobjBySlopes(mobj_t* mo, boolean usedistance)
|
||||
{
|
||||
angle_t lookAngle = 0;
|
||||
angle_t zangle = 0;
|
||||
angle_t xydirection = 0;
|
||||
angle_t an;
|
||||
angle_t final_slope;
|
||||
INT32 pNum = K_FindPlayerNum(p);
|
||||
I_Assert(mo->subsector != NULL);
|
||||
I_Assert(mo->subsector->sector != NULL);
|
||||
|
||||
I_Assert(p != NULL);
|
||||
I_Assert(p->mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(p->mo));
|
||||
angle_t an;
|
||||
boolean flip = mo->eflags & MFE_VERTICALFLIP;
|
||||
fixed_t m_dist = R_PointToDist(mo->x, mo->y);
|
||||
fixed_t rolldist = cv_sloperolldist.value * mapobjectscale;
|
||||
|
||||
if (useReserves)
|
||||
{
|
||||
I_Assert(p->mo->reservezangle != NULL);
|
||||
I_Assert(p->mo->reservexydir != NULL);
|
||||
}
|
||||
// lifted from hw_md2
|
||||
if (mo->standingslope)
|
||||
{
|
||||
fixed_t tempz = mo->standingslope->normal.z;
|
||||
fixed_t tempy = mo->standingslope->normal.y;
|
||||
fixed_t tempx = mo->standingslope->normal.x;
|
||||
fixed_t tempangle = -(R_PointToAngle2(
|
||||
0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
|
||||
|
||||
lookAngle = R_PointToAngle2(camera[pNum].x, camera[pNum].y, p->mo->x, p->mo->y);
|
||||
// admittedly this is a very hacky way to do the pitch and roll easing
|
||||
|
||||
if (!R_PointToDist(p->mo->x, p->mo->y))
|
||||
lookAngle = p->mo->angle;
|
||||
// pitch
|
||||
if ((!usedistance) || (m_dist <= (rolldist)))
|
||||
{
|
||||
an = (INT32)((angle_t)tempangle - mo->pitch_sprite) / SLOPEROLL_DIV;
|
||||
|
||||
if (!useReserves)
|
||||
{
|
||||
zangle = p->mo->standingslope->zangle;
|
||||
xydirection = p->mo->standingslope->xydirection;
|
||||
mo->pitch_sprite = an ? mo->pitch_sprite + an : (angle_t)tempangle;
|
||||
}
|
||||
else
|
||||
mo->pitch_sprite = FixedAngle(0);
|
||||
|
||||
p->mo->reservezangle = zangle;
|
||||
p->mo->reservexydir = xydirection;
|
||||
}
|
||||
else if (p->mo->reservezangle)
|
||||
{
|
||||
zangle = p->mo->reservezangle;
|
||||
xydirection = p->mo->reservexydir;
|
||||
}
|
||||
mo->slopepitch = flip ? InvAngle(mo->pitch_sprite) : mo->pitch_sprite;
|
||||
|
||||
if ((p->mo->eflags & MFE_VERTICALFLIP) && (!dontflip))
|
||||
zangle = InvAngle(zangle);
|
||||
// roll
|
||||
tempangle = (R_PointToAngle2(0, 0, tempz, tempy));
|
||||
|
||||
an = (lookAngle - xydirection);
|
||||
final_slope = -(FixedMul(FINESINE(an>>ANGLETOFINESHIFT), zangle));
|
||||
|
||||
an = (INT32)(final_slope - p->tilt_sprite) / (camspin[pNum] ? 1 : 3);
|
||||
|
||||
p->tilt_sprite = an ? p->tilt_sprite + an : final_slope;
|
||||
return -p->tilt_sprite;
|
||||
}
|
||||
if ((!usedistance) || (m_dist <= (rolldist)))
|
||||
{
|
||||
an = (INT32)((angle_t)tempangle - mo->roll_sprite) / SLOPEROLL_DIV;
|
||||
|
||||
static void K_RollPlayerBySlopes(player_t *p, boolean usedistance)
|
||||
{
|
||||
I_Assert(p->mo->subsector != NULL);
|
||||
I_Assert(p->mo->subsector->sector != NULL);
|
||||
mo->roll_sprite = an ? mo->roll_sprite + an : (angle_t)tempangle;
|
||||
}
|
||||
else
|
||||
mo->roll_sprite = FixedAngle(0);
|
||||
|
||||
INT32 pNum = K_FindPlayerNum(p);
|
||||
|
||||
fixed_t p_dist = R_PointToDist2(p->mo->x, p->mo->y, camera[pNum].x, camera[pNum].y);
|
||||
fixed_t mos = mapobjectscale;
|
||||
fixed_t rolldist = cv_sloperolldist.value*mos;
|
||||
|
||||
if (!P_IsObjectOnGround(p->mo))
|
||||
{
|
||||
if (!usedistance)
|
||||
p->mo->sloperoll = K_GetSlopeRollAngle(p, false, true);
|
||||
else if (p_dist <= (rolldist))
|
||||
p->mo->sloperoll = K_GetSlopeRollAngle(p, false, true);
|
||||
else
|
||||
p->mo->sloperoll = FixedAngle(0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!p->mo->standingslope)
|
||||
{
|
||||
p->mo->sloperoll = FixedAngle(0);
|
||||
p->mo->reservezangle = FixedAngle(0);
|
||||
p->mo->reservexydir = FixedAngle(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!usedistance)
|
||||
p->mo->sloperoll = K_GetSlopeRollAngle(p, false, false);
|
||||
else if (p_dist <= (rolldist))
|
||||
p->mo->sloperoll = K_GetSlopeRollAngle(p, false, false);
|
||||
else
|
||||
p->mo->sloperoll = FixedAngle(0);
|
||||
mo->sloperoll = flip ? InvAngle(mo->roll_sprite) : mo->roll_sprite;
|
||||
}
|
||||
else if (P_IsObjectOnGround(mo))
|
||||
{
|
||||
mo->sloperoll = FixedAngle(0);
|
||||
mo->slopepitch = FixedAngle(0);
|
||||
}
|
||||
}
|
||||
|
||||
void K_SpawnBoostTrail(player_t *player)
|
||||
@@ -3364,6 +3338,14 @@ void K_SpawnBoostTrail(player_t *player)
|
||||
K_FlipFromObject(flame, player->mo);
|
||||
|
||||
flame->momx = 8;
|
||||
|
||||
// since you have to be on the ground for sneaker trails, this should be fine(?)
|
||||
if (cv_sparkroll.value == 1)
|
||||
{
|
||||
flame->slopepitch = player->mo->slopepitch;
|
||||
flame->sloperoll = player->mo->sloperoll;
|
||||
}
|
||||
|
||||
P_XYMovement(flame);
|
||||
if (P_MobjWasRemoved(flame))
|
||||
continue;
|
||||
@@ -6459,13 +6441,21 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
player->mo->spritexscale = player->mo->realxscale;
|
||||
player->mo->spriteyscale = player->mo->realyscale;
|
||||
}
|
||||
|
||||
boolean usedist = false;
|
||||
|
||||
if (cv_sloperolldist.value > 0)
|
||||
usedist = true;
|
||||
if (cv_sloperoll.value == 1)
|
||||
K_RollPlayerBySlopes(player, usedist);
|
||||
if ((cv_spriteroll.value) && (cv_sloperoll.value))
|
||||
{
|
||||
if ((!player->mo->salty_jump)) // seeing a character rotate mid-hop looks really janky
|
||||
K_RollMobjBySlopes(player->mo, usedist);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->sloperoll = FixedAngle(0);
|
||||
player->mo->slopepitch = FixedAngle(0);
|
||||
}
|
||||
|
||||
|
||||
// Quick Turning
|
||||
@@ -8221,7 +8211,7 @@ static void K_DrawKartPositionNum(INT32 num)
|
||||
if (!splitscreen)
|
||||
{
|
||||
fx = POSI_X + xoffs;
|
||||
fy = BASEVIDHEIGHT - 8;
|
||||
fy = BASEVIDHEIGHT - 8 + cv_posi_yoffset.value;
|
||||
fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
||||
}
|
||||
else if (splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different.
|
||||
@@ -8229,14 +8219,14 @@ static void K_DrawKartPositionNum(INT32 num)
|
||||
fx = POSI_X;
|
||||
if (stplyr == &players[displayplayers[0]]) // for player 1: display this at the top right, above the minimap.
|
||||
{
|
||||
fy = 30;
|
||||
fy = 30 + cv_posi_yoffset.value;
|
||||
fflags = V_SNAPTOTOP|V_SNAPTORIGHT;
|
||||
if (overtake)
|
||||
flipvdraw = true; // make sure overtaking doesn't explode us
|
||||
}
|
||||
else // if we're not p1, that means we're p2. display this at the bottom right, below the minimap.
|
||||
{
|
||||
fy = BASEVIDHEIGHT - 8;
|
||||
fy = BASEVIDHEIGHT - 8 + cv_posi_yoffset.value;
|
||||
fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
||||
}
|
||||
}
|
||||
@@ -8718,6 +8708,9 @@ static void K_drawKartSpeedometer(void)
|
||||
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));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (cv_newspeedometer.value == 2 && snw_speedo) // why bother if we dont?
|
||||
@@ -10064,12 +10057,16 @@ void K_drawKartHUD(void)
|
||||
{
|
||||
char *countstr = va("%d", racecountdown/TICRATE);
|
||||
|
||||
// Eeeh dunno if would be better to add another variable instead of LAPS_Y but this works too
|
||||
int yoff = cv_dnft_yoffset.value - cv_laps_yoffset.value;
|
||||
int xoff = cv_dnft_xoffset.value;
|
||||
|
||||
if (splitscreen > 1)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/4, LAPS_Y+1, K_calcSplitFlags(0), countstr);
|
||||
V_DrawCenteredString(BASEVIDWIDTH/4+xoff, LAPS_Y+1+yoff, K_calcSplitFlags(0), countstr);
|
||||
else
|
||||
{
|
||||
INT32 karlen = strlen(countstr)*6; // half of 12
|
||||
V_DrawKartString((BASEVIDWIDTH/2)-karlen, LAPS_Y+3, K_calcSplitFlags(0), countstr);
|
||||
V_DrawKartString((BASEVIDWIDTH/2)-karlen+xoff, LAPS_Y+3+yoff, K_calcSplitFlags(0), countstr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||
void K_StealBumper(player_t *player, player_t *victim, boolean force);
|
||||
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
|
||||
void K_SpawnMineExplosion(mobj_t *source, UINT8 color);
|
||||
void K_RollMobjBySlopes(mobj_t *mo, boolean usedistance);
|
||||
void K_SpawnBoostTrail(player_t *player);
|
||||
void K_SpawnSparkleTrail(mobj_t *mo);
|
||||
void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent);
|
||||
|
||||
@@ -538,6 +538,18 @@ static int lib_pFlashPal(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// not sure if this is netsafe...
|
||||
static int lib_pRollPitchMobj(lua_State *L)
|
||||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_RollPitchMobj(source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pGetClosestAxis(lua_State *L)
|
||||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
@@ -3033,6 +3045,7 @@ static luaL_Reg lib[] = {
|
||||
{"P_GetMobjGravity",lib_pGetMobjGravity},
|
||||
{"P_WeaponOrPanel",lib_pWeaponOrPanel},
|
||||
{"P_FlashPal",lib_pFlashPal},
|
||||
{"P_RollPitchMobj",lib_pRollPitchMobj},
|
||||
{"P_GetClosestAxis",lib_pGetClosestAxis},
|
||||
{"P_SpawnParaloop",lib_pSpawnParaloop},
|
||||
{"P_BossTargetPlayer",lib_pBossTargetPlayer},
|
||||
|
||||
+31
-18
@@ -83,8 +83,11 @@ 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, pitch, udatalib_getter_angle, udatalib_setter_angle),
|
||||
FIELD(mobj_t, roll, udatalib_getter_angle, udatalib_setter_angle),
|
||||
FIELD(mobj_t, rollangle, udatalib_getter_angle, udatalib_setter_angle),
|
||||
FIELD(mobj_t, sloperoll, udatalib_getter_angle, mobj_sloperoll_noop),
|
||||
FIELD(mobj_t, slopepitch, 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),
|
||||
@@ -418,35 +421,43 @@ int mobj_localskin_setter(lua_State *L)
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
SetLocalPlayerSkin(mo->player - players, luaL_checkstring(L, 2), NULL);
|
||||
SetLocalPlayerSkin(mo->player - players, luaL_optstring(L, 2, "none"), NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 i;
|
||||
char skin[SKINNAMESIZE+1]; // all skin names are limited to this length
|
||||
strlcpy(skin, luaL_checkstring(L, 2), sizeof skin);
|
||||
strlcpy(skin, luaL_optstring(L, 2, "none"), sizeof skin);
|
||||
strlwr(skin); // all skin names are lowercase
|
||||
|
||||
// Try localskins
|
||||
for (i = 0; i < numlocalskins; i++)
|
||||
if (strcasecmp(skin, "none"))
|
||||
{
|
||||
if (stricmp(localskins[i].name, skin) == 0)
|
||||
// Try localskins
|
||||
for (i = 0; i < numlocalskins; i++)
|
||||
{
|
||||
mo->localskin = &localskins[i];
|
||||
mo->skinlocal = true;
|
||||
return 0;
|
||||
if (stricmp(localskins[i].name, skin) == 0)
|
||||
{
|
||||
mo->localskin = &localskins[i];
|
||||
mo->skinlocal = true;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Try other skins
|
||||
for (i = 0; i < numskins; i++)
|
||||
{
|
||||
if (fastcmp(skins[i].name, skin))
|
||||
{
|
||||
mo->localskin = &skins[i];
|
||||
mo->skinlocal = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Try other skins
|
||||
for (i = 0; i < numskins; i++)
|
||||
else
|
||||
{
|
||||
if (fastcmp(skins[i].name, skin))
|
||||
{
|
||||
mo->localskin = &skins[i];
|
||||
mo->skinlocal = false;
|
||||
return 0;
|
||||
}
|
||||
mo->localskin = 0;
|
||||
mo->skinlocal = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,7 +635,9 @@ int mobj_rollsum_getter(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = GETMO();
|
||||
|
||||
angle_t rollsum = mo->rollangle + cv_sloperoll.value ? mo->sloperoll : 0;
|
||||
angle_t pitchnroll = P_MobjPitchAndRoll(mo);
|
||||
|
||||
angle_t rollsum = mo->rollangle + pitchnroll;
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
|
||||
+1
-1
@@ -303,7 +303,7 @@ int player_localskin_setter(lua_State *L)
|
||||
{
|
||||
player_t *plr = GETPLAYER();
|
||||
|
||||
SetLocalPlayerSkin(plr - players, luaL_checkstring(L, 2), NULL);
|
||||
SetLocalPlayerSkin(plr - players, luaL_optstring(L, 2, "none"), NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+60
-54
@@ -1392,7 +1392,7 @@ static const char* OP_VideoTooltips[] =
|
||||
"How far away weather is drawn.",
|
||||
"Toggle being able to see the sky.",
|
||||
"Player field of view.",
|
||||
"Show current game framerate.",
|
||||
"Show current game framerate and select the style.",
|
||||
"Sync game framerate to refresh rate of monitor.",
|
||||
"Set manual framerate cap.",
|
||||
"Size of drift spark pulse.",
|
||||
@@ -1762,23 +1762,24 @@ static menuitem_t OP_HUDOptionsMenu[] =
|
||||
static menuitem_t OP_ChatOptionsMenu[] =
|
||||
{
|
||||
// will ANYONE who doesn't know how to use the console want to touch this one?
|
||||
{IT_STRING | IT_CVAR, NULL, "Chat Mode", &cv_consolechat, 10}, // nonetheless...
|
||||
{IT_STRING | IT_CVAR, NULL, "Chat Mode", &cv_consolechat, 5}, // nonetheless...
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Chat Box Width", &cv_chatwidth, 25},
|
||||
NULL, "Chat Box Width", &cv_chatwidth, 20},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Chat Box Height", &cv_chatheight, 35},
|
||||
NULL, "Chat Box Height", &cv_chatheight, 30},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 75},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 100}, // shows ping next to framerate if we want to.
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 120},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show IP addresses in playerlist", &cv_shownodeip, 140},
|
||||
{IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 95}, // shows ping above the framerate if we want to.
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping display style", &cv_pingstyle, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 115},
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 125},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show IP address in playerlist", &cv_shownodeip, 135},
|
||||
};
|
||||
|
||||
static const char* OP_ChatOptionsTooltips[] =
|
||||
@@ -1791,6 +1792,7 @@ static const char* OP_ChatOptionsTooltips[] =
|
||||
"Spam protection for in-game chat.",
|
||||
"Maxiumum amount of chat messages to look back at.",
|
||||
"Show player ping.",
|
||||
"Choose the looks of the ping display.", // this is ass idk english lmao
|
||||
"Measurement used for ping.",
|
||||
"Visibility of ping icon.",
|
||||
"Should Player IP addresses be printed when using\nthe nodes or listplayers command?",
|
||||
@@ -2003,9 +2005,9 @@ static menuitem_t OP_SaturnMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Cecho Messages", &cv_cechotoggle, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 85},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Midnight Channel Flicker Effect", &cv_lessflicker, 95},
|
||||
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 95},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 105},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 105},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 110},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 120}, // uwu
|
||||
@@ -2029,7 +2031,7 @@ static const char* OP_SaturnTooltips[] =
|
||||
"Show the big Cecho Messages.",
|
||||
"Show Localskin Menus.",
|
||||
"Disables the flicker effect on Midnight Channel.",
|
||||
"Options for player distortion effects.",
|
||||
"Options for sprite distortion effects.",
|
||||
"Move position of HUD elements.",
|
||||
"See the people who helped make this project possible!",
|
||||
};
|
||||
@@ -2057,24 +2059,28 @@ enum
|
||||
|
||||
static menuitem_t OP_PlayerDistortMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Player Distortion", NULL, 0},
|
||||
{IT_HEADER, NULL, "Sprite Distortion", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate players on slopes", &cv_sloperoll, 20},
|
||||
{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},
|
||||
{IT_STRING | IT_CVAR, NULL, "Sprite Rotation", &cv_spriteroll, 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Sprite Slope Rotation", &cv_sloperoll, 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Slope Rotation Distance", &cv_sloperolldist, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Players when Sliptiding", &cv_sliptideroll, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Sparks and Boost Trails", &cv_sparkroll, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Player Stretch Factor", &cv_gravstretch, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Squish Sound Effect", &cv_slamsound, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 135},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 150},
|
||||
};
|
||||
|
||||
static const char* OP_PlayerDistortTooltips[] =
|
||||
{
|
||||
NULL,
|
||||
"Player rotation on slopes.",
|
||||
"Distance player rotation should be visable.",
|
||||
"Sprite rotation features.",
|
||||
"Sprite rotation on slopes. Can either be just players or all objects.",
|
||||
"Distance object rotation should be visable.",
|
||||
"Player rotation when sliptiding.",
|
||||
"Rotation of a player's boost trails and drift sparks.",
|
||||
"Player squash and stretch.",
|
||||
"Player landing sound effect.",
|
||||
"Kart hopping while drifting. This is purely visual.",
|
||||
@@ -2084,9 +2090,12 @@ static const char* OP_PlayerDistortTooltips[] =
|
||||
|
||||
enum
|
||||
{
|
||||
spriteheader,
|
||||
spriterotate,
|
||||
sloperotate,
|
||||
slrotatedist,
|
||||
sliptide,
|
||||
sparkrotate,
|
||||
stretchyplayer,
|
||||
squishsound,
|
||||
salthmmm,
|
||||
@@ -2135,13 +2144,14 @@ static menuitem_t OP_SaturnCreditsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Saturn Credits", NULL, 0},
|
||||
|
||||
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 25},
|
||||
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 15},
|
||||
|
||||
{IT_STRING2+IT_SPACE, NULL, "alufolie91 aka Alug", NULL, 30},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 40},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 50},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 60},
|
||||
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 70},
|
||||
{IT_STRING2+IT_SPACE, NULL, "alufolie91 aka Alug", NULL, 20},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 30},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 40},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 50},
|
||||
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70},
|
||||
|
||||
|
||||
{IT_STRING+IT_SPACE, NULL, "", NULL, 73}, // dummy text
|
||||
@@ -3125,18 +3135,26 @@ void Addons_option_Onchange(void)
|
||||
|
||||
void PDistort_menu_Onchange(void)
|
||||
{
|
||||
UINT16 status;
|
||||
|
||||
if (cv_sloperoll.value)
|
||||
if (!cv_spriteroll.value)
|
||||
{
|
||||
status = IT_STRING | IT_CVAR;
|
||||
OP_PlayerDistortMenu[sloperotate].status = IT_GRAYEDOUT;
|
||||
OP_PlayerDistortMenu[sliptide].status = IT_GRAYEDOUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = IT_GRAYEDOUT;
|
||||
OP_PlayerDistortMenu[sloperotate].status = IT_STRING | IT_CVAR;
|
||||
OP_PlayerDistortMenu[sliptide].status = IT_STRING | IT_CVAR;
|
||||
}
|
||||
|
||||
OP_PlayerDistortMenu[2].status = status;
|
||||
if ((cv_sloperoll.value) && (cv_spriteroll.value)) //enable/disable sloperotate distance
|
||||
OP_PlayerDistortMenu[slrotatedist].status = IT_STRING | IT_CVAR;
|
||||
else
|
||||
OP_PlayerDistortMenu[slrotatedist].status = IT_GRAYEDOUT;
|
||||
|
||||
if ((cv_sloperoll.value == 2) && (cv_spriteroll.value)) //enable/disable sparkroll depending on which setting
|
||||
OP_PlayerDistortMenu[sparkrotate].status = IT_STRING | IT_CVAR;
|
||||
else
|
||||
OP_PlayerDistortMenu[sparkrotate].status = IT_GRAYEDOUT;
|
||||
}
|
||||
|
||||
void Bird_menu_Onchange(void)
|
||||
@@ -3144,26 +3162,18 @@ void Bird_menu_Onchange(void)
|
||||
UINT16 status;
|
||||
|
||||
if (cv_tilting.value)
|
||||
{
|
||||
status = IT_STRING | IT_CVAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = IT_GRAYEDOUT;
|
||||
}
|
||||
|
||||
OP_TiltMenu[tiltwturning].status = status;
|
||||
OP_TiltMenu[smoothening].status = status;
|
||||
OP_TiltMenu[tiltwquakes].status = status;
|
||||
|
||||
if (cv_fading.value)
|
||||
{
|
||||
status = IT_STRING | IT_CVAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = IT_GRAYEDOUT;
|
||||
}
|
||||
|
||||
OP_AdvancedBirdMenu[fadeinvinc].status = status;
|
||||
OP_AdvancedBirdMenu[fadegrow].status = status;
|
||||
@@ -3190,13 +3200,9 @@ void Saturn_menu_Onchange(void)
|
||||
UINT16 status;
|
||||
|
||||
if (cv_colorizedhud.value)
|
||||
{
|
||||
status = IT_STRING | IT_CVAR;
|
||||
}
|
||||
status = IT_STRING | IT_CVAR;
|
||||
else
|
||||
{
|
||||
status = IT_GRAYEDOUT;
|
||||
}
|
||||
status = IT_GRAYEDOUT;
|
||||
|
||||
OP_SaturnMenu[sm_coloritem].status = status;
|
||||
OP_SaturnMenu[sm_colorhud_customcolor].status = status;
|
||||
@@ -4124,7 +4130,7 @@ void M_StartControlPanel(void)
|
||||
MPauseMenu[mpause_addons].alphaKey = 8;
|
||||
|
||||
if (IsPlayerAdmin(consoleplayer))
|
||||
MPauseMenu[mpause_addlocalskins].alphaKey = 8;
|
||||
MPauseMenu[mpause_addlocalskins].alphaKey = 16;
|
||||
else
|
||||
MPauseMenu[mpause_addlocalskins].alphaKey = 24;
|
||||
|
||||
|
||||
+104
-1
@@ -6251,6 +6251,87 @@ static void P_KoopaThinker(mobj_t *koopa)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_RollPitchMobj
|
||||
// Assigns slopepitch and sloperoll to objects, and resets said values when slope-rolling
|
||||
// is turned off completely.
|
||||
//
|
||||
void P_RollPitchMobj(mobj_t* mobj)
|
||||
{
|
||||
boolean usedist = false;
|
||||
|
||||
if (cv_sloperolldist.value > 0)
|
||||
usedist = true;
|
||||
|
||||
if ((cv_spriteroll.value) && (cv_sloperoll.value == 2))
|
||||
{
|
||||
K_RollMobjBySlopes(mobj, usedist);
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj->sloperoll = FixedAngle(0);
|
||||
mobj->slopepitch = FixedAngle(0);
|
||||
}
|
||||
}
|
||||
|
||||
angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
{
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
angle_t camang = 0;
|
||||
angle_t return_angle = 0;
|
||||
|
||||
if (!cv_spriteroll.value)
|
||||
return 0;
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return 0;
|
||||
|
||||
size_t rot = mobj->frame & FF_FRAMEMASK;
|
||||
boolean papersprite = (mobj->frame & FF_PAPERSPRITE);
|
||||
|
||||
if (mobj->skin && mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
sprdef = &((skin_t *)mobj->skin)->spritedef;
|
||||
|
||||
if (rot >= sprdef->numframes)
|
||||
sprdef = &sprites[mobj->sprite];
|
||||
}
|
||||
else
|
||||
{
|
||||
sprdef = &sprites[mobj->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(mobj->x, mobj->y) - mobj->angle;
|
||||
camang = R_PointToAngle(mobj->x, mobj->y);
|
||||
}
|
||||
|
||||
return_angle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mobj->roll)
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch);
|
||||
|
||||
if (cv_sloperoll.value)
|
||||
{
|
||||
return_angle += FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
|
||||
}
|
||||
|
||||
return return_angle;
|
||||
}
|
||||
|
||||
//
|
||||
// P_MobjThinker
|
||||
//
|
||||
@@ -6393,6 +6474,12 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
return;
|
||||
}
|
||||
|
||||
if (mobj->state == &states[S_PLAY_SIGN]) // hack to make the player sign icon roll with the sign itself
|
||||
{
|
||||
mobj->slopepitch = mobj->target->slopepitch;
|
||||
mobj->sloperoll = mobj->target->sloperoll;
|
||||
}
|
||||
|
||||
P_AddOverlay(mobj);
|
||||
break;
|
||||
case MT_SHADOW:
|
||||
@@ -6428,6 +6515,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
P_RemoveMobj(mobj);
|
||||
return;
|
||||
}
|
||||
P_RollPitchMobj(mobj);
|
||||
break;
|
||||
case MT_SMOLDERING:
|
||||
if (leveltime % 2 == 0)
|
||||
@@ -7856,6 +7944,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
fixed_t distbarrier = 512*mapobjectscale;
|
||||
fixed_t distaway;
|
||||
|
||||
P_RollPitchMobj(mobj);
|
||||
P_SpawnGhostMobj(mobj);
|
||||
|
||||
if (mobj->threshold > 0)
|
||||
@@ -7923,6 +8012,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
}
|
||||
else
|
||||
{
|
||||
P_RollPitchMobj(mobj);
|
||||
P_SpawnGhostMobj(mobj);
|
||||
mobj->angle = R_PointToAngle2(0, 0, mobj->momx, mobj->momy);
|
||||
P_InstaThrust(mobj, mobj->angle, mobj->movefactor);
|
||||
@@ -7956,6 +8046,9 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
mobj->momx = mobj->momy = 0;
|
||||
mobj->health = 1;
|
||||
}
|
||||
|
||||
P_RollPitchMobj(mobj);
|
||||
|
||||
if (mobj->threshold > 0)
|
||||
mobj->threshold--;
|
||||
break;
|
||||
@@ -8003,6 +8096,8 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
|| (mobj->state >= &states[S_SSMINE_DEPLOY8] && mobj->state <= &states[S_SSMINE_DEPLOY13]))
|
||||
A_GrenadeRing(mobj);
|
||||
|
||||
P_RollPitchMobj(mobj);
|
||||
|
||||
if (mobj->threshold > 0)
|
||||
mobj->threshold--;
|
||||
break;
|
||||
@@ -8355,6 +8450,10 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fancy sign rotation
|
||||
P_RollPitchMobj(mobj);
|
||||
|
||||
break;
|
||||
case MT_CDUFO:
|
||||
if (!mobj->spawnpoint || mobj->fuse)
|
||||
@@ -9535,6 +9634,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
mobj->height = info->height;
|
||||
mobj->flags = info->flags;
|
||||
mobj->sloperoll = 0;
|
||||
mobj->slopepitch = 0;
|
||||
|
||||
mobj->pitch_sprite = 0;
|
||||
mobj->roll_sprite = 0;
|
||||
|
||||
mobj->health = info->spawnhealth;
|
||||
|
||||
@@ -11404,7 +11507,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
mobj = P_SpawnMobj(x, y, z, i);
|
||||
|
||||
if (!mobj || P_MobjWasRemoved(mobj)) {
|
||||
CONS_Alert(CONS_WARNING, "Failed to spawn map thing #%d at %d, %d\n", mthing->type, x>>FRACBITS, y>>FRACBITS);
|
||||
CONS_Alert(CONS_ERROR, "Failed to spawn map thing #%d at %d, %d. This will crash vanilla clients!\n", mthing->type, x>>FRACBITS, y>>FRACBITS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+18
-8
@@ -283,9 +283,9 @@ typedef struct mobj_s
|
||||
struct mobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr
|
||||
|
||||
// More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
angle_t old_angle; // orientation interpolation
|
||||
angle_t old_angle2;
|
||||
angle_t angle, pitch, roll; // orientation
|
||||
angle_t old_angle, old_pitch, old_roll; // orientation interpolation
|
||||
angle_t old_angle2, old_pitch2, old_roll2;
|
||||
angle_t rollangle;
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
@@ -302,7 +302,10 @@ typedef struct mobj_s
|
||||
fixed_t stretchslam; // "squish" effect when you land
|
||||
|
||||
//sloperollangle
|
||||
angle_t sloperoll, reservezangle, reservexydir;
|
||||
angle_t sloperoll, slopepitch;
|
||||
angle_t old_sloperoll, old_slopepitch;
|
||||
angle_t old_sloperoll2, old_slopepitch2;
|
||||
angle_t pitch_sprite, roll_sprite;
|
||||
|
||||
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
|
||||
|
||||
@@ -433,9 +436,9 @@ typedef struct precipmobj_s
|
||||
struct precipmobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr
|
||||
|
||||
// More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
angle_t old_angle; // orientation interpolation
|
||||
angle_t old_angle2;
|
||||
angle_t angle, pitch, roll; // orientation
|
||||
angle_t old_angle, old_pitch, old_roll; // orientation interpolation
|
||||
angle_t old_angle2, old_pitch2, old_roll2;
|
||||
angle_t rollangle;
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
@@ -452,7 +455,10 @@ typedef struct precipmobj_s
|
||||
fixed_t stretchslam; // "squish" effect when you land
|
||||
|
||||
//sloperollangle
|
||||
angle_t sloperoll, reservezangle, reservexydir;
|
||||
angle_t sloperoll, slopepitch;
|
||||
angle_t old_sloperoll, old_slopepitch;
|
||||
angle_t old_sloperoll2, old_slopepitch2;
|
||||
angle_t pitch_sprite, roll_sprite;
|
||||
|
||||
struct mprecipsecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
|
||||
|
||||
@@ -494,6 +500,10 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum);
|
||||
// check mobj against water content, before movement code
|
||||
void P_MobjCheckWater(mobj_t *mobj);
|
||||
|
||||
// fancy sprite rotation
|
||||
void P_RollPitchMobj(mobj_t *mobj);
|
||||
angle_t P_MobjPitchAndRoll(mobj_t *mobj);
|
||||
|
||||
// Player spawn points
|
||||
void P_SpawnPlayer(INT32 playernum);
|
||||
void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing);
|
||||
|
||||
+8
-2
@@ -1976,9 +1976,15 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
||||
mobj->thinker.function.acp1 = thinker;
|
||||
|
||||
mobj->rollangle = 0;
|
||||
|
||||
mobj->pitch = 0;
|
||||
mobj->roll = 0;
|
||||
|
||||
mobj->sloperoll = 0;
|
||||
mobj->reservexydir = 0;
|
||||
mobj->reservezangle = 0;
|
||||
mobj->slopepitch = 0;
|
||||
|
||||
mobj->pitch_sprite = 0;
|
||||
mobj->roll_sprite = 0;
|
||||
|
||||
mobj->spritexoffset = mobj->old_spritexoffset = 0;
|
||||
mobj->spriteyoffset = mobj->old_spriteyoffset = 0;
|
||||
|
||||
+7
-7
@@ -3621,9 +3621,7 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
|
||||
ST_LoadGraphics();
|
||||
ST_ReloadSkinFaceGraphics();
|
||||
|
||||
if (!partadd_important)
|
||||
partadd_stage = -1; // everything done
|
||||
else if (fullsetup)
|
||||
if (fullsetup)
|
||||
++partadd_stage; // run next stage too
|
||||
}
|
||||
|
||||
@@ -3632,15 +3630,17 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
|
||||
// Reload all textures, unconditionally for better or worse.
|
||||
R_LoadTextures();
|
||||
|
||||
if (fullsetup)
|
||||
// Reload ANIMATED / ANIMDEFS
|
||||
P_InitPicAnims();
|
||||
|
||||
if (!partadd_important)
|
||||
partadd_stage = -1; // everything done
|
||||
else if (fullsetup)
|
||||
++partadd_stage;
|
||||
}
|
||||
|
||||
if (partadd_stage == 2)
|
||||
{
|
||||
// Reload ANIMATED / ANIMDEFS
|
||||
P_InitPicAnims();
|
||||
|
||||
// reload status bar (warning should have valid player!)
|
||||
if (gamestate == GS_LEVEL)
|
||||
ST_Start();
|
||||
|
||||
+13
-13
@@ -3627,8 +3627,8 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
case 5: // Spikes
|
||||
// Don't do anything. In Soviet Russia, spikes find you.
|
||||
break;
|
||||
case 6: // Death Pit (Camera Mod)
|
||||
case 7: // Death Pit (No Camera Mod)
|
||||
case 6: // Death Pit (Camera Tilt)
|
||||
case 7: // Death Pit (No Camera Tilt)
|
||||
if (roversector || P_MobjReadyToTrigger(player->mo, sector))
|
||||
P_DamageMobj(player->mo, NULL, NULL, 10000);
|
||||
break;
|
||||
@@ -3685,8 +3685,8 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
{
|
||||
case 1: // Trigger Linedef Exec (Pushable Objects)
|
||||
break;
|
||||
case 2: // Linedef executor requires all players present+doesn't require touching floor
|
||||
case 3: // Linedef executor requires all players present
|
||||
case 2: // Linedef executor requires all players present+doesn't require touching floor // Trigger Linedef Exec (Anywhere, All Players)
|
||||
case 3: // Linedef executor requires all players present // Trigger Linedef Exec (Floor Touch, All Players)
|
||||
/// \todo check continues for proper splitscreen support?
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && !players[i].bot && players[i].mo && (gametype != GT_COOP || players[i].lives > 0))
|
||||
@@ -3743,16 +3743,16 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
}
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case 4: // Linedef executor that doesn't require touching floor
|
||||
case 5: // Linedef executor
|
||||
case 6: // Linedef executor (7 Emeralds)
|
||||
case 7: // Linedef executor (NiGHTS Mare)
|
||||
case 4: // Linedef executor that doesn't require touching floor // Trigger Linedef Exec (Anywhere in Sector)
|
||||
case 5: // Linedef executor // Trigger Linedef Exec (Floor Touch)
|
||||
case 6: // Linedef executor (7 Emeralds) // unused
|
||||
case 7: // SRB2kart: Linedef executor (Race Lap)
|
||||
if (!player->bot)
|
||||
P_LinedefExecute(sector->tag, player->mo, sector);
|
||||
break;
|
||||
case 8: // Tells pushable things to check FOFs
|
||||
case 8: // Tells pushable things to check FOFs // Check for Linedef Executor on FOFs
|
||||
break;
|
||||
case 9: // Egg trap capsule
|
||||
case 9: // Egg trap capsule // unused
|
||||
{
|
||||
thinker_t *th;
|
||||
mobj_t *mo2;
|
||||
@@ -3792,12 +3792,12 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
P_DoPlayerExit(&players[i]);
|
||||
break;
|
||||
}
|
||||
case 10: // Special Stage Time/Rings
|
||||
case 10: // Special Stage Time/Rings // unused
|
||||
case 11: // Custom Gravity
|
||||
break;
|
||||
case 12: // Lua sector special
|
||||
case 12: // SRB2kart: Invert Encore Remap
|
||||
break;
|
||||
case 15: // Invert Encore Remap
|
||||
case 15: // no idea but keep it dont want anything to break
|
||||
break;
|
||||
}
|
||||
DoneSection2:
|
||||
|
||||
@@ -1697,11 +1697,15 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||
else
|
||||
ghost->angle = mobj->angle;
|
||||
|
||||
ghost->pitch = mobj->pitch;
|
||||
ghost->roll = mobj->roll;
|
||||
|
||||
ghost->sprite = mobj->sprite;
|
||||
ghost->frame = mobj->frame;
|
||||
ghost->tics = -1;
|
||||
ghost->frame &= ~FF_TRANSMASK;
|
||||
ghost->frame |= tr_trans50<<FF_TRANSSHIFT;
|
||||
ghost->slopepitch = mobj->slopepitch;
|
||||
ghost->sloperoll = mobj->sloperoll;
|
||||
|
||||
ghost->fuse = ghost->info->damage;
|
||||
@@ -1724,6 +1728,10 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||
ghost->old_y = mobj->old_y2;
|
||||
ghost->old_z = mobj->old_z2;
|
||||
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle2 : mobj->old_angle2);
|
||||
ghost->old_pitch = mobj->old_pitch2;
|
||||
ghost->old_roll = mobj->old_roll2;
|
||||
ghost->old_sloperoll = mobj->old_sloperoll2;
|
||||
ghost->old_slopepitch = mobj->old_slopepitch2;
|
||||
|
||||
return ghost;
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ INT32 doorclosed;
|
||||
|
||||
boolean R_NoEncore(sector_t *sector, boolean ceiling)
|
||||
{
|
||||
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 15);
|
||||
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 12);
|
||||
#if 0 // perfect implementation
|
||||
INT32 val = GETSECSPECIAL(sector->special, 3);
|
||||
if (val != 1 && val != 3 // spring panel
|
||||
|
||||
+29
@@ -282,6 +282,10 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
out->scale = mobj->scale;
|
||||
out->subsector = mobj->subsector;
|
||||
out->angle = mobj->player ? mobj->player->frameangle : mobj->angle;
|
||||
out->pitch = mobj->pitch;
|
||||
out->roll = mobj->roll;
|
||||
out->slopepitch = mobj->slopepitch;
|
||||
out->sloperoll = mobj->sloperoll;
|
||||
out->spritexscale = mobj->spritexscale;
|
||||
out->spriteyscale = mobj->spriteyscale;
|
||||
out->spritexoffset = mobj->spritexoffset;
|
||||
@@ -313,6 +317,14 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
{
|
||||
out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac);
|
||||
}
|
||||
|
||||
// pitch roll stuff
|
||||
out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac);
|
||||
out->roll = mobj->resetinterp ? mobj->roll : R_LerpAngle(mobj->old_roll, mobj->roll, frac);
|
||||
|
||||
// and the slope stuff
|
||||
out->slopepitch = mobj->resetinterp ? mobj->slopepitch : R_LerpAngle(mobj->old_slopepitch, mobj->slopepitch, frac);
|
||||
out->sloperoll = mobj->resetinterp ? mobj->sloperoll : R_LerpAngle(mobj->old_sloperoll, mobj->sloperoll, frac);
|
||||
}
|
||||
|
||||
void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
@@ -755,10 +767,27 @@ void R_ResetMobjInterpolationState(mobj_t *mobj)
|
||||
mobj->old_z2 = mobj->old_z;
|
||||
mobj->old_angle2 = mobj->old_angle;
|
||||
mobj->old_scale2 = mobj->old_scale;
|
||||
|
||||
// rotation humor
|
||||
mobj->old_pitch2 = mobj->old_pitch;
|
||||
mobj->old_roll2 = mobj->old_roll;
|
||||
mobj->old_slopepitch2 = mobj->old_slopepitch;
|
||||
mobj->old_sloperoll2 = mobj->old_sloperoll;
|
||||
|
||||
mobj->old_x = mobj->x;
|
||||
mobj->old_y = mobj->y;
|
||||
mobj->old_z = mobj->z;
|
||||
mobj->old_angle = mobj->angle;
|
||||
|
||||
// rotation humor, again
|
||||
|
||||
// pitch and roll first
|
||||
mobj->old_pitch = mobj->pitch;
|
||||
mobj->old_roll = mobj->roll;
|
||||
|
||||
mobj->old_slopepitch = mobj->slopepitch;
|
||||
mobj->old_sloperoll = mobj->sloperoll;
|
||||
|
||||
mobj->old_scale = mobj->scale;
|
||||
mobj->old_spritexscale = mobj->spritexscale;
|
||||
mobj->old_spriteyscale = mobj->spriteyscale;
|
||||
|
||||
@@ -65,6 +65,8 @@ typedef struct {
|
||||
fixed_t spriteyscale;
|
||||
fixed_t spritexoffset;
|
||||
fixed_t spriteyoffset;
|
||||
angle_t pitch, roll;
|
||||
angle_t sloperoll, slopepitch;
|
||||
} interpmobjstate_t;
|
||||
|
||||
// Level interpolators
|
||||
|
||||
@@ -1955,8 +1955,10 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_driftsparkpulse);
|
||||
CV_RegisterVar(&cv_gravstretch);
|
||||
CV_RegisterVar(&cv_sloperoll);
|
||||
CV_RegisterVar(&cv_spriteroll);
|
||||
CV_RegisterVar(&cv_sliptideroll);
|
||||
CV_RegisterVar(&cv_sloperolldist);
|
||||
CV_RegisterVar(&cv_sparkroll);
|
||||
|
||||
CV_RegisterVar(&cv_showhud);
|
||||
CV_RegisterVar(&cv_translucenthud);
|
||||
|
||||
@@ -29,13 +29,6 @@
|
||||
#include "p_tick.h"
|
||||
#include "r_fps.h"
|
||||
|
||||
#ifdef TIMING
|
||||
#include "p5prof.h"
|
||||
INT64 mycount;
|
||||
INT64 mytotal = 0;
|
||||
UINT32 nombre = 100000;
|
||||
#endif
|
||||
|
||||
//
|
||||
// opening
|
||||
//
|
||||
@@ -340,19 +333,7 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||
ds_x1 = x1;
|
||||
ds_x2 = x2;
|
||||
|
||||
// profile drawer
|
||||
#ifdef TIMING
|
||||
ProfZeroTimer();
|
||||
#endif
|
||||
|
||||
spanfunc();
|
||||
|
||||
#ifdef TIMING
|
||||
RDMSR(0x10, &mycount);
|
||||
mytotal += mycount; // 64bit add
|
||||
if (!(nombre--))
|
||||
I_Error("spanfunc() CPU Spy reports: 0x%d %d\n", *((INT32 *)&mytotal+1), (INT32)mytotal);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -1248,19 +1248,6 @@ static boolean R_FFloorCanClip(visffloor_t *pfloor)
|
||||
#define HEIGHTBITS 12
|
||||
#define HEIGHTUNIT (1<<HEIGHTBITS)
|
||||
|
||||
|
||||
//profile stuff ---------------------------------------------------------
|
||||
//#define TIMING
|
||||
#ifdef TIMING
|
||||
#include "p5prof.h"
|
||||
INT64 mycount;
|
||||
INT64 mytotal = 0;
|
||||
UINT32 nombre = 100000;
|
||||
//static char runtest[10][80];
|
||||
#endif
|
||||
//profile stuff ---------------------------------------------------------
|
||||
|
||||
|
||||
static void R_RenderSegLoop (void)
|
||||
{
|
||||
angle_t angle;
|
||||
@@ -1517,21 +1504,7 @@ static void R_RenderSegLoop (void)
|
||||
dc_texturemid = rw_midtexturemid;
|
||||
dc_source = R_GetColumn(midtexture,texturecolumn);
|
||||
dc_texheight = textureheight[midtexture]>>FRACBITS;
|
||||
|
||||
//profile stuff ---------------------------------------------------------
|
||||
#ifdef TIMING
|
||||
ProfZeroTimer();
|
||||
#endif
|
||||
colfunc();
|
||||
#ifdef TIMING
|
||||
RDMSR(0x10,&mycount);
|
||||
mytotal += mycount; //64bit add
|
||||
|
||||
if (nombre--==0)
|
||||
I_Error("R_DrawColumn CPU Spy reports: 0x%d %d\n", *((INT32 *)&mytotal+1),
|
||||
(INT32)mytotal);
|
||||
#endif
|
||||
//profile stuff ---------------------------------------------------------
|
||||
|
||||
// dont draw anything more for this column, since
|
||||
// a midtexture blocks the view
|
||||
|
||||
+61
-23
@@ -143,11 +143,11 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
|
||||
|
||||
// rotsprite
|
||||
#ifdef ROTSPRITE
|
||||
for (r = 0; r < 16; r++)
|
||||
{
|
||||
sprtemp[frame].rotated[0][r] = NULL;
|
||||
sprtemp[frame].rotated[1][r] = NULL;
|
||||
}
|
||||
for (r = 0; r < 16; r++)
|
||||
{
|
||||
sprtemp[frame].rotated[0][r] = NULL;
|
||||
sprtemp[frame].rotated[1][r] = NULL;
|
||||
}
|
||||
#endif/*ROTSPRITE*/
|
||||
|
||||
|
||||
@@ -1327,6 +1327,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
spritecut_e cut = SC_NONE;
|
||||
|
||||
angle_t ang = 0; // gcc 4.6 and lower fix
|
||||
angle_t camang = 0;
|
||||
fixed_t iscale;
|
||||
fixed_t scalestep; // toast '16
|
||||
fixed_t offset, offset2;
|
||||
@@ -1346,6 +1347,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
patch_t *rotsprite = NULL;
|
||||
INT32 rollangle = 0;
|
||||
angle_t rollsum = 0;
|
||||
angle_t pitchnroll = 0;
|
||||
angle_t sliptiderollangle = 0;
|
||||
#endif
|
||||
|
||||
@@ -1446,6 +1448,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite)
|
||||
{
|
||||
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
|
||||
camang = R_PointToAngle (interp.x, interp.y);
|
||||
|
||||
if (mirrored)
|
||||
ang = InvAngle(ang);
|
||||
if (papersprite)
|
||||
@@ -1489,29 +1493,63 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
spr_topoffset = spritecachedinfo[lump].topoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if ((thing->rollangle)||(thing->sloperoll)||(thing->player && thing->player->sliproll))
|
||||
pitchnroll = 0; // set this to 0, non-paper sprites will affect this value
|
||||
|
||||
if (cv_spriteroll.value)
|
||||
{
|
||||
if (thing->player)
|
||||
if (papersprite)
|
||||
{
|
||||
sliptiderollangle = cv_sliptideroll.value ? thing->player->sliproll*(thing->player->sliptidemem) : 0;
|
||||
rollsum = (thing->rollangle)+(thing->sloperoll)+FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
if (ang >= ANGLE_180)
|
||||
{
|
||||
// Makes Software act much more sane like OpenGL
|
||||
rollangle = InvAngle(thing->rollangle);
|
||||
}
|
||||
else
|
||||
{
|
||||
rollangle = thing->rollangle;
|
||||
}
|
||||
}
|
||||
else
|
||||
rollsum = (thing->rollangle)+(thing->sloperoll);
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
spr_width = rotsprite->width << FRACBITS;
|
||||
spr_height = rotsprite->height << FRACBITS;
|
||||
spr_offset = rotsprite->leftoffset << FRACBITS;
|
||||
spr_topoffset = rotsprite->topoffset << FRACBITS;
|
||||
spr_topoffset += FEETADJUST;
|
||||
// this is very messy, but it on-the-fly calculates rotations for all the
|
||||
// pitch and roll variables
|
||||
pitchnroll = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp.roll) +
|
||||
FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp.pitch) +
|
||||
FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp.sloperoll) +
|
||||
FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp.slopepitch);
|
||||
|
||||
// flip -> rotate, not rotate -> flip
|
||||
flip = 0;
|
||||
rollangle = thing->rollangle;
|
||||
}
|
||||
|
||||
if ((rollangle) || (pitchnroll) || (thing->player && thing->player->sliproll))
|
||||
{
|
||||
rollsum = pitchnroll;
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
sliptiderollangle =
|
||||
cv_sliptideroll.value ? thing->player->sliproll * (thing->player->sliptidemem) : 0;
|
||||
rollsum += thing->rollangle +
|
||||
FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
}
|
||||
else
|
||||
rollsum += thing->rollangle;
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rotsprite = Patch_GetRotatedSprite(
|
||||
sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
spr_width = rotsprite->width << FRACBITS;
|
||||
spr_height = rotsprite->height << FRACBITS;
|
||||
spr_offset = rotsprite->leftoffset << FRACBITS;
|
||||
spr_topoffset = rotsprite->topoffset << FRACBITS;
|
||||
spr_topoffset += FEETADJUST;
|
||||
|
||||
// flip -> rotate, not rotate -> flip
|
||||
flip = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1764,7 +1802,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
//Fab: lumppat is the lump number of the patch to use, this is different
|
||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||
#ifdef ROTSPRITE
|
||||
if (rotsprite != NULL)
|
||||
if ((rotsprite != NULL) && (cv_spriteroll.value))
|
||||
vis->patch = rotsprite;
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -1323,19 +1323,6 @@ static UINT32 queue_fadeinms;
|
||||
musicdef_t *musicdefstart = NULL; // First music definition
|
||||
struct cursongcredit cursongcredit; // Currently displayed song credit info
|
||||
|
||||
musicdef_t soundtestsfx = {
|
||||
"_STSFX", // prevents exactly one valid track name from being used on the sound test
|
||||
"Sound Effects",
|
||||
"",
|
||||
"SEGA, Sonic Team Jr, other sources",
|
||||
1, // show on soundtest page 1
|
||||
0, // with no conditions
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
NULL
|
||||
};
|
||||
|
||||
//
|
||||
// search for music definition in wad
|
||||
//
|
||||
|
||||
@@ -172,7 +172,6 @@ typedef struct musicdef_s
|
||||
struct musicdef_s *next;
|
||||
} musicdef_t;
|
||||
|
||||
extern musicdef_t soundtestsfx;
|
||||
extern musicdef_t *musicdefstart;
|
||||
extern musicdef_t **soundtestdefs;
|
||||
extern INT32 numsoundtestdefs;
|
||||
|
||||
+51
-26
@@ -429,41 +429,65 @@ void SCR_DisplayTicRate(void)
|
||||
INT32 x = 318;
|
||||
double fps = round(averageFPS);
|
||||
INT32 fpsflags = SCR_FPSflags();
|
||||
const char *fps_string;
|
||||
|
||||
INT32 ticcntcolor2 = 0;
|
||||
|
||||
if (gamestate == GS_NULL)
|
||||
return;
|
||||
|
||||
// draw "FPS"
|
||||
if (cv_ticrate.value == 1)
|
||||
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, fpsflags, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
|
||||
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE);
|
||||
else if (fps < 20)
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
|
||||
if (cap != 0)
|
||||
// new kart counter
|
||||
if ((cv_ticrate.value == 1) || (cv_ticrate.value == 2))
|
||||
{
|
||||
UINT32 digits = 1;
|
||||
UINT32 c2 = cap;
|
||||
// draw "FPS"
|
||||
if (cv_ticrate.value == 1)
|
||||
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, fpsflags, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
|
||||
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE);
|
||||
else if (fps < 20)
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
|
||||
while (c2 > 0)
|
||||
if (cap != 0)
|
||||
{
|
||||
c2 = c2 / 10;
|
||||
digits++;
|
||||
UINT32 digits = 1;
|
||||
UINT32 c2 = cap;
|
||||
|
||||
while (c2 > 0)
|
||||
{
|
||||
c2 = c2 / 10;
|
||||
digits++;
|
||||
}
|
||||
|
||||
// draw total frame:
|
||||
V_DrawPingNum(x, 190, fpsflags, cap, ticcntcolor);
|
||||
|
||||
x -= digits * 4;
|
||||
|
||||
// draw "/"
|
||||
V_DrawFixedPatch(x<<FRACBITS, 190<<FRACBITS, FRACUNIT, fpsflags, frameslash, ticcntcolor);
|
||||
}
|
||||
|
||||
// draw total frame:
|
||||
V_DrawPingNum(x, 190, fpsflags, cap, ticcntcolor);
|
||||
|
||||
x -= digits * 4;
|
||||
|
||||
// draw "/"
|
||||
V_DrawFixedPatch(x<<FRACBITS, 190<<FRACBITS, FRACUNIT, fpsflags, frameslash, ticcntcolor);
|
||||
// draw our actual framerate
|
||||
V_DrawPingNum(x, 190, fpsflags, fps, ticcntcolor);
|
||||
}
|
||||
else if ((cv_ticrate.value == 3)||(cv_ticrate.value == 4)) // kart v1.0/srb2 counter
|
||||
{
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor2 = V_GREENMAP;
|
||||
else if (fps < 20)
|
||||
ticcntcolor2 = V_REDMAP;
|
||||
|
||||
// draw our actual framerate
|
||||
V_DrawPingNum(x, 190, fpsflags, fps, ticcntcolor);
|
||||
if (cap != 0)
|
||||
fps_string = va("%d/%d\x82", (INT32)fps, cap);
|
||||
else
|
||||
fps_string = va("%d\x82", (INT32)fps);
|
||||
|
||||
if (cv_ticrate.value == 3)
|
||||
V_DrawRightAlignedString(319, 181, V_YELLOWMAP|fpsflags, "FPS");
|
||||
|
||||
V_DrawRightAlignedString(319, 190, ticcntcolor2|fpsflags, fps_string);
|
||||
}
|
||||
}
|
||||
|
||||
// SCR_DisplayLocalPing
|
||||
@@ -476,7 +500,8 @@ void SCR_DisplayLocalPing(void)
|
||||
|
||||
if (cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level
|
||||
{
|
||||
INT32 dispy = cv_ticrate.value ? 160 : 181;
|
||||
HU_drawPing(307, dispy, ping, fpsflags);
|
||||
INT32 dispy = (cv_ticrate.value == 1) ? 165 : ((cv_ticrate.value == 2 || cv_ticrate.value == 4) ? 172 : ((cv_ticrate.value == 3) ? 163 : 181)); // absolute buttpain
|
||||
|
||||
HU_drawPing(308, dispy, ping, fpsflags);
|
||||
}
|
||||
}
|
||||
@@ -118,6 +118,7 @@ void *hwSym(const char *funcName,void *handle)
|
||||
GETFUNC(StartBatching);
|
||||
GETFUNC(RenderBatches);
|
||||
|
||||
GETFUNC(InitPalette);
|
||||
GETFUNC(AddLightTable);
|
||||
GETFUNC(ClearLightTableCache);
|
||||
|
||||
|
||||
+2
-1
@@ -1451,7 +1451,7 @@ void I_FinishUpdate(void)
|
||||
if (cv_ticrate.value && st_overlay)
|
||||
SCR_DisplayTicRate();
|
||||
|
||||
if (cv_showping.value && netgame && consoleplayer != serverplayer)
|
||||
if (cv_showping.value && netgame && consoleplayer != serverplayer && st_overlay)
|
||||
SCR_DisplayLocalPing();
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
@@ -2151,6 +2151,7 @@ void I_StartupGraphics(void)
|
||||
HWD.pfnStartBatching = hwSym("StartBatching",NULL);
|
||||
HWD.pfnRenderBatches = hwSym("RenderBatches",NULL);
|
||||
|
||||
HWD.pfnInitPalette = hwSym("InitPalette",NULL);
|
||||
HWD.pfnAddLightTable = hwSym("AddLightTable",NULL);
|
||||
HWD.pfnClearLightTableCache = hwSym("ClearLightTableCache",NULL);
|
||||
|
||||
|
||||
+40
-7
@@ -20,6 +20,8 @@
|
||||
#include "r_draw.h"
|
||||
#include "console.h"
|
||||
|
||||
#include "r_fps.h" //vhs effect stuff
|
||||
|
||||
#include "i_video.h" // rendermode
|
||||
#include "z_zone.h"
|
||||
#include "m_misc.h"
|
||||
@@ -42,7 +44,7 @@ UINT8 *screens[5];
|
||||
static CV_PossibleValue_t gamma_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NULL}};
|
||||
static void CV_usegamma_OnChange(void);
|
||||
|
||||
static CV_PossibleValue_t fps_cons_t[] = {{0, "No"}, {1, "Normal"}, {2, "Compact"}, {0, NULL}};
|
||||
static CV_PossibleValue_t fps_cons_t[] = {{0, "No"}, {1, "Normal"}, {2, "Compact"}, {3, "Old"}, {4, "Old Compact"}, {0, NULL}};
|
||||
consvar_t cv_ticrate = {"showfps", "No", CV_SAVE, fps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_usegamma = {"gamma", "0", CV_SAVE|CV_CALL, gamma_cons_t, CV_usegamma_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -207,7 +209,7 @@ void V_SetPalette(INT32 palettenum)
|
||||
{
|
||||
// reset our palette lookups n shit
|
||||
gl_palette_initialized = false;
|
||||
InitPalette(palettenum, true);
|
||||
HWR_InitPalette(palettenum, true);
|
||||
}
|
||||
else
|
||||
HWR_SetPalette(&pLocalPalette[palettenum*256]);
|
||||
@@ -229,7 +231,7 @@ void V_SetPaletteLump(const char *pal)
|
||||
{
|
||||
// reset our palette lookups n shit
|
||||
gl_palette_initialized = false;
|
||||
InitPalette(0, false);
|
||||
HWR_InitPalette(0, false);
|
||||
}
|
||||
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
@@ -693,10 +695,13 @@ void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const
|
||||
//
|
||||
// Fills a box of pixels with a single color, NOTE: scaled to screen size
|
||||
//
|
||||
// alug: now with translucency support X)
|
||||
void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
{
|
||||
UINT8 *dest;
|
||||
const UINT8 *deststop;
|
||||
INT32 u, v;
|
||||
UINT32 alphalevel = 0;
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
@@ -750,6 +755,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
|
||||
if (x >= vid.width || y >= vid.height)
|
||||
return; // off the screen
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
w += x;
|
||||
@@ -763,18 +769,45 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
|
||||
if (w <= 0 || h <= 0)
|
||||
return; // zero width/height wouldn't draw anything
|
||||
|
||||
if (x + w > vid.width)
|
||||
w = vid.width - x;
|
||||
w = vid.width-x;
|
||||
if (y + h > vid.height)
|
||||
h = vid.height - y;
|
||||
h = vid.height-y;
|
||||
|
||||
dest = screens[0] + y*vid.width + x;
|
||||
deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
|
||||
if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[cv_translucenthud.value];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - cv_translucenthud.value;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[cv_translucenthud.value];
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
}
|
||||
|
||||
c &= 255;
|
||||
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
memset(dest, c, w * vid.bpp);
|
||||
if (!alphalevel) {
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
memset(dest, c, w * vid.bpp);
|
||||
} else { // holy fuck i hope this doesent break lmao
|
||||
const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<<FF_TRANSSHIFT) + (c*256));
|
||||
#define clip(x,y) (x>y) ? y : x
|
||||
w = clip(w,vid.width);
|
||||
h = clip(h,vid.height);
|
||||
#undef clip
|
||||
for (v = 0; v < h; v++, dest += vid.width) {
|
||||
for (u = 0; u < w; u++) {
|
||||
dest[u] = fadetable[dest[u]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
+4
-7
@@ -769,13 +769,10 @@ UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, b
|
||||
{
|
||||
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
|
||||
{
|
||||
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);
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||
if (handle)
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user