mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Merge remote-tracking branch 'origin/master' into turnmultiplier
This commit is contained in:
commit
3e2b28e162
60 changed files with 3203 additions and 1694 deletions
78
.travis.yml
78
.travis.yml
|
@ -459,11 +459,15 @@ matrix:
|
|||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
|
@ -473,43 +477,24 @@ matrix:
|
|||
AND env(DPL_TERMINATE_MAIN) != "1"
|
||||
env:
|
||||
- _DPL_JOB_ENABLED=1
|
||||
- _DPL_JOB_NAME=bionic
|
||||
- _DPL_JOB_NAME=eoan
|
||||
- _DPL_DPUT_TARGET=1
|
||||
- _DPL_PACKAGE_SOURCE=1
|
||||
- PACKAGE_DISTRO=bionic
|
||||
- PACKAGE_SUBVERSION=~18.04bionic
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
dist: trusty
|
||||
if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1")
|
||||
AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1"))
|
||||
AND env(DPL_TERMINATE_MAIN) != "1"
|
||||
env:
|
||||
- _DPL_JOB_ENABLED=1
|
||||
- _DPL_JOB_NAME=trusty
|
||||
- _DPL_DPUT_TARGET=1
|
||||
- _DPL_PACKAGE_SOURCE=1
|
||||
- PACKAGE_DISTRO=trusty
|
||||
- PACKAGE_SUBVERSION=~14.04trusty
|
||||
- PACKAGE_DISTRO=eoan
|
||||
- PACKAGE_SUBVERSION=~19.10eoan
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
|
@ -528,11 +513,15 @@ matrix:
|
|||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
|
@ -542,20 +531,24 @@ matrix:
|
|||
AND env(DPL_TERMINATE_MAIN) != "1"
|
||||
env:
|
||||
- _DPL_JOB_ENABLED=1
|
||||
- _DPL_JOB_NAME=cosmic
|
||||
- _DPL_JOB_NAME=bionic
|
||||
- _DPL_DPUT_TARGET=1
|
||||
- _DPL_PACKAGE_SOURCE=1
|
||||
- PACKAGE_DISTRO=cosmic
|
||||
- PACKAGE_SUBVERSION=~18.10cosmic
|
||||
- PACKAGE_DISTRO=bionic
|
||||
- PACKAGE_SUBVERSION=~18.04bionic
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
|
@ -571,6 +564,33 @@ matrix:
|
|||
- PACKAGE_DISTRO=xenial
|
||||
- PACKAGE_SUBVERSION=~16.04xenial
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
dist: trusty
|
||||
if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1")
|
||||
AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1"))
|
||||
AND env(DPL_TERMINATE_MAIN) != "1"
|
||||
env:
|
||||
- _DPL_JOB_ENABLED=1
|
||||
- _DPL_JOB_NAME=trusty
|
||||
- _DPL_DPUT_TARGET=1
|
||||
- _DPL_PACKAGE_SOURCE=1
|
||||
- PACKAGE_DISTRO=trusty
|
||||
- PACKAGE_SUBVERSION=~14.04trusty
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
allow_failures:
|
||||
- compiler: clang-3.5
|
||||
- compiler: clang-3.6
|
||||
|
|
|
@ -95,7 +95,6 @@ set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|||
|
||||
# Set EXE names so the assets CMakeLists can refer to its target
|
||||
set(SRB2_SDL2_EXE_NAME srb2 CACHE STRING "Executable binary output name")
|
||||
set(SRB2_WIN_EXE_NAME srb2dd CACHE STRING "Executable binary output name for DirectDraw build")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||
|
||||
|
|
14
appveyor.yml
14
appveyor.yml
|
@ -1,4 +1,4 @@
|
|||
version: 2.1.25.{branch}-{build}
|
||||
version: 2.2.0.{branch}-{build}
|
||||
os: MinGW
|
||||
|
||||
environment:
|
||||
|
@ -29,15 +29,15 @@ environment:
|
|||
##############################
|
||||
DPL_ENABLED: 0
|
||||
DPL_TAG_ENABLED: 0
|
||||
DPL_INSTALLER_NAME: SRB2-v2123
|
||||
DPL_INSTALLER_NAME: SRB2-v220
|
||||
# Asset handling is barebones vs. Travis Deployer. We operate on 7z only.
|
||||
# Include the README files and the OpenGL batch in the main and patch archives.
|
||||
# The x86/x64 archives contain the DLL binaries.
|
||||
ASSET_ARCHIVE_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z
|
||||
ASSET_ARCHIVE_PATCH_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-patch-assets.7z
|
||||
ASSET_ARCHIVE_X86_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x86-assets.7z
|
||||
ASSET_ARCHIVE_X64_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x64-assets.7z
|
||||
ASSET_ARCHIVE_OPTIONAL_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z
|
||||
ASSET_ARCHIVE_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-assets.7z
|
||||
ASSET_ARCHIVE_PATCH_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-patch-assets.7z
|
||||
ASSET_ARCHIVE_X86_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-x86-assets.7z
|
||||
ASSET_ARCHIVE_X64_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-x64-assets.7z
|
||||
ASSET_ARCHIVE_OPTIONAL_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-optional-assets.7z
|
||||
# This is overridden to 1 for release tag builds
|
||||
ASSET_FILES_OPTIONAL_GET: 0
|
||||
# For patches, also include the X86/X64 DLLs.
|
||||
|
|
|
@ -12,6 +12,10 @@ ENDFUNCTION(PREPEND)
|
|||
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
|
||||
CACHE STRING "Path to directory that contains all asset files for the installer.")
|
||||
|
||||
####################
|
||||
# POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list!
|
||||
####################
|
||||
|
||||
set(SRB2_ASSET_HASHED
|
||||
"srb2.pk3;\
|
||||
player.dta;\
|
||||
|
@ -22,7 +26,8 @@ zones.pk3"
|
|||
set(SRB2_ASSET_DOCS
|
||||
"README.txt;\
|
||||
LICENSE.txt;\
|
||||
LICENSE-3RD-PARTY.txt"
|
||||
LICENSE-3RD-PARTY.txt;\
|
||||
README-SDL.txt"
|
||||
CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!"
|
||||
)
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ Build-Depends: debhelper (>= 7.0.50~),
|
|||
libpng-dev | libpng16-dev | libpng12-dev (>= 1.2.7),
|
||||
zlib1g-dev,
|
||||
libgme-dev,
|
||||
libopenmpt-dev,
|
||||
libglu1-dev | libglu-dev,
|
||||
libosmesa6-dev | libgl-dev,
|
||||
nasm [i386]
|
||||
|
@ -24,6 +25,7 @@ Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS},
|
|||
libsdl2-mixer-2.0-0,
|
||||
zlib1g,
|
||||
libgme0,
|
||||
libopenmpt | libopenmpt0,
|
||||
libpng | libpng16-16 | libpng12-0
|
||||
Description: A cross-platform 3D Sonic fangame
|
||||
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
: ${_DPL_PACKAGE_ASSET} # Build asset installation package. Linux only.
|
||||
|
||||
# Asset File Parameters
|
||||
: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z}
|
||||
: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z}
|
||||
: ${ASSET_FILES_HASHED:=srb2.srb zones.dta player.dta rings.dta patch.dta}
|
||||
: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt}
|
||||
: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-assets.7z}
|
||||
: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-optional-assets.7z}
|
||||
: ${ASSET_FILES_HASHED:=srb2.pk3 zones.pk3 player.dta} # POST v2.2 NOTE: Don't forget to add patch.pk3!
|
||||
: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt README-SDL.txt}
|
||||
: ${ASSET_FILES_OPTIONAL_GET:=0}
|
||||
|
||||
# FTP Parameters
|
||||
|
@ -51,7 +51,7 @@
|
|||
|
||||
# Package Parameters
|
||||
: ${PACKAGE_NAME:=srb2}
|
||||
: ${PACKAGE_VERSION:=2.1.23}
|
||||
: ${PACKAGE_VERSION:=2.2.0}
|
||||
: ${PACKAGE_SUBVERSION} # Highly recommended to set this to reflect the distro series target (e.g., ~18.04bionic)
|
||||
: ${PACKAGE_REVISION} # Defaults to UTC timestamp
|
||||
: ${PACKAGE_INSTALL_PATH:=/usr/games/SRB2}
|
||||
|
@ -62,12 +62,12 @@
|
|||
: ${PACKAGE_GROUP_NAME_EMAIL:=Sonic Team Junior <stjr@srb2.org>}
|
||||
: ${PACKAGE_WEBSITE:=<http://www.srb2.org>}
|
||||
|
||||
: ${PACKAGE_ASSET_MINVERSION:=2.1.21} # Number this the version BEFORE the actual required version, because we do a > check
|
||||
: ${PACKAGE_ASSET_MAXVERSION:=2.1.24} # Number this the version AFTER the actual required version, because we do a < check
|
||||
: ${PACKAGE_ASSET_MINVERSION:=2.1.26} # Number this the version BEFORE the actual required version, because we do a > check
|
||||
: ${PACKAGE_ASSET_MAXVERSION:=2.2.1} # Number this the version AFTER the actual required version, because we do a < check
|
||||
|
||||
: ${PROGRAM_NAME:=Sonic Robo Blast 2}
|
||||
: ${PROGRAM_VENDOR:=Sonic Team Junior}
|
||||
: ${PROGRAM_VERSION:=2.1.23}
|
||||
: ${PROGRAM_VERSION:=2.2.0}
|
||||
: ${PROGRAM_DESCRIPTION:=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis.}
|
||||
: ${PROGRAM_FILENAME:=srb2}
|
||||
|
||||
|
|
|
@ -3389,14 +3389,14 @@ thingtypes
|
|||
}
|
||||
118
|
||||
{
|
||||
title = "CastleBot FaceStabber";
|
||||
title = "Lance-a-Bot";
|
||||
sprite = "CBFSA1";
|
||||
width = 32;
|
||||
height = 72;
|
||||
}
|
||||
1113
|
||||
{
|
||||
title = "Suspicious FaceStabber Statue";
|
||||
title = "Suspicious Lance-a-Bot Statue";
|
||||
sprite = "CBBSA1";
|
||||
width = 32;
|
||||
height = 72;
|
||||
|
@ -5006,7 +5006,7 @@ thingtypes
|
|||
{
|
||||
arrow = 1;
|
||||
blocking = 2;
|
||||
title = "FaceStabber Statue";
|
||||
title = "Lance-a-Bot Statue";
|
||||
sprite = "CBBSA1";
|
||||
width = 32;
|
||||
height = 72;
|
||||
|
|
|
@ -518,10 +518,6 @@ add_definitions(-DCMAKECONFIG)
|
|||
|
||||
add_subdirectory(sdl)
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
add_subdirectory(win32)
|
||||
endif()
|
||||
|
||||
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
|
||||
if(NOT ${SRB2_SDL2_AVAILABLE})
|
||||
message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(")
|
||||
endif()
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
boolean server = true; // true or false but !server == client
|
||||
#define client (!server)
|
||||
boolean nodownload = false;
|
||||
static boolean serverrunning = false;
|
||||
boolean serverrunning = false;
|
||||
INT32 serverplayer = 0;
|
||||
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
|
||||
|
||||
|
@ -1301,6 +1301,8 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
|
||||
M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, 16);
|
||||
|
||||
memset(netbuffer->u.serverinfo.maptitle, 0, sizeof netbuffer->u.serverinfo.maptitle);
|
||||
|
||||
if (mapheaderinfo[gamemap-1] && *mapheaderinfo[gamemap-1]->lvlttl)
|
||||
{
|
||||
char *read = mapheaderinfo[gamemap-1]->lvlttl, *writ = netbuffer->u.serverinfo.maptitle;
|
||||
|
@ -1319,8 +1321,6 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
else
|
||||
strncpy(netbuffer->u.serverinfo.maptitle, "UNKNOWN", 32);
|
||||
|
||||
netbuffer->u.serverinfo.maptitle[32] = '\0';
|
||||
|
||||
if (mapheaderinfo[gamemap-1] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
|
||||
netbuffer->u.serverinfo.iszone = 1;
|
||||
else
|
||||
|
|
|
@ -1193,6 +1193,13 @@ void D_SRB2Main(void)
|
|||
CONS_Printf("I_StartupGraphics()...\n");
|
||||
I_StartupGraphics();
|
||||
|
||||
#ifdef HWRENDER
|
||||
// Lactozilla: Add every hardware mode CVAR and CCMD.
|
||||
// Has to be done before the configuration file loads,
|
||||
// but after the OpenGL library loads.
|
||||
HWR_AddCommands();
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------- CONSOLE
|
||||
// setup loading screen
|
||||
SCR_Startup();
|
||||
|
|
|
@ -40,6 +40,8 @@ extern SINT8 nodetoplayer2[MAXNETNODES]; // Say the numplayer for this node if a
|
|||
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
|
||||
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
|
||||
|
||||
extern boolean serverrunning;
|
||||
|
||||
INT32 Net_GetFreeAcks(boolean urgent);
|
||||
void Net_AckTicker(void);
|
||||
|
||||
|
|
|
@ -823,6 +823,10 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_autobrake);
|
||||
CV_RegisterVar(&cv_autobrake2);
|
||||
|
||||
// Ported from kart
|
||||
CV_RegisterVar(&cv_deadzone);
|
||||
CV_RegisterVar(&cv_deadzone2);
|
||||
|
||||
// s_sound.c
|
||||
CV_RegisterVar(&cv_soundvolume);
|
||||
CV_RegisterVar(&cv_closedcaptioning);
|
||||
|
@ -1907,7 +1911,7 @@ static void Command_Map_f(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (newmapnum == 0 || !mapheaderinfo[newmapnum-1])
|
||||
if (newmapnum == 0)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Could not find any map described as '%s'.\n"), mapname);
|
||||
Z_Free(mapname);
|
||||
|
|
|
@ -242,6 +242,7 @@ INT32 flags; Bits = 3232 MF_SOLID|MF_SHOOTABLE|MF_DROPOFF|M
|
|||
INT32 raisestate; Respawn frame = 32 S_NULL // raisestate
|
||||
}, */
|
||||
|
||||
#ifdef HWRENDER
|
||||
static INT32 searchvalue(const char *s)
|
||||
{
|
||||
while (s[0] != '=' && s[0])
|
||||
|
@ -255,7 +256,6 @@ static INT32 searchvalue(const char *s)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
static float searchfvalue(const char *s)
|
||||
{
|
||||
while (s[0] != '=' && s[0])
|
||||
|
@ -886,7 +886,9 @@ static void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
|
|||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
char *word, *word2;
|
||||
char *tmp;
|
||||
#ifdef HWRENDER
|
||||
INT32 value;
|
||||
#endif
|
||||
char *lastline;
|
||||
INT32 skinnumbers[MAXSKINS];
|
||||
INT32 foundskins = 0;
|
||||
|
@ -947,9 +949,9 @@ static void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
|
|||
break;
|
||||
}
|
||||
strupr(word);
|
||||
#ifdef HWRENDER
|
||||
value = atoi(word2); // used for numerical settings
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (fastcmp(word, "LIGHTTYPE"))
|
||||
{
|
||||
if (sprite2)
|
||||
|
|
|
@ -628,8 +628,12 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
#define ROTANGLES 24 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
||||
#define ROTANGDIFF (360 / ROTANGLES)
|
||||
|
||||
/// PNG support
|
||||
#ifndef HAVE_PNG
|
||||
#define NO_PNG_LUMPS
|
||||
#endif
|
||||
|
||||
/// Render flats on walls
|
||||
#define WALLFLATS
|
||||
|
||||
#endif // __DOOMDEF__
|
||||
|
|
217
src/g_game.c
217
src/g_game.c
|
@ -275,6 +275,12 @@ static UINT8 *metalbuffer = NULL;
|
|||
static UINT8 *metal_p;
|
||||
static UINT16 metalversion;
|
||||
|
||||
typedef struct joystickvector2_s
|
||||
{
|
||||
INT32 xaxis;
|
||||
INT32 yaxis;
|
||||
} joystickvector2_t;
|
||||
|
||||
// extra data stuff (events registered this frame while recording)
|
||||
static struct {
|
||||
UINT8 flags; // EZT flags
|
||||
|
@ -394,6 +400,11 @@ consvar_t cv_directionchar2 = {"directionchar2", "Movement", CV_SAVE|CV_CALL, di
|
|||
consvar_t cv_autobrake = {"autobrake", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_autobrake2 = {"autobrake2", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t deadzone_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_deadzone = {"deadzone", "0.25", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_deadzone2 = {"deadzone2", "0.25", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AXISNONE = 0,
|
||||
|
@ -401,7 +412,6 @@ typedef enum
|
|||
AXISMOVE,
|
||||
AXISLOOK,
|
||||
AXISSTRAFE,
|
||||
AXISDEAD, //Axises that don't want deadzones
|
||||
AXISJUMP,
|
||||
AXISSPIN,
|
||||
AXISFIRE,
|
||||
|
@ -882,12 +892,6 @@ static INT32 JoyAxis(axis_input_e axissel)
|
|||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick.bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = JOYAXISRANGE/4;
|
||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
}
|
||||
|
@ -955,16 +959,75 @@ static INT32 Joy2Axis(axis_input_e axissel)
|
|||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick2.bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = JOYAXISRANGE/4;
|
||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
}
|
||||
|
||||
// Take a magnitude of two axes, and adjust it to take out the deadzone
|
||||
// Will return a value between 0 and JOYAXISRANGE
|
||||
static INT32 G_BasicDeadZoneCalculation(INT32 magnitude, fixed_t deadZone)
|
||||
{
|
||||
const INT32 jdeadzone = (JOYAXISRANGE * deadZone) / FRACUNIT;
|
||||
INT32 deadzoneAppliedValue = 0;
|
||||
|
||||
if (jdeadzone > 0)
|
||||
{
|
||||
if (magnitude > jdeadzone)
|
||||
{
|
||||
INT32 adjustedMagnitude = abs(magnitude);
|
||||
adjustedMagnitude = min(adjustedMagnitude, JOYAXISRANGE);
|
||||
|
||||
adjustedMagnitude -= jdeadzone;
|
||||
|
||||
deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone);
|
||||
}
|
||||
}
|
||||
|
||||
return deadzoneAppliedValue;
|
||||
}
|
||||
|
||||
// Get the actual sensible radial value for a joystick axis when accounting for a deadzone
|
||||
static void G_HandleAxisDeadZone(UINT8 splitnum, joystickvector2_t *joystickvector)
|
||||
{
|
||||
INT32 gamepadStyle = Joystick.bGamepadStyle;
|
||||
fixed_t deadZone = cv_deadzone.value;
|
||||
|
||||
if (splitnum == 1)
|
||||
{
|
||||
gamepadStyle = Joystick2.bGamepadStyle;
|
||||
deadZone = cv_deadzone2.value;
|
||||
}
|
||||
|
||||
// When gamepadstyle is "true" the values are just -1, 0, or 1. This is done in the interface code.
|
||||
if (!gamepadStyle)
|
||||
{
|
||||
// Get the total magnitude of the 2 axes
|
||||
INT32 magnitude = (joystickvector->xaxis * joystickvector->xaxis) + (joystickvector->yaxis * joystickvector->yaxis);
|
||||
INT32 normalisedXAxis;
|
||||
INT32 normalisedYAxis;
|
||||
INT32 normalisedMagnitude;
|
||||
double dMagnitude = sqrt((double)magnitude);
|
||||
magnitude = (INT32)dMagnitude;
|
||||
|
||||
// Get the normalised xy values from the magnitude
|
||||
normalisedXAxis = (joystickvector->xaxis * magnitude) / JOYAXISRANGE;
|
||||
normalisedYAxis = (joystickvector->yaxis * magnitude) / JOYAXISRANGE;
|
||||
|
||||
// Apply the deadzone to the magnitude to give a correct value between 0 and JOYAXISRANGE
|
||||
normalisedMagnitude = G_BasicDeadZoneCalculation(magnitude, deadZone);
|
||||
|
||||
// Apply the deadzone to the xy axes
|
||||
joystickvector->xaxis = (normalisedXAxis * normalisedMagnitude) / JOYAXISRANGE;
|
||||
joystickvector->yaxis = (normalisedYAxis * normalisedMagnitude) / JOYAXISRANGE;
|
||||
|
||||
// Cap the values so they don't go above the correct maximum
|
||||
joystickvector->xaxis = min(joystickvector->xaxis, JOYAXISRANGE);
|
||||
joystickvector->xaxis = max(joystickvector->xaxis, -JOYAXISRANGE);
|
||||
joystickvector->yaxis = min(joystickvector->yaxis, JOYAXISRANGE);
|
||||
joystickvector->yaxis = max(joystickvector->yaxis, -JOYAXISRANGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// G_BuildTiccmd
|
||||
|
@ -985,12 +1048,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
{
|
||||
boolean forcestrafe = false;
|
||||
boolean forcefullinput = false;
|
||||
INT32 tspeed, forward, side, axis, altaxis, i;
|
||||
INT32 tspeed, forward, side, axis, strafeaxis, moveaxis, turnaxis, lookaxis, i;
|
||||
const INT32 speed = 1;
|
||||
// these ones used for multiple conditions
|
||||
boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming;
|
||||
player_t *player = &players[consoleplayer];
|
||||
camera_t *thiscam = &camera;
|
||||
joystickvector2_t movejoystickvector, lookjoystickvector;
|
||||
|
||||
static INT32 turnheld; // for accelerative turning
|
||||
static boolean keyboard_look; // true if lookup/down using keyboard
|
||||
|
@ -1030,11 +1094,16 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
localaiming = 0;
|
||||
joyaiming = thisjoyaiming;
|
||||
|
||||
axis = JoyAxis(AXISTURN);
|
||||
if (gamepadjoystickmove && axis != 0)
|
||||
turnaxis = JoyAxis(AXISTURN);
|
||||
lookaxis = JoyAxis(AXISLOOK);
|
||||
lookjoystickvector.xaxis = turnaxis;
|
||||
lookjoystickvector.yaxis = lookaxis;
|
||||
G_HandleAxisDeadZone(0, &lookjoystickvector);
|
||||
|
||||
if (gamepadjoystickmove && lookjoystickvector.xaxis != 0)
|
||||
{
|
||||
turnright = turnright || (axis > 0);
|
||||
turnleft = turnleft || (axis < 0);
|
||||
turnright = turnright || (lookjoystickvector.xaxis > 0);
|
||||
turnleft = turnleft || (lookjoystickvector.xaxis < 0);
|
||||
}
|
||||
forward = side = 0;
|
||||
|
||||
|
@ -1074,10 +1143,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
if (turnleft)
|
||||
side -= sidemove[speed];
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||
{
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
side += ((axis * sidemove[1]) >> 10);
|
||||
side += ((lookjoystickvector.xaxis * sidemove[1]) >> 10);
|
||||
}
|
||||
}
|
||||
else if (cv_analog.value) // Analog
|
||||
|
@ -1094,41 +1163,44 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
else if (turnleft)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn + ((angleturn[tspeed] * cv_cam_turnmultiplier.value)>>FRACBITS));
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||
{
|
||||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((((axis * angleturn[1]) >> 10) * cv_cam_turnmultiplier.value)>>FRACBITS)); // ANALOG!
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((((lookjoystickvector.xaxis * angleturn[1]) >> 10) * cv_cam_turnmultiplier.value)>>FRACBITS)); // ANALOG!
|
||||
}
|
||||
}
|
||||
|
||||
axis = JoyAxis(AXISSTRAFE);
|
||||
if (gamepadjoystickmove && axis != 0)
|
||||
strafeaxis = JoyAxis(AXISSTRAFE);
|
||||
moveaxis = JoyAxis(AXISMOVE);
|
||||
movejoystickvector.xaxis = strafeaxis;
|
||||
movejoystickvector.yaxis = moveaxis;
|
||||
G_HandleAxisDeadZone(0, &movejoystickvector);
|
||||
|
||||
if (gamepadjoystickmove && movejoystickvector.xaxis != 0)
|
||||
{
|
||||
if (axis < 0)
|
||||
if (movejoystickvector.xaxis > 0)
|
||||
side += sidemove[speed];
|
||||
else if (axis > 0)
|
||||
else if (movejoystickvector.xaxis < 0)
|
||||
side -= sidemove[speed];
|
||||
}
|
||||
else if (analogjoystickmove && axis != 0)
|
||||
else if (analogjoystickmove && movejoystickvector.xaxis != 0)
|
||||
{
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
side += ((axis * sidemove[1]) >> 10);
|
||||
side += ((movejoystickvector.xaxis * sidemove[1]) >> 10);
|
||||
}
|
||||
|
||||
// forward with key or button
|
||||
axis = JoyAxis(AXISMOVE);
|
||||
altaxis = JoyAxis(AXISLOOK);
|
||||
if (movefkey || (gamepadjoystickmove && axis < 0)
|
||||
if (movefkey || (gamepadjoystickmove && movejoystickvector.yaxis < 0)
|
||||
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||
&& (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && altaxis < 0))))
|
||||
&& (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0))))
|
||||
forward = forwardmove[speed];
|
||||
if (movebkey || (gamepadjoystickmove && axis > 0)
|
||||
if (movebkey || (gamepadjoystickmove && movejoystickvector.yaxis > 0)
|
||||
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||
&& (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0))))
|
||||
&& (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0))))
|
||||
forward -= forwardmove[speed];
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
forward -= ((axis * forwardmove[1]) >> 10); // ANALOG!
|
||||
if (analogjoystickmove && movejoystickvector.yaxis != 0)
|
||||
forward -= ((movejoystickvector.yaxis * forwardmove[1]) >> 10); // ANALOG!
|
||||
|
||||
// some people strafe left & right with mouse buttons
|
||||
// those people are weird
|
||||
|
@ -1211,9 +1283,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
localaiming += (mlooky<<19)*player_invert*screen_invert;
|
||||
}
|
||||
|
||||
axis = JoyAxis(AXISLOOK);
|
||||
if (analogjoystickmove && joyaiming && axis != 0 && cv_lookaxis.value != 0)
|
||||
localaiming += (axis<<16) * screen_invert;
|
||||
if (analogjoystickmove && joyaiming && lookjoystickvector.yaxis != 0 && cv_lookaxis.value != 0)
|
||||
localaiming += (lookjoystickvector.yaxis<<16) * screen_invert;
|
||||
|
||||
// spring back if not using keyboard neither mouselookin'
|
||||
if (!keyboard_look && cv_lookaxis.value == 0 && !joyaiming && !mouseaiming)
|
||||
|
@ -1221,12 +1292,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
if (!(player->powers[pw_carry] == CR_NIGHTSMODE))
|
||||
{
|
||||
if (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0))
|
||||
if (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0))
|
||||
{
|
||||
localaiming += KB_LOOKSPEED * screen_invert;
|
||||
keyboard_look = true;
|
||||
}
|
||||
else if (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0))
|
||||
else if (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0))
|
||||
{
|
||||
localaiming -= KB_LOOKSPEED * screen_invert;
|
||||
keyboard_look = true;
|
||||
|
@ -1316,12 +1387,13 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
{
|
||||
boolean forcestrafe = false;
|
||||
boolean forcefullinput = false;
|
||||
INT32 tspeed, forward, side, axis, altaxis, i;
|
||||
INT32 tspeed, forward, side, axis, strafeaxis, moveaxis, turnaxis, lookaxis, i;
|
||||
const INT32 speed = 1;
|
||||
// these ones used for multiple conditions
|
||||
boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming;
|
||||
player_t *player = &players[secondarydisplayplayer];
|
||||
camera_t *thiscam = (player->bot == 2 ? &camera : &camera2);
|
||||
joystickvector2_t movejoystickvector, lookjoystickvector;
|
||||
|
||||
static INT32 turnheld; // for accelerative turning
|
||||
static boolean keyboard_look; // true if lookup/down using keyboard
|
||||
|
@ -1359,11 +1431,16 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
localaiming2 = 0;
|
||||
joyaiming = thisjoyaiming;
|
||||
|
||||
axis = Joy2Axis(AXISTURN);
|
||||
if (gamepadjoystickmove && axis != 0)
|
||||
turnaxis = Joy2Axis(AXISTURN);
|
||||
lookaxis = Joy2Axis(AXISLOOK);
|
||||
lookjoystickvector.xaxis = turnaxis;
|
||||
lookjoystickvector.yaxis = lookaxis;
|
||||
G_HandleAxisDeadZone(1, &lookjoystickvector);
|
||||
|
||||
if (gamepadjoystickmove && lookjoystickvector.xaxis != 0)
|
||||
{
|
||||
turnright = turnright || (axis > 0);
|
||||
turnleft = turnleft || (axis < 0);
|
||||
turnright = turnright || (lookjoystickvector.xaxis > 0);
|
||||
turnleft = turnleft || (lookjoystickvector.xaxis < 0);
|
||||
}
|
||||
forward = side = 0;
|
||||
|
||||
|
@ -1404,10 +1481,10 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
if (turnleft)
|
||||
side -= sidemove[speed];
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||
{
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
side += ((axis * sidemove[1]) >> 10);
|
||||
side += ((lookjoystickvector.xaxis * sidemove[1]) >> 10);
|
||||
}
|
||||
}
|
||||
else if (cv_analog2.value) // Analog
|
||||
|
@ -1424,41 +1501,44 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
else if (turnleft)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn + (FixedMul(angleturn[tspeed]<<FRACBITS, cv_cam2_turnmultiplier.value)>>FRACBITS));
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||
{
|
||||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - (FixedMul(((axis * angleturn[1]) >> 10)<<FRACBITS, cv_cam2_turnmultiplier.value)>>FRACBITS)); // ANALOG!
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - (FixedMul(((lookjoystickvector.xaxis * angleturn[1]) >> 10)<<FRACBITS, cv_cam2_turnmultiplier.value)>>FRACBITS)); // ANALOG!
|
||||
}
|
||||
}
|
||||
|
||||
axis = Joy2Axis(AXISSTRAFE);
|
||||
if (gamepadjoystickmove && axis != 0)
|
||||
strafeaxis = Joy2Axis(AXISSTRAFE);
|
||||
moveaxis = Joy2Axis(AXISMOVE);
|
||||
movejoystickvector.xaxis = strafeaxis;
|
||||
movejoystickvector.yaxis = moveaxis;
|
||||
G_HandleAxisDeadZone(1, &movejoystickvector);
|
||||
|
||||
if (gamepadjoystickmove && movejoystickvector.xaxis != 0)
|
||||
{
|
||||
if (axis < 0)
|
||||
if (movejoystickvector.xaxis > 0)
|
||||
side += sidemove[speed];
|
||||
else if (axis > 0)
|
||||
else if (movejoystickvector.xaxis < 0)
|
||||
side -= sidemove[speed];
|
||||
}
|
||||
else if (analogjoystickmove && axis != 0)
|
||||
else if (analogjoystickmove && movejoystickvector.xaxis != 0)
|
||||
{
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
side += ((axis * sidemove[1]) >> 10);
|
||||
side += ((movejoystickvector.xaxis * sidemove[1]) >> 10);
|
||||
}
|
||||
|
||||
// forward with key or button
|
||||
axis = Joy2Axis(AXISMOVE);
|
||||
altaxis = Joy2Axis(AXISLOOK);
|
||||
if (movefkey || (gamepadjoystickmove && axis < 0)
|
||||
if (movefkey || (gamepadjoystickmove && movejoystickvector.yaxis < 0)
|
||||
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||
&& (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && altaxis < 0))))
|
||||
&& (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0))))
|
||||
forward = forwardmove[speed];
|
||||
if (movebkey || (gamepadjoystickmove && axis > 0)
|
||||
if (movebkey || (gamepadjoystickmove && movejoystickvector.yaxis > 0)
|
||||
|| ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||
&& (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0))))
|
||||
&& (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0))))
|
||||
forward -= forwardmove[speed];
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
forward -= ((axis * forwardmove[1]) >> 10); // ANALOG!
|
||||
if (analogjoystickmove && movejoystickvector.yaxis != 0)
|
||||
forward -= ((movejoystickvector.yaxis * forwardmove[1]) >> 10); // ANALOG!
|
||||
|
||||
// some people strafe left & right with mouse buttons
|
||||
// those people are (still) weird
|
||||
|
@ -1538,9 +1618,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
localaiming2 += (mlook2y<<19)*player_invert*screen_invert;
|
||||
}
|
||||
|
||||
axis = Joy2Axis(AXISLOOK);
|
||||
if (analogjoystickmove && joyaiming && axis != 0 && cv_lookaxis2.value != 0)
|
||||
localaiming2 += (axis<<16) * screen_invert;
|
||||
if (analogjoystickmove && joyaiming && lookjoystickvector.yaxis != 0 && cv_lookaxis2.value != 0)
|
||||
localaiming2 += (lookjoystickvector.yaxis<<16) * screen_invert;
|
||||
|
||||
// spring back if not using keyboard neither mouselookin'
|
||||
if (!keyboard_look && cv_lookaxis2.value == 0 && !joyaiming && !mouseaiming)
|
||||
|
@ -1548,12 +1627,12 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
if (!(player->powers[pw_carry] == CR_NIGHTSMODE))
|
||||
{
|
||||
if (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0))
|
||||
if (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0))
|
||||
{
|
||||
localaiming2 += KB_LOOKSPEED * screen_invert;
|
||||
keyboard_look = true;
|
||||
}
|
||||
else if (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0))
|
||||
else if (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0))
|
||||
{
|
||||
localaiming2 -= KB_LOOKSPEED * screen_invert;
|
||||
keyboard_look = true;
|
||||
|
|
|
@ -72,6 +72,7 @@ extern consvar_t cv_useranalog, cv_useranalog2;
|
|||
extern consvar_t cv_analog, cv_analog2;
|
||||
extern consvar_t cv_directionchar, cv_directionchar2;
|
||||
extern consvar_t cv_autobrake, cv_autobrake2;
|
||||
extern consvar_t cv_deadzone, cv_deadzone2;
|
||||
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis;
|
||||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2;
|
||||
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest;
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
#include "../r_patch.h"
|
||||
#include "../p_setup.h"
|
||||
|
||||
//Hurdler: 25/04/2000: used for new colormap code in hardware mode
|
||||
//static UINT8 *gr_colormap = NULL; // by default it must be NULL ! (because colormap tables are not initialized)
|
||||
boolean firetranslucent = false;
|
||||
|
||||
// Values set after a call to HWR_ResizeBlock()
|
||||
static INT32 blocksize, blockwidth, blockheight;
|
||||
|
||||
|
@ -122,18 +118,16 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
|||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
|
||||
if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel))
|
||||
alpha = 0x80;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// transparent pixel
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||
alpha = 0x00;
|
||||
else
|
||||
alpha = 0xff;
|
||||
|
||||
//Hurdler: not perfect, but better than holes
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||
texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
else if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
||||
// Alam: SRB2 uses Mingw, HUGS
|
||||
|
@ -236,18 +230,16 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
|
||||
if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel))
|
||||
alpha = 0x80;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// transparent pixel
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||
alpha = 0x00;
|
||||
else
|
||||
alpha = 0xff;
|
||||
|
||||
//Hurdler: not perfect, but better than holes
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||
texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
else if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
||||
// Alam: SRB2 uses Mingw, HUGS
|
||||
|
@ -576,7 +568,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
|||
{
|
||||
UINT8 *block;
|
||||
INT32 bpp, i;
|
||||
UINT16 bu16 = ((0x00 <<8) | HWR_CHROMAKEY_EQUIVALENTCOLORINDEX);
|
||||
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||
|
||||
bpp = format2bpp[grMipmap->grInfo.format];
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data));
|
||||
|
@ -606,6 +598,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
texture_t *texture;
|
||||
texpatch_t *patch;
|
||||
patch_t *realpatch;
|
||||
UINT8 *pdata;
|
||||
|
||||
INT32 i;
|
||||
boolean skyspecial = false; //poor hack for Legacy large skies..
|
||||
|
@ -638,7 +631,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
INT32 j;
|
||||
RGBA_t col;
|
||||
|
||||
col = V_GetColor(HWR_CHROMAKEY_EQUIVALENTCOLORINDEX);
|
||||
col = V_GetColor(HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||
for (j = 0; j < blockheight; j++)
|
||||
{
|
||||
for (i = 0; i < blockwidth; i++)
|
||||
|
@ -654,18 +647,29 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
// Composite the columns together.
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
#ifndef NO_PNG_LUMPS
|
||||
boolean dealloc = true;
|
||||
size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump);
|
||||
#endif
|
||||
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
realpatch = (patch_t *)pdata;
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
||||
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
|
||||
else
|
||||
#endif
|
||||
HWR_DrawTexturePatchInCache(&grtex->mipmap,
|
||||
blockwidth, blockheight,
|
||||
texture, patch,
|
||||
realpatch);
|
||||
#ifdef WALLFLATS
|
||||
if (texture->type == TEXTURETYPE_FLAT)
|
||||
realpatch = R_FlatToPatch(pdata, texture->width, texture->height, 0, 0, NULL, false);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
(void)lumplength;
|
||||
dealloc = false;
|
||||
}
|
||||
|
||||
HWR_DrawTexturePatchInCache(&grtex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
|
||||
|
||||
if (dealloc)
|
||||
Z_Unlock(realpatch);
|
||||
}
|
||||
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
||||
|
@ -760,15 +764,15 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
// CACHING HANDLING
|
||||
// =================================================
|
||||
|
||||
static size_t gr_numtextures;
|
||||
static GLTexture_t *gr_textures; // for ALL Doom textures
|
||||
static GLTexture_t *gr_textures2;
|
||||
static size_t gr_numtextures; // Texture count
|
||||
static GLTexture_t *gr_textures; // For all textures
|
||||
static GLTexture_t *gr_flats; // For all (texture) flats, as normal flats don't need to be cached
|
||||
|
||||
void HWR_InitTextureCache(void)
|
||||
{
|
||||
gr_numtextures = 0;
|
||||
gr_textures = NULL;
|
||||
gr_textures2 = NULL;
|
||||
gr_flats = NULL;
|
||||
}
|
||||
|
||||
// Callback function for HWR_FreeTextureCache.
|
||||
|
@ -776,29 +780,45 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
|||
{
|
||||
GLPatch_t* const pat = patch;
|
||||
(void)patchnum; //unused
|
||||
while (pat->mipmap && pat->mipmap->nextcolormap) // The mipmap must be valid, obviously
|
||||
|
||||
// The patch must be valid, obviously
|
||||
if (!pat)
|
||||
return;
|
||||
|
||||
// The mipmap must be valid, obviously
|
||||
while (pat->mipmap)
|
||||
{
|
||||
// Confusing at first, but pat->mipmap->nextcolormap
|
||||
// at the beginning of the loop is the first colormap
|
||||
// from the linked list of colormaps
|
||||
GLMipmap_t *next = pat->mipmap;
|
||||
if (!next) // No mipmap in this patch, break out of loop.
|
||||
// from the linked list of colormaps.
|
||||
GLMipmap_t *next = NULL;
|
||||
|
||||
// No mipmap in this patch, break out of the loop.
|
||||
if (!pat->mipmap)
|
||||
break;
|
||||
// Set the first colormap
|
||||
// to the one that comes after it
|
||||
next = next->nextcolormap;
|
||||
|
||||
// No colormap mipmap either.
|
||||
if (!pat->mipmap->nextcolormap)
|
||||
break;
|
||||
|
||||
// Set the first colormap to the one that comes after it.
|
||||
next = pat->mipmap->nextcolormap;
|
||||
pat->mipmap->nextcolormap = next->nextcolormap;
|
||||
// Free image data from memory
|
||||
|
||||
// Free image data from memory.
|
||||
if (next->grInfo.data)
|
||||
Z_Free(next->grInfo.data);
|
||||
// Free the old colormap from memory
|
||||
next->grInfo.data = NULL;
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_FreeTextureCache(void)
|
||||
void HWR_FreeMipmapCache(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// free references to the textures
|
||||
HWD.pfnClearMipMapCache();
|
||||
|
||||
|
@ -808,51 +828,46 @@ void HWR_FreeTextureCache(void)
|
|||
Z_FreeTag(PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
// Alam: free the Z_Blocks before freeing it's users
|
||||
|
||||
// free all patch colormaps after each level: must be done after ClearMipMapCache!
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
M_AATreeIterate(wadfiles[i]->hwrcache, FreeMipmapColormap);
|
||||
}
|
||||
|
||||
void HWR_FreeTextureCache(void)
|
||||
{
|
||||
// free references to the textures
|
||||
HWR_FreeMipmapCache();
|
||||
|
||||
// now the heap don't have any 'user' pointing to our
|
||||
// texturecache info, we can free it
|
||||
if (gr_textures)
|
||||
free(gr_textures);
|
||||
if (gr_textures2)
|
||||
free(gr_textures2);
|
||||
if (gr_flats)
|
||||
free(gr_flats);
|
||||
gr_textures = NULL;
|
||||
gr_textures2 = NULL;
|
||||
gr_flats = NULL;
|
||||
gr_numtextures = 0;
|
||||
}
|
||||
|
||||
void HWR_PrepLevelCache(size_t pnumtextures)
|
||||
void HWR_LoadTextures(size_t pnumtextures)
|
||||
{
|
||||
// problem: the mipmap cache management hold a list of mipmaps.. but they are
|
||||
// reallocated on each level..
|
||||
//sub-optimal, but 1) just need re-download stuff in hardware cache VERY fast
|
||||
// 2) sprite/menu stuff mixed with level textures so can't do anything else
|
||||
|
||||
// we must free it since numtextures changed
|
||||
HWR_FreeTextureCache();
|
||||
|
||||
// Why not Z_Malloc?
|
||||
gr_numtextures = pnumtextures;
|
||||
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
|
||||
if (gr_textures == NULL)
|
||||
I_Error("3D can't alloc gr_textures");
|
||||
gr_textures2 = calloc(pnumtextures, sizeof (*gr_textures2));
|
||||
if (gr_textures2 == NULL)
|
||||
I_Error("3D can't alloc gr_textures2");
|
||||
gr_textures = calloc(gr_numtextures, sizeof(*gr_textures));
|
||||
gr_flats = calloc(gr_numtextures, sizeof(*gr_flats));
|
||||
|
||||
// Doesn't tell you which it _is_, but hopefully
|
||||
// should never ever happen (right?!)
|
||||
if ((gr_textures == NULL) || (gr_flats == NULL))
|
||||
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
|
||||
}
|
||||
|
||||
void HWR_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
//Hudler: 16/10/99: added for OpenGL gamma correction
|
||||
RGBA_t gamma_correction = {0x7F7F7F7F};
|
||||
|
||||
//Hurdler 16/10/99: added for OpenGL gamma correction
|
||||
gamma_correction.s.red = (UINT8)cv_grgammared.value;
|
||||
gamma_correction.s.green = (UINT8)cv_grgammagreen.value;
|
||||
gamma_correction.s.blue = (UINT8)cv_grgammablue.value;
|
||||
HWD.pfnSetPalette(palette, &gamma_correction);
|
||||
HWD.pfnSetPalette(palette);
|
||||
|
||||
// hardware driver will flush there own cache if cache is non paletized
|
||||
// now flush data texture cache so 32 bit texture are recomputed
|
||||
|
@ -873,11 +888,16 @@ GLTexture_t *HWR_GetTexture(INT32 tex)
|
|||
if ((unsigned)tex >= gr_numtextures)
|
||||
I_Error("HWR_GetTexture: tex >= numtextures\n");
|
||||
#endif
|
||||
|
||||
// Every texture in memory, stored in the
|
||||
// hardware renderer's bit depth format. Wow!
|
||||
grtex = &gr_textures[tex];
|
||||
|
||||
// Generate texture if missing from the cache
|
||||
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded)
|
||||
HWR_GenerateTexture(tex, grtex);
|
||||
|
||||
// Tell the hardware driver to bind the current texture to the flat's mipmap
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
@ -989,13 +1009,19 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
if ((unsigned)texturenum >= gr_numtextures)
|
||||
I_Error("HWR_GetLevelFlat: texturenum >= numtextures\n");
|
||||
#endif
|
||||
|
||||
// Who knows?
|
||||
if (texturenum == 0 || texturenum == -1)
|
||||
return;
|
||||
grtex = &gr_textures2[texturenum];
|
||||
|
||||
// Every texture in memory, stored as a 8-bit flat. Wow!
|
||||
grtex = &gr_flats[texturenum];
|
||||
|
||||
// Generate flat if missing from the cache
|
||||
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded)
|
||||
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum);
|
||||
|
||||
// Tell the hardware driver to bind the current texture to the flat's mipmap
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
@ -1019,6 +1045,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
HWR_MakePatch(patch, gpatch, grmip, true);
|
||||
|
||||
// You can't free rawpatch for some reason?
|
||||
// (Obviously I can't, sprite rotation needs that...)
|
||||
if (!gpatch->rawpatch)
|
||||
Z_Free(patch);
|
||||
}
|
||||
|
@ -1046,7 +1073,6 @@ void HWR_GetPatch(GLPatch_t *gpatch)
|
|||
|
||||
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
||||
// not fragment memory, and besides the REAL cache here is the hardware memory
|
||||
// You can't free rawpatch for some reason?
|
||||
if (!gpatch->rawpatch)
|
||||
Z_Free(ptr);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ struct GLMipmap_s
|
|||
|
||||
struct GLMipmap_s *nextcolormap;
|
||||
const UINT8 *colormap;
|
||||
INT32 tcindex;
|
||||
|
||||
// opengl
|
||||
struct GLMipmap_s *nextmipmap; // opengl : liste of all texture in opengl driver
|
||||
|
|
|
@ -42,7 +42,7 @@ typedef unsigned char FBOOLEAN;
|
|||
|
||||
// byte value for paletted graphics, which represent the transparent color
|
||||
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 255
|
||||
#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
|
||||
//#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
|
||||
|
||||
// the chroma key color shows on border sprites, set it to black
|
||||
#define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen()
|
||||
|
@ -220,11 +220,10 @@ typedef struct FSurfaceInfo FSurfaceInfo;
|
|||
//Hurdler: added for backward compatibility
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
HWD_SET_FOG_TABLE = 1,
|
||||
HWD_SET_MODEL_LIGHTING = 1,
|
||||
HWD_SET_FOG_MODE,
|
||||
HWD_SET_FOG_COLOR,
|
||||
HWD_SET_FOG_DENSITY,
|
||||
HWD_SET_FOV,
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
HWD_NUMSTATE
|
||||
|
|
|
@ -39,11 +39,7 @@ EXPORT void HWRAPI(Shutdown) (void);
|
|||
#ifdef _WINDOWS
|
||||
EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes);
|
||||
#endif
|
||||
#if defined (PURESDL) || defined (macintosh)
|
||||
EXPORT void HWRAPI(SetPalette) (INT32 *, RGBA_t *gamma);
|
||||
#else
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal, RGBA_t *pgamma);
|
||||
#endif
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal);
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
|
|
|
@ -100,6 +100,7 @@ void HWR_FreePolyPool(void);
|
|||
// --------
|
||||
void HWR_InitTextureCache(void);
|
||||
void HWR_FreeTextureCache(void);
|
||||
void HWR_FreeMipmapCache(void);
|
||||
void HWR_FreeExtraSubsectors(void);
|
||||
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat);
|
||||
|
@ -127,6 +128,5 @@ extern consvar_t cv_grrounddown; // on/off
|
|||
|
||||
extern INT32 patchformat;
|
||||
extern INT32 textureformat;
|
||||
extern boolean firetranslucent;
|
||||
|
||||
#endif //_HW_GLOB_
|
||||
|
|
|
@ -85,62 +85,8 @@ static void HWR_RenderTransparentWalls(void);
|
|||
static void HWR_FoggingOn(void);
|
||||
static UINT32 atohex(const char *s);
|
||||
|
||||
static void CV_filtermode_ONChange(void);
|
||||
static void CV_anisotropic_ONChange(void);
|
||||
static void CV_FogDensity_ONChange(void);
|
||||
static void CV_grFov_OnChange(void);
|
||||
// ==========================================================================
|
||||
// 3D ENGINE COMMANDS & CONSOLE VARS
|
||||
// ==========================================================================
|
||||
|
||||
static CV_PossibleValue_t grfov_cons_t[] = {{0, "MIN"}, {179*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t grfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED, "Nearest"},
|
||||
{HWD_SET_TEXTUREFILTER_BILINEAR, "Bilinear"}, {HWD_SET_TEXTUREFILTER_TRILINEAR, "Trilinear"},
|
||||
{HWD_SET_TEXTUREFILTER_MIXED1, "Linear_Nearest"},
|
||||
{HWD_SET_TEXTUREFILTER_MIXED2, "Nearest_Linear"},
|
||||
{HWD_SET_TEXTUREFILTER_MIXED3, "Nearest_Mipmap"},
|
||||
{0, NULL}};
|
||||
CV_PossibleValue_t granisotropicmode_cons_t[] = {{1, "MIN"}, {16, "MAX"}, {0, NULL}};
|
||||
|
||||
boolean drawsky = true;
|
||||
|
||||
// needs fix: walls are incorrectly clipped one column less
|
||||
#ifndef NEWCLIP
|
||||
static consvar_t cv_grclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
//development variables for diverse uses
|
||||
static consvar_t cv_gralpha = {"gr_alpha", "160", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static consvar_t cv_grbeta = {"gr_beta", "0", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grrounddown = {"gr_rounddown", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfov = {"gr_fov", "90", CV_FLOAT|CV_CALL, grfov_cons_t, CV_grFov_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfogdensity = {"gr_fogdensity", "150", CV_CALL|CV_NOINIT, CV_Unsigned,
|
||||
CV_FogDensity_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Unfortunately, this can no longer be saved..
|
||||
consvar_t cv_grfiltermode = {"gr_filtermode", "Nearest", CV_CALL, grfiltermode_cons_t,
|
||||
CV_filtermode_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_granisotropicmode = {"gr_anisotropicmode", "1", CV_CALL, granisotropicmode_cons_t,
|
||||
CV_anisotropic_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
//static consvar_t cv_grzbuffer = {"gr_zbuffer", "On", 0, CV_OnOff};
|
||||
consvar_t cv_grcorrecttricks = {"gr_correcttricks", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void CV_FogDensity_ONChange(void)
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_FOG_DENSITY, cv_grfogdensity.value);
|
||||
}
|
||||
|
||||
static void CV_filtermode_ONChange(void)
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value);
|
||||
}
|
||||
|
||||
static void CV_anisotropic_ONChange(void)
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value);
|
||||
}
|
||||
|
||||
/*
|
||||
* lookuptable for lightvalues
|
||||
* calculated as follow:
|
||||
|
@ -2473,11 +2419,13 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
|
|||
static cliprange_t * hw_newend;
|
||||
static cliprange_t gr_solidsegs[MAXSEGS];
|
||||
|
||||
// needs fix: walls are incorrectly clipped one column less
|
||||
static consvar_t cv_grclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void printsolidsegs(void)
|
||||
{
|
||||
cliprange_t * start;
|
||||
if (!hw_newend || cv_grbeta.value != 2)
|
||||
if (!hw_newend)
|
||||
return;
|
||||
for (start = gr_solidsegs;start != hw_newend;start++)
|
||||
{
|
||||
|
@ -3431,7 +3379,7 @@ static void HWR_AddPolyObjectPlanes(void)
|
|||
{
|
||||
HWR_GetLevelFlat(&levelflats[polyobjsector->ceilingpic]);
|
||||
HWR_RenderPolyObjectPlane(po_ptrs[i], true, polyobjsector->ceilingheight, PF_Occlude,
|
||||
(light == -1 ? gr_frontsector->lightlevel : *gr_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->floorpic],
|
||||
(light == -1 ? gr_frontsector->lightlevel : *gr_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->ceilingpic],
|
||||
polyobjsector, 255, (light == -1 ? gr_frontsector->extra_colormap : *gr_frontsector->lightlist[light].extra_colormap));
|
||||
}
|
||||
}
|
||||
|
@ -5420,14 +5368,20 @@ static void HWR_DrawSprites(void)
|
|||
if (!cv_grmodels.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f)
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawModel(spr);
|
||||
{
|
||||
if (!HWR_DrawModel(spr))
|
||||
HWR_DrawSprite(spr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cv_grmodels.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawModel(spr);
|
||||
{
|
||||
if (!HWR_DrawModel(spr))
|
||||
HWR_DrawSprite(spr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5941,7 +5895,7 @@ static void HWR_DrawSkyBackground(player_t *player)
|
|||
{
|
||||
if (cv_grskydome.value)
|
||||
{
|
||||
FTransform transform;
|
||||
FTransform dometransform;
|
||||
const float fpov = FIXED_TO_FLOAT(cv_grfov.value+player->fovadd);
|
||||
postimg_t *type;
|
||||
|
||||
|
@ -5950,27 +5904,27 @@ static void HWR_DrawSkyBackground(player_t *player)
|
|||
else
|
||||
type = &postimgtype;
|
||||
|
||||
memset(&transform, 0x00, sizeof(FTransform));
|
||||
memset(&dometransform, 0x00, sizeof(FTransform));
|
||||
|
||||
//04/01/2000: Hurdler: added for T&L
|
||||
// It should replace all other gr_viewxxx when finished
|
||||
transform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
transform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
dometransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
|
||||
if (*type == postimg_flip)
|
||||
transform.flip = true;
|
||||
dometransform.flip = true;
|
||||
else
|
||||
transform.flip = false;
|
||||
dometransform.flip = false;
|
||||
|
||||
transform.scalex = 1;
|
||||
transform.scaley = (float)vid.width/vid.height;
|
||||
transform.scalez = 1;
|
||||
transform.fovxangle = fpov; // Tails
|
||||
transform.fovyangle = fpov; // Tails
|
||||
transform.splitscreen = splitscreen;
|
||||
dometransform.scalex = 1;
|
||||
dometransform.scaley = (float)vid.width/vid.height;
|
||||
dometransform.scalez = 1;
|
||||
dometransform.fovxangle = fpov; // Tails
|
||||
dometransform.fovyangle = fpov; // Tails
|
||||
dometransform.splitscreen = splitscreen;
|
||||
|
||||
HWR_GetTexture(texturetranslation[skytexture]);
|
||||
HWD.pfnRenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, transform);
|
||||
HWD.pfnRenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, dometransform);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6172,6 +6126,8 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
|
|||
|
||||
//04/01/2000: Hurdler: added for T&L
|
||||
// It should replace all other gr_viewxxx when finished
|
||||
memset(&atransform, 0x00, sizeof(FTransform));
|
||||
|
||||
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
|
||||
|
@ -6390,6 +6346,8 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
|||
|
||||
//04/01/2000: Hurdler: added for T&L
|
||||
// It should replace all other gr_viewxxx when finished
|
||||
memset(&atransform, 0x00, sizeof(FTransform));
|
||||
|
||||
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
|
||||
|
@ -6584,59 +6542,125 @@ static void HWR_FoggingOn(void)
|
|||
// 3D ENGINE COMMANDS
|
||||
// ==========================================================================
|
||||
|
||||
static CV_PossibleValue_t grsoftwarefog_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "LightPlanes"}, {0, NULL}};
|
||||
static CV_PossibleValue_t grmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Sometimes"}, {2, "Always"}, {0, NULL}};
|
||||
|
||||
static void CV_grFov_OnChange(void)
|
||||
static void CV_grmodellighting_OnChange(void);
|
||||
static void CV_grfiltermode_OnChange(void);
|
||||
static void CV_granisotropic_OnChange(void);
|
||||
static void CV_grfogdensity_OnChange(void);
|
||||
static void CV_grfov_OnChange(void);
|
||||
|
||||
static CV_PossibleValue_t grfov_cons_t[] = {{0, "MIN"}, {179*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t grfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED, "Nearest"},
|
||||
{HWD_SET_TEXTUREFILTER_BILINEAR, "Bilinear"}, {HWD_SET_TEXTUREFILTER_TRILINEAR, "Trilinear"},
|
||||
{HWD_SET_TEXTUREFILTER_MIXED1, "Linear_Nearest"},
|
||||
{HWD_SET_TEXTUREFILTER_MIXED2, "Nearest_Linear"},
|
||||
{HWD_SET_TEXTUREFILTER_MIXED3, "Nearest_Mipmap"},
|
||||
{0, NULL}};
|
||||
CV_PossibleValue_t granisotropicmode_cons_t[] = {{1, "MIN"}, {16, "MAX"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_grfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfog = {"gr_fog", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfogcolor = {"gr_fogcolor", "AAAAAA", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grsoftwarefog = {"gr_softwarefog", "Off", CV_SAVE, grsoftwarefog_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#ifdef ALAM_LIGHTING
|
||||
consvar_t cv_grdynamiclighting = {"gr_dynamiclighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grstaticlighting = {"gr_staticlighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grcoronas = {"gr_coronas", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grcoronasize = {"gr_coronasize", "1", CV_SAVE|CV_FLOAT, 0, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
consvar_t cv_grmodels = {"gr_models", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grmodelinterpolation = {"gr_modelinterpolation", "Sometimes", CV_SAVE, grmodelinterpolation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grmodellighting = {"gr_modellighting", "Off", CV_SAVE|CV_CALL, CV_OnOff, CV_grmodellighting_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grskydome = {"gr_skydome", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grrounddown = {"gr_rounddown", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfov = {"gr_fov", "90", CV_FLOAT|CV_CALL, grfov_cons_t, CV_grfov_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfogdensity = {"gr_fogdensity", "150", CV_CALL|CV_NOINIT, CV_Unsigned,
|
||||
CV_grfogdensity_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grfiltermode = {"gr_filtermode", "Nearest", CV_SAVE|CV_CALL, grfiltermode_cons_t,
|
||||
CV_grfiltermode_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_granisotropicmode = {"gr_anisotropicmode", "1", CV_CALL, granisotropicmode_cons_t,
|
||||
CV_granisotropic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grcorrecttricks = {"gr_correcttricks", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void CV_grmodellighting_OnChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, cv_grmodellighting.value);
|
||||
}
|
||||
|
||||
static void CV_grfogdensity_OnChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnSetSpecialState(HWD_SET_FOG_DENSITY, cv_grfogdensity.value);
|
||||
}
|
||||
|
||||
static void CV_grfiltermode_OnChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value);
|
||||
}
|
||||
|
||||
static void CV_granisotropic_OnChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value);
|
||||
}
|
||||
|
||||
static void CV_grfov_OnChange(void)
|
||||
{
|
||||
if ((netgame || multiplayer) && !cv_debug && cv_grfov.value != 90*FRACUNIT)
|
||||
CV_Set(&cv_grfov, cv_grfov.defaultvalue);
|
||||
}
|
||||
|
||||
static void Command_GrStats_f(void)
|
||||
{
|
||||
Z_CheckHeap(9875); // debug
|
||||
|
||||
CONS_Printf(M_GetText("Patch info headers: %7s kb\n"), sizeu1(Z_TagUsage(PU_HWRPATCHINFO)>>10));
|
||||
CONS_Printf(M_GetText("3D Texture cache : %7s kb\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
|
||||
CONS_Printf(M_GetText("Plane polygon : %7s kb\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
|
||||
}
|
||||
|
||||
|
||||
// **************************************************************************
|
||||
// 3D ENGINE SETUP
|
||||
// **************************************************************************
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Add hardware engine commands & consvars
|
||||
// --------------------------------------------------------------------------
|
||||
//added by Hurdler: console varibale that are saved
|
||||
void HWR_AddCommands(void)
|
||||
{
|
||||
CV_RegisterVar(&cv_grrounddown);
|
||||
CV_RegisterVar(&cv_grfovchange);
|
||||
CV_RegisterVar(&cv_grfov);
|
||||
|
||||
CV_RegisterVar(&cv_grfogdensity);
|
||||
CV_RegisterVar(&cv_grfogcolor);
|
||||
CV_RegisterVar(&cv_grfog);
|
||||
CV_RegisterVar(&cv_grsoftwarefog);
|
||||
|
||||
#ifdef ALAM_LIGHTING
|
||||
CV_RegisterVar(&cv_grstaticlighting);
|
||||
CV_RegisterVar(&cv_grdynamiclighting);
|
||||
CV_RegisterVar(&cv_grcoronasize);
|
||||
CV_RegisterVar(&cv_grcoronas);
|
||||
#endif
|
||||
|
||||
CV_RegisterVar(&cv_grmodellighting);
|
||||
CV_RegisterVar(&cv_grmodelinterpolation);
|
||||
CV_RegisterVar(&cv_grmodels);
|
||||
|
||||
CV_RegisterVar(&cv_grskydome);
|
||||
CV_RegisterVar(&cv_grspritebillboarding);
|
||||
|
||||
CV_RegisterVar(&cv_grfiltermode);
|
||||
CV_RegisterVar(&cv_granisotropicmode);
|
||||
CV_RegisterVar(&cv_grrounddown);
|
||||
CV_RegisterVar(&cv_grcorrecttricks);
|
||||
CV_RegisterVar(&cv_grsolvetjoin);
|
||||
}
|
||||
|
||||
static inline void HWR_AddEngineCommands(void)
|
||||
{
|
||||
// engine state variables
|
||||
//CV_RegisterVar(&cv_grzbuffer);
|
||||
#ifndef NEWCLIP
|
||||
CV_RegisterVar(&cv_grclipwalls);
|
||||
#endif
|
||||
|
||||
// engine development mode variables
|
||||
// - usage may vary from version to version..
|
||||
CV_RegisterVar(&cv_gralpha);
|
||||
CV_RegisterVar(&cv_grbeta);
|
||||
|
||||
// engine commands
|
||||
COM_AddCommand("gr_stats", Command_GrStats_f);
|
||||
}
|
||||
|
||||
void HWR_AddSessionCommands(void)
|
||||
{
|
||||
CV_RegisterVar(&cv_granisotropicmode);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Setup the hardware renderer
|
||||
|
@ -6657,12 +6681,9 @@ void HWR_Startup(void)
|
|||
{
|
||||
CONS_Printf("HWR_Startup()...\n");
|
||||
HWR_InitPolyPool();
|
||||
// add console cmds & vars
|
||||
HWR_AddEngineCommands();
|
||||
HWR_AddSessionCommands();
|
||||
HWR_InitTextureCache();
|
||||
|
||||
HWR_InitModels();
|
||||
|
||||
#ifdef ALAM_LIGHTING
|
||||
HWR_InitLight();
|
||||
#endif
|
||||
|
@ -6683,6 +6704,7 @@ void HWR_Shutdown(void)
|
|||
CONS_Printf("HWR_Shutdown()\n");
|
||||
HWR_FreeExtraSubsectors();
|
||||
HWR_FreePolyPool();
|
||||
HWR_FreeMipmapCache();
|
||||
HWR_FreeTextureCache();
|
||||
HWD.pfnFlushScreenTextures();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale
|
|||
void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
|
||||
void HWR_CreatePlanePolygons(INT32 bspnum);
|
||||
void HWR_CreateStaticLightmaps(INT32 bspnum);
|
||||
void HWR_PrepLevelCache(size_t pnumtextures);
|
||||
void HWR_LoadTextures(size_t pnumtextures);
|
||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
||||
void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 actualcolor, UINT8 strength);
|
||||
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 actualcolor); // Lat: separate flags from color since color needs to be an uint to work right.
|
||||
|
@ -57,6 +57,7 @@ UINT8 *HWR_GetScreenshot(void);
|
|||
boolean HWR_Screenshot(const char *pathname);
|
||||
|
||||
void HWR_AddCommands(void);
|
||||
void HWR_AddSessionCommands(void);
|
||||
void HWR_CorrectSWTricks(void);
|
||||
void transform(float *cx, float *cy, float *cz);
|
||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
|
@ -85,13 +86,11 @@ extern consvar_t cv_grcoronasize;
|
|||
extern consvar_t cv_grfov;
|
||||
extern consvar_t cv_grmodels;
|
||||
extern consvar_t cv_grmodelinterpolation;
|
||||
extern consvar_t cv_grmodellighting;
|
||||
extern consvar_t cv_grfog;
|
||||
extern consvar_t cv_grfogcolor;
|
||||
extern consvar_t cv_grfogdensity;
|
||||
extern consvar_t cv_grsoftwarefog;
|
||||
extern consvar_t cv_grgammared;
|
||||
extern consvar_t cv_grgammagreen;
|
||||
extern consvar_t cv_grgammablue;
|
||||
extern consvar_t cv_grfiltermode;
|
||||
extern consvar_t cv_granisotropicmode;
|
||||
extern consvar_t cv_grcorrecttricks;
|
||||
|
|
|
@ -239,7 +239,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
|||
|
||||
{
|
||||
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->grInfo.data);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRMODELTEXTURE, &grpatch->mipmap->grInfo.data);
|
||||
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
|
||||
for (i = 0; i < height; i++)
|
||||
row_pointers[i] = PNG_image + i*pitch;
|
||||
|
@ -313,7 +313,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
|||
|
||||
pw = *w = header.xmax - header.xmin + 1;
|
||||
ph = *h = header.ymax - header.ymin + 1;
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->grInfo.data);
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &grpatch->mipmap->grInfo.data);
|
||||
|
||||
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
|
||||
{
|
||||
|
@ -373,6 +373,9 @@ static void md2_loadTexture(md2_t *model)
|
|||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
UINT32 size;
|
||||
RGBA_t *image;
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
|
@ -389,6 +392,15 @@ static void md2_loadTexture(md2_t *model)
|
|||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
|
||||
// Lactozilla: Apply colour cube
|
||||
image = grpatch->mipmap->grInfo.data;
|
||||
size = w*h;
|
||||
while (size--)
|
||||
{
|
||||
V_CubeApply(&image->s.red, &image->s.green, &image->s.blue);
|
||||
image++;
|
||||
}
|
||||
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// not correct!
|
||||
grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
|
@ -397,7 +409,6 @@ static void md2_loadTexture(md2_t *model)
|
|||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
@ -453,7 +464,6 @@ static void md2_loadBlendTexture(md2_t *model)
|
|||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
|
||||
Z_Free(filename);
|
||||
}
|
||||
|
@ -637,18 +647,20 @@ spritemd2found:
|
|||
// 0.7152 to green
|
||||
// 0.0722 to blue
|
||||
#define SETBRIGHTNESS(brightness,r,g,b) \
|
||||
brightness = (UINT8)(((1063*((UINT16)r)/5000) + (3576*((UINT16)g)/5000) + (361*((UINT16)b)/5000)) / 3)
|
||||
brightness = (UINT8)(((1063*(UINT16)(r))/5000) + ((3576*(UINT16)(g))/5000) + ((361*(UINT16)(b))/5000))
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
|
||||
{
|
||||
UINT8 i;
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||
|
||||
// vanilla port
|
||||
UINT8 translation[16];
|
||||
memset(translation, 0, sizeof(translation));
|
||||
|
||||
if (grmip->width == 0)
|
||||
{
|
||||
|
||||
grmip->width = gpatch->width;
|
||||
grmip->height = gpatch->height;
|
||||
|
||||
|
@ -658,46 +670,58 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
grmip->grInfo.format = GR_RGBA;
|
||||
}
|
||||
|
||||
if (grmip->grInfo.data)
|
||||
{
|
||||
Z_Free(grmip->grInfo.data);
|
||||
grmip->grInfo.data = NULL;
|
||||
}
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data);
|
||||
cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &grmip->grInfo.data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap->grInfo.data;
|
||||
blendimage = blendgpatch->mipmap->grInfo.data;
|
||||
blendcolor = V_GetColor(0); // initialize
|
||||
|
||||
// Average all of the translation's colors
|
||||
if (color == SKINCOLOR_NONE || color >= MAXTRANSLATIONS)
|
||||
blendcolor = V_GetColor(0xff);
|
||||
if (color != SKINCOLOR_NONE)
|
||||
memcpy(&translation, &Color_Index[color - 1], 16);
|
||||
|
||||
while (size--)
|
||||
{
|
||||
if (skinnum == TC_BOSS)
|
||||
{
|
||||
// Turn everything below a certain threshold white
|
||||
if ((image->s.red == image->s.green) && (image->s.green == image->s.blue) && image->s.blue <= 82)
|
||||
{
|
||||
// Lactozilla: Invert the colors
|
||||
cur->s.red = cur->s.green = cur->s.blue = (255 - image->s.blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
const UINT8 div = 6;
|
||||
const UINT8 start = 4;
|
||||
UINT32 r, g, b;
|
||||
|
||||
blendcolor = V_GetColor(Color_Index[color-1][start]);
|
||||
r = (UINT32)(blendcolor.s.red*blendcolor.s.red);
|
||||
g = (UINT32)(blendcolor.s.green*blendcolor.s.green);
|
||||
b = (UINT32)(blendcolor.s.blue*blendcolor.s.blue);
|
||||
|
||||
for (i = 1; i < div; i++)
|
||||
{
|
||||
RGBA_t nextcolor = V_GetColor(Color_Index[color-1][start+i]);
|
||||
r += (UINT32)(nextcolor.s.red*nextcolor.s.red);
|
||||
g += (UINT32)(nextcolor.s.green*nextcolor.s.green);
|
||||
b += (UINT32)(nextcolor.s.blue*nextcolor.s.blue);
|
||||
cur->s.red = image->s.red;
|
||||
cur->s.green = image->s.green;
|
||||
cur->s.blue = image->s.blue;
|
||||
}
|
||||
|
||||
blendcolor.s.red = (UINT8)(FixedSqrt((r/div)<<FRACBITS)>>FRACBITS);
|
||||
blendcolor.s.green = (UINT8)(FixedSqrt((g/div)<<FRACBITS)>>FRACBITS);
|
||||
blendcolor.s.blue = (UINT8)(FixedSqrt((b/div)<<FRACBITS)>>FRACBITS);
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
else if (skinnum == TC_METALSONIC)
|
||||
{
|
||||
// Turn everything below a certain blue threshold white
|
||||
if (image->s.red == 0 && image->s.green == 0 && image->s.blue <= 82)
|
||||
{
|
||||
cur->s.red = cur->s.green = cur->s.blue = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur->s.red = image->s.red;
|
||||
cur->s.green = image->s.green;
|
||||
cur->s.blue = image->s.blue;
|
||||
}
|
||||
|
||||
// rainbow support, could theoretically support boss ones too
|
||||
if (skinnum == TC_RAINBOW)
|
||||
{
|
||||
while (size--)
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
else if (skinnum == TC_DASHMODE)
|
||||
{
|
||||
if (image->s.alpha == 0 && blendimage->s.alpha == 0)
|
||||
{
|
||||
|
@ -706,66 +730,216 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
}
|
||||
else
|
||||
{
|
||||
UINT32 tempcolor;
|
||||
UINT16 imagebright, blendbright, finalbright, colorbright;
|
||||
UINT8 ialpha = 255 - blendimage->s.alpha, balpha = blendimage->s.alpha;
|
||||
RGBA_t icolor = *image, bcolor;
|
||||
|
||||
memset(&bcolor, 0x00, sizeof(RGBA_t));
|
||||
|
||||
if (blendimage->s.alpha)
|
||||
{
|
||||
bcolor.s.blue = 0;
|
||||
bcolor.s.red = 255;
|
||||
bcolor.s.green = (blendimage->s.red + blendimage->s.green + blendimage->s.blue) / 3;
|
||||
}
|
||||
if (image->s.alpha && image->s.red > image->s.green << 1) // this is pretty arbitrary, but it works well for Metal Sonic
|
||||
{
|
||||
icolor.s.red = image->s.blue;
|
||||
icolor.s.blue = image->s.red;
|
||||
}
|
||||
cur->s.red = (ialpha * icolor.s.red + balpha * bcolor.s.red)/255;
|
||||
cur->s.green = (ialpha * icolor.s.green + balpha * bcolor.s.green)/255;
|
||||
cur->s.blue = (ialpha * icolor.s.blue + balpha * bcolor.s.blue)/255;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
}
|
||||
else if (skinnum == TC_ALLWHITE)
|
||||
{
|
||||
// Turn everything white
|
||||
cur->s.red = cur->s.green = cur->s.blue = 255;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT16 brightness;
|
||||
|
||||
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
|
||||
if (skinnum == TC_RAINBOW)
|
||||
{
|
||||
if (image->s.alpha == 0 && blendimage->s.alpha == 0)
|
||||
{
|
||||
cur->rgba = image->rgba;
|
||||
cur++; image++; blendimage++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT16 imagebright, blendbright;
|
||||
SETBRIGHTNESS(imagebright,image->s.red,image->s.green,image->s.blue);
|
||||
SETBRIGHTNESS(blendbright,blendimage->s.red,blendimage->s.green,blendimage->s.blue);
|
||||
// slightly dumb average between the blend image color and base image colour, usually one or the other will be fully opaque anyway
|
||||
finalbright = (imagebright*(255-blendimage->s.alpha))/255 + (blendbright*blendimage->s.alpha)/255;
|
||||
SETBRIGHTNESS(colorbright,blendcolor.s.red,blendcolor.s.green,blendcolor.s.blue);
|
||||
|
||||
tempcolor = (finalbright*blendcolor.s.red)/colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.red = (UINT8)tempcolor;
|
||||
tempcolor = (finalbright*blendcolor.s.green)/colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.green = (UINT8)tempcolor;
|
||||
tempcolor = (finalbright*blendcolor.s.blue)/colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.blue = (UINT8)tempcolor;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
|
||||
cur++; image++; blendimage++;
|
||||
brightness = (imagebright*(255-blendimage->s.alpha))/255 + (blendbright*blendimage->s.alpha)/255;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (size--)
|
||||
{
|
||||
if (blendimage->s.alpha == 0)
|
||||
{
|
||||
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
|
||||
cur->rgba = image->rgba;
|
||||
cur++; image++; blendimage++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 tempcolor;
|
||||
INT16 tempmult, tempalpha;
|
||||
tempalpha = -(abs(blendimage->s.red-127)-127)*2;
|
||||
if (tempalpha > 255)
|
||||
tempalpha = 255;
|
||||
else if (tempalpha < 0)
|
||||
tempalpha = 0;
|
||||
SETBRIGHTNESS(brightness,blendimage->s.red,blendimage->s.green,blendimage->s.blue);
|
||||
}
|
||||
}
|
||||
|
||||
tempmult = (blendimage->s.red-127)*2;
|
||||
if (tempmult > 255)
|
||||
tempmult = 255;
|
||||
else if (tempmult < 0)
|
||||
tempmult = 0;
|
||||
// Calculate a sort of "gradient" for the skincolor
|
||||
// (Me splitting this into a function didn't work, so I had to ruin this entire function's groove...)
|
||||
{
|
||||
RGBA_t nextcolor;
|
||||
UINT8 firsti, secondi, mul;
|
||||
UINT32 r, g, b;
|
||||
|
||||
tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255;
|
||||
// Rainbow needs to find the closest match to the textures themselves, instead of matching brightnesses to other colors.
|
||||
// Ensue horrible mess.
|
||||
if (skinnum == TC_RAINBOW)
|
||||
{
|
||||
UINT16 brightdif = 256;
|
||||
UINT8 colorbrightnesses[16];
|
||||
INT32 compare, m, d;
|
||||
UINT8 i;
|
||||
|
||||
// Ignore pure white & pitch black
|
||||
if (brightness > 253 || brightness < 2)
|
||||
{
|
||||
cur->rgba = image->rgba;
|
||||
cur++; image++; blendimage++;
|
||||
continue;
|
||||
}
|
||||
|
||||
firsti = 0;
|
||||
mul = 0;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
RGBA_t tempc = V_GetColor(translation[i]);
|
||||
SETBRIGHTNESS(colorbrightnesses[i], tempc.s.red, tempc.s.green, tempc.s.blue); // store brightnesses for comparison
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
if (brightness > colorbrightnesses[i]) // don't allow greater matches (because calculating a makeshift gradient for this is already a huge mess as is)
|
||||
continue;
|
||||
compare = abs((INT16)(colorbrightnesses[i]) - (INT16)(brightness));
|
||||
if (compare < brightdif)
|
||||
{
|
||||
brightdif = (UINT16)compare;
|
||||
firsti = i; // best matching color that's equal brightness or darker
|
||||
}
|
||||
}
|
||||
|
||||
secondi = firsti+1; // next color in line
|
||||
if (secondi == 16)
|
||||
{
|
||||
m = (INT16)brightness; // - 0;
|
||||
d = (INT16)colorbrightnesses[firsti]; // - 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m = (INT16)brightness - (INT16)colorbrightnesses[secondi];
|
||||
d = (INT16)colorbrightnesses[firsti] - (INT16)colorbrightnesses[secondi];
|
||||
}
|
||||
|
||||
if (m >= d)
|
||||
m = d-1;
|
||||
|
||||
// calculate the "gradient" multiplier based on how close this color is to the one next in line
|
||||
if (m <= 0 || d <= 0)
|
||||
mul = 0;
|
||||
else
|
||||
mul = 15 - ((m * 16) / d);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Thankfully, it's normally way more simple.
|
||||
// Just convert brightness to a skincolor value, use remainder to find the gradient multipler
|
||||
firsti = ((UINT8)(255-brightness) / 16);
|
||||
secondi = firsti+1;
|
||||
mul = ((UINT8)(255-brightness) % 16);
|
||||
}
|
||||
|
||||
blendcolor = V_GetColor(translation[firsti]);
|
||||
|
||||
if (mul > 0 // If it's 0, then we only need the first color.
|
||||
&& translation[firsti] != translation[secondi]) // Some colors have duplicate colors in a row, so let's just save the process
|
||||
{
|
||||
if (secondi == 16) // blend to black
|
||||
nextcolor = V_GetColor(31);
|
||||
else
|
||||
nextcolor = V_GetColor(translation[secondi]);
|
||||
|
||||
// Find difference between points
|
||||
r = (UINT32)(nextcolor.s.red - blendcolor.s.red);
|
||||
g = (UINT32)(nextcolor.s.green - blendcolor.s.green);
|
||||
b = (UINT32)(nextcolor.s.blue - blendcolor.s.blue);
|
||||
|
||||
// Find the gradient of the two points
|
||||
r = ((mul * r) / 16);
|
||||
g = ((mul * g) / 16);
|
||||
b = ((mul * b) / 16);
|
||||
|
||||
// Add gradient value to color
|
||||
blendcolor.s.red += r;
|
||||
blendcolor.s.green += g;
|
||||
blendcolor.s.blue += b;
|
||||
}
|
||||
}
|
||||
|
||||
if (skinnum == TC_RAINBOW)
|
||||
{
|
||||
UINT32 tempcolor;
|
||||
UINT16 colorbright;
|
||||
|
||||
SETBRIGHTNESS(colorbright,blendcolor.s.red,blendcolor.s.green,blendcolor.s.blue);
|
||||
if (colorbright == 0)
|
||||
colorbright = 1; // no dividing by 0 please
|
||||
|
||||
tempcolor = (brightness * blendcolor.s.red) / colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.red = (UINT8)tempcolor;
|
||||
tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255;
|
||||
|
||||
tempcolor = (brightness * blendcolor.s.green) / colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.green = (UINT8)tempcolor;
|
||||
tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255;
|
||||
|
||||
tempcolor = (brightness * blendcolor.s.blue) / colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.blue = (UINT8)tempcolor;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Color strength depends on image alpha
|
||||
INT32 tempcolor;
|
||||
|
||||
tempcolor = ((image->s.red * (255-blendimage->s.alpha)) / 255) + ((blendcolor.s.red * blendimage->s.alpha) / 255);
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.red = (UINT8)tempcolor;
|
||||
|
||||
tempcolor = ((image->s.green * (255-blendimage->s.alpha)) / 255) + ((blendcolor.s.green * blendimage->s.alpha) / 255);
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.green = (UINT8)tempcolor;
|
||||
|
||||
tempcolor = ((image->s.blue * (255-blendimage->s.alpha)) / 255) + ((blendcolor.s.blue * blendimage->s.alpha) / 255);
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.blue = (UINT8)tempcolor;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
}
|
||||
|
||||
cur++; image++; blendimage++;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -777,24 +951,24 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
|||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
if ((colormap == colormaps || colormap == NULL) && (skinnum > TC_DEFAULT))
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
if (grmip->colormap == colormap || grmip->tcindex == skinnum)
|
||||
{
|
||||
if (grmip->downloaded && grmip->grInfo.data)
|
||||
{
|
||||
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRMODELTEXTURE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -812,16 +986,27 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
|||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
grmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
newmip->tcindex = skinnum;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(newmip->grInfo.data, PU_HWRMODELTEXTURE);
|
||||
}
|
||||
|
||||
#define NORMALFOG 0x00000000
|
||||
#define FADEFOG 0x19000000
|
||||
|
||||
static boolean HWR_AllowModel(mobj_t *mobj)
|
||||
{
|
||||
// Signpost overlay. Not needed.
|
||||
if (mobj->state-states == S_PLAY_SIGN)
|
||||
return false;
|
||||
|
||||
// Otherwise, render the model.
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean HWR_CanInterpolateModel(mobj_t *mobj, model_t *model)
|
||||
{
|
||||
if (cv_grmodelinterpolation.value == 2) // Always interpolate
|
||||
|
@ -897,7 +1082,7 @@ static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t
|
|||
// HWR_DrawModel
|
||||
//
|
||||
|
||||
void HWR_DrawModel(gr_vissprite_t *spr)
|
||||
boolean HWR_DrawModel(gr_vissprite_t *spr)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
|
@ -910,10 +1095,12 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
UINT8 color[4];
|
||||
|
||||
if (!cv_grmodels.value)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (spr->precip)
|
||||
return;
|
||||
return false;
|
||||
|
||||
memset(&p, 0x00, sizeof(FTransform));
|
||||
|
||||
// MD2 colormap fix
|
||||
// colormap test
|
||||
|
@ -1001,7 +1188,7 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
}
|
||||
|
||||
if (md2->error)
|
||||
return; // we already failed loading this before :(
|
||||
return false; // we already failed loading this before :(
|
||||
if (!md2->model)
|
||||
{
|
||||
//CONS_Debug(DBG_RENDER, "Loading model... (%s)", sprnames[spr->mobj->sprite]);
|
||||
|
@ -1017,9 +1204,14 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
{
|
||||
//CONS_Debug(DBG_RENDER, " FAILED\n");
|
||||
md2->error = true; // prevent endless fail
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Lactozilla: Disallow certain models from rendering
|
||||
if (!HWR_AllowModel(spr->mobj))
|
||||
return false;
|
||||
|
||||
//HWD.pfnSetBlend(blend); // This seems to actually break translucency?
|
||||
finalscale = md2->scale;
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
|
@ -1034,11 +1226,10 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
|
||||
if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
{
|
||||
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
|
||||
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format
|
||||
if (md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format
|
||||
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
|
||||
{
|
||||
INT32 skinnum = TC_DEFAULT;
|
||||
INT32 skinnum = INT32_MAX;
|
||||
if ((spr->mobj->flags & (MF_ENEMY|MF_BOSS)) && (spr->mobj->flags2 & MF2_FRET) && !(spr->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash"
|
||||
{
|
||||
if (spr->mobj->type == MT_CYBRAKDEMON || spr->mobj->colorized)
|
||||
|
@ -1048,7 +1239,7 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
else
|
||||
skinnum = TC_BOSS;
|
||||
}
|
||||
else if (spr->mobj->color)
|
||||
else if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE)
|
||||
{
|
||||
if (spr->mobj->colorized)
|
||||
skinnum = TC_RAINBOW;
|
||||
|
@ -1066,7 +1257,15 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
else
|
||||
skinnum = TC_DEFAULT;
|
||||
}
|
||||
|
||||
// Translation or skin number found
|
||||
if (skinnum != INT32_MAX)
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
else
|
||||
{
|
||||
// Sorry nothing
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1244,6 +1443,8 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, color);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
|
|
|
@ -45,8 +45,8 @@ extern md2_t md2_models[NUMSPRITES];
|
|||
extern md2_t md2_playermodels[MAXSKINS];
|
||||
|
||||
void HWR_InitModels(void);
|
||||
void HWR_DrawModel(gr_vissprite_t *spr);
|
||||
void HWR_AddPlayerModel(INT32 skin);
|
||||
void HWR_AddSpriteModel(size_t spritenum);
|
||||
boolean HWR_DrawModel(gr_vissprite_t *spr);
|
||||
|
||||
#endif // _HW_MD2_H_
|
||||
|
|
|
@ -564,20 +564,15 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
|||
// : in OpenGL, we store values for conversion of paletted graphics when
|
||||
// : they are downloaded to the 3D card.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal, RGBA_t *gamma)
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = (UINT8)MIN((pal[i].s.red*gamma->s.red)/127, 255);
|
||||
myPaletteData[i].s.green = (UINT8)MIN((pal[i].s.green*gamma->s.green)/127, 255);
|
||||
myPaletteData[i].s.blue = (UINT8)MIN((pal[i].s.blue*gamma->s.blue)/127, 255);
|
||||
myPaletteData[i].s.alpha = pal[i].s.alpha;
|
||||
}
|
||||
|
||||
size_t palsize = (sizeof(RGBA_t) * 256);
|
||||
// on a palette change, you have to reload all of the textures
|
||||
if (memcmp(&myPaletteData, pal, palsize))
|
||||
{
|
||||
memcpy(&myPaletteData, pal, palsize);
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -85,7 +85,7 @@ static GLboolean MipMap = GL_FALSE;
|
|||
static GLint min_filter = GL_LINEAR;
|
||||
static GLint mag_filter = GL_LINEAR;
|
||||
static GLint anisotropic_filter = 0;
|
||||
static FTransform md2_transform;
|
||||
static boolean model_lighting = true;
|
||||
|
||||
const GLubyte *gl_extensions = NULL;
|
||||
|
||||
|
@ -723,8 +723,8 @@ void Flush(void)
|
|||
|
||||
while (gr_cachehead)
|
||||
{
|
||||
// ceci n'est pas du tout necessaire vu que tu les a charger normalement et
|
||||
// donc il sont dans ta liste !
|
||||
// this is not necessary at all, because you have loaded them normally,
|
||||
// and so they already are in your list!
|
||||
#if 0
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
FTextureInfo *tmp = gr_cachehead->nextskin;
|
||||
|
@ -1296,11 +1296,11 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
|
|||
|
||||
pTexInfo->nextmipmap = NULL;
|
||||
if (gr_cachetail)
|
||||
{ // insertion en fin de liste
|
||||
{ // insertion at the tail
|
||||
gr_cachetail->nextmipmap = pTexInfo;
|
||||
gr_cachetail = pTexInfo;
|
||||
}
|
||||
else // initialisation de la liste
|
||||
else // initialization of the linked list
|
||||
gr_cachetail = gr_cachehead = pTexInfo;
|
||||
}
|
||||
}
|
||||
|
@ -1659,16 +1659,9 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
|||
{
|
||||
switch (IdState)
|
||||
{
|
||||
|
||||
#if 0
|
||||
case 77:
|
||||
{
|
||||
//08/01/00: Hurdler this is a test for mirror
|
||||
if (!Value)
|
||||
ClearBuffer(false, true, 0); // clear depth buffer
|
||||
case HWD_SET_MODEL_LIGHTING:
|
||||
model_lighting = Value;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case HWD_SET_FOG_COLOR:
|
||||
{
|
||||
|
@ -1681,6 +1674,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
|||
pglFogfv(GL_FOG_COLOR, fogcolor);
|
||||
break;
|
||||
}
|
||||
|
||||
case HWD_SET_FOG_DENSITY:
|
||||
pglFogf(GL_FOG_DENSITY, Value*1200/(500*1000000.0f));
|
||||
break;
|
||||
|
@ -2045,16 +2039,25 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
}
|
||||
#endif
|
||||
|
||||
if (model_lighting)
|
||||
{
|
||||
pglLightfv(GL_LIGHT0, GL_POSITION, LightPos);
|
||||
|
||||
pglShadeModel(GL_SMOOTH);
|
||||
}
|
||||
|
||||
if (color)
|
||||
{
|
||||
#ifdef GL_LIGHT_MODEL_AMBIENT
|
||||
if (model_lighting)
|
||||
{
|
||||
pglEnable(GL_LIGHTING);
|
||||
pglMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient);
|
||||
pglMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
pglColor4ubv((GLubyte*)color);
|
||||
|
||||
if (color[3] < 255)
|
||||
SetBlend(PF_Translucent|PF_Modulated|PF_Clip);
|
||||
else
|
||||
|
@ -2225,8 +2228,6 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
|||
if (stransform)
|
||||
{
|
||||
boolean fovx90;
|
||||
// keep a trace of the transformation for md2
|
||||
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
||||
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
// mirroring from Kart
|
||||
|
|
35
src/i_tcp.c
35
src/i_tcp.c
|
@ -209,7 +209,8 @@ static size_t numbans = 0;
|
|||
static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
|
||||
static boolean init_tcp_driver = false;
|
||||
|
||||
static char port_name[8] = DEFAULTPORT;
|
||||
static const char *serverport_name = DEFAULTPORT;
|
||||
static const char *clientport_name;/* any port */
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
|
@ -887,6 +888,7 @@ static boolean UDP_Socket(void)
|
|||
#ifdef HAVE_IPV6
|
||||
const INT32 b_ipv6 = M_CheckParm("-ipv6");
|
||||
#endif
|
||||
const char *serv;
|
||||
|
||||
|
||||
for (s = 0; s < mysocketses; s++)
|
||||
|
@ -902,11 +904,16 @@ static boolean UDP_Socket(void)
|
|||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_protocol = IPPROTO_UDP;
|
||||
|
||||
if (serverrunning)
|
||||
serv = serverport_name;
|
||||
else
|
||||
serv = clientport_name;
|
||||
|
||||
if (M_CheckParm("-bindaddr"))
|
||||
{
|
||||
while (M_IsNextParm())
|
||||
{
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -927,7 +934,7 @@ static boolean UDP_Socket(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
gaie = I_getaddrinfo("0.0.0.0", port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -942,8 +949,8 @@ static boolean UDP_Socket(void)
|
|||
#ifdef HAVE_MINIUPNPC
|
||||
if (UPNP_support)
|
||||
{
|
||||
I_UPnP_rem(port_name, "UDP");
|
||||
I_UPnP_add(NULL, port_name, "UDP");
|
||||
I_UPnP_rem(serverport_name, "UDP");
|
||||
I_UPnP_add(NULL, serverport_name, "UDP");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -960,7 +967,7 @@ static boolean UDP_Socket(void)
|
|||
{
|
||||
while (M_IsNextParm())
|
||||
{
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -981,7 +988,7 @@ static boolean UDP_Socket(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
gaie = I_getaddrinfo("::", port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo("::", serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -1421,15 +1428,19 @@ boolean I_InitTcpNetwork(void)
|
|||
if (!I_InitTcpDriver())
|
||||
return false;
|
||||
|
||||
if (M_CheckParm("-port"))
|
||||
if (M_CheckParm("-port") || M_CheckParm("-serverport"))
|
||||
// Combined -udpport and -clientport into -port
|
||||
// As it was really redundant having two seperate parms that does the same thing
|
||||
/* Sorry Steel, I'm adding these back. But -udpport is a stupid name. */
|
||||
{
|
||||
if (M_IsNextParm())
|
||||
strcpy(port_name, M_GetNextParm());
|
||||
else
|
||||
strcpy(port_name, "0");
|
||||
/*
|
||||
If it's NULL, that's okay! Because then
|
||||
we'll get a random port from getaddrinfo.
|
||||
*/
|
||||
serverport_name = M_GetNextParm();
|
||||
}
|
||||
if (M_CheckParm("-clientport"))
|
||||
clientport_name = M_GetNextParm();
|
||||
|
||||
// parse network game options,
|
||||
if (M_CheckParm("-server") || dedicated)
|
||||
|
|
76
src/m_menu.c
76
src/m_menu.c
|
@ -309,7 +309,7 @@ static void M_ChangeControl(INT32 choice);
|
|||
// Video & Sound
|
||||
menu_t OP_VideoOptionsDef, OP_VideoModeDef, OP_ColorOptionsDef;
|
||||
#ifdef HWRENDER
|
||||
menu_t OP_OpenGLOptionsDef, OP_OpenGLFogDef, OP_OpenGLColorDef;
|
||||
menu_t OP_OpenGLOptionsDef, OP_OpenGLFogDef;
|
||||
#endif
|
||||
menu_t OP_SoundOptionsDef;
|
||||
menu_t OP_SoundAdvancedDef;
|
||||
|
@ -355,7 +355,6 @@ static void M_DrawScreenshotMenu(void);
|
|||
static void M_DrawMonitorToggles(void);
|
||||
#ifdef HWRENDER
|
||||
static void M_OGL_DrawFogMenu(void);
|
||||
static void M_OGL_DrawColorMenu(void);
|
||||
#endif
|
||||
#ifndef NONET
|
||||
static void M_DrawScreenshotMenu(void);
|
||||
|
@ -1119,6 +1118,8 @@ static menuitem_t OP_Joystick1Menu[] =
|
|||
|
||||
{IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook, 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook, 130},
|
||||
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER,
|
||||
NULL, "Deadzone", &cv_deadzone, 140 },
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick2Menu[] =
|
||||
|
@ -1135,6 +1136,8 @@ static menuitem_t OP_Joystick2Menu[] =
|
|||
|
||||
{IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook2,120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook2, 130},
|
||||
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER,
|
||||
NULL, "Deadzone", &cv_deadzone2, 140 },
|
||||
};
|
||||
|
||||
static menuitem_t OP_JoystickSetMenu[1+MAX_JOYSTICKS];
|
||||
|
@ -1302,21 +1305,25 @@ static menuitem_t OP_ColorOptionsMenu[] =
|
|||
#ifdef HWRENDER
|
||||
static menuitem_t OP_OpenGLOptionsMenu[] =
|
||||
{
|
||||
{IT_STRING|IT_CVAR, NULL, "Models", &cv_grmodels, 10},
|
||||
{IT_STRING|IT_CVAR, NULL, "Model interpolation", &cv_grmodelinterpolation, 20},
|
||||
{IT_HEADER, NULL, "3D Models", NULL, 0},
|
||||
{IT_STRING|IT_CVAR, NULL, "Models", &cv_grmodels, 12},
|
||||
{IT_STRING|IT_CVAR, NULL, "Model interpolation", &cv_grmodelinterpolation, 22},
|
||||
{IT_STRING|IT_CVAR, NULL, "Model lighting", &cv_grmodellighting, 32},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Field of view", &cv_grfov, 40},
|
||||
{IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 50},
|
||||
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 60},
|
||||
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode,70},
|
||||
#if defined (_WINDOWS) && (!((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)))
|
||||
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 80},
|
||||
#endif
|
||||
{IT_HEADER, NULL, "General", NULL, 51},
|
||||
{IT_STRING|IT_CVAR, NULL, "Field of view", &cv_grfov, 62},
|
||||
{IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 72},
|
||||
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 82},
|
||||
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode,92},
|
||||
|
||||
{IT_HEADER, NULL, "Miscellaneous", NULL, 111},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Fog...", &OP_OpenGLFogDef, 123},
|
||||
#ifdef ALAM_LIGHTING
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 100},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 133},
|
||||
#endif
|
||||
#if defined (_WINDOWS) && (!((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)))
|
||||
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 143},
|
||||
#endif
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Fog...", &OP_OpenGLFogDef, 110},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 120},
|
||||
};
|
||||
|
||||
#ifdef ALAM_LIGHTING
|
||||
|
@ -1336,13 +1343,6 @@ static menuitem_t OP_OpenGLFogMenu[] =
|
|||
{IT_STRING|IT_CVAR, NULL, "Fog density", &cv_grfogdensity, 30},
|
||||
{IT_STRING|IT_CVAR, NULL, "Software Fog",&cv_grsoftwarefog,40},
|
||||
};
|
||||
|
||||
static menuitem_t OP_OpenGLColorMenu[] =
|
||||
{
|
||||
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "red", &cv_grgammared, 10},
|
||||
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "green", &cv_grgammagreen, 20},
|
||||
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "blue", &cv_grgammablue, 30},
|
||||
};
|
||||
#endif
|
||||
|
||||
static menuitem_t OP_SoundOptionsMenu[] =
|
||||
|
@ -2029,18 +2029,6 @@ menu_t OP_OpenGLFogDef =
|
|||
0,
|
||||
NULL
|
||||
};
|
||||
menu_t OP_OpenGLColorDef =
|
||||
{
|
||||
MN_OP_MAIN + (MN_OP_VIDEO << 6) + (MN_OP_OPENGL << 12) + (MN_OP_OPENGL_COLOR << 18),
|
||||
"M_VIDEO",
|
||||
sizeof (OP_OpenGLColorMenu)/sizeof (menuitem_t),
|
||||
&OP_OpenGLOptionsDef,
|
||||
OP_OpenGLColorMenu,
|
||||
M_OGL_DrawColorMenu,
|
||||
60, 40,
|
||||
0,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE(
|
||||
MN_OP_MAIN + (MN_OP_DATA << 6),
|
||||
|
@ -3027,7 +3015,7 @@ boolean M_Responder(event_t *ev)
|
|||
}
|
||||
else if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime())
|
||||
{
|
||||
const INT32 jdeadzone = JOYAXISRANGE/4;
|
||||
const INT32 jdeadzone = (JOYAXISRANGE * cv_deadzone.value) / FRACUNIT;
|
||||
if (ev->data3 != INT32_MAX)
|
||||
{
|
||||
if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone)
|
||||
|
@ -6388,11 +6376,7 @@ static void M_PandorasBox(INT32 choice)
|
|||
else
|
||||
CV_StealthSetValue(&cv_dummylives, max(players[consoleplayer].lives, 1));
|
||||
CV_StealthSetValue(&cv_dummycontinues, players[consoleplayer].continues);
|
||||
SR_PandorasBox[6].status = ((players[consoleplayer].charflags & SF_SUPER)
|
||||
#ifndef DEVELOP
|
||||
|| cv_skin.value == 1
|
||||
#endif
|
||||
) ? (IT_GRAYEDOUT) : (IT_STRING | IT_CALL);
|
||||
SR_PandorasBox[6].status = (players[consoleplayer].charflags & SF_SUPER) ? (IT_GRAYEDOUT) : (IT_STRING | IT_CALL);
|
||||
SR_PandorasBox[7].status = (emeralds == ((EMERALD7)*2)-1) ? (IT_GRAYEDOUT) : (IT_STRING | IT_CALL);
|
||||
M_SetupNextMenu(&SR_PandoraDef);
|
||||
}
|
||||
|
@ -11933,20 +11917,6 @@ static void M_OGL_DrawFogMenu(void)
|
|||
my + currentMenu->menuitems[FOG_COLOR_ITEM].alphaKey, '_' | 0x80,false);
|
||||
}
|
||||
|
||||
// =====================
|
||||
// M_OGL_DrawColorMenu()
|
||||
// =====================
|
||||
static void M_OGL_DrawColorMenu(void)
|
||||
{
|
||||
INT32 mx, my;
|
||||
|
||||
mx = currentMenu->x;
|
||||
my = currentMenu->y;
|
||||
M_DrawGenericMenu(); // use generic drawer for cursor, items and title
|
||||
V_DrawString(mx, my + currentMenu->menuitems[0].alphaKey - 10,
|
||||
V_YELLOWMAP, "Gamma correction");
|
||||
}
|
||||
|
||||
//===================
|
||||
// M_HandleFogColor()
|
||||
//===================
|
||||
|
|
|
@ -672,7 +672,7 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat)
|
|||
//
|
||||
INT32 P_AddLevelFlatRuntime(const char *flatname)
|
||||
{
|
||||
return Ploadflat(0, flatname);
|
||||
return Ploadflat(levelflats, flatname);
|
||||
}
|
||||
|
||||
// help function for $$$.sav checking
|
||||
|
@ -3019,8 +3019,15 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
P_SpawnPrecipitation();
|
||||
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
// Lactozilla (December 8, 2019)
|
||||
// Level setup used to free EVERY mipmap from memory.
|
||||
// Even mipmaps that aren't related to level textures.
|
||||
// Presumably, the hardware render code used to store textures as level data.
|
||||
// Meaning, they had memory allocated and marked with the PU_LEVEL tag.
|
||||
// Level textures are only reloaded after R_LoadTextures, which is
|
||||
// when the texture list is loaded.
|
||||
#ifdef ALAM_LIGHTING
|
||||
// BP: reset light between levels (we draw preview frame lights on current frame)
|
||||
HWR_ResetLights();
|
||||
|
@ -3175,11 +3182,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
if (!cv_analog2.changed)
|
||||
CV_SetValue(&cv_analog2, 0);
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
CV_Set(&cv_grfov, cv_grfov.defaultvalue);
|
||||
#endif
|
||||
|
||||
displayplayer = consoleplayer; // Start with your OWN view, please!
|
||||
}
|
||||
|
||||
|
@ -3203,14 +3205,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
// Fab : 19-07-98 : start cd music for this level (note: can be remapped)
|
||||
I_PlayCD((UINT8)(gamemap), false);
|
||||
|
||||
// preload graphics
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
HWR_PrepLevelCache(numtextures);
|
||||
}
|
||||
#endif
|
||||
|
||||
P_MapEnd();
|
||||
|
||||
// Remove the loading shit from the screen
|
||||
|
|
26
src/p_spec.c
26
src/p_spec.c
|
@ -138,6 +138,13 @@ static size_t maxanims;
|
|||
|
||||
static animdef_t *animdefs = NULL;
|
||||
|
||||
// Increase the size of animdefs to make room for a new animation definition
|
||||
static void GrowAnimDefs(void)
|
||||
{
|
||||
maxanims++;
|
||||
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
|
||||
}
|
||||
|
||||
// A prototype; here instead of p_spec.h, so they're "private"
|
||||
void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum);
|
||||
void P_ParseAnimationDefintion(SINT8 istexture);
|
||||
|
@ -347,8 +354,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||
if (i == maxanims)
|
||||
{
|
||||
// Increase the size to make room for the new animation definition
|
||||
maxanims++;
|
||||
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
|
||||
GrowAnimDefs();
|
||||
strncpy(animdefs[i].startname, animdefsToken, 9);
|
||||
}
|
||||
|
||||
|
@ -434,8 +440,17 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||
}
|
||||
animdefs[i].speed = animSpeed;
|
||||
Z_Free(animdefsToken);
|
||||
}
|
||||
|
||||
#ifdef WALLFLATS
|
||||
// hehe... uhh.....
|
||||
if (!istexture)
|
||||
{
|
||||
GrowAnimDefs();
|
||||
M_Memcpy(&animdefs[maxanims-1], &animdefs[i], sizeof(animdef_t));
|
||||
animdefs[maxanims-1].istexture = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Checks for flats in levelflats that are part of a flat animation sequence
|
||||
* and sets them up for animation.
|
||||
|
@ -476,7 +491,8 @@ static inline void P_FindAnimatedFlat(INT32 animnum)
|
|||
atoi(sizeu1(i)), foundflats->name, foundflats->animseq,
|
||||
foundflats->numpics,foundflats->speed);
|
||||
}
|
||||
else if (foundflats->u.flat.lumpnum >= startflatnum && foundflats->u.flat.lumpnum <= endflatnum)
|
||||
else if ((!anims[animnum].istexture) && (foundflats->type == LEVELFLAT_FLAT)
|
||||
&& (foundflats->u.flat.lumpnum >= startflatnum && foundflats->u.flat.lumpnum <= endflatnum))
|
||||
{
|
||||
foundflats->u.flat.baselumpnum = startflatnum;
|
||||
foundflats->animseq = foundflats->u.flat.lumpnum - startflatnum;
|
||||
|
@ -5626,7 +5642,7 @@ void P_UpdateSpecials(void)
|
|||
if (foundflats->speed) // it is an animated flat
|
||||
{
|
||||
// update the levelflat texture number
|
||||
if (foundflats->type == LEVELFLAT_TEXTURE)
|
||||
if ((foundflats->type == LEVELFLAT_TEXTURE) && (foundflats->u.texture.basenum != -1))
|
||||
foundflats->u.texture.num = foundflats->u.texture.basenum + ((leveltime/foundflats->speed + foundflats->animseq) % foundflats->numpics);
|
||||
// update the levelflat lump number
|
||||
else if ((foundflats->type == LEVELFLAT_FLAT) && (foundflats->u.flat.baselumpnum != LUMPERROR))
|
||||
|
|
|
@ -1378,5 +1378,13 @@ void R_RenderBSPNode(INT32 bspnum)
|
|||
bspnum = bsp->children[side^1];
|
||||
}
|
||||
|
||||
// PORTAL CULLING
|
||||
if (portalcullsector) {
|
||||
sector_t *sect = subsectors[bspnum & ~NF_SUBSECTOR].sector;
|
||||
if (sect != portalcullsector)
|
||||
return;
|
||||
portalcullsector = NULL;
|
||||
}
|
||||
|
||||
R_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
|
||||
}
|
||||
|
|
185
src/r_data.c
185
src/r_data.c
|
@ -32,6 +32,10 @@
|
|||
#include <malloc.h> // alloca(sizeof)
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h" // HWR_LoadTextures
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
@ -437,7 +441,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
texture_t *texture;
|
||||
texpatch_t *patch;
|
||||
patch_t *realpatch;
|
||||
boolean dealloc = false;
|
||||
UINT8 *pdata;
|
||||
int x, x1, x2, i, width, height;
|
||||
size_t blocksize;
|
||||
column_t *patchcol;
|
||||
|
@ -465,12 +469,17 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
wadnum = patch->wad;
|
||||
lumpnum = patch->lump;
|
||||
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||
realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); // can't use W_CachePatchNumPwad because OpenGL
|
||||
pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||
realpatch = (patch_t *)pdata;
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
||||
goto multipatch;
|
||||
#endif
|
||||
#ifdef WALLFLATS
|
||||
if (texture->type == TEXTURETYPE_FLAT)
|
||||
goto multipatch;
|
||||
#endif
|
||||
|
||||
// Check the patch for holes.
|
||||
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
|
||||
|
@ -548,6 +557,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
// Composite the columns together.
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
boolean dealloc = true;
|
||||
static void (*ColumnDrawerPointer)(column_t *, UINT8 *, texpatch_t *, INT32, INT32); // Column drawing function pointer.
|
||||
if (patch->style != AST_COPY)
|
||||
ColumnDrawerPointer = (patch->flip & 2) ? R_DrawBlendFlippedColumnInCache : R_DrawBlendColumnInCache;
|
||||
|
@ -556,17 +566,25 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
|
||||
wadnum = patch->wad;
|
||||
lumpnum = patch->lump;
|
||||
pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||
realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||
dealloc = false;
|
||||
realpatch = (patch_t *)pdata;
|
||||
dealloc = true;
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
||||
{
|
||||
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
|
||||
dealloc = true;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef WALLFLATS
|
||||
if (texture->type == TEXTURETYPE_FLAT)
|
||||
realpatch = R_FlatToPatch(pdata, texture->width, texture->height, 0, 0, NULL, false);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
(void)lumplength;
|
||||
dealloc = false;
|
||||
}
|
||||
|
||||
x1 = patch->originx;
|
||||
width = SHORT(realpatch->width);
|
||||
|
@ -721,7 +739,6 @@ void R_LoadTextures(void)
|
|||
for (w = 0, numtextures = 0; w < numwadfiles; w++)
|
||||
{
|
||||
// Count the textures from TEXTURES lumps
|
||||
|
||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
||||
while (texturesLumpPos != INT16_MAX)
|
||||
{
|
||||
|
@ -730,7 +747,6 @@ void R_LoadTextures(void)
|
|||
}
|
||||
|
||||
// Count single-patch textures
|
||||
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
||||
|
@ -743,7 +759,11 @@ void R_LoadTextures(void)
|
|||
}
|
||||
|
||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||
#ifdef WALLFLATS
|
||||
goto countflats;
|
||||
#else
|
||||
continue;
|
||||
#endif
|
||||
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
|
@ -760,6 +780,40 @@ void R_LoadTextures(void)
|
|||
{
|
||||
numtextures += (UINT32)(texend - texstart);
|
||||
}
|
||||
|
||||
#ifdef WALLFLATS
|
||||
countflats:
|
||||
// Count flats
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
texstart = W_CheckNumForFolderStartPK3("flats/", (UINT16)w, 0);
|
||||
texend = W_CheckNumForFolderEndPK3("flats/", (UINT16)w, texstart);
|
||||
}
|
||||
else
|
||||
{
|
||||
texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0);
|
||||
texend = W_CheckNumForNamePwad("F_END", (UINT16)w, texstart);
|
||||
}
|
||||
|
||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||
continue;
|
||||
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
// PK3s have subfolders, so we can't just make a simple sum
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
for (j = texstart; j < texend; j++)
|
||||
{
|
||||
if (!W_IsLumpFolder((UINT16)w, j)) // Check if lump is a folder; if not, then count it
|
||||
numtextures++;
|
||||
}
|
||||
}
|
||||
else // Add all the textures between F_START and F_END
|
||||
{
|
||||
numtextures += (UINT32)(texend - texstart);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// If no textures found by this point, bomb out
|
||||
|
@ -809,7 +863,11 @@ void R_LoadTextures(void)
|
|||
}
|
||||
|
||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||
#ifdef WALLFLATS
|
||||
goto checkflats;
|
||||
#else
|
||||
continue;
|
||||
#endif
|
||||
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
|
@ -853,6 +911,8 @@ void R_LoadTextures(void)
|
|||
texture->width = SHORT(patchlump->width);
|
||||
texture->height = SHORT(patchlump->height);
|
||||
}
|
||||
|
||||
texture->type = TEXTURETYPE_SINGLEPATCH;
|
||||
texture->patchcount = 1;
|
||||
texture->holes = false;
|
||||
texture->flip = 0;
|
||||
|
@ -871,7 +931,113 @@ void R_LoadTextures(void)
|
|||
textureheight[i] = texture->height << FRACBITS;
|
||||
i++;
|
||||
}
|
||||
|
||||
#ifdef WALLFLATS
|
||||
checkflats:
|
||||
// Yes
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
texstart = W_CheckNumForFolderStartPK3("flats/", (UINT16)w, 0);
|
||||
texend = W_CheckNumForFolderEndPK3("flats/", (UINT16)w, texstart);
|
||||
}
|
||||
else
|
||||
{
|
||||
texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0);
|
||||
texend = W_CheckNumForNamePwad("F_END", (UINT16)w, texstart);
|
||||
}
|
||||
|
||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||
continue;
|
||||
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
// Work through each lump between the markers in the WAD.
|
||||
for (j = 0; j < (texend - texstart); j++)
|
||||
{
|
||||
UINT8 *flatlump;
|
||||
UINT16 wadnum = (UINT16)w;
|
||||
lumpnum_t lumpnum = texstart + j;
|
||||
size_t lumplength;
|
||||
size_t flatsize = 0;
|
||||
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
if (W_IsLumpFolder(wadnum, lumpnum)) // Check if lump is a folder
|
||||
continue; // If it is then SKIP IT
|
||||
}
|
||||
|
||||
flatlump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||
|
||||
switch (lumplength)
|
||||
{
|
||||
case 4194304: // 2048x2048 lump
|
||||
flatsize = 2048;
|
||||
break;
|
||||
case 1048576: // 1024x1024 lump
|
||||
flatsize = 1024;
|
||||
break;
|
||||
case 262144:// 512x512 lump
|
||||
flatsize = 512;
|
||||
break;
|
||||
case 65536: // 256x256 lump
|
||||
flatsize = 256;
|
||||
break;
|
||||
case 16384: // 128x128 lump
|
||||
flatsize = 128;
|
||||
break;
|
||||
case 1024: // 32x32 lump
|
||||
flatsize = 32;
|
||||
break;
|
||||
default: // 64x64 lump
|
||||
flatsize = 64;
|
||||
break;
|
||||
}
|
||||
|
||||
//CONS_Printf("\n\"%s\" is a flat, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),flatsize,flatsize);
|
||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||
|
||||
// Set texture properties.
|
||||
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
if (R_IsLumpPNG((UINT8 *)flatlump, lumplength))
|
||||
{
|
||||
INT16 width, height;
|
||||
R_PNGDimensions((UINT8 *)flatlump, &width, &height, lumplength);
|
||||
texture->width = width;
|
||||
texture->height = height;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
texture->width = texture->height = flatsize;
|
||||
|
||||
texture->type = TEXTURETYPE_FLAT;
|
||||
texture->patchcount = 1;
|
||||
texture->holes = false;
|
||||
texture->flip = 0;
|
||||
|
||||
// Allocate information for the texture's patches.
|
||||
patch = &texture->patches[0];
|
||||
|
||||
patch->originx = patch->originy = 0;
|
||||
patch->wad = (UINT16)w;
|
||||
patch->lump = texstart + j;
|
||||
patch->flip = 0;
|
||||
|
||||
Z_Unlock(flatlump);
|
||||
|
||||
texturewidth[i] = texture->width;
|
||||
textureheight[i] = texture->height << FRACBITS;
|
||||
i++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_LoadTextures(numtextures);
|
||||
#endif
|
||||
}
|
||||
|
||||
static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
||||
|
@ -1182,6 +1348,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||
M_Memcpy(resultTexture->name, newTextureName, 8);
|
||||
resultTexture->width = newTextureWidth;
|
||||
resultTexture->height = newTextureHeight;
|
||||
resultTexture->type = TEXTURETYPE_COMPOSITE;
|
||||
}
|
||||
Z_Free(texturesToken);
|
||||
texturesToken = M_GetToken(NULL);
|
||||
|
|
12
src/r_data.h
12
src/r_data.h
|
@ -45,6 +45,17 @@ typedef struct
|
|||
enum patchalphastyle style;
|
||||
} texpatch_t;
|
||||
|
||||
// texture type
|
||||
enum
|
||||
{
|
||||
TEXTURETYPE_UNKNOWN,
|
||||
TEXTURETYPE_SINGLEPATCH,
|
||||
TEXTURETYPE_COMPOSITE,
|
||||
#ifdef WALLFLATS
|
||||
TEXTURETYPE_FLAT,
|
||||
#endif
|
||||
};
|
||||
|
||||
// A maptexturedef_t describes a rectangular texture,
|
||||
// which is composed of one or more mappatch_t structures
|
||||
// that arrange graphic patches.
|
||||
|
@ -52,6 +63,7 @@ typedef struct
|
|||
{
|
||||
// Keep name for switch changing, etc.
|
||||
char name[8];
|
||||
UINT8 type; // TEXTURETYPE_
|
||||
INT16 width, height;
|
||||
boolean holes;
|
||||
UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both
|
||||
|
|
|
@ -107,7 +107,8 @@ UINT8 *ds_transmap; // one of the translucency tables
|
|||
|
||||
#ifdef ESLOPE
|
||||
pslope_t *ds_slope; // Current slope being used
|
||||
floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff?
|
||||
floatv3_t ds_su[MAXVIDHEIGHT], ds_sv[MAXVIDHEIGHT], ds_sz[MAXVIDHEIGHT]; // Vectors for... stuff?
|
||||
floatv3_t *ds_sup, *ds_svp, *ds_szp;
|
||||
float focallengthf, zeroheight;
|
||||
#endif
|
||||
|
||||
|
@ -960,6 +961,7 @@ void R_DrawViewBorder(void)
|
|||
// ==========================================================================
|
||||
|
||||
#include "r_draw8.c"
|
||||
#include "r_draw8_npo2.c"
|
||||
|
||||
// ==========================================================================
|
||||
// INCLUDE 16bpp DRAWING CODE HERE
|
||||
|
|
75
src/r_draw.h
75
src/r_draw.h
|
@ -68,7 +68,8 @@ typedef struct {
|
|||
} floatv3_t;
|
||||
|
||||
extern pslope_t *ds_slope; // Current slope being used
|
||||
extern floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff?
|
||||
extern floatv3_t ds_su[MAXVIDHEIGHT], ds_sv[MAXVIDHEIGHT], ds_sz[MAXVIDHEIGHT]; // Vectors for... stuff?
|
||||
extern floatv3_t *ds_sup, *ds_svp, *ds_szp;
|
||||
extern float focallengthf, zeroheight;
|
||||
#endif
|
||||
|
||||
|
@ -138,49 +139,65 @@ void R_DrawViewBorder(void);
|
|||
// -----------------
|
||||
|
||||
void R_DrawColumn_8(void);
|
||||
#define R_DrawWallColumn_8 R_DrawColumn_8
|
||||
void R_DrawShadeColumn_8(void);
|
||||
void R_DrawTranslucentColumn_8(void);
|
||||
void R_DrawTranslatedColumn_8(void);
|
||||
void R_DrawTranslatedTranslucentColumn_8(void);
|
||||
void R_Draw2sMultiPatchColumn_8(void);
|
||||
void R_Draw2sMultiPatchTranslucentColumn_8(void);
|
||||
void R_DrawFogColumn_8(void);
|
||||
void R_DrawColumnShadowed_8(void);
|
||||
|
||||
void R_DrawSpan_8(void);
|
||||
void R_DrawSplat_8(void);
|
||||
void R_DrawTranslucentSpan_8(void);
|
||||
void R_DrawTranslucentSplat_8(void);
|
||||
#ifdef ESLOPE
|
||||
void R_DrawTiltedSpan_8(void);
|
||||
void R_DrawTiltedTranslucentSpan_8(void);
|
||||
#ifndef NOWATER
|
||||
void R_DrawTiltedTranslucentWaterSpan_8(void);
|
||||
#endif
|
||||
void R_DrawTiltedSplat_8(void);
|
||||
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
|
||||
extern INT32 tiltlighting[MAXVIDWIDTH];
|
||||
#endif
|
||||
#ifndef NOWATER
|
||||
void R_DrawTranslucentWaterSpan_8(void);
|
||||
extern INT32 ds_bgofs;
|
||||
extern INT32 ds_waterofs;
|
||||
#endif
|
||||
void R_DrawFogSpan_8(void);
|
||||
|
||||
// Lactozilla: Non-powers-of-two
|
||||
void R_DrawSpan_NPO2_8(void);
|
||||
void R_DrawTranslucentSpan_NPO2_8(void);
|
||||
void R_DrawSplat_NPO2_8(void);
|
||||
void R_DrawTranslucentSplat_NPO2_8(void);
|
||||
#ifdef ESLOPE
|
||||
void R_DrawTiltedSpan_NPO2_8(void);
|
||||
void R_DrawTiltedTranslucentSpan_NPO2_8(void);
|
||||
#ifndef NOWATER
|
||||
void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void);
|
||||
#endif
|
||||
void R_DrawTiltedSplat_NPO2_8(void);
|
||||
#endif
|
||||
#ifndef NOWATER
|
||||
void R_DrawTranslucentWaterSpan_NPO2_8(void);
|
||||
#endif
|
||||
|
||||
#ifdef USEASM
|
||||
void ASMCALL R_DrawColumn_8_ASM(void);
|
||||
#define R_DrawWallColumn_8_ASM R_DrawColumn_8_ASM
|
||||
void ASMCALL R_DrawShadeColumn_8_ASM(void);
|
||||
void ASMCALL R_DrawTranslucentColumn_8_ASM(void);
|
||||
void ASMCALL R_Draw2sMultiPatchColumn_8_ASM(void);
|
||||
|
||||
void ASMCALL R_DrawColumn_8_MMX(void);
|
||||
#define R_DrawWallColumn_8_MMX R_DrawColumn_8_MMX
|
||||
|
||||
void ASMCALL R_Draw2sMultiPatchColumn_8_MMX(void);
|
||||
void ASMCALL R_DrawSpan_8_MMX(void);
|
||||
#endif
|
||||
|
||||
void R_DrawTranslatedColumn_8(void);
|
||||
void R_DrawTranslatedTranslucentColumn_8(void);
|
||||
void R_DrawSpan_8(void);
|
||||
#ifdef ESLOPE
|
||||
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
|
||||
void R_DrawTiltedSpan_8(void);
|
||||
void R_DrawTiltedTranslucentSpan_8(void);
|
||||
void R_DrawTiltedSplat_8(void);
|
||||
#endif
|
||||
void R_DrawSplat_8(void);
|
||||
void R_DrawTranslucentSplat_8(void);
|
||||
void R_DrawTranslucentSpan_8(void);
|
||||
void R_Draw2sMultiPatchColumn_8(void);
|
||||
void R_Draw2sMultiPatchTranslucentColumn_8(void);
|
||||
void R_DrawFogSpan_8(void);
|
||||
void R_DrawFogColumn_8(void);
|
||||
void R_DrawColumnShadowed_8(void);
|
||||
|
||||
#ifndef NOWATER
|
||||
void R_DrawTranslucentWaterSpan_8(void);
|
||||
|
||||
extern INT32 ds_bgofs;
|
||||
extern INT32 ds_waterofs;
|
||||
#endif
|
||||
|
||||
// ------------------
|
||||
// 16bpp DRAWING CODE
|
||||
// ------------------
|
||||
|
|
629
src/r_draw8.c
629
src/r_draw8.c
|
@ -562,11 +562,8 @@ void R_DrawSpan_8 (void)
|
|||
// bit per power of two (obviously)
|
||||
// Ok, because I was able to eliminate the variable spot below, this function is now FASTER
|
||||
// than the original span renderer. Whodathunkit?
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
xposition <<= nflatshiftup; yposition <<= nflatshiftup;
|
||||
xstep <<= nflatshiftup; ystep <<= nflatshiftup;
|
||||
}
|
||||
|
||||
source = ds_source;
|
||||
colormap = ds_colormap;
|
||||
|
@ -575,29 +572,6 @@ void R_DrawSpan_8 (void)
|
|||
if (dest+8 > deststop)
|
||||
return;
|
||||
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
while (count-- && dest <= deststop)
|
||||
{
|
||||
fixed_t x = (xposition >> FRACBITS);
|
||||
fixed_t y = (yposition >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest++ = colormap[source[((y * ds_flatwidth) + x)]];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (count >= 8)
|
||||
{
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
|
@ -645,12 +619,11 @@ void R_DrawSpan_8 (void)
|
|||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
// R_CalcTiltedLighting
|
||||
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
|
||||
static INT32 tiltlighting[MAXVIDWIDTH];
|
||||
INT32 tiltlighting[MAXVIDWIDTH];
|
||||
void R_CalcTiltedLighting(fixed_t start, fixed_t end)
|
||||
{
|
||||
// ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version
|
||||
|
@ -692,22 +665,22 @@ void R_DrawTiltedSpan_8(void)
|
|||
double endz, endu, endv;
|
||||
UINT32 stepu, stepv;
|
||||
|
||||
iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx);
|
||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||
|
||||
// Lighting is simple. It's just linear interpolation from start to end
|
||||
{
|
||||
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
|
||||
float lightstart, lightend;
|
||||
|
||||
lightend = (iz + ds_sz.x*width) * planelightfloat;
|
||||
lightend = (iz + ds_szp->x*width) * planelightfloat;
|
||||
lightstart = iz * planelightfloat;
|
||||
|
||||
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
|
||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
|
||||
}
|
||||
|
||||
uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx);
|
||||
vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx);
|
||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
source = ds_source;
|
||||
|
@ -724,28 +697,11 @@ void R_DrawTiltedSpan_8(void)
|
|||
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest = colormap[source[((y * ds_flatwidth) + x)]];
|
||||
}
|
||||
else
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
dest++;
|
||||
iz += ds_sz.x;
|
||||
uz += ds_su.x;
|
||||
vz += ds_sv.x;
|
||||
iz += ds_szp->x;
|
||||
uz += ds_sup->x;
|
||||
vz += ds_svp->x;
|
||||
} while (--width >= 0);
|
||||
#else
|
||||
#define SPANSIZE 16
|
||||
|
@ -755,9 +711,9 @@ void R_DrawTiltedSpan_8(void)
|
|||
startu = uz*startz;
|
||||
startv = vz*startz;
|
||||
|
||||
izstep = ds_sz.x * SPANSIZE;
|
||||
uzstep = ds_su.x * SPANSIZE;
|
||||
vzstep = ds_sv.x * SPANSIZE;
|
||||
izstep = ds_szp->x * SPANSIZE;
|
||||
uzstep = ds_sup->x * SPANSIZE;
|
||||
vzstep = ds_svp->x * SPANSIZE;
|
||||
//x1 = 0;
|
||||
width++;
|
||||
|
||||
|
@ -778,23 +734,6 @@ void R_DrawTiltedSpan_8(void)
|
|||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest = colormap[source[((y * ds_flatwidth) + x)]];
|
||||
}
|
||||
else
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
dest++;
|
||||
u += stepu;
|
||||
|
@ -811,31 +750,14 @@ void R_DrawTiltedSpan_8(void)
|
|||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest = colormap[source[((y * ds_flatwidth) + x)]];
|
||||
}
|
||||
else
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
}
|
||||
else
|
||||
{
|
||||
double left = width;
|
||||
iz += ds_sz.x * left;
|
||||
uz += ds_su.x * left;
|
||||
vz += ds_sv.x * left;
|
||||
iz += ds_szp->x * left;
|
||||
uz += ds_sup->x * left;
|
||||
vz += ds_svp->x * left;
|
||||
|
||||
endz = 1.f/iz;
|
||||
endu = uz*endz;
|
||||
|
@ -849,23 +771,6 @@ void R_DrawTiltedSpan_8(void)
|
|||
for (; width != 0; width--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest = colormap[source[((y * ds_flatwidth) + x)]];
|
||||
}
|
||||
else
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
dest++;
|
||||
u += stepu;
|
||||
|
@ -896,22 +801,22 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
double endz, endu, endv;
|
||||
UINT32 stepu, stepv;
|
||||
|
||||
iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx);
|
||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||
|
||||
// Lighting is simple. It's just linear interpolation from start to end
|
||||
{
|
||||
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
|
||||
float lightstart, lightend;
|
||||
|
||||
lightend = (iz + ds_sz.x*width) * planelightfloat;
|
||||
lightend = (iz + ds_szp->x*width) * planelightfloat;
|
||||
lightstart = iz * planelightfloat;
|
||||
|
||||
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
|
||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
|
||||
}
|
||||
|
||||
uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx);
|
||||
vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx);
|
||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
source = ds_source;
|
||||
|
@ -927,28 +832,11 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
v = (INT64)(vz*z) + viewy;
|
||||
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
|
||||
}
|
||||
else
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
dest++;
|
||||
iz += ds_sz.x;
|
||||
uz += ds_su.x;
|
||||
vz += ds_sv.x;
|
||||
iz += ds_szp->x;
|
||||
uz += ds_sup->x;
|
||||
vz += ds_svp->x;
|
||||
} while (--width >= 0);
|
||||
#else
|
||||
#define SPANSIZE 16
|
||||
|
@ -958,9 +846,9 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
startu = uz*startz;
|
||||
startv = vz*startz;
|
||||
|
||||
izstep = ds_sz.x * SPANSIZE;
|
||||
uzstep = ds_su.x * SPANSIZE;
|
||||
vzstep = ds_sv.x * SPANSIZE;
|
||||
izstep = ds_szp->x * SPANSIZE;
|
||||
uzstep = ds_sup->x * SPANSIZE;
|
||||
vzstep = ds_svp->x * SPANSIZE;
|
||||
//x1 = 0;
|
||||
width++;
|
||||
|
||||
|
@ -981,23 +869,6 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
|
||||
}
|
||||
else
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
dest++;
|
||||
u += stepu;
|
||||
|
@ -1014,31 +885,14 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
|
||||
}
|
||||
else
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
}
|
||||
else
|
||||
{
|
||||
double left = width;
|
||||
iz += ds_sz.x * left;
|
||||
uz += ds_su.x * left;
|
||||
vz += ds_sv.x * left;
|
||||
iz += ds_szp->x * left;
|
||||
uz += ds_sup->x * left;
|
||||
vz += ds_svp->x * left;
|
||||
|
||||
endz = 1.f/iz;
|
||||
endu = uz*endz;
|
||||
|
@ -1052,23 +906,6 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
for (; width != 0; width--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
|
||||
}
|
||||
else
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
dest++;
|
||||
u += stepu;
|
||||
|
@ -1079,6 +916,145 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef NOWATER
|
||||
/** \brief The R_DrawTiltedTranslucentWaterSpan_8 function
|
||||
Like DrawTiltedTranslucentSpan, but for water
|
||||
*/
|
||||
void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||
{
|
||||
// x1, x2 = ds_x1, ds_x2
|
||||
int width = ds_x2 - ds_x1;
|
||||
double iz, uz, vz;
|
||||
UINT32 u, v;
|
||||
int i;
|
||||
|
||||
UINT8 *source;
|
||||
UINT8 *colormap;
|
||||
UINT8 *dest;
|
||||
UINT8 *dsrc;
|
||||
|
||||
double startz, startu, startv;
|
||||
double izstep, uzstep, vzstep;
|
||||
double endz, endu, endv;
|
||||
UINT32 stepu, stepv;
|
||||
|
||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||
|
||||
// Lighting is simple. It's just linear interpolation from start to end
|
||||
{
|
||||
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
|
||||
float lightstart, lightend;
|
||||
|
||||
lightend = (iz + ds_szp->x*width) * planelightfloat;
|
||||
lightstart = iz * planelightfloat;
|
||||
|
||||
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
|
||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
|
||||
}
|
||||
|
||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1;
|
||||
source = ds_source;
|
||||
//colormap = ds_colormap;
|
||||
|
||||
#if 0 // The "perfect" reference version of this routine. Pretty slow.
|
||||
// Use it only to see how things are supposed to look.
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
double z = 1.f/iz;
|
||||
u = (INT64)(uz*z) + viewx;
|
||||
v = (INT64)(vz*z) + viewy;
|
||||
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++);
|
||||
dest++;
|
||||
iz += ds_szp->x;
|
||||
uz += ds_sup->x;
|
||||
vz += ds_svp->x;
|
||||
} while (--width >= 0);
|
||||
#else
|
||||
#define SPANSIZE 16
|
||||
#define INVSPAN 0.0625f
|
||||
|
||||
startz = 1.f/iz;
|
||||
startu = uz*startz;
|
||||
startv = vz*startz;
|
||||
|
||||
izstep = ds_szp->x * SPANSIZE;
|
||||
uzstep = ds_sup->x * SPANSIZE;
|
||||
vzstep = ds_svp->x * SPANSIZE;
|
||||
//x1 = 0;
|
||||
width++;
|
||||
|
||||
while (width >= SPANSIZE)
|
||||
{
|
||||
iz += izstep;
|
||||
uz += uzstep;
|
||||
vz += vzstep;
|
||||
|
||||
endz = 1.f/iz;
|
||||
endu = uz*endz;
|
||||
endv = vz*endz;
|
||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||
u = (INT64)(startu) + viewx;
|
||||
v = (INT64)(startv) + viewy;
|
||||
|
||||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++);
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
}
|
||||
startu = endu;
|
||||
startv = endv;
|
||||
width -= SPANSIZE;
|
||||
}
|
||||
if (width > 0)
|
||||
{
|
||||
if (width == 1)
|
||||
{
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++);
|
||||
}
|
||||
else
|
||||
{
|
||||
double left = width;
|
||||
iz += ds_szp->x * left;
|
||||
uz += ds_sup->x * left;
|
||||
vz += ds_svp->x * left;
|
||||
|
||||
endz = 1.f/iz;
|
||||
endu = uz*endz;
|
||||
endv = vz*endz;
|
||||
left = 1.f/left;
|
||||
stepu = (INT64)((endu - startu) * left);
|
||||
stepv = (INT64)((endv - startv) * left);
|
||||
u = (INT64)(startu) + viewx;
|
||||
v = (INT64)(startv) + viewy;
|
||||
|
||||
for (; width != 0; width--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++);
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // NOWATER
|
||||
|
||||
void R_DrawTiltedSplat_8(void)
|
||||
{
|
||||
// x1, x2 = ds_x1, ds_x2
|
||||
|
@ -1098,22 +1074,22 @@ void R_DrawTiltedSplat_8(void)
|
|||
double endz, endu, endv;
|
||||
UINT32 stepu, stepv;
|
||||
|
||||
iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx);
|
||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||
|
||||
// Lighting is simple. It's just linear interpolation from start to end
|
||||
{
|
||||
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
|
||||
float lightstart, lightend;
|
||||
|
||||
lightend = (iz + ds_sz.x*width) * planelightfloat;
|
||||
lightend = (iz + ds_szp->x*width) * planelightfloat;
|
||||
lightstart = iz * planelightfloat;
|
||||
|
||||
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
|
||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
|
||||
}
|
||||
|
||||
uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx);
|
||||
vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx);
|
||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
source = ds_source;
|
||||
|
@ -1130,32 +1106,14 @@ void R_DrawTiltedSplat_8(void)
|
|||
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
val = source[((y * ds_flatwidth) + x)];
|
||||
}
|
||||
else
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = colormap[val];
|
||||
|
||||
dest++;
|
||||
iz += ds_sz.x;
|
||||
uz += ds_su.x;
|
||||
vz += ds_sv.x;
|
||||
iz += ds_szp->x;
|
||||
uz += ds_sup->x;
|
||||
vz += ds_svp->x;
|
||||
} while (--width >= 0);
|
||||
#else
|
||||
#define SPANSIZE 16
|
||||
|
@ -1165,9 +1123,9 @@ void R_DrawTiltedSplat_8(void)
|
|||
startu = uz*startz;
|
||||
startv = vz*startz;
|
||||
|
||||
izstep = ds_sz.x * SPANSIZE;
|
||||
uzstep = ds_su.x * SPANSIZE;
|
||||
vzstep = ds_sv.x * SPANSIZE;
|
||||
izstep = ds_szp->x * SPANSIZE;
|
||||
uzstep = ds_sup->x * SPANSIZE;
|
||||
vzstep = ds_svp->x * SPANSIZE;
|
||||
//x1 = 0;
|
||||
width++;
|
||||
|
||||
|
@ -1188,23 +1146,6 @@ void R_DrawTiltedSplat_8(void)
|
|||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
val = source[((y * ds_flatwidth) + x)];
|
||||
}
|
||||
else
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = colormap[val];
|
||||
|
@ -1223,23 +1164,6 @@ void R_DrawTiltedSplat_8(void)
|
|||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
val = source[((y * ds_flatwidth) + x)];
|
||||
}
|
||||
else
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = colormap[val];
|
||||
|
@ -1247,9 +1171,9 @@ void R_DrawTiltedSplat_8(void)
|
|||
else
|
||||
{
|
||||
double left = width;
|
||||
iz += ds_sz.x * left;
|
||||
uz += ds_su.x * left;
|
||||
vz += ds_sv.x * left;
|
||||
iz += ds_szp->x * left;
|
||||
uz += ds_sup->x * left;
|
||||
vz += ds_svp->x * left;
|
||||
|
||||
endz = 1.f/iz;
|
||||
endu = uz*endz;
|
||||
|
@ -1264,24 +1188,6 @@ void R_DrawTiltedSplat_8(void)
|
|||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
val = source[((y * ds_flatwidth) + x)];
|
||||
}
|
||||
else
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = colormap[val];
|
||||
dest++;
|
||||
|
@ -1321,42 +1227,13 @@ void R_DrawSplat_8 (void)
|
|||
// bit per power of two (obviously)
|
||||
// Ok, because I was able to eliminate the variable spot below, this function is now FASTER
|
||||
// than the original span renderer. Whodathunkit?
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
xposition <<= nflatshiftup; yposition <<= nflatshiftup;
|
||||
xstep <<= nflatshiftup; ystep <<= nflatshiftup;
|
||||
}
|
||||
|
||||
source = ds_source;
|
||||
colormap = ds_colormap;
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
while (count-- && dest <= deststop)
|
||||
{
|
||||
fixed_t x = (xposition >> FRACBITS);
|
||||
fixed_t y = (yposition >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
val = source[((y * ds_flatwidth) + x)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = colormap[val];
|
||||
dest++;
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (count >= 8)
|
||||
{
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
|
@ -1441,7 +1318,6 @@ void R_DrawSplat_8 (void)
|
|||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief The R_DrawTranslucentSplat_8 function
|
||||
Just like R_DrawSplat_8, but is translucent!
|
||||
|
@ -1470,42 +1346,13 @@ void R_DrawTranslucentSplat_8 (void)
|
|||
// bit per power of two (obviously)
|
||||
// Ok, because I was able to eliminate the variable spot below, this function is now FASTER
|
||||
// than the original span renderer. Whodathunkit?
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
xposition <<= nflatshiftup; yposition <<= nflatshiftup;
|
||||
xstep <<= nflatshiftup; ystep <<= nflatshiftup;
|
||||
}
|
||||
|
||||
source = ds_source;
|
||||
colormap = ds_colormap;
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
while (count-- && dest <= deststop)
|
||||
{
|
||||
fixed_t x = (xposition >> FRACBITS);
|
||||
fixed_t y = (yposition >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
val = source[((y * ds_flatwidth) + x)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = *(ds_transmap + (colormap[val] << 8) + *dest);
|
||||
dest++;
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (count >= 8)
|
||||
{
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
|
@ -1572,10 +1419,9 @@ void R_DrawTranslucentSplat_8 (void)
|
|||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief The R_DrawTranslucentSpan_8 function
|
||||
Draws the actual span with translucent.
|
||||
Draws the actual span with translucency.
|
||||
*/
|
||||
void R_DrawTranslucentSpan_8 (void)
|
||||
{
|
||||
|
@ -1601,41 +1447,13 @@ void R_DrawTranslucentSpan_8 (void)
|
|||
// bit per power of two (obviously)
|
||||
// Ok, because I was able to eliminate the variable spot below, this function is now FASTER
|
||||
// than the original span renderer. Whodathunkit?
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
xposition <<= nflatshiftup; yposition <<= nflatshiftup;
|
||||
xstep <<= nflatshiftup; ystep <<= nflatshiftup;
|
||||
}
|
||||
|
||||
source = ds_source;
|
||||
colormap = ds_colormap;
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
while (count-- && dest <= deststop)
|
||||
{
|
||||
fixed_t x = (xposition >> FRACBITS);
|
||||
fixed_t y = (yposition >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
val = ((y * ds_flatwidth) + x);
|
||||
*dest = *(ds_transmap + (colormap[source[val]] << 8) + *dest);
|
||||
dest++;
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (count >= 8)
|
||||
{
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
|
@ -1685,25 +1503,20 @@ void R_DrawTranslucentSpan_8 (void)
|
|||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NOWATER
|
||||
void R_DrawTranslucentWaterSpan_8(void)
|
||||
{
|
||||
fixed_t xposition;
|
||||
fixed_t yposition;
|
||||
fixed_t xstep, ystep;
|
||||
UINT32 xposition;
|
||||
UINT32 yposition;
|
||||
UINT32 xstep, ystep;
|
||||
|
||||
UINT8 *source;
|
||||
UINT8 *colormap;
|
||||
UINT8 *dest;
|
||||
UINT8 *dsrc;
|
||||
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
|
||||
size_t count = (ds_x2 - ds_x1 + 1);
|
||||
|
||||
xposition = ds_xfrac; yposition = (ds_yfrac + ds_waterofs);
|
||||
xstep = ds_xstep; ystep = ds_ystep;
|
||||
size_t count;
|
||||
|
||||
// SoM: we only need 6 bits for the integer part (0 thru 63) so the rest
|
||||
// can be used for the fraction part. This allows calculation of the memory address in the
|
||||
|
@ -1712,46 +1525,60 @@ void R_DrawTranslucentWaterSpan_8(void)
|
|||
// bit per power of two (obviously)
|
||||
// Ok, because I was able to eliminate the variable spot below, this function is now FASTER
|
||||
// than the original span renderer. Whodathunkit?
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
xposition <<= nflatshiftup; yposition <<= nflatshiftup;
|
||||
xstep <<= nflatshiftup; ystep <<= nflatshiftup;
|
||||
}
|
||||
xposition = ds_xfrac << nflatshiftup; yposition = (ds_yfrac + ds_waterofs) << nflatshiftup;
|
||||
xstep = ds_xstep << nflatshiftup; ystep = ds_ystep << nflatshiftup;
|
||||
|
||||
source = ds_source;
|
||||
colormap = ds_colormap;
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1;
|
||||
count = ds_x2 - ds_x1 + 1;
|
||||
|
||||
if (!ds_powersoftwo)
|
||||
while (count >= 8)
|
||||
{
|
||||
while (count-- && dest <= deststop)
|
||||
{
|
||||
fixed_t x = (xposition >> FRACBITS);
|
||||
fixed_t y = (yposition >> FRACBITS);
|
||||
|
||||
// Carefully align all of my Friends.
|
||||
if (x < 0)
|
||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
||||
if (y < 0)
|
||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
||||
|
||||
x %= ds_flatwidth;
|
||||
y %= ds_flatheight;
|
||||
|
||||
*dest++ = colormap[*(ds_transmap + (source[((y * ds_flatwidth) + x)] << 8) + *dsrc++)];
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
// have the uber complicated math to calculate it now, so that was a memory write we didn't
|
||||
// need!
|
||||
dest[0] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (count-- && dest <= deststop)
|
||||
{
|
||||
*dest++ = colormap[*(ds_transmap + (source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
|
||||
dest[1] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[2] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[3] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[4] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[5] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[6] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[7] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest += 8;
|
||||
count -= 8;
|
||||
}
|
||||
while (count--)
|
||||
{
|
||||
*dest++ = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1880,7 +1707,7 @@ void R_DrawColumnShadowed_8(void)
|
|||
|
||||
if (dc_yh > realyh)
|
||||
dc_yh = realyh;
|
||||
basecolfunc(); // R_DrawColumn_8 for the appropriate architecture
|
||||
(colfuncs[BASEDRAWFUNC])(); // R_DrawColumn_8 for the appropriate architecture
|
||||
if (solid)
|
||||
dc_yl = bheight;
|
||||
else
|
||||
|
@ -1890,5 +1717,5 @@ void R_DrawColumnShadowed_8(void)
|
|||
}
|
||||
dc_yh = realyh;
|
||||
if (dc_yl <= realyh)
|
||||
walldrawerfunc(); // R_DrawWallColumn_8 for the appropriate architecture
|
||||
(colfuncs[BASEDRAWFUNC])(); // R_DrawWallColumn_8 for the appropriate architecture
|
||||
}
|
||||
|
|
1044
src/r_draw8_npo2.c
Normal file
1044
src/r_draw8_npo2.c
Normal file
File diff suppressed because it is too large
Load diff
28
src/r_main.c
28
src/r_main.c
|
@ -1008,11 +1008,13 @@ static void R_PortalFrame(portal_t *portal)
|
|||
if (portal->clipline != -1)
|
||||
{
|
||||
portalclipline = &lines[portal->clipline];
|
||||
portalcullsector = portalclipline->frontsector;
|
||||
viewsector = portalclipline->frontsector;
|
||||
}
|
||||
else
|
||||
{
|
||||
portalclipline = NULL;
|
||||
portalcullsector = NULL;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
}
|
||||
}
|
||||
|
@ -1210,30 +1212,4 @@ void R_RegisterEngineStuff(void)
|
|||
CV_RegisterVar(&cv_maxportals);
|
||||
|
||||
CV_RegisterVar(&cv_movebob);
|
||||
|
||||
#ifdef HWRENDER
|
||||
// GL-specific Commands
|
||||
CV_RegisterVar(&cv_grgammablue);
|
||||
CV_RegisterVar(&cv_grgammagreen);
|
||||
CV_RegisterVar(&cv_grgammared);
|
||||
CV_RegisterVar(&cv_grfovchange);
|
||||
CV_RegisterVar(&cv_grfog);
|
||||
CV_RegisterVar(&cv_grfogcolor);
|
||||
CV_RegisterVar(&cv_grsoftwarefog);
|
||||
#ifdef ALAM_LIGHTING
|
||||
CV_RegisterVar(&cv_grstaticlighting);
|
||||
CV_RegisterVar(&cv_grdynamiclighting);
|
||||
CV_RegisterVar(&cv_grcoronas);
|
||||
CV_RegisterVar(&cv_grcoronasize);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_grmodelinterpolation);
|
||||
CV_RegisterVar(&cv_grmodels);
|
||||
CV_RegisterVar(&cv_grspritebillboarding);
|
||||
CV_RegisterVar(&cv_grskydome);
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
HWR_AddCommands();
|
||||
#endif
|
||||
}
|
||||
|
|
338
src/r_plane.c
338
src/r_plane.c
|
@ -116,6 +116,35 @@ void R_InitPlanes(void)
|
|||
// FIXME: unused
|
||||
}
|
||||
|
||||
//
|
||||
// Water ripple effect!!
|
||||
// Needs the height of the plane, and the vertical position of the span.
|
||||
// Sets ripple_xfrac and ripple_yfrac, added to ds_xfrac and ds_yfrac, if the span is not tilted.
|
||||
//
|
||||
|
||||
#ifndef NOWATER
|
||||
INT32 ds_bgofs;
|
||||
INT32 ds_waterofs;
|
||||
|
||||
static INT32 wtofs=0;
|
||||
static boolean itswater;
|
||||
static fixed_t ripple_xfrac;
|
||||
static fixed_t ripple_yfrac;
|
||||
|
||||
static void R_PlaneRipple(visplane_t *plane, INT32 y, fixed_t plheight)
|
||||
{
|
||||
fixed_t distance = FixedMul(plheight, yslope[y]);
|
||||
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
|
||||
// ripples da water texture
|
||||
angle_t angle = (plane->viewangle + plane->plangle)>>ANGLETOFINESHIFT;
|
||||
ds_bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
|
||||
|
||||
angle = (angle + 2048) & 8191; // 90 degrees
|
||||
ripple_xfrac = FixedMul(FINECOSINE(angle), (ds_bgofs<<FRACBITS));
|
||||
ripple_yfrac = FixedMul(FINESINE(angle), (ds_bgofs<<FRACBITS));
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// R_MapPlane
|
||||
//
|
||||
|
@ -129,14 +158,6 @@ void R_InitPlanes(void)
|
|||
// viewcos
|
||||
// viewheight
|
||||
|
||||
#ifndef NOWATER
|
||||
INT32 ds_bgofs;
|
||||
INT32 ds_waterofs;
|
||||
|
||||
static INT32 wtofs=0;
|
||||
static boolean itswater;
|
||||
#endif
|
||||
|
||||
void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||
{
|
||||
angle_t angle, planecos, planesin;
|
||||
|
@ -181,14 +202,22 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
|||
#ifndef NOWATER
|
||||
if (itswater)
|
||||
{
|
||||
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
|
||||
// ripples da water texture
|
||||
ds_bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
|
||||
angle = (currentplane->viewangle + currentplane->plangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
|
||||
// Needed for ds_bgofs
|
||||
R_PlaneRipple(currentplane, y, planeheight);
|
||||
|
||||
angle = (angle + 2048) & 8191; // 90 degrees
|
||||
ds_xfrac += FixedMul(FINECOSINE(angle), (ds_bgofs<<FRACBITS));
|
||||
ds_yfrac += FixedMul(FINESINE(angle), (ds_bgofs<<FRACBITS));
|
||||
#ifdef ESLOPE
|
||||
if (currentplane->slope)
|
||||
{
|
||||
ds_sup = &ds_su[y];
|
||||
ds_svp = &ds_sv[y];
|
||||
ds_szp = &ds_sz[y];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ds_xfrac += ripple_xfrac;
|
||||
ds_yfrac += ripple_yfrac;
|
||||
}
|
||||
|
||||
if (y+ds_bgofs>=viewheight)
|
||||
ds_bgofs = viewheight-y-1;
|
||||
|
@ -587,8 +616,7 @@ void R_DrawPlanes(void)
|
|||
|
||||
// Note: are these two lines really needed?
|
||||
// R_DrawSinglePlane and R_DrawSkyPlane do span/column drawer resets themselves anyway
|
||||
spanfunc = basespanfunc;
|
||||
wallcolfunc = walldrawerfunc;
|
||||
spanfunc = spanfuncs[BASEDRAWFUNC];
|
||||
|
||||
for (i = 0; i < MAXVISPLANES; i++, pl++)
|
||||
{
|
||||
|
@ -622,7 +650,7 @@ static void R_DrawSkyPlane(visplane_t *pl)
|
|||
|
||||
// Reset column drawer function (note: couldn't we just call walldrawerfunc directly?)
|
||||
// (that is, unless we'll need to switch drawers in future for some reason)
|
||||
wallcolfunc = walldrawerfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
|
||||
// use correct aspect ratio scale
|
||||
dc_iscale = skyscale;
|
||||
|
@ -648,7 +676,7 @@ static void R_DrawSkyPlane(visplane_t *pl)
|
|||
dc_source =
|
||||
R_GetColumn(texturetranslation[skytexture],
|
||||
-angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
|
||||
wallcolfunc();
|
||||
colfunc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -833,6 +861,99 @@ static UINT8 *R_GetTextureFlat(levelflat_t *levelflat, boolean leveltexture, boo
|
|||
return flat;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
static void R_SlopeVectors(visplane_t *pl, INT32 i, float fudge)
|
||||
{
|
||||
// Potentially override other stuff for now cus we're mean. :< But draw a slope plane!
|
||||
// I copied ZDoom's code and adapted it to SRB2... -Red
|
||||
floatv3_t p, m, n;
|
||||
float ang;
|
||||
float vx, vy, vz;
|
||||
// compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly
|
||||
// use this as a temp var to store P_GetZAt's return value each time
|
||||
fixed_t temp;
|
||||
|
||||
vx = FIXED_TO_FLOAT(pl->viewx+xoffs);
|
||||
vy = FIXED_TO_FLOAT(pl->viewy-yoffs);
|
||||
vz = FIXED_TO_FLOAT(pl->viewz);
|
||||
|
||||
temp = P_GetZAt(pl->slope, pl->viewx, pl->viewy);
|
||||
zeroheight = FIXED_TO_FLOAT(temp);
|
||||
|
||||
// p is the texture origin in view space
|
||||
// Don't add in the offsets at this stage, because doing so can result in
|
||||
// errors if the flat is rotated.
|
||||
ang = ANG2RAD(ANGLE_270 - pl->viewangle);
|
||||
p.x = vx * cos(ang) - vy * sin(ang);
|
||||
p.z = vx * sin(ang) + vy * cos(ang);
|
||||
temp = P_GetZAt(pl->slope, -xoffs, yoffs);
|
||||
p.y = FIXED_TO_FLOAT(temp) - vz;
|
||||
|
||||
// m is the v direction vector in view space
|
||||
ang = ANG2RAD(ANGLE_180 - (pl->viewangle + pl->plangle));
|
||||
m.x = cos(ang);
|
||||
m.z = sin(ang);
|
||||
|
||||
// n is the u direction vector in view space
|
||||
n.x = sin(ang);
|
||||
n.z = -cos(ang);
|
||||
|
||||
ang = ANG2RAD(pl->plangle);
|
||||
temp = P_GetZAt(pl->slope, pl->viewx + FLOAT_TO_FIXED(sin(ang)), pl->viewy + FLOAT_TO_FIXED(cos(ang)));
|
||||
m.y = FIXED_TO_FLOAT(temp) - zeroheight;
|
||||
temp = P_GetZAt(pl->slope, pl->viewx + FLOAT_TO_FIXED(cos(ang)), pl->viewy - FLOAT_TO_FIXED(sin(ang)));
|
||||
n.y = FIXED_TO_FLOAT(temp) - zeroheight;
|
||||
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
m.x /= fudge;
|
||||
m.y /= fudge;
|
||||
m.z /= fudge;
|
||||
|
||||
n.x *= fudge;
|
||||
n.y *= fudge;
|
||||
n.z *= fudge;
|
||||
}
|
||||
|
||||
// Eh. I tried making this stuff fixed-point and it exploded on me. Here's a macro for the only floating-point vector function I recall using.
|
||||
#define CROSS(d, v1, v2) \
|
||||
d.x = (v1.y * v2.z) - (v1.z * v2.y);\
|
||||
d.y = (v1.z * v2.x) - (v1.x * v2.z);\
|
||||
d.z = (v1.x * v2.y) - (v1.y * v2.x)
|
||||
CROSS(ds_su[i], p, m);
|
||||
CROSS(ds_sv[i], p, n);
|
||||
CROSS(ds_sz[i], m, n);
|
||||
#undef CROSS
|
||||
|
||||
ds_su[i].z *= focallengthf;
|
||||
ds_sv[i].z *= focallengthf;
|
||||
ds_sz[i].z *= focallengthf;
|
||||
|
||||
// Premultiply the texture vectors with the scale factors
|
||||
#define SFMULT 65536.f
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
ds_su[i].x *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_su[i].y *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_su[i].z *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_sv[i].x *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_sv[i].y *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_sv[i].z *= (SFMULT * (1<<nflatshiftup));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lactozilla: I'm essentially multiplying the vectors by FRACUNIT...
|
||||
ds_su[i].x *= SFMULT;
|
||||
ds_su[i].y *= SFMULT;
|
||||
ds_su[i].z *= SFMULT;
|
||||
ds_sv[i].x *= SFMULT;
|
||||
ds_sv[i].y *= SFMULT;
|
||||
ds_sv[i].z *= SFMULT;
|
||||
}
|
||||
#undef SFMULT
|
||||
}
|
||||
#endif // ESLOPE
|
||||
|
||||
void R_DrawSinglePlane(visplane_t *pl)
|
||||
{
|
||||
UINT8 *flat;
|
||||
|
@ -842,6 +963,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
ffloor_t *rover;
|
||||
levelflat_t *levelflat;
|
||||
int type;
|
||||
int spanfunctype = BASEDRAWFUNC;
|
||||
|
||||
if (!(pl->minx <= pl->maxx))
|
||||
return;
|
||||
|
@ -856,11 +978,12 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
#ifndef NOWATER
|
||||
itswater = false;
|
||||
#endif
|
||||
spanfunc = basespanfunc;
|
||||
spanfunc = spanfuncs[BASEDRAWFUNC];
|
||||
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
if (pl->polyobj && pl->polyobj->translucency != 0) {
|
||||
spanfunc = R_DrawTranslucentSpan_8;
|
||||
if (pl->polyobj && pl->polyobj->translucency != 0)
|
||||
{
|
||||
spanfunctype = SPANDRAWFUNC_TRANS;
|
||||
|
||||
// Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red)
|
||||
if (pl->polyobj->translucency >= 10)
|
||||
|
@ -868,10 +991,10 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
else if (pl->polyobj->translucency > 0)
|
||||
ds_transmap = transtables + ((pl->polyobj->translucency-1)<<FF_TRANSSHIFT);
|
||||
else // Opaque, but allow transparent flat pixels
|
||||
spanfunc = splatfunc;
|
||||
spanfunctype = SPANDRAWFUNC_SPLAT;
|
||||
|
||||
#ifdef SHITPLANESPARENCY
|
||||
if ((spanfunc == splatfunc) != (pl->extra_colormap && (pl->extra_colormap->fog & 4)))
|
||||
if ((spanfunctype == SPANDRAWFUNC_SPLAT) != (pl->extra_colormap && (pl->extra_colormap->fog & 4)))
|
||||
#else
|
||||
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
||||
#endif
|
||||
|
@ -902,7 +1025,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
|
||||
if (pl->ffloor->flags & FF_TRANSLUCENT)
|
||||
{
|
||||
spanfunc = R_DrawTranslucentSpan_8;
|
||||
spanfunctype = SPANDRAWFUNC_TRANS;
|
||||
|
||||
// Hacked up support for alpha value in software mode Tails 09-24-2002
|
||||
if (pl->ffloor->alpha < 12)
|
||||
|
@ -926,10 +1049,10 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
else if (pl->ffloor->alpha < 243)
|
||||
ds_transmap = transtables + ((tr_trans10-1)<<FF_TRANSSHIFT);
|
||||
else // Opaque, but allow transparent flat pixels
|
||||
spanfunc = splatfunc;
|
||||
spanfunctype = SPANDRAWFUNC_SPLAT;
|
||||
|
||||
#ifdef SHITPLANESPARENCY
|
||||
if ((spanfunc == splatfunc) != (pl->extra_colormap && (pl->extra_colormap->fog & 4)))
|
||||
if ((spanfunctype == SPANDRAWFUNC_SPLAT) != (pl->extra_colormap && (pl->extra_colormap->fog & 4)))
|
||||
#else
|
||||
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
||||
#endif
|
||||
|
@ -939,24 +1062,20 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
}
|
||||
else if (pl->ffloor->flags & FF_FOG)
|
||||
{
|
||||
spanfunc = R_DrawFogSpan_8;
|
||||
spanfunctype = SPANDRAWFUNC_FOG;
|
||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||
}
|
||||
else light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||
|
||||
#ifndef NOWATER
|
||||
if (pl->ffloor->flags & FF_RIPPLE
|
||||
#ifdef ESLOPE
|
||||
&& !pl->slope
|
||||
#endif
|
||||
)
|
||||
if (pl->ffloor->flags & FF_RIPPLE)
|
||||
{
|
||||
INT32 top, bottom;
|
||||
|
||||
itswater = true;
|
||||
if (spanfunc == R_DrawTranslucentSpan_8)
|
||||
if (spanfunctype == SPANDRAWFUNC_TRANS)
|
||||
{
|
||||
spanfunc = R_DrawTranslucentWaterSpan_8;
|
||||
spanfunctype = SPANDRAWFUNC_WATER;
|
||||
|
||||
// Copy the current scene, ugh
|
||||
top = pl->high-8;
|
||||
|
@ -1007,8 +1126,6 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
R_CheckFlatLength(W_LumpLength(levelflat->u.flat.lumpnum));
|
||||
// Raw flats always have dimensions that are powers-of-two numbers.
|
||||
ds_powersoftwo = true;
|
||||
if (spanfunc == basespanfunc)
|
||||
spanfunc = mmxspanfunc;
|
||||
break;
|
||||
default:
|
||||
switch (type)
|
||||
|
@ -1031,11 +1148,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
}
|
||||
// Check if this texture or patch has power-of-two dimensions.
|
||||
if (R_CheckPowersOfTwo())
|
||||
{
|
||||
R_CheckFlatLength(ds_flatwidth * ds_flatheight);
|
||||
if (spanfunc == basespanfunc)
|
||||
spanfunc = mmxspanfunc;
|
||||
}
|
||||
}
|
||||
|
||||
if (light >= LIGHTLEVELS)
|
||||
|
@ -1045,25 +1158,18 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
light = 0;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (pl->slope) {
|
||||
// Potentially override other stuff for now cus we're mean. :< But draw a slope plane!
|
||||
// I copied ZDoom's code and adapted it to SRB2... -Red
|
||||
floatv3_t p, m, n;
|
||||
float ang;
|
||||
float vx, vy, vz;
|
||||
float fudge = 0;
|
||||
// compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly
|
||||
// use this as a temp var to store P_GetZAt's return value each time
|
||||
fixed_t temp;
|
||||
|
||||
if (pl->slope)
|
||||
{
|
||||
float fudgecanyon = 0;
|
||||
angle_t hack = (pl->plangle & (ANGLE_90-1));
|
||||
|
||||
yoffs *= 1;
|
||||
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
fixed_t temp;
|
||||
// Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -Red
|
||||
fudge = ((1<<nflatshiftup)+1.0f)/(1<<nflatshiftup);
|
||||
fudgecanyon = ((1<<nflatshiftup)+1.0f)/(1<<nflatshiftup);
|
||||
if (hack)
|
||||
{
|
||||
/*
|
||||
|
@ -1105,95 +1211,50 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
xoffs -= (pl->slope->o.x + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1);
|
||||
yoffs += (pl->slope->o.y + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1);
|
||||
}
|
||||
xoffs = (fixed_t)(xoffs*fudge);
|
||||
yoffs = (fixed_t)(yoffs/fudge);
|
||||
xoffs = (fixed_t)(xoffs*fudgecanyon);
|
||||
yoffs = (fixed_t)(yoffs/fudgecanyon);
|
||||
}
|
||||
|
||||
vx = FIXED_TO_FLOAT(pl->viewx+xoffs);
|
||||
vy = FIXED_TO_FLOAT(pl->viewy-yoffs);
|
||||
vz = FIXED_TO_FLOAT(pl->viewz);
|
||||
ds_sup = &ds_su[0];
|
||||
ds_svp = &ds_sv[0];
|
||||
ds_szp = &ds_sz[0];
|
||||
|
||||
temp = P_GetZAt(pl->slope, pl->viewx, pl->viewy);
|
||||
zeroheight = FIXED_TO_FLOAT(temp);
|
||||
|
||||
// p is the texture origin in view space
|
||||
// Don't add in the offsets at this stage, because doing so can result in
|
||||
// errors if the flat is rotated.
|
||||
ang = ANG2RAD(ANGLE_270 - pl->viewangle);
|
||||
p.x = vx * cos(ang) - vy * sin(ang);
|
||||
p.z = vx * sin(ang) + vy * cos(ang);
|
||||
temp = P_GetZAt(pl->slope, -xoffs, yoffs);
|
||||
p.y = FIXED_TO_FLOAT(temp) - vz;
|
||||
|
||||
// m is the v direction vector in view space
|
||||
ang = ANG2RAD(ANGLE_180 - (pl->viewangle + pl->plangle));
|
||||
m.x = cos(ang);
|
||||
m.z = sin(ang);
|
||||
|
||||
// n is the u direction vector in view space
|
||||
n.x = sin(ang);
|
||||
n.z = -cos(ang);
|
||||
|
||||
ang = ANG2RAD(pl->plangle);
|
||||
temp = P_GetZAt(pl->slope, pl->viewx + FLOAT_TO_FIXED(sin(ang)), pl->viewy + FLOAT_TO_FIXED(cos(ang)));
|
||||
m.y = FIXED_TO_FLOAT(temp) - zeroheight;
|
||||
temp = P_GetZAt(pl->slope, pl->viewx + FLOAT_TO_FIXED(cos(ang)), pl->viewy - FLOAT_TO_FIXED(sin(ang)));
|
||||
n.y = FIXED_TO_FLOAT(temp) - zeroheight;
|
||||
|
||||
if (ds_powersoftwo)
|
||||
#ifndef NOWATER
|
||||
if (itswater)
|
||||
{
|
||||
m.x /= fudge;
|
||||
m.y /= fudge;
|
||||
m.z /= fudge;
|
||||
INT32 i;
|
||||
fixed_t plheight = abs(P_GetZAt(pl->slope, pl->viewx, pl->viewy) - pl->viewz);
|
||||
fixed_t rxoffs = xoffs;
|
||||
fixed_t ryoffs = yoffs;
|
||||
|
||||
n.x *= fudge;
|
||||
n.y *= fudge;
|
||||
n.z *= fudge;
|
||||
R_PlaneBounds(pl);
|
||||
|
||||
for (i = pl->high; i < pl->low; i++)
|
||||
{
|
||||
R_PlaneRipple(pl, i, plheight);
|
||||
xoffs = rxoffs + ripple_xfrac;
|
||||
yoffs = ryoffs + ripple_yfrac;
|
||||
R_SlopeVectors(pl, i, fudgecanyon);
|
||||
}
|
||||
|
||||
// Eh. I tried making this stuff fixed-point and it exploded on me. Here's a macro for the only floating-point vector function I recall using.
|
||||
#define CROSS(d, v1, v2) \
|
||||
d.x = (v1.y * v2.z) - (v1.z * v2.y);\
|
||||
d.y = (v1.z * v2.x) - (v1.x * v2.z);\
|
||||
d.z = (v1.x * v2.y) - (v1.y * v2.x)
|
||||
CROSS(ds_su, p, m);
|
||||
CROSS(ds_sv, p, n);
|
||||
CROSS(ds_sz, m, n);
|
||||
#undef CROSS
|
||||
|
||||
ds_su.z *= focallengthf;
|
||||
ds_sv.z *= focallengthf;
|
||||
ds_sz.z *= focallengthf;
|
||||
|
||||
// Premultiply the texture vectors with the scale factors
|
||||
#define SFMULT 65536.f
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
ds_su.x *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_su.y *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_su.z *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_sv.x *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_sv.y *= (SFMULT * (1<<nflatshiftup));
|
||||
ds_sv.z *= (SFMULT * (1<<nflatshiftup));
|
||||
xoffs = rxoffs;
|
||||
yoffs = ryoffs;
|
||||
}
|
||||
else
|
||||
{
|
||||
// I'm essentially multiplying the vectors by FRACUNIT...
|
||||
ds_su.x *= SFMULT;
|
||||
ds_su.y *= SFMULT;
|
||||
ds_su.z *= SFMULT;
|
||||
ds_sv.x *= SFMULT;
|
||||
ds_sv.y *= SFMULT;
|
||||
ds_sv.z *= SFMULT;
|
||||
}
|
||||
#undef SFMULT
|
||||
#endif
|
||||
R_SlopeVectors(pl, 0, fudgecanyon);
|
||||
|
||||
if (spanfunc == R_DrawTranslucentSpan_8)
|
||||
spanfunc = R_DrawTiltedTranslucentSpan_8;
|
||||
else if (spanfunc == splatfunc)
|
||||
spanfunc = R_DrawTiltedSplat_8;
|
||||
#ifndef NOWATER
|
||||
if (itswater && (spanfunctype == SPANDRAWFUNC_WATER))
|
||||
spanfunctype = SPANDRAWFUNC_TILTEDWATER;
|
||||
else
|
||||
spanfunc = R_DrawTiltedSpan_8;
|
||||
#endif
|
||||
if (spanfunctype == SPANDRAWFUNC_TRANS)
|
||||
spanfunctype = SPANDRAWFUNC_TILTEDTRANS;
|
||||
else if (spanfunctype == SPANDRAWFUNC_SPLAT)
|
||||
spanfunctype = SPANDRAWFUNC_TILTEDSPLAT;
|
||||
else
|
||||
spanfunctype = SPANDRAWFUNC_TILTED;
|
||||
|
||||
planezlight = scalelight[light];
|
||||
} else
|
||||
|
@ -1201,6 +1262,17 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
|
||||
planezlight = zlight[light];
|
||||
|
||||
// Use the correct span drawer depending on the powers-of-twoness
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
if (spanfuncs_npo2[spanfunctype])
|
||||
spanfunc = spanfuncs_npo2[spanfunctype];
|
||||
else
|
||||
spanfunc = spanfuncs[spanfunctype];
|
||||
}
|
||||
else
|
||||
spanfunc = spanfuncs[spanfunctype];
|
||||
|
||||
// set the maximum value for unsigned
|
||||
pl->top[pl->maxx+1] = 0xffff;
|
||||
pl->top[pl->minx-1] = 0xffff;
|
||||
|
@ -1240,11 +1312,11 @@ a 'smoothing' of the texture while
|
|||
using the palette colors.
|
||||
*/
|
||||
#ifdef QUINCUNX
|
||||
if (spanfunc == R_DrawSpan_8)
|
||||
if (spanfunc == spanfuncs[BASEDRAWFUNC])
|
||||
{
|
||||
INT32 i;
|
||||
ds_transmap = transtables + ((tr_trans50-1)<<FF_TRANSSHIFT);
|
||||
spanfunc = R_DrawTranslucentSpan_8;
|
||||
spanfunc = spanfuncs[SPANDRAWFUNC_TRANS];
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
xoffs = pl->xoffs;
|
||||
|
|
|
@ -26,6 +26,7 @@ UINT8 portalrender; /**< When rendering a portal, it establishes the depth of
|
|||
portal_t *portal_base, *portal_cap;
|
||||
|
||||
line_t *portalclipline;
|
||||
sector_t *portalcullsector;
|
||||
INT32 portalclipstart, portalclipend;
|
||||
|
||||
boolean portalline; // is curline a portal seg?
|
||||
|
|
|
@ -45,6 +45,7 @@ extern portal_t* portal_cap;
|
|||
extern UINT8 portalrender;
|
||||
|
||||
extern line_t *portalclipline;
|
||||
extern sector_t *portalcullsector;
|
||||
extern INT32 portalclipstart, portalclipend;
|
||||
|
||||
void Portal_InitList (void);
|
||||
|
|
50
src/r_segs.c
50
src/r_segs.c
|
@ -177,20 +177,20 @@ static void R_DrawWallSplats(void)
|
|||
switch (splat->flags & SPLATDRAWMODE_MASK)
|
||||
{
|
||||
case SPLATDRAWMODE_OPAQUE:
|
||||
colfunc = basecolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
break;
|
||||
case SPLATDRAWMODE_TRANS:
|
||||
if (!cv_translucency.value)
|
||||
colfunc = basecolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
else
|
||||
{
|
||||
dc_transmap = transtables + ((tr_trans50 - 1)<<FF_TRANSSHIFT);
|
||||
colfunc = fuzzcolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||
}
|
||||
|
||||
break;
|
||||
case SPLATDRAWMODE_SHADE:
|
||||
colfunc = shadecolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_SHADE];
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ static void R_DrawWallSplats(void)
|
|||
}
|
||||
} // next splat
|
||||
|
||||
colfunc = basecolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
}
|
||||
|
||||
#endif //WALLSPLATS
|
||||
|
@ -270,10 +270,10 @@ static void R_Render2sidedMultiPatchColumn(column_t *column)
|
|||
{
|
||||
dc_source = (UINT8 *)column + 3;
|
||||
|
||||
if (colfunc == wallcolfunc)
|
||||
twosmultipatchfunc();
|
||||
else if (colfunc == fuzzcolfunc)
|
||||
twosmultipatchtransfunc();
|
||||
if (colfunc == colfuncs[BASEDRAWFUNC])
|
||||
(colfuncs[COLDRAWFUNC_TWOSMULTIPATCH])();
|
||||
else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY])
|
||||
(colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS])();
|
||||
else
|
||||
colfunc();
|
||||
}
|
||||
|
@ -327,15 +327,15 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
case 907:
|
||||
case 908:
|
||||
dc_transmap = transtables + ((ldef->special-900)<<FF_TRANSSHIFT);
|
||||
colfunc = fuzzcolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||
break;
|
||||
case 909:
|
||||
colfunc = R_DrawFogColumn_8;
|
||||
colfunc = colfuncs[COLDRAWFUNC_FOG];
|
||||
windowtop = frontsector->ceilingheight;
|
||||
windowbottom = frontsector->floorheight;
|
||||
break;
|
||||
default:
|
||||
colfunc = wallcolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
return;
|
||||
|
||||
dc_transmap = transtables + ((curline->polyseg->translucency-1)<<FF_TRANSSHIFT);
|
||||
colfunc = fuzzcolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
|
@ -419,7 +419,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
|
||||
if (rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog))
|
||||
lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
|
||||
else if (colfunc == fuzzcolfunc)
|
||||
else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY])
|
||||
lightnum = LIGHTLEVELS - 1;
|
||||
else
|
||||
lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
|
||||
|
@ -436,7 +436,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (colfunc == fuzzcolfunc)
|
||||
if (colfunc == colfuncs[COLDRAWFUNC_FUZZY])
|
||||
{
|
||||
if (frontsector->extra_colormap && frontsector->extra_colormap->fog)
|
||||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
||||
|
@ -446,7 +446,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
else
|
||||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
||||
|
||||
if (colfunc == R_DrawFogColumn_8
|
||||
if (colfunc == colfuncs[COLDRAWFUNC_FOG]
|
||||
|| (frontsector->extra_colormap && frontsector->extra_colormap->fog))
|
||||
;
|
||||
else if (curline->v1->y == curline->v2->y)
|
||||
|
@ -718,7 +718,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
spryscale += rw_scalestep;
|
||||
}
|
||||
}
|
||||
colfunc = wallcolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
}
|
||||
|
||||
// Loop through R_DrawMaskedColumn calls
|
||||
|
@ -789,7 +789,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector;
|
||||
texnum = R_GetTextureNum(sides[pfloor->master->sidenum[0]].midtexture);
|
||||
|
||||
colfunc = wallcolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
|
@ -827,10 +827,10 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
fuzzy = false; // Opaque
|
||||
|
||||
if (fuzzy)
|
||||
colfunc = fuzzcolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||
}
|
||||
else if (pfloor->flags & FF_FOG)
|
||||
colfunc = R_DrawFogColumn_8;
|
||||
colfunc = colfuncs[COLDRAWFUNC_FOG];
|
||||
|
||||
#ifdef ESLOPE
|
||||
range = max(ds->x2-ds->x1, 1);
|
||||
|
@ -965,7 +965,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
||||
else if (pfloor->flags & FF_FOG)
|
||||
lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT);
|
||||
else if (colfunc == fuzzcolfunc)
|
||||
else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY])
|
||||
lightnum = LIGHTLEVELS-1;
|
||||
else
|
||||
lightnum = R_FakeFlat(frontsector, &tempsec, &templight, &templight, false)
|
||||
|
@ -1297,7 +1297,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
spryscale += rw_scalestep;
|
||||
}
|
||||
}
|
||||
colfunc = wallcolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
|
||||
#undef CLAMPMAX
|
||||
#undef CLAMPMIN
|
||||
|
@ -1530,7 +1530,7 @@ static void R_RenderSegLoop (void)
|
|||
else
|
||||
dc_lightlist[i].rcolormap = xwalllights[pindex];
|
||||
|
||||
colfunc = R_DrawColumnShadowed_8;
|
||||
colfunc = colfuncs[COLDRAWFUNC_SHADOWED];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1736,6 +1736,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
memset(&segright, 0x00, sizeof(segright));
|
||||
#endif
|
||||
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
|
||||
if (ds_p == drawsegs+maxdrawsegs)
|
||||
{
|
||||
size_t curpos = curdrawsegs - drawsegs;
|
||||
|
@ -3186,7 +3188,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
else
|
||||
#endif
|
||||
R_RenderSegLoop();
|
||||
colfunc = wallcolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
|
||||
if (portalline) // if curline is a portal, set portalrender for drawseg
|
||||
ds_p->portalpass = portalrender+1;
|
||||
|
|
|
@ -512,7 +512,7 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
|
|||
ds_x1 = x1;
|
||||
ds_x2 = x2;
|
||||
ds_transmap = transtables + ((tr_trans50-1)<<FF_TRANSSHIFT);
|
||||
splatfunc();
|
||||
(spanfuncs[SPANDRAWFUNC_SPLAT])();
|
||||
}
|
||||
|
||||
// reset for next calls to edge rasterizer
|
||||
|
|
|
@ -653,11 +653,7 @@ void R_DrawMaskedColumn(column_t *column)
|
|||
// quick fix... something more proper should be done!!!
|
||||
if (ylookup[dc_yl])
|
||||
colfunc();
|
||||
else if (colfunc == R_DrawColumn_8
|
||||
#ifdef USEASM
|
||||
|| colfunc == R_DrawColumn_8_ASM || colfunc == R_DrawColumn_8_MMX
|
||||
#endif
|
||||
)
|
||||
else if (colfunc == colfuncs[COLDRAWFUNC_BASE])
|
||||
{
|
||||
static INT32 first = 1;
|
||||
if (first)
|
||||
|
@ -724,11 +720,7 @@ void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight)
|
|||
// Still drawn by R_DrawColumn.
|
||||
if (ylookup[dc_yl])
|
||||
colfunc();
|
||||
else if (colfunc == R_DrawColumn_8
|
||||
#ifdef USEASM
|
||||
|| colfunc == R_DrawColumn_8_ASM || colfunc == R_DrawColumn_8_MMX
|
||||
#endif
|
||||
)
|
||||
else if (colfunc == colfuncs[COLDRAWFUNC_BASE])
|
||||
{
|
||||
static INT32 first = 1;
|
||||
if (first)
|
||||
|
@ -776,12 +768,12 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // ditto
|
||||
}
|
||||
|
||||
colfunc = basecolfunc; // hack: this isn't resetting properly somewhere.
|
||||
colfunc = colfuncs[BASEDRAWFUNC]; // hack: this isn't resetting properly somewhere.
|
||||
dc_colormap = vis->colormap;
|
||||
if (!(vis->cut & SC_PRECIP) && (vis->mobj->flags & (MF_ENEMY|MF_BOSS)) && (vis->mobj->flags2 & MF2_FRET) && !(vis->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash"
|
||||
{
|
||||
// translate certain pixels to white
|
||||
colfunc = transcolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_TRANS];
|
||||
if (vis->mobj->type == MT_CYBRAKDEMON || vis->mobj->colorized)
|
||||
dc_translation = R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE);
|
||||
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
|
||||
|
@ -791,7 +783,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
}
|
||||
else if (vis->mobj->color && vis->transmap) // Color mapping
|
||||
{
|
||||
colfunc = transtransfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_TRANSTRANS];
|
||||
dc_transmap = vis->transmap;
|
||||
if (!(vis->cut & SC_PRECIP) && vis->mobj->colorized)
|
||||
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
|
||||
|
@ -815,13 +807,13 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
}
|
||||
else if (vis->transmap)
|
||||
{
|
||||
colfunc = fuzzcolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||
dc_transmap = vis->transmap; //Fab : 29-04-98: translucency table
|
||||
}
|
||||
else if (vis->mobj->color)
|
||||
{
|
||||
// translate green skin to another color
|
||||
colfunc = transcolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_TRANS];
|
||||
|
||||
// New colormap stuff for skins Tails 06-07-2002
|
||||
if (!(vis->cut & SC_PRECIP) && vis->mobj->colorized)
|
||||
|
@ -846,7 +838,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
}
|
||||
else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
|
||||
{
|
||||
colfunc = transcolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_TRANS];
|
||||
dc_translation = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLUE, GTC_CACHE);
|
||||
}
|
||||
|
||||
|
@ -926,7 +918,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
spryscale += vis->scalestep;
|
||||
}
|
||||
|
||||
colfunc = basecolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
dc_hires = 0;
|
||||
|
||||
vis->x1 = x1;
|
||||
|
@ -956,7 +948,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
|||
|
||||
if (vis->transmap)
|
||||
{
|
||||
colfunc = fuzzcolfunc;
|
||||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||
dc_transmap = vis->transmap; //Fab : 29-04-98: translucency table
|
||||
}
|
||||
|
||||
|
@ -992,7 +984,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
|||
R_DrawMaskedColumn(column);
|
||||
}
|
||||
|
||||
colfunc = basecolfunc;
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
}
|
||||
|
||||
//
|
||||
|
|
98
src/screen.c
98
src/screen.c
|
@ -41,20 +41,12 @@
|
|||
// --------------------------------------------
|
||||
// assembly or c drawer routines for 8bpp/16bpp
|
||||
// --------------------------------------------
|
||||
void (*wallcolfunc)(void); // new wall column drawer to draw posts >128 high
|
||||
void (*colfunc)(void); // standard column, up to 128 high posts
|
||||
void (*colfunc)(void);
|
||||
void (*colfuncs[COLDRAWFUNC_MAX])(void);
|
||||
|
||||
void (*basecolfunc)(void);
|
||||
void (*fuzzcolfunc)(void); // standard fuzzy effect column drawer
|
||||
void (*transcolfunc)(void); // translation column drawer
|
||||
void (*shadecolfunc)(void); // smokie test..
|
||||
void (*spanfunc)(void); // span drawer, use a 64x64 tile
|
||||
void (*mmxspanfunc)(void); // span drawer in MMX assembly
|
||||
void (*splatfunc)(void); // span drawer w/ transparency
|
||||
void (*basespanfunc)(void); // default span func for color mode
|
||||
void (*transtransfunc)(void); // translucent translated column drawer
|
||||
void (*twosmultipatchfunc)(void); // for cols with transparent pixels
|
||||
void (*twosmultipatchtransfunc)(void); // for cols with transparent pixels AND translucency
|
||||
void (*spanfunc)(void);
|
||||
void (*spanfuncs[SPANDRAWFUNC_MAX])(void);
|
||||
void (*spanfuncs_npo2[SPANDRAWFUNC_MAX])(void);
|
||||
|
||||
// ------------------
|
||||
// global video state
|
||||
|
@ -113,36 +105,72 @@ void SCR_SetMode(void)
|
|||
//
|
||||
if (true)//vid.bpp == 1) //Always run in 8bpp. todo: remove all 16bpp code?
|
||||
{
|
||||
spanfunc = basespanfunc = mmxspanfunc = R_DrawSpan_8;
|
||||
splatfunc = R_DrawSplat_8;
|
||||
transcolfunc = R_DrawTranslatedColumn_8;
|
||||
transtransfunc = R_DrawTranslatedTranslucentColumn_8;
|
||||
colfuncs[BASEDRAWFUNC] = R_DrawColumn_8;
|
||||
spanfuncs[BASEDRAWFUNC] = R_DrawSpan_8;
|
||||
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
spanfunc = spanfuncs[BASEDRAWFUNC];
|
||||
|
||||
colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn_8;
|
||||
colfuncs[COLDRAWFUNC_TRANS] = R_DrawTranslatedColumn_8;
|
||||
colfuncs[COLDRAWFUNC_SHADE] = R_DrawShadeColumn_8;
|
||||
colfuncs[COLDRAWFUNC_SHADOWED] = R_DrawColumnShadowed_8;
|
||||
colfuncs[COLDRAWFUNC_TRANSTRANS] = R_DrawTranslatedTranslucentColumn_8;
|
||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8;
|
||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn_8;
|
||||
colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn_8;
|
||||
|
||||
spanfuncs[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan_8;
|
||||
spanfuncs[SPANDRAWFUNC_SPLAT] = R_DrawSplat_8;
|
||||
spanfuncs[SPANDRAWFUNC_TRANSSPLAT] = R_DrawTranslucentSplat_8;
|
||||
spanfuncs[SPANDRAWFUNC_FOG] = R_DrawFogSpan_8;
|
||||
#ifndef NOWATER
|
||||
spanfuncs[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_8;
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
spanfuncs[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_8;
|
||||
spanfuncs[SPANDRAWFUNC_TILTEDTRANS] = R_DrawTiltedTranslucentSpan_8;
|
||||
#ifndef NOWATER
|
||||
spanfuncs[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedTranslucentWaterSpan_8;
|
||||
#endif
|
||||
spanfuncs[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawTiltedSplat_8;
|
||||
#endif
|
||||
|
||||
// Lactozilla: Non-powers-of-two
|
||||
spanfuncs_npo2[BASEDRAWFUNC] = R_DrawSpan_NPO2_8;
|
||||
spanfuncs_npo2[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan_NPO2_8;
|
||||
spanfuncs_npo2[SPANDRAWFUNC_SPLAT] = R_DrawSplat_NPO2_8;
|
||||
spanfuncs_npo2[SPANDRAWFUNC_TRANSSPLAT] = R_DrawTranslucentSplat_NPO2_8;
|
||||
spanfuncs_npo2[SPANDRAWFUNC_FOG] = NULL; // Not needed
|
||||
#ifndef NOWATER
|
||||
spanfuncs_npo2[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_NPO2_8;
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
spanfuncs_npo2[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_NPO2_8;
|
||||
spanfuncs_npo2[SPANDRAWFUNC_TILTEDTRANS] = R_DrawTiltedTranslucentSpan_NPO2_8;
|
||||
#ifndef NOWATER
|
||||
spanfuncs_npo2[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedTranslucentWaterSpan_NPO2_8;
|
||||
#endif
|
||||
spanfuncs_npo2[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawTiltedSplat_NPO2_8;
|
||||
#endif
|
||||
|
||||
colfunc = basecolfunc = R_DrawColumn_8;
|
||||
shadecolfunc = R_DrawShadeColumn_8;
|
||||
fuzzcolfunc = R_DrawTranslucentColumn_8;
|
||||
walldrawerfunc = R_DrawWallColumn_8;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8;
|
||||
twosmultipatchtransfunc = R_Draw2sMultiPatchTranslucentColumn_8;
|
||||
#ifdef RUSEASM
|
||||
if (R_ASM)
|
||||
{
|
||||
if (R_MMX)
|
||||
{
|
||||
colfunc = basecolfunc = R_DrawColumn_8_MMX;
|
||||
//shadecolfunc = R_DrawShadeColumn_8_ASM;
|
||||
//fuzzcolfunc = R_DrawTranslucentColumn_8_ASM;
|
||||
walldrawerfunc = R_DrawWallColumn_8_MMX;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_MMX;
|
||||
mmxspanfunc = R_DrawSpan_8_MMX;
|
||||
colfuncs[BASEDRAWFUNC] = R_DrawColumn_8_MMX;
|
||||
//colfuncs[COLDRAWFUNC_SHADE] = R_DrawShadeColumn_8_ASM;
|
||||
//colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn_8_ASM;
|
||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8_MMX;
|
||||
spanfuncs[BASEDRAWFUNC] = R_DrawSpan_8_MMX;
|
||||
}
|
||||
else
|
||||
{
|
||||
colfunc = basecolfunc = R_DrawColumn_8_ASM;
|
||||
//shadecolfunc = R_DrawShadeColumn_8_ASM;
|
||||
//fuzzcolfunc = R_DrawTranslucentColumn_8_ASM;
|
||||
walldrawerfunc = R_DrawWallColumn_8_ASM;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_ASM;
|
||||
colfuncs[BASEDRAWFUNC] = R_DrawColumn_8_ASM;
|
||||
//colfuncs[COLDRAWFUNC_SHADE] = R_DrawShadeColumn_8_ASM;
|
||||
//colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn_8_ASM;
|
||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8_ASM;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -166,8 +194,6 @@ void SCR_SetMode(void)
|
|||
CONS_Alert(CONS_WARNING, M_GetText("Resolution is not aspect-correct!\nUse a multiple of %dx%d\n"), BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
*/
|
||||
|
||||
wallcolfunc = walldrawerfunc;
|
||||
|
||||
// set the apprpriate drawer for the sky (tall or INT16)
|
||||
setmodeneeded = 0;
|
||||
}
|
||||
|
|
57
src/screen.h
57
src/screen.h
|
@ -110,19 +110,51 @@ extern vmode_t specialmodes[NUMSPECIALMODES];
|
|||
// color mode dependent drawer function pointers
|
||||
// ---------------------------------------------
|
||||
|
||||
extern void (*wallcolfunc)(void);
|
||||
#define BASEDRAWFUNC 0
|
||||
|
||||
enum
|
||||
{
|
||||
COLDRAWFUNC_BASE = BASEDRAWFUNC,
|
||||
COLDRAWFUNC_FUZZY,
|
||||
COLDRAWFUNC_TRANS,
|
||||
COLDRAWFUNC_SHADE,
|
||||
COLDRAWFUNC_SHADOWED,
|
||||
COLDRAWFUNC_TRANSTRANS,
|
||||
COLDRAWFUNC_TWOSMULTIPATCH,
|
||||
COLDRAWFUNC_TWOSMULTIPATCHTRANS,
|
||||
COLDRAWFUNC_FOG,
|
||||
|
||||
COLDRAWFUNC_MAX
|
||||
};
|
||||
|
||||
extern void (*colfunc)(void);
|
||||
extern void (*basecolfunc)(void);
|
||||
extern void (*fuzzcolfunc)(void);
|
||||
extern void (*transcolfunc)(void);
|
||||
extern void (*shadecolfunc)(void);
|
||||
extern void (*colfuncs[COLDRAWFUNC_MAX])(void);
|
||||
|
||||
enum
|
||||
{
|
||||
SPANDRAWFUNC_BASE = BASEDRAWFUNC,
|
||||
SPANDRAWFUNC_TRANS,
|
||||
SPANDRAWFUNC_SPLAT,
|
||||
SPANDRAWFUNC_TRANSSPLAT,
|
||||
SPANDRAWFUNC_FOG,
|
||||
#ifndef NOWATER
|
||||
SPANDRAWFUNC_WATER,
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
SPANDRAWFUNC_TILTED,
|
||||
SPANDRAWFUNC_TILTEDTRANS,
|
||||
SPANDRAWFUNC_TILTEDSPLAT,
|
||||
#ifndef NOWATER
|
||||
SPANDRAWFUNC_TILTEDWATER,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SPANDRAWFUNC_MAX
|
||||
};
|
||||
|
||||
extern void (*spanfunc)(void);
|
||||
extern void (*basespanfunc)(void);
|
||||
extern void (*mmxspanfunc)(void);
|
||||
extern void (*splatfunc)(void);
|
||||
extern void (*transtransfunc)(void);
|
||||
extern void (*twosmultipatchfunc)(void);
|
||||
extern void (*twosmultipatchtransfunc)(void);
|
||||
extern void (*spanfuncs[SPANDRAWFUNC_MAX])(void);
|
||||
extern void (*spanfuncs_npo2[SPANDRAWFUNC_MAX])(void);
|
||||
|
||||
// -----
|
||||
// CPUID
|
||||
|
@ -148,9 +180,6 @@ extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_fu
|
|||
// wait for page flipping to end or not
|
||||
extern consvar_t cv_vidwait;
|
||||
|
||||
// quick fix for tall/short skies, depending on bytesperpixel
|
||||
extern void (*walldrawerfunc)(void);
|
||||
|
||||
// Change video mode, only at the start of a refresh.
|
||||
void SCR_SetMode(void);
|
||||
// Recalc screen size dependent stuff
|
||||
|
|
|
@ -140,7 +140,13 @@ if(${SDL2_FOUND})
|
|||
endif()
|
||||
|
||||
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2win)
|
||||
elseif(${CMAKE_SYSTEM} MATCHES Linux)
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME lsdlsrb2)
|
||||
else()
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
find_library(CORE_LIB CoreFoundation)
|
||||
|
|
|
@ -438,6 +438,9 @@
|
|||
<ClCompile Include="..\r_draw8.c">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\r_draw8_npo2.c">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\r_main.c" />
|
||||
<ClCompile Include="..\r_plane.c" />
|
||||
<ClCompile Include="..\r_patch.c" />
|
||||
|
|
|
@ -837,6 +837,9 @@
|
|||
<ClCompile Include="..\r_draw8.c">
|
||||
<Filter>R_Rend</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\r_draw8_npo2.c">
|
||||
<Filter>R_Rend</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\r_main.c">
|
||||
<Filter>R_Rend</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -1219,7 +1219,7 @@
|
|||
C01FCF4B08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CURRENT_PROJECT_VERSION = 2.1.25;
|
||||
CURRENT_PROJECT_VERSION = 2.2.0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
NORMALSRB2,
|
||||
|
@ -1231,7 +1231,7 @@
|
|||
C01FCF4C08A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CURRENT_PROJECT_VERSION = 2.1.25;
|
||||
CURRENT_PROJECT_VERSION = 2.2.0;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
|
|
@ -222,21 +222,16 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
|||
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
||||
EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette)
|
||||
{
|
||||
INT32 i = -1;
|
||||
UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green,
|
||||
bluegamma = pgamma->s.blue;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
size_t palsize = (sizeof(RGBA_t) * 256);
|
||||
// on a palette change, you have to reload all of the textures
|
||||
if (memcmp(&myPaletteData, palette, palsize))
|
||||
{
|
||||
myPaletteData[i].s.red = (UINT8)MIN((palette[i].s.red * redgamma) /127, 255);
|
||||
myPaletteData[i].s.green = (UINT8)MIN((palette[i].s.green * greengamma)/127, 255);
|
||||
myPaletteData[i].s.blue = (UINT8)MIN((palette[i].s.blue * bluegamma) /127, 255);
|
||||
myPaletteData[i].s.alpha = palette[i].s.alpha;
|
||||
}
|
||||
memcpy(&myPaletteData, palette, palsize);
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
#endif //SDL
|
||||
|
|
|
@ -31,5 +31,5 @@ extern Uint16 realwidth;
|
|||
extern Uint16 realheight;
|
||||
|
||||
#ifdef _CREATE_DLL_
|
||||
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma);
|
||||
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette);
|
||||
#endif
|
||||
|
|
|
@ -84,39 +84,6 @@ static CV_PossibleValue_t constextsize_cons_t[] = {
|
|||
static void CV_constextsize_OnChange(void);
|
||||
consvar_t cv_constextsize = {"con_textsize", "Medium", CV_SAVE|CV_CALL, constextsize_cons_t, CV_constextsize_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#ifdef HWRENDER
|
||||
static void CV_Gammaxxx_ONChange(void);
|
||||
// Saved hardware mode variables
|
||||
// - You can change them in software,
|
||||
// but they won't do anything.
|
||||
static CV_PossibleValue_t grgamma_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t grsoftwarefog_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "LightPlanes"}, {0, NULL}};
|
||||
static CV_PossibleValue_t grmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Sometimes"}, {2, "Always"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_grfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfog = {"gr_fog", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfogcolor = {"gr_fogcolor", "AAAAAA", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grsoftwarefog = {"gr_softwarefog", "Off", CV_SAVE, grsoftwarefog_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grgammared = {"gr_gammared", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
||||
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grgammagreen = {"gr_gammagreen", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
||||
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grgammablue = {"gr_gammablue", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
||||
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
#ifdef ALAM_LIGHTING
|
||||
consvar_t cv_grdynamiclighting = {"gr_dynamiclighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grstaticlighting = {"gr_staticlighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grcoronas = {"gr_coronas", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grcoronasize = {"gr_coronasize", "1", CV_SAVE| CV_FLOAT, 0, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
consvar_t cv_grmodels = {"gr_models", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grmodelinterpolation = {"gr_modelinterpolation", "Sometimes", CV_SAVE, grmodelinterpolation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grskydome = {"gr_skydome", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
// local copy of the palette for V_GetColor()
|
||||
RGBA_t *pLocalPalette = NULL;
|
||||
RGBA_t *pMasterPalette = NULL;
|
||||
|
@ -128,6 +95,7 @@ Please check it out if you're trying to maintain this.
|
|||
toast 18/04/17
|
||||
*/
|
||||
float Cubepal[2][2][2][3];
|
||||
boolean Cubeapply = false;
|
||||
|
||||
// returns whether to apply cube, selectively avoiding expensive operations
|
||||
static boolean InitCube(void)
|
||||
|
@ -343,11 +311,12 @@ const UINT8 correctiontable[256] =
|
|||
// keep a copy of the palette so that we can get the RGB value for a color index at any time.
|
||||
static void LoadPalette(const char *lumpname)
|
||||
{
|
||||
boolean cube = InitCube();
|
||||
lumpnum_t lumpnum = W_GetNumForName(lumpname);
|
||||
size_t i, palsize = W_LumpLength(lumpnum)/3;
|
||||
UINT8 *pal;
|
||||
|
||||
Cubeapply = InitCube();
|
||||
|
||||
Z_Free(pLocalPalette);
|
||||
Z_Free(pMasterPalette);
|
||||
|
||||
|
@ -369,13 +338,21 @@ static void LoadPalette(const char *lumpname)
|
|||
pMasterPalette[i].s.alpha = pLocalPalette[i].s.alpha = 0xFF;
|
||||
|
||||
// lerp of colour cubing! if you want, make it smoother yourself
|
||||
if (cube)
|
||||
if (Cubeapply)
|
||||
V_CubeApply(&pLocalPalette[i].s.red, &pLocalPalette[i].s.green, &pLocalPalette[i].s.blue);
|
||||
}
|
||||
}
|
||||
|
||||
void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue)
|
||||
{
|
||||
float working[4][3];
|
||||
float linear;
|
||||
UINT8 q;
|
||||
|
||||
linear = (pLocalPalette[i].s.red/255.0);
|
||||
if (!Cubeapply)
|
||||
return;
|
||||
|
||||
linear = (*red/255.0);
|
||||
#define dolerp(e1, e2) ((1 - linear)*e1 + linear*e2)
|
||||
for (q = 0; q < 3; q++)
|
||||
{
|
||||
|
@ -384,13 +361,13 @@ static void LoadPalette(const char *lumpname)
|
|||
working[2][q] = dolerp(Cubepal[0][0][1][q], Cubepal[1][0][1][q]);
|
||||
working[3][q] = dolerp(Cubepal[0][1][1][q], Cubepal[1][1][1][q]);
|
||||
}
|
||||
linear = (pLocalPalette[i].s.green/255.0);
|
||||
linear = (*green/255.0);
|
||||
for (q = 0; q < 3; q++)
|
||||
{
|
||||
working[0][q] = dolerp(working[0][q], working[1][q]);
|
||||
working[1][q] = dolerp(working[2][q], working[3][q]);
|
||||
}
|
||||
linear = (pLocalPalette[i].s.blue/255.0);
|
||||
linear = (*blue/255.0);
|
||||
for (q = 0; q < 3; q++)
|
||||
{
|
||||
working[0][q] = 255*dolerp(working[0][q], working[1][q]);
|
||||
|
@ -401,11 +378,9 @@ static void LoadPalette(const char *lumpname)
|
|||
}
|
||||
#undef dolerp
|
||||
|
||||
pLocalPalette[i].s.red = (UINT8)(working[0][0]);
|
||||
pLocalPalette[i].s.green = (UINT8)(working[0][1]);
|
||||
pLocalPalette[i].s.blue = (UINT8)(working[0][2]);
|
||||
}
|
||||
}
|
||||
*red = (UINT8)(working[0][0]);
|
||||
*green = (UINT8)(working[0][1]);
|
||||
*blue = (UINT8)(working[0][2]);
|
||||
}
|
||||
|
||||
const char *R_GetPalname(UINT16 num)
|
||||
|
@ -473,16 +448,6 @@ static void CV_palette_OnChange(void)
|
|||
V_SetPalette(0);
|
||||
}
|
||||
|
||||
// change the palette directly to see the change
|
||||
#ifdef HWRENDER
|
||||
static void CV_Gammaxxx_ONChange(void)
|
||||
{
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
V_SetPalette(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (__GNUC__) && defined (__i386__) && !defined (NOASM) && !defined (__APPLE__) && !defined (NORUSEASM)
|
||||
void VID_BlitLinearScreen_ASM(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
||||
size_t destrowbytes);
|
||||
|
|
|
@ -48,6 +48,8 @@ const char *GetPalette(void);
|
|||
extern RGBA_t *pLocalPalette;
|
||||
extern RGBA_t *pMasterPalette;
|
||||
|
||||
void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue);
|
||||
|
||||
// Retrieve the ARGB value from a palette color index
|
||||
#define V_GetColor(color) (pLocalPalette[color&0xFF])
|
||||
|
||||
|
|
|
@ -1516,8 +1516,8 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
|
|||
#ifdef HWRENDER
|
||||
// Software-only compile cache the data without conversion
|
||||
if (rendermode == render_soft || rendermode == render_none)
|
||||
{
|
||||
#endif
|
||||
{
|
||||
lumpcache_t *lumpcache = wadfiles[wad]->patchcache;
|
||||
if (!lumpcache[lump])
|
||||
{
|
||||
|
@ -1551,8 +1551,8 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
|
|||
Z_ChangeTag(lumpcache[lump], tag);
|
||||
|
||||
return lumpcache[lump];
|
||||
#ifdef HWRENDER
|
||||
}
|
||||
#ifdef HWRENDER
|
||||
|
||||
grPatch = HWR_GetCachedGLPatchPwad(wad, lump);
|
||||
|
||||
|
|
|
@ -295,6 +295,9 @@
|
|||
<ClCompile Include="..\r_draw8.c">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\r_draw8_npo2.c">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\r_main.c" />
|
||||
<ClCompile Include="..\r_plane.c" />
|
||||
<ClCompile Include="..\r_patch.c" />
|
||||
|
|
|
@ -369,6 +369,9 @@
|
|||
<ClCompile Include="..\r_draw16.c">
|
||||
<Filter>R_Rend</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\r_draw8_npo2.c">
|
||||
<Filter>R_Rend</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\r_main.c">
|
||||
<Filter>R_Rend</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -98,7 +98,7 @@ static loadfunc_t hwdFuncTable[] = {
|
|||
{"Init@4", &hwdriver.pfnInit},
|
||||
{"Shutdown@0", &hwdriver.pfnShutdown},
|
||||
{"GetModeList@8", &hwdriver.pfnGetModeList},
|
||||
{"SetPalette@8", &hwdriver.pfnSetPalette},
|
||||
{"SetPalette@4", &hwdriver.pfnSetPalette},
|
||||
{"FinishUpdate@4", &hwdriver.pfnFinishUpdate},
|
||||
{"Draw2DLine@12", &hwdriver.pfnDraw2DLine},
|
||||
{"DrawPolygon@16", &hwdriver.pfnDrawPolygon},
|
||||
|
|
|
@ -46,6 +46,7 @@ enum
|
|||
|
||||
PU_HWRPATCHINFO = 21, // Hardware GLPatch_t struct for OpenGL texture cache
|
||||
PU_HWRPATCHCOLMIPMAP = 22, // Hardware GLMipmap_t struct colormap variation of patch
|
||||
PU_HWRMODELTEXTURE = 23, // Hardware model texture
|
||||
|
||||
PU_HWRCACHE = 48, // static until unlocked
|
||||
PU_CACHE = 49, // static until unlocked
|
||||
|
|
Loading…
Reference in a new issue