This commit is contained in:
Rachael Alexanderson 2018-03-26 07:08:35 -04:00
commit 2c9412e7ed
216 changed files with 31594 additions and 3229 deletions

View file

@ -11,18 +11,20 @@ if( COMMAND cmake_policy )
endif()
list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )
include( CreateLaunchers )
include( FindPackageHandleStandardArgs )
# Produce a warning if XP support will be missing.
# Produce a warning if XP support will be missing when building a 32 bit target for MSVC.
if( MSVC )
list( APPEND WINXP_TOOLSETS v140_xp v141_xp)
list( FIND WINXP_TOOLSETS "${CMAKE_GENERATOR_TOOLSET}" HAVE_WINXP_SUPPORT)
if(NOT "${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)")
if( HAVE_WINXP_SUPPORT EQUAL -1 )
string( REPLACE ";" " or " WINXP_TOOLSETS_STR "${WINXP_TOOLSETS}" )
message( WARNING "This project supports Windows XP but you must set the optional toolset to ${WINXP_TOOLSETS_STR} manually to have it in your build!\n"
"Assign toolset's name to CMAKE_GENERATOR_TOOLSET variable or use -T <toolset> from the command prompt." )
list( APPEND WINXP_TOOLSETS v140_xp v141_xp)
list( FIND WINXP_TOOLSETS "${CMAKE_GENERATOR_TOOLSET}" HAVE_WINXP_SUPPORT)
if( HAVE_WINXP_SUPPORT EQUAL -1 )
string( REPLACE ";" " or " WINXP_TOOLSETS_STR "${WINXP_TOOLSETS}" )
message( WARNING "This project supports Windows XP but you must set the optional toolset to ${WINXP_TOOLSETS_STR} manually to have it in your build!\n"
"Assign toolset's name to CMAKE_GENERATOR_TOOLSET variable or use -T <toolset> from the command prompt." )
endif()
endif()
endif()

View file

@ -1,48 +0,0 @@
# - Removes duplicate entries and non-directories from a provided list
#
# clean_directory_list(<listvar> [<additional list items>...])
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__clean_directory_list)
return()
endif()
set(__clean_directory_list YES)
function(clean_directory_list _var)
# combine variable's current value with additional list items
set(_in ${${_var}} ${ARGN})
if(_in)
# Initial list cleaning
list(REMOVE_DUPLICATES _in)
# Grab the absolute path of each actual directory
set(_out)
foreach(_dir ${_in})
if(IS_DIRECTORY "${_dir}")
get_filename_component(_dir "${_dir}" ABSOLUTE)
file(TO_CMAKE_PATH "${_dir}" _dir)
list(APPEND _out "${_dir}")
endif()
endforeach()
if(_out)
# Clean up the output list now
list(REMOVE_DUPLICATES _out)
endif()
# return _out
set(${_var} "${_out}" PARENT_SCOPE)
endif()
endfunction()

View file

@ -1,340 +0,0 @@
# - Create launchers to set working directory, env. vars, etc.
#
# include(CreateLaunchers) - to make these available
# guess_runtime_library_dirs(<outputvarname> [<extralibrary> ...])
# create_default_target_launcher(<targetname>
# [ARGS <args...>]
# [FORWARD_ARGS]
# [RUNTIME_LIBRARY_DIRS <dir...>]
# [WORKING_DIRECTORY <dir>]
# [ENVIRONMENT <VAR=value> [<VAR=value>...]])
#
# create_target_launcher(<targetname>
# [ARGS <args...>]
# [FORWARD_ARGS]
# [RUNTIME_LIBRARY_DIRS <dir...>]
# [WORKING_DIRECTORY <dir>]
# [ENVIRONMENT <VAR=value> [<VAR=value>...]])
#
# create_generic_launcher(<launchername>
# [RUNTIME_LIBRARY_DIRS <dir...>]
# [WORKING_DIRECTORY <dir>]
# [ENVIRONMENT <VAR=value> [<VAR=value>...]])
# - sets GENERIC_LAUNCHER_COMMAND and GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION
#
# Requires these CMake modules:
# ListFilter
# ProgramFilesGlob
# CleanDirectoryList
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__create_launchers)
return()
endif()
set(__create_launchers YES)
if( POLICY CMP0026 )
cmake_policy( SET CMP0026 OLD )
endif( POLICY CMP0026 )
include(CleanDirectoryList)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_launchermoddir
${CMAKE_CURRENT_LIST_FILE}
PATH)
set(_launchermoddir "${_launchermoddir}/launcher-templates")
macro(_launcher_system_settings)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(BITS 64)
else()
set(BITS 32)
endif()
if(WIN32)
# Find user and system name
set(SYSTEM_NAME $ENV{USERDOMAIN})
set(USER_NAME $ENV{USERNAME})
set(VCPROJ_TYPE vcproj)
set(USERFILE_EXTENSION ${SYSTEM_NAME}.${USER_NAME}.user)
set(LAUNCHER_LINESEP "&#x0A;")
if(MSVC90)
set(USERFILE_VC_VERSION 9.00)
elseif(MSVC80)
set(USERFILE_VC_VERSION 8.00)
elseif(MSVC71)
set(USERFILE_VC_VERSION 7.10)
elseif(MSVC10 OR (MSVC AND MSVC_VERSION GREATER 1600)) # 2010 or newer
set(LAUNCHER_LINESEP "\n")
set(USERFILE_VC_VERSION 10.00)
set(USERFILE_EXTENSION user)
set(VCPROJ_TYPE vcxproj)
endif()
if(BITS EQUAL 64)
set(USERFILE_PLATFORM x64)
else()
set(USERFILE_PLATFORM Win${BITS})
endif()
set(_pathdelim ";")
set(_suffix "cmd")
else()
set(_pathdelim ":")
set(USERFILE_PLATFORM ${CMAKE_SYSTEM_NAME}${BITS})
set(_suffix "sh")
find_package(GDB QUIET)
if(GDB_FOUND)
set(LAUNCHERS_GOT_GDB YES)
if(GDB_HAS_RETURN_CHILD_RESULT)
set(LAUNCHERS_GDB_ARG --return-child-result)
endif()
else()
set(LAUNCHERS_GOT_GDB)
endif()
endif()
if(WIN32 AND NOT USERFILE_REMOTE_MACHINE)
site_name(USERFILE_REMOTE_MACHINE)
mark_as_advanced(USERFILE_REMOTE_MACHINE)
endif()
endmacro()
macro(_launcher_process_args)
set(_nowhere)
set(_curdest _nowhere)
set(_val_args
ARGS
RUNTIME_LIBRARY_DIRS
WORKING_DIRECTORY
ENVIRONMENT)
set(_bool_args FORWARD_ARGS)
foreach(_arg ${_val_args} ${_bool_args})
set(${_arg})
endforeach()
foreach(_element ${ARGN})
list(FIND _val_args "${_element}" _val_arg_find)
list(FIND _bool_args "${_element}" _bool_arg_find)
if("${_val_arg_find}" GREATER "-1")
set(_curdest "${_element}")
elseif("${_bool_arg_find}" GREATER "-1")
set("${_element}" ON)
set(_curdest _nowhere)
else()
list(APPEND ${_curdest} "${_element}")
endif()
endforeach()
if(_nowhere)
message(FATAL_ERROR
"Syntax error in use of a function in CreateLaunchers!")
endif()
# Turn into a list of native paths
set(_runtime_lib_dirs)
foreach(_dlldir ${RUNTIME_LIBRARY_DIRS})
file(TO_NATIVE_PATH "${_dlldir}" _path)
set(_runtime_lib_dirs "${_runtime_lib_dirs}${_path}${_pathdelim}")
endforeach()
if(NOT WORKING_DIRECTORY)
set(WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
if(FORWARD_ARGS)
if(WIN32)
set(FWD_ARGS %*)
else()
set(FWD_ARGS $*)
endif()
else()
set(FWD_ARGS)
endif()
set(USERFILE_WORKING_DIRECTORY "${WORKING_DIRECTORY}")
set(USERFILE_COMMAND_ARGUMENTS "${ARGS}")
set(LAUNCHERSCRIPT_COMMAND_ARGUMENTS "${ARGS} ${FWD_ARGS}")
if(WIN32)
set(RUNTIME_LIBRARIES_ENVIRONMENT "PATH=${_runtime_lib_dirs};%PATH%")
file(READ
"${_launchermoddir}/launcher.env.cmd.in"
_cmdenv)
else()
if(APPLE)
set(RUNTIME_LIBRARIES_ENVIRONMENT
"DYLD_LIBRARY_PATH=${_runtime_lib_dirs}:$DYLD_LIBRARY_PATH")
else()
set(RUNTIME_LIBRARIES_ENVIRONMENT
"LD_LIBRARY_PATH=${_runtime_lib_dirs}:$LD_LIBRARY_PATH")
endif()
file(READ
"${_launchermoddir}/launcher.env.sh.in"
_cmdenv)
endif()
set(USERFILE_ENVIRONMENT "${RUNTIME_LIBRARIES_ENVIRONMENT}")
set(USERFILE_ENV_COMMANDS)
foreach(_arg "${RUNTIME_LIBRARIES_ENVIRONMENT}" ${ENVIRONMENT})
string(CONFIGURE
"${USERFILE_ENVIRONMENT}${LAUNCHER_LINESEP}${_arg}"
USERFILE_ENVIRONMENT
@ONLY)
string(CONFIGURE
"@USERFILE_ENV_COMMANDS@${_cmdenv}"
USERFILE_ENV_COMMANDS
@ONLY)
endforeach()
endmacro()
macro(_launcher_produce_vcproj_user)
if(MSVC)
file(READ
"${_launchermoddir}/perconfig.${VCPROJ_TYPE}.user.in"
_perconfig)
set(USERFILE_CONFIGSECTIONS)
foreach(USERFILE_CONFIGNAME ${CMAKE_CONFIGURATION_TYPES})
get_target_property(USERFILE_${USERFILE_CONFIGNAME}_COMMAND
${_targetname}
LOCATION_${USERFILE_CONFIGNAME})
file(TO_NATIVE_PATH
"${USERFILE_${USERFILE_CONFIGNAME}_COMMAND}"
USERFILE_${USERFILE_CONFIGNAME}_COMMAND)
string(CONFIGURE "${_perconfig}" _temp @ONLY ESCAPE_QUOTES)
string(CONFIGURE
"${USERFILE_CONFIGSECTIONS}${_temp}"
USERFILE_CONFIGSECTIONS
ESCAPE_QUOTES)
endforeach()
configure_file("${_launchermoddir}/${VCPROJ_TYPE}.user.in"
${VCPROJNAME}.${VCPROJ_TYPE}.${USERFILE_EXTENSION}
@ONLY)
endif()
endmacro()
macro(_launcher_configure_executable _src _tmp _target)
# get_filename_component(_targetname "${_target}" NAME)
get_filename_component(_targetpath "${_target}" PATH)
configure_file("${_src}"
"${_tmp}"
@ONLY)
file(COPY "${_tmp}"
DESTINATION "${_targetpath}"
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endmacro()
macro(_launcher_create_target_launcher)
if(CMAKE_CONFIGURATION_TYPES)
# Multi-config generator - multiple launchers
foreach(_config ${CMAKE_CONFIGURATION_TYPES})
get_target_property(USERFILE_${_config}_COMMAND
${_targetname}
LOCATION_${_config})
file(TO_NATIVE_PATH
"${USERFILE_${_config}_COMMAND}"
USERFILE_COMMAND)
set(_fn "launch-${_targetname}-${_config}.${_suffix}")
_launcher_configure_executable("${_launchermoddir}/targetlauncher.${_suffix}.in"
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_fn}"
"${CMAKE_CURRENT_BINARY_DIR}/${_fn}")
endforeach()
else()
# Single-config generator - single launcher
get_target_property(USERFILE_COMMAND
${_targetname}
LOCATION)
file(TO_NATIVE_PATH
"${USERFILE_COMMAND}"
USERFILE_COMMAND)
_launcher_configure_executable("${_launchermoddir}/targetlauncher.${_suffix}.in"
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/launch-${_targetname}.${_suffix}"
"${CMAKE_CURRENT_BINARY_DIR}/launch-${_targetname}.${_suffix}"
@ONLY)
endif()
endmacro()
function(create_default_target_launcher _targetname)
_launcher_system_settings()
_launcher_process_args(${ARGN})
set(VCPROJNAME "${CMAKE_BINARY_DIR}/ALL_BUILD")
_launcher_produce_vcproj_user()
_launcher_create_target_launcher()
endfunction()
function(create_target_launcher _targetname)
_launcher_system_settings()
_launcher_process_args(${ARGN})
set(VCPROJNAME "${CMAKE_CURRENT_BINARY_DIR}/${_targetname}")
_launcher_produce_vcproj_user()
_launcher_create_target_launcher()
endfunction()
function(create_generic_launcher _launchername)
_launcher_system_settings()
_launcher_process_args(${ARGN})
if(NOT IS_ABSOLUTE _launchername)
set(_launchername
"${CMAKE_CURRENT_BINARY_DIR}/${_launchername}.${_suffix}")
else()
set(_launchername "${_launchername}.${_suffix}")
endif()
if(WIN32)
set(GENERIC_LAUNCHER_COMMAND "${_launchername}" PARENT_SCOPE)
set(GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION)
else()
set(GENERIC_LAUNCHER_COMMAND sh "${_launchername}" PARENT_SCOPE)
set(GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION
"Program terminated with signal")
endif()
_launcher_configure_executable("${_launchermoddir}/genericlauncher.${_suffix}.in"
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/genericlauncher.${_suffix}.in"
"${_launchername}")
endfunction()
function(guess_runtime_library_dirs _var)
# Start off with the link directories of the calling listfile's directory
get_directory_property(_libdirs LINK_DIRECTORIES)
# Add additional libraries passed to the function
foreach(_lib ${ARGN})
get_filename_component(_libdir "${_lib}" PATH)
list(APPEND _libdirs "${_libdir}")
endforeach()
# Now, build a list of potential dll directories
set(_dlldirs)
foreach(_libdir ${_libdirs})
# Add the libdir itself
list(APPEND _dlldirs "${_libdir}")
# Look also in libdir/../bin since the dll might not be with the lib
get_filename_component(_libdir "${_libdir}/../bin" ABSOLUTE)
list(APPEND _dlldirs "${_libdir}")
endforeach()
# Only keep the valid, unique directories
clean_directory_list(_dlldirs)
# Return _dlldirs
set(${_var} "${_dlldirs}" PARENT_SCOPE)
endfunction()

View file

@ -1,14 +0,0 @@
cd @USERFILE_WORKING_DIRECTORY@
@USERFILE_ENV_COMMANDS@
IF NOT [x%1]==[x--debugger] GOTO SkipDebuggingMess
ECHO Need to ditch the debugger!
SHIFT /1
%1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO EOF
:SkipDebuggingMess
%*
:EOF

View file

@ -1 +0,0 @@
set @_arg@

View file

@ -1,28 +0,0 @@
<Configuration
Name="@USERFILE_CONFIGNAME@|@USERFILE_PLATFORM@"
>
<DebugSettings
Command="${USERFILE_@USERFILE_CONFIGNAME@_COMMAND}"
WorkingDirectory="@USERFILE_WORKING_DIRECTORY@"
CommandArguments="@USERFILE_COMMAND_ARGUMENTS@"
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="@USERFILE_REMOTE_MACHINE@"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment="@USERFILE_ENVIRONMENT@"
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>

View file

@ -1,7 +0,0 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='@USERFILE_CONFIGNAME@|@USERFILE_PLATFORM@'">
<LocalDebuggerEnvironment>@USERFILE_ENVIRONMENT@</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommand>${USERFILE_@USERFILE_CONFIGNAME@_COMMAND}</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>@USERFILE_COMMAND_ARGUMENTS@</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>@USERFILE_WORKING_DIRECTORY@</LocalDebuggerWorkingDirectory>
</PropertyGroup>

View file

@ -1,8 +0,0 @@
cd @USERFILE_WORKING_DIRECTORY@
@USERFILE_ENV_COMMANDS@
if [%1]==[--debugger] (
SHIFT
)
"@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@
pause

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="@USERFILE_VC_VERSION@"
ShowAllFiles="false"
>
<Configurations>
@USERFILE_CONFIGSECTIONS@
</Configurations>
</VisualStudioUserFile>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
@USERFILE_CONFIGSECTIONS@
</Project>

View file

@ -639,6 +639,22 @@ elseif( FLUIDSYNTH_FOUND )
add_definitions( -DHAVE_FLUIDSYNTH )
endif()
option( SEND_ANON_STATS "Enable sending of anonymous hardware statistics" ON )
if( NOT SEND_ANON_STATS )
add_definitions( -DNO_SEND_STATS )
endif()
# OPLMIDI needs for USE_LEGACY_EMULATOR macro to be correctly built
add_definitions(-DOPNMIDI_USE_LEGACY_EMULATOR)
# Disable ADLMIDI's and OPNMIDI's MIDI Sequencer, MUS and XMI converters
add_definitions(-DADLMIDI_DISABLE_MUS_SUPPORT -DADLMIDI_DISABLE_XMI_SUPPORT -DADLMIDI_DISABLE_MIDI_SEQUENCER)
add_definitions(-DOPNMIDI_DISABLE_MUS_SUPPORT -DOPNMIDI_DISABLE_XMI_SUPPORT -DOPNMIDI_DISABLE_MIDI_SEQUENCER)
# Disable ADLMIDI's MIDI Sequencer, MUS and XMI converters
add_definitions(-DADLMIDI_DISABLE_MUS_SUPPORT -DADLMIDI_DISABLE_XMI_SUPPORT -DADLMIDI_DISABLE_MIDI_SEQUENCER)
# Project files should be aware of the header files. We can GLOB these since
# there's generally a new cpp for every header so this file will get changed
if( WIN32 )
@ -660,6 +676,10 @@ file( GLOB HEADER_FILES
g_inventory/*.h
intermission/*.h
menu/*.h
sound/adlmidi/*.h*
sound/opnmidi/*.h*
sound/oplsynth/*.h
sound/oplsynth/dosbox/*.h
posix/*.h
posix/cocoa/*.h
posix/sdl/*.h
@ -678,6 +698,7 @@ file( GLOB HEADER_FILES
sound/midisources/*.h
sound/oplsynth/*.h
sound/oplsynth/dosbox/*.h
sound/thirdparty/*.h
sound/timidity/*.h
sound/timiditypp/*.h
sound/wildmidi/*.h
@ -845,7 +866,20 @@ set( FASTMATH_SOURCES
gl/models/gl_models.cpp
r_data/models/models.cpp
r_data/matrix.cpp
sound/adlmidi/adldata.cpp
sound/adlmidi/adlmidi.cpp
sound/adlmidi/adlmidi_load.cpp
sound/adlmidi/adlmidi_midiplay.cpp
sound/adlmidi/adlmidi_opl3.cpp
sound/adlmidi/adlmidi_private.cpp
sound/adlmidi/dbopl.cpp
sound/adlmidi/nukedopl3.c
sound/opnmidi/opnmidi.cpp
sound/opnmidi/opnmidi_load.cpp
sound/opnmidi/opnmidi_midiplay.cpp
sound/opnmidi/opnmidi_opn2.cpp
sound/opnmidi/opnmidi_private.cpp
sound/opnmidi/Ym2612_ChipEmu.cpp
)
set (PCH_SOURCES
@ -1091,6 +1125,7 @@ set (PCH_SOURCES
textures/flattexture.cpp
textures/imgztexture.cpp
textures/jpegtexture.cpp
textures/md5check.cpp
textures/multipatchtexture.cpp
textures/patchtexture.cpp
textures/pcxtexture.cpp
@ -1104,6 +1139,7 @@ set (PCH_SOURCES
textures/tgatexture.cpp
textures/warptexture.cpp
textures/skyboxtexture.cpp
textures/worldtexture.cpp
xlat/parse_xlat.cpp
fragglescript/t_func.cpp
fragglescript/t_load.cpp
@ -1149,8 +1185,10 @@ set (PCH_SOURCES
sound/i_music.cpp
sound/i_sound.cpp
sound/i_soundfont.cpp
sound/mididevices/music_adlmidi_mididevice.cpp
sound/mididevices/music_opldumper_mididevice.cpp
sound/mididevices/music_opl_mididevice.cpp
sound/mididevices/music_opnmidi_mididevice.cpp
sound/mididevices/music_timiditypp_mididevice.cpp
sound/mididevices/music_fluidsynth_mididevice.cpp
sound/mididevices/music_softsynth_mididevice.cpp
@ -1315,7 +1353,6 @@ if( MSVC )
COMMENT "Adding manifest..."
)
create_default_target_launcher( zdoom WORKING_DIRECTORY ${ZDOOM_OUTPUT_DIR} )
endif()
if( NOT WIN32 AND NOT APPLE )
@ -1362,6 +1399,8 @@ install(TARGETS zdoom
COMPONENT "Game executable")
source_group("Audio Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/.+")
source_group("Audio Files\\ADL MIDI" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/adlmidi/.+")
source_group("Audio Files\\OPN MIDI" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/opnmidi/.+")
source_group("Audio Files\\OPL Synth" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/oplsynth/.+")
source_group("Audio Files\\OPL Synth\\DOSBox" FILES sound/oplsynth/dosbox/opl.cpp sound/oplsynth/dosbox/opl.h)
source_group("Audio Files\\Timidity" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/timidity/.+")
@ -1370,6 +1409,7 @@ source_group("Audio Files\\WildMidi" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE
source_group("Audio Files\\MIDI Devices" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/mididevices/.+")
source_group("Audio Files\\MIDI Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/midisources/.+")
source_group("Audio Files\\Music formats" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/musicformats/.+")
source_group("Audio Files\\Third-party" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/thirdparty/.+")
source_group("External\\Math" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/math/.+")
source_group("External\\RapidJSON" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/.+")
source_group("External\\SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")

View file

@ -952,7 +952,7 @@ void AM_StaticInit()
for (int i = 0; i < 10; i++)
{
mysnprintf (namebuf, countof(namebuf), "AMMNUM%d", i);
marknums[i] = TexMan.CheckForTexture (namebuf, FTexture::TEX_MiscPatch);
marknums[i] = TexMan.CheckForTexture (namebuf, ETextureType::MiscPatch);
}
markpointnum = 0;
mapback.SetInvalid();
@ -1356,11 +1356,11 @@ void AM_LevelInit ()
{
if (level.info->MapBackground.Len() == 0)
{
mapback = TexMan.CheckForTexture("AUTOPAGE", FTexture::TEX_MiscPatch);
mapback = TexMan.CheckForTexture("AUTOPAGE", ETextureType::MiscPatch);
}
else
{
mapback = TexMan.CheckForTexture(level.info->MapBackground, FTexture::TEX_MiscPatch);
mapback = TexMan.CheckForTexture(level.info->MapBackground, ETextureType::MiscPatch);
}
AM_clearMarks();
@ -2195,7 +2195,7 @@ void AM_drawSubsectors()
// Draw the polygon.
FTexture *pic = TexMan(maptex);
if (pic != NULL && pic->UseType != FTexture::TEX_Null)
if (pic != NULL && pic->UseType != ETextureType::Null)
{
screen->FillSimplePoly(TexMan(maptex),
&points[0], points.Size(),
@ -3069,7 +3069,7 @@ void AM_drawThings ()
static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
INTBOOL flip, double xscale, double yscale, int translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle)
{
if (tex == NULL || tex->UseType == FTexture::TEX_Null)
if (tex == NULL || tex->UseType == ETextureType::Null)
{
return;
}
@ -3088,7 +3088,7 @@ static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
DTA_TranslationIndex, translation,
DTA_Alpha, alpha,
DTA_FillColor, fillcolor,
DTA_RenderStyle, uint32_t(renderstyle),
DTA_RenderStyle, renderstyle.AsDWORD,
TAG_DONE);
}

View file

@ -1060,7 +1060,7 @@ CCMD(changesky)
sky1name = argv[1];
if (sky1name[0] != 0)
{
FTextureID newsky = TexMan.GetTexture(sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
FTextureID newsky = TexMan.GetTexture(sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
if (newsky.Exists())
{
sky1texture = level.skytexture1 = newsky;

View file

@ -586,11 +586,11 @@ void DequeueConsoleText ()
void C_InitConback()
{
conback = TexMan.CheckForTexture ("CONBACK", FTexture::TEX_MiscPatch);
conback = TexMan.CheckForTexture ("CONBACK", ETextureType::MiscPatch);
if (!conback.isValid())
{
conback = TexMan.GetTexture (gameinfo.TitlePage, FTexture::TEX_MiscPatch);
conback = TexMan.GetTexture (gameinfo.TitlePage, ETextureType::MiscPatch);
conshade = MAKEARGB(175,0,0,0);
conline = true;
}

View file

@ -243,7 +243,7 @@ void DWaitingCommand::Tick ()
{
if (--TicsLeft == 0)
{
UnsafeExecutionScope scope;
UnsafeExecutionScope scope(IsUnsafe);
AddCommandString (Command);
Destroy ();
}

View file

@ -641,7 +641,7 @@ void SetCompatibilityParams()
if (side != NULL)
{
assert(TexNames.Size() > (unsigned int)CompatParams[i + 4]);
const FTextureID texID = TexMan.GetTexture(TexNames[CompatParams[i + 4]], FTexture::TEX_Any);
const FTextureID texID = TexMan.GetTexture(TexNames[CompatParams[i + 4]], ETextureType::Any);
side->SetTexture(CompatParams[i + 3], texID);
}
}
@ -713,7 +713,7 @@ void SetCompatibilityParams()
? sec->floorplane
: sec->ceilingplane;
assert(TexNames.Size() > (unsigned int)CompatParams[i + 3]);
const FTextureID texID = TexMan.GetTexture(TexNames[CompatParams[i + 3]], FTexture::TEX_Any);
const FTextureID texID = TexMan.GetTexture(TexNames[CompatParams[i + 3]], ETextureType::Any);
sec->SetTexture(CompatParams[i + 2], texID);
}

View file

@ -564,6 +564,8 @@ static void stripwhite (char *str)
static char *igets (void)
{
assert(PatchPt != nullptr);
char *line;
if (*PatchPt == '\0' || PatchPt >= PatchFile + PatchSize )
@ -2536,7 +2538,7 @@ static bool DoDehPatch()
cont = 0;
if (0 == strncmp (PatchFile, "Patch File for DeHackEd v", 25))
{
if (PatchFile[25] < '3' && PatchFile[25] != '2' && PatchFile[27] != '3')
if (PatchFile[25] < '3' && (PatchFile[25] < '2' || PatchFile[27] < '3'))
{
Printf (PRINT_BOLD, "\"%s\" is an old and unsupported DeHackEd patch\n", PatchName);
delete[] PatchName;
@ -2550,16 +2552,16 @@ static bool DoDehPatch()
}
PatchPt = strchr (PatchFile, '\n');
while ((cont = GetLine()) == 1)
while (PatchPt != nullptr && (cont = GetLine()) == 1)
{
CHECKKEY ("Doom version", dversion)
else CHECKKEY ("Patch format", pversion)
}
if (!cont || dversion == -1 || pversion == -1)
{
Printf (PRINT_BOLD, "\"%s\" is not a DeHackEd patch file\n", PatchName);
delete[] PatchName;
delete[] PatchFile;
Printf (PRINT_BOLD, "\"%s\" is not a DeHackEd patch file\n", PatchFile);
return false;
}
}

View file

@ -918,7 +918,7 @@ void D_Display ()
// [RH] Draw icon, if any
if (D_DrawIcon)
{
FTextureID picnum = TexMan.CheckForTexture (D_DrawIcon, FTexture::TEX_MiscPatch);
FTextureID picnum = TexMan.CheckForTexture (D_DrawIcon, ETextureType::MiscPatch);
D_DrawIcon = NULL;
if (picnum.isValid())
@ -2352,6 +2352,9 @@ void D_DoomMain (void)
D_DoomInit();
extern void D_ConfirmSendStats();
D_ConfirmSendStats();
// [RH] Make sure zdoom.pk3 is always loaded,
// as it contains magic stuff we need.
wad = BaseFileSearch (BASEWAD, NULL, true);

View file

@ -1914,6 +1914,10 @@ void TryRunTics (void)
// Check possible stall conditions
Net_CheckLastReceived (counts);
// Update time returned by I_GetTime, but only if we are stuck in this loop
if (lowtic < gametic + counts)
I_SetFrameTime();
// don't stay in here forever -- give the menu a chance to work
if (I_GetTime () - entertic >= 1)
{

View file

@ -1,3 +1,16 @@
#ifdef NO_SEND_STATS
void D_DoAnonStats()
{
}
void D_ConfirmSendStats()
{
}
#else // !NO_SEND_STATS
#if defined(_WIN32)
#define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN
@ -5,6 +18,11 @@
#include <winsock2.h>
extern int sys_ostype;
#else
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#else // !__APPLE__
#include <SDL.h>
#endif // __APPLE__
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
@ -20,12 +38,13 @@ extern int sys_ostype;
EXTERN_CVAR(Bool, vid_glswfb)
extern int currentrenderer;
CVAR(Int, sys_statsenabled, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOSET)
CVAR(String, sys_statshost, "gzstats.drdteam.org", CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOSET)
CVAR(Int, sys_statsport, 80, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOSET)
// Each machine will only send two reports, one when started with hardware rendering and one when started with software rendering.
#define CHECKVERSION 330
#define CHECKVERSIONSTR "330"
#define CHECKVERSION 331
#define CHECKVERSIONSTR "331"
CVAR(Int, sentstats_swr_done, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOSET)
CVAR(Int, sentstats_hwr_done, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOSET)
@ -48,6 +67,11 @@ bool I_HTTPRequest(const char* request)
SOCKET Socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
struct hostent *host;
host = gethostbyname(sys_statshost.GetHumanString());
if (host == nullptr)
{
DPrintf(DMSG_ERROR, "Error looking up hostname.\n");
return false;
}
SOCKADDR_IN SockAddr;
SockAddr.sin_port = htons(sys_statsport);
SockAddr.sin_family = AF_INET;
@ -113,18 +137,15 @@ bool I_HTTPRequest(const char* request)
return false;
}
char buffer[1024];
sprintf(buffer, "%s", request);
Printf("Buffer: %s", buffer);
n = write(sockfd, (char*)buffer, (int)strlen(request));
n = write(sockfd, request, strlen(request));
if (n<0)
{
DPrintf(DMSG_ERROR, "Error writing to socket.\n");
close(sockfd);
return false;
}
bzero(buffer, 1024);
char buffer[1024] = {};
n = read(sockfd, buffer, 1023);
close(sockfd);
DPrintf(DMSG_NOTIFY, "Stats send successful.\n");
@ -185,12 +206,49 @@ static int GetOSVersion()
#endif
}
#ifdef _WIN32
static int GetCoreInfo()
{
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL;
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = NULL;
DWORD returnLength = 0;
int cores = 0;
uint32_t byteOffset = 0;
auto rc = GetLogicalProcessorInformation(buffer, &returnLength);
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)malloc(returnLength);
if (!GetLogicalProcessorInformation(buffer, &returnLength)) return 0;
}
else
{
return 0;
}
ptr = buffer;
while (byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength)
{
if (ptr->Relationship == RelationProcessorCore) cores++;
byteOffset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
ptr++;
}
free(buffer);
return cores < 2 ? 0 : cores < 4 ? 1 : cores < 6 ? 2 : cores < 8 ? 3 : 4;
}
#else
static int GetCoreInfo()
{
int cores = std::thread::hardware_concurrency();
if (CPU.HyperThreading) cores /= 2;
return cores < 2? 0 : cores < 4? 1 : cores < 6? 2 : cores < 8? 3 : 4;
}
#endif
static int GetRenderInfo()
{
@ -227,6 +285,11 @@ static void D_DoHTTPRequest(const char *request)
void D_DoAnonStats()
{
if (sys_statsenabled != 1)
{
return;
}
static bool done = false; // do this only once per session.
if (done) return;
done = true;
@ -236,9 +299,75 @@ void D_DoAnonStats()
if (currentrenderer == 1 && sentstats_hwr_done >= CHECKVERSION) return;
static char requeststring[1024];
sprintf(requeststring, "GET /stats.php?render=%i&cores=%i&os=%i HTTP/1.1\nHost: %s\nConnection: close\nUser-Agent: %s %s\n\n",
GetRenderInfo(), GetCoreInfo(), GetOSVersion(), sys_statshost.GetHumanString(), GAMENAME, VERSIONSTR);
mysnprintf(requeststring, sizeof requeststring, "GET /stats.py?render=%i&cores=%i&os=%i&renderconfig=%i HTTP/1.1\nHost: %s\nConnection: close\nUser-Agent: %s %s\n\n",
GetRenderInfo(), GetCoreInfo(), GetOSVersion(), currentrenderer, sys_statshost.GetHumanString(), GAMENAME, VERSIONSTR);
DPrintf(DMSG_NOTIFY, "Sending %s", requeststring);
std::thread t1(D_DoHTTPRequest, requeststring);
t1.detach();
}
void D_ConfirmSendStats()
{
if (sys_statsenabled >= 0)
{
return;
}
// TODO: texts
static const char *const MESSAGE_TEXT = "In order to decide where to focus development, the GZDoom team would like to know a little bit about the hardware it is run on.\n" \
"For this we would like to ask you if we may send three bits of information to gzstats.drdteam.org.\n" \
"The three items we would like to know about are:\n" \
"- Operating system\n" \
"- Number of processor cores\n" \
"- Currently used renderer\n\n" \
"All information sent will be anonymous. We will NOT be sending this information to any third party.\n" \
"It will merely be used for decision-making about GZDoom's future development.\n" \
"Data will only be sent at most twice per system, once for the software renderer and once for the hardware renderer.\n" \
"If you are getting this notice more than once per renderer, please let us know on the forums. Thanks!\n\n" \
"May we send this data? If you click 'no', nothing will be sent and you will not be asked again.";
static const char *const TITLE_TEXT = "GZDoom needs your help!";
UCVarValue enabled = { 0 };
#ifdef _WIN32
extern HWND Window;
enabled.Int = MessageBox(Window, MESSAGE_TEXT, TITLE_TEXT, MB_ICONQUESTION | MB_YESNO) == IDYES;
#elif defined __APPLE__
const CFStringRef messageString = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, MESSAGE_TEXT, kCFStringEncodingASCII, kCFAllocatorNull);
const CFStringRef titleString = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, TITLE_TEXT, kCFStringEncodingASCII, kCFAllocatorNull);
if (messageString != nullptr && titleString != nullptr)
{
CFOptionFlags response;
const SInt32 result = CFUserNotificationDisplayAlert(0, kCFUserNotificationNoteAlertLevel, nullptr, nullptr, nullptr,
titleString, messageString, CFSTR("Yes"), CFSTR("No"), nullptr, &response);
enabled.Int = result == 0 && (response & 3) == kCFUserNotificationDefaultResponse;
CFRelease(titleString);
CFRelease(messageString);
}
#else // !__APPLE__
const SDL_MessageBoxButtonData buttons[] =
{
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 0, "Yes" },
{ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 1, "No" },
};
const SDL_MessageBoxData messageboxdata =
{
SDL_MESSAGEBOX_INFORMATION,
nullptr,
TITLE_TEXT,
MESSAGE_TEXT,
SDL_arraysize(buttons),
buttons,
nullptr
};
int buttonid;
enabled.Int = SDL_ShowMessageBox(&messageboxdata, &buttonid) == 0 && buttonid == 0;
#endif // _WIN32
sys_statsenabled.ForceSet(enabled, CVAR_Int);
}
#endif // NO_SEND_STATS

View file

@ -487,10 +487,10 @@ void FDecalLib::ParseDecal (FScanner &sc)
case DECAL_PIC:
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, FTexture::TEX_Any);
picnum = TexMan.CheckForTexture (sc.String, ETextureType::Any);
if (!picnum.Exists() && (lumpnum = Wads.CheckNumForName (sc.String, ns_graphics)) >= 0)
{
picnum = TexMan.CreateTexture (lumpnum, FTexture::TEX_Decal);
picnum = TexMan.CreateTexture (lumpnum, ETextureType::Decal);
}
newdecal.PicNum = picnum;
break;

View file

@ -128,6 +128,11 @@ struct PalEntry
return other;
}
}
int Luminance() const
{
return (r * 77 + g * 143 + b * 37) >> 8;
}
void Decolorize() // this for 'nocoloredspritelighting' and not the same as desaturation. The normal formula results in a value that's too dark.
{
int v = (r + g + b);
@ -168,6 +173,31 @@ struct PalEntry
#endif
};
inline int Luminance(int r, int g, int b)
{
return (r * 77 + g * 143 + b * 37) >> 8;
}
enum class ETextureType : uint8_t
{
Any,
Wall,
Flat,
Sprite,
WallPatch,
Build, // no longer used but needs to remain for ZScript
SkinSprite,
Decal,
MiscPatch,
FontChar,
Override, // For patches between TX_START/TX_END
Autopage, // Automap background - used to enable the use of FAutomapTexture
SkinGraphic,
Null,
FirstDefined,
};
class FTextureID
{
friend class FTextureManager;

View file

@ -413,6 +413,18 @@ void E_WorldThingDestroyed(AActor* actor)
handler->WorldThingDestroyed(actor);
}
void E_WorldLinePreActivated(line_t* line, AActor* actor, bool* shouldactivate)
{
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
handler->WorldLinePreActivated(line, actor, shouldactivate);
}
void E_WorldLineActivated(line_t* line, AActor* actor)
{
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
handler->WorldLineActivated(line, actor);
}
void E_PlayerEntered(int num, bool fromhub)
{
// this event can happen during savegamerestore. make sure that local handlers don't receive it.
@ -509,6 +521,7 @@ DEFINE_EVENT_LOOPER(RenderFrame)
DEFINE_EVENT_LOOPER(WorldLightning)
DEFINE_EVENT_LOOPER(WorldTick)
DEFINE_EVENT_LOOPER(UiTick)
DEFINE_EVENT_LOOPER(PostUiTick)
// declarations
IMPLEMENT_CLASS(DStaticEventHandler, false, true);
@ -540,6 +553,8 @@ DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageSource);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageType);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageFlags);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageAngle);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, ActivatedLine);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, ShouldActivate);
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, PlayerNumber);
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, IsReturn);
@ -626,6 +641,8 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingDied)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingRevived)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingDamaged)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingDestroyed)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLinePreActivated)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLineActivated)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLightning)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldTick)
@ -640,6 +657,7 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, PlayerDisconnected)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, UiProcess);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, InputProcess);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, UiTick);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, PostUiTick);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, ConsoleProcess);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, NetworkProcess);
@ -786,6 +804,38 @@ void DStaticEventHandler::WorldThingDestroyed(AActor* actor)
}
}
void DStaticEventHandler::WorldLinePreActivated(line_t* line, AActor* actor, bool* shouldactivate)
{
IFVIRTUAL(DStaticEventHandler, WorldLinePreActivated)
{
// don't create excessive DObjects if not going to be processed anyway
if (func == DStaticEventHandler_WorldLinePreActivated_VMPtr)
return;
FWorldEvent e = E_SetupWorldEvent();
e.Thing = actor;
e.ActivatedLine = line;
e.ShouldActivate = *shouldactivate;
VMValue params[2] = { (DStaticEventHandler*)this, &e };
VMCall(func, params, 2, nullptr, 0);
*shouldactivate = e.ShouldActivate;
}
}
void DStaticEventHandler::WorldLineActivated(line_t* line, AActor* actor)
{
IFVIRTUAL(DStaticEventHandler, WorldLineActivated)
{
// don't create excessive DObjects if not going to be processed anyway
if (func == DStaticEventHandler_WorldLineActivated_VMPtr)
return;
FWorldEvent e = E_SetupWorldEvent();
e.Thing = actor;
e.ActivatedLine = line;
VMValue params[2] = { (DStaticEventHandler*)this, &e };
VMCall(func, params, 2, nullptr, 0);
}
}
void DStaticEventHandler::WorldLightning()
{
IFVIRTUAL(DStaticEventHandler, WorldLightning)
@ -1021,6 +1071,18 @@ void DStaticEventHandler::UiTick()
}
}
void DStaticEventHandler::PostUiTick()
{
IFVIRTUAL(DStaticEventHandler, PostUiTick)
{
// don't create excessive DObjects if not going to be processed anyway
if (func == DStaticEventHandler_PostUiTick_VMPtr)
return;
VMValue params[1] = { (DStaticEventHandler*)this };
VMCall(func, params, 1, nullptr, 0);
}
}
void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual)
{
if (player < 0)

View file

@ -40,12 +40,18 @@ void E_WorldThingRevived(AActor* actor);
void E_WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int damage, FName mod, int flags, DAngle angle);
// called before AActor::Destroy of each actor.
void E_WorldThingDestroyed(AActor* actor);
// called in P_ActivateLine before executing special, set shouldactivate to false to prevent activation.
void E_WorldLinePreActivated(line_t* line, AActor* actor, bool* shouldactivate);
// called in P_ActivateLine after successful special execution.
void E_WorldLineActivated(line_t* line, AActor* actor);
// same as ACS SCRIPT_Lightning
void E_WorldLightning();
// this executes on every tick, before everything, only when in valid level and not paused
void E_WorldTick();
// this executes on every tick on UI side, always
void E_UiTick();
// this executes on every tick on UI side, always AND immediately after everything else
void E_PostUiTick();
// called on each render frame once.
void E_RenderFrame();
// called after everything's been rendered, but before console/menus
@ -137,6 +143,8 @@ public:
void WorldThingRevived(AActor*);
void WorldThingDamaged(AActor*, AActor*, AActor*, int, FName, int, DAngle);
void WorldThingDestroyed(AActor*);
void WorldLinePreActivated(line_t*, AActor*, bool*);
void WorldLineActivated(line_t*, AActor*);
void WorldLightning();
void WorldTick();
@ -154,6 +162,7 @@ public:
bool InputProcess(const event_t* ev);
bool UiProcess(const event_t* ev);
void UiTick();
void PostUiTick();
//
void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual);
@ -192,6 +201,9 @@ struct FWorldEvent
FName DamageType;
int DamageFlags = 0;
DAngle DamageAngle;
// for line(pre)activated
line_t* ActivatedLine = nullptr;
bool ShouldActivate = true;
};
struct FPlayerEvent
@ -249,4 +261,4 @@ struct FConsoleEvent
bool IsManual;
};
#endif
#endif

View file

@ -201,56 +201,56 @@ public:
uint8_t ReadUInt8()
{
uint8_t v;
uint8_t v = 0;
Read(&v, 1);
return v;
}
int8_t ReadInt8()
{
int8_t v;
int8_t v = 0;
Read(&v, 1);
return v;
}
uint16_t ReadUInt16()
{
uint16_t v;
uint16_t v = 0;
Read(&v, 2);
return LittleShort(v);
}
int16_t ReadInt16()
{
uint16_t v;
uint16_t v = 0;
Read(&v, 2);
return LittleShort(v);
}
uint32_t ReadUInt32()
{
uint32_t v;
uint32_t v = 0;
Read(&v, 4);
return LittleLong(v);
}
int32_t ReadInt32()
{
uint32_t v;
uint32_t v = 0;
Read(&v, 4);
return LittleLong(v);
}
uint32_t ReadUInt32BE()
{
uint32_t v;
uint32_t v = 0;
Read(&v, 4);
return BigLong(v);
}
int32_t ReadInt32BE()
{
uint32_t v;
uint32_t v = 0;
Read(&v, 4);
return BigLong(v);
}

View file

@ -1890,7 +1890,7 @@ void FParser::SF_FloorTexture(void)
if(t_argc > 1)
{
int i = -1;
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
// set all sectors with tag
FSSectorTagIterator itr(tagnum);
@ -1980,7 +1980,7 @@ void FParser::SF_CeilingTexture(void)
if(t_argc > 1)
{
int i = -1;
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
// set all sectors with tag
FSSectorTagIterator itr(tagnum);
@ -2233,7 +2233,7 @@ void FParser::SF_SetLineTexture(void)
position=3-position;
texture = stringvalue(t_argv[3]);
texturenum = TexMan.GetTexture(texture, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
texturenum = TexMan.GetTexture(texture, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
FLineIdIterator itr(tag);
while ((i = itr.Next()) >= 0)
@ -2250,7 +2250,7 @@ void FParser::SF_SetLineTexture(void)
}
else // and an improved legacy version
{
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
side = !!intvalue(t_argv[2]);
int sections = intvalue(t_argv[3]);

View file

@ -192,7 +192,7 @@ void FScriptLoader::ParseInfoCmd(char *line, FString &scriptsrc)
sc.MustGetStringName("=");
sc.MustGetString();
sky2texture = sky1texture = level.skytexture1 = level.skytexture2 = TexMan.GetTexture (sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky2texture = sky1texture = level.skytexture1 = level.skytexture2 = TexMan.GetTexture (sc.String, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
R_InitSkyMap ();
}
else if (sc.Compare("interpic"))

View file

@ -1256,6 +1256,9 @@ void G_Ticker ()
default:
break;
}
// [MK] Additional ticker for UI events right after all others
E_PostUiTick();
}

View file

@ -82,6 +82,7 @@ DEFINE_FIELD(AInventory, MaxAmount)
DEFINE_FIELD(AInventory, InterHubAmount)
DEFINE_FIELD(AInventory, RespawnTics)
DEFINE_FIELD(AInventory, Icon)
DEFINE_FIELD(AInventory, AltHUDIcon)
DEFINE_FIELD(AInventory, DropTime)
DEFINE_FIELD(AInventory, SpawnPointClass)
DEFINE_FIELD(AInventory, PickupFlash)
@ -147,6 +148,7 @@ void AInventory::Serialize(FSerializer &arc)
("respawntics", RespawnTics, def->RespawnTics)
("itemflags", ItemFlags, def->ItemFlags)
("icon", Icon, def->Icon)
("althudicon", AltHUDIcon, def->AltHUDIcon)
("pickupsound", PickupSound, def->PickupSound)
("spawnpointclass", SpawnPointClass, def->SpawnPointClass)
("droptime", DropTime, def->DropTime);

View file

@ -87,6 +87,7 @@
#include "vm.h"
#include "events.h"
#include "dobjgc.h"
#include "i_music.h"
#include "gi.h"
@ -600,6 +601,7 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
startpos = position;
gameaction = ga_completed;
level.SetMusicVolume(1.0);
if (nextinfo != NULL)
{
@ -741,7 +743,7 @@ void G_DoCompleted (void)
AM_Stop ();
wminfo.finished_ep = level.cluster - 1;
wminfo.LName0 = TexMan.CheckForTexture(level.info->PName, FTexture::TEX_MiscPatch);
wminfo.LName0 = TexMan.CheckForTexture(level.info->PName, ETextureType::MiscPatch);
wminfo.current = level.MapName;
if (deathmatch &&
@ -762,7 +764,7 @@ void G_DoCompleted (void)
else
{
wminfo.next = nextinfo->MapName;
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, FTexture::TEX_MiscPatch);
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, ETextureType::MiscPatch);
}
}
@ -953,7 +955,7 @@ void G_DoLoadLevel (int position, bool autosave)
// a flat. The data is in the WAD only because
// we look for an actual index, instead of simply
// setting one.
skyflatnum = TexMan.GetTexture (gameinfo.SkyFlatName, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
skyflatnum = TexMan.GetTexture (gameinfo.SkyFlatName, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
// DOOM determines the sky texture to be used
// depending on the current episode and the game version.
@ -1425,8 +1427,8 @@ void G_InitLevelLocals ()
level.info = info;
level.skyspeed1 = info->skyspeed1;
level.skyspeed2 = info->skyspeed2;
level.skytexture1 = TexMan.GetTexture(info->SkyPic1, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
level.skytexture2 = TexMan.GetTexture(info->SkyPic2, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
level.skytexture1 = TexMan.GetTexture(info->SkyPic1, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
level.skytexture2 = TexMan.GetTexture(info->SkyPic2, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
level.fadeto = info->fadeto;
level.cdtrack = info->cdtrack;
level.cdid = info->cdid;
@ -1469,6 +1471,7 @@ void G_InitLevelLocals ()
level.levelnum = info->levelnum;
level.Music = info->Music;
level.musicorder = info->musicorder;
level.MusicVolume = 1.f;
level.LevelName = level.info->LookupLevelName();
level.NextMap = info->NextMap;
@ -1960,6 +1963,17 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, SetInterMusic)
//
//==========================================================================
void FLevelLocals::SetMusicVolume(float f)
{
MusicVolume = f;
I_SetMusicVolume(f);
}
//==========================================================================
//
//
//==========================================================================
template <typename T>
inline T VecDiff(const T& v1, const T& v2)
{

View file

@ -46,6 +46,7 @@ struct FLevelLocals
void Tick ();
void AddScroller (int secnum);
void SetInterMusic(const char *nextmap);
void SetMusicVolume(float v);
uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.
int time; // time in the hub
@ -149,6 +150,7 @@ struct FLevelLocals
int skyfog;
float pixelstretch;
float MusicVolume;
bool IsJumpingAllowed() const;
bool IsCrouchingAllowed() const;
@ -162,6 +164,7 @@ struct FLevelLocals
{
return headgamenode;
}
};
extern FLevelLocals level;

View file

@ -354,7 +354,7 @@ static void DrawArmor(AInventory * barmor, AInventory * harmor, int x, int y)
case 3: icon[3] = '4'; break;
default: break;
}
DrawImageToBox(TexMan.FindTexture(icon, FTexture::TEX_Sprite), x, y, 31, 17);
DrawImageToBox(TexMan.FindTexture(icon, ETextureType::Sprite), x, y, 31, 17);
}
else if (barmor) DrawImageToBox(TexMan[barmor->Icon], x, y, 31, 17);
DrawHudNumber(HudFont, fontcolor, ap, x + 33, y + 17);
@ -1285,13 +1285,13 @@ void HUD_InitHud()
if (sc.Compare("Health"))
{
sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
FTextureID tex = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
if (tex.isValid()) healthpic = TexMan[tex];
}
else if (sc.Compare("Berserk"))
{
sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
FTextureID tex = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
if (tex.isValid()) berserkpic = TexMan[tex];
}
else
@ -1311,7 +1311,7 @@ void HUD_InitHud()
if (!sc.Compare("0") && !sc.Compare("NULL") && !sc.Compare(""))
{
tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
tex = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
}
else tex.SetInvalid();

View file

@ -517,6 +517,7 @@ enum DI_Flags
DI_ALWAYSSHOWCOUNT = 0x200, // only for DrawInventoryBar.
DI_DIMDEPLETED = 0x400,
DI_DONTANIMATE = 0x800, // do not animate the texture
DI_MIRROR = 0x1000, // flip the texture horizontally, like a mirror
DI_SCREEN_AUTO = 0, // decide based on given offsets.
DI_SCREEN_MANUAL_ALIGN = 0x4000, // If this is on, the following flags will have an effect

View file

@ -99,7 +99,7 @@ FTexture *FMugShotFrame::GetTexture(const char *default_face, const char *skin_f
}
sprite.UnlockBuffer();
}
return TexMan[TexMan.CheckForTexture(sprite, 0, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_AllowSkins)];
return TexMan[TexMan.CheckForTexture(sprite, ETextureType::Any, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_AllowSkins)];
}
//===========================================================================

View file

@ -300,7 +300,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
if (flags & DI_ALTERNATEONFAIL)
{
SetTruth(texture == NULL || texture->UseType == FTexture::TEX_Null, block, statusBar);
SetTruth(texture == NULL || texture->UseType == ETextureType::Null, block, statusBar);
}
}
protected:

View file

@ -214,14 +214,14 @@ void ST_LoadCrosshair(bool alwaysload)
size = (SCREENWIDTH < 640) ? 'S' : 'B';
mysnprintf (name, countof(name), "XHAIR%c%d", size, num);
FTextureID texid = TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
FTextureID texid = TexMan.CheckForTexture(name, ETextureType::MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
if (!texid.isValid())
{
mysnprintf (name, countof(name), "XHAIR%c1", size);
texid = TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
texid = TexMan.CheckForTexture(name, ETextureType::MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
if (!texid.isValid())
{
texid = TexMan.CheckForTexture("XHAIRS1", FTexture::TEX_MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
texid = TexMan.CheckForTexture("XHAIRS1", ETextureType::MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
}
}
CrosshairNum = num;
@ -1635,6 +1635,7 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
DTA_Alpha, Alpha,
DTA_AlphaChannel, !!(flags & DI_ALPHAMAPPED),
DTA_FillColor, (flags & DI_ALPHAMAPPED) ? 0 : -1,
DTA_FlipX, !!(flags & DI_MIRROR),
TAG_DONE);
}
@ -1669,7 +1670,7 @@ DEFINE_ACTION_FUNCTION(DBaseStatusBar, DrawImage)
PARAM_FLOAT_DEF(scaleX);
PARAM_FLOAT_DEF(scaleY);
if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
self->DrawGraphic(TexMan.CheckForTexture(texid, FTexture::TEX_Any), x, y, flags, alpha, w, h, scaleX, scaleY);
self->DrawGraphic(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, alpha, w, h, scaleX, scaleY);
return 0;
}

View file

@ -92,7 +92,7 @@ void AdjustSpriteOffsets()
char str[9];
Wads.GetLumpName(str, i);
str[8] = 0;
FTextureID texid = TexMan.CheckForTexture(str, FTexture::TEX_Sprite, 0);
FTextureID texid = TexMan.CheckForTexture(str, ETextureType::Sprite, 0);
if (texid.isValid() && Wads.GetLumpFile(TexMan[texid]->SourceLump) > Wads.GetIwadNum())
{
// This texture has been replaced by some PWAD.
@ -114,7 +114,7 @@ void AdjustSpriteOffsets()
int x,y;
bool iwadonly = false;
bool forced = false;
FTextureID texno = TexMan.CheckForTexture(sc.String, FTexture::TEX_Sprite);
FTextureID texno = TexMan.CheckForTexture(sc.String, ETextureType::Sprite);
sc.MustGetStringName(",");
sc.MustGetNumber();
x=sc.Number;

View file

@ -50,7 +50,7 @@ void gl_InitGlow(FScanner &sc)
while (!sc.CheckString("}"))
{
sc.MustGetString();
FTextureID flump=TexMan.CheckForTexture(sc.String, FTexture::TEX_Flat,FTextureManager::TEXMAN_TryAny);
FTextureID flump=TexMan.CheckForTexture(sc.String, ETextureType::Flat,FTextureManager::TEXMAN_TryAny);
FTexture *tex = TexMan[flump];
if (tex) tex->gl_info.bAutoGlowing = tex->gl_info.bGlowing = tex->gl_info.bFullbright = true;
}
@ -61,7 +61,7 @@ void gl_InitGlow(FScanner &sc)
while (!sc.CheckString("}"))
{
sc.MustGetString();
FTextureID flump=TexMan.CheckForTexture(sc.String, FTexture::TEX_Wall,FTextureManager::TEXMAN_TryAny);
FTextureID flump=TexMan.CheckForTexture(sc.String, ETextureType::Wall,FTextureManager::TEXMAN_TryAny);
FTexture *tex = TexMan[flump];
if (tex) tex->gl_info.bAutoGlowing = tex->gl_info.bGlowing = tex->gl_info.bFullbright = true;
}
@ -70,7 +70,7 @@ void gl_InitGlow(FScanner &sc)
{
sc.SetCMode(true);
sc.MustGetString();
FTextureID flump=TexMan.CheckForTexture(sc.String, FTexture::TEX_Flat,FTextureManager::TEXMAN_TryAny);
FTextureID flump=TexMan.CheckForTexture(sc.String, ETextureType::Flat,FTextureManager::TEXMAN_TryAny);
FTexture *tex = TexMan[flump];
sc.MustGetStringName(",");
sc.MustGetString();

View file

@ -91,7 +91,9 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
if (!img->bHasCanvas)
{
if (!parms.alphaChannel)
dg.mAlphaTexture = !!(parms.style.Flags & STYLEF_RedIsAlpha);
if (!dg.mAlphaTexture)
{
if (parms.remap != NULL && !parms.remap->Inactive)
{
@ -99,7 +101,6 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
if (pal) dg.mTranslation = -pal->GetIndex();
}
}
dg.mAlphaTexture = !!(parms.style.Flags & STYLEF_RedIsAlpha);
u1 = gltex->GetUL();
v1 = gltex->GetVT();
u2 = gltex->GetUR();

View file

@ -236,10 +236,10 @@ FGLRenderer::~FGLRenderer()
void FGLRenderer::GetSpecialTextures()
{
if (gl.legacyMode) glLight = TexMan.CheckForTexture("glstuff/gllight.png", FTexture::TEX_MiscPatch);
glPart2 = TexMan.CheckForTexture("glstuff/glpart2.png", FTexture::TEX_MiscPatch);
glPart = TexMan.CheckForTexture("glstuff/glpart.png", FTexture::TEX_MiscPatch);
mirrorTexture = TexMan.CheckForTexture("glstuff/mirror.png", FTexture::TEX_MiscPatch);
if (gl.legacyMode) glLight = TexMan.CheckForTexture("glstuff/gllight.png", ETextureType::MiscPatch);
glPart2 = TexMan.CheckForTexture("glstuff/glpart2.png", ETextureType::MiscPatch);
glPart = TexMan.CheckForTexture("glstuff/glpart.png", ETextureType::MiscPatch);
mirrorTexture = TexMan.CheckForTexture("glstuff/mirror.png", ETextureType::MiscPatch);
}

View file

@ -144,14 +144,9 @@ public:
void SetMaterial(FMaterial *mat, int clampmode, int translation, int overrideshader, bool alphatexture)
{
// textures without their own palette are a special case for use as an alpha texture:
// They use the color index directly as an alpha value instead of using the palette's red.
// To handle this case, we need to set a special translation for such textures.
// Without shaders this translation must be applied to any texture.
if (alphatexture)
{
if (mat->tex->UseBasePalette() || gl.legacyMode) translation = TRANSLATION(TRANSLATION_Standard, 8);
}
// alpha textures need special treatment in the legacy renderer because withouz shaders they need a different texture.
if (alphatexture && gl.legacyMode) translation = INT_MAX;
if (mat->tex->bHasCanvas)
{
mTempTM = TM_OPAQUE;

View file

@ -135,7 +135,7 @@ void GLSceneDrawer::AddLine (seg_t *seg, bool portalclip)
if (!seg->linedef->isVisualPortal())
{
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::mid));
if (!tex || tex->UseType==FTexture::TEX_Null)
if (!tex || tex->UseType==ETextureType::Null)
{
// nothing to do here!
seg->linedef->validcount=validcount;

View file

@ -114,7 +114,7 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
if (bs_ceilingheight1 <= fs_floorheight1 && bs_ceilingheight2 <= fs_floorheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top));
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
if (!tex || tex->UseType == ETextureType::Null) return false;
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;
return true;
@ -123,7 +123,7 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
if (fs_ceilingheight1 <= bs_floorheight1 && fs_ceilingheight2 <= bs_floorheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
if (!tex || tex->UseType == ETextureType::Null) return false;
// properly render skies (consider door "open" if both floors are sky):
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
@ -137,12 +137,12 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
if (bs_ceilingheight1 < fs_ceilingheight1 || bs_ceilingheight2 < fs_ceilingheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top));
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
if (!tex || tex->UseType == ETextureType::Null) return false;
}
if (bs_floorheight1 > fs_floorheight1 || bs_floorheight2 > fs_floorheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
if (!tex || tex->UseType == ETextureType::Null) return false;
}
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;

View file

@ -298,7 +298,7 @@ bool FDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez)
{
// If there's a texture abort
FTexture * tex = TexMan[seg->sidedef->GetTexture(side_t::top)];
if (!tex || tex->UseType == FTexture::TEX_Null) continue;
if (!tex || tex->UseType == ETextureType::Null) continue;
else return false;
}
}
@ -356,7 +356,7 @@ bool FDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez)
{
// If there's a texture abort
FTexture * tex = TexMan[seg->sidedef->GetTexture(side_t::bottom)];
if (!tex || tex->UseType == FTexture::TEX_Null) continue;
if (!tex || tex->UseType == ETextureType::Null) continue;
else return false;
}
}

View file

@ -66,7 +66,7 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor)
FTextureID texno = s->GetTexture(pos);
texture[0] = FMaterial::ValidateTexture(texno, false, true);
if (!texture[0] || texture[0]->tex->UseType == FTexture::TEX_Null) goto normalsky;
if (!texture[0] || texture[0]->tex->UseType == ETextureType::Null) goto normalsky;
skytexno1 = texno;
x_offset[0] = s->GetTextureXOffset(pos) * (360.f/65536.f);
y_offset = s->GetTextureYOffset(pos);
@ -247,7 +247,7 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex
if (bs->GetPlaneTexZ(sector_t::floor)==fs->GetPlaneTexZ(sector_t::floor)+1.)
{
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType==FTexture::TEX_Null) return;
if (!tex || tex->UseType==ETextureType::Null) return;
// very, very, very ugly special case (See Icarus MAP14)
// It is VERY important that this is only done for a floor height difference of 1
@ -331,7 +331,7 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom));
// For lower skies the normal logic only applies to walls with no lower texture!
if (tex->UseType==FTexture::TEX_Null)
if (tex->UseType==ETextureType::Null)
{
if (bs->GetTexture(sector_t::floor)==skyflatnum)
{
@ -349,7 +349,7 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver
}
zbottom[0]=zbottom[1]=-32768.0f;
if ((tex && tex->UseType!=FTexture::TEX_Null) || bs->GetTexture(sector_t::floor)!=skyflatnum)
if ((tex && tex->UseType!=ETextureType::Null) || bs->GetTexture(sector_t::floor)!=skyflatnum)
{
ztop[0]=zfloor[0];
ztop[1]=zfloor[1];

View file

@ -819,7 +819,10 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
// [ZZ] add direct picnum override
if (isPicnumOverride)
{
patch = thing->picnum;
// Animate picnum overrides.
auto tex = TexMan(thing->picnum);
if (tex == nullptr) return;
patch = tex->id;
mirror = false;
}
else

View file

@ -822,7 +822,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
//
//
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::top));
if (!tex || tex->UseType==FTexture::TEX_Null)
if (!tex || tex->UseType==ETextureType::Null)
{
if (front->GetTexture(sector_t::ceiling) == skyflatnum &&
back->GetTexture(sector_t::ceiling) == skyflatnum)
@ -858,7 +858,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
//
//
tex = TexMan(seg->sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType==FTexture::TEX_Null)
if (!tex || tex->UseType==ETextureType::Null)
{
// texture is missing - use the lower plane
bottomleft = MIN(bfh1,ffh1);
@ -1392,6 +1392,12 @@ void GLWall::DoFFloorBlocks(seg_t * seg, sector_t * frontsector, sector_t * back
ff_topleft = topleft;
ff_topright = topright;
}
if (ff_bottomleft < bottomleft && ff_bottomright < bottomright)
{
// the new section extends into the floor.
ff_bottomleft = bottomleft;
ff_bottomright = bottomright;
}
// do all inverse floors above the current one it there is a gap between the
// last 3D floor and this one.

View file

@ -223,8 +223,8 @@ void PostProcessShaderInstance::BindTextures()
continue;
FString name = pair->Value;
FTexture *tex = TexMan(TexMan.CheckForTexture(name, FTexture::TEX_Any));
if (tex && tex->UseType != FTexture::TEX_Null)
FTexture *tex = TexMan(TexMan.CheckForTexture(name, ETextureType::Any));
if (tex && tex->UseType != ETextureType::Null)
{
glUniform1i(location, textureUnit);

View file

@ -964,11 +964,11 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump)
}
else
{
int type = FTexture::TEX_Any;
ETextureType type = ETextureType::Any;
if (sc.Compare("texture")) type = FTexture::TEX_Wall;
else if (sc.Compare("flat")) type = FTexture::TEX_Flat;
else if (sc.Compare("sprite")) type = FTexture::TEX_Sprite;
if (sc.Compare("texture")) type = ETextureType::Wall;
else if (sc.Compare("flat")) type = ETextureType::Flat;
else if (sc.Compare("sprite")) type = ETextureType::Sprite;
else sc.UnGet();
bool disable_fullbright = false;

View file

@ -243,7 +243,7 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
if (sc.GetString())
{
texture = TexMan.CheckForTexture(sc.String, FTexture::TEX_Wall);
texture = TexMan.CheckForTexture(sc.String, ETextureType::Wall);
if (!texture.isValid())
{
sc.ScriptMessage("Unknown texture '%s'", sc.String);

View file

@ -2050,7 +2050,8 @@ void OpenGLSWFrameBuffer::Atlas::FreeBox(OpenGLSWFrameBuffer::PackedTexture *box
//
//==========================================================================
OpenGLSWFrameBuffer::OpenGLTex::OpenGLTex(FTexture *tex, OpenGLSWFrameBuffer *fb, bool wrapping)
OpenGLSWFrameBuffer::OpenGLTex::OpenGLTex(FTexture *tex, FTextureFormat fmt, OpenGLSWFrameBuffer *fb, bool wrapping)
: FNativeTexture(tex, fmt)
{
// Attach to the texture list for the OpenGLSWFrameBuffer
Next = fb->Textures;
@ -2090,7 +2091,7 @@ OpenGLSWFrameBuffer::OpenGLTex::~OpenGLTex()
// Remove link from the game texture
if (GameTex != nullptr)
{
GameTex->Native = nullptr;
mGameTex->Native[mFormat] = nullptr;
}
}
@ -2199,7 +2200,7 @@ bool OpenGLSWFrameBuffer::OpenGLTex::Update()
{
dest += pitch + (format == GL_R8 ? 1 : 4);
}
GameTex->FillBuffer(dest, pitch, GameTex->GetHeight(), ToTexFmt(format));
GameTex->FillBuffer(dest, pitch, GameTex->GetHeight(), mFormat);
if (Box->Padded)
{
// Clear top padding row.
@ -2265,50 +2266,25 @@ bool OpenGLSWFrameBuffer::OpenGLTex::Update()
int OpenGLSWFrameBuffer::OpenGLTex::GetTexFormat()
{
FTextureFormat fmt = GameTex->GetFormat();
IsGray = false;
switch (fmt)
switch (mFormat)
{
case TEX_Pal: return GL_R8;
case TEX_Gray: IsGray = true; return GL_R8;
case TEX_RGB: return GL_RGBA8;
#if 0
case TEX_DXT1: return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
case TEX_DXT2: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
case TEX_DXT3: return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
case TEX_DXT4: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; // Doesn't exist in OpenGL. Closest match is DXT5.
case TEX_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
#endif
default: I_FatalError("GameTex->GetFormat() returned invalid format.");
}
return GL_R8;
}
//==========================================================================
//
// OpenGLTex :: ToTexFmt
//
// Converts an OpenGL internal format constant to something the FTexture system
// understands.
//
//==========================================================================
FTextureFormat OpenGLSWFrameBuffer::OpenGLTex::ToTexFmt(int fmt)
{
switch (fmt)
{
case GL_R8: return IsGray ? TEX_Gray : TEX_Pal;
case GL_RGBA8: return TEX_RGB;
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return TEX_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return TEX_DXT2;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return TEX_DXT3;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return TEX_DXT5;
default:
assert(0); // LOL WUT?
return TEX_Pal;
}
}
//==========================================================================
//
// OpenGLPal Constructor
@ -2540,9 +2516,9 @@ void OpenGLSWFrameBuffer::DrawBlendingRect()
//
//==========================================================================
FNativeTexture *OpenGLSWFrameBuffer::CreateTexture(FTexture *gametex, bool wrapping)
FNativeTexture *OpenGLSWFrameBuffer::CreateTexture(FTexture *gametex, FTextureFormat fmt, bool wrapping)
{
OpenGLTex *tex = new OpenGLTex(gametex, this, wrapping);
OpenGLTex *tex = new OpenGLTex(gametex, fmt, this, wrapping);
if (tex->Box == nullptr)
{
delete tex;
@ -2767,7 +2743,12 @@ void OpenGLSWFrameBuffer::DrawTextureParms(FTexture *img, DrawParms &parms)
return;
}
OpenGLTex *tex = static_cast<OpenGLTex *>(img->GetNative(false));
FTextureFormat fmt;
if (parms.style.Flags & STYLEF_RedIsAlpha) fmt = TEX_Gray;
else if (parms.remap != nullptr) fmt = TEX_Pal;
else fmt = img->GetFormat();
OpenGLTex *tex = static_cast<OpenGLTex *>(img->GetNative(fmt, false));
if (tex == nullptr)
{
@ -2944,7 +2925,7 @@ void OpenGLSWFrameBuffer::FlatFill(int left, int top, int right, int bottom, FTe
{
return;
}
OpenGLTex *tex = static_cast<OpenGLTex *>(src->GetNative(true));
OpenGLTex *tex = static_cast<OpenGLTex *>(src->GetNative(src->GetFormat(), true));
if (tex == nullptr)
{
return;
@ -3069,7 +3050,7 @@ void OpenGLSWFrameBuffer::FillSimplePoly(FTexture *texture, FVector2 *points, in
{
return;
}
tex = static_cast<OpenGLTex *>(texture->GetNative(true));
tex = static_cast<OpenGLTex *>(texture->GetNative(texture->GetFormat(), true));
if (tex == nullptr)
{
return;

View file

@ -49,7 +49,7 @@ public:
void SetBlendingRect(int x1, int y1, int x2, int y2) override;
bool Begin2D(bool copy3d) override;
void DrawBlendingRect() override;
FNativeTexture *CreateTexture(FTexture *gametex, bool wrapping) override;
FNativeTexture *CreateTexture(FTexture *gametex, FTextureFormat fmt, bool wrapping) override;
FNativePalette *CreatePalette(FRemapTable *remap) override;
void DrawTextureParms(FTexture *img, DrawParms &parms) override;
void DoClear(int left, int top, int right, int bottom, int palcolor, uint32_t color) override;
@ -265,7 +265,7 @@ private:
class OpenGLTex : public FNativeTexture
{
public:
OpenGLTex(FTexture *tex, OpenGLSWFrameBuffer *fb, bool wrapping);
OpenGLTex(FTexture *tex, FTextureFormat fmt, OpenGLSWFrameBuffer *fb, bool wrapping);
~OpenGLTex();
FTexture *GameTex;
@ -280,7 +280,6 @@ private:
bool Update();
bool CheckWrapping(bool wrapping);
int GetTexFormat();
FTextureFormat ToTexFmt(int fmt);
};
class OpenGLPal : public FNativePalette

View file

@ -111,14 +111,14 @@ int CheckDDPK3(FTexture *tex)
FString checkName;
const char ** checklist;
uint8_t useType=tex->UseType;
ETextureType useType=tex->UseType;
if (useType==FTexture::TEX_SkinSprite || useType==FTexture::TEX_Decal || useType==FTexture::TEX_FontChar)
if (useType==ETextureType::SkinSprite || useType==ETextureType::Decal || useType==ETextureType::FontChar)
{
return -3;
}
bool ispatch = (useType==FTexture::TEX_MiscPatch || useType==FTexture::TEX_Sprite) ;
bool ispatch = (useType==ETextureType::MiscPatch || useType==ETextureType::Sprite) ;
// for patches this doesn't work yet
if (ispatch) return -3;
@ -127,34 +127,34 @@ int CheckDDPK3(FTexture *tex)
{
if (!(gameinfo.flags & GI_MAPxx))
{
checklist = useType==FTexture::TEX_Flat? doomflatpath : doom1texpath;
checklist = useType==ETextureType::Flat? doomflatpath : doom1texpath;
}
else
{
SetDoom2Wad();
if (Doom2Wad == 1)
checklist = useType==FTexture::TEX_Flat? doomflatpath : pluttexpath;
checklist = useType==ETextureType::Flat? doomflatpath : pluttexpath;
else if (Doom2Wad == 2)
checklist = useType==FTexture::TEX_Flat? doomflatpath : tnttexpath;
checklist = useType==ETextureType::Flat? doomflatpath : tnttexpath;
else
checklist = useType==FTexture::TEX_Flat? doomflatpath : doom2texpath;
checklist = useType==ETextureType::Flat? doomflatpath : doom2texpath;
}
}
else if (!gameinfo.ConfigName.CompareNoCase("Heretic"))
{
checklist = useType==FTexture::TEX_Flat? hereticflatpath : heretictexpath;
checklist = useType==ETextureType::Flat? hereticflatpath : heretictexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Hexen"))
{
checklist = useType==FTexture::TEX_Flat? hexenflatpath : hexentexpath;
checklist = useType==ETextureType::Flat? hexenflatpath : hexentexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Strife"))
{
checklist = useType==FTexture::TEX_Flat? strifeflatpath : strifetexpath;
checklist = useType==ETextureType::Flat? strifeflatpath : strifetexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Chex"))
{
checklist = useType==FTexture::TEX_Flat? chexflatpath : chextexpath;
checklist = useType==ETextureType::Flat? chexflatpath : chextexpath;
}
else
return -3;
@ -292,14 +292,14 @@ int CheckExternalFile(FTexture *tex, bool & hascolorkey)
FString checkName;
const char ** checklist;
uint8_t useType=tex->UseType;
ETextureType useType = tex->UseType;
if (useType==FTexture::TEX_SkinSprite || useType==FTexture::TEX_Decal || useType==FTexture::TEX_FontChar)
if (useType == ETextureType::SkinSprite || useType == ETextureType::Decal || useType == ETextureType::FontChar)
{
return -3;
}
bool ispatch = (useType==FTexture::TEX_MiscPatch || useType==FTexture::TEX_Sprite) ;
bool ispatch = (useType==ETextureType::MiscPatch || useType==ETextureType::Sprite) ;
// for patches this doesn't work yet
if (ispatch) return -3;
@ -308,34 +308,34 @@ int CheckExternalFile(FTexture *tex, bool & hascolorkey)
{
if (!(gameinfo.flags & GI_MAPxx))
{
checklist = ispatch ? doom1patchpath : useType==FTexture::TEX_Flat? doom1flatpath : doom1texpath;
checklist = ispatch ? doom1patchpath : useType==ETextureType::Flat? doom1flatpath : doom1texpath;
}
else
{
SetDoom2Wad();
if (Doom2Wad == 1)
checklist = ispatch ? plutpatchpath : useType==FTexture::TEX_Flat? plutflatpath : pluttexpath;
checklist = ispatch ? plutpatchpath : useType==ETextureType::Flat? plutflatpath : pluttexpath;
else if (Doom2Wad == 2)
checklist = ispatch ? tntpatchpath : useType==FTexture::TEX_Flat? tntflatpath : tnttexpath;
checklist = ispatch ? tntpatchpath : useType==ETextureType::Flat? tntflatpath : tnttexpath;
else
checklist = ispatch ? doom2patchpath : useType==FTexture::TEX_Flat? doom2flatpath : doom2texpath;
checklist = ispatch ? doom2patchpath : useType==ETextureType::Flat? doom2flatpath : doom2texpath;
}
}
else if (!gameinfo.ConfigName.CompareNoCase("Heretic"))
{
checklist = ispatch ? hereticpatchpath : useType==FTexture::TEX_Flat? hereticflatpath : heretictexpath;
checklist = ispatch ? hereticpatchpath : useType==ETextureType::Flat? hereticflatpath : heretictexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Hexen"))
{
checklist = ispatch ? hexenpatchpath : useType==FTexture::TEX_Flat? hexenflatpath : hexentexpath;
checklist = ispatch ? hexenpatchpath : useType==ETextureType::Flat? hexenflatpath : hexentexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Strife"))
{
checklist = ispatch ?strifepatchpath : useType==FTexture::TEX_Flat? strifeflatpath : strifetexpath;
checklist = ispatch ?strifepatchpath : useType==ETextureType::Flat? strifeflatpath : strifetexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Chex"))
{
checklist = ispatch ?chexpatchpath : useType==FTexture::TEX_Flat? chexflatpath : chextexpath;
checklist = ispatch ?chexpatchpath : useType==ETextureType::Flat? chexflatpath : chextexpath;
}
else
return -3;

View file

@ -339,12 +339,12 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u
switch (inputTexture->UseType)
{
case FTexture::TEX_Sprite:
case FTexture::TEX_SkinSprite:
case ETextureType::Sprite:
case ETextureType::SkinSprite:
if (!(gl_texture_hqresize_targets & 2)) return inputBuffer;
break;
case FTexture::TEX_FontChar:
case ETextureType::FontChar:
if (!(gl_texture_hqresize_targets & 4)) return inputBuffer;
break;

View file

@ -31,6 +31,7 @@
#include "r_utility.h"
#include "templates.h"
#include "sc_man.h"
#include "r_data/renderstyle.h"
#include "colormatcher.h"
#include "textures/warpbuffer.h"
#include "textures/bitmap.h"
@ -109,7 +110,7 @@ unsigned char *FGLTexture::LoadHiresTexture(FTexture *tex, int *width, int *heig
if (HiresLump >=0)
{
hirestexture = FTexture::CreateTexture(HiresLump, FTexture::TEX_Any);
hirestexture = FTexture::CreateTexture(HiresLump, ETextureType::Any);
}
}
if (hirestexture != NULL)
@ -212,31 +213,27 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F
FBitmap bmp(buffer, W*4, W, H);
if (translation <= 0)
if (translation <= 0 || alphatrans)
{
// Q: Is this special treatment still needed? Needs to be checked.
if (tex->bComplex)
int trans = tex->CopyTrueColorPixels(&bmp, exx, exx);
tex->CheckTrans(buffer, W*H, trans);
isTransparent = tex->gl_info.mIsTransparent;
if (bIsTransparent == -1) bIsTransparent = isTransparent;
// alpha texture for legacy mode
if (alphatrans)
{
FBitmap imgCreate;
// The texture contains special processing so it must be fully composited before being converted as a whole.
if (imgCreate.Create(W, H))
for (int i = 0; i < W*H; i++)
{
memset(imgCreate.GetPixels(), 0, W * H * 4);
int trans = tex->CopyTrueColorPixels(&imgCreate, exx, exx);
bmp.CopyPixelDataRGB(0, 0, imgCreate.GetPixels(), W, H, 4, W * 4, 0, CF_BGRA);
tex->CheckTrans(buffer, W*H, trans);
isTransparent = tex->gl_info.mIsTransparent;
if (bIsTransparent == -1) bIsTransparent = isTransparent;
int b = buffer[4 * i];
int g = buffer[4 * i + 1];
int r = buffer[4 * i + 2];
int gray = Luminance(r, g, b);
buffer[4 * i] = 255;
buffer[4 * i + 1] = 255;
buffer[4 * i + 2] = 255;
buffer[4 * i + 3] = (buffer[4 * i + 3] * gray) >> 8;
}
}
else
{
int trans = tex->CopyTrueColorPixels(&bmp, exx, exx);
tex->CheckTrans(buffer, W*H, trans);
isTransparent = tex->gl_info.mIsTransparent;
if (bIsTransparent == -1) bIsTransparent = isTransparent;
}
}
else
{
@ -264,7 +261,7 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F
FHardwareTexture *FGLTexture::CreateHwTexture()
{
if (tex->UseType==FTexture::TEX_Null) return NULL; // Cannot register a NULL texture
if (tex->UseType==ETextureType::Null) return NULL; // Cannot register a NULL texture
if (mHwTexture == NULL)
{
mHwTexture = new FHardwareTexture(tex->GetWidth() + bExpandFlag*2, tex->GetHeight() + bExpandFlag*2, tex->gl_info.bNoCompress);
@ -281,13 +278,18 @@ FHardwareTexture *FGLTexture::CreateHwTexture()
const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int translation, FTexture *hirescheck)
{
int usebright = false;
bool alphatrans = false;
bool alphatrans = translation == INT_MAX; // This is only needed for legacy mode because no texture combine setting allows using the color as alpha.
if (translation <= 0) translation = -translation;
else
if (!alphatrans)
{
alphatrans = (gl.legacyMode && uint32_t(translation) == TRANSLATION(TRANSLATION_Standard, 8));
translation = GLTranslationPalette::GetInternalTranslation(translation);
if (translation <= 0)
{
translation = -translation;
}
else
{
translation = GLTranslationPalette::GetInternalTranslation(translation);
}
}
bool needmipmap = (clampmode <= CLAMP_XY);
@ -297,7 +299,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
if (hwtex)
{
// Texture has become invalid
if ((!tex->bHasCanvas && (!tex->bWarped || gl.legacyMode)) && tex->CheckModified())
if ((!tex->bHasCanvas && (!tex->bWarped || gl.legacyMode)) && tex->CheckModified(DefaultRenderStyle()))
{
Clean(true);
hwtex = CreateHwTexture();
@ -323,7 +325,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
WarpBuffer((uint32_t*)warpbuffer, (const uint32_t*)buffer, w, h, wt->WidthOffsetMultiplier, wt->HeightOffsetMultiplier, screen->FrameTime, wt->Speed, tex->bWarped);
delete[] buffer;
buffer = warpbuffer;
wt->GenTime = screen->FrameTime;
wt->GenTime[0] = screen->FrameTime;
}
tex->ProcessData(buffer, w, h, false);
}
@ -416,7 +418,7 @@ float FTexCoordInfo::TextureAdjustWidth() const
//===========================================================================
FGLTexture * FMaterial::ValidateSysTexture(FTexture * tex, bool expand)
{
if (tex && tex->UseType!=FTexture::TEX_Null)
if (tex && tex->UseType!=ETextureType::Null)
{
FGLTexture *gltex = tex->gl_info.SystemTexture[expand];
if (gltex == NULL)
@ -868,7 +870,7 @@ void FMaterial::BindToFrameBuffer()
FMaterial * FMaterial::ValidateTexture(FTexture * tex, bool expand)
{
again:
if (tex && tex->UseType!=FTexture::TEX_Null)
if (tex && tex->UseType!=ETextureType::Null)
{
if (tex->gl_info.bNoExpand) expand = false;

View file

@ -233,12 +233,12 @@ void FTexture::CreateDefaultBrightmap()
{
// Check for brightmaps
if (UseBasePalette() && HasGlobalBrightmap &&
UseType != TEX_Decal && UseType != TEX_MiscPatch && UseType != TEX_FontChar &&
UseType != ETextureType::Decal && UseType != ETextureType::MiscPatch && UseType != ETextureType::FontChar &&
gl_info.Brightmap == NULL && bWarped == 0
)
{
// May have one - let's check when we use this texture
const uint8_t *texbuf = GetPixels();
const uint8_t *texbuf = GetPixels(DefaultRenderStyle());
const int white = ColorMatcher.Pick(255,255,255);
int size = GetWidth() * GetHeight();
@ -312,7 +312,7 @@ bool FTexture::FindHoles(const unsigned char * buffer, int w, int h)
// already done!
if (gl_info.areacount) return false;
if (UseType == TEX_Flat) return false; // flats don't have transparent parts
if (UseType == ETextureType::Flat) return false; // flats don't have transparent parts
gl_info.areacount=-1; //whatever happens next, it shouldn't be done twice!
// large textures are excluded for performance reasons
@ -523,24 +523,11 @@ FBrightmapTexture::FBrightmapTexture (FTexture *source)
SourceLump = -1;
}
FBrightmapTexture::~FBrightmapTexture ()
{
}
const uint8_t *FBrightmapTexture::GetColumn (unsigned int column, const Span **spans_out)
{
// not needed
return NULL;
}
const uint8_t *FBrightmapTexture::GetPixels ()
{
// not needed
return NULL;
}
void FBrightmapTexture::Unload ()
uint8_t *FBrightmapTexture::MakeTexture(FRenderStyle style)
{
// This function is only necessary to satisfy the parent class's interface.
// This will never be called.
return nullptr;
}
int FBrightmapTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
@ -557,7 +544,7 @@ int FBrightmapTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotat
void gl_ParseMaterial(FScanner &sc, int deflump)
{
int type = FTexture::TEX_Any;
ETextureType type = ETextureType::Any;
bool disable_fullbright = false;
bool disable_fullbright_specified = false;
bool thiswad = false;
@ -569,9 +556,9 @@ void gl_ParseMaterial(FScanner &sc, int deflump)
memset(textures, 0, sizeof(textures));
sc.MustGetString();
if (sc.Compare("texture")) type = FTexture::TEX_Wall;
else if (sc.Compare("flat")) type = FTexture::TEX_Flat;
else if (sc.Compare("sprite")) type = FTexture::TEX_Sprite;
if (sc.Compare("texture")) type = ETextureType::Wall;
else if (sc.Compare("flat")) type = ETextureType::Flat;
else if (sc.Compare("sprite")) type = ETextureType::Sprite;
else sc.UnGet();
sc.MustGetString();
@ -621,7 +608,7 @@ void gl_ParseMaterial(FScanner &sc, int deflump)
sc.MustGetString();
if (textures[i])
Printf("Multiple %s definitions in texture %s\n", keywords[i], tex? tex->Name.GetChars() : "(null)");
textures[i] = TexMan.FindTexture(sc.String, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
textures[i] = TexMan.FindTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
if (!textures[i])
Printf("%s '%s' not found in texture '%s'\n", notFound[i], sc.String, tex? tex->Name.GetChars() : "(null)");
break;
@ -676,16 +663,16 @@ void gl_ParseMaterial(FScanner &sc, int deflump)
void gl_ParseBrightmap(FScanner &sc, int deflump)
{
int type = FTexture::TEX_Any;
ETextureType type = ETextureType::Any;
bool disable_fullbright=false;
bool thiswad = false;
bool iwad = false;
FTexture *bmtex = NULL;
sc.MustGetString();
if (sc.Compare("texture")) type = FTexture::TEX_Wall;
else if (sc.Compare("flat")) type = FTexture::TEX_Flat;
else if (sc.Compare("sprite")) type = FTexture::TEX_Sprite;
if (sc.Compare("texture")) type = ETextureType::Wall;
else if (sc.Compare("flat")) type = ETextureType::Flat;
else if (sc.Compare("sprite")) type = ETextureType::Sprite;
else sc.UnGet();
sc.MustGetString();
@ -722,7 +709,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
Printf("Multiple brightmap definitions in texture %s\n", tex? tex->Name.GetChars() : "(null)");
}
bmtex = TexMan.FindTexture(sc.String, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
bmtex = TexMan.FindTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
if (bmtex == NULL)
Printf("Brightmap '%s' not found in texture '%s'\n", sc.String, tex? tex->Name.GetChars() : "(null)");
@ -802,7 +789,7 @@ void AddAutoMaterials()
TArray<FTextureID> list;
FString texname = ExtractFileBase(name, false);
TexMan.ListTextures(texname, list);
auto bmtex = TexMan.FindTexture(name, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
auto bmtex = TexMan.FindTexture(name, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
for (auto texid : list)
{
bmtex->bMasked = false;
@ -959,7 +946,7 @@ void gl_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
{
if (smf->skinIDs[i].isValid())
{
texhitlist[smf->skinIDs[i].GetIndex()] |= FTexture::TEX_Flat;
texhitlist[smf->skinIDs[i].GetIndex()] |= FTextureManager::HIT_Flat;
}
else if (smf->modelIDs[i] != -1)
{

View file

@ -4,23 +4,17 @@
#include "r_defs.h"
#include "textures/textures.h"
class FBrightmapTexture : public FTexture
class FBrightmapTexture : public FWorldTexture
{
public:
FBrightmapTexture (FTexture *source);
~FBrightmapTexture ();
const uint8_t *GetColumn (unsigned int column, const Span **spans_out);
const uint8_t *GetPixels ();
void Unload ();
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf);
bool UseBasePalette() { return false; }
uint8_t *MakeTexture(FRenderStyle style) override;
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf) override;
bool UseBasePalette() override { return false; }
protected:
FTexture *SourcePic;
//uint8_t *Pixels;
//Span **Spans;
};

View file

@ -117,7 +117,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
}
if (texname[0] != 0)
{
mBackground = TexMan.CheckForTexture(texname, FTexture::TEX_MiscPatch);
mBackground = TexMan.CheckForTexture(texname, ETextureType::MiscPatch);
mFlatfill = desc->mFlatfill;
}
S_Sound (CHAN_VOICE | CHAN_UI, desc->mSound, 1.0f, ATTN_NONE);
@ -147,7 +147,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
mOverlays[i].x = desc->mOverlays[i].x;
mOverlays[i].y = desc->mOverlays[i].y;
mOverlays[i].mCondition = desc->mOverlays[i].mCondition;
mOverlays[i].mPic = TexMan.CheckForTexture(desc->mOverlays[i].mName, FTexture::TEX_MiscPatch);
mOverlays[i].mPic = TexMan.CheckForTexture(desc->mOverlays[i].mName, ETextureType::MiscPatch);
}
mTicker = 0;
}
@ -640,7 +640,7 @@ void DIntermissionScreenScroller::Init(FIntermissionAction *desc, bool first)
{
Super::Init(desc, first);
mFirstPic = mBackground;
mSecondPic = TexMan.CheckForTexture(static_cast<FIntermissionActionScroller*>(desc)->mSecondPic, FTexture::TEX_MiscPatch);
mSecondPic = TexMan.CheckForTexture(static_cast<FIntermissionActionScroller*>(desc)->mSecondPic, ETextureType::MiscPatch);
mScrollDelay = static_cast<FIntermissionActionScroller*>(desc)->mScrollDelay;
mScrollTime = static_cast<FIntermissionActionScroller*>(desc)->mScrollTime;
mScrollDir = static_cast<FIntermissionActionScroller*>(desc)->mScrollDir;

View file

@ -161,7 +161,7 @@ void DeinitMenus()
static FTextureID GetMenuTexture(const char* const name)
{
const FTextureID texture = TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch);
const FTextureID texture = TexMan.CheckForTexture(name, ETextureType::MiscPatch);
if (!texture.Exists() && mustPrintErrors)
{
@ -417,7 +417,7 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
}
else if (args[i] == TypeTextureID)
{
auto f = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
auto f = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
if (!f.Exists())
{
sc.ScriptMessage("Unknown texture %s", sc.String);
@ -1381,6 +1381,12 @@ static void InitCrosshairsList()
// Initialize the music configuration submenus
//
//=============================================================================
extern "C"
{
extern int adl_getBanksCount();
extern const char *const *adl_getBankNames();
}
static void InitMusicMenus()
{
DMenuDescriptor **advmenu = MenuDescriptors.CheckKey("AdvSoundOptions");
@ -1418,6 +1424,22 @@ static void InitMusicMenus()
}
}
}
DMenuDescriptor **menu = MenuDescriptors.CheckKey("ADLBankMenu");
if (menu != nullptr)
{
if (soundfonts.Size() > 0)
{
int adl_banks_count = adl_getBanksCount();
const char *const *adl_bank_names = adl_getBankNames();
for(int i=0; i < adl_banks_count; i++)
{
auto it = CreateOptionMenuItemCommand(adl_bank_names[i], FStringf("adl_bank %d", i), true);
static_cast<DOptionMenuDescriptor*>(*menu)->mItems.Push(it);
}
}
}
}
//=============================================================================

View file

@ -3873,7 +3873,7 @@ void DLevelScript::ChangeFlat (int tag, int name, bool floorOrCeiling)
if (flatname == NULL)
return;
flat = TexMan.GetTexture (flatname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
flat = TexMan.GetTexture (flatname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0)
@ -3905,7 +3905,7 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
side = !!side;
texture = TexMan.GetTexture (texname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
texture = TexMan.GetTexture (texname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
FLineIdIterator itr(lineid);
while ((linenum = itr.Next()) >= 0)
@ -4700,7 +4700,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
{
return 0;
}
FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string), FTexture::TEX_Flat,
FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string), ETextureType::Flat,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_DontCreate);
if (tex == NULL)
@ -5065,10 +5065,10 @@ bool GetVarAddrType(AActor *self, FName varname, int index, void *&addr, PType *
}
addr = baddr;
// We don't want Int subclasses like Name or Color to be accessible here.
if (!type->isInt() && !type->isFloat() && type != TypeBool)
if (!type->isInt() && !type->isFloat() && type != TypeBool && type != TypeString)
{
// For reading, we also support Name and String types.
if (readonly && (type == TypeName || type == TypeString))
// For reading, we also support Name types.
if (readonly && (type == TypeName))
{
return true;
}
@ -5084,13 +5084,18 @@ static void SetUserVariable(AActor *self, FName varname, int index, int value)
if (GetVarAddrType(self, varname, index, addr, type, false))
{
if (!type->isFloat())
if (type == TypeString)
{
type->SetValue(addr, value);
FString str = FBehavior::StaticLookupString(value);
type->InitializeValue(addr, &str);
}
else if (type->isFloat())
{
type->SetValue(addr, ACSToDouble(value));
}
else
{
type->SetValue(addr, ACSToDouble(value));
type->SetValue(addr, value);
}
}
}
@ -6684,7 +6689,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
break;
case ACSF_SetMusicVolume:
I_SetMusicVolume(ACSToFloat(args[0]));
level.SetMusicVolume(ACSToFloat(args[0]));
break;
case ACSF_CheckProximity:
@ -10028,11 +10033,11 @@ scriptwait:
sky2name = FBehavior::StaticLookupString (STACK(1));
if (sky1name[0] != 0)
{
sky1texture = level.skytexture1 = TexMan.GetTexture (sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky1texture = level.skytexture1 = TexMan.GetTexture (sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
}
if (sky2name[0] != 0)
{
sky2texture = level.skytexture2 = TexMan.GetTexture (sky2name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky2texture = level.skytexture2 = TexMan.GetTexture (sky2name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
}
R_InitSkyMap ();
sp -= 2;
@ -10056,7 +10061,7 @@ scriptwait:
if (camera != NULL)
{
FTextureID picnum = TexMan.CheckForTexture (picname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.CheckForTexture (picname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
if (!picnum.Exists())
{
Printf ("SetCameraToTexture: %s is not a texture\n", picname);

View file

@ -1094,7 +1094,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
if (isconsole)
{
I_SetMusicVolume (1.f);
I_SetMusicVolume (level.MusicVolume);
}
}

View file

@ -8516,5 +8516,7 @@ void PrintMiscActorInfo(AActor *query)
query->Speed, query->Vel.X, query->Vel.Y, query->Vel.Z, query->Vel.Length());
Printf("Scale: x:%f, y:%f\n", query->Scale.X, query->Scale.Y);
Printf("FriendlySeeBlocks: %d\n", query->friendlyseeblocks);
Printf("Target: %s\n", query->target ? query->target->GetClass()->TypeName.GetChars() : "-");
Printf("Last enemy: %s\n", query->lastenemy ? query->lastenemy->GetClass()->TypeName.GetChars() : "-");
}
}

View file

@ -546,19 +546,22 @@ void P_SerializeSounds(FSerializer &arc)
DSeqNode::SerializeSequences (arc);
const char *name = NULL;
uint8_t order;
float musvol = level.MusicVolume;
if (arc.isWriting())
{
order = S_GetMusic(&name);
}
arc.StringPtr("musicname", name)
("musicorder", order);
("musicorder", order)
("musicvolume", musvol);
if (arc.isReading())
{
if (!S_ChangeMusic(name, order))
if (level.cdtrack == 0 || !S_ChangeCDMusic(level.cdtrack, level.cdid))
S_ChangeMusic(level.Music, level.musicorder);
level.SetMusicVolume(musvol);
}
}

View file

@ -2250,8 +2250,8 @@ void P_ReplaceTextures(const char *fromname, const char *toname, int flags)
if ((flags ^ (NOT_BOTTOM | NOT_MIDDLE | NOT_TOP)) != 0)
{
picnum1 = TexMan.GetTexture(fromname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
picnum1 = TexMan.GetTexture(fromname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
for (auto &side : level.sides)
{
@ -2267,8 +2267,8 @@ void P_ReplaceTextures(const char *fromname, const char *toname, int flags)
}
if ((flags ^ (NOT_FLOOR | NOT_CEILING)) != 0)
{
picnum1 = TexMan.GetTexture(fromname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
picnum1 = TexMan.GetTexture(fromname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
for (auto &sec : level.sectors)
{

View file

@ -167,7 +167,7 @@ bool hasglnodes;
TArray<FMapThing> MapThingsConverted;
TMap<unsigned,unsigned> MapThingsUserDataIndex; // from mapthing idx -> user data idx
TArray<FMapThingUserData> MapThingsUserData;
TArray<FUDMFKey> MapThingsUserData;
int sidecount;
sidei_t *sidetemp;
@ -568,7 +568,7 @@ static void SetTexture (side_t *side, int position, const char *name, FMissingTe
static const char *positionnames[] = { "top", "middle", "bottom" };
static const char *sidenames[] = { "first", "second" };
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
FTextureID texture = TexMan.CheckForTexture (name, ETextureType::Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
@ -614,7 +614,7 @@ void SetTexture (sector_t *sector, int index, int position, const char *name, FM
name = name8;
}
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Flat,
FTextureID texture = TexMan.CheckForTexture (name, ETextureType::Flat,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
@ -668,7 +668,7 @@ static void SetTexture (side_t *side, int position, uint32_t *blend, const char
FTextureID texture;
if ((*blend = R_ColormapNumForName (name)) == 0)
{
texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
texture = TexMan.CheckForTexture (name, ETextureType::Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
{
@ -701,7 +701,7 @@ static void SetTextureNoErr (side_t *side, int position, uint32_t *color, const
{
FTextureID texture;
*validcolor = false;
texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
texture = TexMan.CheckForTexture (name, ETextureType::Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
{
@ -1645,23 +1645,34 @@ static void SetMapThingUserData(AActor *actor, unsigned udi)
{
return;
}
while (MapThingsUserData[udi].Property != NAME_None)
while (MapThingsUserData[udi].Key != NAME_None)
{
FName varname = MapThingsUserData[udi].Property;
int value = MapThingsUserData[udi].Value;
FName varname = MapThingsUserData[udi].Key;
PField *var = dyn_cast<PField>(actor->GetClass()->FindSymbol(varname, true));
udi++;
if (var == NULL || (var->Flags & (VARF_Native|VARF_Private|VARF_Protected|VARF_Static)) || !var->Type->isScalar())
{
DPrintf(DMSG_WARNING, "%s is not a user variable in class %s\n", varname.GetChars(),
DPrintf(DMSG_WARNING, "%s is not a writable user variable in class %s\n", varname.GetChars(),
actor->GetClass()->TypeName.GetChars());
}
else
{ // Set the value of the specified user variable.
var->Type->SetValue(reinterpret_cast<uint8_t *>(actor) + var->Offset, value);
void *addr = reinterpret_cast<uint8_t *>(actor) + var->Offset;
if (var->Type == TypeString)
{
var->Type->InitializeValue(addr, &MapThingsUserData[udi].StringVal);
}
else if (var->Type->isFloat())
{
var->Type->SetValue(addr, MapThingsUserData[udi].FloatVal);
}
else if (var->Type->isInt() || var->Type == TypeBool)
{
var->Type->SetValue(addr, MapThingsUserData[udi].IntVal);
}
}
udi++;
}
}
@ -3471,12 +3482,12 @@ static void P_PrecacheLevel()
for (auto n : gameinfo.PrecachedTextures)
{
FTextureID tex = TexMan.CheckForTexture(n, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
FTextureID tex = TexMan.CheckForTexture(n, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
if (tex.Exists()) hitlist[tex.GetIndex()] |= FTextureManager::HIT_Wall;
}
for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++)
{
FTextureID tex = TexMan.CheckForTexture(level.info->PrecacheTextures[i], FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
FTextureID tex = TexMan.CheckForTexture(level.info->PrecacheTextures[i], ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
if (tex.Exists()) hitlist[tex.GetIndex()] |= FTextureManager::HIT_Wall;
}
@ -3640,6 +3651,7 @@ void P_SetupLevel (const char *lumpname, int position)
if (!savegamerestore)
{
level.SetMusicVolume(level.MusicVolume);
for (i = 0; i < MAXPLAYERS; ++i)
{
players[i].killcount = players[i].secretcount

View file

@ -30,6 +30,7 @@
#include "resourcefiles/resourcefile.h"
#include "doomdata.h"
#include "r_defs.h"
struct MapData
@ -180,14 +181,8 @@ struct FMissingCount
};
typedef TMap<FString,FMissingCount> FMissingTextureTracker;
// Record of user data for UDMF maps
struct FMapThingUserData
{
FName Property;
int Value;
};
extern TMap<unsigned,unsigned> MapThingsUserDataIndex; // from mapthing idx -> user data idx
extern TArray<FMapThingUserData> MapThingsUserData;
extern TArray<FUDMFKey> MapThingsUserData;
#endif

View file

@ -188,8 +188,15 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe
{
return false;
}
// [MK] Use WorldLinePreActivated to decide if activation should continue
bool shouldactivate = true;
E_WorldLinePreActivated(line, mo, &shouldactivate);
if ( !shouldactivate ) return false;
bool remote = (line->special != 7 && line->special != 8 && (line->special < 11 || line->special > 14));
if (line->locknumber > 0 && !P_CheckKeys (mo, line->locknumber, remote)) return false;
lineActivation = line->activation;
repeat = line->flags & ML_REPEAT_SPECIAL;
buttonSuccess = false;
@ -198,6 +205,9 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe
line->args[1], line->args[2],
line->args[3], line->args[4]);
// [MK] Fire up WorldLineActivated
if ( buttonSuccess ) E_WorldLineActivated(line, mo);
special = line->special;
if (!repeat && buttonSuccess)
{ // clear the special on non-retriggerable lines

View file

@ -631,7 +631,7 @@ static void ParseFloor (FScanner &sc)
bool opt = sc.CheckString("optional");
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, FTexture::TEX_Flat,
picnum = TexMan.CheckForTexture (sc.String, ETextureType::Flat,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!picnum.Exists())

View file

@ -476,38 +476,7 @@ public:
fogMap = normMap = NULL;
}
void AddUserKey(FName key, int kind, int index)
{
FUDMFKeys &keyarray = UDMFKeys[kind][index];
for(unsigned i=0; i < keyarray.Size(); i++)
{
if (keyarray[i].Key == key)
{
switch (sc.TokenType)
{
case TK_IntConst:
keyarray[i] = sc.Number;
break;
case TK_FloatConst:
keyarray[i] = sc.Float;
break;
default:
case TK_StringConst:
keyarray[i] = parsedString;
break;
case TK_True:
keyarray[i] = 1;
break;
case TK_False:
keyarray[i] = 0;
break;
}
return;
}
}
FUDMFKey ukey;
ukey.Key = key;
void ReadUserKey(FUDMFKey &ukey) {
switch (sc.TokenType)
{
case TK_IntConst:
@ -527,6 +496,22 @@ public:
ukey = 0;
break;
}
}
void AddUserKey(FName key, int kind, int index)
{
FUDMFKeys &keyarray = UDMFKeys[kind][index];
for(unsigned i=0; i < keyarray.Size(); i++)
{
if (keyarray[i].Key == key)
{
ReadUserKey(keyarray[i]);
return;
}
}
FUDMFKey ukey;
ukey.Key = key;
ReadUserKey(ukey);
keyarray.Push(ukey);
}
@ -809,10 +794,10 @@ public:
CHECK_N(Zd | Zdt)
if (0 == strnicmp("user_", key.GetChars(), 5))
{ // Custom user key - Sets an actor's user variable directly
FMapThingUserData ud;
ud.Property = key;
ud.Value = CheckInt(key);
MapThingsUserData.Push(ud);
FUDMFKey ukey;
ukey.Key = key;
ReadUserKey(ukey);
MapThingsUserData.Push(ukey);
}
break;
}
@ -2111,10 +2096,10 @@ public:
{ // User data added
MapThingsUserDataIndex[MapThingsConverted.Size()-1] = userdatastart;
// Mark end of the user data for this map thing
FMapThingUserData ud;
ud.Property = NAME_None;
ud.Value = 0;
MapThingsUserData.Push(ud);
FUDMFKey ukey;
ukey.Key = NAME_None;
ukey = 0;
MapThingsUserData.Push(ukey);
}
}
else if (sc.Compare("linedef"))

View file

@ -46,20 +46,21 @@ void PolyDrawArgs::SetTexture(const uint8_t *texels, int width, int height)
mTranslation = nullptr;
}
void PolyDrawArgs::SetTexture(FTexture *texture)
void PolyDrawArgs::SetTexture(FTexture *texture, FRenderStyle style)
{
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
if (PolyRenderer::Instance()->RenderTarget->IsBgra())
mTexturePixels = (const uint8_t *)texture->GetPixelsBgra();
else
mTexturePixels = texture->GetPixels();
mTexturePixels = texture->GetPixels(style);
mTranslation = nullptr;
}
void PolyDrawArgs::SetTexture(FTexture *texture, uint32_t translationID, bool forcePal)
void PolyDrawArgs::SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style)
{
if (translationID != 0xffffffff && translationID != 0)
// Alphatexture overrides translations.
if (translationID != 0xffffffff && translationID != 0 && !(style.Flags & STYLEF_RedIsAlpha))
{
FRemapTable *table = TranslationToTable(translationID);
if (table != nullptr && !table->Inactive)
@ -71,20 +72,20 @@ void PolyDrawArgs::SetTexture(FTexture *texture, uint32_t translationID, bool fo
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
mTexturePixels = texture->GetPixels();
mTexturePixels = texture->GetPixels(style);
return;
}
}
if (forcePal)
if (style.Flags & STYLEF_RedIsAlpha)
{
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
mTexturePixels = texture->GetPixels();
mTexturePixels = texture->GetPixels(style);
}
else
{
SetTexture(texture);
SetTexture(texture, style);
}
}
@ -164,8 +165,7 @@ void PolyDrawArgs::DrawElements(PolyRenderThread *thread, const TriVertex *verti
void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
{
bool forcePal = (renderstyle == LegacyRenderStyles[STYLE_Shaded] || renderstyle == LegacyRenderStyles[STYLE_AddShaded]);
SetTexture(tex, translationID, forcePal);
SetTexture(tex, translationID, renderstyle);
if (renderstyle == LegacyRenderStyles[STYLE_Normal] || (r_drawfuzz == 0 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
{
@ -232,20 +232,20 @@ void RectDrawArgs::SetTexture(const uint8_t *texels, int width, int height)
mTranslation = nullptr;
}
void RectDrawArgs::SetTexture(FTexture *texture)
void RectDrawArgs::SetTexture(FTexture *texture, FRenderStyle style)
{
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
if (PolyRenderer::Instance()->RenderTarget->IsBgra())
mTexturePixels = (const uint8_t *)texture->GetPixelsBgra();
else
mTexturePixels = texture->GetPixels();
mTexturePixels = texture->GetPixels(style);
mTranslation = nullptr;
}
void RectDrawArgs::SetTexture(FTexture *texture, uint32_t translationID, bool forcePal)
void RectDrawArgs::SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style)
{
if (translationID != 0xffffffff && translationID != 0)
if (translationID != 0xffffffff && translationID != 0 && !(style.Flags & STYLEF_RedIsAlpha))
{
FRemapTable *table = TranslationToTable(translationID);
if (table != nullptr && !table->Inactive)
@ -257,20 +257,20 @@ void RectDrawArgs::SetTexture(FTexture *texture, uint32_t translationID, bool fo
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
mTexturePixels = texture->GetPixels();
mTexturePixels = texture->GetPixels(style);
return;
}
}
if (forcePal)
if (style.Flags & STYLEF_RedIsAlpha)
{
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
mTexturePixels = texture->GetPixels();
mTexturePixels = texture->GetPixels(style);
}
else
{
SetTexture(texture);
SetTexture(texture, style);
}
}
@ -315,10 +315,9 @@ void RectDrawArgs::Draw(PolyRenderThread *thread, double x0, double x1, double y
thread->DrawQueue->Push<DrawRectCommand>(*this);
}
void RectDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
void RectDrawArgs::SetStyle(FRenderStyle renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
{
bool forcePal = (renderstyle == LegacyRenderStyles[STYLE_Shaded] || renderstyle == LegacyRenderStyles[STYLE_AddShaded]);
SetTexture(tex, translationID, forcePal);
SetTexture(tex, translationID, renderstyle);
if (renderstyle == LegacyRenderStyles[STYLE_Normal] || (r_drawfuzz == 0 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
{

View file

@ -67,8 +67,8 @@ class PolyDrawArgs
public:
void SetClipPlane(int index, const PolyClipPlane &plane) { mClipPlane[index] = plane; }
void SetTexture(const uint8_t *texels, int width, int height);
void SetTexture(FTexture *texture);
void SetTexture(FTexture *texture, uint32_t translationID, bool forcePal = false);
void SetTexture(FTexture *texture, FRenderStyle style);
void SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style);
void SetLight(FSWColormap *basecolormap, uint32_t lightlevel, double globVis, bool fixed);
void SetDepthTest(bool enable) { mDepthTest = enable; }
void SetStencilTestValue(uint8_t stencilTestValue) { mStencilTestValue = stencilTestValue; }
@ -186,11 +186,11 @@ class RectDrawArgs
{
public:
void SetTexture(const uint8_t *texels, int width, int height);
void SetTexture(FTexture *texture);
void SetTexture(FTexture *texture, uint32_t translationID, bool forcePal = false);
void SetTexture(FTexture *texture, FRenderStyle style);
void SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style);
void SetLight(FSWColormap *basecolormap, uint32_t lightlevel);
void SetStyle(TriBlendMode blendmode, double srcalpha = 1.0, double destalpha = 1.0) { mBlendMode = blendmode; mSrcAlpha = (uint32_t)(srcalpha * 256.0 + 0.5); mDestAlpha = (uint32_t)(destalpha * 256.0 + 0.5); }
void SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *texture, bool fullbright);
void SetStyle(FRenderStyle renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *texture, bool fullbright);
void SetColor(uint32_t bgra, uint8_t palindex);
void Draw(PolyRenderThread *thread, double x0, double x1, double y0, double y1, double u0, double u1, double v0, double v1);

View file

@ -74,7 +74,7 @@ void PolyRenderThread::FlushDrawQueue()
}
}
void PolyRenderThread::PrepareTexture(FTexture *texture)
void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
{
if (texture == nullptr)
return;
@ -91,9 +91,9 @@ void PolyRenderThread::PrepareTexture(FTexture *texture)
std::unique_lock<std::mutex> lock(loadmutex);
texture->GetPixels();
texture->GetPixels(style);
const FTexture::Span *spans;
texture->GetColumn(0, &spans);
texture->GetColumn(style, 0, &spans);
if (PolyRenderer::Instance()->RenderTarget->IsBgra())
{
texture->GetPixelsBgra();

View file

@ -47,7 +47,7 @@ public:
DrawerCommandQueuePtr DrawQueue;
// Make sure texture can accessed safely
void PrepareTexture(FTexture *texture);
void PrepareTexture(FTexture *texture, FRenderStyle style);
// Setup poly object in a threadsafe manner
void PreparePolyObject(subsector_t *sub);

View file

@ -33,26 +33,15 @@ void PolyCull::CullScene(const PolyClipPlane &portalClipPlane)
ClearSolidSegments();
MarkViewFrustum();
if (level.LevelName != lastLevelName) // Is this the best way to detect a level change?
{
lastLevelName = level.LevelName;
SubsectorDepths.clear();
SubsectorDepths.resize(level.subsectors.Size(), 0xffffffff);
SectorSeen.clear();
SectorSeen.resize(level.sectors.Size());
}
else
{
for (const auto &sub : PvsSectors)
SubsectorDepths[sub->Index()] = 0xffffffff;
SubsectorDepths.resize(level.subsectors.Size(), 0xffffffff);
for (uint32_t sub : PvsSubsectors)
SubsectorDepths[sub] = 0xffffffff;
SubsectorDepths.resize(level.subsectors.Size(), 0xffffffff);
for (const auto &sector : SeenSectors)
SectorSeen[sector->Index()] = false;
SectorSeen.resize(level.sectors.Size());
}
for (uint32_t sector : SeenSectors)
SectorSeen[sector] = false;
SectorSeen.resize(level.sectors.Size());
PvsSectors.clear();
PvsSubsectors.clear();
SeenSectors.clear();
NextPvsLineStart = 0;
@ -125,10 +114,10 @@ void PolyCull::CullSubsector(subsector_t *sub)
FirstSkyHeight = false;
}
uint32_t subsectorDepth = (uint32_t)PvsSectors.size();
uint32_t subsectorDepth = (uint32_t)PvsSubsectors.size();
// Mark that we need to render this
PvsSectors.push_back(sub);
PvsSubsectors.push_back(sub->Index());
PvsLineStart.push_back(NextPvsLineStart);
DVector3 viewpos = PolyRenderer::Instance()->Viewpoint.Pos;
@ -169,7 +158,7 @@ void PolyCull::CullSubsector(subsector_t *sub)
if (!SectorSeen[sub->sector->Index()])
{
SectorSeen[sub->sector->Index()] = true;
SeenSectors.push_back(sub->sector);
SeenSectors.push_back(sub->sector->Index());
}
SubsectorDepths[sub->Index()] = subsectorDepth;

View file

@ -36,11 +36,11 @@ public:
return PvsLineVisible[PvsLineStart[subsectorDepth] + lineIndex];
}
std::vector<subsector_t *> PvsSectors;
std::vector<uint32_t> PvsSubsectors;
double MaxCeilingHeight = 0.0;
double MinFloorHeight = 0.0;
std::vector<sector_t *> SeenSectors;
std::vector<uint32_t> SeenSectors;
std::vector<bool> SectorSeen;
std::vector<uint32_t> SubsectorDepths;

View file

@ -50,7 +50,7 @@ void RenderPolyDecal::Render(PolyRenderThread *thread, const TriMatrix &worldToC
return;
FTexture *tex = TexMan(decal->PicNum, true);
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
return;
sector_t *front, *back;

View file

@ -147,7 +147,7 @@ void PolyModelRenderer::DrawArrays(int start, int count)
args.SetStencilTestValue(StencilValue);
args.SetClipPlane(0, PolyClipPlane());
args.SetStyle(TriBlendMode::TextureOpaque);
args.SetTexture(SkinTexture);
args.SetTexture(SkinTexture, DefaultRenderStyle());
args.SetDepthTest(true);
args.SetWriteDepth(true);
args.SetWriteStencil(false);
@ -181,7 +181,7 @@ void PolyModelRenderer::DrawElements(int numIndices, size_t offset)
args.SetStencilTestValue(StencilValue);
args.SetClipPlane(0, PolyClipPlane());
args.SetStyle(TriBlendMode::TextureOpaque);
args.SetTexture(SkinTexture);
args.SetTexture(SkinTexture, DefaultRenderStyle());
args.SetDepthTest(true);
args.SetWriteDepth(true);
args.SetWriteStencil(false);

View file

@ -67,7 +67,7 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const TriMatrix &wo
if (picnum != skyflatnum)
{
FTexture *tex = TexMan(picnum);
if (!tex || tex->UseType == FTexture::TEX_Null)
if (!tex || tex->UseType == ETextureType::Null)
return;
PolyPlaneUVTransform transform = PolyPlaneUVTransform(ceiling ? fakeflat.FrontSector->planes[sector_t::ceiling].xform : fakeflat.FrontSector->planes[sector_t::floor].xform, tex);
@ -81,7 +81,7 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const TriMatrix &wo
args.SetStencilTestValue(stencilValue);
args.SetWriteStencil(true, stencilValue + 1);
args.SetClipPlane(0, clipPlane);
args.SetTexture(tex);
args.SetTexture(tex, DefaultRenderStyle());
args.SetStyle(TriBlendMode::TextureOpaque);
args.DrawArray(thread, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
}
@ -516,7 +516,7 @@ void Render3DFloorPlane::Render(PolyRenderThread *thread, const TriMatrix &world
{
FTextureID picnum = ceiling ? *fakeFloor->bottom.texture : *fakeFloor->top.texture;
FTexture *tex = TexMan(picnum);
if (tex->UseType == FTexture::TEX_Null)
if (tex->UseType == ETextureType::Null)
return;
PolyCameraLight *cameraLight = PolyCameraLight::Instance();
@ -572,7 +572,7 @@ void Render3DFloorPlane::Render(PolyRenderThread *thread, const TriMatrix &world
args.SetFaceCullCCW(true);
args.SetStencilTestValue(stencilValue);
args.SetWriteStencil(true, stencilValue + 1);
args.SetTexture(tex);
args.SetTexture(tex, DefaultRenderStyle());
args.SetClipPlane(0, clipPlane);
args.DrawArray(thread, vertices, sub->numlines, PolyDrawMode::TriangleFan);
}

View file

@ -224,7 +224,7 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
flip = sprframe->Flip & 1;
tex = TexMan(picnum);
if (tex->UseType == FTexture::TEX_Null)
if (tex->UseType == ETextureType::Null)
return;
if (pspr->firstTic)

View file

@ -69,8 +69,8 @@ void RenderPolyScene::RenderSectors()
{
PolyRenderThread *mainthread = PolyRenderer::Instance()->Threads.MainThread();
int totalcount = (int)Cull.PvsSectors.size();
auto subsectors = Cull.PvsSectors.data();
int totalcount = (int)Cull.PvsSubsectors.size();
uint32_t *subsectors = Cull.PvsSubsectors.data();
TranslucentObjects.resize(PolyRenderer::Instance()->Threads.NumThreads());
@ -82,7 +82,7 @@ void RenderPolyScene::RenderSectors()
int end = thread->End;
for (int i = start; i < end; i++)
{
RenderSubsector(thread, subsectors[i], i);
RenderSubsector(thread, &level.subsectors[subsectors[i]], i);
}
}, [&](PolyRenderThread *thread)
{
@ -372,8 +372,9 @@ void RenderPolyScene::RenderTranslucent(int portalDepth)
}
const auto &viewpoint = PolyRenderer::Instance()->Viewpoint;
for (sector_t *sector : Cull.SeenSectors)
for (uint32_t sectorIndex : Cull.SeenSectors)
{
sector_t *sector = &level.sectors[sectorIndex];
for (AActor *thing = sector->thinglist; thing != nullptr; thing = thing->snext)
{
DVector2 left, right;

View file

@ -91,7 +91,7 @@ void PolySkyDome::Render(PolyRenderThread *thread, const TriMatrix &worldToClip)
RenderCapColorRow(thread, args, mCurrentSetup.frontskytex, 0, false);
RenderCapColorRow(thread, args, mCurrentSetup.frontskytex, rc, true);
args.SetTexture(mCurrentSetup.frontskytex);
args.SetTexture(mCurrentSetup.frontskytex, DefaultRenderStyle());
uint32_t topcapcolor = mCurrentSetup.frontskytex->GetSkyCapColor(false);
uint32_t bottomcapcolor = mCurrentSetup.frontskytex->GetSkyCapColor(true);
@ -342,7 +342,7 @@ void PolySkySetup::Update()
}
frontskytex = TexMan(s->GetTexture(pos), true);
if (frontskytex == nullptr || frontskytex->UseType == FTexture::TEX_Null)
if (frontskytex == nullptr || frontskytex->UseType == ETextureType::Null)
{ // [RH] The blank texture: Use normal sky instead.
goto sky1;
}

View file

@ -104,7 +104,7 @@ void RenderPolySprite::Render(PolyRenderThread *thread, const TriMatrix &worldTo
bool flipTextureX = false;
FTexture *tex = GetSpriteTexture(thing, flipTextureX);
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
return;
double thingyscalemul = thing->Scale.Y / tex->Scale.Y;
@ -315,7 +315,7 @@ FTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool &flipX)
if (thing->picnum.isValid())
{
FTexture *tex = TexMan(thing->picnum);
if (tex->UseType == FTexture::TEX_Null)
if (tex->UseType == ETextureType::Null)
{
return nullptr;
}

View file

@ -173,7 +173,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const TriMatrix &world
wall.FogBoundary = IsFogBoundary(frontsector, backsector);
FTexture *midtex = TexMan(line->sidedef->GetTexture(side_t::mid), true);
if ((midtex && midtex->UseType != FTexture::TEX_Null) || wall.FogBoundary)
if ((midtex && midtex->UseType != ETextureType::Null) || wall.FogBoundary)
translucentWallsOutput.push_back(thread->FrameMemory->NewObject<PolyTranslucentWall>(wall));
if (polyportal)
@ -327,7 +327,7 @@ void RenderPolyWall::Render(PolyRenderThread *thread, const TriMatrix &worldToCl
args.SetStencilTestValue(StencilValue);
args.SetWriteStencil(true, StencilValue + 1);
if (Texture && !Polyportal)
args.SetTexture(Texture);
args.SetTexture(Texture, DefaultRenderStyle());
args.SetClipPlane(0, clipPlane);
SetDynLights(thread, args);
@ -519,7 +519,7 @@ void RenderPolyWall::ClampHeight(TriVertex &v1, TriVertex &v2)
FTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *side, side_t::ETexpart texpart)
{
FTexture *tex = TexMan(side->GetTexture(texpart), true);
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
{
// Mapping error. Doom floodfills this with a plane.
// This code doesn't do that, but at least it uses the "right" texture..
@ -539,7 +539,7 @@ FTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *side, sid
tex = TexMan(line->frontsector->GetTexture(sector_t::floor), true);
}
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
return nullptr;
}
return tex;

View file

@ -41,7 +41,7 @@ void RenderPolyWallSprite::Render(PolyRenderThread *thread, const TriMatrix &wor
bool flipTextureX = false;
FTexture *tex = RenderPolySprite::GetSpriteTexture(thing, flipTextureX);
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
return;
DVector2 spriteScale = thing->Scale;
@ -105,7 +105,7 @@ void RenderPolyWallSprite::Render(PolyRenderThread *thread, const TriMatrix &wor
args.SetTransform(&worldToClip);
args.SetFaceCullCCW(true);
args.SetStencilTestValue(stencilValue);
args.SetTexture(tex);
args.SetTexture(tex, thing->RenderStyle);
args.SetClipPlane(0, clipPlane);
args.SetDepthTest(true);
args.SetWriteDepth(false);

View file

@ -1462,7 +1462,7 @@ bool I_SetCursor(FTexture* cursorpic)
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSCursor* cursor = nil;
if (NULL != cursorpic && FTexture::TEX_Null != cursorpic->UseType)
if (NULL != cursorpic && ETextureType::Null != cursorpic->UseType)
{
// Create bitmap image representation

View file

@ -44,7 +44,7 @@ bool I_SetCursor(FTexture *cursorpic)
static SDL_Cursor *cursor;
static SDL_Surface *cursorSurface;
if (cursorpic != NULL && cursorpic->UseType != FTexture::TEX_Null)
if (cursorpic != NULL && cursorpic->UseType != ETextureType::Null)
{
// Must be no larger than 32x32.
if (cursorpic->GetWidth() > 32 || cursorpic->GetHeight() > 32)

View file

@ -356,7 +356,7 @@ FTextureID LoadSkin(const char * path, const char * fn)
int texlump = FindGFXFile(buffer);
const char * const texname = texlump < 0 ? fn : Wads.GetLumpFullName(texlump);
return TexMan.CheckForTexture(texname, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
return TexMan.CheckForTexture(texname, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
}
//===========================================================================

View file

@ -333,7 +333,7 @@ void FDMDModel::AddSkins(uint8_t *hitlist)
{
if (skins[i].isValid())
{
hitlist[skins[i].GetIndex()] |= FTexture::TEX_Flat;
hitlist[skins[i].GetIndex()] |= FTextureManager::HIT_Flat;
}
}
}

View file

@ -305,7 +305,7 @@ void FMD3Model::AddSkins(uint8_t *hitlist)
{
if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
{
hitlist[curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].GetIndex()] |= FTexture::TEX_Flat;
hitlist[curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].GetIndex()] |= FTextureManager::HIT_Flat;
}
MD3Surface * surf = &surfaces[i];
@ -313,7 +313,7 @@ void FMD3Model::AddSkins(uint8_t *hitlist)
{
if (surf->skins[j].isValid())
{
hitlist[surf->skins[j].GetIndex()] |= FTexture::TEX_Flat;
hitlist[surf->skins[j].GetIndex()] |= FTextureManager::HIT_Flat;
}
}
}

View file

@ -53,23 +53,17 @@
//
//===========================================================================
class FVoxelTexture : public FTexture
class FVoxelTexture : public FWorldTexture
{
public:
FVoxelTexture(FVoxel *voxel);
~FVoxelTexture();
const uint8_t *GetColumn (unsigned int column, const Span **spans_out);
const uint8_t *GetPixels ();
void Unload ();
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf);
bool UseBasePalette() { return false; }
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf) override;
bool UseBasePalette() override { return false; }
uint8_t *MakeTexture(FRenderStyle style) override;
protected:
FVoxel *SourceVox;
uint8_t *Pixels;
};
//===========================================================================
@ -86,7 +80,6 @@ FVoxelTexture::FVoxelTexture(FVoxel *vox)
WidthBits = 4;
HeightBits = 4;
WidthMask = 15;
Pixels = NULL;
gl_info.bNoFilter = true;
gl_info.bNoCompress = true;
}
@ -97,54 +90,32 @@ FVoxelTexture::FVoxelTexture(FVoxel *vox)
//
//===========================================================================
FVoxelTexture::~FVoxelTexture()
{
}
const uint8_t *FVoxelTexture::GetColumn (unsigned int column, const Span **spans_out)
{
// not needed
return NULL;
}
const uint8_t *FVoxelTexture::GetPixels ()
uint8_t *FVoxelTexture::MakeTexture (FRenderStyle style)
{
// GetPixels gets called when a translated palette is used so we still need to implement it here.
if (Pixels == NULL)
auto Pixels = new uint8_t[256];
uint8_t *pp = SourceVox->Palette;
if(pp != NULL)
{
Pixels = new uint8_t[256];
uint8_t *pp = SourceVox->Palette;
if(pp != NULL)
for(int i=0;i<256;i++, pp+=3)
{
for(int i=0;i<256;i++, pp+=3)
{
PalEntry pe;
pe.r = (pp[0] << 2) | (pp[0] >> 4);
pe.g = (pp[1] << 2) | (pp[1] >> 4);
pe.b = (pp[2] << 2) | (pp[2] >> 4);
Pixels[i] = ColorMatcher.Pick(pe);
}
PalEntry pe;
pe.r = (pp[0] << 2) | (pp[0] >> 4);
pe.g = (pp[1] << 2) | (pp[1] >> 4);
pe.b = (pp[2] << 2) | (pp[2] >> 4);
// Alphatexture handling is just for completeness, but rather unlikely to be used ever.
Pixels[i] = (style.Flags & STYLEF_RedIsAlpha)? pe.r : ColorMatcher.Pick(pe);
}
else
{
for(int i=0;i<256;i++, pp+=3)
{
Pixels[i] = (uint8_t)i;
}
}
}
return Pixels;
}
void FVoxelTexture::Unload ()
{
if (Pixels != NULL)
else
{
delete[] Pixels;
Pixels = NULL;
}
for(int i=0;i<256;i++, pp+=3)
{
Pixels[i] = (uint8_t)i;
}
}
return Pixels;
}
//===========================================================================
@ -390,7 +361,7 @@ void FVoxelModel::BuildVertexBuffer(FModelRenderer *renderer)
void FVoxelModel::AddSkins(uint8_t *hitlist)
{
hitlist[mPalette.GetIndex()] |= FTexture::TEX_Flat;
hitlist[mPalette.GetIndex()] |= FTextureManager::HIT_Flat;
}
//===========================================================================

View file

@ -997,7 +997,7 @@ void R_InitTranslationTables ()
{
IcePaletteRemap[i] = ColorMatcher.Pick (IcePalette[i][0], IcePalette[i][1], IcePalette[i][2]);
}
FRemapTable *remap = translationtables[TRANSLATION_Standard][7];
FRemapTable *remap = translationtables[TRANSLATION_Standard][STD_Ice];
remap->Remap[0] = 0;
remap->Palette[0] = 0;
for (i = 1; i < 256; ++i)
@ -1010,9 +1010,9 @@ void R_InitTranslationTables ()
remap->Palette[i] = PalEntry(255, IcePalette[v][0], IcePalette[v][1], IcePalette[v][2]);
}
// The alphatexture translation. Since alphatextures use the red channel this is just a standard grayscale mapping.
// The alphatexture translation. This is just a standard index as gray mapping.
PushIdentityTable(TRANSLATION_Standard);
remap = translationtables[TRANSLATION_Standard][8];
remap = translationtables[TRANSLATION_Standard][STD_Gray];
remap->Remap[0] = 0;
remap->Palette[0] = 0;
for (i = 1; i < 256; i++)
@ -1020,6 +1020,23 @@ void R_InitTranslationTables ()
remap->Remap[i] = i;
remap->Palette[i] = PalEntry(255, i, i, i);
}
// Palette to grayscale ramp. For internal use only, because the remap does not map to the palette.
PushIdentityTable(TRANSLATION_Standard);
remap = translationtables[TRANSLATION_Standard][STD_Grayscale];
remap->Remap[0] = 0;
remap->Palette[0] = 0;
for (i = 1; i < 256; i++)
{
int r = GPalette.BaseColors[i].r;
int g = GPalette.BaseColors[i].g;
int b = GPalette.BaseColors[i].b;
int v = (r * 77 + g * 143 + b * 37) >> 8;
remap->Remap[i] = v;
remap->Palette[i] = PalEntry(255, v, v, v);
}
}
//----------------------------------------------------------------------------

View file

@ -24,6 +24,13 @@ enum
NUM_TRANSLATION_TABLES
};
enum EStandardTranslations
{
STD_Ice = 7,
STD_Gray = 8, // a 0-255 gray ramp
STD_Grayscale = 9, // desaturated version of the palette.
};
struct FRemapTable
{
FRemapTable(int count=256);

View file

@ -133,20 +133,28 @@ union FRenderStyle
uint32_t AsDWORD;
inline FRenderStyle &operator= (ERenderStyle legacy);
operator uint32_t() const { return AsDWORD; }
bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; }
void CheckFuzz();
bool IsVisible(double alpha) const throw();
private:
// Code that compares an actor's render style with a legacy render
// style value should be updated. Making these conversion operators
// private will catch those cases.
operator ERenderStyle() const { return STYLE_Normal; }
operator int() const { return STYLE_Normal; }
// style value should be updated.
operator ERenderStyle() = delete;
operator int() const = delete;
};
extern FRenderStyle LegacyRenderStyles[STYLE_Count];
inline FRenderStyle DefaultRenderStyle()
{
return LegacyRenderStyles[STYLE_Normal];
}
inline FRenderStyle BadRenderStyle() // This is just a marker to find places where work is still needed.
{
return LegacyRenderStyles[STYLE_Normal];
}
inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy)
{
if (legacy < STYLE_None || legacy >= STYLE_Count)

View file

@ -337,7 +337,7 @@ void R_InitSpriteDefs ()
for (i = 0; i < smax; ++i)
{
FTexture *tex = TexMan.ByIndex(i);
if (tex->UseType == FTexture::TEX_Sprite && strlen(tex->Name) >= 6)
if (tex->UseType == ETextureType::Sprite && strlen(tex->Name) >= 6)
{
size_t bucket = TEX_DWNAME(tex) % smax;
hashes[i].Next = hashes[bucket].Head;
@ -856,7 +856,7 @@ void R_InitSkins (void)
memcpy(&lnameint, lname, 4);
if (lnameint == intname)
{
FTextureID picnum = TexMan.CreateTexture(k, FTexture::TEX_SkinSprite);
FTextureID picnum = TexMan.CreateTexture(k, ETextureType::SkinSprite);
bool res = R_InstallSpriteLump (picnum, lname[4] - 'A', lname[5], false, sprtemp, maxframe);
if (lname[6] && res)

View file

@ -84,11 +84,11 @@ void R_InitSkyMap ()
// Do not allow the null texture which has no bitmap and will crash.
if (sky1texture.isNull())
{
sky1texture = TexMan.CheckForTexture("-noflat-", FTexture::TEX_Any);
sky1texture = TexMan.CheckForTexture("-noflat-", ETextureType::Any);
}
if (sky2texture.isNull())
{
sky2texture = TexMan.CheckForTexture("-noflat-", FTexture::TEX_Any);
sky2texture = TexMan.CheckForTexture("-noflat-", ETextureType::Any);
}
skytex1 = TexMan(sky1texture, true);

View file

@ -1062,7 +1062,7 @@ DEFINE_ACTION_FUNCTION(_TexMan, SetCameraToTexture)
PARAM_OBJECT(viewpoint, AActor);
PARAM_STRING(texturename); // [ZZ] there is no point in having this as FTextureID because it's easier to refer to a cameratexture by name and it isn't executed too often to cache it.
PARAM_FLOAT(fov);
FTextureID textureid = TexMan.CheckForTexture(texturename, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
FTextureID textureid = TexMan.CheckForTexture(texturename, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
FCanvasTextureInfo::Add(viewpoint, textureid, fov);
return 0;
}

View file

@ -280,6 +280,8 @@ bool FZipFile::Open(bool quiet)
}
}
}
// If it ran through the list without finding anything it should not attempt any path remapping.
if (!foundspeciallump) name0 = "";
dirptr = (char*)directory;
lump_p = Lumps;

View file

@ -811,6 +811,49 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
}
}
//==========================================================================
//
// ValidatePosVel
//
//==========================================================================
inline bool Validate(const float value)
{
return value >= -32768.f && value <= 32768.f;
}
static bool Validate(const FVector3 &value, const char *const name, const AActor *const actor)
{
const bool valid = Validate(value.X) && Validate(value.Y) && Validate(value.Z);
if (!valid)
{
Printf(TEXTCOLOR_RED "Invalid sound %s " TEXTCOLOR_WHITE "(%f, %f, %f)", name, value.X, value.Y, value.Z);
if (actor == nullptr)
{
Printf("\n");
}
else
{
Printf(TEXTCOLOR_RED " for actor of class " TEXTCOLOR_WHITE "%s\n", actor->GetClass()->TypeName.GetChars());
}
}
return valid;
}
static bool ValidatePosVel(const AActor *actor, const FVector3 &pos, const FVector3 &vel)
{
const bool valid = Validate(pos, "position", actor);
return Validate(vel, "velocity", actor) && valid;
}
static bool ValidatePosVel(const FSoundChan *const chan, const FVector3 &pos, const FVector3 &vel)
{
return ValidatePosVel(chan->SourceType == SOURCE_Actor ? chan->Actor : nullptr, pos, vel);
}
//==========================================================================
//
// CalcSectorSoundOrg
@ -942,6 +985,11 @@ static FSoundChan *S_StartSound(AActor *actor, const sector_t *sec, const FPolyO
CalcPosVel(type, actor, sec, poly, &pt->X, channel, chanflags, &pos, &vel);
if (!ValidatePosVel(type == SOURCE_Actor ? actor : nullptr, pos, vel))
{
return nullptr;
}
if (i_compatflags & COMPATF_MAGICSILENCE)
{ // For people who just can't play without a silent BFG.
channel = CHAN_WEAPON;
@ -1244,6 +1292,11 @@ void S_RestartSound(FSoundChan *chan)
CalcPosVel(chan, &pos, &vel);
if (!ValidatePosVel(chan, pos, vel))
{
return;
}
// If this sound doesn't like playing near itself, don't play it if
// that's what would happen.
if (chan->NearLimit > 0 && S_CheckSoundLimit(&S_sfx[chan->SoundID], pos, chan->NearLimit, chan->LimitRange, NULL, 0))
@ -2116,7 +2169,11 @@ void S_UpdateSounds (AActor *listenactor)
if ((chan->ChanFlags & (CHAN_EVICTED | CHAN_IS3D)) == CHAN_IS3D)
{
CalcPosVel(chan, &pos, &vel);
GSnd->UpdateSoundParams3D(&listener, chan, !!(chan->ChanFlags & CHAN_AREA), pos, vel);
if (ValidatePosVel(chan, pos, vel))
{
GSnd->UpdateSoundParams3D(&listener, chan, !!(chan->ChanFlags & CHAN_AREA), pos, vel);
}
}
chan->ChanFlags &= ~CHAN_JUSTSTARTED;
}

View file

@ -1147,7 +1147,7 @@ static void SetIcon(FTextureID &icon, Baggage &bag, const char *i)
}
else
{
icon = TexMan.CheckForTexture(i, FTexture::TEX_MiscPatch);
icon = TexMan.CheckForTexture(i, ETextureType::MiscPatch);
if (!icon.isValid())
{
// Don't print warnings if the item is for another game or if this is a shareware IWAD.
@ -1609,7 +1609,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, sidemove, F_f, PlayerPawn)
DEFINE_CLASS_PROPERTY_PREFIX(player, scoreicon, S, PlayerPawn)
{
PROP_STRING_PARM(z, 0);
defaults->ScoreIcon = TexMan.CheckForTexture(z, FTexture::TEX_MiscPatch);
defaults->ScoreIcon = TexMan.CheckForTexture(z, ETextureType::MiscPatch);
if (!defaults->ScoreIcon.isValid())
{
bag.ScriptPosition.Message(MSG_WARNING,

View file

@ -2743,6 +2743,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
if (parentfunc->Variants[0].Implementation->DefaultArgs.Size() > 0)
{
sym->Variants[0].Implementation->DefaultArgs = parentfunc->Variants[0].Implementation->DefaultArgs;
sym->Variants[0].ArgFlags = parentfunc->Variants[0].ArgFlags;
}
}
}

Some files were not shown because too many files have changed in this diff Show more