Merge branch 'next' of https://git.magicalgirl.moe/STJr/SRB2 into pictureformats

This commit is contained in:
Jaime Passos 2020-07-21 22:25:00 -03:00
commit ca060a4372
78 changed files with 2123 additions and 2357 deletions

View file

@ -1,14 +1,34 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
# Enable CCache early
set(SRB2_USE_CCACHE OFF CACHE BOOL "Use CCache")
if (${SRB2_USE_CCACHE})
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
message(STATUS "Found CCache: ${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
else()
message(WARNING "You have specified to use CCACHE but it was not found. Object files will not be cached.")
endif()
endif()
file(STRINGS src/version.h SRB2_VERSION)
string(REGEX MATCH "[0-9]+\\.[0-9.]+" SRB2_VERSION ${SRB2_VERSION})
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string. # DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
# Version change is fine. # Version change is fine.
project(SRB2 project(SRB2
VERSION 2.2.4 VERSION ${SRB2_VERSION}
LANGUAGES C) LANGUAGES C)
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.") message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.")
endif() endif()
if ((${SRB2_USE_CCACHE}) AND (${CMAKE_C_COMPILER} MATCHES "clang"))
message(WARNING "Using clang and CCache: You may want to set environment variable CCACHE_CPP2=yes to prevent include errors during compile.")
endif()
# Set up CMAKE path # Set up CMAKE path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
@ -113,16 +133,19 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINAR
##### PACKAGE CONFIGURATION ##### ##### PACKAGE CONFIGURATION #####
if(${CMAKE_SYSTEM} MATCHES "Windows") set(SRB2_CPACK_GENERATOR "" CACHE STRING "Generator to use for making a package. E.g., ZIP, TGZ, DragNDrop (OSX only). Leave blank for default generator.")
set(CPACK_GENERATOR "ZIP")
endif() if("${SRB2_CPACK_GENERATOR}" STREQUAL "")
if(${CMAKE_SYSTEM} MATCHES "Linux") if(${CMAKE_SYSTEM} MATCHES "Windows")
set(CPACK_GENERATOR "TGZ") set(SRB2_CPACK_GENERATOR "ZIP")
endif() elseif(${CMAKE_SYSTEM} MATCHES "Linux")
if(${CMAKE_SYSTEM} MATCHES "Darwin") set(SRB2_CPACK_GENERATOR "TGZ")
set(CPACK_GENERATOR "DragNDrop") elseif(${CMAKE_SYSTEM} MATCHES "Darwin")
set(SRB2_CPACK_GENERATOR "TGZ")
endif()
endif() endif()
set(CPACK_GENERATOR ${SRB2_CPACK_GENERATOR})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2" CACHE STRING "Program name for display purposes") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2" CACHE STRING "Program name for display purposes")
set(CPACK_PACKAGE_VENDOR "Sonic Team Jr." CACHE STRING "Vendor name for display purposes") set(CPACK_PACKAGE_VENDOR "Sonic Team Jr." CACHE STRING "Vendor name for display purposes")
#set(CPACK_PACKAGE_DESCRIPTION_FILE ) #set(CPACK_PACKAGE_DESCRIPTION_FILE )
@ -131,4 +154,5 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH}) set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
SET(CPACK_OUTPUT_FILE_PREFIX package)
include(CPack) include(CPack)

View file

@ -1,4 +1,4 @@
version: 2.2.4.{branch}-{build} version: 2.2.6.{branch}-{build}
os: MinGW os: MinGW
environment: environment:
@ -110,8 +110,8 @@ after_build:
- set BUILDSARCHIVE=%REPO%-%CONFIGURATION%.7z - set BUILDSARCHIVE=%REPO%-%CONFIGURATION%.7z
- cmd: 7z a %BUILD_ARCHIVE% %BUILD_PATH% -xr!.gitignore - cmd: 7z a %BUILD_ARCHIVE% %BUILD_PATH% -xr!.gitignore
- appveyor PushArtifact %BUILD_ARCHIVE% - appveyor PushArtifact %BUILD_ARCHIVE%
- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE% #- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE%
- appveyor PushArtifact %BUILDSARCHIVE% #- appveyor PushArtifact %BUILDSARCHIVE%
############################## ##############################
# DEPLOYER SCRIPT # DEPLOYER SCRIPT
############################## ##############################

View file

@ -12,6 +12,9 @@ ENDFUNCTION(PREPEND)
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer" set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
CACHE STRING "Path to directory that contains all asset files for the installer.") CACHE STRING "Path to directory that contains all asset files for the installer.")
set(SRB2_ASSET_INSTALL ON
CACHE BOOL "Insert asset files into the install directory or package.")
#################### ####################
# POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list! # POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list!
#################### ####################
@ -43,20 +46,27 @@ endforeach()
if(${CMAKE_SYSTEM} MATCHES Darwin) if(${CMAKE_SYSTEM} MATCHES Darwin)
get_target_property(outname SRB2SDL2 OUTPUT_NAME) get_target_property(outname SRB2SDL2 OUTPUT_NAME)
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" if(${SRB2_ASSET_INSTALL})
DESTINATION "${outname}.app/Contents/Resources" install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
) DESTINATION "${outname}.app/Contents/Resources"
)
endif()
# Always install the doc files, even in non-asset packages.
install(FILES ${SRB2_ASSET_DOCS} install(FILES ${SRB2_ASSET_DOCS}
DESTINATION . DESTINATION .
OPTIONAL OPTIONAL
) )
else() else()
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" if(${SRB2_ASSET_INSTALL})
DESTINATION . install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
) DESTINATION .
# Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install again )
#install(FILES ${SRB2_ASSET_DOCS} # Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install them in their own call.
# DESTINATION . else()
# OPTIONAL # Always install the doc files, even in non-asset packages.
#) install(FILES ${SRB2_ASSET_DOCS}
DESTINATION .
OPTIONAL
)
endif()
endif() endif()

3
cmake/launch-c.in Normal file
View file

@ -0,0 +1,3 @@
#!/bin/sh
export CCACHE_CPP2=true
exec "${RULE_LAUNCH_COMPILE}" "${CMAKE_C_COMPILER}" "$@"

3
cmake/launch-cxx.in Normal file
View file

@ -0,0 +1,3 @@
#!/bin/sh
export CCACHE_CPP2=true
exec "${RULE_LAUNCH_COMPILE}" "${CMAKE_C_COMPILER}" "$@"

View file

@ -228,6 +228,12 @@ set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL
"Enable GME support.") "Enable GME support.")
set(SRB2_CONFIG_HAVE_OPENMPT ON CACHE BOOL set(SRB2_CONFIG_HAVE_OPENMPT ON CACHE BOOL
"Enable OpenMPT support.") "Enable OpenMPT support.")
if(${CMAKE_SYSTEM} MATCHES Windows)
set(SRB2_CONFIG_HAVE_MIXERX ON CACHE BOOL
"Enable SDL Mixer X support.")
else()
set(SRB2_CONFIG_HAVE_MIXERX OFF)
endif()
set(SRB2_CONFIG_HWRENDER ON CACHE BOOL set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
"Enable hardware rendering through OpenGL.") "Enable hardware rendering through OpenGL.")
set(SRB2_CONFIG_USEASM OFF CACHE BOOL set(SRB2_CONFIG_USEASM OFF CACHE BOOL
@ -368,6 +374,30 @@ if(${SRB2_CONFIG_HAVE_OPENMPT})
endif() endif()
endif() endif()
if(${SRB2_CONFIG_HAVE_MIXERX})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(MIXERX_FOUND ON)
set(MIXERX_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDLMixerX/i686-w64-mingw32/include/SDL2)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(MIXERX_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDLMixerX/x86_64-w64-mingw32/lib -lSDL2_mixer_ext")
else() # 32-bit
set(MIXERX_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDLMixerX/i686-w64-mingw32/lib -lSDL2_mixer_ext")
endif()
else()
# No support for non-Windows (yet?)
#find_package(MIXERX)
message(WARNING "SDL Mixer X is not supported as an external library.")
set(MIXERX_FOUND OFF)
endif()
if(${MIXERX_FOUND})
set(SRB2_HAVE_MIXERX ON)
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
add_definitions(-DHAVE_MIXERX)
else()
message(WARNING "You have specified that SDL Mixer X is available but it was not found.")
endif()
endif()
if(${SRB2_CONFIG_HAVE_ZLIB}) if(${SRB2_CONFIG_HAVE_ZLIB})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(ZLIB_FOUND ON) set(ZLIB_FOUND ON)
@ -431,7 +461,6 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_trick.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.c
) )
@ -442,7 +471,6 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glide.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
@ -497,6 +525,27 @@ endif()
# Targets # Targets
# If using CCACHE, then force it.
# https://github.com/Cockatrice/Cockatrice/pull/3052/files
if (${CMAKE_SYSTEM} MATCHES "Darwin")
get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
if(RULE_LAUNCH_COMPILE)
MESSAGE(STATUS "Force enabling CCache usage under macOS")
# Set up wrapper scripts
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/launch-c.in ${CMAKE_BINARY_DIR}/launch-c)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/launch-cxx.in ${CMAKE_BINARY_DIR}/launch-cxx)
execute_process(COMMAND chmod a+rx
"${CMAKE_BINARY_DIR}/launch-c"
"${CMAKE_BINARY_DIR}/launch-cxx")
# Set Xcode project attributes to route compilation through our scripts
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx")
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx")
endif()
endif()
# Compatibility flag with later versions of GCC # Compatibility flag with later versions of GCC
# We should really fix our code to not need this # We should really fix our code to not need this
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")

View file

@ -224,7 +224,7 @@ ifdef NOHW
else else
OPTS+=-DHWRENDER OPTS+=-DHWRENDER
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \ OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o \ $(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o
endif endif
@ -646,7 +646,7 @@ ifdef SDL
ifdef MINGW ifdef MINGW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \ command.h hardware/hw_data.h hardware/hw_defs.h \
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
@ -655,7 +655,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
else else
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \ command.h hardware/hw_data.h hardware/hw_defs.h \
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
@ -733,7 +733,7 @@ ifndef SDL
ifndef NOHW ifndef NOHW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \ command.h hardware/hw_data.h hardware/hw_defs.h \
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
@ -742,7 +742,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
$(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \ $(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \ command.h hardware/hw_data.h hardware/hw_defs.h \
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \

View file

@ -1,3 +1,4 @@
# vim: ft=make
# #
# Makefile.cfg for SRB2 # Makefile.cfg for SRB2
# #
@ -7,6 +8,66 @@
# and other things # and other things
# #
# See the following variable don't start with 'GCC'. This is
# to avoid a false positive with the version detection...
SUPPORTED_GCC_VERSIONS:=\
91\
81 82 83\
71 72\
61 62 63 64\
51 52 53 54\
40 41 42 43 44 45 46 47 48 49
LATEST_GCC_VERSION=9.1
# gcc or g++
ifdef PREFIX
CC=$(PREFIX)-gcc
CXX=$(PREFIX)-g++
OBJCOPY=$(PREFIX)-objcopy
OBJDUMP=$(PREFIX)-objdump
STRIP=$(PREFIX)-strip
WINDRES=$(PREFIX)-windres
else
OBJCOPY=objcopy
OBJDUMP=objdump
STRIP=strip
WINDRES=windres
endif
# because Apple screws with us on this
# need to get bintools from homebrew
ifdef MACOSX
CC=clang
CXX=clang
OBJCOPY=gobjcopy
OBJDUMP=gobjdump
endif
# Automatically set version flag, but not if one was manually set
ifeq (,$(filter GCC%,$(.VARIABLES)))
ifneq (,$(findstring gcc,$(shell $(CC) --version))) # if it's GCC
version:=$(shell $(CC) -dumpversion)
# Turn version into words of major, minor
v:=$(subst ., ,$(version))
# concat. major minor
v:=$(word 1,$(v))$(word 2,$(v))
# If this version is not in the list, default to the latest supported
ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS)))
$(info\
Your compiler version, GCC $(version), is not supported by the Makefile.\
The Makefile will assume GCC $(LATEST_GCC_VERSION).)
GCC$(subst .,,$(LATEST_GCC_VERSION))=1
else
$(info Detected GCC $(version) (GCC$(v)))
GCC$(v)=1
endif
endif
endif
ifdef GCC91 ifdef GCC91
GCC83=1 GCC83=1
endif endif
@ -358,30 +419,6 @@ ifdef ARCHNAME
BIN:=$(BIN)/$(ARCHNAME) BIN:=$(BIN)/$(ARCHNAME)
endif endif
# gcc or g++
ifdef PREFIX
CC=$(PREFIX)-gcc
CXX=$(PREFIX)-g++
OBJCOPY=$(PREFIX)-objcopy
OBJDUMP=$(PREFIX)-objdump
STRIP=$(PREFIX)-strip
WINDRES=$(PREFIX)-windres
else
OBJCOPY=objcopy
OBJDUMP=objdump
STRIP=strip
WINDRES=windres
endif
# because Apple screws with us on this
# need to get bintools from homebrew
ifdef MACOSX
CC=clang
CXX=clang
OBJCOPY=gobjcopy
OBJDUMP=gobjdump
endif
OBJDUMP_OPTS?=--wide --source --line-numbers OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC) LD=$(CC)

View file

@ -150,15 +150,15 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
#undef DEALIGNED #undef DEALIGNED
#define WRITESTRINGN(p,s,n) { size_t tmp_i = 0; for (; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) WRITECHAR(p, s[tmp_i]); if (tmp_i < n) WRITECHAR(p, '\0');} #define WRITESTRINGN(p,s,n) do { size_t tmp_i = 0; for (; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) WRITECHAR(p, s[tmp_i]); if (tmp_i < n) WRITECHAR(p, '\0');} while (0)
#define WRITESTRING(p,s) { size_t tmp_i = 0; for (; s[tmp_i] != '\0'; tmp_i++) WRITECHAR(p, s[tmp_i]); WRITECHAR(p, '\0');} #define WRITESTRING(p,s) do { size_t tmp_i = 0; for (; s[tmp_i] != '\0'; tmp_i++) WRITECHAR(p, s[tmp_i]); WRITECHAR(p, '\0');} while (0)
#define WRITEMEM(p,s,n) { memcpy(p, s, n); p += n; } #define WRITEMEM(p,s,n) do { memcpy(p, s, n); p += n; } while (0)
#define SKIPSTRING(p) while (READCHAR(p) != '\0') #define SKIPSTRING(p) while (READCHAR(p) != '\0')
#define READSTRINGN(p,s,n) { size_t tmp_i = 0; for (; tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0'; tmp_i++); s[tmp_i] = '\0';} #define READSTRINGN(p,s,n) ({ size_t tmp_i = 0; for (; tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0'; tmp_i++); s[tmp_i] = '\0';})
#define READSTRING(p,s) { size_t tmp_i = 0; for (; (s[tmp_i] = READCHAR(p)) != '\0'; tmp_i++); s[tmp_i] = '\0';} #define READSTRING(p,s) ({ size_t tmp_i = 0; for (; (s[tmp_i] = READCHAR(p)) != '\0'; tmp_i++); s[tmp_i] = '\0';})
#define READMEM(p,s,n) { memcpy(s, p, n); p += n; } #define READMEM(p,s,n) ({ memcpy(s, p, n); p += n; })
#if 0 // old names #if 0 // old names
#define WRITEBYTE(p,b) WRITEUINT8(p,b) #define WRITEBYTE(p,b) WRITEUINT8(p,b)

View file

@ -33,6 +33,7 @@
#include "p_setup.h" #include "p_setup.h"
#include "lua_script.h" #include "lua_script.h"
#include "d_netfil.h" // findfile #include "d_netfil.h" // findfile
#include "r_data.h" // Color_cons_t
//======== //========
// protos. // protos.
@ -56,7 +57,13 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
static boolean CV_Command(void); static boolean CV_Command(void);
consvar_t *CV_FindVar(const char *name); consvar_t *CV_FindVar(const char *name);
static const char *CV_StringValue(const char *var_name); static const char *CV_StringValue(const char *var_name);
static consvar_t *consvar_vars; // list of registered console variables static consvar_t *consvar_vars; // list of registered console variables
static UINT16 consvar_number_of_netids = 0;
#ifdef OLD22DEMOCOMPAT
static old_demo_var_t *consvar_old_demo_vars;
#endif
static char com_token[1024]; static char com_token[1024];
static char *COM_Parse(char *data); static char *COM_Parse(char *data);
@ -620,7 +627,7 @@ static void COM_ExecuteString(char *ptext)
// check cvars // check cvars
// Hurdler: added at Ebola's request ;) // Hurdler: added at Ebola's request ;)
// (don't flood the console in software mode with bad gr_xxx command) // (don't flood the console in software mode with bad gl_xxx command)
if (!CV_Command() && con_destlines) if (!CV_Command() && con_destlines)
CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0)); CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
} }
@ -812,6 +819,18 @@ static void COM_Help_f(void)
CONS_Printf(" Yes or No (On or Off, 1 or 0)\n"); CONS_Printf(" Yes or No (On or Off, 1 or 0)\n");
else if (cvar->PossibleValue == CV_OnOff) else if (cvar->PossibleValue == CV_OnOff)
CONS_Printf(" On or Off (Yes or No, 1 or 0)\n"); CONS_Printf(" On or Off (Yes or No, 1 or 0)\n");
else if (cvar->PossibleValue == Color_cons_t)
{
for (i = 1; i < numskincolors; ++i)
{
if (skincolors[i].accessible)
{
CONS_Printf(" %-2d : %s\n", i, skincolors[i].name);
if (i == cvar->value)
cvalue = skincolors[i].name;
}
}
}
else else
{ {
#define MINVAL 0 #define MINVAL 0
@ -1121,14 +1140,16 @@ consvar_t *CV_FindVar(const char *name)
return NULL; return NULL;
} }
/** Builds a unique Net Variable identifier number, which is used #ifdef OLD22DEMOCOMPAT
* in network packets instead of the full name. /** Builds a unique Net Variable identifier number, which was used
* in network packets and demos instead of the full name.
*
* This function only still exists to keep compatibility with old demos.
* *
* \param s Name of the variable. * \param s Name of the variable.
* \return A new unique identifier. * \return A new unique identifier.
* \sa CV_FindNetVar
*/ */
static inline UINT16 CV_ComputeNetid(const char *s) static inline UINT16 CV_ComputeOldDemoID(const char *s)
{ {
UINT16 ret = 0, i = 0; UINT16 ret = 0, i = 0;
static UINT16 premiers[16] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53}; static UINT16 premiers[16] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
@ -1142,16 +1163,47 @@ static inline UINT16 CV_ComputeNetid(const char *s)
return ret; return ret;
} }
/** Finds a net variable based on its old style hash. If a hash collides, a
* warning is printed and this function returns NULL.
*
* \param chk The variable's old style hash.
* \return A pointer to the variable itself if found, or NULL.
*/
static old_demo_var_t *CV_FindOldDemoVar(UINT16 chk)
{
old_demo_var_t *demovar;
for (demovar = consvar_old_demo_vars; demovar; demovar = demovar->next)
{
if (demovar->checksum == chk)
{
if (demovar->collides)
{
CONS_Alert(CONS_WARNING,
"Old demo netvar id %hu is a collision\n", chk);
return NULL;
}
return demovar;
}
}
return NULL;
}
#endif/*OLD22DEMOCOMPAT*/
/** Finds a net variable based on its identifier number. /** Finds a net variable based on its identifier number.
* *
* \param netid The variable's identifier number. * \param netid The variable's identifier number.
* \return A pointer to the variable itself if found, or NULL. * \return A pointer to the variable itself if found, or NULL.
* \sa CV_ComputeNetid
*/ */
static consvar_t *CV_FindNetVar(UINT16 netid) static consvar_t *CV_FindNetVar(UINT16 netid)
{ {
consvar_t *cvar; consvar_t *cvar;
if (netid >= consvar_number_of_netids)
return NULL;
for (cvar = consvar_vars; cvar; cvar = cvar->next) for (cvar = consvar_vars; cvar; cvar = cvar->next)
if (cvar->netid == netid) if (cvar->netid == netid)
return cvar; return cvar;
@ -1161,6 +1213,32 @@ static consvar_t *CV_FindNetVar(UINT16 netid)
static void Setvalue(consvar_t *var, const char *valstr, boolean stealth); static void Setvalue(consvar_t *var, const char *valstr, boolean stealth);
#ifdef OLD22DEMOCOMPAT
/* Sets up a netvar for compatibility with old demos. */
static void CV_RegisterOldDemoVar(consvar_t *variable)
{
old_demo_var_t *demovar;
UINT16 old_demo_id;
old_demo_id = CV_ComputeOldDemoID(variable->name);
demovar = CV_FindOldDemoVar(old_demo_id);
if (demovar)
demovar->collides = true;
else
{
demovar = ZZ_Calloc(sizeof *demovar);
demovar->checksum = old_demo_id;
demovar->cvar = variable;
demovar->next = consvar_old_demo_vars;
consvar_old_demo_vars = demovar;
}
}
#endif
/** Registers a variable for later use from the console. /** Registers a variable for later use from the console.
* *
* \param variable The variable to register. * \param variable The variable to register.
@ -1184,11 +1262,15 @@ void CV_RegisterVar(consvar_t *variable)
// check net variables // check net variables
if (variable->flags & CV_NETVAR) if (variable->flags & CV_NETVAR)
{ {
const consvar_t *netvar; variable->netid = consvar_number_of_netids++;
variable->netid = CV_ComputeNetid(variable->name);
netvar = CV_FindNetVar(variable->netid); /* in case of overflow... */
if (netvar) if (variable->netid > consvar_number_of_netids)
I_Error("Variables %s and %s have same netid\n", variable->name, netvar->name); I_Error("Way too many netvars");
#ifdef OLD22DEMOCOMPAT
CV_RegisterOldDemoVar(variable);
#endif
} }
// link the variable in // link the variable in
@ -1448,12 +1530,100 @@ badinput:
static boolean serverloading = false; static boolean serverloading = false;
static consvar_t *
ReadNetVar (UINT8 **p, char **return_value, boolean *return_stealth)
{
UINT16 netid;
char *val;
boolean stealth;
consvar_t *cvar;
netid = READUINT16 (*p);
val = (char *)*p;
SKIPSTRING (*p);
stealth = READUINT8 (*p);
cvar = CV_FindNetVar(netid);
if (cvar)
{
(*return_value) = val;
(*return_stealth) = stealth;
DEBFILE(va("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, val));
}
else
CONS_Alert(CONS_WARNING, "Netvar not found with netid %hu\n", netid);
return cvar;
}
#ifdef OLD22DEMOCOMPAT
static consvar_t *
ReadOldDemoVar (UINT8 **p, char **return_value, boolean *return_stealth)
{
UINT16 id;
char *val;
boolean stealth;
old_demo_var_t *demovar;
id = READUINT16 (*p);
val = (char *)*p;
SKIPSTRING (*p);
stealth = READUINT8 (*p);
demovar = CV_FindOldDemoVar(id);
if (demovar)
{
(*return_value) = val;
(*return_stealth) = stealth;
return demovar->cvar;
}
else
{
CONS_Alert(CONS_WARNING, "Netvar not found with old demo id %hu\n", id);
return NULL;
}
}
#endif/*OLD22DEMOCOMPAT*/
static consvar_t *
ReadDemoVar (UINT8 **p, char **return_value, boolean *return_stealth)
{
char *name;
char *val;
boolean stealth;
consvar_t *cvar;
name = (char *)*p;
SKIPSTRING (*p);
val = (char *)*p;
SKIPSTRING (*p);
stealth = READUINT8 (*p);
cvar = CV_FindVar(name);
if (cvar)
{
(*return_value) = val;
(*return_stealth) = stealth;
}
else
CONS_Alert(CONS_WARNING, "Netvar not found with name %s\n", name);
return cvar;
}
static void Got_NetVar(UINT8 **p, INT32 playernum) static void Got_NetVar(UINT8 **p, INT32 playernum)
{ {
consvar_t *cvar; consvar_t *cvar;
UINT16 netid;
char *svalue; char *svalue;
UINT8 stealth = false; boolean stealth;
if (playernum != serverplayer && !IsPlayerAdmin(playernum) && !serverloading) if (playernum != serverplayer && !IsPlayerAdmin(playernum) && !serverloading)
{ {
@ -1463,23 +1633,14 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
return; return;
} }
netid = READUINT16(*p);
cvar = CV_FindNetVar(netid);
svalue = (char *)*p;
SKIPSTRING(*p);
stealth = READUINT8(*p);
if (!cvar) cvar = ReadNetVar(p, &svalue, &stealth);
{
CONS_Alert(CONS_WARNING, "Netvar not found with netid %hu\n", netid);
return;
}
DEBFILE(va("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, svalue));
Setvalue(cvar, svalue, stealth); if (cvar)
Setvalue(cvar, svalue, stealth);
} }
void CV_SaveNetVars(UINT8 **p) void CV_SaveVars(UINT8 **p, boolean in_demo)
{ {
consvar_t *cvar; consvar_t *cvar;
UINT8 *count_p = *p; UINT8 *count_p = *p;
@ -1491,7 +1652,10 @@ void CV_SaveNetVars(UINT8 **p)
for (cvar = consvar_vars; cvar; cvar = cvar->next) for (cvar = consvar_vars; cvar; cvar = cvar->next)
if ((cvar->flags & CV_NETVAR) && !CV_IsSetToDefault(cvar)) if ((cvar->flags & CV_NETVAR) && !CV_IsSetToDefault(cvar))
{ {
WRITEUINT16(*p, cvar->netid); if (in_demo)
WRITESTRING(*p, cvar->name);
else
WRITEUINT16(*p, cvar->netid);
WRITESTRING(*p, cvar->string); WRITESTRING(*p, cvar->string);
WRITEUINT8(*p, false); WRITEUINT8(*p, false);
++count; ++count;
@ -1499,11 +1663,15 @@ void CV_SaveNetVars(UINT8 **p)
WRITEUINT16(count_p, count); WRITEUINT16(count_p, count);
} }
void CV_LoadNetVars(UINT8 **p) static void CV_LoadVars(UINT8 **p,
consvar_t *(*got)(UINT8 **p, char **ret_value, boolean *ret_stealth))
{ {
consvar_t *cvar; consvar_t *cvar;
UINT16 count; UINT16 count;
char *val;
boolean stealth;
// prevent "invalid command received" // prevent "invalid command received"
serverloading = true; serverloading = true;
@ -1513,11 +1681,33 @@ void CV_LoadNetVars(UINT8 **p)
count = READUINT16(*p); count = READUINT16(*p);
while (count--) while (count--)
Got_NetVar(p, 0); {
cvar = (*got)(p, &val, &stealth);
if (cvar)
Setvalue(cvar, val, stealth);
}
serverloading = false; serverloading = false;
} }
void CV_LoadNetVars(UINT8 **p)
{
CV_LoadVars(p, ReadNetVar);
}
#ifdef OLD22DEMOCOMPAT
void CV_LoadOldDemoVars(UINT8 **p)
{
CV_LoadVars(p, ReadOldDemoVar);
}
#endif
void CV_LoadDemoVars(UINT8 **p)
{
CV_LoadVars(p, ReadDemoVar);
}
static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth); static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth);
void CV_ResetCheatNetVars(void) void CV_ResetCheatNetVars(void)
@ -1574,7 +1764,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
// send the value of the variable // send the value of the variable
UINT8 buf[128]; UINT8 buf[128];
UINT8 *p = buf; UINT8 *p = buf;
if (!(server || (IsPlayerAdmin(consoleplayer)))) if (!(server || (addedtogame && IsPlayerAdmin(consoleplayer))))
{ {
CONS_Printf(M_GetText("Only the server or admin can change: %s %s\n"), var->name, var->string); CONS_Printf(M_GetText("Only the server or admin can change: %s %s\n"), var->name, var->string);
return; return;

View file

@ -144,6 +144,19 @@ typedef struct consvar_s //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NUL
struct consvar_s *next; struct consvar_s *next;
} consvar_t; } consvar_t;
#ifdef OLD22DEMOCOMPAT
typedef struct old_demo_var old_demo_var_t;
struct old_demo_var
{
UINT16 checksum;
boolean collides;/* this var is a collision of multiple hashes */
consvar_t *cvar;
old_demo_var_t *next;
};
#endif/*OLD22DEMOCOMPAT*/
extern CV_PossibleValue_t CV_OnOff[]; extern CV_PossibleValue_t CV_OnOff[];
extern CV_PossibleValue_t CV_YesNo[]; extern CV_PossibleValue_t CV_YesNo[];
extern CV_PossibleValue_t CV_Unsigned[]; extern CV_PossibleValue_t CV_Unsigned[];
@ -184,9 +197,18 @@ void CV_AddValue(consvar_t *var, INT32 increment);
void CV_SaveVariables(FILE *f); void CV_SaveVariables(FILE *f);
// load/save gamesate (load and save option and for network join in game) // load/save gamesate (load and save option and for network join in game)
void CV_SaveNetVars(UINT8 **p); void CV_SaveVars(UINT8 **p, boolean in_demo);
#define CV_SaveNetVars(p) CV_SaveVars(p, false)
void CV_LoadNetVars(UINT8 **p); void CV_LoadNetVars(UINT8 **p);
#define CV_SaveDemoVars(p) CV_SaveVars(p, true)
void CV_LoadDemoVars(UINT8 **p);
#ifdef OLD22DEMOCOMPAT
void CV_LoadOldDemoVars(UINT8 **p);
#endif
// reset cheat netvars after cheats is deactivated // reset cheat netvars after cheats is deactivated
void CV_ResetCheatNetVars(void); void CV_ResetCheatNetVars(void);

View file

@ -30,12 +30,14 @@
* Last updated 2020 / 02 / 22 - v2.2.2 - patch.pk3 * Last updated 2020 / 02 / 22 - v2.2.2 - patch.pk3
* Last updated 2020 / 05 / 10 - v2.2.3 - player.dta & patch.pk3 * Last updated 2020 / 05 / 10 - v2.2.3 - player.dta & patch.pk3
* Last updated 2020 / 05 / 11 - v2.2.4 - patch.pk3 * Last updated 2020 / 05 / 11 - v2.2.4 - patch.pk3
* Last updated 2020 / 07 / 07 - v2.2.5 - player.dta & patch.pk3
* Last updated 2020 / 07 / 10 - v2.2.6 - player.dta & patch.pk3
*/ */
#define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" #define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28"
#define ASSET_HASH_ZONES_PK3 "f7e88afb6af7996a834c7d663144bead" #define ASSET_HASH_ZONES_PK3 "f7e88afb6af7996a834c7d663144bead"
#define ASSET_HASH_PLAYER_DTA "8a4507ddf9bc0682c09174400f26ad65" #define ASSET_HASH_PLAYER_DTA "49dad7b24634c89728cc3e0b689e12bb"
#ifdef USE_PATCH_DTA #ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_PK3 "bbbf6af3b20349612ee06e0b55979a76" #define ASSET_HASH_PATCH_PK3 "ecf00060f03c76b3e49c6ae3925b627f"
#endif #endif
#endif #endif

View file

@ -2336,8 +2336,8 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
if (server_list) if (server_list)
{ {
char version[8] = ""; char version[8] = "";
#if VERSION > 0 || SUBVERSION > 0 #ifndef DEVELOP
snprintf(version, sizeof (version), "%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION); strcpy(version, SRB2VERSION);
#else #else
strcpy(version, GetRevisionString()); strcpy(version, GetRevisionString());
#endif #endif
@ -5159,7 +5159,7 @@ static void SV_SendTics(void)
{ {
// assert supposedtics[n]>=nettics[n] // assert supposedtics[n]>=nettics[n]
realfirsttic = supposedtics[n]; realfirsttic = supposedtics[n];
lasttictosend = min(maketic, realfirsttic + CLIENTBACKUPTICS); lasttictosend = min(maketic, nettics[n] + CLIENTBACKUPTICS);
if (realfirsttic >= lasttictosend) if (realfirsttic >= lasttictosend)
{ {
@ -5496,7 +5496,7 @@ void NetUpdate(void)
// update node latency values so we can take an average later. // update node latency values so we can take an average later.
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && playernode[i] != UINT8_MAX) if (playeringame[i] && playernode[i] != UINT8_MAX)
realpingtable[i] += GetLag(playernode[i]) * (1000.00f / TICRATE); realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i]));
pingmeasurecount++; pingmeasurecount++;
} }

View file

@ -93,6 +93,10 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "lua_script.h" #include "lua_script.h"
// Version numbers for netplay :upside_down_face:
int VERSION;
int SUBVERSION;
// platform independant focus loss // platform independant focus loss
UINT8 window_notinfocus = false; UINT8 window_notinfocus = false;
@ -635,7 +639,7 @@ static void D_Display(void)
V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s); V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s);
snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor); snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor);
V_DrawThinString(30, 80, V_MONOSPACE | V_YELLOWMAP, s); V_DrawThinString(30, 80, V_MONOSPACE | V_YELLOWMAP, s);
if (cv_grbatching.value) if (cv_glbatching.value)
{ {
snprintf(s, sizeof s - 1, "bsrt %d", rs_hw_batchsorttime / divisor); snprintf(s, sizeof s - 1, "bsrt %d", rs_hw_batchsorttime / divisor);
V_DrawThinString(80, 55, V_MONOSPACE | V_REDMAP, s); V_DrawThinString(80, 55, V_MONOSPACE | V_REDMAP, s);
@ -1142,6 +1146,21 @@ static inline void D_Titlebar(void)
} }
#endif #endif
static void
D_ConvertVersionNumbers (void)
{
/* leave at defaults (0) under DEVELOP */
#ifndef DEVELOP
int major;
int minor;
sscanf(SRB2VERSION, "%d.%d.%d", &major, &minor, &SUBVERSION);
/* this is stupid */
VERSION = ( major * 100 ) + minor;
#endif
}
// //
// D_SRB2Main // D_SRB2Main
// //
@ -1152,6 +1171,9 @@ void D_SRB2Main(void)
INT32 pstartmap = 1; INT32 pstartmap = 1;
boolean autostart = false; boolean autostart = false;
/* break the version string into version numbers, for netplay */
D_ConvertVersionNumbers();
// Print GPL notice for our console users (Linux) // Print GPL notice for our console users (Linux)
CONS_Printf( CONS_Printf(
"\n\nSonic Robo Blast 2\n" "\n\nSonic Robo Blast 2\n"

View file

@ -3475,7 +3475,7 @@ static void Command_Version_f(void)
#ifdef DEVELOP #ifdef DEVELOP
CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s) ", compbranch, comprevision, compdate, comptime); CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s) ", compbranch, comprevision, compdate, comptime);
#else #else
CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision); CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch);
#endif #endif
// Base library // Base library

View file

@ -807,8 +807,41 @@ static void readskincolor(MYFILE *f, INT32 num)
if (fastcmp(word, "NAME")) if (fastcmp(word, "NAME"))
{ {
deh_strlcpy(skincolors[num].name, word2, size_t namesize = sizeof(skincolors[num].name);
sizeof (skincolors[num].name), va("Skincolor %d: name", num)); char truncword[namesize];
deh_strlcpy(truncword, word2, namesize, va("Skincolor %d: name", num)); // truncate here to check for dupes
if (truncword[0] != '\0' && (!stricmp(truncword, skincolors[SKINCOLOR_NONE].name) || R_GetColorByName(truncword)))
{
size_t lastchar = strlen(truncword);
char oldword[lastchar+1];
char dupenum = '1';
strlcpy(oldword, truncword, lastchar+1);
lastchar--;
if (lastchar == namesize-2) // exactly max length, replace last character with 0
truncword[lastchar] = '0';
else // append 0
{
strcat(truncword, "0");
lastchar++;
}
while (R_GetColorByName(truncword))
{
truncword[lastchar] = dupenum;
if (dupenum == '9')
dupenum = 'A';
else if (dupenum == 'Z') // give up :?
break;
else
dupenum++;
}
deh_warning("Skincolor %d: name %s is a duplicate of another skincolor's name - renamed to %s", num, oldword, truncword);
}
strlcpy(skincolors[num].name, truncword, namesize); // already truncated
} }
else if (fastcmp(word, "RAMP")) else if (fastcmp(word, "RAMP"))
{ {
@ -819,10 +852,15 @@ static void readskincolor(MYFILE *f, INT32 num)
if ((tmp = strtok(NULL,",")) == NULL) if ((tmp = strtok(NULL,",")) == NULL)
break; break;
} }
skincolor_modified[num] = true;
} }
else if (fastcmp(word, "INVCOLOR")) else if (fastcmp(word, "INVCOLOR"))
{ {
skincolors[num].invcolor = (UINT16)get_number(word2); UINT16 v = (UINT16)get_number(word2);
if (v < numskincolors)
skincolors[num].invcolor = v;
else
skincolors[num].invcolor = SKINCOLOR_GREEN;
} }
else if (fastcmp(word, "INVSHADE")) else if (fastcmp(word, "INVSHADE"))
{ {
@ -3083,6 +3121,7 @@ static actionpointer_t actionpointers[] =
{{A_NapalmScatter}, "A_NAPALMSCATTER"}, {{A_NapalmScatter}, "A_NAPALMSCATTER"},
{{A_SpawnFreshCopy}, "A_SPAWNFRESHCOPY"}, {{A_SpawnFreshCopy}, "A_SPAWNFRESHCOPY"},
{{A_FlickySpawn}, "A_FLICKYSPAWN"}, {{A_FlickySpawn}, "A_FLICKYSPAWN"},
{{A_FlickyCenter}, "A_FLICKYCENTER"},
{{A_FlickyAim}, "A_FLICKYAIM"}, {{A_FlickyAim}, "A_FLICKYAIM"},
{{A_FlickyFly}, "A_FLICKYFLY"}, {{A_FlickyFly}, "A_FLICKYFLY"},
{{A_FlickySoar}, "A_FLICKYSOAR"}, {{A_FlickySoar}, "A_FLICKYSOAR"},
@ -9484,8 +9523,6 @@ struct {
{"PUSHACCEL",PUSHACCEL}, {"PUSHACCEL",PUSHACCEL},
{"MODID",MODID}, // I don't know, I just thought it would be cool for a wad to potentially know what mod it was loaded into. {"MODID",MODID}, // I don't know, I just thought it would be cool for a wad to potentially know what mod it was loaded into.
{"CODEBASE",CODEBASE}, // or what release of SRB2 this is. {"CODEBASE",CODEBASE}, // or what release of SRB2 this is.
{"VERSION",VERSION}, // Grab the game's version!
{"SUBVERSION",SUBVERSION}, // more precise version number
{"NEWTICRATE",NEWTICRATE}, // TICRATE*NEWTICRATERATIO {"NEWTICRATE",NEWTICRATE}, // TICRATE*NEWTICRATERATIO
{"NEWTICRATERATIO",NEWTICRATERATIO}, {"NEWTICRATERATIO",NEWTICRATERATIO},
@ -10630,7 +10667,7 @@ static inline int lib_freeslot(lua_State *L)
CONS_Printf("State S_%s allocated.\n",word); CONS_Printf("State S_%s allocated.\n",word);
FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL); FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_STATES[i],word); strcpy(FREE_STATES[i],word);
lua_pushinteger(L, i); lua_pushinteger(L, S_FIRSTFREESLOT + i);
r++; r++;
break; break;
} }
@ -10645,7 +10682,7 @@ static inline int lib_freeslot(lua_State *L)
CONS_Printf("MobjType MT_%s allocated.\n",word); CONS_Printf("MobjType MT_%s allocated.\n",word);
FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL); FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_MOBJS[i],word); strcpy(FREE_MOBJS[i],word);
lua_pushinteger(L, i); lua_pushinteger(L, MT_FIRSTFREESLOT + i);
r++; r++;
break; break;
} }
@ -10661,7 +10698,7 @@ static inline int lib_freeslot(lua_State *L)
FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL); FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_SKINCOLORS[i],word); strcpy(FREE_SKINCOLORS[i],word);
M_AddMenuColor(numskincolors++); M_AddMenuColor(numskincolors++);
lua_pushinteger(L, i); lua_pushinteger(L, SKINCOLOR_FIRSTFREESLOT + i);
r++; r++;
break; break;
} }
@ -10682,11 +10719,12 @@ static inline int lib_freeslot(lua_State *L)
CONS_Printf("Sprite SPR2_%s allocated.\n",word); CONS_Printf("Sprite SPR2_%s allocated.\n",word);
strncpy(spr2names[free_spr2],word,4); strncpy(spr2names[free_spr2],word,4);
spr2defaults[free_spr2] = 0; spr2defaults[free_spr2] = 0;
lua_pushinteger(L, free_spr2);
r++;
spr2names[free_spr2++][4] = 0; spr2names[free_spr2++][4] = 0;
} else } else
CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n"); CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n");
} }
r++;
} }
else if (fastcmp(type, "TOL")) else if (fastcmp(type, "TOL"))
{ {

View file

@ -86,6 +86,7 @@
// warning C4213: nonstandard extension used : cast on l-value // warning C4213: nonstandard extension used : cast on l-value
#include "version.h"
#include "doomtype.h" #include "doomtype.h"
#include <stdarg.h> #include <stdarg.h>
@ -135,21 +136,17 @@ extern char logfilename[1024];
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 //#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
#ifdef DEVELOP #ifdef DEVELOP
#define VERSION 0 // Game version
#define SUBVERSION 0 // more precise version number
#define VERSIONSTRING "Development EXE" #define VERSIONSTRING "Development EXE"
#define VERSIONSTRINGW L"Development EXE"
// most interface strings are ignored in development mode. // most interface strings are ignored in development mode.
// we use comprevision and compbranch instead. // we use comprevision and compbranch instead.
#else #else
#define VERSION 202 // Game version #define VERSIONSTRING "v"SRB2VERSION
#define SUBVERSION 4 // more precise version number
#define VERSIONSTRING "v2.2.4"
#define VERSIONSTRINGW L"v2.2.4"
// Hey! If you change this, add 1 to the MODVERSION below! // Hey! If you change this, add 1 to the MODVERSION below!
// Otherwise we can't force updates! // Otherwise we can't force updates!
#endif #endif
#define VERSIONSTRINGW WSTRING (VERSIONSTRING)
/* A custom URL protocol for server links. */ /* A custom URL protocol for server links. */
#define SERVER_URL_PROTOCOL "srb2://" #define SERVER_URL_PROTOCOL "srb2://"
@ -204,17 +201,6 @@ extern char logfilename[1024];
// Will always resemble the versionstring, 205 = 2.0.5, 210 = 2.1, etc. // Will always resemble the versionstring, 205 = 2.0.5, 210 = 2.1, etc.
#define CODEBASE 220 #define CODEBASE 220
// The Modification ID; must be obtained from Rob ( https://mb.srb2.org/private.php?do=newpm&u=546 ).
// DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server.
// "18" is the default mod ID for version 2.2
#define MODID 18
// The Modification Version, starting from 1. Do not follow your version string for this,
// it's only for detection of the version the player is using so the MS can alert them of an update.
// Only set it higher, not lower, obviously.
// Note that we use this to help keep internal testing in check; this is why v2.2.0 is not version "1".
#define MODVERSION 44
// To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically. // To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically.
// Increment MINOREXECVERSION whenever a config change is needed that does not correspond // Increment MINOREXECVERSION whenever a config change is needed that does not correspond
// to an increment in MODVERSION. This might never happen in practice. // to an increment in MODVERSION. This might never happen in practice.
@ -503,6 +489,8 @@ char *sizeu4(size_t num);
char *sizeu5(size_t num); char *sizeu5(size_t num);
// d_main.c // d_main.c
extern int VERSION;
extern int SUBVERSION;
extern boolean devparm; // development mode (-debug) extern boolean devparm; // development mode (-debug)
// d_netcmd.c // d_netcmd.c
extern INT32 cv_debug; extern INT32 cv_debug;
@ -657,4 +645,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Render flats on walls /// Render flats on walls
#define WALLFLATS #define WALLFLATS
/// Maintain compatibility with older 2.2 demos
#define OLD22DEMOCOMPAT
#endif // __DOOMDEF__ #endif // __DOOMDEF__

View file

@ -367,4 +367,8 @@ typedef UINT32 tic_t;
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24) #define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
#endif #endif
/* preprocessor dumb and needs second macro to expand input */
#define WSTRING2(s) L ## s
#define WSTRING(s) WSTRING2 (s)
#endif //__DOOMTYPE__ #endif //__DOOMTYPE__

View file

@ -1674,6 +1674,18 @@ void F_GameEvaluationDrawer(void)
V_DrawString(8, 96, V_YELLOWMAP, "Modified games\ncan't unlock\nextras!"); V_DrawString(8, 96, V_YELLOWMAP, "Modified games\ncan't unlock\nextras!");
} }
#endif #endif
if (marathonmode)
{
const char *rtatext, *cuttext;
rtatext = (marathonmode & MA_INGAME) ? "In-game timer" : "RTA timer";
cuttext = (marathonmode & MA_NOCUTSCENES) ? "" : " w/ cutscenes";
if (botskin)
endingtext = va("%s & %s, %s%s", skins[players[consoleplayer].skin].realname, skins[botskin-1].realname, rtatext, cuttext);
else
endingtext = va("%s, %s%s", skins[players[consoleplayer].skin].realname, rtatext, cuttext);
V_DrawCenteredString(BASEVIDWIDTH/2, 182, V_SNAPTOBOTTOM|(ultimatemode ? V_REDMAP : V_YELLOWMAP), endingtext);
}
} }
void F_GameEvaluationTicker(void) void F_GameEvaluationTicker(void)

View file

@ -1525,7 +1525,7 @@ void G_BeginRecording(void)
} }
// Save netvar data // Save netvar data
CV_SaveNetVars(&demo_p); CV_SaveDemoVars(&demo_p);
memset(&oldcmd,0,sizeof(oldcmd)); memset(&oldcmd,0,sizeof(oldcmd));
memset(&oldghost,0,sizeof(oldghost)); memset(&oldghost,0,sizeof(oldghost));
@ -1756,6 +1756,9 @@ void G_DoPlayDemo(char *defdemoname)
UINT32 randseed, followitem; UINT32 randseed, followitem;
fixed_t camerascale,shieldscale,actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor,height,spinheight; fixed_t camerascale,shieldscale,actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor,height,spinheight;
char msg[1024]; char msg[1024];
#ifdef OLD22DEMOCOMPAT
boolean use_old_demo_vars = false;
#endif
skin[16] = '\0'; skin[16] = '\0';
color[MAXCOLORNAME] = '\0'; color[MAXCOLORNAME] = '\0';
@ -1818,10 +1821,13 @@ void G_DoPlayDemo(char *defdemoname)
case DEMOVERSION: // latest always supported case DEMOVERSION: // latest always supported
cnamelen = MAXCOLORNAME; cnamelen = MAXCOLORNAME;
break; break;
#ifdef OLD22DEMOCOMPAT
// all that changed between then and now was longer color name // all that changed between then and now was longer color name
case 0x000c: case 0x000c:
cnamelen = 16; cnamelen = 16;
use_old_demo_vars = true;
break; break;
#endif
// too old, cannot support. // too old, cannot support.
default: default:
snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname);
@ -1923,7 +1929,13 @@ void G_DoPlayDemo(char *defdemoname)
} }
// net var data // net var data
CV_LoadNetVars(&demo_p); #ifdef OLD22DEMOCOMPAT
if (use_old_demo_vars)
CV_LoadOldDemoVars(&demo_p);
else
#else
CV_LoadDemoVars(&demo_p);
#endif
// Sigh ... it's an empty demo. // Sigh ... it's an empty demo.
if (*demo_p == DEMOMARKER) if (*demo_p == DEMOMARKER)

View file

@ -3729,6 +3729,32 @@ static boolean CanSaveLevel(INT32 mapnum)
return (mapheaderinfo[mapnum-1] && (mapheaderinfo[mapnum-1]->levelflags & LF_SAVEGAME)); return (mapheaderinfo[mapnum-1] && (mapheaderinfo[mapnum-1]->levelflags & LF_SAVEGAME));
} }
static void G_HandleSaveLevel(void)
{
// do this before running the intermission or custom cutscene, mostly for the sake of marathon mode but it also massively reduces redundant file save events in f_finale.c
if (nextmap >= 1100-1)
{
if (!gamecomplete)
gamecomplete = 2; // special temporary mode to prevent using SP level select in pause menu until the intermission is over without restricting it in every intermission
if (cursaveslot > 0)
{
if (marathonmode)
{
// don't keep a backup around when the run is done!
if (FIL_FileExists(liveeventbackup))
remove(liveeventbackup);
cursaveslot = 0;
}
else if ((!modifiedgame || savemoddata) && !(netgame || multiplayer || ultimatemode || demorecording || metalrecording || modeattacking))
G_SaveGame((UINT32)cursaveslot, spstage_start);
}
}
// and doing THIS here means you don't lose your progress if you close the game mid-intermission
else if (!(ultimatemode || netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking)
&& (!modifiedgame || savemoddata) && cursaveslot > 0 && CanSaveLevel(lastmap+1))
G_SaveGame((UINT32)cursaveslot, lastmap+1); // not nextmap+1 to route around special stages
}
// //
// G_DoCompleted // G_DoCompleted
// //
@ -3875,6 +3901,7 @@ static void G_DoCompleted(void)
if ((skipstats && !modeattacking) || (spec && modeattacking && stagefailed) || (intertype == int_none)) if ((skipstats && !modeattacking) || (spec && modeattacking && stagefailed) || (intertype == int_none))
{ {
G_UpdateVisited(); G_UpdateVisited();
G_HandleSaveLevel();
G_AfterIntermission(); G_AfterIntermission();
} }
else else
@ -3882,30 +3909,8 @@ static void G_DoCompleted(void)
G_SetGamestate(GS_INTERMISSION); G_SetGamestate(GS_INTERMISSION);
Y_StartIntermission(); Y_StartIntermission();
G_UpdateVisited(); G_UpdateVisited();
G_HandleSaveLevel();
} }
// do this before running the intermission or custom cutscene, mostly for the sake of marathon mode but it also massively reduces redundant file save events in f_finale.c
if (nextmap >= 1100-1)
{
if (!gamecomplete)
gamecomplete = 2; // special temporary mode to prevent using SP level select in pause menu until the intermission is over without restricting it in every intermission
if (cursaveslot > 0)
{
if (marathonmode)
{
// don't keep a backup around when the run is done!
if (FIL_FileExists(liveeventbackup))
remove(liveeventbackup);
cursaveslot = 0;
}
else if ((!modifiedgame || savemoddata) && !(netgame || multiplayer || ultimatemode || demorecording || metalrecording || modeattacking))
G_SaveGame((UINT32)cursaveslot, spstage_start);
}
}
// and doing THIS here means you don't lose your progress if you close the game mid-intermission
else if (!(ultimatemode || netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking)
&& (!modifiedgame || savemoddata) && cursaveslot > 0 && CanSaveLevel(lastmap+1))
G_SaveGame((UINT32)cursaveslot, lastmap+1); // not nextmap+1 to route around special stages
} }
// See also F_EndCutscene, the only other place which handles intra-map/ending transitions // See also F_EndCutscene, the only other place which handles intra-map/ending transitions
@ -4498,7 +4503,10 @@ void G_SaveGame(UINT32 slot, INT16 mapnum)
P_SaveGame(mapnum); P_SaveGame(mapnum);
if (marathonmode) if (marathonmode)
{ {
WRITEUINT32(save_p, marathontime); UINT32 writetime = marathontime;
if (!(marathonmode & MA_INGAME))
writetime += TICRATE*5; // live event backup penalty because we don't know how long it takes to get to the next map
WRITEUINT32(save_p, writetime);
WRITEUINT8(save_p, (marathonmode & ~MA_INIT)); WRITEUINT8(save_p, (marathonmode & ~MA_INIT));
} }

View file

@ -250,7 +250,7 @@ void HWR_RenderBatches(void)
// sort polygons // sort polygons
rs_hw_batchsorttime = I_GetTimeMicros(); rs_hw_batchsorttime = I_GetTimeMicros();
if (cv_grshaders.value && gr_shadersavailable) if (cv_glshaders.value && gl_shadersavailable)
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons); qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons);
else else
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders); qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders);
@ -273,7 +273,7 @@ void HWR_RenderBatches(void)
// set state for first batch // set state for first batch
if (cv_grshaders.value && gr_shadersavailable) if (cv_glshaders.value && gl_shadersavailable)
{ {
HWD.pfnSetShader(currentShader); HWD.pfnSetShader(currentShader);
} }
@ -355,7 +355,7 @@ void HWR_RenderBatches(void)
nextSurfaceInfo = polygonArray[nextIndex].surf; nextSurfaceInfo = polygonArray[nextIndex].surf;
if (nextPolyFlags & PF_NoTexture) if (nextPolyFlags & PF_NoTexture)
nextTexture = 0; nextTexture = 0;
if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable) if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable)
{ {
changeState = true; changeState = true;
changeShader = true; changeShader = true;
@ -370,7 +370,7 @@ void HWR_RenderBatches(void)
changeState = true; changeState = true;
changePolyFlags = true; changePolyFlags = true;
} }
if (cv_grshaders.value && gr_shadersavailable) if (cv_glshaders.value && gl_shadersavailable)
{ {
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba || if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba || currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||

View file

@ -61,17 +61,17 @@ static INT32 totalsubsecpolys = 0;
/// \todo check out how much is used /// \todo check out how much is used
static size_t POLYPOOLSIZE = 1024000; static size_t POLYPOOLSIZE = 1024000;
static UINT8 *gr_polypool = NULL; static UINT8 *gl_polypool = NULL;
static UINT8 *gr_ppcurrent; static UINT8 *gl_ppcurrent;
static size_t gr_ppfree; static size_t gl_ppfree;
#endif #endif
// only between levels, clear poly pool // only between levels, clear poly pool
static void HWR_ClearPolys(void) static void HWR_ClearPolys(void)
{ {
#ifndef ZPLANALLOC #ifndef ZPLANALLOC
gr_ppcurrent = gr_polypool; gl_ppcurrent = gl_polypool;
gr_ppfree = POLYPOOLSIZE; gl_ppfree = POLYPOOLSIZE;
#endif #endif
} }
@ -86,8 +86,8 @@ void HWR_InitPolyPool(void)
POLYPOOLSIZE = atoi(myargv[pnum+1])*1024; // (in kb) POLYPOOLSIZE = atoi(myargv[pnum+1])*1024; // (in kb)
CONS_Debug(DBG_RENDER, "HWR_InitPolyPool(): allocating %d bytes\n", POLYPOOLSIZE); CONS_Debug(DBG_RENDER, "HWR_InitPolyPool(): allocating %d bytes\n", POLYPOOLSIZE);
gr_polypool = malloc(POLYPOOLSIZE); gl_polypool = malloc(POLYPOOLSIZE);
if (!gr_polypool) if (!gl_polypool)
I_Error("HWR_InitPolyPool(): couldn't malloc polypool\n"); I_Error("HWR_InitPolyPool(): couldn't malloc polypool\n");
HWR_ClearPolys(); HWR_ClearPolys();
#endif #endif
@ -96,9 +96,9 @@ void HWR_InitPolyPool(void)
void HWR_FreePolyPool(void) void HWR_FreePolyPool(void)
{ {
#ifndef ZPLANALLOC #ifndef ZPLANALLOC
if (gr_polypool) if (gl_polypool)
free(gr_polypool); free(gl_polypool);
gr_polypool = NULL; gl_polypool = NULL;
#endif #endif
} }
@ -110,19 +110,19 @@ static poly_t *HWR_AllocPoly(INT32 numpts)
p = Z_Malloc(size, PU_HWRPLANE, NULL); p = Z_Malloc(size, PU_HWRPLANE, NULL);
#else #else
#ifdef PARANOIA #ifdef PARANOIA
if (!gr_polypool) if (!gl_polypool)
I_Error("Used gr_polypool without init!\n"); I_Error("Used gl_polypool without init!\n");
if (!gr_ppcurrent) if (!gl_ppcurrent)
I_Error("gr_ppcurrent == NULL!\n"); I_Error("gl_ppcurrent == NULL!\n");
#endif #endif
if (gr_ppfree < size) if (gl_ppfree < size)
I_Error("HWR_AllocPoly(): no more memory %u bytes left, %u bytes needed\n\n%s\n", I_Error("HWR_AllocPoly(): no more memory %u bytes left, %u bytes needed\n\n%s\n",
gr_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)"); gl_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)");
p = (poly_t *)gr_ppcurrent; p = (poly_t *)gl_ppcurrent;
gr_ppcurrent += size; gl_ppcurrent += size;
gr_ppfree -= size; gl_ppfree -= size;
#endif #endif
p->numpts = numpts; p->numpts = numpts;
return p; return p;
@ -135,13 +135,13 @@ static polyvertex_t *HWR_AllocVertex(void)
#ifdef ZPLANALLOC #ifdef ZPLANALLOC
p = Z_Malloc(size, PU_HWRPLANE, NULL); p = Z_Malloc(size, PU_HWRPLANE, NULL);
#else #else
if (gr_ppfree < size) if (gl_ppfree < size)
I_Error("HWR_AllocVertex(): no more memory %u bytes left, %u bytes needed\n\n%s\n", I_Error("HWR_AllocVertex(): no more memory %u bytes left, %u bytes needed\n\n%s\n",
gr_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)"); gl_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)");
p = (polyvertex_t *)gr_ppcurrent; p = (polyvertex_t *)gl_ppcurrent;
gr_ppcurrent += size; gl_ppcurrent += size;
gr_ppfree -= size; gl_ppfree -= size;
#endif #endif
return p; return p;
} }
@ -829,7 +829,7 @@ static INT32 SolveTProblem(void)
INT32 i; INT32 i;
size_t l; size_t l;
if (cv_grsolvetjoin.value == 0) if (cv_glsolvetjoin.value == 0)
return 0; return 0;
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n"); CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
@ -983,9 +983,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors)); I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
// allocate table for back to front drawing of subsectors // allocate table for back to front drawing of subsectors
/*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors); /*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors);
if (!gr_drawsubsectors) if (!gl_drawsubsectors)
I_Error("couldn't malloc gr_drawsubsectors\n");*/ I_Error("couldn't malloc gl_drawsubsectors\n");*/
// number of the first new subsector that might be added // number of the first new subsector that might be added
addsubsector = numsubsectors; addsubsector = numsubsectors;

View file

@ -28,27 +28,18 @@
#include "../r_picformats.h" #include "../r_picformats.h"
#include "../p_setup.h" #include "../p_setup.h"
INT32 patchformat = GR_TEXFMT_AP_88; // use alpha for holes INT32 patchformat = GL_TEXFMT_AP_88; // use alpha for holes
INT32 textureformat = GR_TEXFMT_P_8; // use chromakey for hole INT32 textureformat = GL_TEXFMT_P_8; // use chromakey for hole
static const INT32 format2bpp[16] = static INT32 format2bpp(GLTextureFormat_t format)
{ {
0, //0 if (format == GL_TEXFMT_RGBA)
0, //1 return 4;
1, //2 GR_TEXFMT_ALPHA_8 else if (format == GL_TEXFMT_ALPHA_INTENSITY_88 || format == GL_TEXFMT_AP_88)
1, //3 GR_TEXFMT_INTENSITY_8 return 2;
1, //4 GR_TEXFMT_ALPHA_INTENSITY_44 else
1, //5 GR_TEXFMT_P_8 return 1;
4, //6 GR_RGBA }
0, //7
0, //8
0, //9
2, //10 GR_TEXFMT_RGB_565
2, //11 GR_TEXFMT_ARGB_1555
2, //12 GR_TEXFMT_ARGB_4444
2, //13 GR_TEXFMT_ALPHA_INTENSITY_88
2, //14 GR_TEXFMT_AP_88
};
// This code was originally placed directly in HWR_DrawPatchInCache. // This code was originally placed directly in HWR_DrawPatchInCache.
// It is now split from it for my sanity! (and the sanity of others) // It is now split from it for my sanity! (and the sanity of others)
@ -131,7 +122,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
{ {
case 2 : // uhhhhhhhh.......... case 2 : // uhhhhhhhh..........
if ((originPatch != NULL) && (originPatch->style != AST_COPY)) if ((originPatch != NULL) && (originPatch->style != AST_COPY))
texel = ASTBlendPixel_8bpp(*(dest+1), texel, originPatch->style, originPatch->alpha); texel = ASTBlendPaletteIndexes(*(dest+1), texel, originPatch->style, originPatch->alpha);
texelu16 = (UINT16)((alpha<<8) | texel); texelu16 = (UINT16)((alpha<<8) | texel);
memcpy(dest, &texelu16, sizeof(UINT16)); memcpy(dest, &texelu16, sizeof(UINT16));
break; break;
@ -140,7 +131,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
rgbatexel.rgba = *(UINT32 *)dest; rgbatexel.rgba = *(UINT32 *)dest;
colortemp.rgba = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha); colortemp.rgba = ASTBlendTexturePixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha);
} }
memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8));
break; break;
@ -150,14 +141,14 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
rgbatexel.rgba = *(UINT32 *)dest; rgbatexel.rgba = *(UINT32 *)dest;
colortemp.rgba = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha); colortemp.rgba = ASTBlendTexturePixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha);
} }
memcpy(dest, &colortemp, sizeof(RGBA_t)); memcpy(dest, &colortemp, sizeof(RGBA_t));
break; break;
// default is 1 // default is 1
default: default:
if ((originPatch != NULL) && (originPatch->style != AST_COPY)) if ((originPatch != NULL) && (originPatch->style != AST_COPY))
*dest = ASTBlendPixel_8bpp(*dest, texel, originPatch->style, originPatch->alpha); *dest = ASTBlendPaletteIndexes(*dest, texel, originPatch->style, originPatch->alpha);
else else
*dest = texel; *dest = texel;
break; break;
@ -241,7 +232,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
{ {
case 2 : // uhhhhhhhh.......... case 2 : // uhhhhhhhh..........
if ((originPatch != NULL) && (originPatch->style != AST_COPY)) if ((originPatch != NULL) && (originPatch->style != AST_COPY))
texel = ASTBlendPixel_8bpp(*(dest+1), texel, originPatch->style, originPatch->alpha); texel = ASTBlendPaletteIndexes(*(dest+1), texel, originPatch->style, originPatch->alpha);
texelu16 = (UINT16)((alpha<<8) | texel); texelu16 = (UINT16)((alpha<<8) | texel);
memcpy(dest, &texelu16, sizeof(UINT16)); memcpy(dest, &texelu16, sizeof(UINT16));
break; break;
@ -250,7 +241,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
rgbatexel.rgba = *(UINT32 *)dest; rgbatexel.rgba = *(UINT32 *)dest;
colortemp.rgba = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha); colortemp.rgba = ASTBlendTexturePixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha);
} }
memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8));
break; break;
@ -260,14 +251,14 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
rgbatexel.rgba = *(UINT32 *)dest; rgbatexel.rgba = *(UINT32 *)dest;
colortemp.rgba = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha); colortemp.rgba = ASTBlendTexturePixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha);
} }
memcpy(dest, &colortemp, sizeof(RGBA_t)); memcpy(dest, &colortemp, sizeof(RGBA_t));
break; break;
// default is 1 // default is 1
default: default:
if ((originPatch != NULL) && (originPatch->style != AST_COPY)) if ((originPatch != NULL) && (originPatch->style != AST_COPY))
*dest = ASTBlendPixel_8bpp(*dest, texel, originPatch->style, originPatch->alpha); *dest = ASTBlendPaletteIndexes(*dest, texel, originPatch->style, originPatch->alpha);
else else
*dest = texel; *dest = texel;
break; break;
@ -295,7 +286,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
fixed_t xfrac, xfracstep; fixed_t xfrac, xfracstep;
fixed_t yfracstep, scale_y; fixed_t yfracstep, scale_y;
const column_t *patchcol; const column_t *patchcol;
UINT8 *block = mipmap->grInfo.data; UINT8 *block = mipmap->data;
INT32 bpp; INT32 bpp;
INT32 blockmodulo; INT32 blockmodulo;
@ -310,7 +301,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
yfracstep = FRACUNIT; yfracstep = FRACUNIT;
scale_y = FRACUNIT; scale_y = FRACUNIT;
bpp = format2bpp[mipmap->grInfo.format]; bpp = format2bpp(mipmap->format);
if (bpp < 1 || bpp > 4) if (bpp < 1 || bpp > 4)
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp); I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
@ -342,7 +333,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
fixed_t xfrac, xfracstep; fixed_t xfrac, xfracstep;
fixed_t yfracstep, scale_y; fixed_t yfracstep, scale_y;
const column_t *patchcol; const column_t *patchcol;
UINT8 *block = mipmap->grInfo.data; UINT8 *block = mipmap->data;
INT32 bpp; INT32 bpp;
INT32 blockmodulo; INT32 blockmodulo;
INT32 width, height; INT32 width, height;
@ -403,7 +394,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
yfracstep = (texture->height<< FRACBITS) / pblockheight; yfracstep = (texture->height<< FRACBITS) / pblockheight;
scale_y = (pblockheight << FRACBITS) / texture->height; scale_y = (pblockheight << FRACBITS) / texture->height;
bpp = format2bpp[mipmap->grInfo.format]; bpp = format2bpp(mipmap->format);
if (bpp < 1 || bpp > 4) if (bpp < 1 || bpp > 4)
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp); I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
@ -434,8 +425,8 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX); UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
INT32 blocksize = (grMipmap->width * grMipmap->height); INT32 blocksize = (grMipmap->width * grMipmap->height);
bpp = format2bpp[grMipmap->grInfo.format]; bpp = format2bpp(grMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data)); block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
switch (bpp) switch (bpp)
{ {
@ -456,7 +447,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
// Create a composite texture from patches, adapt the texture size to a power of 2 // Create a composite texture from patches, adapt the texture size to a power of 2
// height and width for the hardware texture cache. // height and width for the hardware texture cache.
// //
static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex) static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
{ {
UINT8 *block; UINT8 *block;
texture_t *texture; texture_t *texture;
@ -486,7 +477,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
grtex->mipmap.width = (UINT16)texture->width; grtex->mipmap.width = (UINT16)texture->width;
grtex->mipmap.height = (UINT16)texture->height; grtex->mipmap.height = (UINT16)texture->height;
grtex->mipmap.grInfo.format = textureformat; grtex->mipmap.format = textureformat;
blockwidth = texture->width; blockwidth = texture->width;
blockheight = texture->height; blockheight = texture->height;
@ -544,7 +535,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
Z_Unlock(realpatch); Z_Unlock(realpatch);
} }
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :( //Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
if (format2bpp[grtex->mipmap.grInfo.format]==4) if (format2bpp(grtex->mipmap.format)==4)
{ {
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
{ {
@ -593,15 +584,15 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
// no wrap around, no chroma key // no wrap around, no chroma key
grMipmap->flags = 0; grMipmap->flags = 0;
// setup the texture info // setup the texture info
grMipmap->grInfo.format = patchformat; grMipmap->format = patchformat;
//grPatch->max_s = grPatch->max_t = 1.0f; //grPatch->max_s = grPatch->max_t = 1.0f;
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width; grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height; grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
} }
Z_Free(grMipmap->grInfo.data); Z_Free(grMipmap->data);
grMipmap->grInfo.data = NULL; grMipmap->data = NULL;
if (makebitmap) if (makebitmap)
{ {
@ -619,14 +610,14 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
// CACHING HANDLING // CACHING HANDLING
// ================================================= // =================================================
static size_t gr_numtextures = 0; // Texture count static size_t gl_numtextures = 0; // Texture count
static GLTexture_t *gr_textures; // For all textures static GLMapTexture_t *gl_textures; // For all textures
static GLTexture_t *gr_flats; // For all (texture) flats, as normal flats don't need to be cached static GLMapTexture_t *gl_flats; // For all (texture) flats, as normal flats don't need to be cached
void HWR_InitTextureCache(void) void HWR_InitTextureCache(void)
{ {
gr_textures = NULL; gl_textures = NULL;
gr_flats = NULL; gl_flats = NULL;
} }
// Callback function for HWR_FreeTextureCache. // Callback function for HWR_FreeTextureCache.
@ -660,9 +651,9 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
pat->mipmap->nextcolormap = next->nextcolormap; pat->mipmap->nextcolormap = next->nextcolormap;
// Free image data from memory. // Free image data from memory.
if (next->grInfo.data) if (next->data)
Z_Free(next->grInfo.data); Z_Free(next->data);
next->grInfo.data = NULL; next->data = NULL;
// Free the old colormap mipmap from memory. // Free the old colormap mipmap from memory.
free(next); free(next);
@ -694,13 +685,13 @@ void HWR_FreeTextureCache(void)
// now the heap don't have any 'user' pointing to our // now the heap don't have any 'user' pointing to our
// texturecache info, we can free it // texturecache info, we can free it
if (gr_textures) if (gl_textures)
free(gr_textures); free(gl_textures);
if (gr_flats) if (gl_flats)
free(gr_flats); free(gl_flats);
gr_textures = NULL; gl_textures = NULL;
gr_flats = NULL; gl_flats = NULL;
gr_numtextures = 0; gl_numtextures = 0;
} }
void HWR_LoadTextures(size_t pnumtextures) void HWR_LoadTextures(size_t pnumtextures)
@ -709,13 +700,13 @@ void HWR_LoadTextures(size_t pnumtextures)
HWR_FreeTextureCache(); HWR_FreeTextureCache();
// Why not Z_Malloc? // Why not Z_Malloc?
gr_numtextures = pnumtextures; gl_numtextures = pnumtextures;
gr_textures = calloc(gr_numtextures, sizeof(*gr_textures)); gl_textures = calloc(gl_numtextures, sizeof(*gl_textures));
gr_flats = calloc(gr_numtextures, sizeof(*gr_flats)); gl_flats = calloc(gl_numtextures, sizeof(*gl_flats));
// Doesn't tell you which it _is_, but hopefully // Doesn't tell you which it _is_, but hopefully
// should never ever happen (right?!) // should never ever happen (right?!)
if ((gr_textures == NULL) || (gr_flats == NULL)) if ((gl_textures == NULL) || (gl_flats == NULL))
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!"); I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
} }
@ -725,7 +716,7 @@ void HWR_SetPalette(RGBA_t *palette)
// hardware driver will flush there own cache if cache is non paletized // hardware driver will flush there own cache if cache is non paletized
// now flush data texture cache so 32 bit texture are recomputed // now flush data texture cache so 32 bit texture are recomputed
if (patchformat == GR_RGBA || textureformat == GR_RGBA) if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
{ {
Z_FreeTag(PU_HWRCACHE); Z_FreeTag(PU_HWRCACHE);
Z_FreeTag(PU_HWRCACHE_UNLOCKED); Z_FreeTag(PU_HWRCACHE_UNLOCKED);
@ -735,20 +726,20 @@ void HWR_SetPalette(RGBA_t *palette)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Make sure texture is downloaded and set it as the source // Make sure texture is downloaded and set it as the source
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
GLTexture_t *HWR_GetTexture(INT32 tex) GLMapTexture_t *HWR_GetTexture(INT32 tex)
{ {
GLTexture_t *grtex; GLMapTexture_t *grtex;
#ifdef PARANOIA #ifdef PARANOIA
if ((unsigned)tex >= gr_numtextures) if ((unsigned)tex >= gl_numtextures)
I_Error("HWR_GetTexture: tex >= numtextures\n"); I_Error("HWR_GetTexture: tex >= numtextures\n");
#endif #endif
// Every texture in memory, stored in the // Every texture in memory, stored in the
// hardware renderer's bit depth format. Wow! // hardware renderer's bit depth format. Wow!
grtex = &gr_textures[tex]; grtex = &gl_textures[tex];
// Generate texture if missing from the cache // Generate texture if missing from the cache
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded) if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
HWR_GenerateTexture(tex, grtex); HWR_GenerateTexture(tex, grtex);
// If hardware does not have the texture, then call pfnSetTexture to upload it // If hardware does not have the texture, then call pfnSetTexture to upload it
@ -758,7 +749,7 @@ GLTexture_t *HWR_GetTexture(INT32 tex)
HWR_SetCurrentTexture(&grtex->mipmap); HWR_SetCurrentTexture(&grtex->mipmap);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grtex->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
return grtex; return grtex;
} }
@ -768,7 +759,7 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
size_t size, pflatsize; size_t size, pflatsize;
// setup the texture info // setup the texture info
grMipmap->grInfo.format = GR_TEXFMT_P_8; grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED; grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
size = W_LumpLength(flatlumpnum); size = W_LumpLength(flatlumpnum);
@ -803,7 +794,7 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
// the flat raw data needn't be converted with palettized textures // the flat raw data needn't be converted with palettized textures
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum), W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
PU_HWRCACHE, &grMipmap->grInfo.data)); PU_HWRCACHE, &grMipmap->data));
} }
static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum) static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
@ -813,14 +804,14 @@ static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
size_t size; size_t size;
// setup the texture info // setup the texture info
grMipmap->grInfo.format = GR_TEXFMT_P_8; grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED; grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
grMipmap->width = (UINT16)textures[texturenum]->width; grMipmap->width = (UINT16)textures[texturenum]->width;
grMipmap->height = (UINT16)textures[texturenum]->height; grMipmap->height = (UINT16)textures[texturenum]->height;
size = (grMipmap->width * grMipmap->height); size = (grMipmap->width * grMipmap->height);
flat = Z_Malloc(size, PU_HWRCACHE, &grMipmap->grInfo.data); flat = Z_Malloc(size, PU_HWRCACHE, &grMipmap->data);
converted = (UINT8 *)Picture_TextureToFlat(texturenum); converted = (UINT8 *)Picture_TextureToFlat(texturenum);
M_Memcpy(flat, converted, size); M_Memcpy(flat, converted, size);
Z_Free(converted); Z_Free(converted);
@ -834,7 +825,7 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
return; return;
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap; grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->data)
HWR_CacheFlat(grmip, flatlumpnum); HWR_CacheFlat(grmip, flatlumpnum);
// If hardware does not have the texture, then call pfnSetTexture to upload it // If hardware does not have the texture, then call pfnSetTexture to upload it
@ -844,7 +835,7 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
HWR_SetCurrentTexture(grmip); HWR_SetCurrentTexture(grmip);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
} }
void HWR_GetLevelFlat(levelflat_t *levelflat) void HWR_GetLevelFlat(levelflat_t *levelflat)
@ -857,10 +848,10 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
HWR_LiterallyGetFlat(levelflat->u.flat.lumpnum); HWR_LiterallyGetFlat(levelflat->u.flat.lumpnum);
else if (levelflat->type == LEVELFLAT_TEXTURE) else if (levelflat->type == LEVELFLAT_TEXTURE)
{ {
GLTexture_t *grtex; GLMapTexture_t *grtex;
INT32 texturenum = levelflat->u.texture.num; INT32 texturenum = levelflat->u.texture.num;
#ifdef PARANOIA #ifdef PARANOIA
if ((unsigned)texturenum >= gr_numtextures) if ((unsigned)texturenum >= gl_numtextures)
I_Error("HWR_GetLevelFlat: texturenum >= numtextures"); I_Error("HWR_GetLevelFlat: texturenum >= numtextures");
#endif #endif
@ -869,10 +860,10 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
return; return;
// Every texture in memory, stored as a 8-bit flat. Wow! // Every texture in memory, stored as a 8-bit flat. Wow!
grtex = &gr_flats[texturenum]; grtex = &gl_flats[texturenum];
// Generate flat if missing from the cache // Generate flat if missing from the cache
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded) if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum); HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum);
// If hardware does not have the texture, then call pfnSetTexture to upload it // If hardware does not have the texture, then call pfnSetTexture to upload it
@ -882,7 +873,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
HWR_SetCurrentTexture(&grtex->mipmap); HWR_SetCurrentTexture(&grtex->mipmap);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grtex->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
} }
else if (levelflat->type == LEVELFLAT_PATCH) else if (levelflat->type == LEVELFLAT_PATCH)
{ {
@ -911,22 +902,17 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
if (mipmap == NULL) if (mipmap == NULL)
{ {
mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_LEVEL, NULL); mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_LEVEL, NULL);
mipmap->grInfo.format = GR_TEXFMT_P_8; mipmap->format = GL_TEXFMT_P_8;
mipmap->flags = TF_WRAPXY|TF_CHROMAKEYED; mipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
#ifdef GLIDE_API_COMPATIBILITY
mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_64;
mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_64;
mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
#endif
levelflat->mipmap = mipmap; levelflat->mipmap = mipmap;
} }
if (!mipmap->grInfo.data && !mipmap->downloaded) if (!mipmap->data && !mipmap->downloaded)
{ {
mipmap->width = levelflat->width; mipmap->width = levelflat->width;
mipmap->height = levelflat->height; mipmap->height = levelflat->height;
size = (mipmap->width * mipmap->height); size = (mipmap->width * mipmap->height);
flat = Z_Malloc(size, PU_LEVEL, &mipmap->grInfo.data); flat = Z_Malloc(size, PU_LEVEL, &mipmap->data);
if (levelflat->picture == NULL) if (levelflat->picture == NULL)
I_Error("HWR_GetLevelFlat: levelflat->picture == NULL"); I_Error("HWR_GetLevelFlat: levelflat->picture == NULL");
M_Memcpy(flat, levelflat->picture, size); M_Memcpy(flat, levelflat->picture, size);
@ -946,7 +932,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
// //
static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch) static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
{ {
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->data)
{ {
patch_t *patch = gpatch->rawpatch; patch_t *patch = gpatch->rawpatch;
if (!patch) if (!patch)
@ -966,7 +952,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
HWR_SetCurrentTexture(grmip); HWR_SetCurrentTexture(grmip);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
} }
// -----------------+ // -----------------+
@ -975,7 +961,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
void HWR_GetPatch(GLPatch_t *gpatch) void HWR_GetPatch(GLPatch_t *gpatch)
{ {
// is it in hardware cache // is it in hardware cache
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->grInfo.data) if (!gpatch->mipmap->downloaded && !gpatch->mipmap->data)
{ {
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will // load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
// flush the software patch before the conversion! oh yeah I suffered // flush the software patch before the conversion! oh yeah I suffered
@ -997,7 +983,7 @@ void HWR_GetPatch(GLPatch_t *gpatch)
HWR_SetCurrentTexture(gpatch->mipmap); HWR_SetCurrentTexture(gpatch->mipmap);
// The system-memory patch data can be purged now. // The system-memory patch data can be purged now.
Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
} }
@ -1047,17 +1033,17 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
if (!gpatch) if (!gpatch)
return; return;
Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED); Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED);
} }
static const INT32 picmode2GR[] = static const INT32 picmode2GR[] =
{ {
GR_TEXFMT_P_8, // PALETTE GL_TEXFMT_P_8, // PALETTE
0, // INTENSITY (unsupported yet) 0, // INTENSITY (unsupported yet)
GR_TEXFMT_ALPHA_INTENSITY_88, // INTENSITY_ALPHA (corona use this) GL_TEXFMT_ALPHA_INTENSITY_88, // INTENSITY_ALPHA (corona use this)
0, // RGB24 (unsupported yet) 0, // RGB24 (unsupported yet)
GR_RGBA, // RGBA32 (opengl only) GL_TEXFMT_RGBA, // RGBA32 (opengl only)
}; };
static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheight, static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheight,
@ -1072,7 +1058,7 @@ static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheig
stepy = ((INT32)SHORT(pic->height)<<FRACBITS)/pblockheight; stepy = ((INT32)SHORT(pic->height)<<FRACBITS)/pblockheight;
stepx = ((INT32)SHORT(pic->width)<<FRACBITS)/pblockwidth; stepx = ((INT32)SHORT(pic->width)<<FRACBITS)/pblockwidth;
picbpp = format2bpp[picmode2GR[pic->mode]]; picbpp = format2bpp(picmode2GR[pic->mode]);
posy = 0; posy = 0;
for (j = 0; j < pblockheight; j++) for (j = 0; j < pblockheight; j++)
{ {
@ -1132,7 +1118,7 @@ static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheig
GLPatch_t *HWR_GetPic(lumpnum_t lumpnum) GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
{ {
GLPatch_t *grpatch = HWR_GetCachedGLPatch(lumpnum); GLPatch_t *grpatch = HWR_GetCachedGLPatch(lumpnum);
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{ {
pic_t *pic; pic_t *pic;
UINT8 *block; UINT8 *block;
@ -1150,27 +1136,27 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
grpatch->mipmap->height = (UINT16)grpatch->height; grpatch->mipmap->height = (UINT16)grpatch->height;
if (pic->mode == PALETTE) if (pic->mode == PALETTE)
grpatch->mipmap->grInfo.format = textureformat; // can be set by driver grpatch->mipmap->format = textureformat; // can be set by driver
else else
grpatch->mipmap->grInfo.format = picmode2GR[pic->mode]; grpatch->mipmap->format = picmode2GR[pic->mode];
Z_Free(grpatch->mipmap->grInfo.data); Z_Free(grpatch->mipmap->data);
// allocate block // allocate block
block = MakeBlock(grpatch->mipmap); block = MakeBlock(grpatch->mipmap);
if (grpatch->width == SHORT(pic->width) && if (grpatch->width == SHORT(pic->width) &&
grpatch->height == SHORT(pic->height) && grpatch->height == SHORT(pic->height) &&
format2bpp[grpatch->mipmap->grInfo.format] == format2bpp[picmode2GR[pic->mode]]) format2bpp(grpatch->mipmap->format) == format2bpp(picmode2GR[pic->mode]))
{ {
// no conversion needed // no conversion needed
M_Memcpy(grpatch->mipmap->grInfo.data, pic->data,len); M_Memcpy(grpatch->mipmap->data, pic->data,len);
} }
else else
HWR_DrawPicInCache(block, SHORT(pic->width), SHORT(pic->height), HWR_DrawPicInCache(block, SHORT(pic->width), SHORT(pic->height),
SHORT(pic->width)*format2bpp[grpatch->mipmap->grInfo.format], SHORT(pic->width)*format2bpp(grpatch->mipmap->format),
pic, pic,
format2bpp[grpatch->mipmap->grInfo.format]); format2bpp(grpatch->mipmap->format));
Z_Unlock(pic); Z_Unlock(pic);
Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED);
@ -1179,7 +1165,7 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
grpatch->max_s = grpatch->max_t = 1.0f; grpatch->max_s = grpatch->max_t = 1.0f;
} }
HWD.pfnSetTexture(grpatch->mipmap); HWD.pfnSetTexture(grpatch->mipmap);
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.grInfo.data, grpatch->mipmap.downloaded); //CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.data, grpatch->mipmap.downloaded);
return grpatch; return grpatch;
} }
@ -1212,7 +1198,7 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
{ {
INT32 i,j; INT32 i,j;
fixed_t posx, posy, stepx, stepy; fixed_t posx, posy, stepx, stepy;
UINT8 *block = mipmap->grInfo.data; // places the data directly into here UINT8 *block = mipmap->data; // places the data directly into here
UINT8 *flat; UINT8 *flat;
UINT8 *dest, *src, texel; UINT8 *dest, *src, texel;
RGBA_t col; RGBA_t col;
@ -1251,7 +1237,7 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
UINT16 fmheight = 0, fmwidth = 0; UINT16 fmheight = 0, fmwidth = 0;
// setup the texture info // setup the texture info
grMipmap->grInfo.format = GR_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later grMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
grMipmap->flags = 0; grMipmap->flags = 0;
size = W_LumpLength(fademasklumpnum); size = W_LumpLength(fademasklumpnum);
@ -1295,13 +1281,13 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
void HWR_GetFadeMask(lumpnum_t fademasklumpnum) void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
{ {
GLMipmap_t *grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap; GLMipmap_t *grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->data)
HWR_CacheFadeMask(grmip, fademasklumpnum); HWR_CacheFadeMask(grmip, fademasklumpnum);
HWD.pfnSetTexture(grmip); HWD.pfnSetTexture(grmip);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
} }
#endif //HWRENDER #endif //HWRENDER

View file

@ -20,8 +20,6 @@
#endif #endif
#include "../doomdef.h" #include "../doomdef.h"
//THIS MUST DISAPPEAR!!!
#include "hw_glide.h"
#include "../screen.h" #include "../screen.h"
@ -29,12 +27,27 @@
// TEXTURE INFO // TEXTURE INFO
// ========================================================================== // ==========================================================================
// grInfo.data holds the address of the graphics data cached in heap memory typedef enum GLTextureFormat_e
{
GL_TEXFMT_P_8 = 0x01, /* 8-bit palette */
GL_TEXFMT_AP_88 = 0x02, /* 8-bit alpha, 8-bit palette */
GL_TEXFMT_RGBA = 0x10, /* 32 bit RGBA! */
GL_TEXFMT_ALPHA_8 = 0x20, /* (0..0xFF) alpha */
GL_TEXFMT_INTENSITY_8 = 0x21, /* (0..0xFF) intensity */
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
} GLTextureFormat_t;
// data holds the address of the graphics data cached in heap memory
// NULL if the texture is not in Doom heap cache. // NULL if the texture is not in Doom heap cache.
struct GLMipmap_s struct GLMipmap_s
{ {
GrTexInfo grInfo; //for TexDownloadMipMap //for TexDownloadMipMap
FxU32 flags; GLTextureFormat_t format;
void *data;
UINT32 flags;
UINT16 height; UINT16 height;
UINT16 width; UINT16 width;
UINT32 downloaded; // the dll driver have it in there cache ? UINT32 downloaded; // the dll driver have it in there cache ?
@ -51,13 +64,13 @@ typedef struct GLMipmap_s GLMipmap_t;
// //
// Doom texture info, as cached for hardware rendering // Doom texture info, as cached for hardware rendering
// //
struct GLTexture_s struct GLMapTexture_s
{ {
GLMipmap_t mipmap; GLMipmap_t mipmap;
float scaleX; //used for scaling textures on walls float scaleX; //used for scaling textures on walls
float scaleY; float scaleY;
}; };
typedef struct GLTexture_s GLTexture_t; typedef struct GLMapTexture_s GLMapTexture_t;
// a cached patch as converted to hardware format, holding the original patch_t // a cached patch as converted to hardware format, holding the original patch_t

View file

@ -936,17 +936,17 @@ void HWR_DrawViewBorder(INT32 clearlines)
INT32 basewindowx, basewindowy; INT32 basewindowx, basewindowy;
GLPatch_t *patch; GLPatch_t *patch;
// if (gr_viewwidth == vid.width) // if (gl_viewwidth == vid.width)
// return; // return;
if (!clearlines) if (!clearlines)
clearlines = BASEVIDHEIGHT; // refresh all clearlines = BASEVIDHEIGHT; // refresh all
// calc view size based on original game resolution // calc view size based on original game resolution
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7; baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy)); baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy)); top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwindowx), vid.fdupx)); side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwindowx), vid.fdupx));
// top // top
HWR_DrawFlatFill(0, 0, HWR_DrawFlatFill(0, 0,

View file

@ -1,41 +0,0 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_glide.h
/// \brief Declaration needed by Glide renderer
/// !!! To be replaced by our own def in the future !!!
#ifndef _GLIDE_H_
#define _GLIDE_H_
#ifndef __GLIDE_H__
typedef unsigned long FxU32;
typedef long FxI32;
typedef FxI32 GrTextureFormat_t;
#define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */
#define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */
#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
#define GR_TEXFMT_P_8 0x5 /* 8-bit palette */
#define GR_TEXFMT_RGB_565 0xa
#define GR_TEXFMT_ARGB_1555 0xb
#define GR_TEXFMT_ARGB_4444 0xc
#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
#define GR_TEXFMT_AP_88 0xe /* 8-bit alpha 8-bit palette */
#define GR_RGBA 0x6 // 32 bit RGBA !
typedef struct
{
GrTextureFormat_t format;
void *data;
} GrTexInfo;
#endif // __GLIDE_H__ (defined in <glide.h>)
#endif // _GLIDE_H_

View file

@ -59,22 +59,23 @@ typedef struct
// needed for sprite rendering // needed for sprite rendering
// equivalent of the software renderer's vissprites // equivalent of the software renderer's vissprites
typedef struct gr_vissprite_s typedef struct gl_vissprite_s
{ {
float x1, x2; float x1, x2;
float tz, ty; float tz, ty;
float tracertz; // for MF2_LINKDRAW sprites, this contains tracer's tz for use in sorting
//lumpnum_t patchlumpnum; //lumpnum_t patchlumpnum;
GLPatch_t *gpatch; GLPatch_t *gpatch;
boolean flip; boolean flip;
UINT8 translucency; //alpha level 0-255 UINT8 translucency; //alpha level 0-255
mobj_t *mobj; mobj_t *mobj; // NOTE: This is a precipmobj_t if precip is true !!! Watch out.
boolean precip; // Tails 08-25-2002 boolean precip; // Tails 08-25-2002
boolean vflip; boolean vflip;
//Hurdler: 25/04/2000: now support colormap in hardware mode //Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap; UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
float z1, z2; float z1, z2;
} gr_vissprite_t; } gl_vissprite_t;
// -------- // --------
// hw_bsp.c // hw_bsp.c
@ -95,7 +96,7 @@ void HWR_FreeExtraSubsectors(void);
void HWR_GetLevelFlat(levelflat_t *levelflat); void HWR_GetLevelFlat(levelflat_t *levelflat);
void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum); void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum);
GLTexture_t *HWR_GetTexture(INT32 tex); GLMapTexture_t *HWR_GetTexture(INT32 tex);
void HWR_GetPatch(GLPatch_t *gpatch); void HWR_GetPatch(GLPatch_t *gpatch);
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap); void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
void HWR_UnlockCachedPatch(GLPatch_t *gpatch); void HWR_UnlockCachedPatch(GLPatch_t *gpatch);

View file

@ -821,7 +821,7 @@ void HWR_WallLighting(FOutVector *wlVerts)
{ {
int i, j; int i, j;
// dynlights->nb == 0 if cv_grdynamiclighting.value is not set // dynlights->nb == 0 if cv_gldynamiclighting.value is not set
for (j = 0; j < dynlights->nb; j++) for (j = 0; j < dynlights->nb; j++)
{ {
FVector inter; FVector inter;
@ -970,7 +970,7 @@ static lumpnum_t coronalumpnum = LUMPERROR;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// coronas lighting // coronas lighting
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr) void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr)
{ {
light_t *p_lspr; light_t *p_lspr;
@ -985,7 +985,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
p_lspr = &lspr[ROCKETEXP_L]; p_lspr = &lspr[ROCKETEXP_L];
} }
if (cv_grcoronas.value && (p_lspr->type & CORONA_SPR)) if (cv_glcoronas.value && (p_lspr->type & CORONA_SPR))
{ // it's an object which emits light { // it's an object which emits light
FOutVector light[4]; FOutVector light[4];
FSurfaceInfo Surf; FSurfaceInfo Surf;
@ -1010,7 +1010,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
} }
if (size > p_lspr->corona_radius) if (size > p_lspr->corona_radius)
size = p_lspr->corona_radius; size = p_lspr->corona_radius;
size *= FIXED_TO_FLOAT(cv_grcoronasize.value<<1); size *= FIXED_TO_FLOAT(cv_glcoronasize.value<<1);
// compute position doing average // compute position doing average
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -1067,7 +1067,7 @@ void HWR_DrawCoronas(void)
{ {
int j; int j;
if (!cv_grcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR) if (!cv_glcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR)
return; return;
HWR_GetPic(coronalumpnum); /// \todo use different coronas HWR_GetPic(coronalumpnum); /// \todo use different coronas
@ -1121,7 +1121,7 @@ void HWR_DrawCoronas(void)
} }
if (size > p_lspr->corona_radius) if (size > p_lspr->corona_radius)
size = p_lspr->corona_radius; size = p_lspr->corona_radius;
size = (float)(FIXED_TO_FLOAT(cv_grcoronasize.value<<1)*size); size = (float)(FIXED_TO_FLOAT(cv_glcoronasize.value<<1)*size);
// put light little forward the sprite so there is no // put light little forward the sprite so there is no
// z-buffer problem (coplanar polygons) // z-buffer problem (coplanar polygons)
@ -1170,13 +1170,13 @@ void HWR_SetLights(int viewnumber)
// Add a light for dynamic lighting // Add a light for dynamic lighting
// The light position is already transformed execpt for mlook // The light position is already transformed execpt for mlook
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch) void HWR_DL_AddLight(gl_vissprite_t *spr, GLPatch_t *patch)
{ {
light_t *p_lspr; light_t *p_lspr;
//Hurdler: moved here because it's better;-) //Hurdler: moved here because it's better;-)
(void)patch; (void)patch;
if (!cv_grdynamiclighting.value) if (!cv_gldynamiclighting.value)
return; return;
if (!spr->mobj) if (!spr->mobj)
@ -1193,7 +1193,7 @@ void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch)
p_lspr = t_lspr[spr->mobj->sprite]; p_lspr = t_lspr[spr->mobj->sprite];
if (!(p_lspr->type & DYNLIGHT_SPR)) if (!(p_lspr->type & DYNLIGHT_SPR))
return; return;
if ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value) if ((p_lspr->type != LIGHT_SPR) || cv_glstaticlighting.value)
return; return;
LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x); LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x);
@ -1229,10 +1229,10 @@ static void HWR_SetLight(void)
{ {
int i, j; int i, j;
if (!lightmappatch.mipmap->downloaded && !lightmappatch.mipmap->grInfo.data) if (!lightmappatch.mipmap->downloaded && !lightmappatch.mipmap->data)
{ {
UINT16 *Data = Z_Malloc(129*128*sizeof (UINT16), PU_HWRCACHE, &lightmappatch.mipmap->grInfo.data); UINT16 *Data = Z_Malloc(129*128*sizeof (UINT16), PU_HWRCACHE, &lightmappatch.mipmap->data);
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
{ {
@ -1245,7 +1245,7 @@ static void HWR_SetLight(void)
Data[i*128+j] = 0; Data[i*128+j] = 0;
} }
} }
lightmappatch.mipmap->grInfo.format = GR_TEXFMT_ALPHA_INTENSITY_88; lightmappatch.mipmap->format = GL_TEXFMT_ALPHA_INTENSITY_88;
lightmappatch.width = 128; lightmappatch.width = 128;
lightmappatch.height = 128; lightmappatch.height = 128;
@ -1256,7 +1256,7 @@ static void HWR_SetLight(void)
HWD.pfnSetTexture(lightmappatch.mipmap); HWD.pfnSetTexture(lightmappatch.mipmap);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(lightmappatch.mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(lightmappatch.mipmap->data, PU_HWRCACHE_UNLOCKED);
} }
//********************************************************** //**********************************************************
@ -1265,8 +1265,8 @@ static void HWR_SetLight(void)
#ifdef STATICLIGHT #ifdef STATICLIGHT
// is this really necessary? // is this really necessary?
static sector_t *lgr_backsector; static sector_t *lgl_backsector;
static seg_t *lgr_curline; static seg_t *lgl_curline;
#endif #endif
// p1 et p2 c'est le deux bou du seg en float // p1 et p2 c'est le deux bou du seg en float
@ -1304,27 +1304,27 @@ static void HWR_AddLightMapForLine(int lightnum, seg_t *line)
*/ */
FVector p1,p2; FVector p1,p2;
lgr_curline = line; lgl_curline = line;
lgr_backsector = line->backsector; lgl_backsector = line->backsector;
// Reject empty lines used for triggers and special events. // Reject empty lines used for triggers and special events.
// Identical floor and ceiling on both sides, // Identical floor and ceiling on both sides,
// identical light levels on both sides, // identical light levels on both sides,
// and no middle texture. // and no middle texture.
/* /*
if ( lgr_backsector->ceilingpic == gr_frontsector->ceilingpic if ( lgl_backsector->ceilingpic == gl_frontsector->ceilingpic
&& lgr_backsector->floorpic == gr_frontsector->floorpic && lgl_backsector->floorpic == gl_frontsector->floorpic
&& lgr_backsector->lightlevel == gr_frontsector->lightlevel && lgl_backsector->lightlevel == gl_frontsector->lightlevel
&& lgr_curline->sidedef->midtexture == 0) && lgl_curline->sidedef->midtexture == 0)
{ {
return; return;
} }
*/ */
p1.y = FIXED_TO_FLOAT(lgr_curline->v1->y); p1.y = FIXED_TO_FLOAT(lgl_curline->v1->y);
p1.x = FIXED_TO_FLOAT(lgr_curline->v1->x); p1.x = FIXED_TO_FLOAT(lgl_curline->v1->x);
p2.y = FIXED_TO_FLOAT(lgr_curline->v2->y); p2.y = FIXED_TO_FLOAT(lgl_curline->v2->y);
p2.x = FIXED_TO_FLOAT(lgr_curline->v2->x); p2.x = FIXED_TO_FLOAT(lgl_curline->v2->x);
// check bbox of the seg // check bbox of the seg
// if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false) // if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false)

View file

@ -24,7 +24,7 @@
#define DL_MAX_LIGHT 256 // maximum number of lights (extra lights are ignored) #define DL_MAX_LIGHT 256 // maximum number of lights (extra lights are ignored)
void HWR_InitLight(void); void HWR_InitLight(void);
void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch); void HWR_DL_AddLight(gl_vissprite_t *spr, GLPatch_t *patch);
void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts); void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts);
void HWR_WallLighting(FOutVector *wlVerts); void HWR_WallLighting(FOutVector *wlVerts);
void HWR_ResetLights(void); void HWR_ResetLights(void);
@ -33,7 +33,7 @@ void HWR_SetLights(int viewnumber);
#ifdef NEWCORONAS #ifdef NEWCORONAS
void HWR_DrawCoronas(void); void HWR_DrawCoronas(void);
#else #else
void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr); void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr);
#endif #endif
typedef struct typedef struct

File diff suppressed because it is too large Load diff

View file

@ -52,7 +52,6 @@ boolean HWR_Screenshot(const char *pathname);
void HWR_AddCommands(void); void HWR_AddCommands(void);
void HWR_AddSessionCommands(void); void HWR_AddSessionCommands(void);
void HWR_CorrectSWTricks(void);
void transform(float *cx, float *cy, float *cz); void transform(float *cx, float *cy, float *cz);
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf); FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
INT32 HWR_GetTextureUsed(void); INT32 HWR_GetTextureUsed(void);
@ -75,32 +74,31 @@ boolean HWR_LoadShaders(void);
extern CV_PossibleValue_t granisotropicmode_cons_t[]; extern CV_PossibleValue_t granisotropicmode_cons_t[];
#ifdef ALAM_LIGHTING #ifdef ALAM_LIGHTING
extern consvar_t cv_grdynamiclighting; extern consvar_t cv_gldynamiclighting;
extern consvar_t cv_grstaticlighting; extern consvar_t cv_glstaticlighting;
extern consvar_t cv_grcoronas; extern consvar_t cv_glcoronas;
extern consvar_t cv_grcoronasize; extern consvar_t cv_glcoronasize;
#endif #endif
extern consvar_t cv_grshaders; extern consvar_t cv_glshaders;
extern consvar_t cv_grmodels; extern consvar_t cv_glmodels;
extern consvar_t cv_grmodelinterpolation; extern consvar_t cv_glmodelinterpolation;
extern consvar_t cv_grmodellighting; extern consvar_t cv_glmodellighting;
extern consvar_t cv_grfiltermode; extern consvar_t cv_glfiltermode;
extern consvar_t cv_granisotropicmode; extern consvar_t cv_glanisotropicmode;
extern consvar_t cv_grcorrecttricks;
extern consvar_t cv_fovchange; extern consvar_t cv_fovchange;
extern consvar_t cv_grsolvetjoin; extern consvar_t cv_glsolvetjoin;
extern consvar_t cv_grshearing; extern consvar_t cv_glshearing;
extern consvar_t cv_grspritebillboarding; extern consvar_t cv_glspritebillboarding;
extern consvar_t cv_grskydome; extern consvar_t cv_glskydome;
extern consvar_t cv_grfakecontrast; extern consvar_t cv_glfakecontrast;
extern consvar_t cv_grslopecontrast; extern consvar_t cv_glslopecontrast;
extern consvar_t cv_grbatching; extern consvar_t cv_glbatching;
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy; extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowy;
extern float gr_viewwindowx, gr_basewindowcentery; extern float gl_viewwindowx, gl_basewindowcentery;
// BP: big hack for a test in lighting ref : 1249753487AB // BP: big hack for a test in lighting ref : 1249753487AB
extern fixed_t *hwbbox; extern fixed_t *hwbbox;
@ -124,6 +122,6 @@ extern int rs_hw_numcolors;
extern int rs_hw_batchsorttime; extern int rs_hw_batchsorttime;
extern int rs_hw_batchdrawtime; extern int rs_hw_batchdrawtime;
extern boolean gr_shadersavailable; extern boolean gl_shadersavailable;
#endif #endif

View file

@ -141,7 +141,7 @@ static void PNG_warn(png_structp PNG, png_const_charp pngtext)
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext); CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
} }
static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch) static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch)
{ {
png_structp png_ptr; png_structp png_ptr;
png_infop png_info_ptr; png_infop png_info_ptr;
@ -191,7 +191,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename); //CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL); png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
fclose(png_FILE); fclose(png_FILE);
Z_Free(grpatch->mipmap->grInfo.data); Z_Free(grpatch->mipmap->data);
return 0; return 0;
} }
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
@ -232,7 +232,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
{ {
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr); png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRMODELTEXTURE, &grpatch->mipmap->grInfo.data); png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRMODELTEXTURE, &grpatch->mipmap->data);
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep)); png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
row_pointers[i] = PNG_image + i*pitch; row_pointers[i] = PNG_image + i*pitch;
@ -245,7 +245,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
fclose(png_FILE); fclose(png_FILE);
*w = (int)width; *w = (int)width;
*h = (int)height; *h = (int)height;
return GR_RGBA; return GL_TEXFMT_RGBA;
} }
#endif #endif
@ -271,7 +271,7 @@ typedef struct
UINT8 filler[54]; UINT8 filler[54];
} PcxHeader; } PcxHeader;
static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h, static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
GLPatch_t *grpatch) GLPatch_t *grpatch)
{ {
PcxHeader header; PcxHeader header;
@ -306,7 +306,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
pw = *w = header.xmax - header.xmin + 1; pw = *w = header.xmax - header.xmin + 1;
ph = *h = header.ymax - header.ymin + 1; ph = *h = header.ymax - header.ymin + 1;
image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &grpatch->mipmap->grInfo.data); image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &grpatch->mipmap->data);
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE) if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
{ {
@ -340,7 +340,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
} }
} }
fclose(file); fclose(file);
return GR_RGBA; return GL_TEXFMT_RGBA;
} }
// -----------------+ // -----------------+
@ -354,7 +354,7 @@ static void md2_loadTexture(md2_t *model)
if (model->grpatch) if (model->grpatch)
{ {
grpatch = model->grpatch; grpatch = model->grpatch;
Z_Free(grpatch->mipmap->grInfo.data); Z_Free(grpatch->mipmap->data);
} }
else else
{ {
@ -363,18 +363,18 @@ static void md2_loadTexture(md2_t *model)
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL); grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
} }
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{ {
int w = 0, h = 0; int w = 0, h = 0;
UINT32 size; UINT32 size;
RGBA_t *image; RGBA_t *image;
#ifdef HAVE_PNG #ifdef HAVE_PNG
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch); grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0) if (grpatch->mipmap->format == 0)
#endif #endif
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch); grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0) if (grpatch->mipmap->format == 0)
{ {
model->notexturefile = true; // mark it so its not searched for again repeatedly model->notexturefile = true; // mark it so its not searched for again repeatedly
return; return;
@ -389,7 +389,7 @@ static void md2_loadTexture(md2_t *model)
grpatch->mipmap->height = (UINT16)h; grpatch->mipmap->height = (UINT16)h;
// Lactozilla: Apply colour cube // Lactozilla: Apply colour cube
image = grpatch->mipmap->grInfo.data; image = grpatch->mipmap->data;
size = w*h; size = w*h;
while (size--) while (size--)
{ {
@ -414,7 +414,7 @@ static void md2_loadBlendTexture(md2_t *model)
if (model->blendgrpatch) if (model->blendgrpatch)
{ {
grpatch = model->blendgrpatch; grpatch = model->blendgrpatch;
Z_Free(grpatch->mipmap->grInfo.data); Z_Free(grpatch->mipmap->data);
} }
else else
{ {
@ -423,15 +423,15 @@ static void md2_loadBlendTexture(md2_t *model)
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL); grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
} }
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{ {
int w = 0, h = 0; int w = 0, h = 0;
#ifdef HAVE_PNG #ifdef HAVE_PNG
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch); grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0) if (grpatch->mipmap->format == 0)
#endif #endif
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch); grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0) if (grpatch->mipmap->format == 0)
{ {
model->noblendfile = true; // mark it so its not searched for again repeatedly model->noblendfile = true; // mark it so its not searched for again repeatedly
Z_Free(filename); Z_Free(filename);
@ -686,20 +686,20 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
// no wrap around, no chroma key // no wrap around, no chroma key
grmip->flags = 0; grmip->flags = 0;
// setup the texture info // setup the texture info
grmip->grInfo.format = GR_RGBA; grmip->format = GL_TEXFMT_RGBA;
} }
if (grmip->grInfo.data) if (grmip->data)
{ {
Z_Free(grmip->grInfo.data); Z_Free(grmip->data);
grmip->grInfo.data = NULL; grmip->data = NULL;
} }
cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &grmip->grInfo.data); cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &grmip->data);
memset(cur, 0x00, size*4); memset(cur, 0x00, size*4);
image = gpatch->mipmap->grInfo.data; image = gpatch->mipmap->data;
blendimage = blendgpatch->mipmap->grInfo.data; blendimage = blendgpatch->mipmap->data;
// TC_METALSONIC includes an actual skincolor translation, on top of its flashing. // TC_METALSONIC includes an actual skincolor translation, on top of its flashing.
if (skinnum == TC_METALSONIC) if (skinnum == TC_METALSONIC)
@ -1050,7 +1050,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
return; return;
} }
if ((blendgpatch && blendgpatch->mipmap->grInfo.format) if ((blendgpatch && blendgpatch->mipmap->format)
&& (gpatch->width != blendgpatch->width || gpatch->height != blendgpatch->height)) && (gpatch->width != blendgpatch->width || gpatch->height != blendgpatch->height))
{ {
// Blend image exists, but it's bad. // Blend image exists, but it's bad.
@ -1065,10 +1065,10 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
grmip = grmip->nextcolormap; grmip = grmip->nextcolormap;
if (grmip->colormap == colormap) if (grmip->colormap == colormap)
{ {
if (grmip->downloaded && grmip->grInfo.data) if (grmip->downloaded && grmip->data)
{ {
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
Z_ChangeTag(grmip->grInfo.data, PU_HWRMODELTEXTURE_UNLOCKED); Z_ChangeTag(grmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
return; return;
} }
} }
@ -1090,7 +1090,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color); HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
HWD.pfnSetTexture(newmip); HWD.pfnSetTexture(newmip);
Z_ChangeTag(newmip->grInfo.data, PU_HWRMODELTEXTURE_UNLOCKED); Z_ChangeTag(newmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
} }
#define NORMALFOG 0x00000000 #define NORMALFOG 0x00000000
@ -1108,14 +1108,14 @@ static boolean HWR_AllowModel(mobj_t *mobj)
static boolean HWR_CanInterpolateModel(mobj_t *mobj, model_t *model) static boolean HWR_CanInterpolateModel(mobj_t *mobj, model_t *model)
{ {
if (cv_grmodelinterpolation.value == 2) // Always interpolate if (cv_glmodelinterpolation.value == 2) // Always interpolate
return true; return true;
return model->interpolate[(mobj->frame & FF_FRAMEMASK)]; return model->interpolate[(mobj->frame & FF_FRAMEMASK)];
} }
static boolean HWR_CanInterpolateSprite2(modelspr2frames_t *spr2frame) static boolean HWR_CanInterpolateSprite2(modelspr2frames_t *spr2frame)
{ {
if (cv_grmodelinterpolation.value == 2) // Always interpolate if (cv_glmodelinterpolation.value == 2) // Always interpolate
return true; return true;
return spr2frame->interpolate; return spr2frame->interpolate;
} }
@ -1177,11 +1177,39 @@ static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t
return spr2; return spr2;
} }
static void adjustTextureCoords(model_t *model, GLPatch_t *gpatch)
{
int i;
for (i = 0; i < model->numMeshes; i++)
{
int j;
mesh_t *mesh = &model->meshes[i];
int numVertices;
float *uvPtr = mesh->uvs;
// i dont know if this is actually possible, just logical conclusion of structure in CreateModelVBOs
if (!mesh->frames && !mesh->tinyframes) return;
if (mesh->frames) // again CreateModelVBO and CreateModelVBOTiny iterate like this so I'm gonna do that too
numVertices = mesh->numTriangles * 3;
else
numVertices = mesh->numVertices;
// fix uvs (texture coordinates) to take into account that the actual texture
// has empty space added until the next power of two
for (j = 0; j < numVertices; j++)
{
*uvPtr++ *= gpatch->max_s;
*uvPtr++ *= gpatch->max_t;
}
}
}
// //
// HWR_DrawModel // HWR_DrawModel
// //
boolean HWR_DrawModel(gr_vissprite_t *spr) boolean HWR_DrawModel(gl_vissprite_t *spr)
{ {
md2_t *md2; md2_t *md2;
@ -1192,7 +1220,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
FTransform p; FTransform p;
FSurfaceInfo Surf; FSurfaceInfo Surf;
if (!cv_grmodels.value) if (!cv_glmodels.value)
return false; return false;
if (spr->precip) if (spr->precip)
@ -1278,6 +1306,19 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
sprinfo = &spriteinfo[spr->mobj->sprite]; sprinfo = &spriteinfo[spr->mobj->sprite];
} }
// texture loading before model init, so it knows if sprite graphics are used, which
// means that texture coordinates have to be adjusted
gpatch = md2->grpatch;
if (!gpatch || ((!gpatch->mipmap->format || !gpatch->mipmap->downloaded) && !md2->notexturefile))
md2_loadTexture(md2);
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap->format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendgrpatch
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
&& !md2->noblendfile)))
md2_loadBlendTexture(md2);
if (md2->error) if (md2->error)
return false; // we already failed loading this before :( return false; // we already failed loading this before :(
if (!md2->model) if (!md2->model)
@ -1289,6 +1330,10 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
if (md2->model) if (md2->model)
{ {
md2_printModelInfo(md2->model); md2_printModelInfo(md2->model);
// if model uses sprite patch as texture, then
// adjust texture coordinates to take power of two textures into account
if (!gpatch || !gpatch->mipmap->format)
adjustTextureCoords(md2->model, spr->gpatch);
HWD.pfnCreateModelVBOs(md2->model); HWD.pfnCreateModelVBOs(md2->model);
} }
else else
@ -1306,18 +1351,8 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
//HWD.pfnSetBlend(blend); // This seems to actually break translucency? //HWD.pfnSetBlend(blend); // This seems to actually break translucency?
finalscale = md2->scale; finalscale = md2->scale;
//Hurdler: arf, I don't like that implementation at all... too much crappy //Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->grpatch;
if (!gpatch || ((!gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded) && !md2->notexturefile))
md2_loadTexture(md2);
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap->grInfo.format) // don't load the blend texture if the base texture isn't available if (gpatch && gpatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
&& (!md2->blendgrpatch
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
&& !md2->noblendfile)))
md2_loadBlendTexture(md2);
if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
{ {
INT32 skinnum = TC_DEFAULT; INT32 skinnum = TC_DEFAULT;
@ -1388,7 +1423,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
#ifdef USE_MODEL_NEXTFRAME #ifdef USE_MODEL_NEXTFRAME
#define INTERPOLERATION_LIMIT TICRATE/4 #define INTERPOLERATION_LIMIT TICRATE/4
if (cv_grmodelinterpolation.value && tics <= durs && tics <= INTERPOLERATION_LIMIT) if (cv_glmodelinterpolation.value && tics <= durs && tics <= INTERPOLERATION_LIMIT)
{ {
if (durs > INTERPOLERATION_LIMIT) if (durs > INTERPOLERATION_LIMIT)
durs = INTERPOLERATION_LIMIT; durs = INTERPOLERATION_LIMIT;

View file

@ -42,7 +42,7 @@ extern md2_t md2_playermodels[MAXSKINS];
void HWR_InitModels(void); void HWR_InitModels(void);
void HWR_AddPlayerModel(INT32 skin); void HWR_AddPlayerModel(INT32 skin);
void HWR_AddSpriteModel(size_t spritenum); void HWR_AddSpriteModel(size_t spritenum);
boolean HWR_DrawModel(gr_vissprite_t *spr); boolean HWR_DrawModel(gl_vissprite_t *spr);
#define PLAYERMODELPREFIX "PLAYER" #define PLAYERMODELPREFIX "PLAYER"

View file

@ -1,914 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 1998-2001 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief special trick routines to make some SW tricks look OK with
/// HW rendering. This includes:
/// - deepwatereffect (e.g. tnt/map02)
/// - invisible staircase (e.g. eternal/map02)
/// - floating ceilings (e.g. eternal/map03)
///
/// It is not guaranteed that it looks identical to the SW mode,
/// but it looks in most of the cases far better than having
/// holes in the architecture, HOM, etc.
///
/// It fixes as well missing textures, which are replaced by either
/// a default texture or the midtexture.
///
/// words of notice:
/// pseudosectors, as mentioned in this file, are sectors where both
/// sidedefs point to the same sector. This expression is also used
/// for sectors which are enclosed by another sector but have no
/// correct sidedefs at all
///
/// if a vertex is inside a poly is determined by the angles between
/// this vertex and all angles on the linedefs (imagine walking along
/// a circle always facing a certain point inside/outside the circle;
/// if inside, angle have taken all values [0..pi), otherwise the
/// range was < pi/2
#include <math.h>
#include "../doomdef.h"
#include "../doomstat.h"
#ifdef HWRENDER
#include "hw_glob.h"
#include "hw_dll.h"
#include "../r_local.h"
#include "../i_system.h"
//
// add a line to a sectors list of lines
//
static void addLineToChain(sector_t *sector, line_t *line)
{
linechain_t *thisElem = NULL, *nextElem;
if (!sector)
return;
nextElem = sector->sectorLines;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
}
// add a new element into the chain
if (thisElem)
{
thisElem->next = malloc(sizeof (linechain_t));
if (thisElem->next)
{
thisElem->next->line = line;
thisElem->next->next = NULL;
}
else
{
I_Error("Out of memory in addLineToChain(.)\n");
}
}
else // first element in chain
{
sector->sectorLines = malloc(sizeof (linechain_t));
if (sector->sectorLines)
{
sector->sectorLines->line = line;
sector->sectorLines->next = NULL;
}
else
{
I_Error("Out of memory in addLineToChain(.)\n");
}
}
}
//
// We dont want a memory hole, do we?;-)
//
static void releaseLineChains(void)
{
linechain_t *thisElem, *nextElem;
sector_t *sector;
size_t i;
for (i = 0; i < numsectors; i++)
{
sector = &sectors[i];
nextElem = sector->sectorLines;
while (nextElem)
{
thisElem = nextElem;
nextElem = thisElem->next;
free(thisElem);
}
sector->sectorLines = NULL;
}
}
//
// check if a pseudo sector is valid by checking all its linedefs
//
static boolean isPSectorValid(sector_t *sector)
{
linechain_t *thisElem, *nextElem;
if (!sector->pseudoSector) // check only pseudosectors, others dont care
{
#ifdef PARANOIA
CONS_Debug(DBG_RENDER, "Alert! non-pseudosector fed to isPSectorClosed()\n");
#endif
return false;
}
nextElem = sector->sectorLines;
while (nextElem)
{
thisElem = nextElem;
nextElem = thisElem->next;
if (thisElem->line->frontsector != thisElem->line->backsector)
return false;
}
return true;
}
//
// angles are always phiMax-phiMin [0...2\pi)
//
FUNCMATH static double phiDiff(double phiMin, double phiMax)
{
double result;
result = phiMax-phiMin;
if (result < 0.0l)
result += 2.0l*M_PIl;
return result;
}
//
// sort phi's so that enclosed angle < \pi
//
static void sortPhi(double phi1, double phi2, double *phiMin, double *phiMax)
{
if (phiDiff(phi1, phi2) < M_PIl)
{
*phiMin = phi1;
*phiMax = phi2;
}
else
{
*phiMin = phi2;
*phiMax = phi1;
}
}
//
// return if angle(phi1, phi2) is bigger than \pi
// if so, the vertex lies inside the poly
//
FUNCMATH static boolean biggerThanPi(double phi1, double phi2)
{
if (phiDiff(phi1, phi2) > M_PIl)
return true;
return false;
}
#define DELTAPHI (M_PIl/100.0l) // some small phi << \pi
//
// calculate bounds for minimum angle
//
static void phiBounds(double phi1, double phi2, double *phiMin, double *phiMax)
{
double phi1Tmp, phi2Tmp;
double psi1, psi2, psi3, psi4, psi5, psi6, psi7; // for optimization
sortPhi(phi1, phi2, &phi1Tmp, &phi2Tmp);
phi1 = phi1Tmp;
phi2 = phi2Tmp;
// check start condition
if (*phiMin > M_PIl || *phiMax > M_PIl)
{
*phiMin = phi1;
*phiMax = phi2;
return;
}
// 6 cases:
// new angles inbetween phiMin, phiMax -> forget it
// new angles enclose phiMin -> set phiMin
// new angles enclose phiMax -> set phiMax
// new angles completely outside phiMin, phiMax -> leave largest area free
// new angles close the range completely!
// new angles enlarges range on both sides
psi1 = phiDiff(*phiMin, phi1);
psi2 = phiDiff(*phiMin, phi2);
psi3 = phiDiff(*phiMax, phi1);
psi4 = phiDiff(*phiMax, phi2);
psi5 = phiDiff(*phiMin, *phiMax);
psi6 = (double)(2.0l*M_PIl - psi5); // phiDiff(*phiMax, *phiMin);
psi7 = (double)(2.0l*M_PIl - psi2); // phiDiff(phi2, *phiMin);
// case 1 & 5!
if ((psi1 <= psi5) && (psi2 <= psi5))
{
if (psi1 <= psi2) // case 1
{
return;
}
else // case 5
{
// create some artificial interval here not to get into numerical trouble
// in fact we know now the sector is completely enclosed -> base for computational optimization
*phiMax = 0.0l;
*phiMin = DELTAPHI;
return;
}
}
// case 2
if ((psi1 >= psi5) && (psi2 <= psi5))
{
*phiMin = phi1;
return;
}
// case 3
if ((psi3 >= psi6) && (psi4 <= psi6))
{
*phiMax = phi2;
return;
}
// case 4 & 6
#ifdef PARANOIA
if ((psi3 <= psi6) && (psi4 <= psi6)) // FIXME: isn't this case implicitly true anyway??
#endif
{
if (psi3 <= psi4) //case 4
{
if (psi3 >= psi7)
{
*phiMin = phi1;
return;
}
else
{
*phiMax = phi2;
return;
}
}
else // case 6
{
*phiMin = phi1;
*phiMax = phi2;
return;
}
}
#ifdef PARANOIA
CONS_Debug(DBG_RENDER, "phiMin = %f, phiMax = %f, phi1 = %f, phi2 = %f\n", *phiMin, *phiMax, phi1, phi2);
I_Error("phiBounds() out of range!\n");
#endif
}
//
// Check if a vertex lies inside a sector
// This works for "well-behaved" convex polygons
// If we need it mathematically correct, we need to sort the
// linedefs first so we have them in a row, then walk along the linedefs,
// but this is a bit overdone
//
static inline boolean isVertexInside(vertex_t *vertex, sector_t *sector)
{
double xa, ya, xe, ye;
linechain_t *chain;
double phiMin, phiMax;
double phi1, phi2;
chain = sector->sectorLines;
phiMin = phiMax = 10.0l*M_PIl; // some value > \pi
while (chain)
{
// start and end vertex
xa = (double)chain->line->v1->x - (double)vertex->x;
ya = (double)chain->line->v1->y - (double)vertex->y;
xe = (double)chain->line->v2->x - (double)vertex->x;
ye = (double)chain->line->v2->y - (double)vertex->y;
// angle phi of connection between the vertices and the x-axis
phi1 = atan2(ya, xa);
phi2 = atan2(ye, xe);
// if we have just started, we can have to create start bounds for phi
phiBounds(phi1, phi2, &phiMin, &phiMax);
chain = chain->next;
}
return biggerThanPi(phiMin, phiMax);
}
#define MAXSTACK 256 // Not more than 256 polys in each other?
//
// generate a list of sectors which enclose the given sector
//
static void generateStacklist(sector_t *thisSector)
{
size_t i, stackCnt = 0;
sector_t *locStacklist[MAXSTACK];
sector_t *checkSector;
for (i = 0; i < numsectors; i++)
{
checkSector = &sectors[i];
if (checkSector == thisSector) // dont check self
continue;
// buggy sector?
if (!thisSector->sectorLines)
continue;
// check if an arbitrary vertex of thisSector lies inside the checkSector
if (isVertexInside(thisSector->sectorLines->line->v1, checkSector))
{
// if so, the thisSector lies inside the checkSector
locStacklist[stackCnt] = checkSector;
stackCnt++;
if (MAXSTACK-1 == stackCnt) // beware of the SIGSEGV! and consider terminating NULL!
break;
}
}
thisSector->stackList = malloc(sizeof (sector_t *) * (stackCnt+1));
if (NULL == thisSector->stackList)
{
I_Error("Out of memory error in generateStacklist()");
}
locStacklist[stackCnt] = NULL; // terminating NULL
memcpy(thisSector->stackList, locStacklist, sizeof (sector_t *) * (stackCnt+1));
}
//
// Bubble sort the stacklist with rising lineoutlengths
//
static void sortStacklist(sector_t *sector)
{
sector_t **list;
sector_t *sec1, *sec2;
boolean finished;
size_t i;
list = sector->stackList;
finished = false;
if (!*list)
return; // nothing to sort
while (!finished)
{
i = 0;
finished = true;
while (*(list+i+1))
{
sec1 = *(list+i);
sec2 = *(list+i+1);
if (sec1->lineoutLength > sec2->lineoutLength)
{
*(list+i) = sec2;
*(list+i+1) = sec1;
finished = false;
}
i++;
}
}
}
//
// length of a line in euclidian sense
//
static double lineLength(line_t *line)
{
double dx, dy, length;
dx = (double) line->v1->x - (double) line->v2->x;
dy = (double) line->v1->y - (double) line->v2->y;
length = hypot(dx, dy);
return length;
}
//
// length of the sector lineout
//
static double calcLineoutLength(sector_t *sector)
{
linechain_t *chain;
double length = 0.0L;
chain = sector->sectorLines;
while (chain) // sum up lengths of all lines
{
length += lineLength(chain->line);
chain = chain->next;
}
return length;
}
//
// Calculate length of the sectors lineout
//
static void calcLineouts(sector_t *sector)
{
size_t secCount = 0;
sector_t *encSector = *(sector->stackList);
while (encSector)
{
if (encSector->lineoutLength < 0.0L) // if length has not yet been calculated
{
encSector->lineoutLength = calcLineoutLength(encSector);
}
secCount++;
encSector = *((sector->stackList) + secCount);
}
}
//
// Free Stacklists of all sectors
//
static void freeStacklists(void)
{
size_t i;
for (i = 0; i < numsectors; i++)
{
if (sectors[i].stackList)
{
free(sectors[i].stackList);
sectors[i].stackList = NULL;
}
}
}
//
// if more than half of the toptextures are missing
//
static boolean areToptexturesMissing(sector_t *thisSector)
{
linechain_t *thisElem, *nextElem = thisSector->sectorLines;
sector_t *frontSector, *backSector;
size_t nomiss = 0;
side_t *sidel, *sider;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
frontSector = thisElem->line->frontsector;
backSector = thisElem->line->backsector;
if (frontSector == backSector) // skip damn renderer tricks here
continue;
if (!frontSector || !backSector)
continue;
sider = &sides[thisElem->line->sidenum[0]];
sidel = &sides[thisElem->line->sidenum[1]];
if (backSector->ceilingheight < frontSector->ceilingheight)
{
if (sider->toptexture != 0)
{
nomiss++;
break; // we can stop here if decision criterium is ==0
}
}
else if (backSector->ceilingheight > frontSector->ceilingheight)
{
if (sidel->toptexture != 0)
{
nomiss++;
break; // we can stop here if decision criterium is ==0
}
}
}
return nomiss == 0;
}
//
// are more textures missing than present?
//
static boolean areBottomtexturesMissing(sector_t *thisSector)
{
linechain_t *thisElem, *nextElem = thisSector->sectorLines;
sector_t *frontSector, *backSector;
size_t nomiss = 0;
side_t *sidel, *sider;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
frontSector = thisElem->line->frontsector;
backSector = thisElem->line->backsector;
if (frontSector == backSector) // skip damn renderer tricks here
continue;
if (!frontSector || !backSector)
continue;
sider = &sides[thisElem->line->sidenum[0]];
sidel = &sides[thisElem->line->sidenum[1]];
if (backSector->floorheight > frontSector->floorheight)
{
if (sider->bottomtexture != 0)
{
nomiss++;
break; // we can stop here if decision criterium is ==0
}
}
else if (backSector->floorheight < frontSector->floorheight)
{
if (sidel->bottomtexture != 0)
{
nomiss++;
break; // we can stop here if decision criterium is ==0
}
}
}
// return missing >= nomiss;
return nomiss == 0;
}
//
// check if no adjacent sector has same ceiling height
//
static boolean isCeilingFloating(sector_t *thisSector)
{
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
linechain_t *thisElem, *nextElem;
if (!thisSector)
return false;
nextElem = thisSector->sectorLines;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
frontSector = thisElem->line->frontsector;
backSector = thisElem->line->backsector;
if (frontSector == thisSector)
adjSector = backSector;
else
adjSector = frontSector;
if (!adjSector) // assume floating sectors have surrounding sectors
return false;
if (adjSector->c_slope) // Don't bother with slopes
return false;
if (!refSector)
{
refSector = adjSector;
continue;
}
// if adjacent sector has same height or more than one adjacent sector exists -> stop
if (thisSector->ceilingheight == adjSector->ceilingheight || refSector != adjSector)
return false;
}
// now check for walltextures
if (!areToptexturesMissing(thisSector))
return false;
return true;
}
//
// check if no adjacent sector has same ceiling height
// FIXME: throw that together with isCeilingFloating??
//
static boolean isFloorFloating(sector_t *thisSector)
{
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
linechain_t *thisElem, *nextElem;
if (!thisSector)
return false;
nextElem = thisSector->sectorLines;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
frontSector = thisElem->line->frontsector;
backSector = thisElem->line->backsector;
if (frontSector == thisSector)
adjSector = backSector;
else
adjSector = frontSector;
if (!adjSector) // assume floating sectors have surrounding sectors
return false;
if (adjSector->f_slope) // Don't bother with slopes
return false;
if (!refSector)
{
refSector = adjSector;
continue;
}
// if adjacent sector has same height or more than one adjacent sector exists -> stop
if (thisSector->floorheight == adjSector->floorheight || refSector != adjSector)
return false;
}
// now check for walltextures
if (!areBottomtexturesMissing(thisSector))
return false;
return true;
}
//
// estimate ceilingheight according to height of adjacent sector
//
static fixed_t estimateCeilHeight(sector_t *thisSector)
{
sector_t *adjSector;
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
return 0;
adjSector = thisSector->sectorLines->line->frontsector;
if (adjSector == thisSector)
adjSector = thisSector->sectorLines->line->backsector;
if (!adjSector)
return 0;
return adjSector->ceilingheight;
}
//
// estimate ceilingheight according to height of adjacent sector
//
static fixed_t estimateFloorHeight(sector_t *thisSector)
{
sector_t *adjSector;
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
return 0;
adjSector = thisSector->sectorLines->line->frontsector;
if (adjSector == thisSector)
adjSector = thisSector->sectorLines->line->backsector;
if (!adjSector)
return 0;
return adjSector->floorheight;
}
#define CORRECT_FLOAT_EXPERIMENTAL
// --------------------------------------------------------------------------
// Some levels have missing sidedefs, which produces HOM, so lets try to compensate for that
// and some levels have deep water trick, invisible staircases etc.
// --------------------------------------------------------------------------
// FIXME: put some nice default texture in legacy.dat and use it
void HWR_CorrectSWTricks(void)
{
size_t i;
size_t k;
line_t *ld;
side_t *sidel = NULL, *sider;
sector_t *secl, *secr;
sector_t **sectorList;
sector_t *outSector;
if ((0 == cv_grcorrecttricks.value))
return;
// determine lines for sectors
for (i = 0; i < numlines; i++)
{
ld = &lines[i];
secr = ld->frontsector;
secl = ld->backsector;
if (secr == secl)
{
secr->pseudoSector = true; // special renderer trick?
addLineToChain(secr, ld);
}
else
{
addLineToChain(secr, ld);
addLineToChain(secl, ld);
}
}
// preprocessing
for (i = 0; i < numsectors; i++)
{
sector_t *checkSector;
checkSector = &sectors[i];
// identify real pseudosectors first
if (checkSector->pseudoSector)
{
if (!isPSectorValid(checkSector)) // drop invalid pseudo sectors
{
checkSector->pseudoSector = false;
}
}
// determine enclosing sectors for pseudosectors ... used later
if (checkSector->pseudoSector)
{
generateStacklist(checkSector);
calcLineouts(checkSector);
sortStacklist(checkSector);
}
}
// set virtual floor heights for pseudo sectors
// required for deep water effect e.g.
for (i = 0; i < numsectors; i++)
{
if (sectors[i].pseudoSector)
{
sectorList = sectors[i].stackList;
k = 0;
while (*(sectorList+k))
{
outSector = *(sectorList+k);
if (!outSector->pseudoSector)
{
sectors[i].virtualFloorheight = outSector->floorheight;
sectors[i].virtualCeilingheight = outSector->ceilingheight;
break;
}
k++;
}
if (*(sectorList+k) == NULL) // sorry, did not work :(
{
sectors[i].virtualFloorheight = sectors[i].floorheight;
sectors[i].virtualCeilingheight = sectors[i].ceilingheight;
}
}
}
#ifdef CORRECT_FLOAT_EXPERIMENTAL
// correct ceiling/floor heights of totally floating sectors
for (i = 0; i < numsectors; i++)
{
sector_t *floatSector;
floatSector = &sectors[i];
// correct height of floating sectors
if (isCeilingFloating(floatSector))
{
floatSector->virtualCeilingheight = estimateCeilHeight(floatSector);
floatSector->virtualCeiling = true;
}
if (isFloorFloating(floatSector))
{
floatSector->virtualFloorheight = estimateFloorHeight(floatSector);
floatSector->virtualFloor = true;
}
}
#endif
// now for the missing textures
for (i = 0; i < numlines; i++)
{
ld = &lines[i];
sider = &sides[ld->sidenum[0]];
if (ld->sidenum[1] != 0xffff)
sidel = &sides[ld->sidenum[1]];
secr = ld->frontsector;
secl = ld->backsector;
if (secr == secl) // special renderer trick
continue; // we cant correct missing textures here
if (secl) // only if there is a backsector
{
if (secr->pseudoSector || secl->pseudoSector)
continue;
if (!secr->virtualFloor && !secl->virtualFloor)
{
if (secl->floorheight > secr->floorheight)
{
// now check if r-sidedef is correct
if (sider->bottomtexture == 0)
{
if (sider->midtexture == 0)
sider->bottomtexture = 0; // Tails // More redwall sky shenanigans
else
sider->bottomtexture = sider->midtexture;
}
}
else if (secl->floorheight < secr->floorheight)
{
// now check if l-sidedef is correct
if (sidel->bottomtexture == 0)
{
if (sidel->midtexture == 0)
sidel->bottomtexture = 0; // Tails // More redwall sky shenanigans
else
sidel->bottomtexture = sidel->midtexture;
}
}
}
if (!secr->virtualCeiling && !secl->virtualCeiling)
{
if (secl->ceilingheight < secr->ceilingheight)
{
// now check if r-sidedef is correct
if (sider->toptexture == 0)
{
if (sider->midtexture == 0)
sider->toptexture = 0; // Tails // When this was REDWALL it was causing issues in the sky sometimes
else
sider->toptexture = sider->midtexture;
}
}
else if (secl->ceilingheight > secr->ceilingheight)
{
// now check if l-sidedef is correct
if (sidel->toptexture == 0)
{
if (sidel->midtexture == 0)
sidel->toptexture = 0; // Tails // When this was REDWALL it was causing issues in the sky sometimes
else
sidel->toptexture = sidel->midtexture;
}
}
}
} // if (NULL != secl)
} // for (i = 0; i < numlines; i++)
// release all linechains
releaseLineChains();
freeStacklists();
}
#endif // HWRENDER

View file

@ -58,8 +58,8 @@ static GLuint tex_downloaded = 0;
static GLfloat fov = 90.0f; static GLfloat fov = 90.0f;
static FBITFIELD CurrentPolyFlags; static FBITFIELD CurrentPolyFlags;
static FTextureInfo *gr_cachetail = NULL; static FTextureInfo *gl_cachetail = NULL;
static FTextureInfo *gr_cachehead = NULL; static FTextureInfo *gl_cachehead = NULL;
RGBA_t myPaletteData[256]; RGBA_t myPaletteData[256];
GLint screen_width = 0; // used by Draw2DLine() GLint screen_width = 0; // used by Draw2DLine()
@ -1200,7 +1200,7 @@ void SetModelView(GLint w, GLint h)
pglLoadIdentity(); pglLoadIdentity();
GLPerspective(fov, ASPECT_RATIO); GLPerspective(fov, ASPECT_RATIO);
//pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gr_scalefrustum (ORIGINAL_ASPECT) //pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gl_scalefrustum (ORIGINAL_ASPECT)
// added for new coronas' code (without depth buffer) // added for new coronas' code (without depth buffer)
pglGetIntegerv(GL_VIEWPORT, viewport); pglGetIntegerv(GL_VIEWPORT, viewport);
@ -1277,14 +1277,14 @@ void Flush(void)
{ {
//GL_DBG_Printf ("HWR_Flush()\n"); //GL_DBG_Printf ("HWR_Flush()\n");
while (gr_cachehead) while (gl_cachehead)
{ {
if (gr_cachehead->downloaded) if (gl_cachehead->downloaded)
pglDeleteTextures(1, (GLuint *)&gr_cachehead->downloaded); pglDeleteTextures(1, (GLuint *)&gl_cachehead->downloaded);
gr_cachehead->downloaded = 0; gl_cachehead->downloaded = 0;
gr_cachehead = gr_cachehead->nextmipmap; gl_cachehead = gl_cachehead->nextmipmap;
} }
gr_cachetail = gr_cachehead = NULL; //Hurdler: well, gr_cachehead is already NULL gl_cachetail = gl_cachehead = NULL; //Hurdler: well, gl_cachehead is already NULL
tex_downloaded = 0; tex_downloaded = 0;
} }
@ -1657,15 +1657,15 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
else else
texnum = pTexInfo->downloaded; texnum = pTexInfo->downloaded;
//GL_DBG_Printf ("DownloadMipmap %d %x\n",(INT32)texnum,pTexInfo->grInfo.data); //GL_DBG_Printf ("DownloadMipmap %d %x\n",(INT32)texnum,pTexInfo->data);
w = pTexInfo->width; w = pTexInfo->width;
h = pTexInfo->height; h = pTexInfo->height;
if ((pTexInfo->grInfo.format == GR_TEXFMT_P_8) || if ((pTexInfo->format == GL_TEXFMT_P_8) ||
(pTexInfo->grInfo.format == GR_TEXFMT_AP_88)) (pTexInfo->format == GL_TEXFMT_AP_88))
{ {
const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data; const GLubyte *pImgData = (const GLubyte *)pTexInfo->data;
INT32 i, j; INT32 i, j;
for (j = 0; j < h; j++) for (j = 0; j < h; j++)
@ -1691,7 +1691,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
pImgData++; pImgData++;
if (pTexInfo->grInfo.format == GR_TEXFMT_AP_88) if (pTexInfo->format == GL_TEXFMT_AP_88)
{ {
if (!(pTexInfo->flags & TF_CHROMAKEYED)) if (!(pTexInfo->flags & TF_CHROMAKEYED))
tex[w*j+i].s.alpha = *pImgData; tex[w*j+i].s.alpha = *pImgData;
@ -1701,15 +1701,15 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
} }
} }
} }
else if (pTexInfo->grInfo.format == GR_RGBA) else if (pTexInfo->format == GL_TEXFMT_RGBA)
{ {
// corona test : passed as ARGB 8888, which is not in glide formats // corona test : passed as ARGB 8888, which is not in glide formats
// Hurdler: not used for coronas anymore, just for dynamic lighting // Hurdler: not used for coronas anymore, just for dynamic lighting
ptex = pTexInfo->grInfo.data; ptex = pTexInfo->data;
} }
else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88) else if (pTexInfo->format == GL_TEXFMT_ALPHA_INTENSITY_88)
{ {
const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data; const GLubyte *pImgData = (const GLubyte *)pTexInfo->data;
INT32 i, j; INT32 i, j;
for (j = 0; j < h; j++) for (j = 0; j < h; j++)
@ -1725,9 +1725,9 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
} }
} }
} }
else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_8) // Used for fade masks else if (pTexInfo->format == GL_TEXFMT_ALPHA_8) // Used for fade masks
{ {
const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data; const GLubyte *pImgData = (const GLubyte *)pTexInfo->data;
INT32 i, j; INT32 i, j;
for (j = 0; j < h; j++) for (j = 0; j < h; j++)
@ -1743,7 +1743,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
} }
} }
else else
GL_MSG_Warning ("SetTexture(bad format) %ld\n", pTexInfo->grInfo.format); GL_MSG_Warning ("SetTexture(bad format) %ld\n", pTexInfo->format);
// the texture number was already generated by pglGenTextures // the texture number was already generated by pglGenTextures
pglBindTexture(GL_TEXTURE_2D, texnum); pglBindTexture(GL_TEXTURE_2D, texnum);
@ -1761,7 +1761,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
} }
if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88) if (pTexInfo->format == GL_TEXFMT_ALPHA_INTENSITY_88)
{ {
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); //pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (MipMap) if (MipMap)
@ -1782,7 +1782,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
} }
} }
else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_8) else if (pTexInfo->format == GL_TEXFMT_ALPHA_8)
{ {
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); //pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (MipMap) if (MipMap)
@ -1860,13 +1860,13 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
{ {
UpdateTexture(pTexInfo); UpdateTexture(pTexInfo);
pTexInfo->nextmipmap = NULL; pTexInfo->nextmipmap = NULL;
if (gr_cachetail) if (gl_cachetail)
{ // insertion at the tail { // insertion at the tail
gr_cachetail->nextmipmap = pTexInfo; gl_cachetail->nextmipmap = pTexInfo;
gr_cachetail = pTexInfo; gl_cachetail = pTexInfo;
} }
else // initialization of the linked list else // initialization of the linked list
gr_cachetail = gr_cachehead = pTexInfo; gl_cachetail = gl_cachehead = pTexInfo;
} }
} }
@ -2939,6 +2939,8 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
if (shearing) if (shearing)
{ {
float fdy = stransform->viewaiming * 2; float fdy = stransform->viewaiming * 2;
if (stransform->flip)
fdy *= -1.0f;
pglTranslatef(0.0f, -fdy/BASEVIDHEIGHT, 0.0f); pglTranslatef(0.0f, -fdy/BASEVIDHEIGHT, 0.0f);
} }
@ -2959,7 +2961,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
EXPORT INT32 HWRAPI(GetTextureUsed) (void) EXPORT INT32 HWRAPI(GetTextureUsed) (void)
{ {
FTextureInfo *tmp = gr_cachehead; FTextureInfo *tmp = gl_cachehead;
INT32 res = 0; INT32 res = 0;
while (tmp) while (tmp)
@ -2968,14 +2970,10 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void)
// I don't know which one the game actually _uses_ but this // I don't know which one the game actually _uses_ but this
// follows format2bpp in hw_cache.c // follows format2bpp in hw_cache.c
int bpp = 1; int bpp = 1;
int format = tmp->grInfo.format; int format = tmp->format;
if (format == GR_RGBA) if (format == GL_TEXFMT_RGBA)
bpp = 4; bpp = 4;
else if (format == GR_TEXFMT_RGB_565 else if (format == GL_TEXFMT_ALPHA_INTENSITY_88 || format == GL_TEXFMT_AP_88)
|| format == GR_TEXFMT_ARGB_1555
|| format == GR_TEXFMT_ARGB_4444
|| format == GR_TEXFMT_ALPHA_INTENSITY_88
|| format == GR_TEXFMT_AP_88)
bpp = 2; bpp = 2;
// Add it up! // Add it up!

View file

@ -1880,7 +1880,7 @@ static inline void HU_DrawCrosshair(void)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
y = (INT32)gr_basewindowcentery; y = (INT32)gl_basewindowcentery;
else else
#endif #endif
y = viewwindowy + (viewheight>>1); y = viewwindowy + (viewheight>>1);
@ -1901,7 +1901,7 @@ static inline void HU_DrawCrosshair2(void)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
y = (INT32)gr_basewindowcentery; y = (INT32)gl_basewindowcentery;
else else
#endif #endif
y = viewwindowy + (viewheight>>1); y = viewwindowy + (viewheight>>1);
@ -1910,7 +1910,7 @@ static inline void HU_DrawCrosshair2(void)
{ {
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
y += (INT32)gr_viewheight; y += (INT32)gl_viewheight;
else else
#endif #endif
y += viewheight; y += viewheight;

View file

@ -21803,11 +21803,11 @@ skincolor_t skincolors[MAXSKINCOLORS] = {
{"Super Orange 4", {0x00, 0xd0, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x44, 0x45, 0x46}, SKINCOLOR_SAPPHIRE, 4, V_ORANGEMAP, false}, // SKINCOLOR_SUPERORANGE4 {"Super Orange 4", {0x00, 0xd0, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x44, 0x45, 0x46}, SKINCOLOR_SAPPHIRE, 4, V_ORANGEMAP, false}, // SKINCOLOR_SUPERORANGE4
{"Super Orange 5", {0xd0, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x44, 0x45, 0x46, 0x47}, SKINCOLOR_SAPPHIRE, 3, V_ORANGEMAP, false}, // SKINCOLOR_SUPERORANGE5 {"Super Orange 5", {0xd0, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x44, 0x45, 0x46, 0x47}, SKINCOLOR_SAPPHIRE, 3, V_ORANGEMAP, false}, // SKINCOLOR_SUPERORANGE5
{"Super Gold 1", {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x50, 0x51, 0x52, 0x53, 0x48}, SKINCOLOR_CORNFLOWER, 15, 0, false}, // SKINCOLOR_SUPERGOLD1 {"Super Gold 1", {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x50, 0x51, 0x52, 0x53, 0x48, 0x48, 0x48}, SKINCOLOR_CORNFLOWER, 15, 0, false}, // SKINCOLOR_SUPERGOLD1
{"Super Gold 2", {0x00, 0x50, 0x51, 0x52, 0x53, 0x53, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x40, 0x41}, SKINCOLOR_CORNFLOWER, 9, V_YELLOWMAP, false}, // SKINCOLOR_SUPERGOLD2 {"Super Gold 2", {0x00, 0x50, 0x51, 0x52, 0x53, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x40, 0x41, 0x41, 0x41}, SKINCOLOR_CORNFLOWER, 9, V_YELLOWMAP, false}, // SKINCOLOR_SUPERGOLD2
{"Super Gold 3", {0x51, 0x52, 0x53, 0x53, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x40, 0x41, 0x42, 0x43}, SKINCOLOR_CORNFLOWER, 8, V_YELLOWMAP, false}, // SKINCOLOR_SUPERGOLD3 {"Super Gold 3", {0x51, 0x52, 0x53, 0x53, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x40, 0x41, 0x42, 0x43, 0x43, 0x43}, SKINCOLOR_CORNFLOWER, 8, V_YELLOWMAP, false}, // SKINCOLOR_SUPERGOLD3
{"Super Gold 4", {0x53, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46}, SKINCOLOR_CORNFLOWER, 8, V_YELLOWMAP, false}, // SKINCOLOR_SUPERGOLD4 {"Super Gold 4", {0x53, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x46, 0x46}, SKINCOLOR_CORNFLOWER, 8, V_YELLOWMAP, false}, // SKINCOLOR_SUPERGOLD4
{"Super Gold 5", {0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47}, SKINCOLOR_CORNFLOWER, 8, V_YELLOWMAP, false}, // SKINCOLOR_SUPERGOLD5 {"Super Gold 5", {0x48, 0x48, 0x49, 0x49, 0x49, 0x40, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x47, 0x47}, SKINCOLOR_CORNFLOWER, 8, V_YELLOWMAP, false}, // SKINCOLOR_SUPERGOLD5
{"Super Peridot 1", {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x58, 0x58, 0xbc, 0xbc, 0xbc}, SKINCOLOR_COBALT, 15, 0, false}, // SKINCOLOR_SUPERPERIDOT1 {"Super Peridot 1", {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x58, 0x58, 0xbc, 0xbc, 0xbc}, SKINCOLOR_COBALT, 15, 0, false}, // SKINCOLOR_SUPERPERIDOT1
{"Super Peridot 2", {0x00, 0x58, 0x58, 0x58, 0xbc, 0xbc, 0xbc, 0xbc, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbe, 0xbe}, SKINCOLOR_COBALT, 4, V_PERIDOTMAP, false}, // SKINCOLOR_SUPERPERIDOT2 {"Super Peridot 2", {0x00, 0x58, 0x58, 0x58, 0xbc, 0xbc, 0xbc, 0xbc, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbe, 0xbe}, SKINCOLOR_COBALT, 4, V_PERIDOTMAP, false}, // SKINCOLOR_SUPERPERIDOT2

View file

@ -902,6 +902,94 @@ static int lib_pMaceRotate(lua_State *L)
return 0; return 0;
} }
static int lib_pRailThinker(lua_State *L)
{
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!mobj)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_RailThinker(mobj));
return 1;
}
static int lib_pXYMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
P_XYMovement(actor);
return 0;
}
static int lib_pRingXYMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
P_RingXYMovement(actor);
return 0;
}
static int lib_pSceneryXYMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
P_SceneryXYMovement(actor);
return 0;
}
static int lib_pZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_ZMovement(actor));
return 1;
}
static int lib_pRingZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
P_RingZMovement(actor);
return 0;
}
static int lib_pSceneryZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_SceneryZMovement(actor));
return 1;
}
static int lib_pPlayerZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
P_PlayerZMovement(actor);
return 0;
}
// P_USER // P_USER
//////////// ////////////
@ -1272,6 +1360,17 @@ static int lib_pSpawnSkidDust(lua_State *L)
return 0; return 0;
} }
static int lib_pMovePlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
INLEVEL
if (!player)
return LUA_ErrInvalid(L, "player_t");
P_MovePlayer(player);
return 0;
}
static int lib_pDoPlayerFinish(lua_State *L) static int lib_pDoPlayerFinish(lua_State *L)
{ {
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@ -2451,6 +2550,14 @@ static int lib_rGetColorByName(lua_State *L)
return 1; return 1;
} }
static int lib_rGetSuperColorByName(lua_State *L)
{
const char* colorname = luaL_checkstring(L, 1);
//HUDSAFE
lua_pushinteger(L, R_GetSuperColorByName(colorname));
return 1;
}
// Lua exclusive function, returns the name of a color from the SKINCOLOR_ constant. // Lua exclusive function, returns the name of a color from the SKINCOLOR_ constant.
// SKINCOLOR_GREEN > "Green" for example // SKINCOLOR_GREEN > "Green" for example
static int lib_rGetNameByColor(lua_State *L) static int lib_rGetNameByColor(lua_State *L)
@ -3259,6 +3366,14 @@ static luaL_Reg lib[] = {
{"P_CheckSolidLava",lib_pCheckSolidLava}, {"P_CheckSolidLava",lib_pCheckSolidLava},
{"P_CanRunOnWater",lib_pCanRunOnWater}, {"P_CanRunOnWater",lib_pCanRunOnWater},
{"P_MaceRotate",lib_pMaceRotate}, {"P_MaceRotate",lib_pMaceRotate},
{"P_RailThinker",lib_pRailThinker},
{"P_XYMovement",lib_pXYMovement},
{"P_RingXYMovement",lib_pRingXYMovement},
{"P_SceneryXYMovement",lib_pSceneryXYMovement},
{"P_ZMovement",lib_pZMovement},
{"P_RingZMovement",lib_pRingZMovement},
{"P_SceneryZMovement",lib_pSceneryZMovement},
{"P_PlayerZMovement",lib_pPlayerZMovement},
// p_user // p_user
{"P_GetPlayerHeight",lib_pGetPlayerHeight}, {"P_GetPlayerHeight",lib_pGetPlayerHeight},
@ -3290,6 +3405,7 @@ static luaL_Reg lib[] = {
{"P_BlackOw",lib_pBlackOw}, {"P_BlackOw",lib_pBlackOw},
{"P_ElementalFire",lib_pElementalFire}, {"P_ElementalFire",lib_pElementalFire},
{"P_SpawnSkidDust", lib_pSpawnSkidDust}, {"P_SpawnSkidDust", lib_pSpawnSkidDust},
{"P_MovePlayer",lib_pMovePlayer},
{"P_DoPlayerFinish",lib_pDoPlayerFinish}, {"P_DoPlayerFinish",lib_pDoPlayerFinish},
{"P_DoPlayerExit",lib_pDoPlayerExit}, {"P_DoPlayerExit",lib_pDoPlayerExit},
{"P_InstaThrust",lib_pInstaThrust}, {"P_InstaThrust",lib_pInstaThrust},
@ -3385,6 +3501,7 @@ static luaL_Reg lib[] = {
// r_draw // r_draw
{"R_GetColorByName", lib_rGetColorByName}, {"R_GetColorByName", lib_rGetColorByName},
{"R_GetSuperColorByName", lib_rGetSuperColorByName},
{"R_GetNameByColor", lib_rGetNameByColor}, {"R_GetNameByColor", lib_rGetNameByColor},
// s_sound // s_sound

View file

@ -444,7 +444,7 @@ static int lib_consPrintf(lua_State *L)
if (n < 2) if (n < 2)
return luaL_error(L, "CONS_Printf requires at least two arguments: player and text."); return luaL_error(L, "CONS_Printf requires at least two arguments: player and text.");
//HUDSAFE //HUDSAFE
INLEVEL
plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
if (!plr) if (!plr)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");

View file

@ -19,14 +19,15 @@
#include "z_zone.h" #include "z_zone.h"
#include "r_picformats.h" #include "r_picformats.h"
#include "r_things.h" #include "r_things.h"
#include "r_draw.h" // R_GetColorByName
#include "doomstat.h" // luabanks[] #include "doomstat.h" // luabanks[]
#include "lua_script.h" #include "lua_script.h"
#include "lua_libs.h" #include "lua_libs.h"
#include "lua_hud.h" // hud_running errors #include "lua_hud.h" // hud_running errors
extern CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1]; extern CV_PossibleValue_t Color_cons_t[];
extern void R_FlushTranslationColormapCache(void); extern UINT8 skincolor_modified[];
boolean LUA_CallAction(const char *action, mobj_t *actor); boolean LUA_CallAction(const char *action, mobj_t *actor);
state_t *astate; state_t *astate;
@ -1540,7 +1541,16 @@ static int lib_setSkinColor(lua_State *L)
const char* n = luaL_checkstring(L, 3); const char* n = luaL_checkstring(L, 3);
strlcpy(info->name, n, MAXCOLORNAME+1); strlcpy(info->name, n, MAXCOLORNAME+1);
if (strlen(n) > MAXCOLORNAME) if (strlen(n) > MAXCOLORNAME)
CONS_Alert(CONS_WARNING, "skincolor_t field 'name' ('%s') longer than %d chars; shortened to %s.\n", n, MAXCOLORNAME, info->name); CONS_Alert(CONS_WARNING, "skincolor_t field 'name' ('%s') longer than %d chars; clipped to %s.\n", n, MAXCOLORNAME, info->name);
if (strchr(info->name, ' ') != NULL)
CONS_Alert(CONS_WARNING, "skincolor_t field 'name' ('%s') contains spaces.\n", info->name);
if (info->name[0] != '\0') // don't check empty string for dupe
{
UINT16 dupecheck = R_GetColorByName(info->name);
if (!stricmp(info->name, skincolors[SKINCOLOR_NONE].name) || (dupecheck && (dupecheck != info-skincolors)))
CONS_Alert(CONS_WARNING, "skincolor_t field 'name' ('%s') is a duplicate of another skincolor's name.\n", info->name);
}
} else if (i == 2 || (str && fastcmp(str,"ramp"))) { } else if (i == 2 || (str && fastcmp(str,"ramp"))) {
if (!lua_istable(L, 3) && luaL_checkudata(L, 3, META_COLORRAMP) == NULL) if (!lua_istable(L, 3) && luaL_checkudata(L, 3, META_COLORRAMP) == NULL)
return luaL_error(L, LUA_QL("skincolor_t") " field 'ramp' must be a table or array."); return luaL_error(L, LUA_QL("skincolor_t") " field 'ramp' must be a table or array.");
@ -1549,20 +1559,18 @@ static int lib_setSkinColor(lua_State *L)
else else
for (j=0; j<COLORRAMPSIZE; j++) for (j=0; j<COLORRAMPSIZE; j++)
info->ramp[j] = (*((UINT8 **)luaL_checkudata(L, 3, META_COLORRAMP)))[j]; info->ramp[j] = (*((UINT8 **)luaL_checkudata(L, 3, META_COLORRAMP)))[j];
R_FlushTranslationColormapCache(); skincolor_modified[cnum] = true;
} else if (i == 3 || (str && fastcmp(str,"invcolor"))) } else if (i == 3 || (str && fastcmp(str,"invcolor"))) {
info->invcolor = (UINT16)luaL_checkinteger(L, 3); UINT16 v = (UINT16)luaL_checkinteger(L, 3);
else if (i == 4 || (str && fastcmp(str,"invshade"))) if (v >= numskincolors)
return luaL_error(L, "attempt to set skincolors[%d].invcolor to out of range value %d.", cnum, v);
info->invcolor = v;
} else if (i == 4 || (str && fastcmp(str,"invshade")))
info->invshade = (UINT8)luaL_checkinteger(L, 3)%COLORRAMPSIZE; info->invshade = (UINT8)luaL_checkinteger(L, 3)%COLORRAMPSIZE;
else if (i == 5 || (str && fastcmp(str,"chatcolor"))) else if (i == 5 || (str && fastcmp(str,"chatcolor")))
info->chatcolor = (UINT16)luaL_checkinteger(L, 3); info->chatcolor = (UINT16)luaL_checkinteger(L, 3);
else if (i == 6 || (str && fastcmp(str,"accessible"))) { else if (i == 6 || (str && fastcmp(str,"accessible")))
boolean v = lua_isboolean(L,3) ? lua_toboolean(L, 3) : true; info->accessible = lua_toboolean(L, 3);
if (cnum < FIRSTSUPERCOLOR && v != skincolors[cnum].accessible)
return luaL_error(L, "skincolors[] index %d is a standard color; accessibility changes are prohibited.", i);
else
info->accessible = v;
}
lua_pop(L, 1); lua_pop(L, 1);
} }
return 0; return 0;
@ -1616,11 +1624,18 @@ static int skincolor_set(lua_State *L)
if (fastcmp(field,"name")) { if (fastcmp(field,"name")) {
const char* n = luaL_checkstring(L, 3); const char* n = luaL_checkstring(L, 3);
if (strchr(n, ' ') != NULL)
CONS_Alert(CONS_WARNING, "skincolor_t field 'name' ('%s') contains spaces.\n", n);
strlcpy(info->name, n, MAXCOLORNAME+1); strlcpy(info->name, n, MAXCOLORNAME+1);
if (strlen(n) > MAXCOLORNAME) if (strlen(n) > MAXCOLORNAME)
CONS_Alert(CONS_WARNING, "skincolor_t field 'name' ('%s') longer than %d chars; clipped to %s.\n", n, MAXCOLORNAME, info->name); CONS_Alert(CONS_WARNING, "skincolor_t field 'name' ('%s') longer than %d chars; clipped to %s.\n", n, MAXCOLORNAME, info->name);
if (strchr(info->name, ' ') != NULL)
CONS_Alert(CONS_WARNING, "skincolor_t field 'name' ('%s') contains spaces.\n", info->name);
if (info->name[0] != '\0') // don't check empty string for dupe
{
UINT16 dupecheck = R_GetColorByName(info->name);
if (!stricmp(info->name, skincolors[SKINCOLOR_NONE].name) || (dupecheck && (dupecheck != info-skincolors)))
CONS_Alert(CONS_WARNING, "skincolor_t field 'name' ('%s') is a duplicate of another skincolor's name.\n", info->name);
}
} else if (fastcmp(field,"ramp")) { } else if (fastcmp(field,"ramp")) {
if (!lua_istable(L, 3) && luaL_checkudata(L, 3, META_COLORRAMP) == NULL) if (!lua_istable(L, 3) && luaL_checkudata(L, 3, META_COLORRAMP) == NULL)
return luaL_error(L, LUA_QL("skincolor_t") " field 'ramp' must be a table or array."); return luaL_error(L, LUA_QL("skincolor_t") " field 'ramp' must be a table or array.");
@ -1629,15 +1644,18 @@ static int skincolor_set(lua_State *L)
else else
for (i=0; i<COLORRAMPSIZE; i++) for (i=0; i<COLORRAMPSIZE; i++)
info->ramp[i] = (*((UINT8 **)luaL_checkudata(L, 3, META_COLORRAMP)))[i]; info->ramp[i] = (*((UINT8 **)luaL_checkudata(L, 3, META_COLORRAMP)))[i];
R_FlushTranslationColormapCache(); skincolor_modified[info-skincolors] = true;
} else if (fastcmp(field,"invcolor")) } else if (fastcmp(field,"invcolor")) {
info->invcolor = (UINT16)luaL_checkinteger(L, 3); UINT16 v = (UINT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"invshade")) if (v >= numskincolors)
return luaL_error(L, "attempt to set skincolor_t field 'invcolor' to out of range value %d.", v);
info->invcolor = v;
} else if (fastcmp(field,"invshade"))
info->invshade = (UINT8)luaL_checkinteger(L, 3)%COLORRAMPSIZE; info->invshade = (UINT8)luaL_checkinteger(L, 3)%COLORRAMPSIZE;
else if (fastcmp(field,"chatcolor")) else if (fastcmp(field,"chatcolor"))
info->chatcolor = (UINT16)luaL_checkinteger(L, 3); info->chatcolor = (UINT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"accessible")) else if (fastcmp(field,"accessible"))
info->accessible = lua_isboolean(L,3); info->accessible = lua_toboolean(L, 3);
else else
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "skincolor_t", field); CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "skincolor_t", field);
return 1; return 1;
@ -1680,7 +1698,7 @@ static int colorramp_set(lua_State *L)
if (hud_running) if (hud_running)
return luaL_error(L, "Do not alter skincolor_t in HUD rendering code!"); return luaL_error(L, "Do not alter skincolor_t in HUD rendering code!");
colorramp[n] = i; colorramp[n] = i;
R_FlushTranslationColormapCache(); skincolor_modified[cnum] = true;
return 0; return 0;
} }

View file

@ -165,14 +165,15 @@ static int mobj_get(lua_State *L)
enum mobj_e field = Lua_optoption(L, 2, NULL, mobj_opt); enum mobj_e field = Lua_optoption(L, 2, NULL, mobj_opt);
lua_settop(L, 2); lua_settop(L, 2);
INLEVEL if (!mo || !ISINLEVEL) {
if (!mo) {
if (field == mobj_valid) { if (field == mobj_valid) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
} }
return LUA_ErrInvalid(L, "mobj_t"); if (!mo) {
return LUA_ErrInvalid(L, "mobj_t");
} else
return luaL_error(L, "Do not access an mobj_t field outside a level!");
} }
switch(field) switch(field)

View file

@ -344,6 +344,12 @@ int LUA_PushGlobals(lua_State *L, const char *word)
} else if (fastcmp(word,"gravity")) { } else if (fastcmp(word,"gravity")) {
lua_pushinteger(L, gravity); lua_pushinteger(L, gravity);
return 1; return 1;
} else if (fastcmp(word,"VERSION")) {
lua_pushinteger(L, VERSION);
return 1;
} else if (fastcmp(word,"SUBVERSION")) {
lua_pushinteger(L, SUBVERSION);
return 1;
} else if (fastcmp(word,"VERSIONSTRING")) { } else if (fastcmp(word,"VERSIONSTRING")) {
lua_pushstring(L, VERSIONSTRING); lua_pushstring(L, VERSIONSTRING);
return 1; return 1;

View file

@ -487,7 +487,7 @@ CV_PossibleValue_t loadless_cons_t[] = {{0, "Realtime"}, {1, "In-game"}, {0, NUL
consvar_t cv_dummymarathon = {"dummymarathon", "Standard", CV_HIDEN, marathon_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_dummymarathon = {"dummymarathon", "Standard", CV_HIDEN, marathon_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_dummycutscenes = {"dummycutscenes", "Off", CV_HIDEN, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_dummycutscenes = {"dummycutscenes", "Off", CV_HIDEN, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_dummyloadless = {"dummyloadless", "Realtime", CV_HIDEN, loadless_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_dummyloadless = {"dummyloadless", "In-game", CV_HIDEN, loadless_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
// ========================================================================== // ==========================================================================
// ORGANIZATION START. // ORGANIZATION START.
@ -1446,19 +1446,19 @@ static menuitem_t OP_ColorOptionsMenu[] =
static menuitem_t OP_OpenGLOptionsMenu[] = static menuitem_t OP_OpenGLOptionsMenu[] =
{ {
{IT_HEADER, NULL, "3D Models", NULL, 0}, {IT_HEADER, NULL, "3D Models", NULL, 0},
{IT_STRING|IT_CVAR, NULL, "Models", &cv_grmodels, 12}, {IT_STRING|IT_CVAR, NULL, "Models", &cv_glmodels, 12},
{IT_STRING|IT_CVAR, NULL, "Frame interpolation", &cv_grmodelinterpolation, 22}, {IT_STRING|IT_CVAR, NULL, "Frame interpolation", &cv_glmodelinterpolation, 22},
{IT_STRING|IT_CVAR, NULL, "Ambient lighting", &cv_grmodellighting, 32}, {IT_STRING|IT_CVAR, NULL, "Ambient lighting", &cv_glmodellighting, 32},
{IT_HEADER, NULL, "General", NULL, 51}, {IT_HEADER, NULL, "General", NULL, 51},
{IT_STRING|IT_CVAR, NULL, "Shaders", &cv_grshaders, 63}, {IT_STRING|IT_CVAR, NULL, "Shaders", &cv_glshaders, 63},
{IT_STRING|IT_CVAR, NULL, "Lack of perspective", &cv_grshearing, 73}, {IT_STRING|IT_CVAR, NULL, "Lack of perspective", &cv_glshearing, 73},
{IT_STRING|IT_CVAR, NULL, "Field of view", &cv_fov, 83}, {IT_STRING|IT_CVAR, NULL, "Field of view", &cv_fov, 83},
{IT_HEADER, NULL, "Miscellaneous", NULL, 102}, {IT_HEADER, NULL, "Miscellaneous", NULL, 102},
{IT_STRING|IT_CVAR, NULL, "Bit depth", &cv_scr_depth, 114}, {IT_STRING|IT_CVAR, NULL, "Bit depth", &cv_scr_depth, 114},
{IT_STRING|IT_CVAR, NULL, "Texture filter", &cv_grfiltermode, 124}, {IT_STRING|IT_CVAR, NULL, "Texture filter", &cv_glfiltermode, 124},
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 134}, {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_glanisotropicmode, 134},
#ifdef ALAM_LIGHTING #ifdef ALAM_LIGHTING
{IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 144}, {IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 144},
#endif #endif
@ -1470,10 +1470,10 @@ static menuitem_t OP_OpenGLOptionsMenu[] =
#ifdef ALAM_LIGHTING #ifdef ALAM_LIGHTING
static menuitem_t OP_OpenGLLightingMenu[] = static menuitem_t OP_OpenGLLightingMenu[] =
{ {
{IT_STRING|IT_CVAR, NULL, "Coronas", &cv_grcoronas, 0}, {IT_STRING|IT_CVAR, NULL, "Coronas", &cv_glcoronas, 0},
{IT_STRING|IT_CVAR, NULL, "Coronas size", &cv_grcoronasize, 10}, {IT_STRING|IT_CVAR, NULL, "Coronas size", &cv_glcoronasize, 10},
{IT_STRING|IT_CVAR, NULL, "Dynamic lighting", &cv_grdynamiclighting, 20}, {IT_STRING|IT_CVAR, NULL, "Dynamic lighting", &cv_gldynamiclighting, 20},
{IT_STRING|IT_CVAR, NULL, "Static lighting", &cv_grstaticlighting, 30}, {IT_STRING|IT_CVAR, NULL, "Static lighting", &cv_glstaticlighting, 30},
}; };
#endif // ALAM_LIGHTING #endif // ALAM_LIGHTING
@ -1942,7 +1942,7 @@ static menu_t SP_NightsGhostDef =
static menu_t SP_MarathonDef = static menu_t SP_MarathonDef =
{ {
MTREE2(MN_SP_MAIN, MN_SP_MARATHON), MTREE2(MN_SP_MAIN, MN_SP_MARATHON),
"M_ATTACK", // temporary "M_RATHON",
sizeof(SP_MarathonMenu)/sizeof(menuitem_t), sizeof(SP_MarathonMenu)/sizeof(menuitem_t),
&MainDef, // Doesn't matter. &MainDef, // Doesn't matter.
SP_MarathonMenu, SP_MarathonMenu,
@ -10560,8 +10560,7 @@ static void M_StartMarathon(INT32 choice)
(void)choice; (void)choice;
marathontime = 0; marathontime = 0;
marathonmode = MA_RUNNING|MA_INIT; marathonmode = MA_RUNNING|MA_INIT;
if (cv_dummymarathon.value == 1) cursaveslot = (cv_dummymarathon.value == 1) ? MARATHONSLOT : 0;
cursaveslot = MARATHONSLOT;
if (!cv_dummycutscenes.value) if (!cv_dummycutscenes.value)
marathonmode |= MA_NOCUTSCENES; marathonmode |= MA_NOCUTSCENES;
if (cv_dummyloadless.value) if (cv_dummyloadless.value)
@ -10706,7 +10705,7 @@ void M_DrawMarathon(void)
recatkdrawtimer -= (10*TICRATE); recatkdrawtimer -= (10*TICRATE);
} }
//M_DrawMenuTitle(); M_DrawMenuTitle();
// draw menu (everything else goes on top of it) // draw menu (everything else goes on top of it)
// Sadly we can't just use generic mode menus because we need some extra hacks // Sadly we can't just use generic mode menus because we need some extra hacks

View file

@ -162,7 +162,7 @@ consvar_t cv_zlib_memorya = {"apng_memory_level", "(Max Memory) 9", CV_SAVE, zli
consvar_t cv_zlib_levela = {"apng_compress_level", "4", CV_SAVE, zlib_level_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_zlib_levela = {"apng_compress_level", "4", CV_SAVE, zlib_level_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_zlib_strategya = {"apng_strategy", "RLE", CV_SAVE, zlib_strategy_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_zlib_strategya = {"apng_strategy", "RLE", CV_SAVE, zlib_strategy_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_zlib_window_bitsa = {"apng_window_size", "32k", CV_SAVE, zlib_window_bits_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_zlib_window_bitsa = {"apng_window_size", "32k", CV_SAVE, zlib_window_bits_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_apng_delay = {"apng_speed", "1/2x", CV_SAVE, apng_delay_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_apng_delay = {"apng_speed", "1x", CV_SAVE, apng_delay_t, NULL, 0, NULL, NULL, 0, 0, NULL};
boolean takescreenshot = false; // Take a screenshot this tic boolean takescreenshot = false; // Take a screenshot this tic

View file

@ -754,8 +754,8 @@ static INT32 AddToMasterServer(boolean firstadd)
strcpy(info->port, int2str(current_port)); strcpy(info->port, int2str(current_port));
strcpy(info->name, cv_servername.string); strcpy(info->name, cv_servername.string);
M_Memcpy(&info->room, & room, sizeof (INT32)); M_Memcpy(&info->room, & room, sizeof (INT32));
#if VERSION > 0 || SUBVERSION > 0 #ifndef DEVELOP
sprintf(info->version, "%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION); strcpy(info->version, SRB2VERSION);
#else // Trunk build, send revision info #else // Trunk build, send revision info
strcpy(info->version, GetRevisionString()); strcpy(info->version, GetRevisionString());
#endif #endif

View file

@ -5214,7 +5214,7 @@ void A_SignPlayer(mobj_t *actor)
actor->tracer->color = signcolor; actor->tracer->color = signcolor;
if (signcolor && signcolor < numskincolors) if (signcolor && signcolor < numskincolors)
signframe += (15 - skincolors[facecolor].invshade); signframe += (15 - skincolors[skincolors[signcolor].invcolor].invshade);
actor->tracer->frame = signframe; actor->tracer->frame = signframe;
} }

View file

@ -467,10 +467,22 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if ((P_MobjFlip(toucher)*toucher->momz < 0) && (elementalpierce != 1)) if ((P_MobjFlip(toucher)*toucher->momz < 0) && (elementalpierce != 1))
{ {
if (elementalpierce == 2) if (!(player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2))
P_DoBubbleBounce(player); {
else if (!(player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2)) fixed_t setmomz = -toucher->momz; // Store this, momz get changed by P_DoJump within P_DoBubbleBounce
toucher->momz = -toucher->momz;
if (elementalpierce == 2) // Reset bubblewrap, part 1
P_DoBubbleBounce(player);
toucher->momz = setmomz;
if (elementalpierce == 2) // Reset bubblewrap, part 2
{
boolean underwater = toucher->eflags & MFE_UNDERWATER;
if (underwater)
toucher->momz /= 2;
toucher->momz -= (toucher->momz/(underwater ? 8 : 4)); // Cap the height!
}
}
} }
if (player->pflags & PF_BOUNCING) if (player->pflags & PF_BOUNCING)
P_DoAbilityBounce(player, false); P_DoAbilityBounce(player, false);

View file

@ -177,6 +177,7 @@ void P_BlackOw(player_t *player);
void P_ElementalFire(player_t *player, boolean cropcircle); void P_ElementalFire(player_t *player, boolean cropcircle);
void P_SpawnSkidDust(player_t *player, fixed_t radius, boolean sound); void P_SpawnSkidDust(player_t *player, fixed_t radius, boolean sound);
void P_MovePlayer(player_t *player);
void P_DoPityCheck(player_t *player); void P_DoPityCheck(player_t *player);
void P_PlayerThink(player_t *player); void P_PlayerThink(player_t *player);
void P_PlayerAfterThink(player_t *player); void P_PlayerAfterThink(player_t *player);

View file

@ -1678,13 +1678,23 @@ static boolean PIT_CheckThing(mobj_t *thing)
&& (flipval*(*momz) < 0) // monitor is on the floor and you're going down, or on the ceiling and you're going up && (flipval*(*momz) < 0) // monitor is on the floor and you're going down, or on the ceiling and you're going up
&& (elementalpierce != 1)) // you're not piercing through the monitor... && (elementalpierce != 1)) // you're not piercing through the monitor...
{ {
if (elementalpierce == 2) if (!(player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2))
P_DoBubbleBounce(player);
else if (!(player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2))
{ {
*momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically. fixed_t setmomz = -*momz; // Store this, momz get changed by P_DoJump within P_DoBubbleBounce
if (elementalpierce == 2) // Reset bubblewrap, part 1
P_DoBubbleBounce(player);
*momz = setmomz; // Therefore, you should be thrust in the opposite direction, vertically.
if (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY) if (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY)
P_TwinSpinRejuvenate(player, player->thokitem); P_TwinSpinRejuvenate(player, player->thokitem);
if (elementalpierce == 2) // Reset bubblewrap, part 2
{
boolean underwater = tmthing->eflags & MFE_UNDERWATER;
if (underwater)
*momz /= 2;
*momz -= (*momz/(underwater ? 8 : 4)); // Cap the height!
}
} }
} }
if (!(elementalpierce == 1 && thing->flags & MF_GRENADEBOUNCE)) // prevent gold monitor clipthrough. if (!(elementalpierce == 1 && thing->flags & MF_GRENADEBOUNCE)) // prevent gold monitor clipthrough.

View file

@ -442,7 +442,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
mobj->sprite2 = spr2; mobj->sprite2 = spr2;
mobj->frame = frame|(st->frame&~FF_FRAMEMASK); mobj->frame = frame|(st->frame&~FF_FRAMEMASK);
if (mobj->color >= FIRSTSUPERCOLOR && mobj->color < numskincolors) // Super colours? Super bright! if (player->powers[pw_super] || (player->powers[pw_carry] == CR_NIGHTSMODE && (player->charflags & (SF_SUPER|SF_NONIGHTSSUPER)) == SF_SUPER)) // Super colours? Super bright!
mobj->frame |= FF_FULLBRIGHT; mobj->frame |= FF_FULLBRIGHT;
} }
// Regular sprites // Regular sprites
@ -2102,7 +2102,7 @@ void P_XYMovement(mobj_t *mo)
P_XYFriction(mo, oldx, oldy); P_XYFriction(mo, oldx, oldy);
} }
static void P_RingXYMovement(mobj_t *mo) void P_RingXYMovement(mobj_t *mo)
{ {
I_Assert(mo != NULL); I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo)); I_Assert(!P_MobjWasRemoved(mo));
@ -2111,7 +2111,7 @@ static void P_RingXYMovement(mobj_t *mo)
P_SlideMove(mo); P_SlideMove(mo);
} }
static void P_SceneryXYMovement(mobj_t *mo) void P_SceneryXYMovement(mobj_t *mo)
{ {
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
@ -2270,7 +2270,7 @@ static void P_AdjustMobjFloorZ_PolyObjs(mobj_t *mo, subsector_t *subsec)
} }
} }
static void P_RingZMovement(mobj_t *mo) void P_RingZMovement(mobj_t *mo)
{ {
I_Assert(mo != NULL); I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo)); I_Assert(!P_MobjWasRemoved(mo));
@ -2337,7 +2337,7 @@ boolean P_CheckSolidLava(ffloor_t *rover)
// P_ZMovement // P_ZMovement
// Returns false if the mobj was killed/exploded/removed, true otherwise. // Returns false if the mobj was killed/exploded/removed, true otherwise.
// //
static boolean P_ZMovement(mobj_t *mo) boolean P_ZMovement(mobj_t *mo)
{ {
fixed_t dist, delta; fixed_t dist, delta;
boolean onground; boolean onground;
@ -2891,7 +2891,7 @@ static boolean P_PlayerPolyObjectZMovement(mobj_t *mo)
return stopmovecut; return stopmovecut;
} }
static void P_PlayerZMovement(mobj_t *mo) void P_PlayerZMovement(mobj_t *mo)
{ {
boolean onground; boolean onground;
@ -3069,7 +3069,7 @@ nightsdone:
} }
} }
static boolean P_SceneryZMovement(mobj_t *mo) boolean P_SceneryZMovement(mobj_t *mo)
{ {
// Intercept the stupid 'fall through 3dfloors' bug // Intercept the stupid 'fall through 3dfloors' bug
if (mo->subsector->sector->ffloors) if (mo->subsector->sector->ffloors)

View file

@ -471,6 +471,12 @@ void P_NullPrecipThinker(precipmobj_t *mobj);
void P_RemovePrecipMobj(precipmobj_t *mobj); void P_RemovePrecipMobj(precipmobj_t *mobj);
void P_SetScale(mobj_t *mobj, fixed_t newscale); void P_SetScale(mobj_t *mobj, fixed_t newscale);
void P_XYMovement(mobj_t *mo); void P_XYMovement(mobj_t *mo);
void P_RingXYMovement(mobj_t *mo);
void P_SceneryXYMovement(mobj_t *mo);
boolean P_ZMovement(mobj_t *mo);
void P_RingZMovement(mobj_t *mo);
boolean P_SceneryZMovement(mobj_t *mo);
void P_PlayerZMovement(mobj_t *mo);
void P_EmeraldManager(void); void P_EmeraldManager(void);
extern INT32 modulothing; extern INT32 modulothing;

View file

@ -356,8 +356,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->mustrack = 0; mapheaderinfo[num]->mustrack = 0;
mapheaderinfo[num]->muspos = 0; mapheaderinfo[num]->muspos = 0;
mapheaderinfo[num]->musinterfadeout = 0; mapheaderinfo[num]->musinterfadeout = 0;
mapheaderinfo[num]->musintername[0] = '\0'; mapheaderinfo[num]->musintername[0] = 0;
mapheaderinfo[num]->muspostbossname[6] = 0; mapheaderinfo[num]->muspostbossname[0] = 0;
mapheaderinfo[num]->muspostbosstrack = 0; mapheaderinfo[num]->muspostbosstrack = 0;
mapheaderinfo[num]->muspostbosspos = 0; mapheaderinfo[num]->muspostbosspos = 0;
mapheaderinfo[num]->muspostbossfadein = 0; mapheaderinfo[num]->muspostbossfadein = 0;
@ -1002,17 +1002,6 @@ static void P_InitializeSector(sector_t *ss)
ss->extra_colormap = NULL; ss->extra_colormap = NULL;
#ifdef HWRENDER // ----- for special tricks with HW renderer -----
ss->pseudoSector = false;
ss->virtualFloor = false;
ss->virtualFloorheight = 0;
ss->virtualCeiling = false;
ss->virtualCeilingheight = 0;
ss->sectorLines = NULL;
ss->stackList = NULL;
ss->lineoutLength = -1.0l;
#endif // ----- end special tricks -----
ss->gravity = NULL; ss->gravity = NULL;
ss->verticalflip = false; ss->verticalflip = false;
ss->flags = SF_FLIPSPECIAL_FLOOR; ss->flags = SF_FLIPSPECIAL_FLOOR;
@ -3774,7 +3763,7 @@ boolean P_LoadLevel(boolean fromnetsave)
if (!lastmaploaded) // Start a new game? if (!lastmaploaded) // Start a new game?
{ {
// I'd love to do this in the menu code instead of here, but everything's a mess and I can't guarantee saving proper player struct info before the first act's started. You could probably refactor it, but it'd be a lot of effort. Easier to just work off known good code. ~toast 22/06/2020 // I'd love to do this in the menu code instead of here, but everything's a mess and I can't guarantee saving proper player struct info before the first act's started. You could probably refactor it, but it'd be a lot of effort. Easier to just work off known good code. ~toast 22/06/2020
if (!(ultimatemode || netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking) if (!(ultimatemode || netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking || marathonmode)
&& (!modifiedgame || savemoddata) && cursaveslot > 0) && (!modifiedgame || savemoddata) && cursaveslot > 0)
G_SaveGame((UINT32)cursaveslot, gamemap); G_SaveGame((UINT32)cursaveslot, gamemap);
// If you're looking for saving sp file progression (distinct from G_SaveGameOver), check G_DoCompleted. // If you're looking for saving sp file progression (distinct from G_SaveGameOver), check G_DoCompleted.
@ -3832,8 +3821,6 @@ void HWR_SetupLevel(void)
HWR_ResetLights(); HWR_ResetLights();
#endif #endif
// Correct missing sidedefs & deep water trick
HWR_CorrectSWTricks();
HWR_CreatePlanePolygons((INT32)numnodes - 1); HWR_CreatePlanePolygons((INT32)numnodes - 1);
} }
#endif #endif

View file

@ -4863,7 +4863,7 @@ void P_DoBubbleBounce(player_t *player)
player->pflags |= PF_THOKKED; player->pflags |= PF_THOKKED;
player->pflags &= ~PF_STARTJUMP; player->pflags &= ~PF_STARTJUMP;
player->secondjump = UINT8_MAX; player->secondjump = UINT8_MAX;
player->mo->momz = FixedMul(player->mo->momz, 5*FRACUNIT/4); player->mo->momz = FixedMul(player->mo->momz, 11*FRACUNIT/8);
} }
// //
@ -5112,15 +5112,19 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
boolean elem = ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL); boolean elem = ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL);
player->pflags |= PF_THOKKED|PF_SHIELDABILITY; player->pflags |= PF_THOKKED|PF_SHIELDABILITY;
if (elem) if (elem)
{
player->mo->momx = player->mo->momy = 0;
S_StartSound(player->mo, sfx_s3k43); S_StartSound(player->mo, sfx_s3k43);
}
else else
{ {
player->mo->momx -= (player->mo->momx/3);
player->mo->momy -= (player->mo->momy/3);
player->pflags &= ~PF_NOJUMPDAMAGE; player->pflags &= ~PF_NOJUMPDAMAGE;
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
S_StartSound(player->mo, sfx_s3k44); S_StartSound(player->mo, sfx_s3k44);
} }
player->secondjump = 0; player->secondjump = 0;
player->mo->momx = player->mo->momy = 0;
P_SetObjectMomZ(player->mo, -24*FRACUNIT, false); P_SetObjectMomZ(player->mo, -24*FRACUNIT, false);
break; break;
} }
@ -7885,7 +7889,7 @@ static void P_SkidStuff(player_t *player)
// //
// P_MovePlayer // P_MovePlayer
static void P_MovePlayer(player_t *player) void P_MovePlayer(player_t *player)
{ {
ticcmd_t *cmd; ticcmd_t *cmd;
INT32 i; INT32 i;
@ -10042,7 +10046,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (camorbit) //Sev here, I'm guessing this is where orbital cam lives if (camorbit) //Sev here, I'm guessing this is where orbital cam lives
{ {
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl && !cv_grshearing.value) if (rendermode == render_opengl && !cv_glshearing.value)
distxy = FixedMul(dist, FINECOSINE((focusaiming>>ANGLETOFINESHIFT) & FINEMASK)); distxy = FixedMul(dist, FINECOSINE((focusaiming>>ANGLETOFINESHIFT) & FINEMASK));
else else
#endif #endif

View file

@ -56,6 +56,8 @@ size_t flatmemory, spritememory, texturememory;
INT16 color8to16[256]; // remap color index to highcolor rgb value INT16 color8to16[256]; // remap color index to highcolor rgb value
INT16 *hicolormaps; // test a 32k colormap remaps high -> high INT16 *hicolormaps; // test a 32k colormap remaps high -> high
// Blends two pixels together, using the equation
// that matches the specified alpha style.
UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha) UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha)
{ {
RGBA_t output; RGBA_t output;
@ -74,7 +76,13 @@ UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alph
// if the background pixel is empty, // if the background pixel is empty,
// match software and don't blend anything // match software and don't blend anything
if (!background.s.alpha) if (!background.s.alpha)
output.s.alpha = 0; {
// ...unless the foreground pixel ISN'T actually translucent.
if (alpha == 0xFF)
output.rgba = foreground.rgba;
else
output.rgba = 0;
}
else else
{ {
UINT8 beta = (0xFF - alpha); UINT8 beta = (0xFF - alpha);
@ -131,18 +139,46 @@ UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alph
return 0; return 0;
} }
UINT8 ASTBlendPixel_8bpp(UINT8 background, UINT8 foreground, int style, UINT8 alpha) INT32 ASTTextureBlendingThreshold[2] = {255/11, (10*255/11)};
// Blends a pixel for a texture patch.
UINT32 ASTBlendTexturePixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha)
{ {
// Alpha style set to translucent? // Alpha style set to translucent?
if (style == AST_TRANSLUCENT) if (style == AST_TRANSLUCENT)
{ {
// Is the alpha small enough for translucency? // Is the alpha small enough for translucency?
if (alpha <= (10*255/11)) if (alpha <= ASTTextureBlendingThreshold[1])
{
// Is the patch way too translucent? Don't blend then.
if (alpha < ASTTextureBlendingThreshold[0])
return background.rgba;
return ASTBlendPixel(background, foreground, style, alpha);
}
else // just copy the pixel
return foreground.rgba;
}
else
return ASTBlendPixel(background, foreground, style, alpha);
}
// Blends two palette indexes for a texture patch, then
// finds the nearest palette index from the blended output.
UINT8 ASTBlendPaletteIndexes(UINT8 background, UINT8 foreground, int style, UINT8 alpha)
{
// Alpha style set to translucent?
if (style == AST_TRANSLUCENT)
{
// Is the alpha small enough for translucency?
if (alpha <= ASTTextureBlendingThreshold[1])
{ {
UINT8 *mytransmap; UINT8 *mytransmap;
// Is the patch way too translucent? Don't blend then. // Is the patch way too translucent? Don't blend then.
if (alpha < 255/11) if (alpha < ASTTextureBlendingThreshold[0])
return background; return background;
// The equation's not exact but it works as intended. I'll call it a day for now. // The equation's not exact but it works as intended. I'll call it a day for now.
mytransmap = transtables + ((8*(alpha) + 255/8)/(255 - 255/11) << FF_TRANSSHIFT); mytransmap = transtables + ((8*(alpha) + 255/8)/(255 - 255/11) << FF_TRANSSHIFT);
if (background != 0xFF) if (background != 0xFF)

View file

@ -34,7 +34,10 @@ typedef struct
enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY}; enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY};
UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha); UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha);
UINT8 ASTBlendPixel_8bpp(UINT8 background, UINT8 foreground, int style, UINT8 alpha); UINT32 ASTBlendTexturePixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha);
UINT8 ASTBlendPaletteIndexes(UINT8 background, UINT8 foreground, int style, UINT8 alpha);
extern INT32 ASTTextureBlendingThreshold[2];
extern INT16 color8to16[256]; // remap color index to highcolor extern INT16 color8to16[256]; // remap color index to highcolor
extern INT16 *hicolormaps; // remap high colors to high colors.. extern INT16 *hicolormaps; // remap high colors to high colors..

View file

@ -221,20 +221,6 @@ typedef struct r_lightlist_s
INT32 lightnum; INT32 lightnum;
} r_lightlist_t; } r_lightlist_t;
// ----- for special tricks with HW renderer -----
//
// For creating a chain with the lines around a sector
//
typedef struct linechain_s
{
struct line_s *line;
struct linechain_s *next;
} linechain_t;
// ----- end special tricks -----
// Slopes // Slopes
typedef enum { typedef enum {
SL_NOPHYSICS = 1, /// This plane will have no physics applied besides the positioning. SL_NOPHYSICS = 1, /// This plane will have no physics applied besides the positioning.
@ -348,17 +334,6 @@ typedef struct sector_s
// per-sector colormaps! // per-sector colormaps!
extracolormap_t *extra_colormap; extracolormap_t *extra_colormap;
#ifdef HWRENDER // ----- for special tricks with HW renderer -----
boolean pseudoSector;
boolean virtualFloor;
fixed_t virtualFloorheight;
boolean virtualCeiling;
fixed_t virtualCeilingheight;
linechain_t *sectorLines;
struct sector_s **stackList;
double lineoutLength;
#endif // ----- end special tricks -----
// This points to the master's floorheight, so it can be changed in realtime! // This points to the master's floorheight, so it can be changed in realtime!
fixed_t *gravity; // per-sector gravity fixed_t *gravity; // per-sector gravity
boolean verticalflip; // If gravity < 0, then allow flipped physics boolean verticalflip; // If gravity < 0, then allow flipped physics

View file

@ -134,6 +134,7 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
#define NUM_PALETTE_ENTRIES 256 #define NUM_PALETTE_ENTRIES 256
static UINT8** translationtablecache[MAXSKINS + 7] = {NULL}; static UINT8** translationtablecache[MAXSKINS + 7] = {NULL};
UINT8 skincolor_modified[MAXSKINCOLORS];
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1]; CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
@ -362,6 +363,7 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolornum_t color, UINT8 flags
{ {
UINT8* ret; UINT8* ret;
INT32 skintableindex; INT32 skintableindex;
INT32 i;
// Adjust if we want the default colormap // Adjust if we want the default colormap
switch (skinnum) switch (skinnum)
@ -385,6 +387,15 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolornum_t color, UINT8 flags
// Get colormap // Get colormap
ret = translationtablecache[skintableindex][color]; ret = translationtablecache[skintableindex][color];
// Rebuild the cache if necessary
if (skincolor_modified[color])
{
for (i = 0; i < (INT32)(sizeof(translationtablecache) / sizeof(translationtablecache[0])); i++)
if (translationtablecache[i] && translationtablecache[i][color])
R_GenerateTranslationColormap(translationtablecache[i][color], i>=MAXSKINS ? MAXSKINS-i-1 : i, color);
skincolor_modified[color] = false;
}
} }
else ret = NULL; else ret = NULL;
@ -427,12 +438,12 @@ UINT16 R_GetColorByName(const char *name)
for (color = 1; color < numskincolors; color++) for (color = 1; color < numskincolors; color++)
if (!stricmp(skincolors[color].name, name)) if (!stricmp(skincolors[color].name, name))
return color; return color;
return SKINCOLOR_GREEN; return SKINCOLOR_NONE;
} }
UINT16 R_GetSuperColorByName(const char *name) UINT16 R_GetSuperColorByName(const char *name)
{ {
UINT16 i, color = SKINCOLOR_SUPERGOLD1; UINT16 i, color = SKINCOLOR_NONE;
char *realname = Z_Malloc(MAXCOLORNAME+1, PU_STATIC, NULL); char *realname = Z_Malloc(MAXCOLORNAME+1, PU_STATIC, NULL);
snprintf(realname, MAXCOLORNAME+1, "Super %s 1", name); snprintf(realname, MAXCOLORNAME+1, "Super %s 1", name);
for (i = 1; i < numskincolors; i++) for (i = 1; i < numskincolors; i++)

View file

@ -117,6 +117,9 @@ void R_FlushTranslationColormapCache(void);
UINT16 R_GetColorByName(const char *name); UINT16 R_GetColorByName(const char *name);
UINT16 R_GetSuperColorByName(const char *name); UINT16 R_GetSuperColorByName(const char *name);
// Color ramp modification should force a recache
extern UINT8 skincolor_modified[];
// Custom player skin translation // Custom player skin translation
void R_InitViewBuffer(INT32 width, INT32 height); void R_InitViewBuffer(INT32 width, INT32 height);
void R_InitViewBorder(void); void R_InitViewBorder(void);

View file

@ -1064,7 +1064,7 @@ static void R_SetupFreelook(void)
// (lmps, network and use F12...) // (lmps, network and use F12...)
if (rendermode == render_soft if (rendermode == render_soft
#ifdef HWRENDER #ifdef HWRENDER
|| cv_grshearing.value || cv_glshearing.value
#endif #endif
) )
{ {

View file

@ -1695,10 +1695,10 @@ void R_FreeSingleRotSprite(spritedef_t *spritedef)
} }
if (grPatch->mipmap) if (grPatch->mipmap)
{ {
if (grPatch->mipmap->grInfo.data) if (grPatch->mipmap->data)
{ {
Z_Free(grPatch->mipmap->grInfo.data); Z_Free(grPatch->mipmap->data);
grPatch->mipmap->grInfo.data = NULL; grPatch->mipmap->data = NULL;
} }
Z_Free(grPatch->mipmap); Z_Free(grPatch->mipmap);
grPatch->mipmap = NULL; grPatch->mipmap = NULL;

View file

@ -464,12 +464,19 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value)
GETINT(contangle) GETINT(contangle)
#undef GETINT #undef GETINT
#define GETSKINCOLOR(field) else if (!stricmp(stoken, #field)) skin->field = R_GetColorByName(value); #define GETSKINCOLOR(field) else if (!stricmp(stoken, #field)) \
{ \
UINT16 color = R_GetColorByName(value); \
skin->field = (color ? color : SKINCOLOR_GREEN); \
}
GETSKINCOLOR(prefcolor) GETSKINCOLOR(prefcolor)
GETSKINCOLOR(prefoppositecolor) GETSKINCOLOR(prefoppositecolor)
#undef GETSKINCOLOR #undef GETSKINCOLOR
else if (!stricmp(stoken, "supercolor")) else if (!stricmp(stoken, "supercolor"))
skin->supercolor = R_GetSuperColorByName(value); {
UINT16 color = R_GetSuperColorByName(value);
skin->supercolor = (color ? color : SKINCOLOR_SUPERGOLD1);
}
#define GETFLOAT(field) else if (!stricmp(stoken, #field)) skin->field = FLOAT_TO_FIXED(atof(value)); #define GETFLOAT(field) else if (!stricmp(stoken, #field)) skin->field = FLOAT_TO_FIXED(atof(value));
GETFLOAT(jumpfactor) GETFLOAT(jumpfactor)

View file

@ -67,6 +67,16 @@ static struct {
} *tidcache = NULL; } *tidcache = NULL;
static INT32 tidcachelen = 0; static INT32 tidcachelen = 0;
//
// MAPTEXTURE_T CACHING
// When a texture is first needed, it counts the number of composite columns
// required in the texture and allocates space for a column directory and
// any new columns.
// The directory will simply point inside other patches if there is only one
// patch in a given column, but any columns with multiple patches will have
// new column_ts generated.
//
// //
// R_DrawColumnInCache // R_DrawColumnInCache
// Clip and draw a column from a patch into a cached post. // Clip and draw a column from a patch into a cached post.
@ -188,7 +198,7 @@ static inline void R_DrawBlendColumnInCache(column_t *patch, UINT8 *cache, texpa
{ {
for (; dest < cache + position + count; source++, dest++) for (; dest < cache + position + count; source++, dest++)
if (*source != 0xFF) if (*source != 0xFF)
*dest = ASTBlendPixel_8bpp(*dest, *source, originPatch->style, originPatch->alpha); *dest = ASTBlendPaletteIndexes(*dest, *source, originPatch->style, originPatch->alpha);
} }
patch = (column_t *)((UINT8 *)patch + patch->length + 4); patch = (column_t *)((UINT8 *)patch + patch->length + 4);
@ -232,7 +242,7 @@ static inline void R_DrawBlendFlippedColumnInCache(column_t *patch, UINT8 *cache
{ {
for (; dest < cache + position + count; --source, dest++) for (; dest < cache + position + count; --source, dest++)
if (*source != 0xFF) if (*source != 0xFF)
*dest = ASTBlendPixel_8bpp(*dest, *source, originPatch->style, originPatch->alpha); *dest = ASTBlendPaletteIndexes(*dest, *source, originPatch->style, originPatch->alpha);
} }
patch = (column_t *)((UINT8 *)patch + patch->length + 4); patch = (column_t *)((UINT8 *)patch + patch->length + 4);

View file

@ -1,6 +1,10 @@
# Declare SDL2 interface sources # Declare SDL2 interface sources
set(SRB2_CONFIG_SDL2_USEMIXER ON CACHE BOOL "Use SDL2_mixer or regular sdl sound") if(NOT ${SRB2_CONFIG_HAVE_MIXERX})
set(SRB2_CONFIG_SDL2_USEMIXER ON CACHE BOOL "Use SDL2_mixer or regular sdl sound")
else()
set(SRB2_CONFIG_SDL2_USEMIXER OFF)
endif()
if(${SRB2_CONFIG_SDL2_USEMIXER}) if(${SRB2_CONFIG_SDL2_USEMIXER})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
@ -22,6 +26,8 @@ if(${SRB2_CONFIG_SDL2_USEMIXER})
message(WARNING "You specified that SDL2_mixer is available, but it was not found. Falling back to sdl sound.") message(WARNING "You specified that SDL2_mixer is available, but it was not found. Falling back to sdl sound.")
set(SRB2_SDL2_SOUNDIMPL sdl_sound.c) set(SRB2_SDL2_SOUNDIMPL sdl_sound.c)
endif() endif()
elseif(${MIXERX_FOUND})
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
else() else()
set(SRB2_SDL2_SOUNDIMPL sdl_sound.c) set(SRB2_SDL2_SOUNDIMPL sdl_sound.c)
endif() endif()
@ -156,6 +162,7 @@ if(${SDL2_FOUND})
SDL2_mixer SDL2_mixer
${GME_LIBRARIES} ${GME_LIBRARIES}
${OPENMPT_LIBRARIES} ${OPENMPT_LIBRARIES}
${MIXERX_LIBRARIES}
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
@ -167,6 +174,7 @@ if(${SDL2_FOUND})
${SDL2_MIXER_LIBRARIES} ${SDL2_MIXER_LIBRARIES}
${GME_LIBRARIES} ${GME_LIBRARIES}
${OPENMPT_LIBRARIES} ${OPENMPT_LIBRARIES}
${MIXERX_LIBRARIES}
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
@ -247,27 +255,32 @@ if(${SDL2_FOUND})
${SDL2_MIXER_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS}
${GME_INCLUDE_DIRS} ${GME_INCLUDE_DIRS}
${OPENMPT_INCLUDE_DIRS} ${OPENMPT_INCLUDE_DIRS}
${MIXERX_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS}
) )
if(${SRB2_HAVE_MIXER}) if((${SRB2_HAVE_MIXER}) OR (${SRB2_HAVE_MIXERX}))
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
endif() endif()
target_compile_definitions(SRB2SDL2 PRIVATE target_compile_definitions(SRB2SDL2 PRIVATE
-DHAVE_SDL -DDDIRECTFULLSCREEN -DHAVE_SDL
) )
## strip debug symbols into separate file when using gcc ## strip debug symbols into separate file when using gcc.
if(CMAKE_COMPILER_IS_GNUCC) ## to be consistent with Makefile, don't generate for OS X.
if(${CMAKE_BUILD_TYPE} MATCHES Debug) if((CMAKE_COMPILER_IS_GNUCC) AND NOT (${CMAKE_SYSTEM} MATCHES Darwin))
if((${CMAKE_BUILD_TYPE} MATCHES Debug) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
set(OBJCOPY_ONLY_KEEP_DEBUG "--only-keep-debug")
endif()
message(STATUS "Will make separate debug symbols in *.debug") message(STATUS "Will make separate debug symbols in *.debug")
add_custom_command(TARGET SRB2SDL2 POST_BUILD add_custom_command(TARGET SRB2SDL2 POST_BUILD
COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug COMMAND ${OBJCOPY} ${OBJCOPY_ONLY_KEEP_DEBUG} $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2> COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2>
COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE_NAME:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2> COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
) )
endif() endif()
endif() endif()
@ -281,6 +294,15 @@ if(${SDL2_FOUND})
install(TARGETS SRB2SDL2 SRB2SDL2 install(TARGETS SRB2SDL2 SRB2SDL2
RUNTIME DESTINATION . RUNTIME DESTINATION .
) )
if ((${CMAKE_BUILD_TYPE} MATCHES Debug) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
set(SRB2_DEBUG_INSTALL OFF CACHE BOOL "Insert *.debug file into the install directory or package.")
if (${SRB2_DEBUG_INSTALL})
install(FILES $<TARGET_FILE:SRB2SDL2>.debug
DESTINATION .
OPTIONAL
)
endif()
endif()
endif() endif()
if(${CMAKE_SYSTEM} MATCHES Windows) if(${CMAKE_SYSTEM} MATCHES Windows)
@ -294,6 +316,7 @@ if(${SDL2_FOUND})
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/bin HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/bin
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/bin HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/bin
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86_64/mingw HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86_64/mingw
HINTS ${CMAKE_SOURCE_DIR}/libs/SDLMixerX/x86_64-w64-mingw32/bin
) )
else() else()
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}" find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
@ -301,6 +324,7 @@ if(${SDL2_FOUND})
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/bin HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/bin
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/bin HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/bin
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86/mingw HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86/mingw
HINTS ${CMAKE_SOURCE_DIR}/libs/SDLMixerX/i686-w64-mingw32/bin
) )
endif() endif()
else() else()
@ -310,6 +334,7 @@ if(${SDL2_FOUND})
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x64 HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x64
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x64 HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x64
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86_64/mingw HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86_64/mingw
HINTS ${CMAKE_SOURCE_DIR}/libs/SDLMixerX/x86_64-w64-mingw32/bin
) )
else() else()
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}" find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
@ -317,6 +342,7 @@ if(${SDL2_FOUND})
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x86 HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x86
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x86 HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x86
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86/mingw HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86/mingw
HINTS ${CMAKE_SOURCE_DIR}/libs/SDLMixerX/i686-w64-mingw32/bin
) )
endif() endif()
endif() endif()
@ -340,6 +366,12 @@ if(${SDL2_FOUND})
if(${SRB2_CONFIG_HAVE_OPENMPT}) if(${SRB2_CONFIG_HAVE_OPENMPT})
getwinlib(libopenmpt "libopenmpt.dll") getwinlib(libopenmpt "libopenmpt.dll")
endif() endif()
if(${SRB2_CONFIG_HAVE_MIXERX})
getwinlib(SDL2_mixer_ext "SDL2_mixer_ext.dll")
getwinlib(libfluidsynth-2 "libfluidsynth-2.dll")
getwinlib(libgcc_s_sjlj-1 "libgcc_s_sjlj-1.dll")
getwinlib(libstdc++-6 "libstdc++-6.dll")
endif()
install(PROGRAMS install(PROGRAMS
${win_extra_dll_list} ${win_extra_dll_list}

View file

@ -226,7 +226,6 @@
<ClInclude Include="..\hardware\hw_defs.h" /> <ClInclude Include="..\hardware\hw_defs.h" />
<ClInclude Include="..\hardware\hw_dll.h" /> <ClInclude Include="..\hardware\hw_dll.h" />
<ClInclude Include="..\hardware\hw_drv.h" /> <ClInclude Include="..\hardware\hw_drv.h" />
<ClInclude Include="..\hardware\hw_glide.h" />
<ClInclude Include="..\hardware\hw_glob.h" /> <ClInclude Include="..\hardware\hw_glob.h" />
<ClInclude Include="..\hardware\hw_light.h" /> <ClInclude Include="..\hardware\hw_light.h" />
<ClInclude Include="..\hardware\hw_main.h" /> <ClInclude Include="..\hardware\hw_main.h" />
@ -383,7 +382,6 @@
<ClCompile Include="..\hardware\hw_md2load.c" /> <ClCompile Include="..\hardware\hw_md2load.c" />
<ClCompile Include="..\hardware\hw_md3load.c" /> <ClCompile Include="..\hardware\hw_md3load.c" />
<ClCompile Include="..\hardware\hw_model.c" /> <ClCompile Include="..\hardware\hw_model.c" />
<ClCompile Include="..\hardware\hw_trick.c" />
<ClCompile Include="..\hardware\r_opengl\r_opengl.c" /> <ClCompile Include="..\hardware\r_opengl\r_opengl.c" />
<ClCompile Include="..\hardware\u_list.c" /> <ClCompile Include="..\hardware\u_list.c" />
<ClCompile Include="..\hu_stuff.c" /> <ClCompile Include="..\hu_stuff.c" />

View file

@ -237,9 +237,6 @@
<ClInclude Include="..\hardware\hw_drv.h"> <ClInclude Include="..\hardware\hw_drv.h">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\hardware\hw_glide.h">
<Filter>Hw_Hardware</Filter>
</ClInclude>
<ClInclude Include="..\hardware\hw_glob.h"> <ClInclude Include="..\hardware\hw_glob.h">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClInclude> </ClInclude>
@ -675,9 +672,6 @@
<ClCompile Include="..\hardware\hw_model.c"> <ClCompile Include="..\hardware\hw_model.c">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\hardware\hw_trick.c">
<Filter>Hw_Hardware</Filter>
</ClCompile>
<ClCompile Include="..\hardware\u_list.c"> <ClCompile Include="..\hardware\u_list.c">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClCompile> </ClCompile>

View file

@ -2410,10 +2410,6 @@
RelativePath="..\hardware\hw_drv.h" RelativePath="..\hardware\hw_drv.h"
> >
</File> </File>
<File
RelativePath="..\hardware\hw_glide.h"
>
</File>
<File <File
RelativePath="..\hardware\hw_glob.h" RelativePath="..\hardware\hw_glob.h"
> >
@ -2550,46 +2546,6 @@
RelativePath="..\hardware\hw_md2.h" RelativePath="..\hardware\hw_md2.h"
> >
</File> </File>
<File
RelativePath="..\hardware\hw_trick.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File <File
RelativePath="..\hardware\hws_data.h" RelativePath="..\hardware\hws_data.h"
> >

View file

@ -576,10 +576,6 @@ SOURCE=..\hardware\hw_drv.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\hardware\hw_glide.h
# End Source File
# Begin Source File
SOURCE=..\hardware\hw_glob.h SOURCE=..\hardware\hw_glob.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -608,10 +604,6 @@ SOURCE=..\hardware\hw_md2.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\hardware\hw_trick.c
# End Source File
# Begin Source File
SOURCE=..\hardware\hws_data.h SOURCE=..\hardware\hws_data.h
# End Source File # End Source File
# End Group # End Group

View file

@ -1064,13 +1064,6 @@
path = ../../hardware/hw_drv.h; path = ../../hardware/hw_drv.h;
refType = 2; refType = 2;
}; };
8417773B085A106C000C01D8 = {
fileEncoding = 30;
isa = PBXFileReference;
name = hw_glide.h;
path = ../../hardware/hw_glide.h;
refType = 2;
};
8417773C085A106C000C01D8 = { 8417773C085A106C000C01D8 = {
fileEncoding = 30; fileEncoding = 30;
isa = PBXFileReference; isa = PBXFileReference;
@ -1120,13 +1113,6 @@
path = ../../hardware/hw_md2.h; path = ../../hardware/hw_md2.h;
refType = 2; refType = 2;
}; };
84177743085A106C000C01D8 = {
fileEncoding = 30;
isa = PBXFileReference;
name = hw_trick.c;
path = ../../hardware/hw_trick.c;
refType = 2;
};
84177744085A106C000C01D8 = { 84177744085A106C000C01D8 = {
fileEncoding = 30; fileEncoding = 30;
isa = PBXFileReference; isa = PBXFileReference;

View file

@ -19,7 +19,6 @@
1E44AE800B67CC2B00BAD059 /* hw_draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE6C0B67CC2B00BAD059 /* hw_draw.c */; }; 1E44AE800B67CC2B00BAD059 /* hw_draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE6C0B67CC2B00BAD059 /* hw_draw.c */; };
1E44AE820B67CC2B00BAD059 /* hw_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE6E0B67CC2B00BAD059 /* hw_main.c */; }; 1E44AE820B67CC2B00BAD059 /* hw_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE6E0B67CC2B00BAD059 /* hw_main.c */; };
1E44AE840B67CC2B00BAD059 /* hw_md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE700B67CC2B00BAD059 /* hw_md2.c */; }; 1E44AE840B67CC2B00BAD059 /* hw_md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE700B67CC2B00BAD059 /* hw_md2.c */; };
1E44AE860B67CC2B00BAD059 /* hw_trick.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE720B67CC2B00BAD059 /* hw_trick.c */; };
1E44AEA40B67CC8500BAD059 /* d_clisrv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */; }; 1E44AEA40B67CC8500BAD059 /* d_clisrv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */; };
1E44AEA70B67CC8500BAD059 /* d_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE900B67CC8400BAD059 /* d_main.c */; }; 1E44AEA70B67CC8500BAD059 /* d_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE900B67CC8400BAD059 /* d_main.c */; };
1E44AEA80B67CC8500BAD059 /* d_net.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE910B67CC8500BAD059 /* d_net.c */; }; 1E44AEA80B67CC8500BAD059 /* d_net.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE910B67CC8500BAD059 /* d_net.c */; };
@ -181,7 +180,6 @@
1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; }; 1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; }; 1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; }; 1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
1E44AE670B67CC2B00BAD059 /* hw_glide.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_glide.h; path = ../../hardware/hw_glide.h; sourceTree = SOURCE_ROOT; };
1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; }; 1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; }; 1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; }; 1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
@ -192,7 +190,6 @@
1E44AE6F0B67CC2B00BAD059 /* hw_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_main.h; path = ../../hardware/hw_main.h; sourceTree = SOURCE_ROOT; }; 1E44AE6F0B67CC2B00BAD059 /* hw_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_main.h; path = ../../hardware/hw_main.h; sourceTree = SOURCE_ROOT; };
1E44AE700B67CC2B00BAD059 /* hw_md2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_md2.c; path = ../../hardware/hw_md2.c; sourceTree = SOURCE_ROOT; }; 1E44AE700B67CC2B00BAD059 /* hw_md2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_md2.c; path = ../../hardware/hw_md2.c; sourceTree = SOURCE_ROOT; };
1E44AE710B67CC2B00BAD059 /* hw_md2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_md2.h; path = ../../hardware/hw_md2.h; sourceTree = SOURCE_ROOT; }; 1E44AE710B67CC2B00BAD059 /* hw_md2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_md2.h; path = ../../hardware/hw_md2.h; sourceTree = SOURCE_ROOT; };
1E44AE720B67CC2B00BAD059 /* hw_trick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_trick.c; path = ../../hardware/hw_trick.c; sourceTree = SOURCE_ROOT; };
1E44AE730B67CC2B00BAD059 /* hws_data.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hws_data.h; path = ../../hardware/hws_data.h; sourceTree = SOURCE_ROOT; }; 1E44AE730B67CC2B00BAD059 /* hws_data.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hws_data.h; path = ../../hardware/hws_data.h; sourceTree = SOURCE_ROOT; };
1E44AE8A0B67CC6000BAD059 /* asm_defs.inc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = asm_defs.inc; path = ../../asm_defs.inc; sourceTree = SOURCE_ROOT; }; 1E44AE8A0B67CC6000BAD059 /* asm_defs.inc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = asm_defs.inc; path = ../../asm_defs.inc; sourceTree = SOURCE_ROOT; };
1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_clisrv.c; path = ../../d_clisrv.c; sourceTree = SOURCE_ROOT; }; 1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_clisrv.c; path = ../../d_clisrv.c; sourceTree = SOURCE_ROOT; };
@ -535,7 +532,6 @@
1E44AE640B67CC2B00BAD059 /* hw_cache.c */, 1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
1E44AE650B67CC2B00BAD059 /* hw_dll.h */, 1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
1E44AE660B67CC2B00BAD059 /* hw_drv.h */, 1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
1E44AE670B67CC2B00BAD059 /* hw_glide.h */,
1E44AE680B67CC2B00BAD059 /* hw_light.c */, 1E44AE680B67CC2B00BAD059 /* hw_light.c */,
1E44AE690B67CC2B00BAD059 /* hw_light.h */, 1E44AE690B67CC2B00BAD059 /* hw_light.h */,
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */, 1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
@ -546,7 +542,6 @@
1E44AE6F0B67CC2B00BAD059 /* hw_main.h */, 1E44AE6F0B67CC2B00BAD059 /* hw_main.h */,
1E44AE700B67CC2B00BAD059 /* hw_md2.c */, 1E44AE700B67CC2B00BAD059 /* hw_md2.c */,
1E44AE710B67CC2B00BAD059 /* hw_md2.h */, 1E44AE710B67CC2B00BAD059 /* hw_md2.h */,
1E44AE720B67CC2B00BAD059 /* hw_trick.c */,
1E44AE730B67CC2B00BAD059 /* hws_data.h */, 1E44AE730B67CC2B00BAD059 /* hws_data.h */,
); );
name = Hw_Hardware; name = Hw_Hardware;
@ -1080,7 +1075,6 @@
1E44AE800B67CC2B00BAD059 /* hw_draw.c in Sources */, 1E44AE800B67CC2B00BAD059 /* hw_draw.c in Sources */,
1E44AE820B67CC2B00BAD059 /* hw_main.c in Sources */, 1E44AE820B67CC2B00BAD059 /* hw_main.c in Sources */,
1E44AE840B67CC2B00BAD059 /* hw_md2.c in Sources */, 1E44AE840B67CC2B00BAD059 /* hw_md2.c in Sources */,
1E44AE860B67CC2B00BAD059 /* hw_trick.c in Sources */,
1E44AEA40B67CC8500BAD059 /* d_clisrv.c in Sources */, 1E44AEA40B67CC8500BAD059 /* d_clisrv.c in Sources */,
1E44AEA70B67CC8500BAD059 /* d_main.c in Sources */, 1E44AEA70B67CC8500BAD059 /* d_main.c in Sources */,
1E44AEA80B67CC8500BAD059 /* d_net.c in Sources */, 1E44AEA80B67CC8500BAD059 /* d_net.c in Sources */,
@ -1219,7 +1213,7 @@
C01FCF4B08A954540054247B /* Debug */ = { C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CURRENT_PROJECT_VERSION = 2.2.4; CURRENT_PROJECT_VERSION = 2.2.6;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)", "$(inherited)",
NORMALSRB2, NORMALSRB2,
@ -1231,7 +1225,7 @@
C01FCF4C08A954540054247B /* Release */ = { C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CURRENT_PROJECT_VERSION = 2.2.4; CURRENT_PROJECT_VERSION = 2.2.6;
GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (

View file

@ -240,8 +240,8 @@ void ST_LoadGraphics(void)
int i; int i;
// SRB2 border patch // SRB2 border patch
st_borderpatchnum = W_GetNumForName("GFZFLR01"); // st_borderpatchnum = W_GetNumForName("GFZFLR01");
scr_borderpatch = W_CacheLumpNum(st_borderpatchnum, PU_HUDGFX); // scr_borderpatch = W_CacheLumpNum(st_borderpatchnum, PU_HUDGFX);
// the original Doom uses 'STF' as base name for all face graphics // the original Doom uses 'STF' as base name for all face graphics
// Graue 04-08-2004: face/name graphics are now indexed by skins // Graue 04-08-2004: face/name graphics are now indexed by skins

12
src/version.h Normal file
View file

@ -0,0 +1,12 @@
#define SRB2VERSION "2.2.6"/* this must be the first line, for cmake !! */
// The Modification ID; must be obtained from a Master Server Admin ( https://mb.srb2.org/showgroups.php ).
// DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server.
// "18" is the default mod ID for version 2.2
#define MODID 18
// The Modification Version, starting from 1. Do not follow your version string for this,
// it's only for detection of the version the player is using so the MS can alert them of an update.
// Only set it higher, not lower, obviously.
// Note that we use this to help keep internal testing in check; this is why v2.2.0 is not version "1".
#define MODVERSION 47

View file

@ -1735,11 +1735,11 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
grPatch = HWR_GetCachedGLPatchPwad(wad, lump); grPatch = HWR_GetCachedGLPatchPwad(wad, lump);
if (grPatch->mipmap->grInfo.data) if (grPatch->mipmap->data)
{ {
if (tag == PU_CACHE) if (tag == PU_CACHE)
tag = PU_HWRCACHE; tag = PU_HWRCACHE;
Z_ChangeTag(grPatch->mipmap->grInfo.data, tag); Z_ChangeTag(grPatch->mipmap->data, tag);
} }
else else
{ {

View file

@ -234,7 +234,6 @@
<ClCompile Include="..\hardware\hw_md2load.c" /> <ClCompile Include="..\hardware\hw_md2load.c" />
<ClCompile Include="..\hardware\hw_md3load.c" /> <ClCompile Include="..\hardware\hw_md3load.c" />
<ClCompile Include="..\hardware\hw_model.c" /> <ClCompile Include="..\hardware\hw_model.c" />
<ClCompile Include="..\hardware\hw_trick.c" />
<ClCompile Include="..\hardware\u_list.c" /> <ClCompile Include="..\hardware\u_list.c" />
<ClCompile Include="..\hu_stuff.c" /> <ClCompile Include="..\hu_stuff.c" />
<ClCompile Include="..\info.c" /> <ClCompile Include="..\info.c" />
@ -400,7 +399,6 @@
<ClInclude Include="..\hardware\hw_defs.h" /> <ClInclude Include="..\hardware\hw_defs.h" />
<ClInclude Include="..\hardware\hw_dll.h" /> <ClInclude Include="..\hardware\hw_dll.h" />
<ClInclude Include="..\hardware\hw_drv.h" /> <ClInclude Include="..\hardware\hw_drv.h" />
<ClInclude Include="..\hardware\hw_glide.h" />
<ClInclude Include="..\hardware\hw_glob.h" /> <ClInclude Include="..\hardware\hw_glob.h" />
<ClInclude Include="..\hardware\hw_light.h" /> <ClInclude Include="..\hardware\hw_light.h" />
<ClInclude Include="..\hardware\hw_main.h" /> <ClInclude Include="..\hardware\hw_main.h" />

View file

@ -108,9 +108,6 @@
<ClCompile Include="..\hardware\hw_md2.c"> <ClCompile Include="..\hardware\hw_md2.c">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\hardware\hw_trick.c">
<Filter>Hw_Hardware</Filter>
</ClCompile>
<ClCompile Include="..\hardware\hw3sound.c"> <ClCompile Include="..\hardware\hw3sound.c">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClCompile> </ClCompile>
@ -516,9 +513,6 @@
<ClInclude Include="..\hardware\hw_drv.h"> <ClInclude Include="..\hardware\hw_drv.h">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\hardware\hw_glide.h">
<Filter>Hw_Hardware</Filter>
</ClInclude>
<ClInclude Include="..\hardware\hw_glob.h"> <ClInclude Include="..\hardware\hw_glob.h">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClInclude> </ClInclude>

View file

@ -2151,10 +2151,6 @@
RelativePath="..\hardware\hw_drv.h" RelativePath="..\hardware\hw_drv.h"
> >
</File> </File>
<File
RelativePath="..\hardware\hw_glide.h"
>
</File>
<File <File
RelativePath="..\hardware\hw_glob.h" RelativePath="..\hardware\hw_glob.h"
> >
@ -2291,46 +2287,6 @@
RelativePath="..\hardware\hw_md2.h" RelativePath="..\hardware\hw_md2.h"
> >
</File> </File>
<File
RelativePath="..\hardware\hw_trick.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File <File
RelativePath="..\hardware\hws_data.h" RelativePath="..\hardware\hws_data.h"
> >

View file

@ -535,10 +535,6 @@ SOURCE=..\hardware\hw_drv.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\hardware\hw_glide.h
# End Source File
# Begin Source File
SOURCE=..\hardware\hw_glob.h SOURCE=..\hardware\hw_glob.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -567,10 +563,6 @@ SOURCE=..\hardware\hw_md2.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\hardware\hw_trick.c
# End Source File
# Begin Source File
SOURCE=..\hardware\hws_data.h SOURCE=..\hardware\hws_data.h
# End Source File # End Source File
# End Group # End Group

View file

@ -66,8 +66,8 @@ END
#include "../doomdef.h" // Needed for version string #include "../doomdef.h" // Needed for version string
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,2,0,0 FILEVERSION 2,2,6,0
PRODUCTVERSION 2,2,0,0 PRODUCTVERSION 2,2,6,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L