Merge remote-tracking branch 'origin/next' into g_findmap-lua
This commit is contained in:
commit
6fd9e25b11
|
@ -51,8 +51,8 @@ jobs:
|
|||
- /var/cache/apt/archives
|
||||
- checkout
|
||||
- run:
|
||||
name: Compile without network support and BLUA
|
||||
command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 NO_LUA=1
|
||||
name: Compile without network support
|
||||
command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1
|
||||
- run:
|
||||
name: wipe build
|
||||
command: make -C src LINUX=1 cleandep
|
||||
|
|
|
@ -1,14 +1,34 @@
|
|||
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.
|
||||
# Version change is fine.
|
||||
project(SRB2
|
||||
VERSION 2.2.0
|
||||
VERSION ${SRB2_VERSION}
|
||||
LANGUAGES C)
|
||||
|
||||
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.")
|
||||
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(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 #####
|
||||
|
||||
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.")
|
||||
|
||||
if("${SRB2_CPACK_GENERATOR}" STREQUAL "")
|
||||
if(${CMAKE_SYSTEM} MATCHES "Windows")
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
set(SRB2_CPACK_GENERATOR "ZIP")
|
||||
elseif(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
set(SRB2_CPACK_GENERATOR "TGZ")
|
||||
elseif(${CMAKE_SYSTEM} MATCHES "Darwin")
|
||||
set(SRB2_CPACK_GENERATOR "TGZ")
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM} MATCHES "Darwin")
|
||||
set(CPACK_GENERATOR "DragNDrop")
|
||||
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_VENDOR "Sonic Team Jr." CACHE STRING "Vendor name for display purposes")
|
||||
#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_PATCH ${SRB2_VERSION_PATCH})
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
|
||||
SET(CPACK_OUTPUT_FILE_PREFIX package)
|
||||
include(CPack)
|
||||
|
|
21
appveyor.yml
21
appveyor.yml
|
@ -1,4 +1,4 @@
|
|||
version: 2.2.0.{branch}-{build}
|
||||
version: 2.2.6.{branch}-{build}
|
||||
os: MinGW
|
||||
|
||||
environment:
|
||||
|
@ -83,7 +83,14 @@ before_build:
|
|||
- ccache -V
|
||||
- ccache -s
|
||||
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
|
||||
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 NOOBJDUMP=1 %NOUPX%"
|
||||
- if defined [%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%] ( set "COMMIT=%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%" ) else ( set "COMMIT=%APPVEYOR_REPO_COMMIT%" )
|
||||
- cmd: git rev-parse --short %COMMIT%>%TMP%/gitshort.txt
|
||||
- cmd: set /P GITSHORT=<%TMP%/gitshort.txt
|
||||
# for pull requests, take the owner's name only, if this isn't the same repo of course
|
||||
- set "REPO=%APPVEYOR_REPO_BRANCH%"
|
||||
- if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [] ( if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [%APPVEYOR_REPO_NAME%] ( for /f "delims=/" %%a in ("%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%") do set "REPO=%%a-%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%" ) )
|
||||
- set "EXENAME=EXENAME=srb2win-%REPO%-%GITSHORT%.exe"
|
||||
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 NOOBJDUMP=1 %NOUPX% %EXENAME%"
|
||||
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1 GCC81=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" )
|
||||
- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"
|
||||
|
||||
|
@ -99,14 +106,12 @@ after_build:
|
|||
)
|
||||
- if [%X86_64%] == [1] ( set "CONFIGURATION=%CONFIGURATION%64" )
|
||||
- ccache -s
|
||||
- cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt
|
||||
- cmd: set /P GITSHORT=<%TMP%/gitshort.txt
|
||||
- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%-%CONFIGURATION%.7z
|
||||
- set BUILDSARCHIVE=%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%.7z
|
||||
- set BUILD_ARCHIVE=%REPO%-%GITSHORT%-%CONFIGURATION%.7z
|
||||
- set BUILDSARCHIVE=%REPO%-%CONFIGURATION%.7z
|
||||
- cmd: 7z a %BUILD_ARCHIVE% %BUILD_PATH% -xr!.gitignore
|
||||
- appveyor PushArtifact %BUILD_ARCHIVE%
|
||||
- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE%
|
||||
- appveyor PushArtifact %BUILDSARCHIVE%
|
||||
#- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE%
|
||||
#- appveyor PushArtifact %BUILDSARCHIVE%
|
||||
##############################
|
||||
# DEPLOYER SCRIPT
|
||||
##############################
|
||||
|
|
|
@ -12,6 +12,9 @@ ENDFUNCTION(PREPEND)
|
|||
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/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!
|
||||
####################
|
||||
|
@ -19,7 +22,8 @@ set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
|
|||
set(SRB2_ASSET_HASHED
|
||||
"srb2.pk3;\
|
||||
player.dta;\
|
||||
zones.pk3"
|
||||
zones.pk3;\
|
||||
patch.pk3"
|
||||
CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!"
|
||||
)
|
||||
|
||||
|
@ -42,20 +46,27 @@ endforeach()
|
|||
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
get_target_property(outname SRB2SDL2 OUTPUT_NAME)
|
||||
if(${SRB2_ASSET_INSTALL})
|
||||
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}
|
||||
DESTINATION .
|
||||
OPTIONAL
|
||||
)
|
||||
else()
|
||||
if(${SRB2_ASSET_INSTALL})
|
||||
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}
|
||||
# DESTINATION .
|
||||
# OPTIONAL
|
||||
#)
|
||||
# Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install them in their own call.
|
||||
else()
|
||||
# Always install the doc files, even in non-asset packages.
|
||||
install(FILES ${SRB2_ASSET_DOCS}
|
||||
DESTINATION .
|
||||
OPTIONAL
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
export CCACHE_CPP2=true
|
||||
exec "${RULE_LAUNCH_COMPILE}" "${CMAKE_C_COMPILER}" "$@"
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
export CCACHE_CPP2=true
|
||||
exec "${RULE_LAUNCH_COMPILE}" "${CMAKE_C_COMPILER}" "$@"
|
|
@ -1,77 +0,0 @@
|
|||
// Default lump name for new map
|
||||
defaultlumpname = "MAP01";
|
||||
//GZDB specific. Don't try to load lumps that don't exist.
|
||||
basegame = 0;
|
||||
|
||||
//Sky textures for vanilla maps
|
||||
defaultskytextures
|
||||
{
|
||||
SKY1 = "MAP01,MAP02,MAP03,MAP33,MAP50,MAP60,MAPF0,MAPM0";
|
||||
SKY2 = "MAPM7,MAPMB";
|
||||
SKY4 = "MAP04,MAP06,MAP61,MAPF6,MAPM1";
|
||||
SKY6 = "MAP05,MAP51,MAPMA";
|
||||
SKY7 = "MAPM2,MAPM5";
|
||||
SKY8 = "MAP07,MAP08,MAP09,MAP52,MAP62,MAPF1";
|
||||
SKY10 = "MAP10,MAP12,MAP53,MAP63,MAPM3";
|
||||
SKY11 = "MAP11,MAPF7";
|
||||
SKY13 = "MAP13,MAP64";
|
||||
SKY14 = "MAP14";
|
||||
SKY15 = "MAP15,MAP54";
|
||||
SKY17 = "MAP70";
|
||||
SKY20 = "MAP32,MAP55,MAP65,MAPF2,MAPF5";
|
||||
SKY21 = "MAPM4";
|
||||
SKY22 = "MAP22,MAP23,MAP25,MAP26,MAP27,MAP56,MAP66,MAPF4,MAPM6";
|
||||
SKY30 = "MAP30";
|
||||
SKY31 = "MAP31";
|
||||
SKY35 = "MAP42";
|
||||
SKY40 = "MAP41,MAP71,MAPM9";
|
||||
SKY55 = "MAPF3,MAPM8";
|
||||
SKY68 = "MAPF8";
|
||||
SKY99 = "MAP57,MAPZ0";
|
||||
SKY159 = "MAP16";
|
||||
SKY172 = "MAP40";
|
||||
SKY300 = "MAP72";
|
||||
SKY301 = "MAP73";
|
||||
}
|
||||
|
||||
// Skill levels
|
||||
skills
|
||||
{
|
||||
1 = "Normal";
|
||||
}
|
||||
|
||||
// Skins
|
||||
skins
|
||||
{
|
||||
Sonic;
|
||||
Tails;
|
||||
Knuckles;
|
||||
Amy;
|
||||
Fang;
|
||||
Metalsonic;
|
||||
}
|
||||
|
||||
// Gametypes
|
||||
gametypes
|
||||
{
|
||||
-1 = "Single Player";
|
||||
0 = "Co-op";
|
||||
1 = "Competition";
|
||||
2 = "Race";
|
||||
3 = "Match";
|
||||
4 = "Team Match";
|
||||
5 = "Tag";
|
||||
6 = "Hide and Seek";
|
||||
7 = "CTF";
|
||||
}
|
||||
|
||||
// Texture loading options
|
||||
defaultwalltexture = "GFZROCK";
|
||||
defaultfloortexture = "GFZFLR01";
|
||||
defaultceilingtexture = "F_SKY1";
|
||||
|
||||
// Default texture sets
|
||||
// (these are not required, but useful for new users)
|
||||
texturesets
|
||||
{
|
||||
}
|
|
@ -1,309 +0,0 @@
|
|||
common
|
||||
{
|
||||
// Some common settings
|
||||
|
||||
|
||||
|
||||
// Default testing parameters
|
||||
testparameters = "-file \"%AP\" \"%F\" -warp %L";
|
||||
testshortpaths = true;
|
||||
|
||||
// Action special help (mxd)
|
||||
actionspecialhelp = "https://wiki.srb2.org/wiki/Linedef_type_%K";
|
||||
|
||||
// Default nodebuilder configurations
|
||||
defaultsavecompiler = "zennode_normal";
|
||||
defaulttestcompiler = "zennode_fast";
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
generalizedsectors = true;
|
||||
|
||||
mixtexturesflats = true;
|
||||
defaulttexturescale = 1.0f;
|
||||
defaultflatscale = 1.0f;
|
||||
scaledtextureoffsets = true;
|
||||
|
||||
// Thing number for start position in 3D Mode
|
||||
start3dmode = 3328;
|
||||
|
||||
// Texture sources
|
||||
textures
|
||||
{
|
||||
include("SRB222_misc.cfg", "textures");
|
||||
}
|
||||
|
||||
// Patch sources
|
||||
patches
|
||||
{
|
||||
include("SRB222_misc.cfg", "patches");
|
||||
}
|
||||
|
||||
// Sprite sources
|
||||
sprites
|
||||
{
|
||||
include("SRB222_misc.cfg", "sprites");
|
||||
}
|
||||
|
||||
// Flat sources
|
||||
flats
|
||||
{
|
||||
include("SRB222_misc.cfg", "flats");
|
||||
}
|
||||
}
|
||||
|
||||
mapformat_doom
|
||||
{
|
||||
// The format interface handles the map data format - DoomMapSetIO for SRB2DB2, SRB2MapSetIO for Zone Builder
|
||||
formatinterface = "SRB2MapSetIO";
|
||||
|
||||
/*
|
||||
GAME DETECT PATTERN
|
||||
Used to guess the game for which a WAD file is made.
|
||||
|
||||
1 = One of these lumps must exist
|
||||
2 = None of these lumps must exist
|
||||
3 = All of these lumps must exist
|
||||
*/
|
||||
|
||||
gamedetect
|
||||
{
|
||||
EXTENDED = 2;
|
||||
|
||||
|
||||
BEHAVIOR = 2;
|
||||
|
||||
E#M# = 2;
|
||||
|
||||
MAP?? = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
MAP LUMP NAMES
|
||||
Map lumps are loaded with the map as long as they are right after each other. When the editor
|
||||
meets a lump which is not defined in this list it will ignore the map if not satisfied.
|
||||
The order of items defines the order in which lumps will be written to WAD file on save.
|
||||
To indicate the map header lump, use ~MAP
|
||||
|
||||
Legenda:
|
||||
required = Lump is required to exist.
|
||||
blindcopy = Lump will be copied along with the map blindly. (usefull for lumps Doom Builder doesn't use)
|
||||
nodebuild = The nodebuilder generates this lump.
|
||||
allowempty = The nodebuilder is allowed to leave this lump empty.
|
||||
script = This lump is a text-based script. Specify the filename of the script configuration to use.
|
||||
*/
|
||||
|
||||
maplumpnames
|
||||
{
|
||||
include("SRB222_misc.cfg", "doommaplumpnames");
|
||||
}
|
||||
|
||||
// When this is set to true, sectors with the same tag will light up when a line is highlighted
|
||||
linetagindicatesectors = true;
|
||||
|
||||
// Special linedefs
|
||||
include("SRB222_misc.cfg", "speciallinedefs");
|
||||
|
||||
// Default flags for first new thing (As far as 2.2 goes, they're empty just like in 2.1)
|
||||
defaultthingflags
|
||||
{
|
||||
}
|
||||
|
||||
// DEFAULT SECTOR BRIGHTNESS LEVELS
|
||||
sectorbrightness
|
||||
{
|
||||
include("SRB222_misc.cfg", "sectorbrightness");
|
||||
}
|
||||
|
||||
// SECTOR TYPES-----------------------------------------------------------------
|
||||
sectortypes
|
||||
{
|
||||
include("SRB222_sectors.cfg", "sectortypes");
|
||||
}
|
||||
|
||||
// GENERALISED SECTOR TYPES-----------------------------------------------------------------
|
||||
gen_sectortypes
|
||||
{
|
||||
include("SRB222_sectors.cfg", "gen_sectortypes");
|
||||
}
|
||||
|
||||
// LINEDEF FLAGS
|
||||
linedefflags
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefflags");
|
||||
}
|
||||
|
||||
// Linedef flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
linedefflagstranslation
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefflagstranslation");
|
||||
}
|
||||
|
||||
// LINEDEF ACTIVATIONS
|
||||
linedefactivations
|
||||
{
|
||||
}
|
||||
|
||||
// LINEDEF TYPES
|
||||
linedeftypes
|
||||
{
|
||||
include("SRB222_linedefs.cfg", "doom");
|
||||
}
|
||||
|
||||
// THING FLAGS
|
||||
thingflags
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingflags");
|
||||
}
|
||||
|
||||
// Thing flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
thingflagstranslation
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingflagstranslation");
|
||||
}
|
||||
|
||||
// THING FLAGS ERROR MASK
|
||||
// Mask for the thing flags which indicates the options
|
||||
// that make the same thing appear in the same modes
|
||||
thingflagsmask1 = 7; // 1 + 2 + 4
|
||||
thingflagsmask2 = 0;
|
||||
}
|
||||
|
||||
mapformat_udmf
|
||||
{
|
||||
// The format interface handles the map data format
|
||||
formatinterface = "UniversalMapSetIO";
|
||||
|
||||
// Enables support for long (> 8 chars) texture names
|
||||
// WARNING: this should only be enabled for UDMF game configurations!
|
||||
// WARNING: enabling this will make maps incompatible with Doom Builder 2 and can lead to problems in Slade 3!
|
||||
longtexturenames = false;
|
||||
|
||||
// Default nodebuilder configurations
|
||||
defaultsavecompiler = "zdbsp_udmf_normal";
|
||||
defaulttestcompiler = "zdbsp_udmf_fast";
|
||||
|
||||
engine = "srb2"; // override that so that DB2 uses the correct namespace
|
||||
|
||||
maplumpnames
|
||||
{
|
||||
include("UDMF_misc.cfg", "udmfmaplumpnames_begin");
|
||||
include("SRB222_misc.cfg", "udmfmaplumpnames");
|
||||
include("UDMF_misc.cfg", "udmfmaplumpnames_end");
|
||||
}
|
||||
|
||||
universalfields
|
||||
{
|
||||
// include("SRB222_misc.cfg", "universalfields");
|
||||
}
|
||||
|
||||
// When this is set to true, sectors with the same tag will light up when a line is highlighted
|
||||
linetagindicatesectors = false;
|
||||
|
||||
// Special linedefs
|
||||
include("SRB222_misc.cfg", "speciallinedefs_udmf");
|
||||
|
||||
// Default flags for first new thing (As far as 2.2 goes, they're empty just like in 2.1)
|
||||
defaultthingflags
|
||||
{
|
||||
}
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
||||
// SECTOR FLAGS
|
||||
sectorflags
|
||||
{
|
||||
// include("SRB222_misc.cfg", "sectorflags");
|
||||
}
|
||||
|
||||
// DEFAULT SECTOR BRIGHTNESS LEVELS
|
||||
sectorbrightness
|
||||
{
|
||||
include("SRB222_misc.cfg", "sectorbrightness");
|
||||
}
|
||||
|
||||
// SECTOR TYPES
|
||||
sectortypes
|
||||
{
|
||||
include("SRB222_sectors.cfg", "sectortypes");
|
||||
}
|
||||
|
||||
// SECTOR RENSERSTYLES
|
||||
/* sectorrenderstyles
|
||||
{
|
||||
include("SRB222_misc.cfg", "sectorrenderstyles");
|
||||
}*/
|
||||
|
||||
// LINEDEF FLAGS
|
||||
linedefflags
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefflags_udmf");
|
||||
}
|
||||
|
||||
// LINEDEF ACTIVATIONS
|
||||
linedefactivations
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefactivations_udmf");
|
||||
}
|
||||
|
||||
linedefflagstranslation
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// LINEDEF RENSERSTYLES
|
||||
linedefrenderstyles
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefrenderstyles");
|
||||
}
|
||||
|
||||
//SIDEDEF FLAGS
|
||||
/* sidedefflags
|
||||
{
|
||||
include("UDMF_misc.cfg", "sidedefflags");
|
||||
}*/
|
||||
|
||||
// THING FLAGS
|
||||
thingflags
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingflags_udmf");
|
||||
}
|
||||
|
||||
// Thing flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
thingflagstranslation
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingflagstranslation");
|
||||
}
|
||||
|
||||
// THING RENSERSTYLES
|
||||
/* thingrenderstyles
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingrenderstyles");
|
||||
}*/
|
||||
|
||||
// How to compare thing flags (for the stuck things error checker)
|
||||
/* thingflagscompare
|
||||
{
|
||||
include("UDMF_misc.cfg", "thingflagscompare");
|
||||
}*/
|
||||
|
||||
//mxd. Thing flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
thingflagstranslation
|
||||
{
|
||||
}
|
||||
|
||||
// LINEDEF TYPES
|
||||
linedeftypes
|
||||
{
|
||||
include("SRB222_linedefs.cfg", "udmf");
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,726 +0,0 @@
|
|||
linedefflags
|
||||
{
|
||||
1 = "[0] Impassable";
|
||||
2 = "[1] Block Enemies";
|
||||
4 = "[2] Double-Sided";
|
||||
8 = "[3] Upper Unpegged";
|
||||
16 = "[4] Lower Unpegged";
|
||||
32 = "[5] Slope Skew (E1)";
|
||||
64 = "[6] Not Climbable";
|
||||
128 = "[7] No Midtexture Skew (E2)";
|
||||
256 = "[8] Peg Midtexture (E3)";
|
||||
512 = "[9] Solid Midtexture (E4)";
|
||||
1024 = "[10] Repeat Midtexture (E5)";
|
||||
2048 = "[11] Netgame Only";
|
||||
4096 = "[12] No Netgame";
|
||||
8192 = "[13] Effect 6";
|
||||
16384 = "[14] Bouncy Wall";
|
||||
32768 = "[15] Transfer Line";
|
||||
}
|
||||
|
||||
|
||||
// LINEDEF ACTIVATIONS
|
||||
// Make sure these are in order from lowest value to highest value
|
||||
linedefactivations
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Linedef flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
linedefflagstranslation
|
||||
{
|
||||
1 = "blocking";
|
||||
2 = "blockmonsters";
|
||||
4 = "twosided";
|
||||
8 = "dontpegtop";
|
||||
16 = "dontpegbottom";
|
||||
32 = "skewtd";
|
||||
64 = "noclimb";
|
||||
128 = "noskew";
|
||||
256 = "midpeg";
|
||||
512 = "midsolid";
|
||||
1024 = "wrapmidtex";
|
||||
2048 = "netonly";
|
||||
4096 = "nonet";
|
||||
8192 = "effect6";
|
||||
16384 = "bouncy";
|
||||
32768 = "transfer";
|
||||
}
|
||||
|
||||
|
||||
linedefflags_udmf
|
||||
{
|
||||
blocking = "Impassable";
|
||||
blockmonsters = "Block Enemies";
|
||||
twosided = "Double-Sided";
|
||||
dontpegtop = "Upper Unpegged";
|
||||
dontpegbottom = "Lower Unpegged";
|
||||
skewtd = "Slope Skew";
|
||||
noclimb = "Not Climbable";
|
||||
noskew = "No Midtexture Skew";
|
||||
midpeg = "Peg Midtexture";
|
||||
midsolid = "Solid Midtexture";
|
||||
wrapmidtex = "Repeat Midtexture";
|
||||
// netonly = "Netgame-Only special";
|
||||
// nonet = "No netgame special";
|
||||
// effect6 = "Effect 6";
|
||||
bouncy = "Bouncy Wall";
|
||||
// transfer = "Transfer Line";
|
||||
}
|
||||
|
||||
|
||||
linedefactivations_udmf
|
||||
{
|
||||
notriggerorder = "Out of Order";
|
||||
netonly = "Netgame-Only";
|
||||
nonet = "No netgame";
|
||||
}
|
||||
|
||||
sidedefflags
|
||||
{
|
||||
clipmidtex = "Clip middle texture";
|
||||
wrapmidtex = "Wrap middle texture";
|
||||
smoothlighting = "Smooth lighting";
|
||||
nofakecontrast = "Even lighting";
|
||||
nodecals = "No decals";
|
||||
lightfog = "Use sidedef brightness on fogged walls";
|
||||
}
|
||||
|
||||
//RENDER STYLES
|
||||
thingrenderstyles
|
||||
{
|
||||
}
|
||||
|
||||
linedefrenderstyles
|
||||
{
|
||||
translucent = "Translucent";
|
||||
fog = "Fog";
|
||||
}
|
||||
|
||||
sectorrenderstyles
|
||||
{
|
||||
}
|
||||
|
||||
thingflags
|
||||
{
|
||||
1 = "[1] Extra";
|
||||
2 = "[2] Flip";
|
||||
4 = "[4] Special";
|
||||
8 = "[8] Ambush";
|
||||
}
|
||||
|
||||
// THING FLAGS
|
||||
thingflags_udmf
|
||||
{
|
||||
extra = "Extra";
|
||||
flip = "Flip";
|
||||
special = "Special";
|
||||
ambush = "Ambush";
|
||||
}
|
||||
|
||||
|
||||
// Thing flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
thingflagstranslation
|
||||
{
|
||||
1 = "extra";
|
||||
2 = "flip";
|
||||
4 = "special";
|
||||
8 = "ambush";
|
||||
}
|
||||
|
||||
|
||||
// DEFAULT SECTOR BRIGHTNESS LEVELS
|
||||
sectorbrightness
|
||||
{
|
||||
255;
|
||||
248;
|
||||
240;
|
||||
232;
|
||||
224;
|
||||
216;
|
||||
208;
|
||||
200;
|
||||
192;
|
||||
184;
|
||||
176;
|
||||
168;
|
||||
160;
|
||||
152;
|
||||
144;
|
||||
136;
|
||||
128;
|
||||
120;
|
||||
112;
|
||||
104;
|
||||
96;
|
||||
88;
|
||||
80;
|
||||
72;
|
||||
64;
|
||||
56;
|
||||
48;
|
||||
40;
|
||||
32;
|
||||
24;
|
||||
16;
|
||||
8;
|
||||
0;
|
||||
}
|
||||
|
||||
/*
|
||||
TEXTURES AND FLAT SOURCES
|
||||
This tells Doom Builder where to find the information for textures
|
||||
and flats in the IWAD file, Addition WAD file and Map WAD file.
|
||||
|
||||
Start and end lumps must be given in a structure (of which the
|
||||
key name doesnt matter) and any textures or flats in between them
|
||||
are loaded in either the textures category or flats category.
|
||||
|
||||
For textures: PNAMES, TEXTURE1 and TEXTURE2 are loaded by default.
|
||||
*/
|
||||
textures
|
||||
{
|
||||
zdoom1
|
||||
{
|
||||
start = "TX_START";
|
||||
end = "TX_END";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ADDITIONAL UNIVERSAL DOOM MAP FORMAT FIELD DEFINITIONS
|
||||
Only add fields here that Doom Builder does not edit with its own user-interface!
|
||||
The "default" field must match the UDMF specifications!
|
||||
|
||||
Field data types:
|
||||
0 = integer *
|
||||
1 = float
|
||||
2 = string
|
||||
3 = bool
|
||||
4 = linedef action (integer) *
|
||||
5 = sector effect (integer) *
|
||||
6 = texture (string)
|
||||
7 = flat (string)
|
||||
8 = angle in degrees (integer)
|
||||
9 = angle in radians (float)
|
||||
10 = XXRRGGBB color (integer)
|
||||
11 = enum option (integer) *
|
||||
12 = enum bits (integer) *
|
||||
13 = sector tag (integer) *
|
||||
14 = thing tag (integer) *
|
||||
15 = linedef tag (integer) *
|
||||
16 = enum option (string)
|
||||
17 = angle in degrees (float)
|
||||
22 = byte angle (integer)
|
||||
*/
|
||||
universalfields
|
||||
{
|
||||
sector
|
||||
{
|
||||
friction
|
||||
{
|
||||
name = "Friction";
|
||||
type = 1;
|
||||
default = 1;
|
||||
}
|
||||
|
||||
specialeffectplanes
|
||||
{
|
||||
type = 11;
|
||||
enum = "floorceiling";
|
||||
default = 0;
|
||||
}
|
||||
|
||||
colormapbegin
|
||||
{
|
||||
type = 0;
|
||||
default = 0;
|
||||
}
|
||||
|
||||
colormapend
|
||||
{
|
||||
type = 0;
|
||||
default = 33;
|
||||
}
|
||||
|
||||
foglighting
|
||||
{
|
||||
type = 3;
|
||||
default = false;
|
||||
}
|
||||
|
||||
teambase
|
||||
{
|
||||
type = 11;
|
||||
enum = "ctfteam";
|
||||
default = 0;
|
||||
}
|
||||
|
||||
triggersector
|
||||
{
|
||||
type = 3;
|
||||
default = false;
|
||||
}
|
||||
|
||||
triggerobject
|
||||
{
|
||||
type = 11;
|
||||
enum = "triggerobjects";
|
||||
default = 0;
|
||||
}
|
||||
|
||||
triggersurface
|
||||
{
|
||||
type = 11;
|
||||
enum = "triggersurfaces";
|
||||
default = 0;
|
||||
}
|
||||
|
||||
ringdrain
|
||||
{
|
||||
type = 1;
|
||||
default = 0;
|
||||
}
|
||||
}
|
||||
|
||||
linedef
|
||||
{
|
||||
executordelay
|
||||
{
|
||||
type = 0;
|
||||
default = 0;
|
||||
}
|
||||
midtexrepetitions
|
||||
{
|
||||
type = 0;
|
||||
default = 0;
|
||||
}
|
||||
arg5
|
||||
{
|
||||
type = 0;
|
||||
default = 0;
|
||||
}
|
||||
arg1str
|
||||
{
|
||||
type = 2;
|
||||
default = "";
|
||||
}
|
||||
}
|
||||
|
||||
thing
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
MAP LUMP NAMES
|
||||
Map lumps are loaded with the map as long as they are right after each other. When the editor
|
||||
meets a lump which is not defined in this list it will ignore the map if not satisfied.
|
||||
The order of items defines the order in which lumps will be written to WAD file on save.
|
||||
To indicate the map header lump, use ~MAP
|
||||
|
||||
Legenda:
|
||||
required = Lump is required to exist.
|
||||
blindcopy = Lump will be copied along with the map blindly. (useful for lumps Doom Builder doesn't use)
|
||||
nodebuild = The nodebuilder generates this lump.
|
||||
allowempty = The nodebuilder is allowed to leave this lump empty.
|
||||
scriptbuild = This lump is a text-based script, which should be compiled using current script compiler;
|
||||
script = This lump is a text-based script. Specify the filename of the script configuration to use.
|
||||
*/
|
||||
|
||||
doommaplumpnames
|
||||
{
|
||||
~MAP
|
||||
{
|
||||
required = true;
|
||||
blindcopy = true;
|
||||
nodebuild = false;
|
||||
}
|
||||
|
||||
THINGS
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = true;
|
||||
}
|
||||
|
||||
LINEDEFS
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
SIDEDEFS
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
VERTEXES
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
SEGS
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
SSECTORS
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
NODES
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
SECTORS
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
REJECT
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
BLOCKMAP
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = true;
|
||||
}
|
||||
}
|
||||
|
||||
udmfmaplumpnames
|
||||
{
|
||||
ZNODES
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
REJECT
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
BLOCKMAP
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ENUMERATIONS
|
||||
// These are enumerated lists for linedef types and UDMF fields.
|
||||
// Reserved names are: angledeg, anglerad, color, texture, flat
|
||||
enums
|
||||
{
|
||||
falsetrue
|
||||
{
|
||||
0 = "False";
|
||||
1 = "True";
|
||||
}
|
||||
|
||||
yesno
|
||||
{
|
||||
0 = "Yes";
|
||||
1 = "No";
|
||||
}
|
||||
|
||||
noyes
|
||||
{
|
||||
0 = "No";
|
||||
1 = "Yes";
|
||||
}
|
||||
|
||||
onoff
|
||||
{
|
||||
0 = "On";
|
||||
1 = "Off";
|
||||
}
|
||||
|
||||
offon
|
||||
{
|
||||
0 = "Off";
|
||||
1 = "On";
|
||||
}
|
||||
|
||||
updown
|
||||
{
|
||||
0 = "Up";
|
||||
1 = "Down";
|
||||
}
|
||||
|
||||
downup
|
||||
{
|
||||
0 = "Down";
|
||||
1 = "Up";
|
||||
}
|
||||
|
||||
addset
|
||||
{
|
||||
0 = "Add";
|
||||
1 = "Set";
|
||||
}
|
||||
|
||||
floorceiling
|
||||
{
|
||||
0 = "Floor";
|
||||
1 = "Ceiling";
|
||||
2 = "Floor and ceiling";
|
||||
}
|
||||
|
||||
triggertype
|
||||
{
|
||||
0 = "Continuous";
|
||||
1 = "Each Time (Enter)";
|
||||
2 = "Each Time (Enter and leave)";
|
||||
3 = "Once";
|
||||
}
|
||||
|
||||
frontback
|
||||
{
|
||||
0 = "None";
|
||||
1 = "Front";
|
||||
2 = "Back";
|
||||
}
|
||||
|
||||
ctfteam
|
||||
{
|
||||
0 = "None";
|
||||
1 = "Red";
|
||||
2 = "Blue";
|
||||
}
|
||||
|
||||
triggerobjects
|
||||
{
|
||||
0 = "Any player";
|
||||
1 = "All players";
|
||||
2 = "Pushable object";
|
||||
3 = "Any object with thinker";
|
||||
}
|
||||
|
||||
triggersurfaces
|
||||
{
|
||||
0 = "Floor touch";
|
||||
1 = "Ceiling touch";
|
||||
2 = "Floor or ceiling touch";
|
||||
3 = "Anywhere in sector";
|
||||
}
|
||||
|
||||
tangibility
|
||||
{
|
||||
1 = "Intangible from top";
|
||||
2 = "Intangible from bottom";
|
||||
4 = "Don't block players";
|
||||
8 = "Don't block non-players";
|
||||
}
|
||||
}
|
||||
|
||||
//Default things filters
|
||||
thingsfilters
|
||||
{
|
||||
|
||||
filter0
|
||||
{
|
||||
name = "Player starts";
|
||||
category = "starts";
|
||||
type = -1;
|
||||
}
|
||||
|
||||
|
||||
filter1
|
||||
{
|
||||
name = "Enemies";
|
||||
category = "enemies";
|
||||
type = -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
filter2
|
||||
{
|
||||
name = "NiGHTS Track";
|
||||
category = "nightstrk";
|
||||
type = -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
filter3
|
||||
{
|
||||
name = "Normal Gravity";
|
||||
category = "";
|
||||
type = -1;
|
||||
|
||||
fields
|
||||
{
|
||||
2 = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
filter4
|
||||
{
|
||||
name = "Reverse Gravity";
|
||||
category = "";
|
||||
type = -1;
|
||||
|
||||
fields
|
||||
{
|
||||
2 = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
thingsfilters_udmf
|
||||
{
|
||||
}
|
||||
|
||||
// Special linedefs
|
||||
speciallinedefs
|
||||
{
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
upperunpeggedflag = 8;
|
||||
lowerunpeggedflag = 16;
|
||||
repeatmidtextureflag = 1024;
|
||||
pegmidtextureflag = 256;
|
||||
}
|
||||
|
||||
speciallinedefs_udmf
|
||||
{
|
||||
soundlinedefflag = "noclimb";
|
||||
singlesidedflag = "blocking";
|
||||
doublesidedflag = "twosided";
|
||||
impassableflag = "blocking";
|
||||
upperunpeggedflag = "dontpegtop";
|
||||
lowerunpeggedflag = "dontpegbottom";
|
||||
repeatmidtextureflag = "wrapmidtex";
|
||||
pegmidtextureflag = "midpeg";
|
||||
}
|
||||
|
||||
scriptlumpnames
|
||||
{
|
||||
MAINCFG
|
||||
{
|
||||
script = "SOC.cfg";
|
||||
}
|
||||
|
||||
OBJCTCFG
|
||||
{
|
||||
script = "SOC.cfg";
|
||||
}
|
||||
|
||||
SOC_
|
||||
{
|
||||
script = "SOC.cfg";
|
||||
isprefix = true;
|
||||
}
|
||||
|
||||
LUA_
|
||||
{
|
||||
script = "Lua.cfg";
|
||||
isprefix = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Texture sources
|
||||
textures
|
||||
{
|
||||
zdoom1
|
||||
{
|
||||
start = "TX_START";
|
||||
end = "TX_END";
|
||||
}
|
||||
}
|
||||
|
||||
// Patch sources
|
||||
patches
|
||||
{
|
||||
standard1
|
||||
{
|
||||
start = "P_START";
|
||||
end = "P_END";
|
||||
}
|
||||
|
||||
standard2
|
||||
{
|
||||
start = "PP_START";
|
||||
end = "PP_END";
|
||||
}
|
||||
}
|
||||
|
||||
// Sprite sources
|
||||
sprites
|
||||
{
|
||||
standard1
|
||||
{
|
||||
start = "S_START";
|
||||
end = "S_END";
|
||||
}
|
||||
|
||||
standard2
|
||||
{
|
||||
start = "SS_START";
|
||||
end = "SS_END";
|
||||
}
|
||||
}
|
||||
|
||||
// Flat sources
|
||||
flats
|
||||
{
|
||||
standard1
|
||||
{
|
||||
start = "F_START";
|
||||
end = "F_END";
|
||||
}
|
||||
|
||||
standard2
|
||||
{
|
||||
start = "FF_START";
|
||||
end = "FF_END";
|
||||
}
|
||||
|
||||
standard3
|
||||
{
|
||||
start = "FF_START";
|
||||
end = "F_END";
|
||||
}
|
||||
|
||||
standard4
|
||||
{
|
||||
start = "F_START";
|
||||
end = "FF_END";
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
sectortypes
|
||||
{
|
||||
0 = "Normal";
|
||||
1 = "Damage";
|
||||
2 = "Damage (Water)";
|
||||
3 = "Damage (Fire)";
|
||||
4 = "Damage (Electrical)";
|
||||
5 = "Spikes";
|
||||
6 = "Death Pit (Camera Tilt)";
|
||||
7 = "Death Pit (No Camera Tilt)";
|
||||
8 = "Instant Kill";
|
||||
9 = "Ring Drainer (Floor Touch)";
|
||||
10 = "Ring Drainer (Anywhere in Sector)";
|
||||
11 = "Special Stage Damage";
|
||||
12 = "Space Countdown";
|
||||
13 = "Ramp Sector (double step-up/down)";
|
||||
14 = "Non-Ramp Sector (no step-down)";
|
||||
15 = "Bouncy FOF";
|
||||
16 = "Trigger Line Ex. (Pushable Objects)";
|
||||
32 = "Trigger Line Ex. (Anywhere, All Players)";
|
||||
48 = "Trigger Line Ex. (Floor Touch, All Players)";
|
||||
64 = "Trigger Line Ex. (Anywhere in Sector)";
|
||||
80 = "Trigger Line Ex. (Floor Touch)";
|
||||
96 = "Trigger Line Ex. (Emerald Check)";
|
||||
112 = "Trigger Line Ex. (NiGHTS Mare)";
|
||||
128 = "Check for Linedef Executor on FOFs";
|
||||
144 = "Egg Capsule";
|
||||
160 = "Special Stage Time/Rings Parameters";
|
||||
176 = "Custom Global Gravity";
|
||||
512 = "Wind/Current";
|
||||
1024 = "Conveyor Belt";
|
||||
1280 = "Speed Pad";
|
||||
4096 = "Star Post Activator";
|
||||
8192 = "Exit/Special Stage Pit/Return Flag";
|
||||
12288 = "CTF Red Team Base";
|
||||
16384 = "CTF Blue Team Base";
|
||||
20480 = "Fan Sector";
|
||||
24576 = "Super Sonic Transform";
|
||||
28672 = "Force Spin";
|
||||
32768 = "Zoom Tube Start";
|
||||
36864 = "Zoom Tube End";
|
||||
40960 = "Circuit Finish Line";
|
||||
45056 = "Rope Hang";
|
||||
49152 = "Intangible to the Camera";
|
||||
}
|
||||
|
||||
gen_sectortypes
|
||||
{
|
||||
first
|
||||
{
|
||||
0 = "Normal";
|
||||
1 = "Damage";
|
||||
2 = "Damage (Water)";
|
||||
3 = "Damage (Fire)";
|
||||
4 = "Damage (Electrical)";
|
||||
5 = "Spikes";
|
||||
6 = "Death Pit (Camera Tilt)";
|
||||
7 = "Death Pit (No Camera Tilt)";
|
||||
8 = "Instant Kill";
|
||||
9 = "Ring Drainer (Floor Touch)";
|
||||
10 = "Ring Drainer (Anywhere in Sector)";
|
||||
11 = "Special Stage Damage";
|
||||
12 = "Space Countdown";
|
||||
13 = "Ramp Sector (double step-up/down)";
|
||||
14 = "Non-Ramp Sector (no step-down)";
|
||||
15 = "Bouncy FOF";
|
||||
}
|
||||
|
||||
second
|
||||
{
|
||||
0 = "Normal";
|
||||
16 = "Trigger Line Ex. (Pushable Objects)";
|
||||
32 = "Trigger Line Ex. (Anywhere, All Players)";
|
||||
48 = "Trigger Line Ex. (Floor Touch, All Players)";
|
||||
64 = "Trigger Line Ex. (Anywhere in Sector)";
|
||||
80 = "Trigger Line Ex. (Floor Touch)";
|
||||
96 = "Trigger Line Ex. (Emerald Check)";
|
||||
112 = "Trigger Line Ex. (NiGHTS Mare)";
|
||||
128 = "Check for Linedef Executor on FOFs";
|
||||
144 = "Egg Capsule";
|
||||
160 = "Special Stage Time/Rings Parameters";
|
||||
176 = "Custom Global Gravity";
|
||||
}
|
||||
|
||||
third
|
||||
{
|
||||
0 = "Normal";
|
||||
512 = "Wind/Current";
|
||||
1024 = "Conveyor Belt";
|
||||
1280 = "Speed Pad";
|
||||
}
|
||||
|
||||
fourth
|
||||
{
|
||||
0 = "Normal";
|
||||
4096 = "Star Post Activator";
|
||||
8192 = "Exit/Special Stage Pit/Return Flag";
|
||||
12288 = "CTF Red Team Base";
|
||||
16384 = "CTF Blue Team Base";
|
||||
20480 = "Fan Sector";
|
||||
24576 = "Super Sonic Transform";
|
||||
28672 = "Force Spin";
|
||||
32768 = "Zoom Tube Start";
|
||||
36864 = "Zoom Tube End";
|
||||
40960 = "Circuit Finish Line";
|
||||
45056 = "Rope Hang";
|
||||
49152 = "Intangible to the Camera";
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,7 @@
|
|||
* Oogaland
|
||||
* Rob
|
||||
* Shadow Hog
|
||||
* Spherallic
|
||||
* sphere
|
||||
* SRB2-Playah
|
||||
* SSNTails
|
||||
* SteelT
|
||||
|
@ -435,7 +435,7 @@ sectortypes
|
|||
112 = "Trigger Line Ex. (NiGHTS Mare)";
|
||||
128 = "Check for Linedef Executor on FOFs";
|
||||
144 = "Egg Capsule";
|
||||
160 = "Special Stage Time/Rings Parameters";
|
||||
160 = "Special Stage Time/Spheres Parameters";
|
||||
176 = "Custom Global Gravity";
|
||||
512 = "Wind/Current";
|
||||
1024 = "Conveyor Belt";
|
||||
|
@ -490,7 +490,7 @@ gen_sectortypes
|
|||
112 = "Trigger Line Ex. (NiGHTS Mare)";
|
||||
128 = "Check for Linedef Executor on FOFs";
|
||||
144 = "Egg Capsule";
|
||||
160 = "Special Stage Time/Rings Parameters";
|
||||
160 = "Special Stage Time/Spheres Parameters";
|
||||
176 = "Custom Global Gravity";
|
||||
}
|
||||
|
||||
|
@ -738,12 +738,6 @@ linedeftypes
|
|||
flags2text = "[1] Use control sector tag";
|
||||
flags64text = "[6] No sound effect";
|
||||
}
|
||||
|
||||
65
|
||||
{
|
||||
title = "Bridge Thinker <disabled>";
|
||||
prefix = "(65)";
|
||||
}
|
||||
}
|
||||
|
||||
polyobject
|
||||
|
@ -756,20 +750,17 @@ linedeftypes
|
|||
prefix = "(20)";
|
||||
}
|
||||
|
||||
21
|
||||
{
|
||||
title = "Explicitly Include Line <disabled>";
|
||||
prefix = "(21)";
|
||||
}
|
||||
|
||||
22
|
||||
{
|
||||
title = "Parameters";
|
||||
prefix = "(22)";
|
||||
flags8text = "[3] Set translucency by X offset";
|
||||
flags32text = "[5] Render outer sides only";
|
||||
flags64text = "[6] Trigger linedef executor";
|
||||
flags128text = "[7] Intangible";
|
||||
flags256text = "[8] Stopped by pushables";
|
||||
flags512text = "[9] Render flats";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
}
|
||||
|
||||
30
|
||||
|
@ -788,7 +779,6 @@ linedeftypes
|
|||
{
|
||||
title = "Angular Displacement by Front Sector";
|
||||
prefix = "(32)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags64text = "[6] Don't turn players";
|
||||
flags512text = "[9] Turn all objects";
|
||||
}
|
||||
|
@ -925,6 +915,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Render insides";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "195F";
|
||||
flags643dfloorflagsadd = "7C80";
|
||||
|
@ -984,6 +975,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Render insides/block non-plr";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "200191F";
|
||||
flags1283dfloorflagsadd = "7C80";
|
||||
|
@ -997,6 +989,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Render insides/block non-plr";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "2001917";
|
||||
flags1283dfloorflagsadd = "7C80";
|
||||
|
@ -1024,6 +1017,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Render insides/block non-plr";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "400191F";
|
||||
flags1283dfloorflagsadd = "7C80";
|
||||
|
@ -1037,6 +1031,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Render insides/block non-plr";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "4001917";
|
||||
flags1283dfloorflagsadd = "7C80";
|
||||
|
@ -1082,6 +1077,7 @@ linedeftypes
|
|||
flags64text = "[6] Use two light levels";
|
||||
flags512text = "[9] Use target light level";
|
||||
flags1024text = "[10] Ripple effect";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "9F39";
|
||||
flags643dfloorflagsadd = "20000";
|
||||
|
@ -1110,6 +1106,7 @@ linedeftypes
|
|||
flags64text = "[6] Use two light levels";
|
||||
flags512text = "[9] Use target light level";
|
||||
flags1024text = "[10] Ripple effect";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "1F31";
|
||||
flags643dfloorflagsadd = "20000";
|
||||
|
@ -1125,6 +1122,7 @@ linedeftypes
|
|||
flags64text = "[6] Use two light levels";
|
||||
flags512text = "[9] Use target light level";
|
||||
flags1024text = "[10] Ripple effect";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "209F39";
|
||||
flags643dfloorflagsadd = "20000";
|
||||
|
@ -1136,10 +1134,10 @@ linedeftypes
|
|||
{
|
||||
title = "Goo Water, Translucent, No Sides";
|
||||
prefix = "(125)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags64text = "[6] Use two light levels";
|
||||
flags512text = "[9] Use target light level";
|
||||
flags1024text = "[10] Ripple effect";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "201F31";
|
||||
flags643dfloorflagsadd = "20000";
|
||||
|
@ -1162,6 +1160,7 @@ linedeftypes
|
|||
prefix = "(221)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags64text = "[6] Cast shadow";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "1B59";
|
||||
flags643dfloorflagsremove = "40";
|
||||
|
@ -1227,6 +1226,18 @@ linedeftypes
|
|||
3dfloorflags = "19F";
|
||||
}
|
||||
|
||||
153
|
||||
{
|
||||
title = "Dynamically Sinking Platform";
|
||||
prefix = "(153)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Spindash to move";
|
||||
flags128text = "[7] Only block non-players";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "19F";
|
||||
}
|
||||
|
||||
160
|
||||
{
|
||||
title = "Floating, Bobbing";
|
||||
|
@ -1273,6 +1284,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Spindash to move";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "195F";
|
||||
}
|
||||
|
@ -1282,7 +1294,6 @@ linedeftypes
|
|||
title = "Rising Platform, Solid, Invisible";
|
||||
prefix = "(193)";
|
||||
flags2text = "[1] Sink when stepped on";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Spindash to move";
|
||||
flags128text = "[7] Only block non-players";
|
||||
|
@ -1313,6 +1324,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Spindash, no shadow";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "2009D1F";
|
||||
flags643dfloorflagsadd = "40";
|
||||
|
@ -1379,6 +1391,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "210959F";
|
||||
flags643dfloorflagsadd = "40";
|
||||
|
@ -1392,6 +1405,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "218959F";
|
||||
flags643dfloorflagsadd = "40";
|
||||
|
@ -1488,16 +1502,22 @@ linedeftypes
|
|||
{
|
||||
title = "Mario Block";
|
||||
prefix = "(250)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Invisible block";
|
||||
flags64text = "[6] Brick block";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "40019F";
|
||||
flags323dfloorflagsremove = "19E";
|
||||
flags643dfloorflagsadd = "200000";
|
||||
}
|
||||
|
||||
251
|
||||
{
|
||||
title = "Thwomp Block";
|
||||
prefix = "(251)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags512text = "[9] Custom crushing sound";
|
||||
flags1024text = "[10] Custom speed";
|
||||
3dfloor = true;
|
||||
|
@ -1513,8 +1533,8 @@ linedeftypes
|
|||
flags512text = "[9] Shattered by pushables";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "8800019";
|
||||
flags643dfloorflagsadd = "200006";
|
||||
3dfloorflags = "880001D";
|
||||
flags643dfloorflagsadd = "200002";
|
||||
}
|
||||
|
||||
253
|
||||
|
@ -1524,8 +1544,9 @@ linedeftypes
|
|||
flags8text = "[3] Slope skew sides";
|
||||
flags512text = "[9] Shattered by pushables";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "8801019";
|
||||
3dfloorflags = "880101D";
|
||||
}
|
||||
|
||||
254
|
||||
|
@ -1533,6 +1554,7 @@ linedeftypes
|
|||
title = "Bustable Block";
|
||||
prefix = "(254)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Strong characters only";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags512text = "[9] Shattered by pushables";
|
||||
|
@ -1564,6 +1586,7 @@ linedeftypes
|
|||
flags128text = "[7] Only block non-players";
|
||||
flags512text = "[9] Shattered by pushables";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "1080101F";
|
||||
}
|
||||
|
@ -1585,6 +1608,7 @@ linedeftypes
|
|||
prefix = "(258)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Don't damage bosses";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "959";
|
||||
}
|
||||
|
@ -1593,10 +1617,12 @@ linedeftypes
|
|||
{
|
||||
title = "Custom FOF";
|
||||
prefix = "(259)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags512text = "[9] Shattered by pushables";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorcustom = true;
|
||||
}
|
||||
|
@ -1896,6 +1922,27 @@ linedeftypes
|
|||
prefix = "(333)";
|
||||
}
|
||||
|
||||
334
|
||||
{
|
||||
title = "Object Dye - Continuous";
|
||||
flags64text = "[6] Disable for this color";
|
||||
prefix = "(334)";
|
||||
}
|
||||
|
||||
335
|
||||
{
|
||||
title = "Object Dye - Each Time";
|
||||
flags64text = "[6] Disable for this color";
|
||||
prefix = "(335)";
|
||||
}
|
||||
|
||||
336
|
||||
{
|
||||
title = "Object Dye - Once";
|
||||
flags64text = "[6] Disable for this color";
|
||||
prefix = "(336)";
|
||||
}
|
||||
|
||||
399
|
||||
{
|
||||
title = "Level Load";
|
||||
|
@ -2161,6 +2208,14 @@ linedeftypes
|
|||
flags8text = "[3] Set delay by backside sector";
|
||||
}
|
||||
|
||||
449
|
||||
{
|
||||
title = "Enable Bosses with Parameter";
|
||||
prefix = "(449)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags64text = "[6] Disable bosses";
|
||||
}
|
||||
|
||||
457
|
||||
{
|
||||
title = "Track Object's Angle";
|
||||
|
@ -2180,12 +2235,15 @@ linedeftypes
|
|||
{
|
||||
title = "Award Rings";
|
||||
prefix = "(460)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
}
|
||||
|
||||
461
|
||||
{
|
||||
title = "Spawn Object";
|
||||
prefix = "(461)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags32text = "[5] Use line angle for object";
|
||||
flags64text = "[6] Spawn inside a range";
|
||||
}
|
||||
|
||||
|
@ -2193,6 +2251,20 @@ linedeftypes
|
|||
{
|
||||
title = "Stop Timer/Exit Stage in Record Attack";
|
||||
prefix = "(462)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
}
|
||||
|
||||
463
|
||||
{
|
||||
title = "Dye Object";
|
||||
prefix = "(463)";
|
||||
}
|
||||
|
||||
464
|
||||
{
|
||||
title = "Trigger Egg Capsule";
|
||||
prefix = "(464)";
|
||||
flags64text = "[6] Don't end level";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2206,7 +2278,7 @@ linedeftypes
|
|||
prefix = "(413)";
|
||||
flags2text = "[1] Keep after death";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags32text = "[5] Seek to current song position";
|
||||
flags32text = "[5] Seek from current position";
|
||||
flags64text = "[6] For everyone";
|
||||
flags128text = "[7] Fade to custom volume";
|
||||
flags512text = "[9] Don't loop";
|
||||
|
@ -2220,7 +2292,7 @@ linedeftypes
|
|||
flags2text = "[1] From calling sector";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags64text = "[6] From nowhere for triggerer";
|
||||
flags512text = "[9] For everyone";
|
||||
flags512text = "[9] From nowhere for everyone";
|
||||
flags1024text = "[10] From tagged sectors";
|
||||
}
|
||||
|
||||
|
@ -2298,7 +2370,6 @@ linedeftypes
|
|||
flags8text = "[3] Set delay by backside sector";
|
||||
}
|
||||
|
||||
|
||||
445
|
||||
{
|
||||
title = "Make FOF Disappear/Reappear";
|
||||
|
@ -2325,7 +2396,7 @@ linedeftypes
|
|||
flags32text = "[5] Subtract Red value";
|
||||
flags64text = "[6] Subtract Green value";
|
||||
flags128text = "[7] Subtract Blue value";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags32768text = "[15] Use backside colormap";
|
||||
}
|
||||
|
||||
|
@ -2359,7 +2430,7 @@ linedeftypes
|
|||
prefix = "(452)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags64text = "[6] Do not handle FF_TRANS";
|
||||
flags256text = "[8] Set relative to current val";
|
||||
flags256text = "[8] Set relative to current";
|
||||
}
|
||||
|
||||
453
|
||||
|
@ -2371,7 +2442,7 @@ linedeftypes
|
|||
flags32text = "[5] No collision during fade";
|
||||
flags64text = "[6] Do not handle FF_TRANS";
|
||||
flags128text = "[7] Do not handle lighting";
|
||||
flags256text = "[8] Set relative to current val";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags512text = "[9] Speed = Tic Duration";
|
||||
flags1024text = "[10] Override existing fade";
|
||||
flags16384text = "[14] Do not handle collision";
|
||||
|
@ -2395,7 +2466,7 @@ linedeftypes
|
|||
flags32text = "[5] Subtract Red value";
|
||||
flags64text = "[6] Subtract Green value";
|
||||
flags128text = "[7] Subtract Blue value";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags512text = "[9] Speed = Tic Duration";
|
||||
flags1024text = "[10] Override existing fade";
|
||||
flags16384text = "[14] Fade from invisible black";
|
||||
|
@ -2416,9 +2487,7 @@ linedeftypes
|
|||
flags2text = "[1] Close text prompt";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags32text = "[5] Run executor tag on close";
|
||||
flags64text = "[6] For everyone";
|
||||
flags128text = "[7] Do not block controls";
|
||||
flags256text = "[8] Do not freeze time";
|
||||
flags128text = "[7] Don't disable controls";
|
||||
flags32768text = "[15] Find prompt by name";
|
||||
}
|
||||
}
|
||||
|
@ -2524,7 +2593,7 @@ linedeftypes
|
|||
prefix = "(491)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags16text = "[4] Set raw alpha by Front X";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags256text = "[8] Set relative to current";
|
||||
}
|
||||
|
||||
492
|
||||
|
@ -2534,7 +2603,7 @@ linedeftypes
|
|||
flags8text = "[3] Set delay by backside sector";
|
||||
flags16text = "[4] Set raw alpha by Front X";
|
||||
flags32text = "[5] No collision during fade";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags512text = "[9] Speed = Tic Duration";
|
||||
flags1024text = "[10] Override existing fade";
|
||||
flags16384text = "[14] Do not handle collision";
|
||||
|
@ -2547,45 +2616,63 @@ linedeftypes
|
|||
|
||||
500
|
||||
{
|
||||
title = "Scroll Wall Front Side Left";
|
||||
title = "Scroll Front Wall Left";
|
||||
prefix = "(500)";
|
||||
}
|
||||
|
||||
501
|
||||
{
|
||||
title = "Scroll Wall Front Side Right";
|
||||
title = "Scroll Front Wall Right";
|
||||
prefix = "(501)";
|
||||
}
|
||||
|
||||
502
|
||||
{
|
||||
title = "Scroll Wall According to Linedef";
|
||||
title = "Scroll Tagged Wall";
|
||||
prefix = "(502)";
|
||||
flags128text = "[7] Use texture offsets";
|
||||
flags256text = "[8] Scroll back side";
|
||||
}
|
||||
|
||||
503
|
||||
{
|
||||
title = "Scroll Wall According to Linedef (Accelerative)";
|
||||
title = "Scroll Tagged Wall (Accelerative)";
|
||||
prefix = "(503)";
|
||||
flags128text = "[7] Use texture offsets";
|
||||
flags256text = "[8] Scroll back side";
|
||||
}
|
||||
|
||||
504
|
||||
{
|
||||
title = "Scroll Wall According to Linedef (Displacement)";
|
||||
title = "Scroll Tagged Wall (Displacement)";
|
||||
prefix = "(504)";
|
||||
flags128text = "[7] Use texture offsets";
|
||||
flags256text = "[8] Scroll back side";
|
||||
}
|
||||
|
||||
505
|
||||
{
|
||||
title = "Scroll Texture by Front Side Offsets";
|
||||
title = "Scroll Front Wall by Front Side Offsets";
|
||||
prefix = "(505)";
|
||||
}
|
||||
|
||||
506
|
||||
{
|
||||
title = "Scroll Texture by Back Side Offsets";
|
||||
title = "Scroll Front Wall by Back Side Offsets";
|
||||
prefix = "(506)";
|
||||
}
|
||||
|
||||
507
|
||||
{
|
||||
title = "Scroll Back Wall by Front Side Offsets";
|
||||
prefix = "(507)";
|
||||
}
|
||||
|
||||
508
|
||||
{
|
||||
title = "Scroll Back Wall by Back Side Offsets";
|
||||
prefix = "(508)";
|
||||
}
|
||||
}
|
||||
|
||||
planescroll
|
||||
|
@ -2632,76 +2719,84 @@ linedeftypes
|
|||
{
|
||||
title = "Carry Objects on Floor";
|
||||
prefix = "(520)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
521
|
||||
{
|
||||
title = "Carry Objects on Floor (Accelerative)";
|
||||
prefix = "(521)";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
522
|
||||
{
|
||||
title = "Carry Objects on Floor (Displacement)";
|
||||
prefix = "(522)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
523
|
||||
{
|
||||
title = "Carry Objects on Ceiling";
|
||||
prefix = "(523)";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
524
|
||||
{
|
||||
title = "Carry Objects on Ceiling (Accelerative)";
|
||||
prefix = "(524)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
525
|
||||
{
|
||||
title = "Carry Objects on Ceiling (Displacement)";
|
||||
prefix = "(525)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
530
|
||||
{
|
||||
title = "Scroll Floor Texture and Carry Objects";
|
||||
prefix = "(530)";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
531
|
||||
{
|
||||
title = "Scroll Floor Texture and Carry Objects (Accelerative)";
|
||||
prefix = "(531)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
532
|
||||
{
|
||||
title = "Scroll Floor Texture and Carry Objects (Displacement)";
|
||||
prefix = "(532)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
533
|
||||
{
|
||||
title = "Scroll Ceiling Texture and Carry Objects";
|
||||
prefix = "(533)";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
534
|
||||
{
|
||||
title = "Scroll Ceiling Texture and Carry Objects (Accelerative)";
|
||||
prefix = "(534)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
535
|
||||
{
|
||||
title = "Scroll Ceiling Texture and Carry Objects (Displacement)";
|
||||
prefix = "(535)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2714,7 +2809,7 @@ linedeftypes
|
|||
title = "Wind";
|
||||
prefix = "(541)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
542
|
||||
|
@ -2722,7 +2817,7 @@ linedeftypes
|
|||
title = "Upwards Wind";
|
||||
prefix = "(542)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
543
|
||||
|
@ -2730,7 +2825,7 @@ linedeftypes
|
|||
title = "Downwards Wind";
|
||||
prefix = "(543)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
544
|
||||
|
@ -2738,7 +2833,7 @@ linedeftypes
|
|||
title = "Current";
|
||||
prefix = "(544)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
545
|
||||
|
@ -2746,7 +2841,7 @@ linedeftypes
|
|||
title = "Upwards Current";
|
||||
prefix = "(545)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
546
|
||||
|
@ -2754,13 +2849,14 @@ linedeftypes
|
|||
title = "Downwards Current";
|
||||
prefix = "(546)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
547
|
||||
{
|
||||
title = "Push/Pull";
|
||||
prefix = "(547)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3407,8 +3503,8 @@ thingtypes
|
|||
sprite = "ESHIA1";
|
||||
width = 16;
|
||||
height = 48;
|
||||
flags1text = "[1] 90 degrees counter-clockwise";
|
||||
flags4text = "[4] 90 degrees clockwise";
|
||||
flags1text = "[1] 90 degrees clockwise";
|
||||
flags4text = "[4] 90 degrees counter-clockwise";
|
||||
flags8text = "[8] Double speed";
|
||||
}
|
||||
115
|
||||
|
@ -3674,6 +3770,7 @@ thingtypes
|
|||
width = 8;
|
||||
height = 16;
|
||||
sprite = "internal:capsule";
|
||||
angletext = "Tag";
|
||||
}
|
||||
292
|
||||
{
|
||||
|
@ -3870,6 +3967,8 @@ thingtypes
|
|||
{
|
||||
title = "Emerald Hunt Location";
|
||||
sprite = "SHRDA0";
|
||||
flags8height = 24;
|
||||
flags8text = "[8] Float";
|
||||
}
|
||||
321
|
||||
{
|
||||
|
@ -3897,9 +3996,10 @@ thingtypes
|
|||
title = "Monitors";
|
||||
width = 18;
|
||||
height = 40;
|
||||
flags1text = "[1] Run Linedef Executor on pop";
|
||||
flags1text = "[1] Run linedef executor on pop";
|
||||
flags4text = "[4] Random (Strong)";
|
||||
flags8text = "[8] Random (Weak)";
|
||||
angletext = "Tag";
|
||||
|
||||
400
|
||||
{
|
||||
|
@ -4029,7 +4129,8 @@ thingtypes
|
|||
title = "Monitors (Respawning)";
|
||||
width = 20;
|
||||
height = 44;
|
||||
flags1text = "[1] Run Linedef Executor on pop";
|
||||
flags1text = "[1] Run linedef executor on pop";
|
||||
angletext = "Tag";
|
||||
|
||||
431
|
||||
{
|
||||
|
@ -4125,7 +4226,9 @@ thingtypes
|
|||
sprite = "STPTA0M0";
|
||||
width = 64;
|
||||
height = 128;
|
||||
flags4text = "[4] Respawn at center";
|
||||
angletext = "Angle/Order";
|
||||
parametertext = "Order";
|
||||
}
|
||||
520
|
||||
{
|
||||
|
@ -4152,6 +4255,7 @@ thingtypes
|
|||
sprite = "WSPKALAR";
|
||||
width = 16;
|
||||
height = 14;
|
||||
arrow = 1;
|
||||
flags1text = "[1] Start retracted";
|
||||
flags4text = "[4] Retractable";
|
||||
flags8text = "[8] Intangible";
|
||||
|
@ -4558,6 +4662,7 @@ thingtypes
|
|||
sprite = "TOADA0";
|
||||
width = 32;
|
||||
height = 16;
|
||||
angletext = "Tag";
|
||||
}
|
||||
757
|
||||
{
|
||||
|
@ -5832,7 +5937,7 @@ thingtypes
|
|||
sprite = "CAPSA0";
|
||||
width = 72;
|
||||
height = 144;
|
||||
angletext = "Rings";
|
||||
angletext = "Spheres";
|
||||
parametertext = "Mare";
|
||||
}
|
||||
}
|
||||
|
@ -6273,7 +6378,7 @@ thingtypes
|
|||
sprite = "PUMKA0";
|
||||
width = 16;
|
||||
height = 40;
|
||||
flags1text = "Don't flicker";
|
||||
flags1text = "[1] Don't flicker";
|
||||
}
|
||||
2007
|
||||
{
|
||||
|
@ -6281,7 +6386,7 @@ thingtypes
|
|||
sprite = "PUMKB0";
|
||||
width = 16;
|
||||
height = 40;
|
||||
flags1text = "Don't flicker";
|
||||
flags1text = "[1] Don't flicker";
|
||||
}
|
||||
2008
|
||||
{
|
||||
|
@ -6289,7 +6394,7 @@ thingtypes
|
|||
sprite = "PUMKC0";
|
||||
width = 16;
|
||||
height = 40;
|
||||
flags1text = "Don't flicker";
|
||||
flags1text = "[1] Don't flicker";
|
||||
}
|
||||
2009
|
||||
{
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/************************************************************************\
|
||||
Zone Builder Game Configuration for Sonic Robo Blast 2 Version 2.2
|
||||
\************************************************************************/
|
||||
|
||||
// This is required to prevent accidental use of a different configuration
|
||||
type = "Doom Builder 2 Game Configuration";
|
||||
|
||||
// This is the title to show for this game
|
||||
game = "Sonic Robo Blast 2 - 2.2 (Doom format)";
|
||||
|
||||
// This is the simplified game engine/sourceport name
|
||||
engine = "zdoom";
|
||||
|
||||
// Settings common to all games and all map formats
|
||||
include("Includes\\SRB222_common.cfg", "common");
|
||||
|
||||
// Settings common to Doom map format
|
||||
include("Includes\\SRB222_common.cfg", "mapformat_doom");
|
||||
|
||||
include("Includes\\Game_SRB222.cfg");
|
||||
|
||||
// Script lumps detection
|
||||
scriptlumpnames
|
||||
{
|
||||
include("Includes\\SRB222_misc.cfg", "scriptlumpnames");
|
||||
}
|
||||
|
||||
// THING TYPES
|
||||
thingtypes
|
||||
{
|
||||
include("Includes\\SRB222_things.cfg");
|
||||
}
|
||||
|
||||
//Default things filters
|
||||
thingsfilters
|
||||
{
|
||||
include("Includes\\SRB222_misc.cfg", "thingsfilters");
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/************************************************************************\
|
||||
Zone Builder Game Configuration for Sonic Robo Blast 2 Version 2.2
|
||||
\************************************************************************/
|
||||
|
||||
// This is required to prevent accidental use of a different configuration
|
||||
type = "Doom Builder 2 Game Configuration";
|
||||
|
||||
// This is the title to show for this game
|
||||
game = "Sonic Robo Blast 2 - 2.2 (UDMF)";
|
||||
|
||||
// This is the simplified game engine/sourceport name
|
||||
engine = "zdoom";
|
||||
|
||||
// Settings common to all games and all map formats
|
||||
include("Includes\\SRB222_common.cfg", "common");
|
||||
|
||||
// Settings common to Doom map format
|
||||
include("Includes\\SRB222_common.cfg", "mapformat_udmf");
|
||||
|
||||
include("Includes\\Game_SRB222.cfg");
|
||||
|
||||
// Script lumps detection
|
||||
scriptlumpnames
|
||||
{
|
||||
include("Includes\\SRB222_misc.cfg", "scriptlumpnames");
|
||||
}
|
||||
|
||||
// THING TYPES
|
||||
thingtypes
|
||||
{
|
||||
include("Includes\\SRB222_things.cfg");
|
||||
}
|
||||
|
||||
//Default things filters
|
||||
thingsfilters
|
||||
{
|
||||
include("Includes\\SRB222_misc.cfg", "thingsfilters");
|
||||
}
|
||||
|
||||
// ENUMERATIONS
|
||||
// Each engine has its own additional thing types
|
||||
// These are enumerated lists for linedef types and UDMF fields.
|
||||
enums
|
||||
{
|
||||
// Basic game enums
|
||||
include("Includes\\SRB222_misc.cfg", "enums");
|
||||
}
|
|
@ -16,6 +16,7 @@ set(SRB2_CORE_SOURCES
|
|||
f_finale.c
|
||||
f_wipe.c
|
||||
filesrch.c
|
||||
g_demo.c
|
||||
g_game.c
|
||||
g_input.c
|
||||
hu_stuff.c
|
||||
|
@ -71,6 +72,7 @@ set(SRB2_CORE_HEADERS
|
|||
f_finale.h
|
||||
fastcmp.h
|
||||
filesrch.h
|
||||
g_demo.h
|
||||
g_game.h
|
||||
g_input.h
|
||||
g_state.h
|
||||
|
@ -120,6 +122,7 @@ set(SRB2_CORE_RENDER_SOURCES
|
|||
r_main.c
|
||||
r_plane.c
|
||||
r_segs.c
|
||||
r_skins.c
|
||||
r_sky.c
|
||||
r_splats.c
|
||||
r_things.c
|
||||
|
@ -134,6 +137,7 @@ set(SRB2_CORE_RENDER_SOURCES
|
|||
r_main.h
|
||||
r_plane.h
|
||||
r_segs.h
|
||||
r_skins.h
|
||||
r_sky.h
|
||||
r_splats.h
|
||||
r_state.h
|
||||
|
@ -214,8 +218,6 @@ source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
|
|||
|
||||
|
||||
### Configuration
|
||||
set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
|
||||
"Enable Lua interpreter support")
|
||||
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
|
||||
"Enable PNG support. Depends on zlib, so will be disabled if you don't enable that too.")
|
||||
set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
|
||||
|
@ -224,6 +226,12 @@ set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL
|
|||
"Enable GME support.")
|
||||
set(SRB2_CONFIG_HAVE_OPENMPT ON CACHE BOOL
|
||||
"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
|
||||
"Enable hardware rendering through OpenGL.")
|
||||
set(SRB2_CONFIG_USEASM OFF CACHE BOOL
|
||||
|
@ -239,8 +247,6 @@ if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
|
|||
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_BLUA})
|
||||
add_definitions(-DHAVE_BLUA)
|
||||
set(SRB2_LUA_SOURCES
|
||||
lua_baselib.c
|
||||
lua_blockmaplib.c
|
||||
|
@ -279,6 +285,7 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||
blua/lfunc.c
|
||||
blua/lgc.c
|
||||
blua/linit.c
|
||||
blua/liolib.c
|
||||
blua/llex.c
|
||||
blua/lmem.c
|
||||
blua/lobject.c
|
||||
|
@ -324,7 +331,6 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||
prepend_sources(SRB2_BLUA_HEADERS)
|
||||
|
||||
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_GME})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
|
@ -366,6 +372,30 @@ if(${SRB2_CONFIG_HAVE_OPENMPT})
|
|||
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_USE_INTERNAL_LIBRARIES})
|
||||
set(ZLIB_FOUND ON)
|
||||
|
@ -418,6 +448,7 @@ endif()
|
|||
if(${SRB2_CONFIG_HWRENDER})
|
||||
add_definitions(-DHWRENDER)
|
||||
set(SRB2_HWRENDER_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
|
||||
|
@ -428,17 +459,16 @@ if(${SRB2_CONFIG_HWRENDER})
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.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
|
||||
)
|
||||
|
||||
set (SRB2_HWRENDER_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.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_light.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
||||
|
@ -493,6 +523,27 @@ endif()
|
|||
|
||||
# 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
|
||||
# We should really fix our code to not need this
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
|
|
22
src/Makefile
22
src/Makefile
|
@ -2,7 +2,7 @@
|
|||
# GNU Make makefile for SRB2
|
||||
#############################################################################
|
||||
# Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
# Copyright (C) 2003-2019 by Sonic Team Junior.
|
||||
# Copyright (C) 2003-2020 by Sonic Team Junior.
|
||||
#
|
||||
# This program is free software distributed under the
|
||||
# terms of the GNU General Public License, version 2.
|
||||
|
@ -222,12 +222,10 @@ endif
|
|||
ifdef NOHW
|
||||
OPTS+=-DNOHW
|
||||
else
|
||||
#Hurdler: not really supported and not tested recently
|
||||
#OPTS+=-DUSE_PALETTED_TEXTURE
|
||||
OPTS+=-DHWRENDER
|
||||
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_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.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
|
||||
endif
|
||||
|
||||
ifdef NOHS
|
||||
|
@ -340,9 +338,7 @@ CFLAGS+=-DHAVE_MINIUPNPC
|
|||
endif
|
||||
endif
|
||||
|
||||
ifndef NO_LUA
|
||||
include blua/Makefile.cfg
|
||||
endif
|
||||
|
||||
ifdef NOMD5
|
||||
OPTS+=-DNOMD5
|
||||
|
@ -424,6 +420,7 @@ OBJS:=$(i_main_o) \
|
|||
$(OBJDIR)/z_zone.o \
|
||||
$(OBJDIR)/f_finale.o \
|
||||
$(OBJDIR)/f_wipe.o \
|
||||
$(OBJDIR)/g_demo.o \
|
||||
$(OBJDIR)/g_game.o \
|
||||
$(OBJDIR)/g_input.o \
|
||||
$(OBJDIR)/am_map.o \
|
||||
|
@ -468,6 +465,7 @@ OBJS:=$(i_main_o) \
|
|||
$(OBJDIR)/r_main.o \
|
||||
$(OBJDIR)/r_plane.o \
|
||||
$(OBJDIR)/r_segs.o \
|
||||
$(OBJDIR)/r_skins.o \
|
||||
$(OBJDIR)/r_sky.o \
|
||||
$(OBJDIR)/r_splats.o \
|
||||
$(OBJDIR)/r_things.o \
|
||||
|
@ -647,7 +645,7 @@ ifdef SDL
|
|||
ifdef MINGW
|
||||
$(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 \
|
||||
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_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 \
|
||||
|
@ -656,7 +654,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
|
|||
else
|
||||
$(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 \
|
||||
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_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 \
|
||||
|
@ -682,9 +680,7 @@ $(OBJDIR)/depend.dep:
|
|||
ifndef NOHW
|
||||
$(CC) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped
|
||||
endif
|
||||
ifndef NO_LUA
|
||||
$(CC) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped
|
||||
endif
|
||||
@sed -e 's,\(.*\)\.o: ,$(subst /,\/,$(OBJDIR))\/&,g' < $(OBJDIR)/depend.ped > $(OBJDIR)/depend.dep
|
||||
$(REMOVE) $(OBJDIR)/depend.ped
|
||||
@echo "Created dependency file, depend.dep"
|
||||
|
@ -736,7 +732,7 @@ ifndef SDL
|
|||
ifndef NOHW
|
||||
$(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 \
|
||||
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_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 \
|
||||
|
@ -745,7 +741,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 \
|
||||
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_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 \
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# vim: ft=make
|
||||
#
|
||||
# Makefile.cfg for SRB2
|
||||
#
|
||||
|
@ -7,6 +8,66 @@
|
|||
# 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
|
||||
GCC83=1
|
||||
endif
|
||||
|
@ -358,30 +419,6 @@ ifdef ARCHNAME
|
|||
BIN:=$(BIN)/$(ARCHNAME)
|
||||
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
|
||||
LD=$(CC)
|
||||
|
||||
|
|
162
src/am_map.c
162
src/am_map.c
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -160,6 +160,7 @@ static boolean am_stopped = true;
|
|||
static INT32 f_x, f_y; // location of window on screen (always zero for both)
|
||||
static INT32 f_w, f_h; // size of window on screen (always the screen width and height respectively)
|
||||
|
||||
static boolean m_keydown[4]; // which window panning keys are being pressed down?
|
||||
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
|
||||
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
|
||||
static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords)
|
||||
|
@ -205,6 +206,7 @@ static boolean followplayer = true; // specifies whether to follow the player ar
|
|||
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
|
||||
static AMDRAWFLINEFUNC AM_drawFline;
|
||||
|
||||
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc);
|
||||
static void AM_drawFline_soft(const fline_t *fl, INT32 color);
|
||||
|
||||
static void AM_activateNewScale(void)
|
||||
|
@ -344,22 +346,22 @@ static void AM_initVariables(void)
|
|||
old_m_h = m_h;
|
||||
}
|
||||
|
||||
//
|
||||
// Called when the screen size changes.
|
||||
//
|
||||
static void AM_FrameBufferInit(void)
|
||||
{
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
}
|
||||
|
||||
//
|
||||
// should be called at the start of every level
|
||||
// right now, i figure it out myself
|
||||
//
|
||||
static void AM_LevelInit(void)
|
||||
{
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
AM_drawFline = HWR_drawAMline;
|
||||
#endif
|
||||
|
||||
AM_findMinMaxBoundaries();
|
||||
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
|
||||
if (scale_mtof > max_scale_mtof)
|
||||
|
@ -381,7 +383,7 @@ void AM_Stop(void)
|
|||
*
|
||||
* \sa AM_Stop
|
||||
*/
|
||||
static inline void AM_Start(void)
|
||||
void AM_Start(void)
|
||||
{
|
||||
static INT32 lastlevel = -1;
|
||||
|
||||
|
@ -389,9 +391,13 @@ static inline void AM_Start(void)
|
|||
AM_Stop();
|
||||
am_stopped = false;
|
||||
if (lastlevel != gamemap || am_recalc) // screen size changed
|
||||
{
|
||||
AM_FrameBufferInit();
|
||||
if (lastlevel != gamemap)
|
||||
{
|
||||
AM_LevelInit();
|
||||
lastlevel = gamemap;
|
||||
}
|
||||
am_recalc = false;
|
||||
}
|
||||
AM_initVariables();
|
||||
|
@ -417,6 +423,28 @@ static void AM_maxOutWindowScale(void)
|
|||
AM_activateNewScale();
|
||||
}
|
||||
|
||||
//
|
||||
// set window panning
|
||||
//
|
||||
static void AM_setWindowPanning(void)
|
||||
{
|
||||
// up and down
|
||||
if (m_keydown[2]) // pan up
|
||||
m_paninc.y = FTOM(F_PANINC);
|
||||
else if (m_keydown[3]) // pan down
|
||||
m_paninc.y = -FTOM(F_PANINC);
|
||||
else
|
||||
m_paninc.y = 0;
|
||||
|
||||
// left and right
|
||||
if (m_keydown[0]) // pan right
|
||||
m_paninc.x = FTOM(F_PANINC);
|
||||
else if (m_keydown[1]) // pan left
|
||||
m_paninc.x = -FTOM(F_PANINC);
|
||||
else
|
||||
m_paninc.x = 0;
|
||||
}
|
||||
|
||||
/** Responds to user inputs in automap mode.
|
||||
*
|
||||
* \param ev Event to possibly respond to.
|
||||
|
@ -449,35 +477,49 @@ boolean AM_Responder(event_t *ev)
|
|||
{
|
||||
case AM_PANRIGHTKEY: // pan right
|
||||
if (!followplayer)
|
||||
m_paninc.x = FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[0] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANLEFTKEY: // pan left
|
||||
if (!followplayer)
|
||||
m_paninc.x = -FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[1] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANUPKEY: // pan up
|
||||
if (!followplayer)
|
||||
m_paninc.y = FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[2] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANDOWNKEY: // pan down
|
||||
if (!followplayer)
|
||||
m_paninc.y = -FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[3] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_ZOOMOUTKEY: // zoom out
|
||||
mtof_zoommul = M_ZOOMOUT;
|
||||
ftom_zoommul = M_ZOOMIN;
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_ZOOMINKEY: // zoom in
|
||||
mtof_zoommul = M_ZOOMIN;
|
||||
ftom_zoommul = M_ZOOMOUT;
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_TOGGLEKEY:
|
||||
AM_Stop();
|
||||
|
@ -491,6 +533,7 @@ boolean AM_Responder(event_t *ev)
|
|||
}
|
||||
else
|
||||
AM_restoreScaleAndLoc();
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_FOLLOWKEY:
|
||||
followplayer = !followplayer;
|
||||
|
@ -510,14 +553,32 @@ boolean AM_Responder(event_t *ev)
|
|||
switch (ev->data1)
|
||||
{
|
||||
case AM_PANRIGHTKEY:
|
||||
if (!followplayer)
|
||||
{
|
||||
m_keydown[0] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANLEFTKEY:
|
||||
if (!followplayer)
|
||||
m_paninc.x = 0;
|
||||
{
|
||||
m_keydown[1] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANUPKEY:
|
||||
if (!followplayer)
|
||||
{
|
||||
m_keydown[2] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANDOWNKEY:
|
||||
if (!followplayer)
|
||||
m_paninc.y = 0;
|
||||
{
|
||||
m_keydown[3] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_ZOOMOUTKEY:
|
||||
case AM_ZOOMINKEY:
|
||||
|
@ -718,6 +779,17 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl)
|
|||
}
|
||||
#undef DOOUTCODE
|
||||
|
||||
//
|
||||
// Draws a pixel.
|
||||
//
|
||||
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc)
|
||||
{
|
||||
UINT8 *dest = screens[0];
|
||||
if (xx < 0 || yy < 0 || xx >= vid.width || yy >= vid.height)
|
||||
return; // off the screen
|
||||
dest[(yy*vid.width) + xx] = cc;
|
||||
}
|
||||
|
||||
//
|
||||
// Classic Bresenham w/ whatever optimizations needed for speed
|
||||
//
|
||||
|
@ -739,8 +811,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
|||
}
|
||||
#endif
|
||||
|
||||
#define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART);
|
||||
|
||||
dx = fl->b.x - fl->a.x;
|
||||
ax = 2 * (dx < 0 ? -dx : dx);
|
||||
sx = dx < 0 ? -1 : 1;
|
||||
|
@ -757,7 +827,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
|||
d = ay - ax/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color)
|
||||
AM_drawPixel(x, y, color);
|
||||
if (x == fl->b.x)
|
||||
return;
|
||||
if (d >= 0)
|
||||
|
@ -774,7 +844,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
|||
d = ax - ay/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color)
|
||||
AM_drawPixel(x, y, color);
|
||||
if (y == fl->b.y)
|
||||
return;
|
||||
if (d >= 0)
|
||||
|
@ -786,8 +856,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
|||
d += ax;
|
||||
}
|
||||
}
|
||||
|
||||
#undef PUTDOT
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -852,10 +920,8 @@ static inline void AM_drawWalls(void)
|
|||
{
|
||||
size_t i;
|
||||
static mline_t l;
|
||||
#ifdef ESLOPE
|
||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
|
||||
#endif
|
||||
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
|
@ -863,13 +929,10 @@ static inline void AM_drawWalls(void)
|
|||
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
|
||||
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
|
||||
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
|
||||
#ifdef ESLOPE
|
||||
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
|
||||
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \
|
||||
} else \
|
||||
end1 = end2 = normalheight;
|
||||
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y, normalheight); \
|
||||
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y, normalheight);
|
||||
|
||||
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)
|
||||
|
@ -878,7 +941,6 @@ static inline void AM_drawWalls(void)
|
|||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
}
|
||||
#undef SLOPEPARAMS
|
||||
#endif
|
||||
|
||||
if (!lines[i].backsector) // 1-sided
|
||||
{
|
||||
|
@ -887,19 +949,11 @@ static inline void AM_drawWalls(void)
|
|||
else
|
||||
AM_drawMline(&l, WALLCOLORS);
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
|
||||
{
|
||||
if (backf1 == backc1 && backf2 == backc2
|
||||
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
|
||||
#else
|
||||
else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier
|
||||
|| lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier
|
||||
{
|
||||
if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight
|
||||
&& lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers
|
||||
#endif
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
|
@ -917,20 +971,10 @@ static inline void AM_drawWalls(void)
|
|||
else
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB) {
|
||||
#ifdef ESLOPE
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
#else
|
||||
if (lines[i].backsector->floorheight
|
||||
!= lines[i].frontsector->floorheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
#else
|
||||
else if (lines[i].backsector->ceilingheight
|
||||
!= lines[i].frontsector->ceilingheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
|
@ -938,20 +982,10 @@ static inline void AM_drawWalls(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
#else
|
||||
if (lines[i].backsector->floorheight
|
||||
!= lines[i].frontsector->floorheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floor level change
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
#else
|
||||
else if (lines[i].backsector->ceilingheight
|
||||
!= lines[i].frontsector->ceilingheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
|
@ -1100,6 +1134,12 @@ void AM_Drawer(void)
|
|||
if (!automapactive)
|
||||
return;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
AM_drawFline = HWR_drawAMline;
|
||||
#endif
|
||||
|
||||
AM_clearFB(BACKGROUND);
|
||||
if (draw_grid) AM_drawGrid(GRIDCOLORS);
|
||||
AM_drawWalls();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -38,6 +38,9 @@ void AM_Ticker(void);
|
|||
// Called by main loop, instead of view drawer if automap is active.
|
||||
void AM_Drawer(void);
|
||||
|
||||
// Enables the automap.
|
||||
void AM_Start(void);
|
||||
|
||||
// Called to force the automap to quit if the level is completed while it is up.
|
||||
void AM_Stop(void);
|
||||
|
||||
|
|
|
@ -19,10 +19,10 @@ boolean allow_fullscreen = false;
|
|||
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
void I_StartupGraphics(void){}
|
||||
void I_StartupHardwareGraphics(void){}
|
||||
|
||||
void I_ShutdownGraphics(void){}
|
||||
|
||||
void VID_StartupOpenGL(void){}
|
||||
|
||||
void I_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
(void)palette;
|
||||
|
@ -52,10 +52,8 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
void VID_CheckRenderer(void) {}
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender) {}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2019, James R.
|
||||
Copyright 2019-2020, James R.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2019, James R.
|
||||
Copyright 2019-2020, James R.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
19
src/b_bot.c
19
src/b_bot.c
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2007-2016 by John "JTE" Muniz.
|
||||
// Copyright (C) 2011-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 2011-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -74,11 +74,9 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
if (!sonic || sonic->health <= 0)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Lua can handle it!
|
||||
if (LUAh_BotAI(sonic, tails, cmd))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC)
|
||||
{
|
||||
|
@ -364,11 +362,9 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
|||
// Bot AI isn't programmed in analog.
|
||||
CV_SetValue(&cv_analog[1], false);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Let Lua scripts build ticcmds
|
||||
if (LUAh_BotTiccmd(player, cmd))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// We don't have any main character AI, sorry. D:
|
||||
if (player-players == consoleplayer)
|
||||
|
@ -463,6 +459,19 @@ boolean B_CheckRespawn(player_t *player)
|
|||
if (!sonic || sonic->health <= 0)
|
||||
return false;
|
||||
|
||||
// B_RespawnBot doesn't do anything if the condition above this isn't met
|
||||
{
|
||||
UINT8 shouldForce = LUAh_BotRespawn(sonic, tails);
|
||||
|
||||
if (P_MobjWasRemoved(sonic) || P_MobjWasRemoved(tails))
|
||||
return (shouldForce == 1); // mobj was removed
|
||||
|
||||
if (shouldForce == 1)
|
||||
return true;
|
||||
else if (shouldForce == 2)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if Sonic is busy first.
|
||||
// If he's doing any of these things, he probably doesn't want to see us.
|
||||
if (sonic->player->pflags & (PF_GLIDING|PF_SLIDING|PF_BOUNCING)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2007-2016 by John "JTE" Muniz.
|
||||
// Copyright (C) 2012-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 2012-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
|
@ -10,14 +10,13 @@ WFLAGS+=-Wno-logical-op
|
|||
endif
|
||||
endif
|
||||
|
||||
OPTS+=-DHAVE_BLUA
|
||||
|
||||
OBJS:=$(OBJS) \
|
||||
$(OBJDIR)/lapi.o \
|
||||
$(OBJDIR)/lbaselib.o \
|
||||
$(OBJDIR)/ldo.o \
|
||||
$(OBJDIR)/lfunc.o \
|
||||
$(OBJDIR)/linit.o \
|
||||
$(OBJDIR)/liolib.o \
|
||||
$(OBJDIR)/llex.o \
|
||||
$(OBJDIR)/lmem.o \
|
||||
$(OBJDIR)/lobject.o \
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../lua_script.h"
|
||||
#include "../w_wad.h"
|
||||
|
||||
#define lbaselib_c
|
||||
#define LUA_LIB
|
||||
|
||||
|
@ -263,6 +267,27 @@ static int luaB_ipairs (lua_State *L) {
|
|||
}
|
||||
|
||||
|
||||
// Edited to load PK3 entries instead
|
||||
static int luaB_dofile (lua_State *L) {
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
char fullfilename[256];
|
||||
UINT16 lumpnum;
|
||||
int n = lua_gettop(L);
|
||||
|
||||
if (wadfiles[numwadfiles - 1]->type != RET_PK3)
|
||||
luaL_error(L, "dofile() only works with PK3 files");
|
||||
|
||||
snprintf(fullfilename, sizeof(fullfilename), "Lua/%s", filename);
|
||||
lumpnum = W_CheckNumForFullNamePK3(fullfilename, numwadfiles - 1, 0);
|
||||
if (lumpnum == INT16_MAX)
|
||||
luaL_error(L, "can't find script " LUA_QS, fullfilename);
|
||||
|
||||
LUA_LoadLump(numwadfiles - 1, lumpnum, false);
|
||||
|
||||
return lua_gettop(L) - n;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_assert (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
if (!lua_toboolean(L, 1))
|
||||
|
@ -380,6 +405,7 @@ static const luaL_Reg base_funcs[] = {
|
|||
{"assert", luaB_assert},
|
||||
{"collectgarbage", luaB_collectgarbage},
|
||||
{"error", luaB_error},
|
||||
{"dofile", luaB_dofile},
|
||||
{"gcinfo", luaB_gcinfo},
|
||||
{"getfenv", luaB_getfenv},
|
||||
{"getmetatable", luaB_getmetatable},
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
static const luaL_Reg lualibs[] = {
|
||||
{"", luaopen_base},
|
||||
{LUA_TABLIBNAME, luaopen_table},
|
||||
{LUA_IOLIBNAME, luaopen_io},
|
||||
{LUA_STRLIBNAME, luaopen_string},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,640 @@
|
|||
/*
|
||||
** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $
|
||||
** Standard I/O (and system) library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define liolib_c
|
||||
#define LUA_LIB
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
#include "../i_system.h"
|
||||
#include "../g_game.h"
|
||||
#include "../d_netfil.h"
|
||||
#include "../lua_libs.h"
|
||||
#include "../byteptr.h"
|
||||
#include "../lua_script.h"
|
||||
#include "../m_misc.h"
|
||||
|
||||
|
||||
#define IO_INPUT 1
|
||||
#define IO_OUTPUT 2
|
||||
|
||||
#define FILELIMIT (1024 * 1024) // Size limit for reading/writing files
|
||||
|
||||
#define FMT_FILECALLBACKID "file_callback_%d"
|
||||
|
||||
|
||||
// Allow scripters to write files of these types to SRB2's folder
|
||||
static const char *whitelist[] = {
|
||||
".bmp",
|
||||
".cfg",
|
||||
".csv",
|
||||
".dat",
|
||||
".png",
|
||||
".sav2",
|
||||
".txt",
|
||||
};
|
||||
|
||||
|
||||
static int pushresult (lua_State *L, int i, const char *filename) {
|
||||
int en = errno; /* calls to Lua API may change this value */
|
||||
if (i) {
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
lua_pushnil(L);
|
||||
if (filename)
|
||||
lua_pushfstring(L, "%s: %s", filename, strerror(en));
|
||||
else
|
||||
lua_pushfstring(L, "%s", strerror(en));
|
||||
lua_pushinteger(L, en);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE))
|
||||
|
||||
|
||||
static int io_type (lua_State *L) {
|
||||
void *ud;
|
||||
luaL_checkany(L, 1);
|
||||
ud = lua_touserdata(L, 1);
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE);
|
||||
if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1))
|
||||
lua_pushnil(L); /* not a file */
|
||||
else if (*((FILE **)ud) == NULL)
|
||||
lua_pushliteral(L, "closed file");
|
||||
else
|
||||
lua_pushliteral(L, "file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static FILE *tofile (lua_State *L) {
|
||||
FILE **f = tofilep(L);
|
||||
if (*f == NULL)
|
||||
luaL_error(L, "attempt to use a closed file");
|
||||
return *f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** When creating file handles, always creates a `closed' file handle
|
||||
** before opening the actual file; so, if there is a memory error, the
|
||||
** file is not left opened.
|
||||
*/
|
||||
static FILE **newfile (lua_State *L) {
|
||||
FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *));
|
||||
*pf = NULL; /* file handle is currently `closed' */
|
||||
luaL_getmetatable(L, LUA_FILEHANDLE);
|
||||
lua_setmetatable(L, -2);
|
||||
return pf;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** function to (not) close the standard files stdin, stdout, and stderr
|
||||
*/
|
||||
static int io_noclose (lua_State *L) {
|
||||
lua_pushnil(L);
|
||||
lua_pushliteral(L, "cannot close standard file");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** function to close regular files
|
||||
*/
|
||||
static int io_fclose (lua_State *L) {
|
||||
FILE **p = tofilep(L);
|
||||
int ok = (fclose(*p) == 0);
|
||||
*p = NULL;
|
||||
return pushresult(L, ok, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int aux_close (lua_State *L) {
|
||||
lua_getfenv(L, 1);
|
||||
lua_getfield(L, -1, "__close");
|
||||
return (lua_tocfunction(L, -1))(L);
|
||||
}
|
||||
|
||||
|
||||
static int io_close (lua_State *L) {
|
||||
if (lua_isnone(L, 1))
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT);
|
||||
tofile(L); /* make sure argument is a file */
|
||||
return aux_close(L);
|
||||
}
|
||||
|
||||
|
||||
static int io_gc (lua_State *L) {
|
||||
FILE *f = *tofilep(L);
|
||||
/* ignore closed files */
|
||||
if (f != NULL)
|
||||
aux_close(L);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int io_tostring (lua_State *L) {
|
||||
FILE *f = *tofilep(L);
|
||||
if (f == NULL)
|
||||
lua_pushliteral(L, "file (closed)");
|
||||
else
|
||||
lua_pushfstring(L, "file (%p)", f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Create directories in the path
|
||||
void MakePathDirs(char *path)
|
||||
{
|
||||
char *c;
|
||||
|
||||
for (c = path; *c; c++)
|
||||
if (*c == '/' || *c == '\\')
|
||||
{
|
||||
char sep = *c;
|
||||
*c = '\0';
|
||||
I_mkdir(path, 0755);
|
||||
*c = sep;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int CheckFileName(lua_State *L, const char *filename)
|
||||
{
|
||||
int length = strlen(filename);
|
||||
boolean pass = false;
|
||||
size_t i;
|
||||
|
||||
if (strchr(filename, '\\'))
|
||||
{
|
||||
luaL_error(L, "access denied to %s: \\ is not allowed, use / instead", filename);
|
||||
return pushresult(L,0,filename);
|
||||
}
|
||||
|
||||
for (i = 0; i < (sizeof (whitelist) / sizeof(const char *)); i++)
|
||||
if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
|
||||
{
|
||||
pass = true;
|
||||
break;
|
||||
}
|
||||
if (strstr(filename, "./")
|
||||
|| strstr(filename, "..") || strchr(filename, ':')
|
||||
|| filename[0] == '/'
|
||||
|| !pass)
|
||||
{
|
||||
luaL_error(L, "access denied to %s", filename);
|
||||
return pushresult(L,0,filename);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int io_open (lua_State *L) {
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
const char *mode = luaL_optstring(L, 2, "r");
|
||||
int checkresult;
|
||||
|
||||
checkresult = CheckFileName(L, filename);
|
||||
if (checkresult)
|
||||
return checkresult;
|
||||
|
||||
luaL_checktype(L, 3, LUA_TFUNCTION);
|
||||
|
||||
if (!(strchr(mode, 'r') || strchr(mode, '+')))
|
||||
luaL_error(L, "open() is only for reading, use openlocal() for writing");
|
||||
|
||||
AddLuaFileTransfer(filename, mode);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int io_openlocal (lua_State *L) {
|
||||
FILE **pf;
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
const char *mode = luaL_optstring(L, 2, "r");
|
||||
char *realfilename;
|
||||
luafiletransfer_t *filetransfer;
|
||||
int checkresult;
|
||||
|
||||
checkresult = CheckFileName(L, filename);
|
||||
if (checkresult)
|
||||
return checkresult;
|
||||
|
||||
realfilename = va("%s" PATHSEP "%s", luafiledir, filename);
|
||||
|
||||
if (client && strnicmp(filename, "client/", strlen("client/")))
|
||||
I_Error("Access denied to %s\n"
|
||||
"Clients can only access files stored in luafiles/client/\n",
|
||||
filename);
|
||||
|
||||
// Prevent access if the file is being downloaded
|
||||
for (filetransfer = luafiletransfers; filetransfer; filetransfer = filetransfer->next)
|
||||
if (!stricmp(filetransfer->filename, filename))
|
||||
I_Error("Access denied to %s\n"
|
||||
"Files can't be opened while being downloaded\n",
|
||||
filename);
|
||||
|
||||
MakePathDirs(realfilename);
|
||||
|
||||
// Open and return the file
|
||||
pf = newfile(L);
|
||||
*pf = fopen(realfilename, mode);
|
||||
return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
|
||||
}
|
||||
|
||||
|
||||
void Got_LuaFile(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
FILE **pf = NULL;
|
||||
UINT8 success = READUINT8(*cp); // The first (and only) byte indicates whether the file could be opened
|
||||
|
||||
if (playernum != serverplayer)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal luafile command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!luafiletransfers)
|
||||
I_Error("No Lua file transfer\n");
|
||||
|
||||
// Retrieve the callback and push it on the stack
|
||||
lua_pushfstring(gL, FMT_FILECALLBACKID, luafiletransfers->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
|
||||
// Push the first argument (file handle or nil) on the stack
|
||||
if (success)
|
||||
{
|
||||
char mode[4];
|
||||
|
||||
// Ensure we are opening in binary mode
|
||||
// (if it's a text file, newlines have been converted already)
|
||||
strcpy(mode, luafiletransfers->mode);
|
||||
if (!strchr(mode, 'b'))
|
||||
strcat(mode, "b");
|
||||
|
||||
pf = newfile(gL); // Create and push the file handle
|
||||
*pf = fopen(luafiletransfers->realfilename, mode); // Open the file
|
||||
if (!*pf)
|
||||
I_Error("Can't open file \"%s\"\n", luafiletransfers->realfilename); // The file SHOULD exist
|
||||
}
|
||||
else
|
||||
lua_pushnil(gL);
|
||||
|
||||
// Push the second argument (file name) on the stack
|
||||
lua_pushstring(gL, luafiletransfers->filename);
|
||||
|
||||
// Call the callback
|
||||
LUA_Call(gL, 2);
|
||||
|
||||
if (success)
|
||||
{
|
||||
// Close the file
|
||||
if (*pf)
|
||||
{
|
||||
fclose(*pf);
|
||||
*pf = NULL;
|
||||
}
|
||||
|
||||
if (client)
|
||||
remove(luafiletransfers->realfilename);
|
||||
}
|
||||
|
||||
RemoveLuaFileTransfer();
|
||||
|
||||
if (waitingforluafilecommand)
|
||||
{
|
||||
waitingforluafilecommand = false;
|
||||
CL_PrepareDownloadLuaFile();
|
||||
}
|
||||
|
||||
if (server && luafiletransfers)
|
||||
SV_PrepareSendLuaFile();
|
||||
}
|
||||
|
||||
|
||||
void StoreLuaFileCallback(INT32 id)
|
||||
{
|
||||
lua_pushfstring(gL, FMT_FILECALLBACKID, id);
|
||||
lua_pushvalue(gL, 3); // Parameter 3 is the callback
|
||||
lua_settable(gL, LUA_REGISTRYINDEX); // registry[callbackid] = callback
|
||||
}
|
||||
|
||||
|
||||
void RemoveLuaFileCallback(INT32 id)
|
||||
{
|
||||
lua_pushfstring(gL, FMT_FILECALLBACKID, id);
|
||||
lua_pushnil(gL);
|
||||
lua_settable(gL, LUA_REGISTRYINDEX); // registry[callbackid] = nil
|
||||
}
|
||||
|
||||
|
||||
static int io_tmpfile (lua_State *L) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = tmpfile();
|
||||
return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;
|
||||
}
|
||||
|
||||
|
||||
static int io_readline (lua_State *L);
|
||||
|
||||
|
||||
static void aux_lines (lua_State *L, int idx, int toclose) {
|
||||
lua_pushvalue(L, idx);
|
||||
lua_pushboolean(L, toclose); /* close/not close file when finished */
|
||||
lua_pushcclosure(L, io_readline, 2);
|
||||
}
|
||||
|
||||
|
||||
static int f_lines (lua_State *L) {
|
||||
tofile(L); /* check that it's a valid file handle */
|
||||
aux_lines(L, 1, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** READ
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
|
||||
static int read_number (lua_State *L, FILE *f) {
|
||||
lua_Number d;
|
||||
if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
|
||||
lua_pushnumber(L, d);
|
||||
return 1;
|
||||
}
|
||||
else return 0; /* read fails */
|
||||
}
|
||||
|
||||
|
||||
static int test_eof (lua_State *L, FILE *f) {
|
||||
int c = getc(f);
|
||||
ungetc(c, f);
|
||||
lua_pushlstring(L, NULL, 0);
|
||||
return (c != EOF);
|
||||
}
|
||||
|
||||
|
||||
static int read_line (lua_State *L, FILE *f) {
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
for (;;) {
|
||||
size_t l;
|
||||
char *p = luaL_prepbuffer(&b);
|
||||
if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */
|
||||
luaL_pushresult(&b); /* close buffer */
|
||||
return (lua_objlen(L, -1) > 0); /* check whether read something */
|
||||
}
|
||||
l = strlen(p);
|
||||
if (l == 0 || p[l-1] != '\n')
|
||||
luaL_addsize(&b, l);
|
||||
else {
|
||||
luaL_addsize(&b, l - 1); /* do not include `eol' */
|
||||
luaL_pushresult(&b); /* close buffer */
|
||||
return 1; /* read at least an `eol' */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int read_chars (lua_State *L, FILE *f, size_t n) {
|
||||
size_t rlen; /* how much to read */
|
||||
size_t nr; /* number of chars actually read */
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
rlen = LUAL_BUFFERSIZE; /* try to read that much each time */
|
||||
do {
|
||||
char *p = luaL_prepbuffer(&b);
|
||||
if (rlen > n) rlen = n; /* cannot read more than asked */
|
||||
nr = fread(p, sizeof(char), rlen, f);
|
||||
luaL_addsize(&b, nr);
|
||||
n -= nr; /* still have to read `n' chars */
|
||||
} while (n > 0 && nr == rlen); /* until end of count or eof */
|
||||
luaL_pushresult(&b); /* close buffer */
|
||||
return (n == 0 || lua_objlen(L, -1) > 0);
|
||||
}
|
||||
|
||||
|
||||
static int g_read (lua_State *L, FILE *f, int first) {
|
||||
int nargs = lua_gettop(L) - 1;
|
||||
int success;
|
||||
int n;
|
||||
clearerr(f);
|
||||
if (nargs == 0) { /* no arguments? */
|
||||
success = read_line(L, f);
|
||||
n = first+1; /* to return 1 result */
|
||||
}
|
||||
else { /* ensure stack space for all results and for auxlib's buffer */
|
||||
luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments");
|
||||
success = 1;
|
||||
for (n = first; nargs-- && success; n++) {
|
||||
if (lua_type(L, n) == LUA_TNUMBER) {
|
||||
size_t l = (size_t)lua_tointeger(L, n);
|
||||
success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);
|
||||
}
|
||||
else {
|
||||
const char *p = lua_tostring(L, n);
|
||||
luaL_argcheck(L, p && p[0] == '*', n, "invalid option");
|
||||
switch (p[1]) {
|
||||
case 'n': /* number */
|
||||
success = read_number(L, f);
|
||||
break;
|
||||
case 'l': /* line */
|
||||
success = read_line(L, f);
|
||||
break;
|
||||
case 'a': /* file */
|
||||
read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */
|
||||
success = 1; /* always success */
|
||||
break;
|
||||
default:
|
||||
return luaL_argerror(L, n, "invalid format");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ferror(f))
|
||||
return pushresult(L, 0, NULL);
|
||||
if (!success) {
|
||||
lua_pop(L, 1); /* remove last result */
|
||||
lua_pushnil(L); /* push nil instead */
|
||||
}
|
||||
return n - first;
|
||||
}
|
||||
|
||||
|
||||
static int f_read (lua_State *L) {
|
||||
return g_read(L, tofile(L), 2);
|
||||
}
|
||||
|
||||
|
||||
static int io_readline (lua_State *L) {
|
||||
FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1));
|
||||
int sucess;
|
||||
if (f == NULL) /* file is already closed? */
|
||||
luaL_error(L, "file is already closed");
|
||||
sucess = read_line(L, f);
|
||||
if (ferror(f))
|
||||
return luaL_error(L, "%s", strerror(errno));
|
||||
if (sucess) return 1;
|
||||
else { /* EOF */
|
||||
if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */
|
||||
lua_settop(L, 0);
|
||||
lua_pushvalue(L, lua_upvalueindex(1));
|
||||
aux_close(L); /* close it */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
static int g_write (lua_State *L, FILE *f, int arg) {
|
||||
int nargs = lua_gettop(L) - 1;
|
||||
int status = 1;
|
||||
for (; nargs--; arg++) {
|
||||
if (lua_type(L, arg) == LUA_TNUMBER) {
|
||||
/* optimization: could be done exactly as for strings */
|
||||
status = status &&
|
||||
fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0;
|
||||
}
|
||||
else {
|
||||
size_t l;
|
||||
const char *s = luaL_checklstring(L, arg, &l);
|
||||
if (ftell(f) + l > FILELIMIT) {
|
||||
luaL_error(L,"write limit bypassed in file. Changes have been discarded.");
|
||||
break;
|
||||
}
|
||||
status = status && (fwrite(s, sizeof(char), l, f) == l);
|
||||
}
|
||||
}
|
||||
return pushresult(L, status, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int f_write (lua_State *L) {
|
||||
return g_write(L, tofile(L), 2);
|
||||
}
|
||||
|
||||
|
||||
static int f_seek (lua_State *L) {
|
||||
static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END};
|
||||
static const char *const modenames[] = {"set", "cur", "end", NULL};
|
||||
FILE *f = tofile(L);
|
||||
int op = luaL_checkoption(L, 2, "cur", modenames);
|
||||
long offset = luaL_optlong(L, 3, 0);
|
||||
op = fseek(f, offset, mode[op]);
|
||||
if (op)
|
||||
return pushresult(L, 0, NULL); /* error */
|
||||
else {
|
||||
lua_pushinteger(L, ftell(f));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int f_setvbuf (lua_State *L) {
|
||||
static const int mode[] = {_IONBF, _IOFBF, _IOLBF};
|
||||
static const char *const modenames[] = {"no", "full", "line", NULL};
|
||||
FILE *f = tofile(L);
|
||||
int op = luaL_checkoption(L, 2, NULL, modenames);
|
||||
lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE);
|
||||
int res = setvbuf(f, NULL, mode[op], sz);
|
||||
return pushresult(L, res == 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int f_flush (lua_State *L) {
|
||||
return pushresult(L, fflush(tofile(L)) == 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg iolib[] = {
|
||||
{"close", io_close},
|
||||
{"open", io_open},
|
||||
{"openlocal", io_openlocal},
|
||||
{"tmpfile", io_tmpfile},
|
||||
{"type", io_type},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static const luaL_Reg flib[] = {
|
||||
{"close", io_close},
|
||||
{"flush", f_flush},
|
||||
{"lines", f_lines},
|
||||
{"read", f_read},
|
||||
{"seek", f_seek},
|
||||
{"setvbuf", f_setvbuf},
|
||||
{"write", f_write},
|
||||
{"__gc", io_gc},
|
||||
{"__tostring", io_tostring},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static void createmeta (lua_State *L) {
|
||||
luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */
|
||||
lua_pushvalue(L, -1); /* push metatable */
|
||||
lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
|
||||
luaL_register(L, NULL, flib); /* file methods */
|
||||
}
|
||||
|
||||
|
||||
static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) {
|
||||
*newfile(L) = f;
|
||||
if (k > 0) {
|
||||
lua_pushvalue(L, -1);
|
||||
lua_rawseti(L, LUA_ENVIRONINDEX, k);
|
||||
}
|
||||
lua_pushvalue(L, -2); /* copy environment */
|
||||
lua_setfenv(L, -2); /* set it */
|
||||
lua_setfield(L, -3, fname);
|
||||
}
|
||||
|
||||
|
||||
static void newfenv (lua_State *L, lua_CFunction cls) {
|
||||
lua_createtable(L, 0, 1);
|
||||
lua_pushcfunction(L, cls);
|
||||
lua_setfield(L, -2, "__close");
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaopen_io (lua_State *L) {
|
||||
createmeta(L);
|
||||
/* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */
|
||||
newfenv(L, io_fclose);
|
||||
lua_replace(L, LUA_ENVIRONINDEX);
|
||||
/* open library */
|
||||
luaL_register(L, LUA_IOLIBNAME, iolib);
|
||||
/* create (and set) default files */
|
||||
newfenv(L, io_noclose); /* close function for default files */
|
||||
createstdfile(L, stdin, IO_INPUT, "stdin");
|
||||
createstdfile(L, stdout, IO_OUTPUT, "stdout");
|
||||
createstdfile(L, stderr, 0, "stderr");
|
||||
lua_pop(L, 1); /* pop environment for default files */
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -21,6 +21,9 @@ LUALIB_API int (luaopen_base) (lua_State *L);
|
|||
#define LUA_TABLIBNAME "table"
|
||||
LUALIB_API int (luaopen_table) (lua_State *L);
|
||||
|
||||
#define LUA_IOLIBNAME "io"
|
||||
LUALIB_API int (luaopen_io) (lua_State *L);
|
||||
|
||||
#define LUA_STRLIBNAME "string"
|
||||
LUALIB_API int (luaopen_string) (lua_State *L);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -150,15 +150,15 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
|||
|
||||
#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 WRITESTRING(p,s) { size_t tmp_i = 0; for (; s[tmp_i] != '\0'; tmp_i++) WRITECHAR(p, s[tmp_i]); WRITECHAR(p, '\0');}
|
||||
#define WRITEMEM(p,s,n) { memcpy(p, s, n); p += n; }
|
||||
#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) 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) do { memcpy(p, s, n); p += n; } while (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 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 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 READMEM(p,s,n) ({ memcpy(s, p, n); p += n; })
|
||||
|
||||
#if 0 // old names
|
||||
#define WRITEBYTE(p,b) WRITEUINT8(p,b)
|
||||
|
|
272
src/command.c
272
src/command.c
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -33,6 +33,7 @@
|
|||
#include "p_setup.h"
|
||||
#include "lua_script.h"
|
||||
#include "d_netfil.h" // findfile
|
||||
#include "r_data.h" // Color_cons_t
|
||||
|
||||
//========
|
||||
// protos.
|
||||
|
@ -56,7 +57,13 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
|
|||
static boolean CV_Command(void);
|
||||
consvar_t *CV_FindVar(const char *name);
|
||||
static const char *CV_StringValue(const char *var_name);
|
||||
|
||||
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_Parse(char *data);
|
||||
|
@ -80,7 +87,7 @@ static boolean joyaxis2_default = false;
|
|||
static INT32 joyaxis_count = 0;
|
||||
static INT32 joyaxis2_count = 0;
|
||||
|
||||
#define COM_BUF_SIZE 8192 // command buffer size
|
||||
#define COM_BUF_SIZE (32<<10) // command buffer size
|
||||
#define MAX_ALIAS_RECURSION 100 // max recursion allowed for aliases
|
||||
|
||||
static INT32 com_wait; // one command per frame (for cmd sequences)
|
||||
|
@ -481,13 +488,11 @@ void COM_AddCommand(const char *name, com_func_t func)
|
|||
{
|
||||
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// don't I_Error for Lua commands
|
||||
// Lua commands can replace game commands, and they have priority.
|
||||
// BUT, if for some reason we screwed up and made two console commands with the same name,
|
||||
// it's good to have this here so we find out.
|
||||
if (cmd->function != COM_Lua_f)
|
||||
#endif
|
||||
I_Error("Command %s already exists\n", name);
|
||||
|
||||
return;
|
||||
|
@ -501,7 +506,6 @@ void COM_AddCommand(const char *name, com_func_t func)
|
|||
com_commands = cmd;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
/** Adds a console command for Lua.
|
||||
* No I_Errors allowed; return a negative code instead.
|
||||
*
|
||||
|
@ -534,7 +538,6 @@ int COM_AddLuaCommand(const char *name)
|
|||
com_commands = cmd;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Tests if a command exists.
|
||||
*
|
||||
|
@ -624,7 +627,7 @@ static void COM_ExecuteString(char *ptext)
|
|||
|
||||
// check cvars
|
||||
// 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)
|
||||
CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
|
||||
}
|
||||
|
@ -816,6 +819,18 @@ static void COM_Help_f(void)
|
|||
CONS_Printf(" Yes or No (On or Off, 1 or 0)\n");
|
||||
else if (cvar->PossibleValue == CV_OnOff)
|
||||
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
|
||||
{
|
||||
#define MINVAL 0
|
||||
|
@ -823,8 +838,13 @@ static void COM_Help_f(void)
|
|||
if (!stricmp(cvar->PossibleValue[MINVAL].strvalue, "MIN"))
|
||||
{
|
||||
if (floatmode)
|
||||
CONS_Printf(" range from %f to %f\n", FIXED_TO_FLOAT(cvar->PossibleValue[MINVAL].value),
|
||||
FIXED_TO_FLOAT(cvar->PossibleValue[MAXVAL].value));
|
||||
{
|
||||
float fu = FIXED_TO_FLOAT(cvar->PossibleValue[MINVAL].value);
|
||||
float ck = FIXED_TO_FLOAT(cvar->PossibleValue[MAXVAL].value);
|
||||
CONS_Printf(" range from %ld%s to %ld%s\n",
|
||||
(long)fu, M_Ftrim(fu),
|
||||
(long)ck, M_Ftrim(ck));
|
||||
}
|
||||
else
|
||||
CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[MINVAL].value,
|
||||
cvar->PossibleValue[MAXVAL].value);
|
||||
|
@ -973,7 +993,10 @@ static void COM_Add_f(void)
|
|||
}
|
||||
|
||||
if (( cvar->flags & CV_FLOAT ))
|
||||
CV_Set(cvar, va("%f", FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2))));
|
||||
{
|
||||
float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2));
|
||||
CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n)));
|
||||
}
|
||||
else
|
||||
CV_AddValue(cvar, atoi(COM_Argv(2)));
|
||||
}
|
||||
|
@ -1117,14 +1140,16 @@ consvar_t *CV_FindVar(const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/** Builds a unique Net Variable identifier number, which is used
|
||||
* in network packets instead of the full name.
|
||||
#ifdef OLD22DEMOCOMPAT
|
||||
/** 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.
|
||||
* \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;
|
||||
static UINT16 premiers[16] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
|
||||
|
@ -1138,16 +1163,47 @@ static inline UINT16 CV_ComputeNetid(const char *s)
|
|||
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.
|
||||
*
|
||||
* \param netid The variable's identifier number.
|
||||
* \return A pointer to the variable itself if found, or NULL.
|
||||
* \sa CV_ComputeNetid
|
||||
*/
|
||||
static consvar_t *CV_FindNetVar(UINT16 netid)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
|
||||
if (netid >= consvar_number_of_netids)
|
||||
return NULL;
|
||||
|
||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
if (cvar->netid == netid)
|
||||
return cvar;
|
||||
|
@ -1157,6 +1213,32 @@ static consvar_t *CV_FindNetVar(UINT16 netid)
|
|||
|
||||
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.
|
||||
*
|
||||
* \param variable The variable to register.
|
||||
|
@ -1180,11 +1262,15 @@ void CV_RegisterVar(consvar_t *variable)
|
|||
// check net variables
|
||||
if (variable->flags & CV_NETVAR)
|
||||
{
|
||||
const consvar_t *netvar;
|
||||
variable->netid = CV_ComputeNetid(variable->name);
|
||||
netvar = CV_FindNetVar(variable->netid);
|
||||
if (netvar)
|
||||
I_Error("Variables %s and %s have same netid\n", variable->name, netvar->name);
|
||||
variable->netid = consvar_number_of_netids++;
|
||||
|
||||
/* in case of overflow... */
|
||||
if (variable->netid > consvar_number_of_netids)
|
||||
I_Error("Way too many netvars");
|
||||
|
||||
#ifdef OLD22DEMOCOMPAT
|
||||
CV_RegisterOldDemoVar(variable);
|
||||
#endif
|
||||
}
|
||||
|
||||
// link the variable in
|
||||
|
@ -1419,9 +1505,7 @@ finish:
|
|||
}
|
||||
var->flags |= CV_MODIFIED;
|
||||
// raise 'on change' code
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_CVarChanged(var->name); // let consolelib know what cvar this is.
|
||||
#endif
|
||||
if (var->flags & CV_CALL && !stealth)
|
||||
var->func();
|
||||
|
||||
|
@ -1446,38 +1530,117 @@ badinput:
|
|||
|
||||
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)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
UINT16 netid;
|
||||
char *svalue;
|
||||
UINT8 stealth = false;
|
||||
boolean stealth;
|
||||
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum) && !serverloading)
|
||||
{
|
||||
// not from server or remote admin, must be hacked/buggy client
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal netvar command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
netid = READUINT16(*p);
|
||||
cvar = CV_FindNetVar(netid);
|
||||
svalue = (char *)*p;
|
||||
SKIPSTRING(*p);
|
||||
stealth = READUINT8(*p);
|
||||
|
||||
if (!cvar)
|
||||
{
|
||||
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));
|
||||
cvar = ReadNetVar(p, &svalue, &stealth);
|
||||
|
||||
if (cvar)
|
||||
Setvalue(cvar, svalue, stealth);
|
||||
}
|
||||
|
||||
void CV_SaveNetVars(UINT8 **p)
|
||||
void CV_SaveVars(UINT8 **p, boolean in_demo)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
UINT8 *count_p = *p;
|
||||
|
@ -1489,6 +1652,9 @@ void CV_SaveNetVars(UINT8 **p)
|
|||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
if ((cvar->flags & CV_NETVAR) && !CV_IsSetToDefault(cvar))
|
||||
{
|
||||
if (in_demo)
|
||||
WRITESTRING(*p, cvar->name);
|
||||
else
|
||||
WRITEUINT16(*p, cvar->netid);
|
||||
WRITESTRING(*p, cvar->string);
|
||||
WRITEUINT8(*p, false);
|
||||
|
@ -1497,11 +1663,15 @@ void CV_SaveNetVars(UINT8 **p)
|
|||
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;
|
||||
UINT16 count;
|
||||
|
||||
char *val;
|
||||
boolean stealth;
|
||||
|
||||
// prevent "invalid command received"
|
||||
serverloading = true;
|
||||
|
||||
|
@ -1511,11 +1681,33 @@ void CV_LoadNetVars(UINT8 **p)
|
|||
|
||||
count = READUINT16(*p);
|
||||
while (count--)
|
||||
Got_NetVar(p, 0);
|
||||
{
|
||||
cvar = (*got)(p, &val, &stealth);
|
||||
|
||||
if (cvar)
|
||||
Setvalue(cvar, val, stealth);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
void CV_ResetCheatNetVars(void)
|
||||
|
@ -1572,7 +1764,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
|||
// send the value of the variable
|
||||
UINT8 buf[128];
|
||||
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);
|
||||
return;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -144,6 +144,19 @@ typedef struct consvar_s //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NUL
|
|||
struct consvar_s *next;
|
||||
} 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_YesNo[];
|
||||
extern CV_PossibleValue_t CV_Unsigned[];
|
||||
|
@ -184,9 +197,18 @@ void CV_AddValue(consvar_t *var, INT32 increment);
|
|||
void CV_SaveVariables(FILE *f);
|
||||
|
||||
// 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);
|
||||
|
||||
#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
|
||||
void CV_ResetCheatNetVars(void);
|
||||
|
||||
|
|
|
@ -26,14 +26,18 @@
|
|||
#else
|
||||
|
||||
/* Manually defined asset hashes for non-CMake builds
|
||||
* Last updated 2019 / 12 / 06 - v2.2.0 - main assets
|
||||
* Last updated 20?? / ?? / ?? - v2.2.? - patch.pk3
|
||||
* Last updated 2020 / 02 / 15 - v2.2.1 - main assets
|
||||
* 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 / 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 "51419a33b4982d840c6772c159ba7c0a"
|
||||
#define ASSET_HASH_ZONES_PK3 "df74843919fd51af26a0baa8e21e4c19"
|
||||
#define ASSET_HASH_PLAYER_DTA "56a247e074dd0dc794b6617efef1e918"
|
||||
#define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28"
|
||||
#define ASSET_HASH_ZONES_PK3 "f7e88afb6af7996a834c7d663144bead"
|
||||
#define ASSET_HASH_PLAYER_DTA "49dad7b24634c89728cc3e0b689e12bb"
|
||||
#ifdef USE_PATCH_DTA
|
||||
#define ASSET_HASH_PATCH_PK3 "there is no patch.pk3, only zuul"
|
||||
#define ASSET_HASH_PATCH_PK3 "ecf00060f03c76b3e49c6ae3925b627f"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
112
src/console.c
112
src/console.c
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -32,6 +32,7 @@
|
|||
#include "d_main.h"
|
||||
#include "m_menu.h"
|
||||
#include "filesrch.h"
|
||||
#include "m_misc.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include "win32/win_main.h"
|
||||
|
@ -96,6 +97,7 @@ static void CON_InputInit(void);
|
|||
static void CON_RecalcSize(void);
|
||||
static void CON_ChangeHeight(void);
|
||||
|
||||
static void CON_DrawBackpic(void);
|
||||
static void CONS_hudlines_Change(void);
|
||||
static void CONS_backcolor_Change(void);
|
||||
|
||||
|
@ -768,7 +770,7 @@ boolean CON_Responder(event_t *ev)
|
|||
// check for console toggle key
|
||||
if (ev->type != ev_console)
|
||||
{
|
||||
if (modeattacking || metalrecording || menuactive)
|
||||
if (modeattacking || metalrecording || marathonmode)
|
||||
return false;
|
||||
|
||||
if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1])
|
||||
|
@ -806,6 +808,33 @@ boolean CON_Responder(event_t *ev)
|
|||
|| key == KEY_LALT || key == KEY_RALT)
|
||||
return true;
|
||||
|
||||
if (key == KEY_LEFTARROW)
|
||||
{
|
||||
if (input_cur != 0)
|
||||
{
|
||||
if (ctrldown)
|
||||
input_cur = M_JumpWordReverse(inputlines[inputline], input_cur);
|
||||
else
|
||||
--input_cur;
|
||||
}
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
{
|
||||
if (input_cur < input_len)
|
||||
{
|
||||
if (ctrldown)
|
||||
input_cur += M_JumpWord(&inputlines[inputline][input_cur]);
|
||||
else
|
||||
++input_cur;
|
||||
}
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ctrl modifier -- changes behavior, adds shortcuts
|
||||
if (ctrldown)
|
||||
{
|
||||
|
@ -958,23 +987,6 @@ boolean CON_Responder(event_t *ev)
|
|||
con_scrollup--;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == KEY_LEFTARROW)
|
||||
{
|
||||
if (input_cur != 0)
|
||||
--input_cur;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
{
|
||||
if (input_cur < input_len)
|
||||
++input_cur;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_HOME)
|
||||
{
|
||||
input_cur = 0;
|
||||
|
@ -1519,6 +1531,51 @@ static void CON_DrawHudlines(void)
|
|||
con_clearlines = y; // this is handled by HU_Erase();
|
||||
}
|
||||
|
||||
// Lactozilla: Draws the console's background picture.
|
||||
static void CON_DrawBackpic(void)
|
||||
{
|
||||
patch_t *con_backpic;
|
||||
lumpnum_t piclump;
|
||||
int x, w, h;
|
||||
|
||||
// Get the lumpnum for CONSBACK, or fallback into MISSING.
|
||||
piclump = W_CheckNumForName("CONSBACK");
|
||||
if (piclump == LUMPERROR)
|
||||
piclump = W_GetNumForName("MISSING");
|
||||
|
||||
// Cache the Software patch.
|
||||
con_backpic = W_CacheSoftwarePatchNum(piclump, PU_PATCH);
|
||||
|
||||
// Center the backpic, and draw a vertically cropped patch.
|
||||
w = (con_backpic->width * vid.dupx);
|
||||
x = (vid.width / 2) - (w / 2);
|
||||
h = con_curlines/vid.dupy;
|
||||
|
||||
// If the patch doesn't fill the entire screen,
|
||||
// then fill the sides with a solid color.
|
||||
if (x > 0)
|
||||
{
|
||||
column_t *column = (column_t *)((UINT8 *)(con_backpic) + LONG(con_backpic->columnofs[0]));
|
||||
if (!column->topdelta)
|
||||
{
|
||||
UINT8 *source = (UINT8 *)(column) + 3;
|
||||
INT32 color = (source[0] | V_NOSCALESTART);
|
||||
// left side
|
||||
V_DrawFill(0, 0, x, con_curlines, color);
|
||||
// right side
|
||||
V_DrawFill((x + w), 0, (vid.width - w), con_curlines, color);
|
||||
}
|
||||
}
|
||||
|
||||
// Cache the patch normally.
|
||||
con_backpic = W_CachePatchNum(piclump, PU_PATCH);
|
||||
V_DrawCroppedPatch(x << FRACBITS, 0, FRACUNIT, V_NOSCALESTART, con_backpic,
|
||||
0, ( BASEVIDHEIGHT - h ), BASEVIDWIDTH, h);
|
||||
|
||||
// Unlock the cached patch.
|
||||
W_UnlockCachedPatch(con_backpic);
|
||||
}
|
||||
|
||||
// draw the console background, text, and prompt if enough place
|
||||
//
|
||||
static void CON_DrawConsole(void)
|
||||
|
@ -1540,19 +1597,7 @@ static void CON_DrawConsole(void)
|
|||
|
||||
// draw console background
|
||||
if (cons_backpic.value || con_forcepic)
|
||||
{
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_PATCH);
|
||||
int h;
|
||||
|
||||
h = con_curlines/vid.dupy;
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
//V_DrawScaledPatch(0, 0, 0, con_backpic);
|
||||
V_DrawCroppedPatch(0, 0, FRACUNIT, 0, con_backpic,
|
||||
0, ( BASEVIDHEIGHT - h ), BASEVIDWIDTH, h);
|
||||
|
||||
W_UnlockCachedPatch(con_backpic);
|
||||
}
|
||||
CON_DrawBackpic();
|
||||
else
|
||||
{
|
||||
// inu: no more width (was always 0 and vid.width)
|
||||
|
@ -1604,10 +1649,7 @@ void CON_Drawer(void)
|
|||
return;
|
||||
|
||||
if (needpatchrecache)
|
||||
{
|
||||
W_FlushCachedPatches();
|
||||
HU_LoadGraphics();
|
||||
}
|
||||
|
||||
if (con_recalc)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
1152
src/d_clisrv.c
1152
src/d_clisrv.c
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -20,14 +20,11 @@
|
|||
#include "d_player.h"
|
||||
|
||||
/*
|
||||
The 'packet version' may be used with packets whose
|
||||
format is expected to change between versions.
|
||||
|
||||
This version is independent of the mod name, and standard
|
||||
version and subversion. It should only account for the
|
||||
basic fields of the packet, and change infrequently.
|
||||
The 'packet version' is used to distinguish packet formats.
|
||||
This version is independent of VERSION and SUBVERSION. Different
|
||||
applications may follow different packet versions.
|
||||
*/
|
||||
#define PACKETVERSION 2
|
||||
#define PACKETVERSION 3
|
||||
|
||||
// Network play related stuff.
|
||||
// There is a data struct that stores network
|
||||
|
@ -36,7 +33,8 @@ basic fields of the packet, and change infrequently.
|
|||
// be transmitted.
|
||||
|
||||
// Networking and tick handling related.
|
||||
#define BACKUPTICS 32
|
||||
#define BACKUPTICS 1024
|
||||
#define CLIENTBACKUPTICS 32
|
||||
#define MAXTEXTCMD 256
|
||||
//
|
||||
// Packet structure
|
||||
|
@ -67,6 +65,10 @@ typedef enum
|
|||
PT_RESYNCHEND, // Player is now resynched and is being requested to remake the gametic
|
||||
PT_RESYNCHGET, // Player got resynch packet
|
||||
|
||||
PT_SENDINGLUAFILE, // Server telling a client Lua needs to open a file
|
||||
PT_ASKLUAFILE, // Client telling the server they don't have the file
|
||||
PT_HASLUAFILE, // Client telling the server they have the file
|
||||
|
||||
// Add non-PT_CANFAIL packet types here to avoid breaking MS compatibility.
|
||||
|
||||
PT_CANFAIL, // This is kind of a priority. Anything bigger than CANFAIL
|
||||
|
@ -74,6 +76,8 @@ typedef enum
|
|||
// In addition, this packet can't occupy all the available slots.
|
||||
|
||||
PT_FILEFRAGMENT = PT_CANFAIL, // A part of a file.
|
||||
PT_FILEACK,
|
||||
PT_FILERECEIVED,
|
||||
|
||||
PT_TEXTCMD, // Extra text commands from the client.
|
||||
PT_TEXTCMD2, // Splitscreen text commands.
|
||||
|
@ -127,7 +131,7 @@ typedef struct
|
|||
// this packet is too large
|
||||
typedef struct
|
||||
{
|
||||
UINT8 starttic;
|
||||
tic_t starttic;
|
||||
UINT8 numtics;
|
||||
UINT8 numslots; // "Slots filled": Highest player number in use plus one.
|
||||
ticcmd_t cmds[45]; // Normally [BACKUPTIC][MAXPLAYERS] but too large
|
||||
|
@ -170,6 +174,9 @@ typedef struct
|
|||
UINT32 pflags; // pflags_t
|
||||
UINT8 panim; // panim_t
|
||||
|
||||
INT16 angleturn;
|
||||
INT16 oldrelangleturn;
|
||||
|
||||
angle_t aiming;
|
||||
INT32 currentweapon;
|
||||
INT32 ringweapons;
|
||||
|
@ -187,7 +194,7 @@ typedef struct
|
|||
SINT8 xtralife;
|
||||
SINT8 pity;
|
||||
|
||||
UINT8 skincolor;
|
||||
UINT16 skincolor;
|
||||
INT32 skin;
|
||||
UINT32 availabilities;
|
||||
// Just in case Lua does something like
|
||||
|
@ -307,7 +314,7 @@ typedef struct
|
|||
|
||||
// 0xFF == not in game; else player skin num
|
||||
UINT8 playerskins[MAXPLAYERS];
|
||||
UINT8 playercolor[MAXPLAYERS];
|
||||
UINT16 playercolor[MAXPLAYERS];
|
||||
UINT32 playeravailabilities[MAXPLAYERS];
|
||||
|
||||
UINT8 gametype;
|
||||
|
@ -319,13 +326,30 @@ typedef struct
|
|||
UINT8 varlengthinputs[0]; // Playernames and netvars
|
||||
} ATTRPACK serverconfig_pak;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
UINT8 fileid;
|
||||
UINT32 filesize;
|
||||
UINT8 iteration;
|
||||
UINT32 position;
|
||||
UINT16 size;
|
||||
UINT8 data[0]; // Size is variable using hardware_MAXPACKETLENGTH
|
||||
} ATTRPACK filetx_pak;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 start;
|
||||
UINT32 acks;
|
||||
} ATTRPACK fileacksegment_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 fileid;
|
||||
UINT8 iteration;
|
||||
UINT8 numsegments;
|
||||
fileacksegment_t segments[0];
|
||||
} ATTRPACK fileack_pak;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default : 4200)
|
||||
#endif
|
||||
|
@ -361,6 +385,7 @@ typedef struct
|
|||
UINT8 subversion;
|
||||
UINT8 numberofplayer;
|
||||
UINT8 maxplayer;
|
||||
UINT8 refusereason; // 0: joinable, 1: joins disabled, 2: full
|
||||
char gametypename[24];
|
||||
UINT8 modifiedgame;
|
||||
UINT8 cheatsenabled;
|
||||
|
@ -412,7 +437,7 @@ typedef struct
|
|||
{
|
||||
char name[MAXPLAYERNAME+1];
|
||||
UINT8 skin;
|
||||
UINT8 color;
|
||||
UINT16 color;
|
||||
UINT32 pflags;
|
||||
UINT32 score;
|
||||
UINT8 ctfteam;
|
||||
|
@ -440,6 +465,8 @@ typedef struct
|
|||
UINT8 resynchgot; //
|
||||
UINT8 textcmd[MAXTEXTCMD+1]; // 66049 bytes (wut??? 64k??? More like 257 bytes...)
|
||||
filetx_pak filetxpak; // 139 bytes
|
||||
fileack_pak fileack;
|
||||
UINT8 filereceived;
|
||||
clientconfig_pak clientcfg; // 136 bytes
|
||||
UINT8 md5sum[16];
|
||||
serverinfo_pak serverinfo; // 1024 bytes
|
||||
|
@ -485,6 +512,7 @@ extern consvar_t cv_playbackspeed;
|
|||
#define KICK_MSG_PING_HIGH 6
|
||||
#define KICK_MSG_CUSTOM_KICK 7
|
||||
#define KICK_MSG_CUSTOM_BAN 8
|
||||
#define KICK_MSG_KEEP_BODY 0x80
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -512,10 +540,12 @@ extern UINT32 realpingtable[MAXPLAYERS];
|
|||
extern UINT32 playerpingtable[MAXPLAYERS];
|
||||
extern tic_t servermaxping;
|
||||
|
||||
extern consvar_t cv_joinnextround, cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
extern consvar_t cv_netticbuffer, cv_allownewplayer, cv_joinnextround, cv_maxplayers, cv_joindelay, cv_rejointimeout;
|
||||
extern consvar_t cv_resynchattempts, cv_blamecfail;
|
||||
extern consvar_t cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
|
||||
// Used in d_net, the only dependence
|
||||
tic_t ExpandTics(INT32 low);
|
||||
tic_t ExpandTics(INT32 low, INT32 node);
|
||||
void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
|
@ -529,7 +559,6 @@ void NetUpdate(void);
|
|||
|
||||
void SV_StartSinglePlayerServer(void);
|
||||
boolean SV_SpawnServer(void);
|
||||
void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle);
|
||||
void SV_StopServer(void);
|
||||
void SV_ResetServer(void);
|
||||
void CL_AddSplitscreenPlayer(void);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
271
src/d_main.c
271
src/d_main.c
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -91,9 +91,11 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
|||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_script.h"
|
||||
#endif
|
||||
|
||||
// Version numbers for netplay :upside_down_face:
|
||||
int VERSION;
|
||||
int SUBVERSION;
|
||||
|
||||
// platform independant focus loss
|
||||
UINT8 window_notinfocus = false;
|
||||
|
@ -127,6 +129,12 @@ boolean advancedemo;
|
|||
INT32 debugload = 0;
|
||||
#endif
|
||||
|
||||
UINT16 numskincolors;
|
||||
menucolor_t *menucolorhead, *menucolortail;
|
||||
|
||||
char savegamename[256];
|
||||
char liveeventbackup[256];
|
||||
|
||||
char srb2home[256] = ".";
|
||||
char srb2path[256] = ".";
|
||||
boolean usehome = true;
|
||||
|
@ -188,14 +196,14 @@ void D_ProcessEvents(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
// console input
|
||||
if (CON_Responder(ev))
|
||||
continue; // ate the event
|
||||
|
||||
// Menu input
|
||||
if (M_Responder(ev))
|
||||
continue; // menu ate the event
|
||||
|
||||
// console input
|
||||
if (CON_Responder(ev))
|
||||
continue; // ate the event
|
||||
|
||||
G_Responder(ev);
|
||||
}
|
||||
}
|
||||
|
@ -266,6 +274,9 @@ static void D_Display(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
if (rendermode == render_soft && !splitscreen)
|
||||
R_CheckViewMorph();
|
||||
|
||||
// change the view size if needed
|
||||
if (setsizeneeded || setrenderstillneeded)
|
||||
{
|
||||
|
@ -309,7 +320,9 @@ static void D_Display(void)
|
|||
F_WipeStartScreen();
|
||||
// Check for Mega Genesis fade
|
||||
wipestyleflags = WSF_FADEOUT;
|
||||
if (F_TryColormapFade(31))
|
||||
if (wipegamestate == (gamestate_t)FORCEWIPE)
|
||||
F_WipeColorFill(31);
|
||||
else if (F_TryColormapFade(31))
|
||||
wipetypepost = -1; // Don't run the fade below this one
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
||||
|
@ -408,6 +421,7 @@ static void D_Display(void)
|
|||
|
||||
if (!automapactive && !dedicated && cv_renderview.value)
|
||||
{
|
||||
rs_rendercalltime = I_GetTimeMicros();
|
||||
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
|
||||
{
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
|
@ -446,11 +460,15 @@ static void D_Display(void)
|
|||
// Image postprocessing effect
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (!splitscreen)
|
||||
R_ApplyViewMorph();
|
||||
|
||||
if (postimgtype)
|
||||
V_DoPostProcessor(0, postimgtype, postimgparam);
|
||||
if (postimgtype2)
|
||||
V_DoPostProcessor(1, postimgtype2, postimgparam2);
|
||||
}
|
||||
rs_rendercalltime = I_GetTimeMicros() - rs_rendercalltime;
|
||||
}
|
||||
|
||||
if (lastdraw)
|
||||
|
@ -505,7 +523,6 @@ static void D_Display(void)
|
|||
M_Drawer(); // menu is drawn even on top of everything
|
||||
// focus lost moved to M_Drawer
|
||||
|
||||
if (gamestate != GS_TIMEATTACK)
|
||||
CON_Drawer();
|
||||
|
||||
//
|
||||
|
@ -587,22 +604,96 @@ static void D_Display(void)
|
|||
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s);
|
||||
}
|
||||
|
||||
if (cv_renderstats.value)
|
||||
{
|
||||
char s[50];
|
||||
int frametime = I_GetTimeMicros() - rs_prevframetime;
|
||||
int divisor = 1;
|
||||
rs_prevframetime = I_GetTimeMicros();
|
||||
|
||||
if (rs_rendercalltime > 10000) divisor = 1000;
|
||||
|
||||
snprintf(s, sizeof s - 1, "ft %d", frametime / divisor);
|
||||
V_DrawThinString(30, 10, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "rtot %d", rs_rendercalltime / divisor);
|
||||
V_DrawThinString(30, 20, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "bsp %d", rs_bsptime / divisor);
|
||||
V_DrawThinString(30, 30, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nbsp %d", rs_numbspcalls);
|
||||
V_DrawThinString(80, 10, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nspr %d", rs_numsprites);
|
||||
V_DrawThinString(80, 20, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nnod %d", rs_numdrawnodes);
|
||||
V_DrawThinString(80, 30, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "npob %d", rs_numpolyobjects);
|
||||
V_DrawThinString(80, 40, V_MONOSPACE | V_BLUEMAP, s);
|
||||
if (rendermode == render_opengl) // OpenGL specific stats
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "nsrt %d", rs_hw_nodesorttime / divisor);
|
||||
V_DrawThinString(30, 40, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ndrw %d", rs_hw_nodedrawtime / divisor);
|
||||
V_DrawThinString(30, 50, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ssrt %d", rs_hw_spritesorttime / divisor);
|
||||
V_DrawThinString(30, 60, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "sdrw %d", rs_hw_spritedrawtime / divisor);
|
||||
V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor);
|
||||
V_DrawThinString(30, 80, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
if (cv_glbatching.value)
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "bsrt %d", rs_hw_batchsorttime / divisor);
|
||||
V_DrawThinString(80, 55, V_MONOSPACE | V_REDMAP, s);
|
||||
snprintf(s, sizeof s - 1, "bdrw %d", rs_hw_batchdrawtime / divisor);
|
||||
V_DrawThinString(80, 65, V_MONOSPACE | V_REDMAP, s);
|
||||
|
||||
snprintf(s, sizeof s - 1, "npol %d", rs_hw_numpolys);
|
||||
V_DrawThinString(130, 10, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ndc %d", rs_hw_numcalls);
|
||||
V_DrawThinString(130, 20, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nshd %d", rs_hw_numshaders);
|
||||
V_DrawThinString(130, 30, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nvrt %d", rs_hw_numverts);
|
||||
V_DrawThinString(130, 40, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ntex %d", rs_hw_numtextures);
|
||||
V_DrawThinString(185, 10, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "npf %d", rs_hw_numpolyflags);
|
||||
V_DrawThinString(185, 20, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ncol %d", rs_hw_numcolors);
|
||||
V_DrawThinString(185, 30, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
}
|
||||
}
|
||||
else // software specific stats
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "prtl %d", rs_sw_portaltime / divisor);
|
||||
V_DrawThinString(30, 40, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "plns %d", rs_sw_planetime / divisor);
|
||||
V_DrawThinString(30, 50, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "mskd %d", rs_sw_maskedtime / divisor);
|
||||
V_DrawThinString(30, 60, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor);
|
||||
V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
}
|
||||
}
|
||||
|
||||
rs_swaptime = I_GetTimeMicros();
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
rs_swaptime = I_GetTimeMicros() - rs_swaptime;
|
||||
}
|
||||
|
||||
needpatchflush = false;
|
||||
needpatchrecache = false;
|
||||
}
|
||||
|
||||
// Lactozilla: Check the renderer's state
|
||||
// Check the renderer's state
|
||||
// after a possible renderer switch.
|
||||
void D_CheckRendererState(void)
|
||||
{
|
||||
// flush all patches from memory
|
||||
// (also frees memory tagged with PU_CACHE)
|
||||
// (which are not necessarily patches but I don't care)
|
||||
if (needpatchflush)
|
||||
{
|
||||
Z_FlushCachedPatches();
|
||||
needpatchflush = false;
|
||||
}
|
||||
|
||||
// some patches have been freed,
|
||||
// so cache them again
|
||||
|
@ -651,8 +742,14 @@ void D_SRB2Loop(void)
|
|||
// hack to start on a nice clear console screen.
|
||||
COM_ImmedExecute("cls;version");
|
||||
|
||||
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(W_GetNumForName("CONSBACK"), PU_CACHE));
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
/*
|
||||
LMFAO this was showing garbage under OpenGL
|
||||
because I_FinishUpdate was called afterward
|
||||
*/
|
||||
/* Smells like a hack... Don't fade Sonic's ass into the title screen. */
|
||||
if (gamestate != GS_TITLESCREEN)
|
||||
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(W_GetNumForName("CONSBACK"), PU_PATCH));
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -735,9 +832,7 @@ void D_SRB2Loop(void)
|
|||
HW3S_EndFrameUpdate();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_Step();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -806,6 +901,7 @@ void D_StartTitle(void)
|
|||
// In case someone exits out at the same time they start a time attack run,
|
||||
// reset modeattacking
|
||||
modeattacking = ATTACKING_NONE;
|
||||
marathonmode = 0;
|
||||
|
||||
// empty maptol so mario/etc sounds don't play in sound test when they shouldn't
|
||||
maptol = 0;
|
||||
|
@ -869,6 +965,40 @@ static inline void D_CleanFile(void)
|
|||
}
|
||||
}
|
||||
|
||||
///\brief Checks if a netgame URL is being handled, and changes working directory to the EXE's if so.
|
||||
/// Done because browsers (at least, Firefox on Windows) launch the game from the browser's directory, which causes problems.
|
||||
static void ChangeDirForUrlHandler(void)
|
||||
{
|
||||
// URL handlers are opened by web browsers (at least Firefox) from the browser's working directory, not the game's stored directory,
|
||||
// so chdir to that directory unless overridden.
|
||||
if (M_GetUrlProtocolArg() != NULL && !M_CheckParm("-nochdir"))
|
||||
{
|
||||
size_t i;
|
||||
|
||||
CONS_Printf("%s connect links load game files from the SRB2 application's stored directory. Switching to ", SERVER_URL_PROTOCOL);
|
||||
strlcpy(srb2path, myargv[0], sizeof(srb2path));
|
||||
|
||||
// Get just the directory, minus the EXE name
|
||||
for (i = strlen(srb2path)-1; i > 0; i--)
|
||||
{
|
||||
if (srb2path[i] == '/' || srb2path[i] == '\\')
|
||||
{
|
||||
srb2path[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Printf("%s\n", srb2path);
|
||||
|
||||
#if defined (_WIN32)
|
||||
SetCurrentDirectoryA(srb2path);
|
||||
#else
|
||||
if (chdir(srb2path) == -1)
|
||||
I_OutputMsg("Couldn't change working directory\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Identify the SRB2 version, and IWAD file to use.
|
||||
// ==========================================================================
|
||||
|
@ -950,6 +1080,7 @@ static void IdentifyVersion(void)
|
|||
}
|
||||
|
||||
MUSICTEST("music.dta")
|
||||
MUSICTEST("patch_music.pk3")
|
||||
#ifdef DEVELOP // remove when music_new.dta is merged into music.dta
|
||||
MUSICTEST("music_new.dta")
|
||||
#endif
|
||||
|
@ -1015,6 +1146,21 @@ static inline void D_Titlebar(void)
|
|||
}
|
||||
#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
|
||||
//
|
||||
|
@ -1025,10 +1171,13 @@ void D_SRB2Main(void)
|
|||
INT32 pstartmap = 1;
|
||||
boolean autostart = false;
|
||||
|
||||
/* break the version string into version numbers, for netplay */
|
||||
D_ConvertVersionNumbers();
|
||||
|
||||
// Print GPL notice for our console users (Linux)
|
||||
CONS_Printf(
|
||||
"\n\nSonic Robo Blast 2\n"
|
||||
"Copyright (C) 1998-2019 by Sonic Team Junior\n\n"
|
||||
"Copyright (C) 1998-2020 by Sonic Team Junior\n\n"
|
||||
"This program comes with ABSOLUTELY NO WARRANTY.\n\n"
|
||||
"This is free software, and you are welcome to redistribute it\n"
|
||||
"and/or modify it under the terms of the GNU General Public License\n"
|
||||
|
@ -1045,10 +1194,8 @@ void D_SRB2Main(void)
|
|||
I_OutputMsg("setvbuf didnt work\n");
|
||||
#endif
|
||||
|
||||
#ifdef GETTEXT
|
||||
// initialise locale code
|
||||
M_StartupLocale();
|
||||
#endif
|
||||
|
||||
// get parameters from a response file (eg: srb2 @parms.txt)
|
||||
M_FindResponseFile();
|
||||
|
@ -1059,6 +1206,9 @@ void D_SRB2Main(void)
|
|||
// Test Dehacked lists
|
||||
DEH_Check();
|
||||
|
||||
// Netgame URL special case: change working dir to EXE folder.
|
||||
ChangeDirForUrlHandler();
|
||||
|
||||
// identify the main IWAD file to use
|
||||
IdentifyVersion();
|
||||
|
||||
|
@ -1086,6 +1236,7 @@ void D_SRB2Main(void)
|
|||
|
||||
// default savegame
|
||||
strcpy(savegamename, SAVEGAMENAME"%u.ssg");
|
||||
strcpy(liveeventbackup, "live"SAVEGAMENAME".bkp"); // intentionally not ending with .ssg
|
||||
|
||||
{
|
||||
const char *userhome = D_Home(); //Alam: path to home
|
||||
|
@ -1114,8 +1265,10 @@ void D_SRB2Main(void)
|
|||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
strcatbf(liveeventbackup, srb2home, PATHSEP);
|
||||
|
||||
#else
|
||||
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", srb2home);
|
||||
#else // DEFAULTDIR
|
||||
snprintf(srb2home, sizeof srb2home, "%s", userhome);
|
||||
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
|
||||
if (dedicated)
|
||||
|
@ -1125,7 +1278,10 @@ void D_SRB2Main(void)
|
|||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, userhome, PATHSEP);
|
||||
#endif
|
||||
strcatbf(liveeventbackup, userhome, PATHSEP);
|
||||
|
||||
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", userhome);
|
||||
#endif // DEFAULTDIR
|
||||
}
|
||||
|
||||
configfile[sizeof configfile - 1] = '\0';
|
||||
|
@ -1137,13 +1293,26 @@ void D_SRB2Main(void)
|
|||
|
||||
// rand() needs seeded regardless of password
|
||||
srand((unsigned int)time(NULL));
|
||||
rand();
|
||||
rand();
|
||||
rand();
|
||||
|
||||
if (M_CheckParm("-password") && M_IsNextParm())
|
||||
D_SetPassword(M_GetNextParm());
|
||||
|
||||
// player setup menu colors must be initialized before
|
||||
// any wad file is added, as they may contain colors themselves
|
||||
M_InitPlayerSetupColors();
|
||||
|
||||
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
|
||||
Z_Init();
|
||||
|
||||
// Do this up here so that WADs loaded through the command line can use ExecCfg
|
||||
COM_Init();
|
||||
|
||||
// add any files specified on the command line with -file wadfile
|
||||
// to the wad list
|
||||
if (!(M_CheckParm("-connect") && !M_CheckParm("-server")))
|
||||
if (!((M_GetUrlProtocolArg() || M_CheckParm("-connect")) && !M_CheckParm("-server")))
|
||||
{
|
||||
if (M_CheckParm("-file"))
|
||||
{
|
||||
|
@ -1168,9 +1337,6 @@ void D_SRB2Main(void)
|
|||
if (M_CheckParm("-server") || dedicated)
|
||||
netgame = server = true;
|
||||
|
||||
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
|
||||
Z_Init();
|
||||
|
||||
// adapt tables to SRB2's needs, including extra slots for dehacked file support
|
||||
P_PatchInfoTables();
|
||||
|
||||
|
@ -1178,7 +1344,7 @@ void D_SRB2Main(void)
|
|||
M_InitMenuPresTables();
|
||||
|
||||
// init title screen display params
|
||||
if (M_CheckParm("-connect"))
|
||||
if (M_GetUrlProtocolArg() || M_CheckParm("-connect"))
|
||||
F_InitMenuPresValues();
|
||||
|
||||
//---------------------------------------------------- READY TIME
|
||||
|
@ -1201,22 +1367,17 @@ void D_SRB2Main(void)
|
|||
|
||||
// load wad, including the main wad file
|
||||
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
|
||||
if (!W_InitMultipleFiles(startupwadfiles, mainwads))
|
||||
#ifdef _DEBUG
|
||||
CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
|
||||
#else
|
||||
I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
|
||||
#endif
|
||||
W_InitMultipleFiles(startupwadfiles, mainwads);
|
||||
D_CleanFile();
|
||||
|
||||
#ifndef DEVELOP // md5s last updated 06/12/19 (ddmmyy)
|
||||
#ifndef DEVELOP // md5s last updated 22/02/20 (ddmmyy)
|
||||
|
||||
// Check MD5s of autoloaded files
|
||||
W_VerifyFileMD5(0, ASSET_HASH_SRB2_PK3); // srb2.pk3
|
||||
W_VerifyFileMD5(1, ASSET_HASH_ZONES_PK3); // zones.pk3
|
||||
W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta
|
||||
#ifdef USE_PATCH_DTA
|
||||
W_VerifyFileMD5(3, ASSET_HASH_PATCH_DTA); // patch.pk3
|
||||
W_VerifyFileMD5(3, ASSET_HASH_PATCH_PK3); // patch.pk3
|
||||
#endif
|
||||
// don't check music.dta because people like to modify it, and it doesn't matter if they do
|
||||
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
|
||||
|
@ -1224,20 +1385,6 @@ void D_SRB2Main(void)
|
|||
|
||||
mainwadstally = packetsizetally; // technically not accurate atm, remember to port the two-stage -file process from kart in 2.2.x
|
||||
|
||||
if (M_CheckParm("-warp") && M_IsNextParm())
|
||||
{
|
||||
const char *word = M_GetNextParm();
|
||||
pstartmap = G_FindMapByNameOrCode(word, 0);
|
||||
if (! pstartmap)
|
||||
I_Error("Cannot find a map remotely named '%s'\n", word);
|
||||
else
|
||||
{
|
||||
if (!M_CheckParm("-server"))
|
||||
G_SetGameModified(true);
|
||||
autostart = true;
|
||||
}
|
||||
}
|
||||
|
||||
cht_Init();
|
||||
|
||||
//---------------------------------------------------- READY SCREEN
|
||||
|
@ -1261,7 +1408,6 @@ void D_SRB2Main(void)
|
|||
CONS_Printf("HU_Init(): Setting up heads up display.\n");
|
||||
HU_Init();
|
||||
|
||||
COM_Init();
|
||||
CON_Init();
|
||||
|
||||
D_RegisterServerCommands();
|
||||
|
@ -1286,12 +1432,20 @@ void D_SRB2Main(void)
|
|||
// Lactozilla: Does the render mode need to change?
|
||||
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
|
||||
{
|
||||
CONS_Printf(M_GetText("Switching the renderer...\n"));
|
||||
Z_PreparePatchFlush();
|
||||
|
||||
// set needpatchflush / needpatchrecache true for D_CheckRendererState
|
||||
needpatchflush = true;
|
||||
needpatchrecache = true;
|
||||
|
||||
// Set cv_renderer to the new render mode
|
||||
VID_CheckRenderer();
|
||||
SCR_ChangeRendererCVars(setrenderneeded);
|
||||
}
|
||||
SCR_ChangeRendererCVars(rendermode);
|
||||
|
||||
// check the renderer's state
|
||||
D_CheckRendererState();
|
||||
}
|
||||
|
||||
wipegamestate = gamestate;
|
||||
|
||||
|
@ -1299,6 +1453,23 @@ void D_SRB2Main(void)
|
|||
|
||||
//------------------------------------------------ COMMAND LINE PARAMS
|
||||
|
||||
// this must be done after loading gamedata,
|
||||
// to avoid setting off the corrupted gamedata code in G_LoadGameData if a SOC with custom gamedata is added
|
||||
// -- Monster Iestyn 20/02/20
|
||||
if (M_CheckParm("-warp") && M_IsNextParm())
|
||||
{
|
||||
const char *word = M_GetNextParm();
|
||||
pstartmap = G_FindMapByNameOrCode(word, 0);
|
||||
if (! pstartmap)
|
||||
I_Error("Cannot find a map remotely named '%s'\n", word);
|
||||
else
|
||||
{
|
||||
if (!M_CheckParm("-server"))
|
||||
G_SetGameModified(true);
|
||||
autostart = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize CD-Audio
|
||||
if (M_CheckParm("-usecd") && !dedicated)
|
||||
I_InitCD();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
18
src/d_net.c
18
src/d_net.c
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -715,6 +715,8 @@ void Net_CloseConnection(INT32 node)
|
|||
|
||||
InitNode(&nodes[node]);
|
||||
SV_AbortSendFiles(node);
|
||||
if (server)
|
||||
SV_AbortLuaFileTransfer(node);
|
||||
I_NetFreeNodenum(node);
|
||||
#endif
|
||||
}
|
||||
|
@ -799,12 +801,20 @@ static const char *packettypename[NUMPACKETTYPE] =
|
|||
"RESYNCHEND",
|
||||
"RESYNCHGET",
|
||||
|
||||
"SENDINGLUAFILE",
|
||||
"ASKLUAFILE",
|
||||
"HASLUAFILE",
|
||||
|
||||
"FILEFRAGMENT",
|
||||
"FILEACK",
|
||||
"FILERECEIVED",
|
||||
|
||||
"TEXTCMD",
|
||||
"TEXTCMD2",
|
||||
"CLIENTJOIN",
|
||||
"NODETIMEOUT",
|
||||
"RESYNCHING",
|
||||
"LOGIN",
|
||||
"PING"
|
||||
};
|
||||
|
||||
|
@ -831,7 +841,7 @@ static void DebugPrintpacket(const char *header)
|
|||
size_t ntxtcmd = &((UINT8 *)netbuffer)[doomcom->datalength] - cmd;
|
||||
|
||||
fprintf(debugfile, " firsttic %u ply %d tics %d ntxtcmd %s\n ",
|
||||
(UINT32)ExpandTics(serverpak->starttic), serverpak->numslots, serverpak->numtics, sizeu1(ntxtcmd));
|
||||
(UINT32)serverpak->starttic, serverpak->numslots, serverpak->numtics, sizeu1(ntxtcmd));
|
||||
/// \todo Display more readable information about net commands
|
||||
fprintfstringnewline((char *)cmd, ntxtcmd);
|
||||
/*fprintfstring((char *)cmd, 3);
|
||||
|
@ -850,8 +860,8 @@ static void DebugPrintpacket(const char *header)
|
|||
case PT_NODEKEEPALIVE:
|
||||
case PT_NODEKEEPALIVEMIS:
|
||||
fprintf(debugfile, " tic %4u resendfrom %u\n",
|
||||
(UINT32)ExpandTics(netbuffer->u.clientpak.client_tic),
|
||||
(UINT32)ExpandTics (netbuffer->u.clientpak.resendfrom));
|
||||
(UINT32)ExpandTics(netbuffer->u.clientpak.client_tic, doomcom->remotenode),
|
||||
(UINT32)ExpandTics (netbuffer->u.clientpak.resendfrom, doomcom->remotenode));
|
||||
break;
|
||||
case PT_TEXTCMD:
|
||||
case PT_TEXTCMD2:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
215
src/d_netcmd.c
215
src/d_netcmd.c
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -22,7 +22,7 @@
|
|||
#include "g_input.h"
|
||||
#include "m_menu.h"
|
||||
#include "r_local.h"
|
||||
#include "r_things.h"
|
||||
#include "r_skins.h"
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h"
|
||||
#include "s_sound.h"
|
||||
|
@ -157,10 +157,8 @@ static void Command_Isgamemodified_f(void);
|
|||
static void Command_Cheats_f(void);
|
||||
#ifdef _DEBUG
|
||||
static void Command_Togglemodified_f(void);
|
||||
#ifdef HAVE_BLUA
|
||||
static void Command_Archivetest_f(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// =========================================================================
|
||||
// CLIENT VARIABLES
|
||||
|
@ -227,6 +225,7 @@ consvar_t cv_allowseenames = {"allowseenames", "Yes", CV_NETVAR, CV_YesNo, NULL,
|
|||
consvar_t cv_playername = {"name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_playername2 = {"name2", "Tails", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
// player colors
|
||||
UINT16 lastgoodcolor = SKINCOLOR_BLUE, lastgoodcolor2 = SKINCOLOR_BLUE;
|
||||
consvar_t cv_playercolor = {"color", "Blue", CV_CALL|CV_NOINIT, Color_cons_t, Color_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_playercolor2 = {"color2", "Orange", CV_CALL|CV_NOINIT, Color_cons_t, Color2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
// player's skin, saved for commodity, when using a favorite skins wad..
|
||||
|
@ -370,7 +369,7 @@ consvar_t cv_advancemap = {"advancemap", "Next", CV_NETVAR, advancemap_cons_t, N
|
|||
static CV_PossibleValue_t playersforexit_cons_t[] = {{0, "One"}, {1, "1/4"}, {2, "Half"}, {3, "3/4"}, {4, "All"}, {0, NULL}};
|
||||
consvar_t cv_playersforexit = {"playersforexit", "All", CV_NETVAR, playersforexit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_exitmove = {"exitmove", "Off", CV_NETVAR|CV_CALL, CV_OnOff, ExitMove_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_exitmove = {"exitmove", "On", CV_NETVAR|CV_CALL, CV_OnOff, ExitMove_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_runscripts = {"runscripts", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -415,10 +414,9 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
|
|||
"DELFILE", // replace next time we add an XD
|
||||
"SETMOTD",
|
||||
"SUICIDE",
|
||||
#ifdef HAVE_BLUA
|
||||
"LUACMD",
|
||||
"LUAVAR"
|
||||
#endif
|
||||
"LUAVAR",
|
||||
"LUAFILE"
|
||||
};
|
||||
|
||||
// =========================================================================
|
||||
|
@ -451,9 +449,8 @@ void D_RegisterServerCommands(void)
|
|||
RegisterNetXCmd(XD_PAUSE, Got_Pause);
|
||||
RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
|
||||
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
|
||||
#ifdef HAVE_BLUA
|
||||
RegisterNetXCmd(XD_LUACMD, Got_Luacmd);
|
||||
#endif
|
||||
RegisterNetXCmd(XD_LUAFILE, Got_LuaFile);
|
||||
|
||||
// Remote Administration
|
||||
COM_AddCommand("password", Command_Changepassword_f);
|
||||
|
@ -502,10 +499,10 @@ void D_RegisterServerCommands(void)
|
|||
COM_AddCommand("cheats", Command_Cheats_f); // test
|
||||
#ifdef _DEBUG
|
||||
COM_AddCommand("togglemodified", Command_Togglemodified_f);
|
||||
#ifdef HAVE_BLUA
|
||||
COM_AddCommand("archivetest", Command_Archivetest_f);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
COM_AddCommand("downloads", Command_Downloads_f);
|
||||
|
||||
// for master server connection
|
||||
AddMServCommands();
|
||||
|
@ -579,6 +576,8 @@ void D_RegisterServerCommands(void)
|
|||
|
||||
// d_clisrv
|
||||
CV_RegisterVar(&cv_maxplayers);
|
||||
CV_RegisterVar(&cv_joindelay);
|
||||
CV_RegisterVar(&cv_rejointimeout);
|
||||
CV_RegisterVar(&cv_resynchattempts);
|
||||
CV_RegisterVar(&cv_maxsend);
|
||||
CV_RegisterVar(&cv_noticedownload);
|
||||
|
@ -623,7 +622,7 @@ void D_RegisterClientCommands(void)
|
|||
for (i = 0; i < MAXSKINCOLORS; i++)
|
||||
{
|
||||
Color_cons_t[i].value = i;
|
||||
Color_cons_t[i].strvalue = Color_Names[i];
|
||||
Color_cons_t[i].strvalue = skincolors[i].name;
|
||||
}
|
||||
Color_cons_t[MAXSKINCOLORS].value = 0;
|
||||
Color_cons_t[MAXSKINCOLORS].strvalue = NULL;
|
||||
|
@ -631,7 +630,7 @@ void D_RegisterClientCommands(void)
|
|||
// Set default player names
|
||||
// Monster Iestyn (12/08/19): not sure where else I could have actually put this, but oh well
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
sprintf(player_names[i], "Player %d", i);
|
||||
sprintf(player_names[i], "Player %d", 1 + i);
|
||||
|
||||
if (dedicated)
|
||||
return;
|
||||
|
@ -676,6 +675,8 @@ void D_RegisterClientCommands(void)
|
|||
// GIF variables
|
||||
CV_RegisterVar(&cv_gif_optimize);
|
||||
CV_RegisterVar(&cv_gif_downscale);
|
||||
CV_RegisterVar(&cv_gif_dynamicdelay);
|
||||
CV_RegisterVar(&cv_gif_localcolortable);
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
CV_RegisterVar(&cv_splats);
|
||||
|
@ -700,6 +701,7 @@ void D_RegisterClientCommands(void)
|
|||
#endif
|
||||
CV_RegisterVar(&cv_rollingdemos);
|
||||
CV_RegisterVar(&cv_netstat);
|
||||
CV_RegisterVar(&cv_netticbuffer);
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
CV_RegisterVar(&cv_fishcake);
|
||||
|
@ -911,7 +913,7 @@ void D_RegisterClientCommands(void)
|
|||
#ifdef _DEBUG
|
||||
COM_AddCommand("causecfail", Command_CauseCfail_f);
|
||||
#endif
|
||||
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
|
||||
#ifdef LUA_ALLOW_BYTECODE
|
||||
COM_AddCommand("dumplua", Command_Dumplua_f);
|
||||
#endif
|
||||
}
|
||||
|
@ -1007,7 +1009,7 @@ boolean EnsurePlayerNameIsGood(char *name, INT32 playernum)
|
|||
* SetPlayerName
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
static void CleanupPlayerName(INT32 playernum, const char *newname)
|
||||
void CleanupPlayerName(INT32 playernum, const char *newname)
|
||||
{
|
||||
char *buf;
|
||||
char *p;
|
||||
|
@ -1035,6 +1037,17 @@ static void CleanupPlayerName(INT32 playernum, const char *newname)
|
|||
|
||||
tmpname = p;
|
||||
|
||||
do
|
||||
{
|
||||
/* from EnsurePlayerNameIsGood */
|
||||
if (!isprint(*p) || *p == ';' || (UINT8)*p >= 0x80)
|
||||
break;
|
||||
}
|
||||
while (*++p) ;
|
||||
|
||||
if (*p)/* bad char found */
|
||||
break;
|
||||
|
||||
// Remove trailing spaces.
|
||||
p = &tmpname[strlen(tmpname)-1]; // last character
|
||||
while (*p == ' ' && p >= tmpname)
|
||||
|
@ -1124,7 +1137,7 @@ static void SetPlayerName(INT32 playernum, char *newname)
|
|||
{
|
||||
CONS_Printf(M_GetText("Player %d sent a bad name change\n"), playernum+1);
|
||||
if (server && netgame)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1145,7 +1158,7 @@ UINT8 CanChangeSkin(INT32 playernum)
|
|||
// Server has skin change restrictions.
|
||||
if (cv_restrictskinchange.value)
|
||||
{
|
||||
if (gametype == GT_COOP)
|
||||
if (gametyperules & GTR_FRIENDLY)
|
||||
return true;
|
||||
|
||||
// Can change skin during initial countdown.
|
||||
|
@ -1199,7 +1212,7 @@ static INT32 snacpending = 0, snac2pending = 0, chmappending = 0;
|
|||
//
|
||||
static void SendNameAndColor(void)
|
||||
{
|
||||
char buf[MAXPLAYERNAME+2];
|
||||
char buf[MAXPLAYERNAME+6];
|
||||
char *p;
|
||||
|
||||
p = buf;
|
||||
|
@ -1213,15 +1226,20 @@ static void SendNameAndColor(void)
|
|||
CV_StealthSetValue(&cv_playercolor, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// never allow the color "none"
|
||||
if (!cv_playercolor.value)
|
||||
// don't allow inaccessible colors
|
||||
if (!skincolors[cv_playercolor.value].accessible)
|
||||
{
|
||||
if (players[consoleplayer].skincolor)
|
||||
if (players[consoleplayer].skincolor && skincolors[players[consoleplayer].skincolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor, players[consoleplayer].skincolor);
|
||||
else if (skins[players[consoleplayer].skin].prefcolor)
|
||||
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor);
|
||||
else
|
||||
else if (skincolors[atoi(cv_playercolor.defaultvalue)].accessible)
|
||||
CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue);
|
||||
else if (skins[players[consoleplayer].skin].prefcolor && skincolors[skins[players[consoleplayer].skin].prefcolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor);
|
||||
else {
|
||||
UINT16 i = 0;
|
||||
while (i<numskincolors && !skincolors[i].accessible) i++;
|
||||
CV_StealthSetValue(&cv_playercolor, (i != numskincolors) ? i : SKINCOLOR_BLUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(cv_playername.string, player_names[consoleplayer])
|
||||
|
@ -1245,7 +1263,7 @@ static void SendNameAndColor(void)
|
|||
|
||||
players[consoleplayer].skincolor = cv_playercolor.value;
|
||||
|
||||
if (players[consoleplayer].mo)
|
||||
if (players[consoleplayer].mo && !players[consoleplayer].powers[pw_dye])
|
||||
players[consoleplayer].mo->color = players[consoleplayer].skincolor;
|
||||
|
||||
if (metalrecording)
|
||||
|
@ -1268,10 +1286,10 @@ static void SendNameAndColor(void)
|
|||
{
|
||||
CV_StealthSetValue(&cv_playercolor, skins[cv_skin.value].prefcolor);
|
||||
|
||||
players[consoleplayer].skincolor = cv_playercolor.value % MAXSKINCOLORS;
|
||||
players[consoleplayer].skincolor = cv_playercolor.value % numskincolors;
|
||||
|
||||
if (players[consoleplayer].mo)
|
||||
players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor;
|
||||
players[consoleplayer].mo->color = (UINT16)players[consoleplayer].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
|
@ -1309,7 +1327,7 @@ static void SendNameAndColor(void)
|
|||
// Finally write out the complete packet and send it off.
|
||||
WRITESTRINGN(p, cv_playername.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT32(p, (UINT32)players[consoleplayer].availabilities);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor.value);
|
||||
WRITEUINT16(p, (UINT16)cv_playercolor.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin.value);
|
||||
SendNetXCmd(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
@ -1336,15 +1354,20 @@ static void SendNameAndColor2(void)
|
|||
CV_StealthSetValue(&cv_playercolor2, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// never allow the color "none"
|
||||
if (!cv_playercolor2.value)
|
||||
// don't allow inaccessible colors
|
||||
if (!skincolors[cv_playercolor2.value].accessible)
|
||||
{
|
||||
if (players[secondplaya].skincolor)
|
||||
if (players[secondplaya].skincolor && skincolors[players[secondplaya].skincolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor2, players[secondplaya].skincolor);
|
||||
else if (skins[players[secondplaya].skin].prefcolor)
|
||||
else if (skincolors[atoi(cv_playercolor2.defaultvalue)].accessible)
|
||||
CV_StealthSet(&cv_playercolor, cv_playercolor2.defaultvalue);
|
||||
else if (skins[players[secondplaya].skin].prefcolor && skincolors[skins[players[secondplaya].skin].prefcolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
|
||||
else
|
||||
CV_StealthSet(&cv_playercolor2, cv_playercolor2.defaultvalue);
|
||||
else {
|
||||
UINT16 i = 0;
|
||||
while (i<numskincolors && !skincolors[i].accessible) i++;
|
||||
CV_StealthSetValue(&cv_playercolor2, (i != numskincolors) ? i : SKINCOLOR_BLUE);
|
||||
}
|
||||
}
|
||||
|
||||
players[secondplaya].availabilities = R_GetSkinAvailabilities();
|
||||
|
@ -1357,8 +1380,9 @@ static void SendNameAndColor2(void)
|
|||
if (botingame)
|
||||
{
|
||||
players[secondplaya].skincolor = botcolor;
|
||||
if (players[secondplaya].mo)
|
||||
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
|
||||
SetPlayerSkinByNum(secondplaya, botskin-1);
|
||||
return;
|
||||
}
|
||||
|
@ -1371,7 +1395,7 @@ static void SendNameAndColor2(void)
|
|||
|
||||
// don't use secondarydisplayplayer: the second player must be 1
|
||||
players[secondplaya].skincolor = cv_playercolor2.value;
|
||||
if (players[secondplaya].mo)
|
||||
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
|
||||
if (cv_forceskin.value >= 0 && (netgame || multiplayer)) // Server wants everyone to use the same player
|
||||
|
@ -1396,7 +1420,7 @@ static void SendNameAndColor2(void)
|
|||
{
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
|
||||
|
||||
players[secondplaya].skincolor = cv_playercolor2.value % MAXSKINCOLORS;
|
||||
players[secondplaya].skincolor = cv_playercolor2.value % numskincolors;
|
||||
|
||||
if (players[secondplaya].mo)
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
|
@ -1419,7 +1443,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
player_t *p = &players[playernum];
|
||||
char name[MAXPLAYERNAME+1];
|
||||
UINT8 color, skin;
|
||||
UINT16 color;
|
||||
UINT8 skin;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (playernum < 0 || playernum > MAXPLAYERS)
|
||||
|
@ -1438,7 +1463,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
|
||||
READSTRINGN(*cp, name, MAXPLAYERNAME);
|
||||
p->availabilities = READUINT32(*cp);
|
||||
color = READUINT8(*cp);
|
||||
color = READUINT16(*cp);
|
||||
skin = READUINT8(*cp);
|
||||
|
||||
// set name
|
||||
|
@ -1446,9 +1471,9 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
SetPlayerName(playernum, name);
|
||||
|
||||
// set color
|
||||
p->skincolor = color % MAXSKINCOLORS;
|
||||
p->skincolor = color % numskincolors;
|
||||
if (p->mo)
|
||||
p->mo->color = (UINT8)p->skincolor;
|
||||
p->mo->color = (UINT16)p->skincolor;
|
||||
|
||||
// normal player colors
|
||||
if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer]))
|
||||
|
@ -1465,8 +1490,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
kick = true;
|
||||
}
|
||||
|
||||
// don't allow color "none"
|
||||
if (!p->skincolor)
|
||||
// don't allow inaccessible colors
|
||||
if (skincolors[p->skincolor].accessible == false)
|
||||
kick = true;
|
||||
|
||||
// availabilities
|
||||
|
@ -1482,7 +1507,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
if (kick)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal color change received from %s (team: %d), color: %d)\n"), player_names[playernum], p->ctfteam, p->skincolor);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1724,7 +1749,7 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese
|
|||
}
|
||||
CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d ultmode=%d resetplayers=%d delay=%d skipprecutscene=%d\n",
|
||||
mapnum, newgametype, pultmode, resetplayers, delay, skipprecutscene);
|
||||
if ((netgame || multiplayer) && !((gametype == newgametype) && (newgametype == GT_COOP)))
|
||||
if ((netgame || multiplayer) && !((gametype == newgametype) && (gametypedefaultrules[newgametype] & GTR_CAMPAIGN)))
|
||||
FLS = false;
|
||||
|
||||
if (delay != 2)
|
||||
|
@ -1966,7 +1991,7 @@ static void Command_Map_f(void)
|
|||
fromlevelselect =
|
||||
( netgame || multiplayer ) &&
|
||||
newgametype == gametype &&
|
||||
newgametype == GT_COOP;
|
||||
gametypedefaultrules[newgametype] & GTR_CAMPAIGN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2014,15 +2039,13 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
UINT8 flags;
|
||||
INT32 resetplayer = 1, lastgametype;
|
||||
UINT8 skipprecutscene, FLS;
|
||||
#ifdef HAVE_BLUA
|
||||
INT16 mapnumber;
|
||||
#endif
|
||||
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal map change received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2078,10 +2101,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
mapnumber = M_MapNumber(mapname[3], mapname[4]);
|
||||
LUAh_MapChange(mapnumber);
|
||||
#endif
|
||||
|
||||
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS);
|
||||
if (demoplayback && !timingdemo)
|
||||
|
@ -2133,7 +2154,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal pause command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2208,7 +2229,7 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2271,7 +2292,7 @@ static void Got_Clearscores(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal clear scores command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2618,7 +2639,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
// this should never happen unless the client is hacked/buggy
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
}
|
||||
|
||||
if (NetPacket.packet.verification) // Special marker that the server sent the request
|
||||
|
@ -2627,7 +2648,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
playernum = NetPacket.packet.playernum;
|
||||
|
@ -2660,16 +2681,14 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Don't switch team, just go away, please, go awaayyyy, aaauuauugghhhghgh
|
||||
if (!LUAh_TeamSwitch(&players[playernum], NetPacket.packet.newteam, players[playernum].spectator, NetPacket.packet.autobalance, NetPacket.packet.scrambled))
|
||||
return;
|
||||
#endif
|
||||
|
||||
//no status changes after hidetime
|
||||
if ((gametyperules & GTR_HIDEFROZEN) && (leveltime >= (hidetime * TICRATE)))
|
||||
|
@ -2719,7 +2738,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
if (server && ((NetPacket.packet.newteam < 0 || NetPacket.packet.newteam > 3) || error))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
}
|
||||
|
||||
//Safety first!
|
||||
|
@ -2762,7 +2781,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
players[playernum].spectator = false;
|
||||
|
||||
//If joining after hidetime in normal tag, default to being IT.
|
||||
if (gametype == GT_TAG && (leveltime > (hidetime * TICRATE)))
|
||||
if (((gametyperules & (GTR_TAG|GTR_HIDEFROZEN)) == GTR_TAG) && (leveltime > (hidetime * TICRATE)))
|
||||
{
|
||||
NetPacket.packet.newteam = 1; //minor hack, causes the "is it" message to be printed later.
|
||||
players[playernum].pflags |= PF_TAGIT; //make the player IT.
|
||||
|
@ -2826,12 +2845,10 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
//reset view if you are changed, or viewing someone who was changed.
|
||||
if (playernum == consoleplayer || displayplayer == playernum)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal.
|
||||
LUAh_ViewpointSwitch(&players[playernum], &players[displayplayer], true);
|
||||
#endif
|
||||
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
|
@ -3011,7 +3028,7 @@ static void Got_Verification(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal verification received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3061,7 +3078,7 @@ static void Got_Removal(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal demotion received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3135,7 +3152,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal motd change received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
Z_Free(mymotd);
|
||||
return;
|
||||
}
|
||||
|
@ -3191,7 +3208,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal runsoc command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3329,10 +3346,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
|||
boolean kick = false;
|
||||
boolean toomany = false;
|
||||
INT32 i,j;
|
||||
serverinfo_pak *dummycheck = NULL;
|
||||
|
||||
// Shut the compiler up.
|
||||
(void)dummycheck;
|
||||
|
||||
READSTRINGN(*cp, filename, 240);
|
||||
READMEM(*cp, md5sum, 16);
|
||||
|
@ -3349,7 +3362,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
|||
if ((playernum != serverplayer && !IsPlayerAdmin(playernum)) || kick)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3398,7 +3411,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3463,7 +3476,7 @@ static void Command_Version_f(void)
|
|||
#ifdef DEVELOP
|
||||
CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s) ", compbranch, comprevision, compdate, comptime);
|
||||
#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
|
||||
|
||||
// Base library
|
||||
|
@ -3559,6 +3572,8 @@ static void Command_Playintro_f(void)
|
|||
*/
|
||||
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void)
|
||||
{
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
I_Quit();
|
||||
}
|
||||
|
||||
|
@ -3616,7 +3631,7 @@ static void PointLimit_OnChange(void)
|
|||
static void NumLaps_OnChange(void)
|
||||
{
|
||||
// Just don't be verbose
|
||||
if (gametype == GT_RACE)
|
||||
if ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE)
|
||||
CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value);
|
||||
}
|
||||
|
||||
|
@ -3730,15 +3745,21 @@ static void ExitMove_OnChange(void)
|
|||
{
|
||||
UINT8 i;
|
||||
|
||||
if (!(netgame || multiplayer) || gametype != GT_COOP)
|
||||
if (!(netgame || multiplayer) || !(gametyperules & GTR_FRIENDLY))
|
||||
return;
|
||||
|
||||
if (cv_exitmove.value)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
if (playeringame[i] && players[i].mo
|
||||
&& players[i].mo->target && players[i].mo->target->type == MT_SIGN)
|
||||
if (playeringame[i] && players[i].mo)
|
||||
{
|
||||
if (players[i].mo->target && players[i].mo->target->type == MT_SIGN)
|
||||
P_SetTarget(&players[i].mo->target, NULL);
|
||||
|
||||
if (players[i].pflags & PF_FINISHED)
|
||||
P_GiveFinishFlags(&players[i]);
|
||||
}
|
||||
|
||||
CONS_Printf(M_GetText("Players can now move after completing the level.\n"));
|
||||
}
|
||||
else
|
||||
|
@ -4191,7 +4212,7 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal exitlevel command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4214,6 +4235,9 @@ void Command_ExitGame_f(void)
|
|||
{
|
||||
INT32 i;
|
||||
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
|
||||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
CV_ClearChangedFlags();
|
||||
|
@ -4315,7 +4339,6 @@ static void Command_Togglemodified_f(void)
|
|||
modifiedgame = !modifiedgame;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
extern UINT8 *save_p;
|
||||
static void Command_Archivetest_f(void)
|
||||
{
|
||||
|
@ -4360,7 +4383,6 @@ static void Command_Archivetest_f(void)
|
|||
CONS_Printf("Done. No crash.\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Makes a change to ::cv_forceskin take effect immediately.
|
||||
*
|
||||
|
@ -4472,16 +4494,19 @@ static void Skin2_OnChange(void)
|
|||
*/
|
||||
static void Color_OnChange(void)
|
||||
{
|
||||
if (!Playing())
|
||||
return; // do whatever you want
|
||||
|
||||
if (!Playing()) {
|
||||
if (!cv_playercolor.value || !skincolors[cv_playercolor.value].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor, lastgoodcolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player.
|
||||
{
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!P_PlayerMoving(consoleplayer))
|
||||
if (!P_PlayerMoving(consoleplayer) && skincolors[players[consoleplayer].skincolor].accessible == true)
|
||||
{
|
||||
// Color change menu scrolling fix is no longer necessary
|
||||
SendNameAndColor();
|
||||
|
@ -4492,6 +4517,8 @@ static void Color_OnChange(void)
|
|||
players[consoleplayer].skincolor);
|
||||
}
|
||||
}
|
||||
lastgoodcolor = cv_playercolor.value;
|
||||
}
|
||||
|
||||
/** Sends a color change for the secondary splitscreen player, unless that
|
||||
* player is moving.
|
||||
|
@ -4501,9 +4528,13 @@ static void Color_OnChange(void)
|
|||
static void Color2_OnChange(void)
|
||||
{
|
||||
if (!Playing() || !splitscreen)
|
||||
return; // do whatever you want
|
||||
|
||||
if (!P_PlayerMoving(secondarydisplayplayer))
|
||||
{
|
||||
if (!cv_playercolor2.value || !skincolors[cv_playercolor2.value].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor2, lastgoodcolor2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!P_PlayerMoving(secondarydisplayplayer) && skincolors[players[secondarydisplayplayer].skincolor].accessible == true)
|
||||
{
|
||||
// Color change menu scrolling fix is no longer necessary
|
||||
SendNameAndColor2();
|
||||
|
@ -4514,6 +4545,8 @@ static void Color2_OnChange(void)
|
|||
players[secondarydisplayplayer].skincolor);
|
||||
}
|
||||
}
|
||||
lastgoodcolor2 = cv_playercolor2.value;
|
||||
}
|
||||
|
||||
/** Displays the result of the chat being muted or unmuted.
|
||||
* The server or remote admin should already know and be able to talk
|
||||
|
@ -4589,7 +4622,7 @@ static void Command_ShowTime_f(void)
|
|||
|
||||
static void BaseNumLaps_OnChange(void)
|
||||
{
|
||||
if (gametype == GT_RACE)
|
||||
if ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE)
|
||||
{
|
||||
if (cv_basenumlaps.value)
|
||||
CONS_Printf(M_GetText("Number of laps will be changed to map defaults next round.\n"));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -142,10 +142,9 @@ typedef enum
|
|||
XD_SETMOTD, // 19
|
||||
XD_SUICIDE, // 20
|
||||
XD_DEMOTED, // 21
|
||||
#ifdef HAVE_BLUA
|
||||
XD_LUACMD, // 22
|
||||
XD_LUAVAR, // 23
|
||||
#endif
|
||||
XD_LUAFILE, // 24
|
||||
MAXNETXCMD
|
||||
} netxcmd_t;
|
||||
|
||||
|
@ -194,6 +193,7 @@ typedef union {
|
|||
// add game commands, needs cleanup
|
||||
void D_RegisterServerCommands(void);
|
||||
void D_RegisterClientCommands(void);
|
||||
void CleanupPlayerName(INT32 playernum, const char *newname);
|
||||
boolean EnsurePlayerNameIsGood(char *name, INT32 playernum);
|
||||
void D_SendPlayerConfig(void);
|
||||
void Command_ExitGame_f(void);
|
||||
|
|
731
src/d_netfil.c
731
src/d_netfil.c
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -56,7 +56,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
// Prototypes
|
||||
static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid);
|
||||
static boolean AddFileToSendQueue(INT32 node, const char *filename, UINT8 fileid);
|
||||
|
||||
// Sender structure
|
||||
typedef struct filetx_s
|
||||
|
@ -76,8 +76,13 @@ typedef struct filetx_s
|
|||
typedef struct filetran_s
|
||||
{
|
||||
filetx_t *txlist; // Linked list of all files for the node
|
||||
UINT8 iteration;
|
||||
UINT8 ackediteration;
|
||||
UINT32 position; // The current position in the file
|
||||
boolean *ackedfragments;
|
||||
UINT32 ackedsize;
|
||||
FILE *currentfile; // The file currently being sent/received
|
||||
tic_t dontsenduntil;
|
||||
} filetran_t;
|
||||
static filetran_t transfer[MAXNETNODES];
|
||||
|
||||
|
@ -87,13 +92,31 @@ static filetran_t transfer[MAXNETNODES];
|
|||
// Receiver structure
|
||||
INT32 fileneedednum; // Number of files needed to join the server
|
||||
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
|
||||
static tic_t lasttimeackpacketsent = 0;
|
||||
char downloaddir[512] = "DOWNLOAD";
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
// For resuming failed downloads
|
||||
typedef struct
|
||||
{
|
||||
char filename[MAX_WADPATH];
|
||||
UINT8 md5sum[16];
|
||||
boolean *receivedfragments;
|
||||
UINT32 fragmentsize;
|
||||
UINT32 currentsize;
|
||||
} pauseddownload_t;
|
||||
static pauseddownload_t *pauseddownload = NULL;
|
||||
|
||||
#ifndef NONET
|
||||
// for cl loading screen
|
||||
INT32 lastfilenum = -1;
|
||||
#endif
|
||||
|
||||
luafiletransfer_t *luafiletransfers = NULL;
|
||||
boolean waitingforluafiletransfer = false;
|
||||
boolean waitingforluafilecommand = false;
|
||||
char luafiledir[256 + 16] = "luafiles";
|
||||
|
||||
|
||||
/** Fills a serverinfo packet with information about wad files loaded.
|
||||
*
|
||||
* \todo Give this function a better name since it is in global scope.
|
||||
|
@ -153,6 +176,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr)
|
|||
for (i = 0; i < fileneedednum; i++)
|
||||
{
|
||||
fileneeded[i].status = FS_NOTFOUND; // We haven't even started looking for the file yet
|
||||
fileneeded[i].justdownloaded = false;
|
||||
filestatus = READUINT8(p); // The first byte is the file status
|
||||
fileneeded[i].willsend = (UINT8)(filestatus >> 4);
|
||||
fileneeded[i].totalsize = READUINT32(p); // The four next bytes are the file size
|
||||
|
@ -164,8 +188,13 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr)
|
|||
|
||||
void CL_PrepareDownloadSaveGame(const char *tmpsave)
|
||||
{
|
||||
#ifndef NONET
|
||||
lastfilenum = -1;
|
||||
#endif
|
||||
|
||||
fileneedednum = 1;
|
||||
fileneeded[0].status = FS_REQUESTED;
|
||||
fileneeded[0].justdownloaded = false;
|
||||
fileneeded[0].totalsize = UINT32_MAX;
|
||||
fileneeded[0].file = NULL;
|
||||
memset(fileneeded[0].md5sum, 0, 16);
|
||||
|
@ -238,6 +267,31 @@ boolean CL_CheckDownloadable(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
/** Returns true if a needed file transfer can be resumed
|
||||
*
|
||||
* \param file The needed file to resume the transfer for
|
||||
* \return True if the transfer can be resumed
|
||||
*
|
||||
*/
|
||||
static boolean CL_CanResumeDownload(fileneeded_t *file)
|
||||
{
|
||||
return pauseddownload
|
||||
&& !strcmp(pauseddownload->filename, file->filename) // Same name
|
||||
&& !memcmp(pauseddownload->md5sum, file->md5sum, 16) // Same checksum
|
||||
&& pauseddownload->fragmentsize == file->fragmentsize; // Same fragment size
|
||||
}
|
||||
|
||||
void CL_AbortDownloadResume(void)
|
||||
{
|
||||
if (!pauseddownload)
|
||||
return;
|
||||
|
||||
free(pauseddownload->receivedfragments);
|
||||
remove(pauseddownload->filename);
|
||||
free(pauseddownload);
|
||||
pauseddownload = NULL;
|
||||
}
|
||||
|
||||
/** Sends requests for files in the ::fileneeded table with a status of
|
||||
* ::FS_NOTFOUND.
|
||||
*
|
||||
|
@ -245,7 +299,7 @@ boolean CL_CheckDownloadable(void)
|
|||
* \note Sends a PT_REQUESTFILE packet
|
||||
*
|
||||
*/
|
||||
boolean CL_SendRequestFile(void)
|
||||
boolean CL_SendFileRequest(void)
|
||||
{
|
||||
char *p;
|
||||
INT32 i;
|
||||
|
@ -290,7 +344,7 @@ boolean CL_SendRequestFile(void)
|
|||
|
||||
// get request filepak and put it on the send queue
|
||||
// returns false if a requested file was not found or cannot be sent
|
||||
boolean Got_RequestFilePak(INT32 node)
|
||||
boolean PT_RequestFile(INT32 node)
|
||||
{
|
||||
char wad[MAX_WADPATH+1];
|
||||
UINT8 *p = netbuffer->u.textcmd;
|
||||
|
@ -301,7 +355,7 @@ boolean Got_RequestFilePak(INT32 node)
|
|||
if (id == 0xFF)
|
||||
break;
|
||||
READSTRINGN(p, wad, MAX_WADPATH);
|
||||
if (!SV_SendFile(node, wad, id))
|
||||
if (!AddFileToSendQueue(node, wad, id))
|
||||
{
|
||||
SV_AbortSendFiles(node);
|
||||
return false; // don't read the rest of the files
|
||||
|
@ -448,6 +502,196 @@ void CL_LoadServerFiles(void)
|
|||
}
|
||||
}
|
||||
|
||||
void AddLuaFileTransfer(const char *filename, const char *mode)
|
||||
{
|
||||
luafiletransfer_t **prevnext; // A pointer to the "next" field of the last transfer in the list
|
||||
luafiletransfer_t *filetransfer;
|
||||
static INT32 id;
|
||||
|
||||
// Find the last transfer in the list and set a pointer to its "next" field
|
||||
prevnext = &luafiletransfers;
|
||||
while (*prevnext)
|
||||
prevnext = &((*prevnext)->next);
|
||||
|
||||
// Allocate file transfer information and append it to the transfer list
|
||||
filetransfer = malloc(sizeof(luafiletransfer_t));
|
||||
if (!filetransfer)
|
||||
I_Error("AddLuaFileTransfer: Out of memory\n");
|
||||
*prevnext = filetransfer;
|
||||
filetransfer->next = NULL;
|
||||
|
||||
// Allocate the file name
|
||||
filetransfer->filename = strdup(filename);
|
||||
if (!filetransfer->filename)
|
||||
I_Error("AddLuaFileTransfer: Out of memory\n");
|
||||
|
||||
// Create and allocate the real file name
|
||||
if (server)
|
||||
filetransfer->realfilename = strdup(va("%s" PATHSEP "%s",
|
||||
luafiledir, filename));
|
||||
else
|
||||
filetransfer->realfilename = strdup(va("%s" PATHSEP "client" PATHSEP "$$$%d%d.tmp",
|
||||
luafiledir, rand(), rand()));
|
||||
if (!filetransfer->realfilename)
|
||||
I_Error("AddLuaFileTransfer: Out of memory\n");
|
||||
|
||||
strlcpy(filetransfer->mode, mode, sizeof(filetransfer->mode));
|
||||
|
||||
// Only if there is no transfer already going on
|
||||
if (server && filetransfer == luafiletransfers)
|
||||
SV_PrepareSendLuaFile();
|
||||
else
|
||||
filetransfer->ongoing = false;
|
||||
|
||||
// Store the callback so it can be called once everyone has the file
|
||||
filetransfer->id = id;
|
||||
StoreLuaFileCallback(id);
|
||||
id++;
|
||||
|
||||
if (waitingforluafiletransfer)
|
||||
{
|
||||
waitingforluafiletransfer = false;
|
||||
CL_PrepareDownloadLuaFile();
|
||||
}
|
||||
}
|
||||
|
||||
static void SV_PrepareSendLuaFileToNextNode(void)
|
||||
{
|
||||
INT32 i;
|
||||
UINT8 success = 1;
|
||||
|
||||
// Find a client to send the file to
|
||||
for (i = 1; i < MAXNETNODES; i++)
|
||||
if (nodeingame[i] && luafiletransfers->nodestatus[i] == LFTNS_WAITING) // Node waiting
|
||||
{
|
||||
// Tell the client we're about to send them the file
|
||||
netbuffer->packettype = PT_SENDINGLUAFILE;
|
||||
if (!HSendPacket(i, true, 0, 0))
|
||||
I_Error("Failed to send a PT_SENDINGLUAFILE packet\n"); // !!! Todo: Handle failure a bit better lol
|
||||
|
||||
luafiletransfers->nodestatus[i] = LFTNS_ASKED;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// No client found, everyone has the file
|
||||
// Send a net command with 1 as its first byte to indicate the file could be opened
|
||||
SendNetXCmd(XD_LUAFILE, &success, 1);
|
||||
}
|
||||
|
||||
void SV_PrepareSendLuaFile(void)
|
||||
{
|
||||
char *binfilename;
|
||||
INT32 i;
|
||||
|
||||
luafiletransfers->ongoing = true;
|
||||
|
||||
// Set status to "waiting" for everyone
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
luafiletransfers->nodestatus[i] = LFTNS_WAITING;
|
||||
|
||||
if (FIL_ReadFileOK(luafiletransfers->realfilename))
|
||||
{
|
||||
// If opening in text mode, convert all newlines to LF
|
||||
if (!strchr(luafiletransfers->mode, 'b'))
|
||||
{
|
||||
binfilename = strdup(va("%s" PATHSEP "$$$%d%d.tmp",
|
||||
luafiledir, rand(), rand()));
|
||||
if (!binfilename)
|
||||
I_Error("SV_PrepareSendLuaFile: Out of memory\n");
|
||||
|
||||
if (!FIL_ConvertTextFileToBinary(luafiletransfers->realfilename, binfilename))
|
||||
I_Error("SV_PrepareSendLuaFile: Failed to convert file newlines\n");
|
||||
|
||||
// Use the temporary file instead
|
||||
free(luafiletransfers->realfilename);
|
||||
luafiletransfers->realfilename = binfilename;
|
||||
}
|
||||
|
||||
SV_PrepareSendLuaFileToNextNode();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Send a net command with 0 as its first byte to indicate the file couldn't be opened
|
||||
UINT8 success = 0;
|
||||
SendNetXCmd(XD_LUAFILE, &success, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void SV_HandleLuaFileSent(UINT8 node)
|
||||
{
|
||||
luafiletransfers->nodestatus[node] = LFTNS_SENT;
|
||||
SV_PrepareSendLuaFileToNextNode();
|
||||
}
|
||||
|
||||
void RemoveLuaFileTransfer(void)
|
||||
{
|
||||
luafiletransfer_t *filetransfer = luafiletransfers;
|
||||
|
||||
// If it was a temporary file, delete it
|
||||
if (server && !strchr(filetransfer->mode, 'b'))
|
||||
remove(filetransfer->realfilename);
|
||||
|
||||
RemoveLuaFileCallback(filetransfer->id);
|
||||
|
||||
luafiletransfers = filetransfer->next;
|
||||
|
||||
free(filetransfer->filename);
|
||||
free(filetransfer->realfilename);
|
||||
free(filetransfer);
|
||||
}
|
||||
|
||||
void RemoveAllLuaFileTransfers(void)
|
||||
{
|
||||
while (luafiletransfers)
|
||||
RemoveLuaFileTransfer();
|
||||
}
|
||||
|
||||
void SV_AbortLuaFileTransfer(INT32 node)
|
||||
{
|
||||
if (luafiletransfers
|
||||
&& (luafiletransfers->nodestatus[node] == LFTNS_ASKED
|
||||
|| luafiletransfers->nodestatus[node] == LFTNS_SENDING))
|
||||
{
|
||||
luafiletransfers->nodestatus[node] = LFTNS_WAITING;
|
||||
SV_PrepareSendLuaFileToNextNode();
|
||||
}
|
||||
}
|
||||
|
||||
void CL_PrepareDownloadLuaFile(void)
|
||||
{
|
||||
// If there is no transfer in the list, this normally means the server
|
||||
// called io.open before us, so we have to wait until we call it too
|
||||
if (!luafiletransfers)
|
||||
{
|
||||
waitingforluafiletransfer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (luafiletransfers->ongoing)
|
||||
{
|
||||
waitingforluafilecommand = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Tell the server we are ready to receive the file
|
||||
netbuffer->packettype = PT_ASKLUAFILE;
|
||||
HSendPacket(servernode, true, 0, 0);
|
||||
|
||||
fileneedednum = 1;
|
||||
fileneeded[0].status = FS_REQUESTED;
|
||||
fileneeded[0].justdownloaded = false;
|
||||
fileneeded[0].totalsize = UINT32_MAX;
|
||||
fileneeded[0].file = NULL;
|
||||
memset(fileneeded[0].md5sum, 0, 16);
|
||||
strcpy(fileneeded[0].filename, luafiletransfers->realfilename);
|
||||
|
||||
// Make sure all directories in the file path exist
|
||||
MakePathDirs(fileneeded[0].filename);
|
||||
|
||||
luafiletransfers->ongoing = true;
|
||||
}
|
||||
|
||||
// Number of files to send
|
||||
// Little optimization to quickly test if there is a file in the queue
|
||||
static INT32 filestosend = 0;
|
||||
|
@ -456,11 +700,12 @@ static INT32 filestosend = 0;
|
|||
*
|
||||
* \param node The node to send the file to
|
||||
* \param filename The file to send
|
||||
* \param fileid ???
|
||||
* \sa SV_SendRam
|
||||
* \param fileid The index of the file in the list of added files
|
||||
* \sa AddRamToSendQueue
|
||||
* \sa AddLuaFileToSendQueue
|
||||
*
|
||||
*/
|
||||
static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
||||
static boolean AddFileToSendQueue(INT32 node, const char *filename, UINT8 fileid)
|
||||
{
|
||||
filetx_t **q; // A pointer to the "next" field of the last file in the list
|
||||
filetx_t *p; // The new file request
|
||||
|
@ -478,7 +723,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
|||
// Allocate a file request and append it to the file list
|
||||
p = *q = (filetx_t *)malloc(sizeof (filetx_t));
|
||||
if (!p)
|
||||
I_Error("SV_SendFile: No more memory\n");
|
||||
I_Error("AddFileToSendQueue: No more memory\n");
|
||||
|
||||
// Initialise with zeros
|
||||
memset(p, 0, sizeof (filetx_t));
|
||||
|
@ -486,7 +731,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
|||
// Allocate the file name
|
||||
p->id.filename = (char *)malloc(MAX_WADPATH);
|
||||
if (!p->id.filename)
|
||||
I_Error("SV_SendFile: No more memory\n");
|
||||
I_Error("AddFileToSendQueue: No more memory\n");
|
||||
|
||||
// Set the file name and get rid of the path
|
||||
strlcpy(p->id.filename, filename, MAX_WADPATH);
|
||||
|
@ -546,11 +791,12 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
|||
* \param data The memory block to send
|
||||
* \param size The size of the block in bytes
|
||||
* \param freemethod How to free the block after it has been sent
|
||||
* \param fileid ???
|
||||
* \sa SV_SendFile
|
||||
* \param fileid The index of the file in the list of added files
|
||||
* \sa AddFileToSendQueue
|
||||
* \sa AddLuaFileToSendQueue
|
||||
*
|
||||
*/
|
||||
void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UINT8 fileid)
|
||||
void AddRamToSendQueue(INT32 node, void *data, size_t size, freemethod_t freemethod, UINT8 fileid)
|
||||
{
|
||||
filetx_t **q; // A pointer to the "next" field of the last file in the list
|
||||
filetx_t *p; // The new file request
|
||||
|
@ -563,7 +809,7 @@ void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UI
|
|||
// Allocate a file request and append it to the file list
|
||||
p = *q = (filetx_t *)malloc(sizeof (filetx_t));
|
||||
if (!p)
|
||||
I_Error("SV_SendRam: No more memory\n");
|
||||
I_Error("AddRamToSendQueue: No more memory\n");
|
||||
|
||||
// Initialise with zeros
|
||||
memset(p, 0, sizeof (filetx_t));
|
||||
|
@ -579,6 +825,52 @@ void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UI
|
|||
filestosend++;
|
||||
}
|
||||
|
||||
/** Adds a file requested by Lua to the file list for a node
|
||||
*
|
||||
* \param node The node to send the file to
|
||||
* \param filename The file to send
|
||||
* \sa AddFileToSendQueue
|
||||
* \sa AddRamToSendQueue
|
||||
*
|
||||
*/
|
||||
boolean AddLuaFileToSendQueue(INT32 node, const char *filename)
|
||||
{
|
||||
filetx_t **q; // A pointer to the "next" field of the last file in the list
|
||||
filetx_t *p; // The new file request
|
||||
//INT32 i;
|
||||
//char wadfilename[MAX_WADPATH];
|
||||
|
||||
luafiletransfers->nodestatus[node] = LFTNS_SENDING;
|
||||
|
||||
// Find the last file in the list and set a pointer to its "next" field
|
||||
q = &transfer[node].txlist;
|
||||
while (*q)
|
||||
q = &((*q)->next);
|
||||
|
||||
// Allocate a file request and append it to the file list
|
||||
p = *q = (filetx_t *)malloc(sizeof (filetx_t));
|
||||
if (!p)
|
||||
I_Error("AddLuaFileToSendQueue: No more memory\n");
|
||||
|
||||
// Initialise with zeros
|
||||
memset(p, 0, sizeof (filetx_t));
|
||||
|
||||
// Allocate the file name
|
||||
p->id.filename = (char *)malloc(MAX_WADPATH); // !!!
|
||||
if (!p->id.filename)
|
||||
I_Error("AddLuaFileToSendQueue: No more memory\n");
|
||||
|
||||
// Set the file name and get rid of the path
|
||||
strlcpy(p->id.filename, filename, MAX_WADPATH); // !!!
|
||||
//nameonly(p->id.filename);
|
||||
|
||||
DEBFILE(va("Sending Lua file %s to %d\n", filename, node));
|
||||
p->ram = SF_FILE; // It's a file, we need to close it and free its name once we're done sending it
|
||||
p->next = NULL; // End of list
|
||||
filestosend++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Stops sending a file for a node, and removes the file request from the list,
|
||||
* either because the file has been fully sent or because the node was disconnected
|
||||
*
|
||||
|
@ -589,7 +881,8 @@ static void SV_EndFileSend(INT32 node)
|
|||
{
|
||||
filetx_t *p = transfer[node].txlist;
|
||||
|
||||
// Free the file request according to the freemethod parameter used with SV_SendFile/Ram
|
||||
// Free the file request according to the freemethod
|
||||
// parameter used with AddFileToSendQueue/AddRamToSendQueue
|
||||
switch (p->ram)
|
||||
{
|
||||
case SF_FILE: // It's a file, close it and free its filename
|
||||
|
@ -614,43 +907,32 @@ static void SV_EndFileSend(INT32 node)
|
|||
|
||||
// Indicate that the transmission is over
|
||||
transfer[node].currentfile = NULL;
|
||||
if (transfer[node].ackedfragments)
|
||||
free(transfer[node].ackedfragments);
|
||||
transfer[node].ackedfragments = NULL;
|
||||
|
||||
filestosend--;
|
||||
}
|
||||
|
||||
#define PACKETPERTIC net_bandwidth/(TICRATE*software_MAXPACKETLENGTH)
|
||||
#define FILEFRAGMENTSIZE (software_MAXPACKETLENGTH - (FILETXHEADER + BASEPACKETSIZE))
|
||||
|
||||
/** Handles file transmission
|
||||
*
|
||||
* \todo Use an acknowledging method more adapted to file transmission
|
||||
* The current download speed suffers from lack of ack packets,
|
||||
* especially when the one downloading has high latency
|
||||
*
|
||||
*/
|
||||
void SV_FileSendTicker(void)
|
||||
void FileSendTicker(void)
|
||||
{
|
||||
static INT32 currentnode = 0;
|
||||
filetx_pak *p;
|
||||
size_t size;
|
||||
size_t fragmentsize;
|
||||
filetx_t *f;
|
||||
INT32 packetsent, ram, i, j;
|
||||
INT32 maxpacketsent;
|
||||
|
||||
if (!filestosend) // No file to send
|
||||
return;
|
||||
|
||||
if (cv_downloadspeed.value) // New (and experimental) behavior
|
||||
{
|
||||
if (cv_downloadspeed.value) // New behavior
|
||||
packetsent = cv_downloadspeed.value;
|
||||
// Don't send more packets than we have free acks
|
||||
#ifndef NONET
|
||||
maxpacketsent = Net_GetFreeAcks(false) - 5; // Let 5 extra acks just in case
|
||||
#else
|
||||
maxpacketsent = 1;
|
||||
#endif
|
||||
if (packetsent > maxpacketsent && maxpacketsent > 0) // Send at least one packet
|
||||
packetsent = maxpacketsent;
|
||||
}
|
||||
else // Old behavior
|
||||
{
|
||||
packetsent = PACKETPERTIC;
|
||||
|
@ -667,11 +949,12 @@ void SV_FileSendTicker(void)
|
|||
i = (i+1) % MAXNETNODES, j++)
|
||||
{
|
||||
if (transfer[i].txlist)
|
||||
goto found;
|
||||
break;
|
||||
}
|
||||
// no transfer to do
|
||||
if (j >= MAXNETNODES)
|
||||
I_Error("filestosend=%d but no file to send found\n", filestosend);
|
||||
found:
|
||||
|
||||
currentnode = (i+1) % MAXNETNODES;
|
||||
f = transfer[i].txlist;
|
||||
ram = f->ram;
|
||||
|
@ -705,48 +988,232 @@ void SV_FileSendTicker(void)
|
|||
}
|
||||
else // Sending RAM
|
||||
transfer[i].currentfile = (FILE *)1; // Set currentfile to a non-null value to indicate that it is open
|
||||
|
||||
transfer[i].iteration = 1;
|
||||
transfer[i].ackediteration = 0;
|
||||
transfer[i].position = 0;
|
||||
transfer[i].ackedsize = 0;
|
||||
|
||||
transfer[i].ackedfragments = calloc(f->size / FILEFRAGMENTSIZE + 1, sizeof(*transfer[i].ackedfragments));
|
||||
if (!transfer[i].ackedfragments)
|
||||
I_Error("FileSendTicker: No more memory\n");
|
||||
|
||||
transfer[i].dontsenduntil = 0;
|
||||
}
|
||||
|
||||
// If the client hasn't acknowledged any fragment from the previous iteration,
|
||||
// it is most likely because their acks haven't had enough time to reach the server
|
||||
// yet, due to latency. In that case, we wait a little to avoid useless resend.
|
||||
if (I_GetTime() < transfer[i].dontsenduntil)
|
||||
continue;
|
||||
|
||||
// Find the first non-acknowledged fragment
|
||||
while (transfer[i].ackedfragments[transfer[i].position / FILEFRAGMENTSIZE])
|
||||
{
|
||||
transfer[i].position += FILEFRAGMENTSIZE;
|
||||
if (transfer[i].position >= f->size)
|
||||
{
|
||||
if (transfer[i].ackediteration < transfer[i].iteration)
|
||||
transfer[i].dontsenduntil = I_GetTime() + TICRATE / 2;
|
||||
|
||||
transfer[i].position = 0;
|
||||
transfer[i].iteration++;
|
||||
}
|
||||
}
|
||||
|
||||
// Build a packet containing a file fragment
|
||||
p = &netbuffer->u.filetxpak;
|
||||
size = software_MAXPACKETLENGTH - (FILETXHEADER + BASEPACKETSIZE);
|
||||
if (f->size-transfer[i].position < size)
|
||||
size = f->size-transfer[i].position;
|
||||
fragmentsize = FILEFRAGMENTSIZE;
|
||||
if (f->size-transfer[i].position < fragmentsize)
|
||||
fragmentsize = f->size-transfer[i].position;
|
||||
if (ram)
|
||||
M_Memcpy(p->data, &f->id.ram[transfer[i].position], size);
|
||||
else if (fread(p->data, 1, size, transfer[i].currentfile) != size)
|
||||
I_Error("SV_FileSendTicker: can't read %s byte on %s at %d because %s", sizeu1(size), f->id.filename, transfer[i].position, M_FileError(transfer[i].currentfile));
|
||||
M_Memcpy(p->data, &f->id.ram[transfer[i].position], fragmentsize);
|
||||
else
|
||||
{
|
||||
fseek(transfer[i].currentfile, transfer[i].position, SEEK_SET);
|
||||
|
||||
if (fread(p->data, 1, fragmentsize, transfer[i].currentfile) != fragmentsize)
|
||||
I_Error("FileSendTicker: can't read %s byte on %s at %d because %s", sizeu1(fragmentsize), f->id.filename, transfer[i].position, M_FileError(transfer[i].currentfile));
|
||||
}
|
||||
p->iteration = transfer[i].iteration;
|
||||
p->position = LONG(transfer[i].position);
|
||||
// Put flag so receiver knows the total size
|
||||
if (transfer[i].position + size == f->size)
|
||||
p->position |= LONG(0x80000000);
|
||||
p->fileid = f->fileid;
|
||||
p->size = SHORT((UINT16)size);
|
||||
p->filesize = LONG(f->size);
|
||||
p->size = SHORT((UINT16)FILEFRAGMENTSIZE);
|
||||
|
||||
// Send the packet
|
||||
if (HSendPacket(i, true, 0, FILETXHEADER + size)) // Reliable SEND
|
||||
if (HSendPacket(i, false, 0, FILETXHEADER + fragmentsize)) // Don't use the default acknowledgement system
|
||||
{ // Success
|
||||
transfer[i].position = (UINT32)(transfer[i].position + size);
|
||||
if (transfer[i].position == f->size) // Finish?
|
||||
SV_EndFileSend(i);
|
||||
transfer[i].position = (UINT32)(transfer[i].position + fragmentsize);
|
||||
if (transfer[i].position >= f->size)
|
||||
{
|
||||
if (transfer[i].ackediteration < transfer[i].iteration)
|
||||
transfer[i].dontsenduntil = I_GetTime() + TICRATE / 2;
|
||||
|
||||
transfer[i].position = 0;
|
||||
transfer[i].iteration++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Not sent for some odd reason, retry at next call
|
||||
if (!ram)
|
||||
fseek(transfer[i].currentfile,transfer[i].position, SEEK_SET);
|
||||
// Exit the while (can't send this one so why should i send the next?)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Got_Filetxpak(void)
|
||||
void PT_FileAck(void)
|
||||
{
|
||||
fileack_pak *packet = &netbuffer->u.fileack;
|
||||
INT32 node = doomcom->remotenode;
|
||||
filetran_t *trans = &transfer[node];
|
||||
INT32 i, j;
|
||||
|
||||
// Wrong file id? Ignore it, it's probably a late packet
|
||||
if (!(trans->txlist && packet->fileid == trans->txlist->fileid))
|
||||
return;
|
||||
|
||||
if (packet->numsegments * sizeof(*packet->segments) != doomcom->datalength - BASEPACKETSIZE - sizeof(*packet))
|
||||
{
|
||||
Net_CloseConnection(node);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->iteration > trans->ackediteration)
|
||||
{
|
||||
trans->ackediteration = packet->iteration;
|
||||
if (trans->ackediteration >= trans->iteration - 1)
|
||||
trans->dontsenduntil = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < packet->numsegments; i++)
|
||||
{
|
||||
fileacksegment_t *segment = &packet->segments[i];
|
||||
|
||||
for (j = 0; j < 32; j++)
|
||||
if (LONG(segment->acks) & (1 << j))
|
||||
{
|
||||
if (LONG(segment->start) * FILEFRAGMENTSIZE >= trans->txlist->size)
|
||||
{
|
||||
Net_CloseConnection(node);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!trans->ackedfragments[LONG(segment->start) + j])
|
||||
{
|
||||
trans->ackedfragments[LONG(segment->start) + j] = true;
|
||||
trans->ackedsize += FILEFRAGMENTSIZE;
|
||||
|
||||
// If the last missing fragment was acked, finish!
|
||||
if (trans->ackedsize == trans->txlist->size)
|
||||
{
|
||||
SV_EndFileSend(node);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PT_FileReceived(void)
|
||||
{
|
||||
filetx_t *trans = transfer[doomcom->remotenode].txlist;
|
||||
|
||||
if (trans && netbuffer->u.filereceived == trans->fileid)
|
||||
SV_EndFileSend(doomcom->remotenode);
|
||||
}
|
||||
|
||||
static void SendAckPacket(fileack_pak *packet, UINT8 fileid)
|
||||
{
|
||||
size_t packetsize;
|
||||
INT32 i;
|
||||
|
||||
packetsize = sizeof(*packet) + packet->numsegments * sizeof(*packet->segments);
|
||||
|
||||
// Finalise the packet
|
||||
packet->fileid = fileid;
|
||||
for (i = 0; i < packet->numsegments; i++)
|
||||
{
|
||||
packet->segments[i].start = LONG(packet->segments[i].start);
|
||||
packet->segments[i].acks = LONG(packet->segments[i].acks);
|
||||
}
|
||||
|
||||
// Send the packet
|
||||
netbuffer->packettype = PT_FILEACK;
|
||||
M_Memcpy(&netbuffer->u.fileack, packet, packetsize);
|
||||
HSendPacket(servernode, false, 0, packetsize);
|
||||
|
||||
// Clear the packet
|
||||
memset(packet, 0, sizeof(*packet) + 512);
|
||||
}
|
||||
|
||||
static void AddFragmentToAckPacket(fileack_pak *packet, UINT8 iteration, UINT32 fragmentpos, UINT8 fileid)
|
||||
{
|
||||
fileacksegment_t *segment = &packet->segments[packet->numsegments - 1];
|
||||
|
||||
packet->iteration = max(packet->iteration, iteration);
|
||||
|
||||
if (packet->numsegments == 0
|
||||
|| fragmentpos < segment->start
|
||||
|| fragmentpos - segment->start >= 32)
|
||||
{
|
||||
// If the packet becomes too big, send it
|
||||
if ((packet->numsegments + 1) * sizeof(*segment) > 512)
|
||||
SendAckPacket(packet, fileid);
|
||||
|
||||
packet->numsegments++;
|
||||
segment = &packet->segments[packet->numsegments - 1];
|
||||
segment->start = fragmentpos;
|
||||
}
|
||||
|
||||
// Set the bit that represents the fragment
|
||||
segment->acks |= 1 << (fragmentpos - segment->start);
|
||||
}
|
||||
|
||||
void FileReceiveTicker(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
{
|
||||
fileneeded_t *file = &fileneeded[i];
|
||||
|
||||
if (file->status == FS_DOWNLOADING)
|
||||
{
|
||||
if (lasttimeackpacketsent - I_GetTime() > TICRATE / 2)
|
||||
SendAckPacket(file->ackpacket, i);
|
||||
|
||||
// When resuming a tranfer, start with telling
|
||||
// the server what parts we already received
|
||||
if (file->ackresendposition != UINT32_MAX && file->status == FS_DOWNLOADING)
|
||||
{
|
||||
// Acknowledge ~70 MB/s, whichs means the client sends ~18 KB/s
|
||||
INT32 j;
|
||||
for (j = 0; j < 2048; j++)
|
||||
{
|
||||
if (file->receivedfragments[file->ackresendposition])
|
||||
AddFragmentToAckPacket(file->ackpacket, file->iteration, file->ackresendposition, i);
|
||||
|
||||
file->ackresendposition++;
|
||||
if (file->ackresendposition * file->fragmentsize >= file->totalsize)
|
||||
{
|
||||
file->ackresendposition = UINT32_MAX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PT_FileFragment(void)
|
||||
{
|
||||
INT32 filenum = netbuffer->u.filetxpak.fileid;
|
||||
fileneeded_t *file = &fileneeded[filenum];
|
||||
UINT32 fragmentpos = LONG(netbuffer->u.filetxpak.position);
|
||||
UINT16 fragmentsize = SHORT(netbuffer->u.filetxpak.size);
|
||||
UINT16 boundedfragmentsize = doomcom->datalength - BASEPACKETSIZE - sizeof(netbuffer->u.filetxpak);
|
||||
char *filename;
|
||||
static INT32 filetime = 0;
|
||||
|
||||
filename = va("%s", file->filename);
|
||||
nameonly(filename);
|
||||
|
@ -771,43 +1238,105 @@ void Got_Filetxpak(void)
|
|||
if (file->status == FS_REQUESTED)
|
||||
{
|
||||
if (file->file)
|
||||
I_Error("Got_Filetxpak: already open file\n");
|
||||
I_Error("PT_FileFragment: already open file\n");
|
||||
|
||||
file->status = FS_DOWNLOADING;
|
||||
file->fragmentsize = fragmentsize;
|
||||
file->iteration = 0;
|
||||
|
||||
file->ackpacket = calloc(1, sizeof(*file->ackpacket) + 512);
|
||||
if (!file->ackpacket)
|
||||
I_Error("FileSendTicker: No more memory\n");
|
||||
|
||||
if (CL_CanResumeDownload(file))
|
||||
{
|
||||
file->file = fopen(filename, "r+b");
|
||||
if (!file->file)
|
||||
I_Error("Can't reopen file %s: %s", filename, strerror(errno));
|
||||
CONS_Printf("\r%s...\n", filename);
|
||||
|
||||
CONS_Printf("Resuming download...\n");
|
||||
file->currentsize = pauseddownload->currentsize;
|
||||
file->receivedfragments = pauseddownload->receivedfragments;
|
||||
file->ackresendposition = 0;
|
||||
|
||||
free(pauseddownload);
|
||||
pauseddownload = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
CL_AbortDownloadResume();
|
||||
|
||||
file->file = fopen(filename, "wb");
|
||||
if (!file->file)
|
||||
I_Error("Can't create file %s: %s", filename, strerror(errno));
|
||||
|
||||
CONS_Printf("\r%s...\n",filename);
|
||||
|
||||
file->currentsize = 0;
|
||||
file->status = FS_DOWNLOADING;
|
||||
file->totalsize = LONG(netbuffer->u.filetxpak.filesize);
|
||||
file->ackresendposition = UINT32_MAX; // Only used for resumed downloads
|
||||
|
||||
file->receivedfragments = calloc(file->totalsize / fragmentsize + 1, sizeof(*file->receivedfragments));
|
||||
if (!file->receivedfragments)
|
||||
I_Error("FileSendTicker: No more memory\n");
|
||||
}
|
||||
|
||||
lasttimeackpacketsent = I_GetTime();
|
||||
}
|
||||
|
||||
if (file->status == FS_DOWNLOADING)
|
||||
{
|
||||
UINT32 pos = LONG(netbuffer->u.filetxpak.position);
|
||||
UINT16 size = SHORT(netbuffer->u.filetxpak.size);
|
||||
// Use a special trick to know when the file is complete (not always used)
|
||||
// WARNING: file fragments can arrive out of order so don't stop yet!
|
||||
if (pos & 0x80000000)
|
||||
if (fragmentpos >= file->totalsize)
|
||||
I_Error("Invalid file fragment\n");
|
||||
|
||||
file->iteration = max(file->iteration, netbuffer->u.filetxpak.iteration);
|
||||
|
||||
if (!file->receivedfragments[fragmentpos / fragmentsize]) // Not received yet
|
||||
{
|
||||
pos &= ~0x80000000;
|
||||
file->totalsize = pos + size;
|
||||
}
|
||||
// We can receive packet in the wrong order, anyway all os support gaped file
|
||||
fseek(file->file, pos, SEEK_SET);
|
||||
if (fwrite(netbuffer->u.filetxpak.data,size,1,file->file) != 1)
|
||||
file->receivedfragments[fragmentpos / fragmentsize] = true;
|
||||
|
||||
// We can receive packets in the wrong order, anyway all OSes support gaped files
|
||||
fseek(file->file, fragmentpos, SEEK_SET);
|
||||
if (fragmentsize && fwrite(netbuffer->u.filetxpak.data, boundedfragmentsize, 1, file->file) != 1)
|
||||
I_Error("Can't write to %s: %s\n",filename, M_FileError(file->file));
|
||||
file->currentsize += size;
|
||||
file->currentsize += boundedfragmentsize;
|
||||
|
||||
AddFragmentToAckPacket(file->ackpacket, file->iteration, fragmentpos / fragmentsize, filenum);
|
||||
|
||||
// Finished?
|
||||
if (file->currentsize == file->totalsize)
|
||||
{
|
||||
fclose(file->file);
|
||||
file->file = NULL;
|
||||
free(file->receivedfragments);
|
||||
free(file->ackpacket);
|
||||
file->status = FS_FOUND;
|
||||
file->justdownloaded = true;
|
||||
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
|
||||
filename);
|
||||
|
||||
// Tell the server we have received the file
|
||||
netbuffer->packettype = PT_FILERECEIVED;
|
||||
netbuffer->u.filereceived = filenum;
|
||||
HSendPacket(servernode, true, 0, 1);
|
||||
|
||||
if (luafiletransfers)
|
||||
{
|
||||
// Tell the server we have received the file
|
||||
netbuffer->packettype = PT_HASLUAFILE;
|
||||
HSendPacket(servernode, true, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else // Already received
|
||||
{
|
||||
// If they are sending us the fragment again, it's probably because
|
||||
// they missed our previous ack, so we must re-acknowledge it
|
||||
AddFragmentToAckPacket(file->ackpacket, file->iteration, fragmentpos / fragmentsize, filenum);
|
||||
}
|
||||
}
|
||||
else if (!file->justdownloaded)
|
||||
{
|
||||
const char *s;
|
||||
switch(file->status)
|
||||
|
@ -830,14 +1359,8 @@ void Got_Filetxpak(void)
|
|||
}
|
||||
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
|
||||
}
|
||||
// Send ack back quickly
|
||||
if (++filetime == 3)
|
||||
{
|
||||
Net_SendAcks(servernode);
|
||||
filetime = 0;
|
||||
}
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
#ifndef NONET
|
||||
lastfilenum = filenum;
|
||||
#endif
|
||||
}
|
||||
|
@ -848,7 +1371,7 @@ void Got_Filetxpak(void)
|
|||
* \return True if the node is downloading a file
|
||||
*
|
||||
*/
|
||||
boolean SV_SendingFile(INT32 node)
|
||||
boolean SendingFile(INT32 node)
|
||||
{
|
||||
return transfer[node].txlist != NULL;
|
||||
}
|
||||
|
@ -877,12 +1400,62 @@ void CloseNetFile(void)
|
|||
if (fileneeded[i].status == FS_DOWNLOADING && fileneeded[i].file)
|
||||
{
|
||||
fclose(fileneeded[i].file);
|
||||
free(fileneeded[i].ackpacket);
|
||||
|
||||
if (!pauseddownload && i != 0) // 0 is either srb2.srb or the gamestate...
|
||||
{
|
||||
// Don't remove the file, save it for later in case we resume the download
|
||||
pauseddownload = malloc(sizeof(*pauseddownload));
|
||||
if (!pauseddownload)
|
||||
I_Error("CloseNetFile: No more memory\n");
|
||||
|
||||
strcpy(pauseddownload->filename, fileneeded[i].filename);
|
||||
memcpy(pauseddownload->md5sum, fileneeded[i].md5sum, 16);
|
||||
pauseddownload->currentsize = fileneeded[i].currentsize;
|
||||
pauseddownload->receivedfragments = fileneeded[i].receivedfragments;
|
||||
pauseddownload->fragmentsize = fileneeded[i].fragmentsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(fileneeded[i].receivedfragments);
|
||||
// File is not complete delete it
|
||||
remove(fileneeded[i].filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove PT_FILEFRAGMENT from acknowledge list
|
||||
Net_AbortPacketType(PT_FILEFRAGMENT);
|
||||
void Command_Downloads_f(void)
|
||||
{
|
||||
INT32 node;
|
||||
|
||||
for (node = 0; node < MAXNETNODES; node++)
|
||||
if (transfer[node].txlist
|
||||
&& transfer[node].txlist->ram == SF_FILE) // Node is downloading a file?
|
||||
{
|
||||
const char *name = transfer[node].txlist->id.filename;
|
||||
UINT32 position = transfer[node].ackedsize;
|
||||
UINT32 size = transfer[node].txlist->size;
|
||||
char ratecolor;
|
||||
|
||||
// Avoid division by zero errors
|
||||
if (!size)
|
||||
size = 1;
|
||||
|
||||
name = &name[strlen(name) - nameonlylength(name)];
|
||||
switch (4 * (position - 1) / size)
|
||||
{
|
||||
case 0: ratecolor = '\x85'; break;
|
||||
case 1: ratecolor = '\x87'; break;
|
||||
case 2: ratecolor = '\x82'; break;
|
||||
case 3: ratecolor = '\x83'; break;
|
||||
default: ratecolor = '\x80';
|
||||
}
|
||||
|
||||
CONS_Printf("%2d %c%s ", node, ratecolor, name); // Node and file name
|
||||
CONS_Printf("\x80%uK\x84/\x80%uK ", position / 1024, size / 1024); // Progress in kB
|
||||
CONS_Printf("\x80(%c%u%%\x80) ", ratecolor, (UINT32)(100.0 * position / size)); // Progress in %
|
||||
CONS_Printf("%s\n", I_GetNodeAddress(node)); // Address and newline
|
||||
}
|
||||
}
|
||||
|
||||
// Functions cut and pasted from Doomatic :)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -13,6 +13,8 @@
|
|||
#ifndef __D_NETFIL__
|
||||
#define __D_NETFIL__
|
||||
|
||||
#include "d_net.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
typedef enum
|
||||
|
@ -38,18 +40,25 @@ typedef struct
|
|||
UINT8 willsend; // Is the server willing to send it?
|
||||
char filename[MAX_WADPATH];
|
||||
UINT8 md5sum[16];
|
||||
filestatus_t status; // The value returned by recsearch
|
||||
boolean justdownloaded; // To prevent late fragments from causing an I_Error
|
||||
|
||||
// Used only for download
|
||||
FILE *file;
|
||||
boolean *receivedfragments;
|
||||
UINT32 fragmentsize;
|
||||
UINT8 iteration;
|
||||
fileack_pak *ackpacket;
|
||||
UINT32 currentsize;
|
||||
UINT32 totalsize;
|
||||
filestatus_t status; // The value returned by recsearch
|
||||
UINT32 ackresendposition; // Used when resuming downloads
|
||||
} fileneeded_t;
|
||||
|
||||
extern INT32 fileneedednum;
|
||||
extern fileneeded_t fileneeded[MAX_WADFILES];
|
||||
extern char downloaddir[512];
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
#ifndef NONET
|
||||
extern INT32 lastfilenum;
|
||||
#endif
|
||||
|
||||
|
@ -59,19 +68,63 @@ void CL_PrepareDownloadSaveGame(const char *tmpsave);
|
|||
|
||||
INT32 CL_CheckFiles(void);
|
||||
void CL_LoadServerFiles(void);
|
||||
void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod,
|
||||
void AddRamToSendQueue(INT32 node, void *data, size_t size, freemethod_t freemethod,
|
||||
UINT8 fileid);
|
||||
|
||||
void SV_FileSendTicker(void);
|
||||
void Got_Filetxpak(void);
|
||||
boolean SV_SendingFile(INT32 node);
|
||||
void FileSendTicker(void);
|
||||
void PT_FileAck(void);
|
||||
void PT_FileReceived(void);
|
||||
boolean SendingFile(INT32 node);
|
||||
|
||||
void FileReceiveTicker(void);
|
||||
void PT_FileFragment(void);
|
||||
|
||||
boolean CL_CheckDownloadable(void);
|
||||
boolean CL_SendRequestFile(void);
|
||||
boolean Got_RequestFilePak(INT32 node);
|
||||
boolean CL_SendFileRequest(void);
|
||||
boolean PT_RequestFile(INT32 node);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LFTNS_WAITING, // This node is waiting for the server to send the file
|
||||
LFTNS_ASKED, // The server has told the node they're ready to send the file
|
||||
LFTNS_SENDING, // The server is sending the file to this node
|
||||
LFTNS_SENT // The node already has the file
|
||||
} luafiletransfernodestatus_t;
|
||||
|
||||
typedef struct luafiletransfer_s
|
||||
{
|
||||
char *filename;
|
||||
char *realfilename;
|
||||
char mode[4]; // rb+/wb+/ab+ + null character
|
||||
INT32 id; // Callback ID
|
||||
boolean ongoing;
|
||||
luafiletransfernodestatus_t nodestatus[MAXNETNODES];
|
||||
struct luafiletransfer_s *next;
|
||||
} luafiletransfer_t;
|
||||
|
||||
extern luafiletransfer_t *luafiletransfers;
|
||||
extern boolean waitingforluafiletransfer;
|
||||
extern boolean waitingforluafilecommand;
|
||||
extern char luafiledir[256 + 16];
|
||||
|
||||
void AddLuaFileTransfer(const char *filename, const char *mode);
|
||||
void SV_PrepareSendLuaFile(void);
|
||||
boolean AddLuaFileToSendQueue(INT32 node, const char *filename);
|
||||
void SV_HandleLuaFileSent(UINT8 node);
|
||||
void RemoveLuaFileTransfer(void);
|
||||
void RemoveAllLuaFileTransfers(void);
|
||||
void SV_AbortLuaFileTransfer(INT32 node);
|
||||
void CL_PrepareDownloadLuaFile(void);
|
||||
void Got_LuaFile(UINT8 **cp, INT32 playernum);
|
||||
void StoreLuaFileCallback(INT32 id);
|
||||
void RemoveLuaFileCallback(INT32 id);
|
||||
void MakePathDirs(char *path);
|
||||
|
||||
void SV_AbortSendFiles(INT32 node);
|
||||
void CloseNetFile(void);
|
||||
void CL_AbortDownloadResume(void);
|
||||
|
||||
void Command_Downloads_f(void);
|
||||
|
||||
boolean fileexist(char *filename, time_t ptime);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -48,6 +48,9 @@ typedef enum
|
|||
SF_FASTEDGE = 1<<12, // Faster edge teeter?
|
||||
SF_MULTIABILITY = 1<<13, // Revenge of Final Demo.
|
||||
SF_NONIGHTSROTATION = 1<<14, // Disable sprite rotation for NiGHTS
|
||||
SF_NONIGHTSSUPER = 1<<15, // Disable super colors for NiGHTS (if you have SF_SUPER)
|
||||
SF_NOSUPERSPRITES = 1<<16, // Don't use super sprites while super
|
||||
SF_NOSUPERJUMPBOOST = 1<<17, // Disable the jump boost given while super (i.e. Knuckles)
|
||||
// free up to and including 1<<31
|
||||
} skinflags_t;
|
||||
|
||||
|
@ -238,7 +241,8 @@ typedef enum
|
|||
CR_MACESPIN,
|
||||
CR_MINECART,
|
||||
CR_ROLLOUT,
|
||||
CR_PTERABYTE
|
||||
CR_PTERABYTE,
|
||||
CR_DUSTDEVIL
|
||||
} carrytype_t; // pw_carry
|
||||
|
||||
// Player powers. (don't edit this comment)
|
||||
|
@ -279,6 +283,12 @@ typedef enum
|
|||
|
||||
pw_nocontrol, //for linedef exec 427
|
||||
|
||||
pw_dye, // for dyes
|
||||
|
||||
pw_justlaunched, // Launched off a slope this tic (0=none, 1=standard launch, 2=half-pipe launch)
|
||||
|
||||
pw_ignorelatch, // Don't grab onto CR_GENERIC, add 32768 (powers[pw_ignorelatch] & 1<<15) to avoid ALL not-NiGHTS CR_ types
|
||||
|
||||
NUMPOWERS
|
||||
} powertype_t;
|
||||
|
||||
|
@ -324,6 +334,11 @@ typedef struct player_s
|
|||
// bounded/scaled total momentum.
|
||||
fixed_t bob;
|
||||
|
||||
angle_t viewrollangle;
|
||||
|
||||
INT16 angleturn;
|
||||
INT16 oldrelangleturn;
|
||||
|
||||
// Mouse aiming, where the guy is looking at!
|
||||
// It is updated with cmd->aiming.
|
||||
angle_t aiming;
|
||||
|
@ -358,7 +373,7 @@ typedef struct player_s
|
|||
UINT16 flashpal;
|
||||
|
||||
// Player skin colorshift, 0-15 for which color to draw player.
|
||||
UINT8 skincolor;
|
||||
UINT16 skincolor;
|
||||
|
||||
INT32 skin;
|
||||
UINT32 availabilities;
|
||||
|
@ -510,6 +525,7 @@ typedef struct player_s
|
|||
UINT8 bot;
|
||||
|
||||
tic_t jointime; // Timer when player joins game to change skin/color
|
||||
tic_t quittime; // Time elapsed since user disconnected, zero if connected
|
||||
#ifdef HWRENDER
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
633
src/dehacked.c
633
src/dehacked.c
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -34,11 +34,9 @@ void DEH_Check(void);
|
|||
|
||||
fixed_t get_number(const char *word);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
|
||||
const char *LUA_GetActionName(void *action);
|
||||
void LUA_SetActionByName(void *state, const char *actiontocompare);
|
||||
#endif
|
||||
|
||||
extern boolean deh_loaded;
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
|
||||
#include "../console.h"
|
||||
|
||||
#include "../m_menu.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "../i_system.h"
|
||||
#endif
|
||||
|
@ -555,6 +557,7 @@ void I_Error (const char *error, ...)
|
|||
if (demorecording)
|
||||
G_CheckDemoStatus();
|
||||
D_QuitNetGame ();
|
||||
M_FreePlayerSetupColors();
|
||||
|
||||
if (shutdowning)
|
||||
{
|
||||
|
@ -622,6 +625,7 @@ void I_Quit (void)
|
|||
if (demorecording)
|
||||
G_CheckDemoStatus();
|
||||
D_QuitNetGame ();
|
||||
M_FreePlayerSetupColors();
|
||||
I_ShutdownMusic();
|
||||
I_ShutdownSound();
|
||||
I_ShutdownCD();
|
||||
|
|
|
@ -90,6 +90,9 @@ static unsigned long nombre = NEWTICRATE*10;
|
|||
static void I_BlitScreenVesa1(void); //see later
|
||||
void I_FinishUpdate (void)
|
||||
{
|
||||
if (marathonmode)
|
||||
SCR_DisplayMarathonInfo();
|
||||
|
||||
// draw captions if enabled
|
||||
if (cv_closedcaptioning.value)
|
||||
SCR_ClosedCaptions();
|
||||
|
@ -339,7 +342,4 @@ void I_StartupGraphics(void)
|
|||
|
||||
}
|
||||
|
||||
void I_StartupHardwareGraphics(void)
|
||||
{
|
||||
// oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo y
|
||||
}
|
||||
void VID_StartupOpenGL(void) {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2005-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 2005-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -378,10 +378,8 @@ INT32 VID_SetMode (INT32 modenum) //, UINT8 *palette)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
void VID_CheckRenderer(void) {}
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender) {}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -208,10 +208,6 @@ typedef struct
|
|||
|
||||
#define ZSHIFT 4
|
||||
|
||||
extern const UINT8 Color_Index[MAXTRANSLATIONS-1][16];
|
||||
extern const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS];
|
||||
extern const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2];
|
||||
|
||||
#define NUMMAPS 1035
|
||||
|
||||
#endif // __DOOMDATA__
|
||||
|
|
111
src/doomdef.h
111
src/doomdef.h
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -86,6 +86,7 @@
|
|||
// warning C4213: nonstandard extension used : cast on l-value
|
||||
|
||||
|
||||
#include "version.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
@ -98,8 +99,8 @@
|
|||
|
||||
#ifdef GETTEXT
|
||||
#include <libintl.h>
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include <locale.h> // locale should not be dependent on GETTEXT -- 11/01/20 Monster Iestyn
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -135,24 +136,23 @@ 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
|
||||
#ifdef DEVELOP
|
||||
#define VERSION 0 // Game version
|
||||
#define SUBVERSION 0 // more precise version number
|
||||
#define VERSIONSTRING "Development EXE"
|
||||
#define VERSIONSTRINGW L"Development EXE"
|
||||
// most interface strings are ignored in development mode.
|
||||
// we use comprevision and compbranch instead.
|
||||
#else
|
||||
#define VERSION 202 // Game version
|
||||
#define SUBVERSION 0 // more precise version number
|
||||
#define VERSIONSTRING "v2.2.0"
|
||||
#define VERSIONSTRINGW L"v2.2.0"
|
||||
#define VERSIONSTRING "v"SRB2VERSION
|
||||
// Hey! If you change this, add 1 to the MODVERSION below!
|
||||
// Otherwise we can't force updates!
|
||||
#endif
|
||||
|
||||
#define VERSIONSTRINGW WSTRING (VERSIONSTRING)
|
||||
|
||||
/* A custom URL protocol for server links. */
|
||||
#define SERVER_URL_PROTOCOL "srb2://"
|
||||
|
||||
// Does this version require an added patch file?
|
||||
// Comment or uncomment this as necessary.
|
||||
//#define USE_PATCH_DTA
|
||||
#define USE_PATCH_DTA
|
||||
|
||||
// Use .kart extension addons
|
||||
//#define USE_KART
|
||||
|
@ -201,17 +201,6 @@ extern char logfilename[1024];
|
|||
// Will always resemble the versionstring, 205 = 2.0.5, 210 = 2.1, etc.
|
||||
#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 40
|
||||
|
||||
// To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically.
|
||||
// Increment MINOREXECVERSION whenever a config change is needed that does not correspond
|
||||
// to an increment in MODVERSION. This might never happen in practice.
|
||||
|
@ -236,6 +225,20 @@ extern char logfilename[1024];
|
|||
#define PLAYERSMASK (MAXPLAYERS-1)
|
||||
#define MAXPLAYERNAME 21
|
||||
|
||||
#define COLORRAMPSIZE 16
|
||||
#define MAXCOLORNAME 32
|
||||
#define NUMCOLORFREESLOTS 1024
|
||||
|
||||
typedef struct skincolor_s
|
||||
{
|
||||
char name[MAXCOLORNAME+1]; // Skincolor name
|
||||
UINT8 ramp[COLORRAMPSIZE]; // Colormap ramp
|
||||
UINT16 invcolor; // Signpost color
|
||||
UINT8 invshade; // Signpost color shade
|
||||
UINT16 chatcolor; // Chat color
|
||||
boolean accessible; // Accessible by the color command + setup menu
|
||||
} skincolor_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SKINCOLOR_NONE = 0,
|
||||
|
@ -253,9 +256,11 @@ typedef enum
|
|||
// Desaturated
|
||||
SKINCOLOR_AETHER,
|
||||
SKINCOLOR_SLATE,
|
||||
SKINCOLOR_BLUEBELL,
|
||||
SKINCOLOR_PINK,
|
||||
SKINCOLOR_YOGURT,
|
||||
SKINCOLOR_BROWN,
|
||||
SKINCOLOR_BRONZE,
|
||||
SKINCOLOR_TAN,
|
||||
SKINCOLOR_BEIGE,
|
||||
SKINCOLOR_MOSS,
|
||||
|
@ -268,9 +273,11 @@ typedef enum
|
|||
SKINCOLOR_RED,
|
||||
SKINCOLOR_CRIMSON,
|
||||
SKINCOLOR_FLAME,
|
||||
SKINCOLOR_KETCHUP,
|
||||
SKINCOLOR_PEACHY,
|
||||
SKINCOLOR_QUAIL,
|
||||
SKINCOLOR_SUNSET,
|
||||
SKINCOLOR_COPPER,
|
||||
SKINCOLOR_APRICOT,
|
||||
SKINCOLOR_ORANGE,
|
||||
SKINCOLOR_RUST,
|
||||
|
@ -280,6 +287,7 @@ typedef enum
|
|||
SKINCOLOR_OLIVE,
|
||||
SKINCOLOR_LIME,
|
||||
SKINCOLOR_PERIDOT,
|
||||
SKINCOLOR_APPLE,
|
||||
SKINCOLOR_GREEN,
|
||||
SKINCOLOR_FOREST,
|
||||
SKINCOLOR_EMERALD,
|
||||
|
@ -306,14 +314,13 @@ typedef enum
|
|||
SKINCOLOR_VIOLET,
|
||||
SKINCOLOR_LILAC,
|
||||
SKINCOLOR_PLUM,
|
||||
SKINCOLOR_RASPBERRY,
|
||||
SKINCOLOR_ROSY,
|
||||
|
||||
// SKINCOLOR_? - one left before we bump up against 0x39, which isn't a HARD limit anymore but would be excessive
|
||||
|
||||
MAXSKINCOLORS,
|
||||
FIRSTSUPERCOLOR,
|
||||
|
||||
// Super special awesome Super flashing colors!
|
||||
SKINCOLOR_SUPERSILVER1 = MAXSKINCOLORS,
|
||||
SKINCOLOR_SUPERSILVER1 = FIRSTSUPERCOLOR,
|
||||
SKINCOLOR_SUPERSILVER2,
|
||||
SKINCOLOR_SUPERSILVER3,
|
||||
SKINCOLOR_SUPERSILVER4,
|
||||
|
@ -367,9 +374,17 @@ typedef enum
|
|||
SKINCOLOR_SUPERTAN4,
|
||||
SKINCOLOR_SUPERTAN5,
|
||||
|
||||
MAXTRANSLATIONS,
|
||||
NUMSUPERCOLORS = ((MAXTRANSLATIONS - MAXSKINCOLORS)/5)
|
||||
} skincolors_t;
|
||||
SKINCOLOR_FIRSTFREESLOT,
|
||||
SKINCOLOR_LASTFREESLOT = SKINCOLOR_FIRSTFREESLOT + NUMCOLORFREESLOTS - 1,
|
||||
|
||||
MAXSKINCOLORS,
|
||||
|
||||
NUMSUPERCOLORS = ((SKINCOLOR_FIRSTFREESLOT - FIRSTSUPERCOLOR)/5)
|
||||
} skincolornum_t;
|
||||
|
||||
extern UINT16 numskincolors;
|
||||
|
||||
extern skincolor_t skincolors[MAXSKINCOLORS];
|
||||
|
||||
// State updates, number of tics / second.
|
||||
// NOTE: used to setup the timer rate, see I_StartupTimer().
|
||||
|
@ -449,17 +464,18 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...) FUNCDEBUG;
|
|||
|
||||
// Things that used to be in dstrings.h
|
||||
#define SAVEGAMENAME "srb2sav"
|
||||
char savegamename[256];
|
||||
extern char savegamename[256];
|
||||
extern char liveeventbackup[256];
|
||||
|
||||
// m_misc.h
|
||||
#ifdef GETTEXT
|
||||
#define M_GetText(String) gettext(String)
|
||||
void M_StartupLocale(void);
|
||||
#else
|
||||
// If no translations are to be used, make a stub
|
||||
// M_GetText function that just returns the string.
|
||||
#define M_GetText(x) (x)
|
||||
#endif
|
||||
void M_StartupLocale(void);
|
||||
extern void *(*M_Memcpy)(void* dest, const void* src, size_t n) FUNCNONNULL;
|
||||
char *va(const char *format, ...) FUNCPRINTF;
|
||||
char *M_GetToken(const char *inputString);
|
||||
|
@ -473,6 +489,8 @@ char *sizeu4(size_t num);
|
|||
char *sizeu5(size_t num);
|
||||
|
||||
// d_main.c
|
||||
extern int VERSION;
|
||||
extern int SUBVERSION;
|
||||
extern boolean devparm; // development mode (-debug)
|
||||
// d_netcmd.c
|
||||
extern INT32 cv_debug;
|
||||
|
@ -490,6 +508,7 @@ extern INT32 cv_debug;
|
|||
#define DBG_SETUP 0x0400
|
||||
#define DBG_LUA 0x0800
|
||||
#define DBG_RANDOMIZER 0x1000
|
||||
#define DBG_VIEWMORPH 0x2000
|
||||
|
||||
// =======================
|
||||
// Misc stuff for later...
|
||||
|
@ -546,6 +565,8 @@ INT32 I_GetKey(void);
|
|||
#define PATHSEP "/"
|
||||
#endif
|
||||
|
||||
#define PUNCTUATION "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
||||
|
||||
// Compile date and time and revision.
|
||||
extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
|
||||
|
@ -553,15 +574,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
// None of these that are disabled in the normal build are guaranteed to work perfectly
|
||||
// Compile them at your own risk!
|
||||
|
||||
/// Kalaron/Eternity Engine slope code (SRB2CB ported)
|
||||
#define ESLOPE
|
||||
|
||||
#ifdef ESLOPE
|
||||
/// Backwards compatibility with SRB2CB's slope linedef types.
|
||||
/// \note A simple shim that prints a warning.
|
||||
#define ESLOPE_TYPESHIM
|
||||
#endif
|
||||
|
||||
/// Allows the use of devmode in multiplayer. AKA "fishcake"
|
||||
//#define NETGAME_DEVMODE
|
||||
|
||||
|
@ -571,9 +583,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// Dumps the contents of a network save game upon consistency failure for debugging.
|
||||
//#define DUMPCONSISTENCY
|
||||
|
||||
/// Polyobject fake flat code
|
||||
#define POLYOBJECTS_PLANES
|
||||
|
||||
/// See name of player in your crosshair
|
||||
#define SEENAMES
|
||||
|
||||
|
@ -596,11 +605,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// memory that never gets touched.
|
||||
#define ALLOW_RESETDATA
|
||||
|
||||
#ifndef NONET
|
||||
/// Display a connection screen on join attempts.
|
||||
#define CLIENT_LOADINGSCREEN
|
||||
#endif
|
||||
|
||||
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
|
||||
//#define REDSANALOG
|
||||
|
||||
|
@ -618,17 +622,13 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// SRB2CB itself ported this from PrBoom+
|
||||
#define NEWCLIP
|
||||
|
||||
/// OpenGL shaders
|
||||
#define GL_SHADERS
|
||||
|
||||
/// Handle touching sector specials in P_PlayerAfterThink instead of P_PlayerThink.
|
||||
/// \note Required for proper collision with moving sloped surfaces that have sector specials on them.
|
||||
#define SECTORSPECIALSAFTERTHINK
|
||||
|
||||
/// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up
|
||||
/// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down)
|
||||
/// on the bright side it fixes some weird issues with translucent walls
|
||||
/// \note SRB2CB port.
|
||||
/// SRB2CB itself ported this from PrBoom+
|
||||
#define NEWCLIP
|
||||
|
||||
/// Cache patches in Lua in a way that renderer switching will work flawlessly.
|
||||
//#define LUA_PATCH_SAFETY
|
||||
|
||||
|
@ -645,4 +645,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// Render flats on walls
|
||||
#define WALLFLATS
|
||||
|
||||
/// Maintain compatibility with older 2.2 demos
|
||||
#define OLD22DEMOCOMPAT
|
||||
|
||||
#endif // __DOOMDEF__
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -45,7 +45,19 @@ extern INT32 curWeather;
|
|||
extern INT32 cursaveslot;
|
||||
//extern INT16 lastmapsaved;
|
||||
extern INT16 lastmaploaded;
|
||||
extern boolean gamecomplete;
|
||||
extern UINT8 gamecomplete;
|
||||
|
||||
// Extra abilities/settings for skins (combinable stuff)
|
||||
typedef enum
|
||||
{
|
||||
MA_RUNNING = 1, // In action
|
||||
MA_INIT = 1<<1, // Initialisation
|
||||
MA_NOCUTSCENES = 1<<2, // No cutscenes
|
||||
MA_INGAME = 1<<3 // Timer ignores loads
|
||||
} marathonmode_t;
|
||||
|
||||
extern marathonmode_t marathonmode;
|
||||
extern tic_t marathontime;
|
||||
|
||||
#define maxgameovers 13
|
||||
extern UINT8 numgameovers;
|
||||
|
@ -127,7 +139,7 @@ extern INT32 displayplayer;
|
|||
extern INT32 secondarydisplayplayer; // for splitscreen
|
||||
|
||||
// Maps of special importance
|
||||
extern INT16 spstage_start;
|
||||
extern INT16 spstage_start, spmarathon_start;
|
||||
extern INT16 sstage_start, sstage_end, smpstage_start, smpstage_end;
|
||||
|
||||
extern INT16 titlemap;
|
||||
|
@ -145,7 +157,7 @@ extern INT32 tutorialanalog; // store cv_analog[0] user value
|
|||
extern boolean looptitle;
|
||||
|
||||
// CTF colors.
|
||||
extern UINT8 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor_bluering;
|
||||
extern UINT16 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor_bluering;
|
||||
|
||||
extern tic_t countdowntimer;
|
||||
extern boolean countdowntimeup;
|
||||
|
@ -289,6 +301,8 @@ typedef struct
|
|||
UINT8 actnum; ///< Act number or 0 for none.
|
||||
UINT32 typeoflevel; ///< Combination of typeoflevel flags.
|
||||
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
|
||||
INT16 marathonnext; ///< See nextlevel, but for Marathon mode. Necessary to support hub worlds ala SUGOI.
|
||||
char keywords[33]; ///< Keywords separated by space to search for. 32 characters.
|
||||
char musname[7]; ///< Music track to play. "" for no music.
|
||||
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
||||
UINT32 muspos; ///< Music position to jump to.
|
||||
|
@ -318,6 +332,9 @@ typedef struct
|
|||
|
||||
char selectheading[22]; ///< Level select heading. Allows for controllable grouping.
|
||||
UINT16 startrings; ///< Number of rings players start with.
|
||||
INT32 sstimer; ///< Timer for special stages.
|
||||
UINT32 ssspheres; ///< Sphere requirement in special stages.
|
||||
fixed_t gravity; ///< Map-wide gravity.
|
||||
|
||||
// Title card.
|
||||
char ltzzpatch[8]; ///< Zig zag patch.
|
||||
|
@ -350,15 +367,19 @@ typedef struct
|
|||
} mapheader_t;
|
||||
|
||||
// level flags
|
||||
#define LF_SCRIPTISFILE 1 ///< True if the script is a file, not a lump.
|
||||
#define LF_SPEEDMUSIC 2 ///< Speed up act music for super sneakers
|
||||
#define LF_NOSSMUSIC 4 ///< Disable Super Sonic music
|
||||
#define LF_NORELOAD 8 ///< Don't reload level on death
|
||||
#define LF_NOZONE 16 ///< Don't include "ZONE" on level title
|
||||
#define LF_SAVEGAME 32 ///< Save the game upon loading this level
|
||||
#define LF_MIXNIGHTSCOUNTDOWN 64 ///< Play sfx_timeup instead of music change for NiGHTS countdown
|
||||
#define LF_WARNINGTITLE 128 ///< WARNING! WARNING! WARNING! WARNING!
|
||||
#define LF_NOTITLECARD 256 ///< Don't start the title card
|
||||
#define LF_SCRIPTISFILE (1<<0) ///< True if the script is a file, not a lump.
|
||||
#define LF_SPEEDMUSIC (1<<1) ///< Speed up act music for super sneakers
|
||||
#define LF_NOSSMUSIC (1<<2) ///< Disable Super Sonic music
|
||||
#define LF_NORELOAD (1<<3) ///< Don't reload level on death
|
||||
#define LF_NOZONE (1<<4) ///< Don't include "ZONE" on level title
|
||||
#define LF_SAVEGAME (1<<5) ///< Save the game upon loading this level
|
||||
#define LF_MIXNIGHTSCOUNTDOWN (1<<6) ///< Play sfx_timeup instead of music change for NiGHTS countdown
|
||||
#define LF_WARNINGTITLE (1<<7) ///< WARNING! WARNING! WARNING! WARNING!
|
||||
|
||||
#define LF_NOTITLECARDFIRST (1<<8)
|
||||
#define LF_NOTITLECARDRESPAWN (1<<9)
|
||||
#define LF_NOTITLECARDRECORDATTACK (1<<10)
|
||||
#define LF_NOTITLECARD (LF_NOTITLECARDFIRST|LF_NOTITLECARDRESPAWN|LF_NOTITLECARDRECORDATTACK) ///< Don't start the title card at all
|
||||
|
||||
#define LF2_HIDEINMENU 1 ///< Hide in the multiplayer menu
|
||||
#define LF2_HIDEINSTATS 2 ///< Hide in the statistics screen
|
||||
|
@ -436,6 +457,7 @@ extern const char *Gametype_ConstantNames[NUMGAMETYPES];
|
|||
extern INT32 pointlimits[NUMGAMETYPES];
|
||||
extern INT32 timelimits[NUMGAMETYPES];
|
||||
|
||||
// TypeOfLevel things
|
||||
enum TypeOfLevel
|
||||
{
|
||||
TOL_SP = 0x01, ///< Single Player
|
||||
|
@ -460,16 +482,16 @@ enum TypeOfLevel
|
|||
TOL_XMAS = 0x1000, ///< Christmas NiGHTS
|
||||
};
|
||||
|
||||
#define NUMBASETOL 18
|
||||
#define NUMMAXTOL (18 + NUMGAMETYPEFREESLOTS)
|
||||
#define MAXTOL (1<<31)
|
||||
#define NUMBASETOLNAMES (19)
|
||||
#define NUMTOLNAMES (NUMBASETOLNAMES + NUMGAMETYPEFREESLOTS)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
UINT32 flag;
|
||||
} tolinfo_t;
|
||||
extern tolinfo_t TYPEOFLEVEL[NUMMAXTOL];
|
||||
extern INT32 numtolinfo;
|
||||
extern tolinfo_t TYPEOFLEVEL[NUMTOLNAMES];
|
||||
extern UINT32 lastcustomtol;
|
||||
|
||||
extern tic_t totalplaytime;
|
||||
|
@ -487,7 +509,6 @@ extern UINT16 emeralds;
|
|||
#define EMERALD7 64
|
||||
#define ALL7EMERALDS(v) ((v & (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7)) == (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7))
|
||||
|
||||
// yes, even in non HAVE_BLUA
|
||||
#define NUM_LUABANKS 16 // please only make this number go up between versions, never down. you'll break saves otherwise. also, must fit in UINT8
|
||||
extern INT32 luabanks[NUM_LUABANKS];
|
||||
|
||||
|
@ -537,7 +558,7 @@ extern recorddata_t *mainrecords[NUMMAPS];
|
|||
extern UINT8 mapvisited[NUMMAPS];
|
||||
|
||||
// Temporary holding place for nights data for the current map
|
||||
nightsdata_t ntemprecords;
|
||||
extern nightsdata_t ntemprecords;
|
||||
|
||||
extern UINT32 token; ///< Number of tokens collected in a level
|
||||
extern UINT32 tokenlist; ///< List of tokens collected
|
||||
|
@ -567,9 +588,12 @@ extern UINT16 nightslinktics;
|
|||
|
||||
extern UINT8 introtoplay;
|
||||
extern UINT8 creditscutscene;
|
||||
extern UINT8 useBlackRock;
|
||||
|
||||
extern UINT8 use1upSound;
|
||||
extern UINT8 maxXtraLife; // Max extra lives from rings
|
||||
extern UINT8 useContinues;
|
||||
#define continuesInSession (!multiplayer && (ultimatemode || (useContinues && !marathonmode) || (!modeattacking && !(cursaveslot > 0))))
|
||||
|
||||
extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations
|
||||
|
||||
|
@ -610,6 +634,19 @@ extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative
|
|||
extern mapthing_t *bluectfstarts[MAXPLAYERS]; // CTF
|
||||
extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
|
||||
|
||||
#define WAYPOINTSEQUENCESIZE 256
|
||||
#define NUMWAYPOINTSEQUENCES 256
|
||||
extern mobj_t *waypoints[NUMWAYPOINTSEQUENCES][WAYPOINTSEQUENCESIZE];
|
||||
extern UINT16 numwaypoints[NUMWAYPOINTSEQUENCES];
|
||||
|
||||
void P_AddWaypoint(UINT8 sequence, UINT8 id, mobj_t *waypoint);
|
||||
mobj_t *P_GetFirstWaypoint(UINT8 sequence);
|
||||
mobj_t *P_GetLastWaypoint(UINT8 sequence);
|
||||
mobj_t *P_GetPreviousWaypoint(mobj_t *current, boolean wrap);
|
||||
mobj_t *P_GetNextWaypoint(mobj_t *current, boolean wrap);
|
||||
mobj_t *P_GetClosestWaypoint(UINT8 sequence, mobj_t *mo);
|
||||
boolean P_IsDegeneratedWaypointSequence(UINT8 sequence);
|
||||
|
||||
// =====================================
|
||||
// Internal parameters, used for engine.
|
||||
// =====================================
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -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)
|
||||
#endif
|
||||
|
||||
/* preprocessor dumb and needs second macro to expand input */
|
||||
#define WSTRING2(s) L ## s
|
||||
#define WSTRING(s) WSTRING2 (s)
|
||||
|
||||
#endif //__DOOMTYPE__
|
||||
|
|
|
@ -16,6 +16,11 @@ tic_t I_GetTime(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int I_GetTimeMicros(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void I_Sleep(void){}
|
||||
|
||||
void I_GetEvent(void){}
|
||||
|
|
|
@ -11,10 +11,10 @@ boolean allow_fullscreen = false;
|
|||
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
void I_StartupGraphics(void){}
|
||||
void I_StartupHardwareGraphics(void){}
|
||||
|
||||
void I_ShutdownGraphics(void){}
|
||||
|
||||
void VID_StartupOpenGL(void){}
|
||||
|
||||
void I_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
(void)palette;
|
||||
|
@ -40,10 +40,8 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
void VID_CheckRenderer(void) {}
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender) {}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2014-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 2014-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -39,9 +39,7 @@
|
|||
#include "fastcmp.h"
|
||||
#include "console.h"
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_hud.h"
|
||||
#endif
|
||||
|
||||
// Stage of animation:
|
||||
// 0 = text, 1 = art screen
|
||||
|
@ -1150,11 +1148,13 @@ static const char *credits[] = {
|
|||
"",
|
||||
"\1Programming",
|
||||
"\1Assistance",
|
||||
"Colette \"fickleheart\" Bordelon",
|
||||
"\"chi.miru\"", // helped port slope drawing code from ZDoom
|
||||
"Andrew \"orospakr\" Clunis",
|
||||
"Sally \"TehRealSalt\" Cochenour",
|
||||
"Gregor \"Oogaland\" Dick",
|
||||
"Julio \"Chaos Zero 64\" Guir",
|
||||
"\"Hannu_Hanhi\"", // For many OpenGL performance improvements!
|
||||
"\"Kalaron\"", // Coded some of Sryder13's collection of OpenGL fixes, especially fog
|
||||
"\"Lat'\"", // SRB2-CHAT, the chat window from Kart
|
||||
"Matthew \"Shuffle\" Marsalko",
|
||||
|
@ -1165,6 +1165,8 @@ static const char *credits[] = {
|
|||
"Tasos \"tatokis\" Sahanidis", // Corrected C FixedMul, making 64-bit builds netplay compatible
|
||||
"Wessel \"sphere\" Smit",
|
||||
"Ben \"Cue\" Woodford",
|
||||
"\"VelocitOni\"", // Wrote the original dashmode script
|
||||
"Ikaro \"Tatsuru\" Vinhas",
|
||||
// Git contributors with 5+ approved merges of substantive quality,
|
||||
// or contributors with at least one groundbreaking merge, may be named.
|
||||
// Everyone else is acknowledged under "Special Thanks > SRB2 Community Contributors".
|
||||
|
@ -1172,6 +1174,7 @@ static const char *credits[] = {
|
|||
"\1Art",
|
||||
"Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D:
|
||||
"Ryan \"Blaze Hedgehog\" Bloom",
|
||||
"\"ChrispyPixels\"",
|
||||
"Paul \"Boinciel\" Clempson",
|
||||
"Sally \"TehRealSalt\" Cochenour",
|
||||
"\"Dave Lite\"",
|
||||
|
@ -1218,6 +1221,7 @@ static const char *credits[] = {
|
|||
"\"SSNTails\"",
|
||||
"",
|
||||
"\1Level Design",
|
||||
"Colette \"fickleheart\" Bordelon",
|
||||
"Hank \"FuriousFox\" Brannock",
|
||||
"Matthew \"Fawfulfan\" Chapman",
|
||||
"Paul \"Boinciel\" Clempson",
|
||||
|
@ -1233,6 +1237,7 @@ static const char *credits[] = {
|
|||
"Thomas \"Shadow Hog\" Igoe",
|
||||
"Alexander \"DrTapeworm\" Moench-Ford",
|
||||
"\"Kaito Sinclaire\"",
|
||||
"Anna \"QueenDelta\" Sandlin",
|
||||
"Wessel \"sphere\" Smit",
|
||||
"\"Spazzo\"",
|
||||
"\"SSNTails\"",
|
||||
|
@ -1252,11 +1257,12 @@ static const char *credits[] = {
|
|||
"Johnny \"Sonikku\" Wallbank",
|
||||
"",
|
||||
"\1Testing",
|
||||
"Discord Community Testers",
|
||||
"Hank \"FuriousFox\" Brannock",
|
||||
"Cody \"SRB2 Playah\" Koester",
|
||||
"Skye \"OmegaVelocity\" Meredith",
|
||||
"Stephen \"HEDGESMFG\" Moellering",
|
||||
"Nick \"ST218\" Molina",
|
||||
"Rosalie \"ST218\" Molina",
|
||||
"Samuel \"Prime 2.0\" Peters",
|
||||
"Colin \"Sonict\" Pfaff",
|
||||
"Bill \"Tets\" Reed",
|
||||
|
@ -1327,10 +1333,6 @@ void F_StartCredits(void)
|
|||
// Just in case they're open ... somehow
|
||||
M_ClearMenus(true);
|
||||
|
||||
// Save the second we enter the credits
|
||||
if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0)
|
||||
G_SaveGame((UINT32)cursaveslot);
|
||||
|
||||
if (creditscutscene)
|
||||
{
|
||||
F_StartCustomCutscene(creditscutscene - 1, false, false);
|
||||
|
@ -1526,12 +1528,6 @@ void F_StartGameEvaluation(void)
|
|||
// Just in case they're open ... somehow
|
||||
M_ClearMenus(true);
|
||||
|
||||
// Save the second we enter the evaluation
|
||||
// We need to do this again! Remember, it's possible a mod designed skipped
|
||||
// the credits sequence!
|
||||
if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0)
|
||||
G_SaveGame((UINT32)cursaveslot);
|
||||
|
||||
goodending = (ALL7EMERALDS(emeralds));
|
||||
|
||||
gameaction = ga_nothing;
|
||||
|
@ -1548,13 +1544,20 @@ void F_GameEvaluationDrawer(void)
|
|||
angle_t fa;
|
||||
INT32 eemeralds_cur;
|
||||
char patchname[7] = "CEMGx0";
|
||||
const char* endingtext = (goodending ? "CONGRATULATIONS!" : "TRY AGAIN...");
|
||||
const char* endingtext;
|
||||
|
||||
if (marathonmode)
|
||||
endingtext = "THANKS FOR THE RUN!";
|
||||
else if (goodending)
|
||||
endingtext = "CONGRATULATIONS!";
|
||||
else
|
||||
endingtext = "TRY AGAIN...";
|
||||
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
// Draw all the good crap here.
|
||||
|
||||
if (finalecount > 0)
|
||||
if (finalecount > 0 && useBlackRock)
|
||||
{
|
||||
INT32 scale = FRACUNIT;
|
||||
patch_t *rockpat;
|
||||
|
@ -1671,6 +1674,18 @@ void F_GameEvaluationDrawer(void)
|
|||
V_DrawString(8, 96, V_YELLOWMAP, "Modified games\ncan't unlock\nextras!");
|
||||
}
|
||||
#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)
|
||||
|
@ -1681,7 +1696,9 @@ void F_GameEvaluationTicker(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!goodending)
|
||||
if (!useBlackRock)
|
||||
;
|
||||
else if (!goodending)
|
||||
{
|
||||
if (sparklloop)
|
||||
sparklloop--;
|
||||
|
@ -1838,10 +1855,6 @@ void F_StartEnding(void)
|
|||
// Just in case they're open ... somehow
|
||||
M_ClearMenus(true);
|
||||
|
||||
// Save before the credits sequence.
|
||||
if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0)
|
||||
G_SaveGame((UINT32)cursaveslot);
|
||||
|
||||
gameaction = ga_nothing;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
|
@ -2182,7 +2195,7 @@ void F_EndingDrawer(void)
|
|||
for (i = 0; i < 7; ++i)
|
||||
{
|
||||
UINT8* colormap;
|
||||
skincolors_t col = SKINCOLOR_GREEN;
|
||||
skincolornum_t col = SKINCOLOR_GREEN;
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
|
@ -2693,8 +2706,18 @@ static void F_FigureActiveTtScale(void)
|
|||
SINT8 newttscale = max(1, min(6, vid.dupx));
|
||||
SINT8 oldttscale = activettscale;
|
||||
|
||||
if (needpatchrecache)
|
||||
ttloaded[0] = ttloaded[1] = ttloaded[2] = ttloaded[3] = ttloaded[4] = ttloaded[5] = 0;
|
||||
else
|
||||
{
|
||||
if (newttscale == testttscale)
|
||||
return;
|
||||
|
||||
// We have a new ttscale, so load gfx
|
||||
if(oldttscale > 0)
|
||||
F_UnloadAlacroixGraphics(oldttscale);
|
||||
}
|
||||
|
||||
testttscale = newttscale;
|
||||
|
||||
// If ttscale is unavailable: look for lower scales, then higher scales.
|
||||
|
@ -2712,10 +2735,6 @@ static void F_FigureActiveTtScale(void)
|
|||
|
||||
activettscale = (newttscale >= 1 && newttscale <= 6) ? newttscale : 0;
|
||||
|
||||
// We have a new ttscale, so load gfx
|
||||
if(oldttscale > 0)
|
||||
F_UnloadAlacroixGraphics(oldttscale);
|
||||
|
||||
if(activettscale > 0)
|
||||
F_LoadAlacroixGraphics(activettscale);
|
||||
}
|
||||
|
@ -2751,17 +2770,7 @@ void F_TitleScreenDrawer(void)
|
|||
// rei|miru: use title pics?
|
||||
hidepics = curhidepics;
|
||||
if (hidepics)
|
||||
#ifdef HAVE_BLUA
|
||||
goto luahook;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (needpatchrecache && (curttmode == TTMODE_ALACROIX))
|
||||
{
|
||||
ttloaded[0] = ttloaded[1] = ttloaded[2] = ttloaded[3] = ttloaded[4] = ttloaded[5] = 0;
|
||||
F_LoadAlacroixGraphics(activettscale);
|
||||
}
|
||||
|
||||
switch(curttmode)
|
||||
{
|
||||
|
@ -3483,10 +3492,8 @@ void F_TitleScreenDrawer(void)
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
luahook:
|
||||
LUAh_TitleHUD();
|
||||
#endif
|
||||
}
|
||||
|
||||
// separate animation timer for backgrounds, since we also count
|
||||
|
@ -3621,14 +3628,13 @@ void F_StartContinue(void)
|
|||
{
|
||||
I_Assert(!netgame && !multiplayer);
|
||||
|
||||
if (players[consoleplayer].continues <= 0)
|
||||
if (continuesInSession && players[consoleplayer].continues <= 0)
|
||||
{
|
||||
Command_ExitGame_f();
|
||||
return;
|
||||
}
|
||||
|
||||
wipestyleflags = WSF_FADEOUT;
|
||||
F_TryColormapFade(31);
|
||||
G_SetGamestate(GS_CONTINUING);
|
||||
gameaction = ga_nothing;
|
||||
|
||||
|
@ -3729,7 +3735,9 @@ void F_ContinueDrawer(void)
|
|||
}
|
||||
|
||||
// Draw the continue markers! Show continues.
|
||||
if (ncontinues > 10)
|
||||
if (!continuesInSession)
|
||||
;
|
||||
else if (ncontinues > 10)
|
||||
{
|
||||
if (!(continuetime & 1) || continuetime > 17)
|
||||
V_DrawContinueIcon(x, 68, 0, players[consoleplayer].skin, players[consoleplayer].skincolor);
|
||||
|
@ -3961,6 +3969,7 @@ static void F_AdvanceToNextScene(void)
|
|||
animtimer = pictime = cutscenes[cutnum]->scene[scenenum].picduration[picnum];
|
||||
}
|
||||
|
||||
// See also G_AfterIntermission, the only other place which handles intra-map/ending transitions
|
||||
void F_EndCutScene(void)
|
||||
{
|
||||
cutsceneover = true; // do this first, just in case G_EndGame or something wants to turn it back false later
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -162,7 +162,9 @@ extern wipestyleflags_t wipestyleflags;
|
|||
// Even my function names are borderline
|
||||
boolean F_ShouldColormapFade(void);
|
||||
boolean F_TryColormapFade(UINT8 wipecolor);
|
||||
#ifndef NOWIPE
|
||||
void F_DecideWipeStyle(void);
|
||||
#endif
|
||||
|
||||
#define FADECOLORMAPDIV 8
|
||||
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
|
||||
|
|
16
src/f_wipe.c
16
src/f_wipe.c
|
@ -3,7 +3,7 @@
|
|||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -16,6 +16,7 @@
|
|||
#include "i_video.h"
|
||||
#include "v_video.h"
|
||||
|
||||
#include "r_state.h" // fadecolormap
|
||||
#include "r_draw.h" // transtable
|
||||
#include "p_pspr.h" // tr_transxxx
|
||||
#include "p_local.h"
|
||||
|
@ -32,9 +33,7 @@
|
|||
|
||||
#include "doomstat.h"
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_hud.h" // level title
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
|
@ -192,8 +191,7 @@ void F_WipeStageTitle(void)
|
|||
// draw level title
|
||||
if ((WipeStageTitle && st_overlay)
|
||||
&& (wipestyle == WIPESTYLE_COLORMAP)
|
||||
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
||||
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
|
||||
&& G_IsTitleCardAvailable())
|
||||
{
|
||||
ST_runTitleCard();
|
||||
ST_drawWipeTitleCard();
|
||||
|
@ -466,6 +464,7 @@ void F_WipeEndScreen(void)
|
|||
*/
|
||||
boolean F_ShouldColormapFade(void)
|
||||
{
|
||||
#ifndef NOWIPE
|
||||
if ((wipestyleflags & (WSF_FADEIN|WSF_FADEOUT)) // only if one of those wipestyleflags are actually set
|
||||
&& !(wipestyleflags & WSF_CROSSFADE)) // and if not crossfading
|
||||
{
|
||||
|
@ -481,11 +480,13 @@ boolean F_ShouldColormapFade(void)
|
|||
// Menus
|
||||
|| gamestate == GS_TIMEATTACK);
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Decides what wipe style to use.
|
||||
*/
|
||||
#ifndef NOWIPE
|
||||
void F_DecideWipeStyle(void)
|
||||
{
|
||||
// Set default wipe style
|
||||
|
@ -495,6 +496,7 @@ void F_DecideWipeStyle(void)
|
|||
if (F_ShouldColormapFade())
|
||||
wipestyle = WIPESTYLE_COLORMAP;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Attempt to run a colormap fade,
|
||||
provided all the conditionals were properly met.
|
||||
|
@ -503,6 +505,7 @@ void F_DecideWipeStyle(void)
|
|||
*/
|
||||
boolean F_TryColormapFade(UINT8 wipecolor)
|
||||
{
|
||||
#ifndef NOWIPE
|
||||
if (F_ShouldColormapFade())
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
|
@ -512,6 +515,7 @@ boolean F_TryColormapFade(UINT8 wipecolor)
|
|||
return true;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
F_WipeColorFill(wipecolor);
|
||||
return false;
|
||||
|
@ -610,6 +614,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
|||
tic_t F_GetWipeLength(UINT8 wipetype)
|
||||
{
|
||||
#ifdef NOWIPE
|
||||
(void)wipetype;
|
||||
return 0;
|
||||
#else
|
||||
static char lumpname[10] = "FADEmmss";
|
||||
|
@ -636,6 +641,7 @@ tic_t F_GetWipeLength(UINT8 wipetype)
|
|||
boolean F_WipeExists(UINT8 wipetype)
|
||||
{
|
||||
#ifdef NOWIPE
|
||||
(void)wipetype;
|
||||
return false;
|
||||
#else
|
||||
static char lumpname[10] = "FADEmm00";
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef enum
|
|||
#endif
|
||||
EXT_PK3,
|
||||
EXT_SOC,
|
||||
EXT_LUA, // allowed even if not HAVE_BLUA so that we can yell on load attempt
|
||||
EXT_LUA,
|
||||
NUM_EXT,
|
||||
NUM_EXT_TABLE = NUM_EXT-EXT_START,
|
||||
EXT_LOADED = 0x80
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,86 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file g_demo.h
|
||||
/// \brief Demo recording and playback
|
||||
|
||||
#ifndef __G_DEMO__
|
||||
#define __G_DEMO__
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_event.h"
|
||||
|
||||
// ======================================
|
||||
// DEMO playback/recording related stuff.
|
||||
// ======================================
|
||||
|
||||
// demoplaying back and demo recording
|
||||
extern boolean demoplayback, titledemo, demorecording, timingdemo;
|
||||
extern tic_t demostarttime;
|
||||
|
||||
// Quit after playing a demo from cmdline.
|
||||
extern boolean singledemo;
|
||||
extern boolean demo_start;
|
||||
extern boolean demosynced;
|
||||
|
||||
extern mobj_t *metalplayback;
|
||||
|
||||
// Only called by startup code.
|
||||
void G_RecordDemo(const char *name);
|
||||
void G_RecordMetal(void);
|
||||
void G_BeginRecording(void);
|
||||
void G_BeginMetal(void);
|
||||
|
||||
// Only called by shutdown code.
|
||||
void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings);
|
||||
UINT8 G_CmpDemoTime(char *oldname, char *newname);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GHC_NORMAL = 0,
|
||||
GHC_SUPER,
|
||||
GHC_FIREFLOWER,
|
||||
GHC_INVINCIBLE,
|
||||
GHC_NIGHTSSKIN, // not actually a colour
|
||||
GHC_RETURNSKIN // ditto
|
||||
} ghostcolor_t;
|
||||
|
||||
// Record/playback tics
|
||||
void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
|
||||
void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
|
||||
void G_GhostAddThok(void);
|
||||
void G_GhostAddSpin(void);
|
||||
void G_GhostAddRev(void);
|
||||
void G_GhostAddColor(ghostcolor_t color);
|
||||
void G_GhostAddFlip(void);
|
||||
void G_GhostAddScale(fixed_t scale);
|
||||
void G_GhostAddHit(mobj_t *victim);
|
||||
void G_WriteGhostTic(mobj_t *ghost);
|
||||
void G_ConsGhostTic(void);
|
||||
void G_GhostTicker(void);
|
||||
void G_ReadMetalTic(mobj_t *metal);
|
||||
void G_WriteMetalTic(mobj_t *metal);
|
||||
void G_SaveMetal(UINT8 **buffer);
|
||||
void G_LoadMetal(UINT8 **buffer);
|
||||
|
||||
void G_DeferedPlayDemo(const char *demo);
|
||||
void G_DoPlayDemo(char *defdemoname);
|
||||
void G_TimeDemo(const char *name);
|
||||
void G_AddGhost(char *defdemoname);
|
||||
void G_FreeGhosts(void);
|
||||
void G_DoPlayMetal(void);
|
||||
void G_DoneLevelLoad(void);
|
||||
void G_StopMetalDemo(void);
|
||||
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(boolean kill);
|
||||
void G_StopDemo(void);
|
||||
boolean G_CheckDemoStatus(void);
|
||||
|
||||
#endif // __G_DEMO__
|
3041
src/g_game.c
3041
src/g_game.c
File diff suppressed because it is too large
Load Diff
77
src/g_game.h
77
src/g_game.h
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -17,6 +17,7 @@
|
|||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_event.h"
|
||||
#include "g_demo.h"
|
||||
|
||||
extern char gamedatafilename[64];
|
||||
extern char timeattackfolder[64];
|
||||
|
@ -31,21 +32,6 @@ extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
|
|||
extern player_t players[MAXPLAYERS];
|
||||
extern boolean playeringame[MAXPLAYERS];
|
||||
|
||||
// ======================================
|
||||
// DEMO playback/recording related stuff.
|
||||
// ======================================
|
||||
|
||||
// demoplaying back and demo recording
|
||||
extern boolean demoplayback, titledemo, demorecording, timingdemo;
|
||||
extern tic_t demostarttime;
|
||||
|
||||
// Quit after playing a demo from cmdline.
|
||||
extern boolean singledemo;
|
||||
extern boolean demo_start;
|
||||
extern boolean demosynced;
|
||||
|
||||
extern mobj_t *metalplayback;
|
||||
|
||||
// gametic at level start
|
||||
extern tic_t levelstarttic;
|
||||
|
||||
|
@ -107,6 +93,7 @@ typedef enum
|
|||
// build an internal map name MAPxx from map number
|
||||
const char *G_BuildMapName(INT32 map);
|
||||
|
||||
extern INT16 ticcmd_oldangleturn[2];
|
||||
extern boolean ticcmd_centerviewdown[2]; // For simple controls, lock the camera behind the player
|
||||
extern mobj_t *ticcmd_ztargetfocus[2]; // Locking onto an object?
|
||||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer);
|
||||
|
@ -161,7 +148,9 @@ INT32 G_FindMapByNameOrCode(const char *query, char **foundmapnamep);
|
|||
mapthing_t *G_FindCTFStart(INT32 playernum);
|
||||
mapthing_t *G_FindMatchStart(INT32 playernum);
|
||||
mapthing_t *G_FindCoopStart(INT32 playernum);
|
||||
void G_SpawnPlayer(INT32 playernum, boolean starpost);
|
||||
mapthing_t *G_FindMapStart(INT32 playernum);
|
||||
void G_MovePlayerToSpawnOrStarpost(INT32 playernum);
|
||||
void G_SpawnPlayer(INT32 playernum);
|
||||
|
||||
// Can be called by the startup code or M_Responder.
|
||||
// A normal game starts at map 1, but a warp test can start elsewhere
|
||||
|
@ -171,65 +160,16 @@ void G_DoLoadLevel(boolean resetplayer);
|
|||
void G_StartTitleCard(void);
|
||||
void G_PreLevelTitleCard(void);
|
||||
boolean G_IsTitleCardAvailable(void);
|
||||
void G_DeferedPlayDemo(const char *demo);
|
||||
|
||||
// Can be called by the startup code or M_Responder, calls P_SetupLevel.
|
||||
void G_LoadGame(UINT32 slot, INT16 mapoverride);
|
||||
|
||||
void G_SaveGameData(void);
|
||||
|
||||
void G_SaveGame(UINT32 slot);
|
||||
void G_SaveGame(UINT32 slot, INT16 mapnum);
|
||||
|
||||
void G_SaveGameOver(UINT32 slot, boolean modifylives);
|
||||
|
||||
// Only called by startup code.
|
||||
void G_RecordDemo(const char *name);
|
||||
void G_RecordMetal(void);
|
||||
void G_BeginRecording(void);
|
||||
void G_BeginMetal(void);
|
||||
|
||||
// Only called by shutdown code.
|
||||
void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings);
|
||||
UINT8 G_CmpDemoTime(char *oldname, char *newname);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GHC_NORMAL = 0,
|
||||
GHC_SUPER,
|
||||
GHC_FIREFLOWER,
|
||||
GHC_INVINCIBLE,
|
||||
GHC_NIGHTSSKIN, // not actually a colour
|
||||
GHC_RETURNSKIN // ditto
|
||||
} ghostcolor_t;
|
||||
|
||||
// Record/playback tics
|
||||
void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
|
||||
void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
|
||||
void G_GhostAddThok(void);
|
||||
void G_GhostAddSpin(void);
|
||||
void G_GhostAddRev(void);
|
||||
void G_GhostAddColor(ghostcolor_t color);
|
||||
void G_GhostAddFlip(void);
|
||||
void G_GhostAddScale(fixed_t scale);
|
||||
void G_GhostAddHit(mobj_t *victim);
|
||||
void G_WriteGhostTic(mobj_t *ghost);
|
||||
void G_ConsGhostTic(void);
|
||||
void G_GhostTicker(void);
|
||||
void G_ReadMetalTic(mobj_t *metal);
|
||||
void G_WriteMetalTic(mobj_t *metal);
|
||||
void G_SaveMetal(UINT8 **buffer);
|
||||
void G_LoadMetal(UINT8 **buffer);
|
||||
|
||||
void G_DoPlayDemo(char *defdemoname);
|
||||
void G_TimeDemo(const char *name);
|
||||
void G_AddGhost(char *defdemoname);
|
||||
void G_DoPlayMetal(void);
|
||||
void G_DoneLevelLoad(void);
|
||||
void G_StopMetalDemo(void);
|
||||
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(boolean kill);
|
||||
void G_StopDemo(void);
|
||||
boolean G_CheckDemoStatus(void);
|
||||
|
||||
extern UINT32 gametypedefaultrules[NUMGAMETYPES];
|
||||
extern UINT32 gametypetol[NUMGAMETYPES];
|
||||
extern INT16 gametyperankings[NUMGAMETYPES];
|
||||
|
@ -251,6 +191,7 @@ boolean G_GametypeHasTeams(void);
|
|||
boolean G_GametypeHasSpectators(void);
|
||||
boolean G_RingSlingerGametype(void);
|
||||
boolean G_PlatformGametype(void);
|
||||
boolean G_CoopGametype(void);
|
||||
boolean G_TagGametype(void);
|
||||
boolean G_CompetitionGametype(void);
|
||||
boolean G_EnoughPlayersFinished(void);
|
||||
|
@ -307,6 +248,6 @@ FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics);
|
|||
FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
|
||||
|
||||
// Don't split up TOL handling
|
||||
INT16 G_TOLFlag(INT32 pgametype);
|
||||
UINT32 G_TOLFlag(INT32 pgametype);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -662,7 +662,13 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
|||
return keystr[0];
|
||||
|
||||
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
|
||||
return atoi(&keystr[3]);
|
||||
{
|
||||
/* what if we out of range bruh? */
|
||||
j = atoi(&keystr[3]);
|
||||
if (j < NUMINPUTS)
|
||||
return j;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < NUMKEYNAMES; j++)
|
||||
if (!stricmp(keynames[j].name, keystr))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -57,6 +57,7 @@ extern UINT8 ultimatemode; // was sk_insane
|
|||
extern gameaction_t gameaction;
|
||||
|
||||
extern boolean botingame;
|
||||
extern UINT8 botskin, botcolor;
|
||||
extern UINT8 botskin;
|
||||
extern UINT16 botcolor;
|
||||
|
||||
#endif //__G_STATE__
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 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.
|
||||
//
|
||||
// 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
|
||||
/// \file hw3dsdrv.h
|
||||
/// \brief 3D sound import/export prototypes for low-level hardware interface
|
||||
|
||||
#ifndef __HW_3DS_DRV_H__
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 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.
|
||||
// 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
|
||||
/// \file hw3sound.c
|
||||
/// \brief Hardware 3D sound general code
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
@ -28,7 +21,7 @@
|
|||
#include "../tables.h"
|
||||
#include "../sounds.h"
|
||||
#include "../r_main.h"
|
||||
#include "../r_things.h"
|
||||
#include "../r_skins.h"
|
||||
#include "../m_random.h"
|
||||
#include "../p_local.h"
|
||||
#include "hw3dsdrv.h"
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 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.
|
||||
//
|
||||
// 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
|
||||
/// \file hw3sound.h
|
||||
/// \brief High-level functions of hardware 3D sound
|
||||
|
||||
#ifndef __HW3_SOUND_H__
|
||||
|
|
|
@ -0,0 +1,454 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_batching.c
|
||||
/// \brief Draw call batching and related things.
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_glob.h"
|
||||
#include "hw_batching.h"
|
||||
#include "../i_system.h"
|
||||
|
||||
// The texture for the next polygon given to HWR_ProcessPolygon.
|
||||
// Set with HWR_SetCurrentTexture.
|
||||
GLMipmap_t *current_texture = NULL;
|
||||
|
||||
boolean currently_batching = false;
|
||||
|
||||
FOutVector* finalVertexArray = NULL;// contains subset of sorted vertices and texture coordinates to be sent to gpu
|
||||
UINT32* finalVertexIndexArray = NULL;// contains indexes for glDrawElements, taking into account fan->triangles conversion
|
||||
// NOTE have this alloced as 3x finalVertexArray size
|
||||
int finalVertexArrayAllocSize = 65536;
|
||||
//GLubyte* colorArray = NULL;// contains color data to be sent to gpu, if needed
|
||||
//int colorArrayAllocSize = 65536;
|
||||
// not gonna use this for now, just sort by color and change state when it changes
|
||||
// later maybe when using vertex attributes if it's needed
|
||||
|
||||
PolygonArrayEntry* polygonArray = NULL;// contains the polygon data from DrawPolygon, waiting to be processed
|
||||
int polygonArraySize = 0;
|
||||
UINT32* polygonIndexArray = NULL;// contains sorting pointers for polygonArray
|
||||
int polygonArrayAllocSize = 65536;
|
||||
|
||||
FOutVector* unsortedVertexArray = NULL;// contains unsorted vertices and texture coordinates from DrawPolygon
|
||||
int unsortedVertexArraySize = 0;
|
||||
int unsortedVertexArrayAllocSize = 65536;
|
||||
|
||||
// Enables batching mode. HWR_ProcessPolygon will collect polygons instead of passing them directly to the rendering backend.
|
||||
// Call HWR_RenderBatches to render all the collected geometry.
|
||||
void HWR_StartBatching(void)
|
||||
{
|
||||
if (currently_batching)
|
||||
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
|
||||
|
||||
// init arrays if that has not been done yet
|
||||
if (!finalVertexArray)
|
||||
{
|
||||
finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
|
||||
finalVertexIndexArray = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32));
|
||||
polygonArray = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry));
|
||||
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(UINT32));
|
||||
unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
||||
}
|
||||
|
||||
currently_batching = true;
|
||||
}
|
||||
|
||||
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
|
||||
// The texture selection is saved for the next HWR_ProcessPolygon call.
|
||||
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
|
||||
void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
{
|
||||
if (currently_batching)
|
||||
{
|
||||
current_texture = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
// If batching is enabled, this function collects the polygon data and the chosen texture
|
||||
// for later use in HWR_RenderBatches. Otherwise the rendering backend is used to
|
||||
// render the polygon immediately.
|
||||
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial)
|
||||
{
|
||||
if (currently_batching)
|
||||
{
|
||||
if (!pSurf)
|
||||
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
|
||||
if (polygonArraySize == polygonArrayAllocSize)
|
||||
{
|
||||
PolygonArrayEntry* new_array;
|
||||
// ran out of space, make new array double the size
|
||||
polygonArrayAllocSize *= 2;
|
||||
new_array = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry));
|
||||
memcpy(new_array, polygonArray, polygonArraySize * sizeof(PolygonArrayEntry));
|
||||
free(polygonArray);
|
||||
polygonArray = new_array;
|
||||
// also need to redo the index array, dont need to copy it though
|
||||
free(polygonIndexArray);
|
||||
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(UINT32));
|
||||
}
|
||||
|
||||
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
|
||||
{
|
||||
FOutVector* new_array;
|
||||
// need more space for vertices in unsortedVertexArray
|
||||
unsortedVertexArrayAllocSize *= 2;
|
||||
new_array = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
||||
memcpy(new_array, unsortedVertexArray, unsortedVertexArraySize * sizeof(FOutVector));
|
||||
free(unsortedVertexArray);
|
||||
unsortedVertexArray = new_array;
|
||||
}
|
||||
|
||||
// add the polygon data to the arrays
|
||||
|
||||
polygonArray[polygonArraySize].surf = *pSurf;
|
||||
polygonArray[polygonArraySize].vertsIndex = unsortedVertexArraySize;
|
||||
polygonArray[polygonArraySize].numVerts = iNumPts;
|
||||
polygonArray[polygonArraySize].polyFlags = PolyFlags;
|
||||
polygonArray[polygonArraySize].texture = current_texture;
|
||||
polygonArray[polygonArraySize].shader = shader;
|
||||
polygonArray[polygonArraySize].horizonSpecial = horizonSpecial;
|
||||
polygonArraySize++;
|
||||
|
||||
memcpy(&unsortedVertexArray[unsortedVertexArraySize], pOutVerts, iNumPts * sizeof(FOutVector));
|
||||
unsortedVertexArraySize += iNumPts;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shader)
|
||||
HWD.pfnSetShader(shader);
|
||||
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
static int comparePolygons(const void *p1, const void *p2)
|
||||
{
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
int shader1 = poly1->shader;
|
||||
int shader2 = poly2->shader;
|
||||
// make skywalls and horizon lines first in order
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
shader1 = -1;
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
shader2 = -1;
|
||||
diff = shader1 - shader2;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (shader1 == -1 && shader2 == -1)
|
||||
return index1 - index2;
|
||||
|
||||
diff64 = poly1->texture - poly2->texture;
|
||||
if (diff64 != 0) return diff64;
|
||||
|
||||
diff = poly1->polyFlags - poly2->polyFlags;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
diff64 = poly1->surf.PolyColor.rgba - poly2->surf.PolyColor.rgba;
|
||||
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
|
||||
diff64 = poly1->surf.TintColor.rgba - poly2->surf.TintColor.rgba;
|
||||
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
|
||||
diff64 = poly1->surf.FadeColor.rgba - poly2->surf.FadeColor.rgba;
|
||||
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
|
||||
|
||||
diff = poly1->surf.LightInfo.light_level - poly2->surf.LightInfo.light_level;
|
||||
if (diff != 0) return diff;
|
||||
diff = poly1->surf.LightInfo.fade_start - poly2->surf.LightInfo.fade_start;
|
||||
if (diff != 0) return diff;
|
||||
diff = poly1->surf.LightInfo.fade_end - poly2->surf.LightInfo.fade_end;
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
{
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
GLMipmap_t *texture1 = poly1->texture;
|
||||
GLMipmap_t *texture2 = poly2->texture;
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
texture1 = NULL;
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
texture2 = NULL;
|
||||
diff64 = texture1 - texture2;
|
||||
if (diff64 != 0) return diff64;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (texture1 == NULL && texture2 == NULL)
|
||||
return index1 - index2;
|
||||
|
||||
diff = poly1->polyFlags - poly2->polyFlags;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
diff64 = poly1->surf.PolyColor.rgba - poly2->surf.PolyColor.rgba;
|
||||
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This function organizes the geometry collected by HWR_ProcessPolygon calls into batches and uses
|
||||
// the rendering backend to draw them.
|
||||
void HWR_RenderBatches(void)
|
||||
{
|
||||
int finalVertexWritePos = 0;// position in finalVertexArray
|
||||
int finalIndexWritePos = 0;// position in finalVertexIndexArray
|
||||
|
||||
int polygonReadPos = 0;// position in polygonIndexArray
|
||||
|
||||
int currentShader;
|
||||
int nextShader = 0;
|
||||
GLMipmap_t *currentTexture;
|
||||
GLMipmap_t *nextTexture = NULL;
|
||||
FBITFIELD currentPolyFlags = 0;
|
||||
FBITFIELD nextPolyFlags = 0;
|
||||
FSurfaceInfo currentSurfaceInfo;
|
||||
FSurfaceInfo nextSurfaceInfo;
|
||||
|
||||
int i;
|
||||
|
||||
if (!currently_batching)
|
||||
I_Error("HWR_RenderBatches called without starting batching");
|
||||
|
||||
nextSurfaceInfo.LightInfo.fade_end = 0;
|
||||
nextSurfaceInfo.LightInfo.fade_start = 0;
|
||||
nextSurfaceInfo.LightInfo.light_level = 0;
|
||||
|
||||
currently_batching = false;// no longer collecting batches
|
||||
if (!polygonArraySize)
|
||||
{
|
||||
rs_hw_numpolys = rs_hw_numcalls = rs_hw_numshaders = rs_hw_numtextures = rs_hw_numpolyflags = rs_hw_numcolors = 0;
|
||||
return;// nothing to draw
|
||||
}
|
||||
// init stats vars
|
||||
rs_hw_numpolys = polygonArraySize;
|
||||
rs_hw_numcalls = rs_hw_numverts = 0;
|
||||
rs_hw_numshaders = rs_hw_numtextures = rs_hw_numpolyflags = rs_hw_numcolors = 1;
|
||||
// init polygonIndexArray
|
||||
for (i = 0; i < polygonArraySize; i++)
|
||||
{
|
||||
polygonIndexArray[i] = i;
|
||||
}
|
||||
|
||||
// sort polygons
|
||||
rs_hw_batchsorttime = I_GetTimeMicros();
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons);
|
||||
else
|
||||
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders);
|
||||
rs_hw_batchsorttime = I_GetTimeMicros() - rs_hw_batchsorttime;
|
||||
// sort order
|
||||
// 1. shader
|
||||
// 2. texture
|
||||
// 3. polyflags
|
||||
// 4. colors + light level
|
||||
// not sure about what order of the last 2 should be, or if it even matters
|
||||
|
||||
rs_hw_batchdrawtime = I_GetTimeMicros();
|
||||
|
||||
currentShader = polygonArray[polygonIndexArray[0]].shader;
|
||||
currentTexture = polygonArray[polygonIndexArray[0]].texture;
|
||||
currentPolyFlags = polygonArray[polygonIndexArray[0]].polyFlags;
|
||||
currentSurfaceInfo = polygonArray[polygonIndexArray[0]].surf;
|
||||
// For now, will sort and track the colors. Vertex attributes could be used instead of uniforms
|
||||
// and a color array could replace the color calls.
|
||||
|
||||
// set state for first batch
|
||||
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
HWD.pfnSetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = NULL;
|
||||
else
|
||||
HWD.pfnSetTexture(currentTexture);
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
{
|
||||
int firstIndex;
|
||||
int lastIndex;
|
||||
|
||||
boolean stopFlag = false;
|
||||
boolean changeState = false;
|
||||
boolean changeShader = false;
|
||||
boolean changeTexture = false;
|
||||
boolean changePolyFlags = false;
|
||||
boolean changeSurfaceInfo = false;
|
||||
|
||||
// steps:
|
||||
// write vertices
|
||||
// check for changes or end, otherwise go back to writing
|
||||
// changes will affect the next vars and the change bools
|
||||
// end could set flag for stopping
|
||||
// execute draw call
|
||||
// could check ending flag here
|
||||
// change states according to next vars and change bools, updating the current vars and reseting the bools
|
||||
// reset write pos
|
||||
// repeat loop
|
||||
|
||||
int index = polygonIndexArray[polygonReadPos++];
|
||||
int numVerts = polygonArray[index].numVerts;
|
||||
// before writing, check if there is enough room
|
||||
// using 'while' instead of 'if' here makes sure that there will *always* be enough room.
|
||||
// probably never will this loop run more than once though
|
||||
while (finalVertexWritePos + numVerts > finalVertexArrayAllocSize)
|
||||
{
|
||||
FOutVector* new_array;
|
||||
unsigned int* new_index_array;
|
||||
finalVertexArrayAllocSize *= 2;
|
||||
new_array = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
|
||||
memcpy(new_array, finalVertexArray, finalVertexWritePos * sizeof(FOutVector));
|
||||
free(finalVertexArray);
|
||||
finalVertexArray = new_array;
|
||||
// also increase size of index array, 3x of vertex array since
|
||||
// going from fans to triangles increases vertex count to 3x
|
||||
new_index_array = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32));
|
||||
memcpy(new_index_array, finalVertexIndexArray, finalIndexWritePos * sizeof(UINT32));
|
||||
free(finalVertexIndexArray);
|
||||
finalVertexIndexArray = new_index_array;
|
||||
}
|
||||
// write the vertices of the polygon
|
||||
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[polygonArray[index].vertsIndex],
|
||||
numVerts * sizeof(FOutVector));
|
||||
// write the indexes, pointing to the fan vertexes but in triangles format
|
||||
firstIndex = finalVertexWritePos;
|
||||
lastIndex = finalVertexWritePos + numVerts;
|
||||
finalVertexWritePos += 2;
|
||||
while (finalVertexWritePos < lastIndex)
|
||||
{
|
||||
finalVertexIndexArray[finalIndexWritePos++] = firstIndex;
|
||||
finalVertexIndexArray[finalIndexWritePos++] = finalVertexWritePos - 1;
|
||||
finalVertexIndexArray[finalIndexWritePos++] = finalVertexWritePos++;
|
||||
}
|
||||
|
||||
if (polygonReadPos >= polygonArraySize)
|
||||
{
|
||||
stopFlag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if a state change is required, set the change bools and next vars
|
||||
int nextIndex = polygonIndexArray[polygonReadPos];
|
||||
nextShader = polygonArray[nextIndex].shader;
|
||||
nextTexture = polygonArray[nextIndex].texture;
|
||||
nextPolyFlags = polygonArray[nextIndex].polyFlags;
|
||||
nextSurfaceInfo = polygonArray[nextIndex].surf;
|
||||
if (nextPolyFlags & PF_NoTexture)
|
||||
nextTexture = 0;
|
||||
if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
changeState = true;
|
||||
changeShader = true;
|
||||
}
|
||||
if (currentTexture != nextTexture)
|
||||
{
|
||||
changeState = true;
|
||||
changeTexture = true;
|
||||
}
|
||||
if (currentPolyFlags != nextPolyFlags)
|
||||
{
|
||||
changeState = true;
|
||||
changePolyFlags = true;
|
||||
}
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba ||
|
||||
currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level ||
|
||||
currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start ||
|
||||
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end)
|
||||
{
|
||||
changeState = true;
|
||||
changeSurfaceInfo = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba)
|
||||
{
|
||||
changeState = true;
|
||||
changeSurfaceInfo = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (changeState || stopFlag)
|
||||
{
|
||||
// execute draw call
|
||||
HWD.pfnDrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
// update stats
|
||||
rs_hw_numcalls++;
|
||||
rs_hw_numverts += finalIndexWritePos;
|
||||
// reset write positions
|
||||
finalVertexWritePos = 0;
|
||||
finalIndexWritePos = 0;
|
||||
}
|
||||
else continue;
|
||||
|
||||
// if we're here then either its time to stop or time to change state
|
||||
if (stopFlag) break;
|
||||
|
||||
// change state according to change bools and next vars, update current vars and reset bools
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
rs_hw_numshaders++;
|
||||
}
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
rs_hw_numtextures++;
|
||||
}
|
||||
if (changePolyFlags)
|
||||
{
|
||||
currentPolyFlags = nextPolyFlags;
|
||||
changePolyFlags = false;
|
||||
|
||||
rs_hw_numpolyflags++;
|
||||
}
|
||||
if (changeSurfaceInfo)
|
||||
{
|
||||
currentSurfaceInfo = nextSurfaceInfo;
|
||||
changeSurfaceInfo = false;
|
||||
|
||||
rs_hw_numcolors++;
|
||||
}
|
||||
// and that should be it?
|
||||
}
|
||||
// reset the arrays (set sizes to 0)
|
||||
polygonArraySize = 0;
|
||||
unsortedVertexArraySize = 0;
|
||||
|
||||
rs_hw_batchdrawtime = I_GetTimeMicros() - rs_hw_batchdrawtime;
|
||||
}
|
||||
|
||||
|
||||
#endif // HWRENDER
|
|
@ -0,0 +1,37 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_batching.h
|
||||
/// \brief Draw call batching and related things.
|
||||
|
||||
#ifndef __HWR_BATCHING_H__
|
||||
#define __HWR_BATCHING_H__
|
||||
|
||||
#include "hw_defs.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
|
||||
unsigned int vertsIndex;// location of verts in unsortedVertexArray
|
||||
FUINT numVerts;
|
||||
FBITFIELD polyFlags;
|
||||
GLMipmap_t *texture;
|
||||
int shader;
|
||||
// this tells batching that the plane belongs to a horizon line and must be drawn in correct order with the skywalls
|
||||
boolean horizonSpecial;
|
||||
} PolygonArrayEntry;
|
||||
|
||||
void HWR_StartBatching(void);
|
||||
void HWR_SetCurrentTexture(GLMipmap_t *texture);
|
||||
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial);
|
||||
void HWR_RenderBatches(void);
|
||||
|
||||
#endif
|
|
@ -1,19 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 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.
|
||||
// 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
|
||||
/// \file hw_bsp.c
|
||||
/// \brief convert SRB2 map
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
@ -68,17 +61,17 @@ static INT32 totalsubsecpolys = 0;
|
|||
/// \todo check out how much is used
|
||||
static size_t POLYPOOLSIZE = 1024000;
|
||||
|
||||
static UINT8 *gr_polypool = NULL;
|
||||
static UINT8 *gr_ppcurrent;
|
||||
static size_t gr_ppfree;
|
||||
static UINT8 *gl_polypool = NULL;
|
||||
static UINT8 *gl_ppcurrent;
|
||||
static size_t gl_ppfree;
|
||||
#endif
|
||||
|
||||
// only between levels, clear poly pool
|
||||
static void HWR_ClearPolys(void)
|
||||
{
|
||||
#ifndef ZPLANALLOC
|
||||
gr_ppcurrent = gr_polypool;
|
||||
gr_ppfree = POLYPOOLSIZE;
|
||||
gl_ppcurrent = gl_polypool;
|
||||
gl_ppfree = POLYPOOLSIZE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -93,8 +86,8 @@ void HWR_InitPolyPool(void)
|
|||
POLYPOOLSIZE = atoi(myargv[pnum+1])*1024; // (in kb)
|
||||
|
||||
CONS_Debug(DBG_RENDER, "HWR_InitPolyPool(): allocating %d bytes\n", POLYPOOLSIZE);
|
||||
gr_polypool = malloc(POLYPOOLSIZE);
|
||||
if (!gr_polypool)
|
||||
gl_polypool = malloc(POLYPOOLSIZE);
|
||||
if (!gl_polypool)
|
||||
I_Error("HWR_InitPolyPool(): couldn't malloc polypool\n");
|
||||
HWR_ClearPolys();
|
||||
#endif
|
||||
|
@ -103,9 +96,9 @@ void HWR_InitPolyPool(void)
|
|||
void HWR_FreePolyPool(void)
|
||||
{
|
||||
#ifndef ZPLANALLOC
|
||||
if (gr_polypool)
|
||||
free(gr_polypool);
|
||||
gr_polypool = NULL;
|
||||
if (gl_polypool)
|
||||
free(gl_polypool);
|
||||
gl_polypool = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -117,19 +110,19 @@ static poly_t *HWR_AllocPoly(INT32 numpts)
|
|||
p = Z_Malloc(size, PU_HWRPLANE, NULL);
|
||||
#else
|
||||
#ifdef PARANOIA
|
||||
if (!gr_polypool)
|
||||
I_Error("Used gr_polypool without init!\n");
|
||||
if (!gr_ppcurrent)
|
||||
I_Error("gr_ppcurrent == NULL!\n");
|
||||
if (!gl_polypool)
|
||||
I_Error("Used gl_polypool without init!\n");
|
||||
if (!gl_ppcurrent)
|
||||
I_Error("gl_ppcurrent == NULL!\n");
|
||||
#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",
|
||||
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;
|
||||
gr_ppcurrent += size;
|
||||
gr_ppfree -= size;
|
||||
p = (poly_t *)gl_ppcurrent;
|
||||
gl_ppcurrent += size;
|
||||
gl_ppfree -= size;
|
||||
#endif
|
||||
p->numpts = numpts;
|
||||
return p;
|
||||
|
@ -142,13 +135,13 @@ static polyvertex_t *HWR_AllocVertex(void)
|
|||
#ifdef ZPLANALLOC
|
||||
p = Z_Malloc(size, PU_HWRPLANE, NULL);
|
||||
#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",
|
||||
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;
|
||||
gr_ppcurrent += size;
|
||||
gr_ppfree -= size;
|
||||
p = (polyvertex_t *)gl_ppcurrent;
|
||||
gl_ppcurrent += size;
|
||||
gl_ppfree -= size;
|
||||
#endif
|
||||
return p;
|
||||
}
|
||||
|
@ -836,7 +829,7 @@ static INT32 SolveTProblem(void)
|
|||
INT32 i;
|
||||
size_t l;
|
||||
|
||||
if (cv_grsolvetjoin.value == 0)
|
||||
if (cv_glsolvetjoin.value == 0)
|
||||
return 0;
|
||||
|
||||
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
|
||||
|
@ -887,12 +880,10 @@ static void AdjustSegs(void)
|
|||
float distv1,distv2,tmp;
|
||||
nearv1 = nearv2 = MYMAX;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// Don't touch polyobject segs. We'll compensate
|
||||
// for this when we go about drawing them.
|
||||
if (lseg->polyseg)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (p) {
|
||||
for (j = 0; j < p->numpts; j++)
|
||||
|
@ -992,9 +983,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
|||
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
|
||||
|
||||
// allocate table for back to front drawing of subsectors
|
||||
/*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors);
|
||||
if (!gr_drawsubsectors)
|
||||
I_Error("couldn't malloc gr_drawsubsectors\n");*/
|
||||
/*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors);
|
||||
if (!gl_drawsubsectors)
|
||||
I_Error("couldn't malloc gl_drawsubsectors\n");*/
|
||||
|
||||
// number of the first new subsector that might be added
|
||||
addsubsector = numsubsectors;
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
/// \file hw_cache.c
|
||||
/// \brief load and convert graphics to the hardware format
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
@ -22,6 +15,7 @@
|
|||
#ifdef HWRENDER
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_batching.h"
|
||||
|
||||
#include "../doomstat.h" //gamemode
|
||||
#include "../i_video.h" //rendermode
|
||||
|
@ -33,30 +27,18 @@
|
|||
#include "../r_patch.h"
|
||||
#include "../p_setup.h"
|
||||
|
||||
// Values set after a call to HWR_ResizeBlock()
|
||||
static INT32 blocksize, blockwidth, blockheight;
|
||||
INT32 patchformat = GL_TEXFMT_AP_88; // use alpha for holes
|
||||
INT32 textureformat = GL_TEXFMT_P_8; // use chromakey for hole
|
||||
|
||||
INT32 patchformat = GR_TEXFMT_AP_88; // use alpha for holes
|
||||
INT32 textureformat = GR_TEXFMT_P_8; // use chromakey for hole
|
||||
|
||||
static const INT32 format2bpp[16] =
|
||||
static INT32 format2bpp(GLTextureFormat_t format)
|
||||
{
|
||||
0, //0
|
||||
0, //1
|
||||
1, //2 GR_TEXFMT_ALPHA_8
|
||||
1, //3 GR_TEXFMT_INTENSITY_8
|
||||
1, //4 GR_TEXFMT_ALPHA_INTENSITY_44
|
||||
1, //5 GR_TEXFMT_P_8
|
||||
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
|
||||
};
|
||||
if (format == GL_TEXFMT_RGBA)
|
||||
return 4;
|
||||
else if (format == GL_TEXFMT_ALPHA_INTENSITY_88 || format == GL_TEXFMT_AP_88)
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
// This code was originally placed directly in HWR_DrawPatchInCache.
|
||||
// It is now split from it for my sanity! (and the sanity of others)
|
||||
|
@ -135,7 +117,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
|||
{
|
||||
case 2 : // uhhhhhhhh..........
|
||||
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);
|
||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
||||
break;
|
||||
|
@ -144,7 +126,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
|||
{
|
||||
RGBA_t rgbatexel;
|
||||
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));
|
||||
break;
|
||||
|
@ -154,14 +136,14 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
|||
{
|
||||
RGBA_t rgbatexel;
|
||||
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));
|
||||
break;
|
||||
// default is 1
|
||||
default:
|
||||
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
|
||||
*dest = texel;
|
||||
break;
|
||||
|
@ -234,11 +216,11 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// transparent pixel
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||
alpha = 0x00;
|
||||
else
|
||||
// If the mipmap is chromakeyed, check if the texel's color
|
||||
// is equivalent to the chroma key's color index.
|
||||
alpha = 0xff;
|
||||
if ((mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
|
||||
alpha = 0x00;
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
||||
|
@ -247,7 +229,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
{
|
||||
case 2 : // uhhhhhhhh..........
|
||||
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);
|
||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
||||
break;
|
||||
|
@ -256,7 +238,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
{
|
||||
RGBA_t rgbatexel;
|
||||
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));
|
||||
break;
|
||||
|
@ -266,14 +248,14 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
{
|
||||
RGBA_t rgbatexel;
|
||||
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));
|
||||
break;
|
||||
// default is 1
|
||||
default:
|
||||
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
|
||||
*dest = texel;
|
||||
break;
|
||||
|
@ -301,28 +283,28 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
|||
fixed_t xfrac, xfracstep;
|
||||
fixed_t yfracstep, scale_y;
|
||||
const column_t *patchcol;
|
||||
UINT8 *block = mipmap->grInfo.data;
|
||||
UINT8 *block = mipmap->data;
|
||||
INT32 bpp;
|
||||
INT32 blockmodulo;
|
||||
|
||||
if (pwidth <= 0 || pheight <= 0)
|
||||
return;
|
||||
|
||||
ncols = (pwidth * pblockwidth) / pwidth;
|
||||
ncols = pwidth;
|
||||
|
||||
// source advance
|
||||
xfrac = 0;
|
||||
xfracstep = (pwidth << FRACBITS) / pblockwidth;
|
||||
yfracstep = (pheight << FRACBITS) / pblockheight;
|
||||
scale_y = (pblockheight << FRACBITS) / pheight;
|
||||
xfracstep = FRACUNIT;
|
||||
yfracstep = FRACUNIT;
|
||||
scale_y = FRACUNIT;
|
||||
|
||||
bpp = format2bpp[mipmap->grInfo.format];
|
||||
bpp = format2bpp(mipmap->format);
|
||||
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = blockwidth*bpp;
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
for (; ncols--; block += bpp, xfrac += xfracstep)
|
||||
|
@ -348,7 +330,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
|||
fixed_t xfrac, xfracstep;
|
||||
fixed_t yfracstep, scale_y;
|
||||
const column_t *patchcol;
|
||||
UINT8 *block = mipmap->grInfo.data;
|
||||
UINT8 *block = mipmap->data;
|
||||
INT32 bpp;
|
||||
INT32 blockmodulo;
|
||||
INT32 width, height;
|
||||
|
@ -409,13 +391,13 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
|||
yfracstep = (texture->height<< FRACBITS) / pblockheight;
|
||||
scale_y = (pblockheight << FRACBITS) / texture->height;
|
||||
|
||||
bpp = format2bpp[mipmap->grInfo.format];
|
||||
bpp = format2bpp(mipmap->format);
|
||||
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = blockwidth*bpp;
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
for (block += col*bpp; ncols--; block += bpp, xfrac += xfracstep)
|
||||
|
@ -433,145 +415,15 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// resize the patch to be 3dfx compliant
|
||||
// set : blocksize = blockwidth * blockheight (no bpp used)
|
||||
// blockwidth
|
||||
// blockheight
|
||||
//note : 8bit (1 byte per pixel) palettized format
|
||||
static void HWR_ResizeBlock(INT32 originalwidth, INT32 originalheight,
|
||||
GrTexInfo *grInfo)
|
||||
{
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// Build the full textures from patches.
|
||||
static const GrLOD_t gr_lods[9] =
|
||||
{
|
||||
GR_LOD_LOG2_256,
|
||||
GR_LOD_LOG2_128,
|
||||
GR_LOD_LOG2_64,
|
||||
GR_LOD_LOG2_32,
|
||||
GR_LOD_LOG2_16,
|
||||
GR_LOD_LOG2_8,
|
||||
GR_LOD_LOG2_4,
|
||||
GR_LOD_LOG2_2,
|
||||
GR_LOD_LOG2_1
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GrAspectRatio_t aspect;
|
||||
float max_s;
|
||||
float max_t;
|
||||
} booring_aspect_t;
|
||||
|
||||
static const booring_aspect_t gr_aspects[8] =
|
||||
{
|
||||
{GR_ASPECT_LOG2_1x1, 255, 255},
|
||||
{GR_ASPECT_LOG2_2x1, 255, 127},
|
||||
{GR_ASPECT_LOG2_4x1, 255, 63},
|
||||
{GR_ASPECT_LOG2_8x1, 255, 31},
|
||||
|
||||
{GR_ASPECT_LOG2_1x1, 255, 255},
|
||||
{GR_ASPECT_LOG2_1x2, 127, 255},
|
||||
{GR_ASPECT_LOG2_1x4, 63, 255},
|
||||
{GR_ASPECT_LOG2_1x8, 31, 255}
|
||||
};
|
||||
|
||||
INT32 j,k;
|
||||
INT32 max,min;
|
||||
#else
|
||||
(void)grInfo;
|
||||
#endif
|
||||
|
||||
// find a power of 2 width/height
|
||||
if (cv_grrounddown.value)
|
||||
{
|
||||
blockwidth = 256;
|
||||
while (originalwidth < blockwidth)
|
||||
blockwidth >>= 1;
|
||||
if (blockwidth < 1)
|
||||
I_Error("3D GenerateTexture : too small");
|
||||
|
||||
blockheight = 256;
|
||||
while (originalheight < blockheight)
|
||||
blockheight >>= 1;
|
||||
if (blockheight < 1)
|
||||
I_Error("3D GenerateTexture : too small");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
//size up to nearest power of 2
|
||||
blockwidth = 1;
|
||||
while (blockwidth < originalwidth)
|
||||
blockwidth <<= 1;
|
||||
// scale down the original graphics to fit in 256
|
||||
if (blockwidth > 2048)
|
||||
blockwidth = 2048;
|
||||
//I_Error("3D GenerateTexture : too big");
|
||||
|
||||
//size up to nearest power of 2
|
||||
blockheight = 1;
|
||||
while (blockheight < originalheight)
|
||||
blockheight <<= 1;
|
||||
// scale down the original graphics to fit in 256
|
||||
if (blockheight > 2048)
|
||||
blockheight = 2048;
|
||||
//I_Error("3D GenerateTexture : too big");
|
||||
#else
|
||||
blockwidth = originalwidth;
|
||||
blockheight = originalheight;
|
||||
#endif
|
||||
}
|
||||
|
||||
// do the boring LOD stuff.. blech!
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
if (blockwidth >= blockheight)
|
||||
{
|
||||
max = blockwidth;
|
||||
min = blockheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
max = blockheight;
|
||||
min = blockwidth;
|
||||
}
|
||||
|
||||
for (k = 2048, j = 0; k > max; j++)
|
||||
k>>=1;
|
||||
grInfo->smallLodLog2 = gr_lods[j];
|
||||
grInfo->largeLodLog2 = gr_lods[j];
|
||||
|
||||
for (k = max, j = 0; k > min && j < 4; j++)
|
||||
k>>=1;
|
||||
// aspect ratio too small for 3Dfx (eg: 8x128 is 1x16 : use 1x8)
|
||||
if (j == 4)
|
||||
{
|
||||
j = 3;
|
||||
//CONS_Debug(DBG_RENDER, "HWR_ResizeBlock : bad aspect ratio %dx%d\n", blockwidth,blockheight);
|
||||
if (blockwidth < blockheight)
|
||||
blockwidth = max>>3;
|
||||
else
|
||||
blockheight = max>>3;
|
||||
}
|
||||
if (blockwidth < blockheight)
|
||||
j += 4;
|
||||
grInfo->aspectRatioLog2 = gr_aspects[j].aspect;
|
||||
#endif
|
||||
|
||||
blocksize = blockwidth * blockheight;
|
||||
|
||||
//CONS_Debug(DBG_RENDER, "Width is %d, Height is %d\n", blockwidth, blockheight);
|
||||
}
|
||||
|
||||
static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||
{
|
||||
UINT8 *block;
|
||||
INT32 bpp, i;
|
||||
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||
INT32 blocksize = (grMipmap->width * grMipmap->height);
|
||||
|
||||
bpp = format2bpp[grMipmap->grInfo.format];
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data));
|
||||
bpp = format2bpp(grMipmap->format);
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
|
@ -592,13 +444,14 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
|||
// Create a composite texture from patches, adapt the texture size to a power of 2
|
||||
// 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;
|
||||
texture_t *texture;
|
||||
texpatch_t *patch;
|
||||
patch_t *realpatch;
|
||||
UINT8 *pdata;
|
||||
INT32 blockwidth, blockheight, blocksize;
|
||||
|
||||
INT32 i;
|
||||
boolean skyspecial = false; //poor hack for Legacy large skies..
|
||||
|
@ -619,11 +472,13 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
else
|
||||
grtex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
|
||||
HWR_ResizeBlock (texture->width, texture->height, &grtex->mipmap.grInfo);
|
||||
grtex->mipmap.width = (UINT16)blockwidth;
|
||||
grtex->mipmap.height = (UINT16)blockheight;
|
||||
grtex->mipmap.grInfo.format = textureformat;
|
||||
grtex->mipmap.width = (UINT16)texture->width;
|
||||
grtex->mipmap.height = (UINT16)texture->height;
|
||||
grtex->mipmap.format = textureformat;
|
||||
|
||||
blockwidth = texture->width;
|
||||
blockheight = texture->height;
|
||||
blocksize = (blockwidth * blockheight);
|
||||
block = MakeBlock(&grtex->mipmap);
|
||||
|
||||
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
|
||||
|
@ -673,7 +528,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
Z_Unlock(realpatch);
|
||||
}
|
||||
//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
|
||||
{
|
||||
|
@ -692,8 +547,6 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
|
||||
void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
|
||||
{
|
||||
INT32 newwidth, newheight;
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
// lump is a png so convert it
|
||||
size_t len = W_LumpLengthPwad(grPatch->wadnum, grPatch->lumpnum);
|
||||
|
@ -712,51 +565,32 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
grPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
grPatch->topoffset = SHORT(patch->topoffset);
|
||||
|
||||
// find the good 3dfx size (boring spec)
|
||||
HWR_ResizeBlock (SHORT(patch->width), SHORT(patch->height), &grMipmap->grInfo);
|
||||
grMipmap->width = (UINT16)blockwidth;
|
||||
grMipmap->height = (UINT16)blockheight;
|
||||
grMipmap->width = grMipmap->height = 1;
|
||||
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
|
||||
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grMipmap->flags = 0;
|
||||
// setup the texture info
|
||||
grMipmap->grInfo.format = patchformat;
|
||||
}
|
||||
else
|
||||
{
|
||||
blockwidth = grMipmap->width;
|
||||
blockheight = grMipmap->height;
|
||||
blocksize = blockwidth * blockheight;
|
||||
grMipmap->format = patchformat;
|
||||
|
||||
//grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
|
||||
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
|
||||
}
|
||||
|
||||
Z_Free(grMipmap->grInfo.data);
|
||||
grMipmap->grInfo.data = NULL;
|
||||
|
||||
// if rounddown, rounddown patches as well as textures
|
||||
if (cv_grrounddown.value)
|
||||
{
|
||||
newwidth = blockwidth;
|
||||
newheight = blockheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no rounddown, do not size up patches, so they don't look 'scaled'
|
||||
newwidth = min(grPatch->width, blockwidth);
|
||||
newheight = min(grPatch->height, blockheight);
|
||||
}
|
||||
Z_Free(grMipmap->data);
|
||||
grMipmap->data = NULL;
|
||||
|
||||
if (makebitmap)
|
||||
{
|
||||
MakeBlock(grMipmap);
|
||||
|
||||
HWR_DrawPatchInCache(grMipmap,
|
||||
newwidth, newheight,
|
||||
grMipmap->width, grMipmap->height,
|
||||
grPatch->width, grPatch->height,
|
||||
patch);
|
||||
}
|
||||
|
||||
grPatch->max_s = (float)newwidth / (float)blockwidth;
|
||||
grPatch->max_t = (float)newheight / (float)blockheight;
|
||||
}
|
||||
|
||||
|
||||
|
@ -764,14 +598,14 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
// CACHING HANDLING
|
||||
// =================================================
|
||||
|
||||
static size_t gr_numtextures = 0; // Texture count
|
||||
static GLTexture_t *gr_textures; // For all textures
|
||||
static GLTexture_t *gr_flats; // For all (texture) flats, as normal flats don't need to be cached
|
||||
static size_t gl_numtextures = 0; // Texture count
|
||||
static GLMapTexture_t *gl_textures; // For all textures
|
||||
static GLMapTexture_t *gl_flats; // For all (texture) flats, as normal flats don't need to be cached
|
||||
|
||||
void HWR_InitTextureCache(void)
|
||||
{
|
||||
gr_textures = NULL;
|
||||
gr_flats = NULL;
|
||||
gl_textures = NULL;
|
||||
gl_flats = NULL;
|
||||
}
|
||||
|
||||
// Callback function for HWR_FreeTextureCache.
|
||||
|
@ -805,9 +639,9 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
|||
pat->mipmap->nextcolormap = next->nextcolormap;
|
||||
|
||||
// Free image data from memory.
|
||||
if (next->grInfo.data)
|
||||
Z_Free(next->grInfo.data);
|
||||
next->grInfo.data = NULL;
|
||||
if (next->data)
|
||||
Z_Free(next->data);
|
||||
next->data = NULL;
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
|
@ -839,13 +673,13 @@ void HWR_FreeTextureCache(void)
|
|||
|
||||
// now the heap don't have any 'user' pointing to our
|
||||
// texturecache info, we can free it
|
||||
if (gr_textures)
|
||||
free(gr_textures);
|
||||
if (gr_flats)
|
||||
free(gr_flats);
|
||||
gr_textures = NULL;
|
||||
gr_flats = NULL;
|
||||
gr_numtextures = 0;
|
||||
if (gl_textures)
|
||||
free(gl_textures);
|
||||
if (gl_flats)
|
||||
free(gl_flats);
|
||||
gl_textures = NULL;
|
||||
gl_flats = NULL;
|
||||
gl_numtextures = 0;
|
||||
}
|
||||
|
||||
void HWR_LoadTextures(size_t pnumtextures)
|
||||
|
@ -854,13 +688,13 @@ void HWR_LoadTextures(size_t pnumtextures)
|
|||
HWR_FreeTextureCache();
|
||||
|
||||
// Why not Z_Malloc?
|
||||
gr_numtextures = pnumtextures;
|
||||
gr_textures = calloc(gr_numtextures, sizeof(*gr_textures));
|
||||
gr_flats = calloc(gr_numtextures, sizeof(*gr_flats));
|
||||
gl_numtextures = pnumtextures;
|
||||
gl_textures = calloc(gl_numtextures, sizeof(*gl_textures));
|
||||
gl_flats = calloc(gl_numtextures, sizeof(*gl_flats));
|
||||
|
||||
// Doesn't tell you which it _is_, but hopefully
|
||||
// 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!");
|
||||
}
|
||||
|
||||
|
@ -870,7 +704,7 @@ void HWR_SetPalette(RGBA_t *palette)
|
|||
|
||||
// hardware driver will flush there own cache if cache is non paletized
|
||||
// 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_UNLOCKED);
|
||||
|
@ -880,27 +714,30 @@ void HWR_SetPalette(RGBA_t *palette)
|
|||
// --------------------------------------------------------------------------
|
||||
// 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
|
||||
if ((unsigned)tex >= gr_numtextures)
|
||||
if ((unsigned)tex >= gl_numtextures)
|
||||
I_Error("HWR_GetTexture: tex >= numtextures\n");
|
||||
#endif
|
||||
|
||||
// Every texture in memory, stored in the
|
||||
// hardware renderer's bit depth format. Wow!
|
||||
grtex = &gr_textures[tex];
|
||||
grtex = &gl_textures[tex];
|
||||
|
||||
// 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);
|
||||
|
||||
// Tell the hardware driver to bind the current texture to the flat's mipmap
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -910,12 +747,7 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
|||
size_t size, pflatsize;
|
||||
|
||||
// setup the texture info
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
grMipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_64;
|
||||
grMipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_64;
|
||||
grMipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
grMipmap->grInfo.format = GR_TEXFMT_P_8;
|
||||
grMipmap->format = GL_TEXFMT_P_8;
|
||||
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
|
||||
size = W_LumpLength(flatlumpnum);
|
||||
|
@ -950,29 +782,21 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
|||
|
||||
// the flat raw data needn't be converted with palettized textures
|
||||
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)
|
||||
{
|
||||
UINT8 *flat;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
// setup the texture info
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
grMipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_64;
|
||||
grMipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_64;
|
||||
grMipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
grMipmap->grInfo.format = GR_TEXFMT_P_8;
|
||||
grMipmap->format = GL_TEXFMT_P_8;
|
||||
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
|
||||
grMipmap->width = (UINT16)textures[texturenum]->width;
|
||||
grMipmap->height = (UINT16)textures[texturenum]->height;
|
||||
|
||||
flat = Z_Malloc(grMipmap->width * grMipmap->height, PU_HWRCACHE, &grMipmap->grInfo.data);
|
||||
flat = Z_Malloc(grMipmap->width * grMipmap->height, PU_HWRCACHE, &grMipmap->data);
|
||||
memset(flat, TRANSPARENTPIXEL, grMipmap->width * grMipmap->height);
|
||||
|
||||
R_TextureToFlat(texturenum, flat);
|
||||
|
@ -985,17 +809,18 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
|
|||
if (flatlumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
|
||||
// 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)
|
||||
|
@ -1008,10 +833,10 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
HWR_LiterallyGetFlat(levelflat->u.flat.lumpnum);
|
||||
else if (levelflat->type == LEVELFLAT_TEXTURE)
|
||||
{
|
||||
GLTexture_t *grtex;
|
||||
GLMapTexture_t *grtex;
|
||||
INT32 texturenum = levelflat->u.texture.num;
|
||||
#ifdef PARANOIA
|
||||
if ((unsigned)texturenum >= gr_numtextures)
|
||||
if ((unsigned)texturenum >= gl_numtextures)
|
||||
I_Error("HWR_GetLevelFlat: texturenum >= numtextures\n");
|
||||
#endif
|
||||
|
||||
|
@ -1020,20 +845,23 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
return;
|
||||
|
||||
// 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
|
||||
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded)
|
||||
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
|
||||
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum);
|
||||
|
||||
// Tell the hardware driver to bind the current texture to the flat's mipmap
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
// 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 // set no texture
|
||||
HWD.pfnSetTexture(NULL);
|
||||
HWR_SetCurrentTexture(NULL);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1042,7 +870,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
//
|
||||
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;
|
||||
if (!patch)
|
||||
|
@ -1055,10 +883,14 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
Z_Free(patch);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
@ -1066,11 +898,8 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
{
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
// 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
|
||||
// flush the software patch before the conversion! oh yeah I suffered
|
||||
|
@ -1085,10 +914,14 @@ void HWR_GetPatch(GLPatch_t *gpatch)
|
|||
Z_Free(ptr);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gpatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(gpatch->mipmap);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1099,9 +932,6 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
|||
{
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
|
@ -1141,17 +971,17 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
|||
if (!gpatch)
|
||||
return;
|
||||
|
||||
Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED);
|
||||
}
|
||||
|
||||
static const INT32 picmode2GR[] =
|
||||
{
|
||||
GR_TEXFMT_P_8, // PALETTE
|
||||
GL_TEXFMT_P_8, // PALETTE
|
||||
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)
|
||||
GR_RGBA, // RGBA32 (opengl only)
|
||||
GL_TEXFMT_RGBA, // RGBA32 (opengl only)
|
||||
};
|
||||
|
||||
static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheight,
|
||||
|
@ -1166,7 +996,7 @@ static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheig
|
|||
|
||||
stepy = ((INT32)SHORT(pic->height)<<FRACBITS)/pblockheight;
|
||||
stepx = ((INT32)SHORT(pic->width)<<FRACBITS)/pblockwidth;
|
||||
picbpp = format2bpp[picmode2GR[pic->mode]];
|
||||
picbpp = format2bpp(picmode2GR[pic->mode]);
|
||||
posy = 0;
|
||||
for (j = 0; j < pblockheight; j++)
|
||||
{
|
||||
|
@ -1225,19 +1055,12 @@ static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheig
|
|||
// -----------------+
|
||||
GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grpatch = HWR_GetCachedGLPatch(lumpnum);
|
||||
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
|
||||
GLPatch_t *grpatch = HWR_GetCachedGLPatch(lumpnum);
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
|
||||
{
|
||||
pic_t *pic;
|
||||
UINT8 *block;
|
||||
size_t len;
|
||||
INT32 newwidth, newheight;
|
||||
|
||||
pic = W_CacheLumpNum(lumpnum, PU_CACHE);
|
||||
grpatch->width = SHORT(pic->width);
|
||||
|
@ -1247,57 +1070,40 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
grpatch->leftoffset = 0;
|
||||
grpatch->topoffset = 0;
|
||||
|
||||
// find the good 3dfx size (boring spec)
|
||||
HWR_ResizeBlock (grpatch->width, grpatch->height, &grpatch->mipmap->grInfo);
|
||||
grpatch->mipmap->width = (UINT16)blockwidth;
|
||||
grpatch->mipmap->height = (UINT16)blockheight;
|
||||
grpatch->mipmap->width = (UINT16)grpatch->width;
|
||||
grpatch->mipmap->height = (UINT16)grpatch->height;
|
||||
|
||||
if (pic->mode == PALETTE)
|
||||
grpatch->mipmap->grInfo.format = textureformat; // can be set by driver
|
||||
grpatch->mipmap->format = textureformat; // can be set by driver
|
||||
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
|
||||
block = MakeBlock(grpatch->mipmap);
|
||||
|
||||
// if rounddown, rounddown patches as well as textures
|
||||
if (cv_grrounddown.value)
|
||||
{
|
||||
newwidth = blockwidth;
|
||||
newheight = blockheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no rounddown, do not size up patches, so they don't look 'scaled'
|
||||
newwidth = min(SHORT(pic->width),blockwidth);
|
||||
newheight = min(SHORT(pic->height),blockheight);
|
||||
}
|
||||
|
||||
|
||||
if (grpatch->width == blockwidth &&
|
||||
grpatch->height == blockheight &&
|
||||
format2bpp[grpatch->mipmap->grInfo.format] == format2bpp[picmode2GR[pic->mode]])
|
||||
if (grpatch->width == SHORT(pic->width) &&
|
||||
grpatch->height == SHORT(pic->height) &&
|
||||
format2bpp(grpatch->mipmap->format) == format2bpp(picmode2GR[pic->mode]))
|
||||
{
|
||||
// no conversion needed
|
||||
M_Memcpy(grpatch->mipmap->grInfo.data, pic->data,len);
|
||||
M_Memcpy(grpatch->mipmap->data, pic->data,len);
|
||||
}
|
||||
else
|
||||
HWR_DrawPicInCache(block, newwidth, newheight,
|
||||
blockwidth*format2bpp[grpatch->mipmap->grInfo.format],
|
||||
HWR_DrawPicInCache(block, SHORT(pic->width), SHORT(pic->height),
|
||||
SHORT(pic->width)*format2bpp(grpatch->mipmap->format),
|
||||
pic,
|
||||
format2bpp[grpatch->mipmap->grInfo.format]);
|
||||
format2bpp(grpatch->mipmap->format));
|
||||
|
||||
Z_Unlock(pic);
|
||||
Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
grpatch->mipmap->flags = 0;
|
||||
grpatch->max_s = (float)newwidth / (float)blockwidth;
|
||||
grpatch->max_t = (float)newheight / (float)blockheight;
|
||||
grpatch->max_s = grpatch->max_t = 1.0f;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -1330,7 +1136,7 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
|
|||
{
|
||||
INT32 i,j;
|
||||
fixed_t posx, posy, stepx, stepy;
|
||||
UINT8 *block = mipmap->grInfo.data; // places the data directly into here, it already has the space allocated from HWR_ResizeBlock
|
||||
UINT8 *block = mipmap->data; // places the data directly into here
|
||||
UINT8 *flat;
|
||||
UINT8 *dest, *src, texel;
|
||||
RGBA_t col;
|
||||
|
@ -1345,7 +1151,7 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
|
|||
for (j = 0; j < pblockheight; j++)
|
||||
{
|
||||
posx = 0;
|
||||
dest = &block[j*blockwidth]; // 1bpp
|
||||
dest = &block[j*(mipmap->width)]; // 1bpp
|
||||
src = &flat[(posy>>FRACBITS)*SHORT(fmwidth)];
|
||||
for (i = 0; i < pblockwidth;i++)
|
||||
{
|
||||
|
@ -1369,7 +1175,7 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
|||
UINT16 fmheight = 0, fmwidth = 0;
|
||||
|
||||
// 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;
|
||||
|
||||
size = W_LumpLength(fademasklumpnum);
|
||||
|
@ -1399,14 +1205,12 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
|||
}
|
||||
|
||||
// Thankfully, this will still work for this scenario
|
||||
HWR_ResizeBlock(fmwidth, fmheight, &grMipmap->grInfo);
|
||||
|
||||
grMipmap->width = blockwidth;
|
||||
grMipmap->height = blockheight;
|
||||
grMipmap->width = fmwidth;
|
||||
grMipmap->height = fmheight;
|
||||
|
||||
MakeBlock(grMipmap);
|
||||
|
||||
HWR_DrawFadeMaskInCache(grMipmap, blockwidth, blockheight, fademasklumpnum, fmwidth, fmheight);
|
||||
HWR_DrawFadeMaskInCache(grMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
|
||||
|
||||
// I DO need to convert this because it isn't power of 2 and we need the alpha
|
||||
}
|
||||
|
@ -1414,20 +1218,14 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
|||
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
GLMipmap_t *grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFadeMask(grmip, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(grmip);
|
||||
|
||||
// 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
|
||||
|
|
|
@ -78,8 +78,8 @@
|
|||
#include "r_opengl/r_opengl.h"
|
||||
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
static GLfloat viewMatrix[16];
|
||||
static GLfloat projMatrix[16];
|
||||
static GLdouble viewMatrix[16];
|
||||
static GLdouble projMatrix[16];
|
||||
float frustum[6][4];
|
||||
#endif
|
||||
|
||||
|
@ -320,12 +320,12 @@ void gld_clipper_Clear(void)
|
|||
|
||||
#define RMUL (1.6f/1.333333f)
|
||||
|
||||
angle_t gld_FrustumAngle(void)
|
||||
angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
{
|
||||
double floatangle;
|
||||
angle_t a1;
|
||||
|
||||
float tilt = (float)fabs(((double)(int)aimingangle) / ANG1);
|
||||
float tilt = (float)fabs(((double)(int)tiltangle) / ANG1);
|
||||
|
||||
// NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
|
||||
|
||||
|
@ -339,7 +339,7 @@ angle_t gld_FrustumAngle(void)
|
|||
}
|
||||
|
||||
// If the pitch is larger than this you can look all around at a FOV of 90
|
||||
if (abs((signed)aimingangle) > 46 * ANG1)
|
||||
if (abs((signed)tiltangle) > 46 * ANG1)
|
||||
return 0xffffffff;
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
|
@ -352,7 +352,7 @@ angle_t gld_FrustumAngle(void)
|
|||
}
|
||||
|
||||
// SRB2CB I don't think used any of this stuff, let's disable for now since SRB2 probably doesn't want it either
|
||||
// compiler complains about (p)glGetDoublev anyway, in case anyone wants this
|
||||
// compiler complains about (p)glGetFloatv anyway, in case anyone wants this
|
||||
// only r_opengl.c can use the base gl funcs as it turns out, that's a problem for whoever wants sphere frustum checks
|
||||
// btw to renable define HAVE_SPHEREFRUSTRUM in hw_clip.h
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
|
@ -381,7 +381,7 @@ void gld_FrustrumSetup(void)
|
|||
float t;
|
||||
float clip[16];
|
||||
|
||||
pglGeFloatv(GL_PROJECTION_MATRIX, projMatrix);
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix);
|
||||
|
||||
clip[0] = CALCMATRIX(0, 0, 1, 4, 2, 8, 3, 12);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
|
||||
void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle);
|
||||
void gld_clipper_Clear(void);
|
||||
angle_t gld_FrustumAngle(void);
|
||||
angle_t gld_FrustumAngle(angle_t tiltangle);
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
void gld_FrustrumSetup(void);
|
||||
boolean gld_SphereInFrustum(float x, float y, float z, float radius);
|
||||
|
|
|
@ -1,21 +1,14 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
/// \brief defines structures and exports for the standard 3D driver DLL used by Doom Legacy
|
||||
/// \file hw_data.h
|
||||
/// \brief defines structures and exports for the hardware interface used by Sonic Robo Blast 2
|
||||
|
||||
#ifndef _HWR_DATA_
|
||||
#define _HWR_DATA_
|
||||
|
@ -27,8 +20,6 @@
|
|||
#endif
|
||||
|
||||
#include "../doomdef.h"
|
||||
//THIS MUST DISAPPEAR!!!
|
||||
#include "hw_glide.h"
|
||||
#include "../screen.h"
|
||||
|
||||
|
||||
|
@ -36,19 +27,33 @@
|
|||
// 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.
|
||||
struct GLMipmap_s
|
||||
{
|
||||
GrTexInfo grInfo; //for TexDownloadMipMap
|
||||
FxU32 flags;
|
||||
//for TexDownloadMipMap
|
||||
GLTextureFormat_t format;
|
||||
void *data;
|
||||
|
||||
UINT32 flags;
|
||||
UINT16 height;
|
||||
UINT16 width;
|
||||
UINT32 downloaded; // the dll driver have it in there cache ?
|
||||
|
||||
struct GLMipmap_s *nextcolormap;
|
||||
const UINT8 *colormap;
|
||||
INT32 tcindex;
|
||||
|
||||
// opengl
|
||||
struct GLMipmap_s *nextmipmap; // opengl : liste of all texture in opengl driver
|
||||
|
@ -59,13 +64,13 @@ typedef struct GLMipmap_s GLMipmap_t;
|
|||
//
|
||||
// Doom texture info, as cached for hardware rendering
|
||||
//
|
||||
struct GLTexture_s
|
||||
struct GLMapTexture_s
|
||||
{
|
||||
GLMipmap_t mipmap;
|
||||
float scaleX; //used for scaling textures on walls
|
||||
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
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
// 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
|
||||
/// \file hw_defs.h
|
||||
/// \brief 3D hardware renderer definitions
|
||||
|
||||
#ifndef _HWR_DEFS_
|
||||
#define _HWR_DEFS_
|
||||
#include "../doomtype.h"
|
||||
#include "../r_defs.h"
|
||||
|
||||
#define ZCLIP_PLANE 4.0f // Used for the actual game drawing
|
||||
#define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures
|
||||
|
@ -85,13 +80,15 @@ typedef struct FVector
|
|||
FLOAT x,y,z;
|
||||
} FVector;
|
||||
|
||||
// 3D model vector (coords + texture coords)
|
||||
typedef struct
|
||||
{
|
||||
//FVector Point;
|
||||
FLOAT x,y,z;
|
||||
FLOAT s,t,w; // texture coordinates
|
||||
} v3d_t, wallVert3D;
|
||||
// ======================
|
||||
// wallVert3D
|
||||
// ----------------------
|
||||
// :crab: IS GONE! :crab:
|
||||
// ======================
|
||||
|
||||
// -----------
|
||||
// structures
|
||||
// -----------
|
||||
|
||||
//Hurdler: Transform (coords + angles)
|
||||
//BP: transform order : scale(rotation_x(rotation_y(translation(v))))
|
||||
|
@ -123,15 +120,16 @@ typedef struct
|
|||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
boolean mirror; // SRB2Kart: Encore Mode
|
||||
#endif
|
||||
boolean shearing; // 14042019
|
||||
float viewaiming; // 17052019
|
||||
} FTransform;
|
||||
|
||||
// Transformed vector, as passed to HWR API
|
||||
typedef struct
|
||||
{
|
||||
FLOAT x,y,z;
|
||||
FUINT argb; // flat-shaded color
|
||||
FLOAT sow; // s texture ordinate (s over w)
|
||||
FLOAT tow; // t texture ordinate (t over w)
|
||||
FLOAT s; // s texture ordinate (s over w)
|
||||
FLOAT t; // t texture ordinate (t over w)
|
||||
} FOutVector;
|
||||
|
||||
|
||||
|
@ -162,10 +160,10 @@ enum EPolyFlags
|
|||
PF_Invisible = 0x00000400, // Disable write to color buffer
|
||||
PF_Decal = 0x00000800, // Enable polygon offset
|
||||
PF_Modulated = 0x00001000, // Modulation (multiply output with constant ARGB)
|
||||
// When set, pass the color constant into the FSurfaceInfo -> FlatColor
|
||||
// When set, pass the color constant into the FSurfaceInfo -> PolyColor
|
||||
PF_NoTexture = 0x00002000, // Use the small white texture
|
||||
PF_Corona = 0x00004000, // Tell the rendrer we are drawing a corona
|
||||
PF_Unused = 0x00008000, // Unused
|
||||
PF_Ripple = 0x00008000, // Water shader effect
|
||||
PF_RemoveYWrap = 0x00010000, // Force clamp texture on Y
|
||||
PF_ForceWrapX = 0x00020000, // Force repeat texture on X
|
||||
PF_ForceWrapY = 0x00040000, // Force repeat texture on Y
|
||||
|
@ -178,7 +176,6 @@ enum EPolyFlags
|
|||
enum ESurfFlags
|
||||
{
|
||||
SF_DYNLIGHT = 0x00000001,
|
||||
|
||||
};
|
||||
|
||||
enum ETextureFlags
|
||||
|
@ -190,38 +187,36 @@ enum ETextureFlags
|
|||
TF_TRANSPARENT = 0x00000040, // texture with some alpha == 0
|
||||
};
|
||||
|
||||
#ifdef TODO
|
||||
struct FTextureInfo
|
||||
{
|
||||
FUINT Width; // Pixels
|
||||
FUINT Height; // Pixels
|
||||
FUBYTE *TextureData; // Image data
|
||||
FUINT Format; // FORMAT_RGB, ALPHA ...
|
||||
FBITFIELD Flags; // Flags to tell driver about texture (see ETextureFlags)
|
||||
void DriverExtra; // (OpenGL texture object nr, ...)
|
||||
// chromakey enabled,...
|
||||
|
||||
struct FTextureInfo *Next; // Manage list of downloaded textures.
|
||||
};
|
||||
#else
|
||||
typedef struct GLMipmap_s FTextureInfo;
|
||||
#endif
|
||||
|
||||
// jimita 14032019
|
||||
struct FLightInfo
|
||||
{
|
||||
FUINT light_level;
|
||||
FUINT fade_start;
|
||||
FUINT fade_end;
|
||||
};
|
||||
typedef struct FLightInfo FLightInfo;
|
||||
|
||||
// Description of a renderable surface
|
||||
struct FSurfaceInfo
|
||||
{
|
||||
FUINT PolyFlags; // Surface flags -- UNUSED YET --
|
||||
RGBA_t FlatColor; // Flat-shaded color used with PF_Modulated mode
|
||||
FUINT PolyFlags;
|
||||
RGBA_t PolyColor;
|
||||
RGBA_t TintColor;
|
||||
RGBA_t FadeColor;
|
||||
FLightInfo LightInfo; // jimita 14032019
|
||||
};
|
||||
typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
|
||||
#define GL_DEFAULTMIX 0x00000000
|
||||
#define GL_DEFAULTFOG 0xFF000000
|
||||
|
||||
//Hurdler: added for backward compatibility
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
HWD_SET_MODEL_LIGHTING = 1,
|
||||
HWD_SET_FOG_MODE,
|
||||
HWD_SET_FOG_COLOR,
|
||||
HWD_SET_FOG_DENSITY,
|
||||
HWD_SET_SHADERS,
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
HWD_NUMSTATE
|
||||
|
@ -229,6 +224,15 @@ enum hwdsetspecialstate
|
|||
|
||||
typedef enum hwdsetspecialstate hwdspecialstate_t;
|
||||
|
||||
// Lactozilla: Shader info
|
||||
// Generally set at the start of the frame.
|
||||
enum hwdshaderinfo
|
||||
{
|
||||
HWD_SHADERINFO_LEVELTIME = 1,
|
||||
};
|
||||
|
||||
typedef enum hwdshaderinfo hwdshaderinfo_t;
|
||||
|
||||
enum hwdfiltermode
|
||||
{
|
||||
HWD_SET_TEXTUREFILTER_POINTSAMPLED,
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2005 by Sonic Team Junior.
|
||||
//
|
||||
// Copyright (C) 2005 by SRB2 Jr. 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.
|
||||
// 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
|
||||
/// \file hw_dll.h
|
||||
/// \brief Win32 DLL and Shared Objects API definitions
|
||||
|
||||
#ifndef __HWR_DLL_H__
|
||||
|
@ -54,8 +47,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
typedef void (*I_Error_t) (const char *error, ...) FUNCIERROR;
|
||||
|
||||
// ==========================================================================
|
||||
// MATHS
|
||||
// ==========================================================================
|
||||
|
@ -63,7 +54,7 @@ typedef void (*I_Error_t) (const char *error, ...) FUNCIERROR;
|
|||
// Constants
|
||||
#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360
|
||||
|
||||
void DBG_Printf(const char *lpFmt, ...) /*FUNCPRINTF*/;
|
||||
void GL_DBG_Printf(const char *format, ...) /*FUNCPRINTF*/;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
// 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
|
||||
/// \file hw_draw.c
|
||||
/// \brief miscellaneous drawing (mainly 2d)
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
@ -23,6 +17,7 @@
|
|||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
|
||||
|
@ -43,9 +38,6 @@
|
|||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
float gr_patch_scalex;
|
||||
float gr_patch_scaley;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
@ -65,9 +57,6 @@ typedef struct
|
|||
#if defined(_MSC_VER)
|
||||
#pragma pack()
|
||||
#endif
|
||||
typedef UINT8 GLRGB[3];
|
||||
|
||||
#define BLENDMODE PF_Translucent
|
||||
|
||||
static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
||||
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
||||
|
@ -121,12 +110,12 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
|||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = gpatch->max_s;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = gpatch->max_t;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = gpatch->max_s;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
|
||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
if (option & V_WRAPX)
|
||||
flags |= PF_ForceWrapX;
|
||||
|
@ -291,7 +280,7 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
||||
{
|
||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
patch_t *realpatch = W_CacheSoftwarePatchNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
|
||||
if (!column->topdelta)
|
||||
{
|
||||
|
@ -356,19 +345,19 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
|
||||
if (option & V_FLIP)
|
||||
{
|
||||
v[0].sow = v[3].sow = gpatch->max_s;
|
||||
v[2].sow = v[1].sow = 0.0f;
|
||||
v[0].s = v[3].s = gpatch->max_s;
|
||||
v[2].s = v[1].s = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = gpatch->max_s;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = gpatch->max_s;
|
||||
}
|
||||
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = gpatch->max_t;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
|
||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
if (option & V_WRAPX)
|
||||
flags |= PF_ForceWrapX;
|
||||
|
@ -379,11 +368,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
if (alphalevel)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff;
|
||||
if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
|
@ -450,7 +439,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
||||
{
|
||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
patch_t *realpatch = W_CacheSoftwarePatchNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
|
||||
if (!column->topdelta)
|
||||
{
|
||||
|
@ -514,19 +503,19 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = ((sx )/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
v[0].s = v[3].s = ((sx )/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
if (sx + w > SHORT(gpatch->width))
|
||||
v[2].sow = v[1].sow = gpatch->max_s;
|
||||
v[2].s = v[1].s = gpatch->max_s;
|
||||
else
|
||||
v[2].sow = v[1].sow = ((sx+w)/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
v[2].s = v[1].s = ((sx+w)/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
|
||||
v[0].tow = v[1].tow = ((sy )/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
v[0].t = v[1].t = ((sy )/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
if (sy + h > SHORT(gpatch->height))
|
||||
v[2].tow = v[3].tow = gpatch->max_t;
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
else
|
||||
v[2].tow = v[3].tow = ((sy+h)/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
v[2].t = v[3].t = ((sy+h)/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
|
||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
if (option & V_WRAPX)
|
||||
flags |= PF_ForceWrapX;
|
||||
|
@ -537,11 +526,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
if (alphalevel)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff;
|
||||
if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
|
@ -569,10 +558,10 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
|||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0;
|
||||
v[2].sow = v[1].sow = patch->max_s;
|
||||
v[0].tow = v[1].tow = 0;
|
||||
v[2].tow = v[3].tow = patch->max_t;
|
||||
v[0].s = v[3].s = 0;
|
||||
v[2].s = v[1].s = patch->max_s;
|
||||
v[0].t = v[1].t = 0;
|
||||
v[2].t = v[3].t = patch->max_t;
|
||||
|
||||
|
||||
//Hurdler: Boris, the same comment as above... but maybe for pics
|
||||
|
@ -581,7 +570,7 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
|||
// But then, the question is: why not 0 instead of PF_Masked ?
|
||||
// or maybe PF_Environment ??? (like what I said above)
|
||||
// BP: PF_Environment don't change anything ! and 0 is undifined
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, BLENDMODE | PF_NoDepthTest | PF_Clip | PF_NoZClip);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_Translucent | PF_NoDepthTest | PF_Clip | PF_NoZClip);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
@ -644,10 +633,10 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
|||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
// flat is 64x64 lod and texture offsets are [0.0, 1.0]
|
||||
v[0].sow = v[3].sow = (float)((x & flatflag)/dflatsize);
|
||||
v[2].sow = v[1].sow = (float)(v[0].sow + w/dflatsize);
|
||||
v[0].tow = v[1].tow = (float)((y & flatflag)/dflatsize);
|
||||
v[2].tow = v[3].tow = (float)(v[0].tow + h/dflatsize);
|
||||
v[0].s = v[3].s = (float)((x & flatflag)/dflatsize);
|
||||
v[2].s = v[1].s = (float)(v[0].s + w/dflatsize);
|
||||
v[0].t = v[1].t = (float)((y & flatflag)/dflatsize);
|
||||
v[2].t = v[3].t = (float)(v[0].t + h/dflatsize);
|
||||
|
||||
HWR_LiterallyGetFlat(flatlumpnum);
|
||||
|
||||
|
@ -679,20 +668,20 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
|||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 1.0f;
|
||||
v[2].tow = v[3].tow = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.FlatColor.s.alpha = (strength*8);
|
||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = V_GetColor(color).rgba;
|
||||
Surf.FlatColor.s.alpha = softwaretranstogl[strength];
|
||||
Surf.PolyColor.rgba = V_GetColor(color).rgba;
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -850,24 +839,22 @@ void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 ac
|
|||
v[0].y = v[1].y = fy;
|
||||
v[2].y = v[3].y = fy - fh;
|
||||
|
||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = 1.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = 1.0f;
|
||||
|
||||
if (actualcolor & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.FlatColor.s.alpha = (strength*8);
|
||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = V_GetColor(actualcolor).rgba;
|
||||
Surf.FlatColor.s.alpha = softwaretranstogl[strength];
|
||||
Surf.PolyColor.rgba = V_GetColor(actualcolor).rgba;
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -888,13 +875,13 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
|||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 1.0f;
|
||||
v[2].tow = v[3].tow = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
Surf.FlatColor.rgba = UINT2RGBA(color);
|
||||
Surf.FlatColor.s.alpha = 0x80;
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -904,7 +891,11 @@ void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight)
|
|||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
INT32 height = (boxheight * 4) + (boxheight/2)*5; // 4 lines of space plus gaps between and some leeway
|
||||
INT32 height;
|
||||
if (boxheight < 0)
|
||||
height = -boxheight;
|
||||
else
|
||||
height = (boxheight * 4) + (boxheight/2)*5; // 4 lines of space plus gaps between and some leeway
|
||||
|
||||
// setup some neat-o translucency effect
|
||||
|
||||
|
@ -914,13 +905,13 @@ void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight)
|
|||
v[2].y = v[3].y = -1.0f+((height<<1)/(float)vid.height);
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 1.0f;
|
||||
v[2].tow = v[3].tow = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
Surf.FlatColor.rgba = UINT2RGBA(color);
|
||||
Surf.FlatColor.s.alpha = (color == 0 ? 0xC0 : 0x80); // make black darker, like software
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = (color == 0 ? 0xC0 : 0x80); // make black darker, like software
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -945,17 +936,17 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
INT32 basewindowx, basewindowy;
|
||||
GLPatch_t *patch;
|
||||
|
||||
// if (gr_viewwidth == vid.width)
|
||||
// if (gl_viewwidth == vid.width)
|
||||
// return;
|
||||
|
||||
if (!clearlines)
|
||||
clearlines = BASEVIDHEIGHT; // refresh all
|
||||
|
||||
// calc view size based on original game resolution
|
||||
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
|
||||
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy));
|
||||
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy));
|
||||
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwindowx), vid.fdupx));
|
||||
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
|
||||
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
|
||||
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
|
||||
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwindowx), vid.fdupx));
|
||||
|
||||
// top
|
||||
HWR_DrawFlatFill(0, 0,
|
||||
|
@ -1232,17 +1223,15 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32
|
|||
v[0].y = v[1].y = fy;
|
||||
v[2].y = v[3].y = fy - fh;
|
||||
|
||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = 1.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = 1.0f;
|
||||
|
||||
Surf.FlatColor.rgba = UINT2RGBA(actualcolor);
|
||||
Surf.FlatColor.s.alpha = 0x80;
|
||||
Surf.PolyColor.rgba = UINT2RGBA(actualcolor);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -1412,16 +1401,14 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
v[0].y = v[1].y = fy;
|
||||
v[2].y = v[3].y = fy - fh;
|
||||
|
||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = 1.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = 1.0f;
|
||||
|
||||
Surf.FlatColor = V_GetColor(color);
|
||||
Surf.PolyColor = V_GetColor(color);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
/// \file hw_drv.h
|
||||
/// \brief imports/exports for the 3D hardware low-level interface API
|
||||
|
||||
#ifndef __HWR_DRV_H__
|
||||
|
@ -32,7 +25,7 @@
|
|||
// STANDARD DLL EXPORTS
|
||||
// ==========================================================================
|
||||
|
||||
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
||||
EXPORT boolean HWRAPI(Init) (void);
|
||||
#ifndef HAVE_SDL
|
||||
EXPORT void HWRAPI(Shutdown) (void);
|
||||
#endif
|
||||
|
@ -43,10 +36,12 @@ EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal);
|
|||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, UINT32 *IndexArray);
|
||||
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *TexInfo);
|
||||
EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height, INT32 dst_stride, UINT16 *dst_data);
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip);
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||
|
@ -55,14 +50,11 @@ EXPORT void HWRAPI(ClearMipMapCache) (void);
|
|||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||
|
||||
//Hurdler: added for new development
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 *color);
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *ptransform);
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||
EXPORT INT32 HWRAPI(GetRenderVersion) (void);
|
||||
|
||||
#define SCREENVERTS 10
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
EXPORT void HWRAPI(StartScreenWipe) (void);
|
||||
EXPORT void HWRAPI(EndScreenWipe) (void);
|
||||
|
@ -71,6 +63,20 @@ EXPORT void HWRAPI(DrawIntermissionBG) (void);
|
|||
EXPORT void HWRAPI(MakeScreenTexture) (void);
|
||||
EXPORT void HWRAPI(MakeScreenFinalTexture) (void);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height);
|
||||
|
||||
#define SCREENVERTS 10
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
// jimita
|
||||
EXPORT boolean HWRAPI(LoadShaders) (void);
|
||||
EXPORT void HWRAPI(KillShaders) (void);
|
||||
EXPORT void HWRAPI(SetShader) (int shader);
|
||||
EXPORT void HWRAPI(UnSetShader) (void);
|
||||
|
||||
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
|
||||
EXPORT void HWRAPI(LoadCustomShader) (int number, char *shader, size_t size, boolean fragment);
|
||||
EXPORT boolean HWRAPI(InitCustomShaders) (void);
|
||||
|
||||
// ==========================================================================
|
||||
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
|
||||
// ==========================================================================
|
||||
|
@ -84,10 +90,12 @@ struct hwdriver_s
|
|||
FinishUpdate pfnFinishUpdate;
|
||||
Draw2DLine pfnDraw2DLine;
|
||||
DrawPolygon pfnDrawPolygon;
|
||||
DrawIndexedTriangles pfnDrawIndexedTriangles;
|
||||
RenderSkyDome pfnRenderSkyDome;
|
||||
SetBlend pfnSetBlend;
|
||||
ClearBuffer pfnClearBuffer;
|
||||
SetTexture pfnSetTexture;
|
||||
UpdateTexture pfnUpdateTexture;
|
||||
ReadRect pfnReadRect;
|
||||
GClipRect pfnGClipRect;
|
||||
ClearMipMapCache pfnClearMipMapCache;
|
||||
|
@ -96,7 +104,6 @@ struct hwdriver_s
|
|||
CreateModelVBOs pfnCreateModelVBOs;
|
||||
SetTransform pfnSetTransform;
|
||||
GetTextureUsed pfnGetTextureUsed;
|
||||
GetRenderVersion pfnGetRenderVersion;
|
||||
#ifdef _WINDOWS
|
||||
GetModeList pfnGetModeList;
|
||||
#endif
|
||||
|
@ -112,13 +119,19 @@ struct hwdriver_s
|
|||
MakeScreenTexture pfnMakeScreenTexture;
|
||||
MakeScreenFinalTexture pfnMakeScreenFinalTexture;
|
||||
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
|
||||
|
||||
LoadShaders pfnLoadShaders;
|
||||
KillShaders pfnKillShaders;
|
||||
SetShader pfnSetShader;
|
||||
UnSetShader pfnUnSetShader;
|
||||
|
||||
SetShaderInfo pfnSetShaderInfo;
|
||||
LoadCustomShader pfnLoadCustomShader;
|
||||
InitCustomShaders pfnInitCustomShaders;
|
||||
};
|
||||
|
||||
extern struct hwdriver_s hwdriver;
|
||||
|
||||
//Hurdler: 16/10/99: added for OpenGL gamma correction
|
||||
//extern RGBA_t gamma_correction;
|
||||
|
||||
#define HWD hwdriver
|
||||
|
||||
#endif //not defined _CREATE_DLL_
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 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 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 GrAspectRatio_t;
|
||||
#define GR_ASPECT_LOG2_8x1 3 /* 8W x 1H */
|
||||
#define GR_ASPECT_LOG2_4x1 2 /* 4W x 1H */
|
||||
#define GR_ASPECT_LOG2_2x1 1 /* 2W x 1H */
|
||||
#define GR_ASPECT_LOG2_1x1 0 /* 1W x 1H */
|
||||
#define GR_ASPECT_LOG2_1x2 -1 /* 1W x 2H */
|
||||
#define GR_ASPECT_LOG2_1x4 -2 /* 1W x 4H */
|
||||
#define GR_ASPECT_LOG2_1x8 -3 /* 1W x 8H */
|
||||
|
||||
typedef FxI32 GrLOD_t;
|
||||
#define GR_LOD_LOG2_256 0x8
|
||||
#define GR_LOD_LOG2_128 0x7
|
||||
#define GR_LOD_LOG2_64 0x6
|
||||
#define GR_LOD_LOG2_32 0x5
|
||||
#define GR_LOD_LOG2_16 0x4
|
||||
#define GR_LOD_LOG2_8 0x3
|
||||
#define GR_LOD_LOG2_4 0x2
|
||||
#define GR_LOD_LOG2_2 0x1
|
||||
#define GR_LOD_LOG2_1 0x0
|
||||
|
||||
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
|
||||
{
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
GrLOD_t smallLodLog2;
|
||||
GrLOD_t largeLodLog2;
|
||||
GrAspectRatio_t aspectRatioLog2;
|
||||
#endif
|
||||
GrTextureFormat_t format;
|
||||
void *data;
|
||||
} GrTexInfo;
|
||||
|
||||
#endif // __GLIDE_H__ (defined in <glide.h>)
|
||||
|
||||
#endif // _GLIDE_H_
|
|
@ -1,20 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
/// \file hw_glob.h
|
||||
/// \brief globals (shared data & code) for hw_ modules
|
||||
|
||||
#ifndef _HWR_GLOB_H_
|
||||
|
@ -66,25 +59,23 @@ typedef struct
|
|||
|
||||
// needed for sprite rendering
|
||||
// equivalent of the software renderer's vissprites
|
||||
typedef struct gr_vissprite_s
|
||||
typedef struct gl_vissprite_s
|
||||
{
|
||||
// Doubly linked list
|
||||
struct gr_vissprite_s *prev;
|
||||
struct gr_vissprite_s *next;
|
||||
float x1, x2;
|
||||
float tz, ty;
|
||||
float tracertz; // for MF2_LINKDRAW sprites, this contains tracer's tz for use in sorting
|
||||
//lumpnum_t patchlumpnum;
|
||||
GLPatch_t *gpatch;
|
||||
boolean flip;
|
||||
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 vflip;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
UINT8 *colormap;
|
||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||
float z1, z2;
|
||||
} gr_vissprite_t;
|
||||
} gl_vissprite_t;
|
||||
|
||||
// --------
|
||||
// hw_bsp.c
|
||||
|
@ -105,7 +96,7 @@ void HWR_FreeExtraSubsectors(void);
|
|||
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat);
|
||||
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_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
|
||||
|
@ -118,11 +109,6 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
|||
// --------
|
||||
// hw_draw.c
|
||||
// --------
|
||||
extern float gr_patch_scalex;
|
||||
extern float gr_patch_scaley;
|
||||
|
||||
extern consvar_t cv_grrounddown; // on/off
|
||||
|
||||
extern INT32 patchformat;
|
||||
extern INT32 textureformat;
|
||||
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
// 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
|
||||
/// \file hw_light.c
|
||||
/// \brief Corona/Dynamic/Static lighting add on by Hurdler
|
||||
/// !!! Under construction !!!
|
||||
|
||||
|
@ -298,6 +292,8 @@ light_t *t_lspr[NUMSPRITES] =
|
|||
|
||||
// Projectiles
|
||||
&lspr[NOLIGHT], // SPR_MISL
|
||||
&lspr[SMALLREDBALL_L], // SPR_LASR
|
||||
&lspr[REDSHINE_L], // SPR_LASF
|
||||
&lspr[NOLIGHT], // SPR_TORP
|
||||
&lspr[NOLIGHT], // SPR_ENRG
|
||||
&lspr[NOLIGHT], // SPR_MINE
|
||||
|
@ -509,6 +505,7 @@ light_t *t_lspr[NUMSPRITES] =
|
|||
&lspr[NOLIGHT], // SPR_LCKN
|
||||
&lspr[NOLIGHT], // SPR_TTAG
|
||||
&lspr[NOLIGHT], // SPR_GFLG
|
||||
&lspr[NOLIGHT], // SPR_FNSF
|
||||
|
||||
&lspr[NOLIGHT], // SPR_CORK
|
||||
&lspr[NOLIGHT], // SPR_LHRT
|
||||
|
@ -608,6 +605,9 @@ light_t *t_lspr[NUMSPRITES] =
|
|||
&lspr[NOLIGHT], // SPR_GFZD
|
||||
&lspr[NOLIGHT], // SPR_BRIC
|
||||
&lspr[NOLIGHT], // SPR_WDDB
|
||||
&lspr[NOLIGHT], // SPR_BRIR
|
||||
&lspr[NOLIGHT], // SPR_BRIB
|
||||
&lspr[NOLIGHT], // SPR_BRIY
|
||||
|
||||
// Gravity Well Objects
|
||||
&lspr[NOLIGHT], // SPR_GWLG
|
||||
|
@ -821,7 +821,7 @@ void HWR_WallLighting(FOutVector *wlVerts)
|
|||
{
|
||||
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++)
|
||||
{
|
||||
FVector inter;
|
||||
|
@ -876,19 +876,19 @@ void HWR_WallLighting(FOutVector *wlVerts)
|
|||
#endif
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
wlVerts[i].sow = (float)(0.5f + d[i]*s);
|
||||
wlVerts[i].tow = (float)(0.5f + (wlVerts[i].y-LIGHT_POS(j).y)*s*1.2f);
|
||||
wlVerts[i].s = (float)(0.5f + d[i]*s);
|
||||
wlVerts[i].t = (float)(0.5f + (wlVerts[i].y-LIGHT_POS(j).y)*s*1.2f);
|
||||
}
|
||||
|
||||
HWR_SetLight();
|
||||
|
||||
Surf.FlatColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color);
|
||||
Surf.PolyColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color);
|
||||
#ifdef DL_HIGH_QUALITY
|
||||
Surf.FlatColor.s.alpha = (UINT8)((1-dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha);
|
||||
Surf.PolyColor.s.alpha = (UINT8)((1-dist_p2d/DL_SQRRADIUS(j))*Surf.PolyColor.s.alpha);
|
||||
#endif
|
||||
// next state is null so fade out with alpha
|
||||
if (dynlights->mo[j]->state->nextstate == S_NULL)
|
||||
Surf.FlatColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha);
|
||||
Surf.PolyColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.PolyColor.s.alpha);
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, wlVerts, 4, LIGHTMAPFLAGS);
|
||||
|
||||
|
@ -945,19 +945,19 @@ void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts)
|
|||
#endif
|
||||
for (i = 0; i < nrClipVerts; i++)
|
||||
{
|
||||
clVerts[i].sow = 0.5f + (clVerts[i].x-LIGHT_POS(j).x)*s;
|
||||
clVerts[i].tow = 0.5f + (clVerts[i].z-LIGHT_POS(j).z)*s*1.2f;
|
||||
clVerts[i].s = 0.5f + (clVerts[i].x-LIGHT_POS(j).x)*s;
|
||||
clVerts[i].t = 0.5f + (clVerts[i].z-LIGHT_POS(j).z)*s*1.2f;
|
||||
}
|
||||
|
||||
HWR_SetLight();
|
||||
|
||||
Surf.FlatColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color);
|
||||
Surf.PolyColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color);
|
||||
#ifdef DL_HIGH_QUALITY
|
||||
Surf.FlatColor.s.alpha = (unsigned char)((1 - dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha);
|
||||
Surf.PolyColor.s.alpha = (unsigned char)((1 - dist_p2d/DL_SQRRADIUS(j))*Surf.PolyColor.s.alpha);
|
||||
#endif
|
||||
// next state is null so fade out with alpha
|
||||
if ((dynlights->mo[j]->state->nextstate == S_NULL))
|
||||
Surf.FlatColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha);
|
||||
Surf.PolyColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.PolyColor.s.alpha);
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, clVerts, nrClipVerts, LIGHTMAPFLAGS);
|
||||
|
||||
|
@ -970,7 +970,7 @@ static lumpnum_t coronalumpnum = LUMPERROR;
|
|||
// --------------------------------------------------------------------------
|
||||
// coronas lighting
|
||||
// --------------------------------------------------------------------------
|
||||
void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
|
||||
void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr)
|
||||
{
|
||||
light_t *p_lspr;
|
||||
|
||||
|
@ -985,7 +985,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
|
|||
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
|
||||
FOutVector light[4];
|
||||
FSurfaceInfo Surf;
|
||||
|
@ -1010,7 +1010,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
|
|||
}
|
||||
if (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
|
||||
for (i = 0; i < 4; i++)
|
||||
|
@ -1024,11 +1024,11 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
|
|||
// more realistique corona !
|
||||
if (cz >= 255*8+250)
|
||||
return;
|
||||
Surf.FlatColor.rgba = p_lspr->corona_color;
|
||||
Surf.PolyColor.rgba = p_lspr->corona_color;
|
||||
if (cz > 250.0f)
|
||||
Surf.FlatColor.s.alpha = 0xff-((int)cz-250)/8;
|
||||
Surf.PolyColor.s.alpha = 0xff-((int)cz-250)/8;
|
||||
else
|
||||
Surf.FlatColor.s.alpha = 0xff;
|
||||
Surf.PolyColor.s.alpha = 0xff;
|
||||
|
||||
// do not be hide by sprite of the light itself !
|
||||
cz = cz - 2.0f;
|
||||
|
@ -1040,19 +1040,19 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
|
|||
// car comme l'offset est minime sa ce voit pas !
|
||||
light[0].x = cx-size; light[0].z = cz;
|
||||
light[0].y = cy-size*1.33f+p_lspr->light_yoffset;
|
||||
light[0].sow = 0.0f; light[0].tow = 0.0f;
|
||||
light[0].s = 0.0f; light[0].t = 0.0f;
|
||||
|
||||
light[1].x = cx+size; light[1].z = cz;
|
||||
light[1].y = cy-size*1.33f+p_lspr->light_yoffset;
|
||||
light[1].sow = 1.0f; light[1].tow = 0.0f;
|
||||
light[1].s = 1.0f; light[1].t = 0.0f;
|
||||
|
||||
light[2].x = cx+size; light[2].z = cz;
|
||||
light[2].y = cy+size*1.33f+p_lspr->light_yoffset;
|
||||
light[2].sow = 1.0f; light[2].tow = 1.0f;
|
||||
light[2].s = 1.0f; light[2].t = 1.0f;
|
||||
|
||||
light[3].x = cx-size; light[3].z = cz;
|
||||
light[3].y = cy+size*1.33f+p_lspr->light_yoffset;
|
||||
light[3].sow = 0.0f; light[3].tow = 1.0f;
|
||||
light[3].s = 0.0f; light[3].t = 1.0f;
|
||||
|
||||
HWR_GetPic(coronalumpnum); /// \todo use different coronas
|
||||
|
||||
|
@ -1067,7 +1067,7 @@ void HWR_DrawCoronas(void)
|
|||
{
|
||||
int j;
|
||||
|
||||
if (!cv_grcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR)
|
||||
if (!cv_glcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
HWR_GetPic(coronalumpnum); /// \todo use different coronas
|
||||
|
@ -1098,11 +1098,11 @@ void HWR_DrawCoronas(void)
|
|||
// more realistique corona !
|
||||
if (cz >= 255*8+250)
|
||||
continue;
|
||||
Surf.FlatColor.rgba = p_lspr->corona_color;
|
||||
Surf.PolyColor.rgba = p_lspr->corona_color;
|
||||
if (cz > 250.0f)
|
||||
Surf.FlatColor.s.alpha = (UINT8)(0xff-(UINT8)(((int)cz-250)/8));
|
||||
Surf.PolyColor.s.alpha = (UINT8)(0xff-(UINT8)(((int)cz-250)/8));
|
||||
else
|
||||
Surf.FlatColor.s.alpha = 0xff;
|
||||
Surf.PolyColor.s.alpha = 0xff;
|
||||
|
||||
switch (p_lspr->type)
|
||||
{
|
||||
|
@ -1110,7 +1110,7 @@ void HWR_DrawCoronas(void)
|
|||
size = p_lspr->corona_radius * ((cz+120.0f)/950.0f); // d'ou vienne ces constante ?
|
||||
break;
|
||||
case ROCKET_SPR:
|
||||
Surf.FlatColor.s.alpha = (UINT8)((M_RandomByte()>>1)&0xff);
|
||||
Surf.PolyColor.s.alpha = (UINT8)((M_RandomByte()>>1)&0xff);
|
||||
// don't need a break
|
||||
case CORONA_SPR:
|
||||
size = p_lspr->corona_radius * ((cz+60.0f)/100.0f); // d'ou vienne ces constante ?
|
||||
|
@ -1121,7 +1121,7 @@ void HWR_DrawCoronas(void)
|
|||
}
|
||||
if (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
|
||||
// z-buffer problem (coplanar polygons)
|
||||
|
@ -1130,19 +1130,19 @@ void HWR_DrawCoronas(void)
|
|||
|
||||
light[0].x = cx-size; light[0].z = cz;
|
||||
light[0].y = cy-size*1.33f;
|
||||
light[0].sow = 0.0f; light[0].tow = 0.0f;
|
||||
light[0].s = 0.0f; light[0].t = 0.0f;
|
||||
|
||||
light[1].x = cx+size; light[1].z = cz;
|
||||
light[1].y = cy-size*1.33f;
|
||||
light[1].sow = 1.0f; light[1].tow = 0.0f;
|
||||
light[1].s = 1.0f; light[1].t = 0.0f;
|
||||
|
||||
light[2].x = cx+size; light[2].z = cz;
|
||||
light[2].y = cy+size*1.33f;
|
||||
light[2].sow = 1.0f; light[2].tow = 1.0f;
|
||||
light[2].s = 1.0f; light[2].t = 1.0f;
|
||||
|
||||
light[3].x = cx-size; light[3].z = cz;
|
||||
light[3].y = cy+size*1.33f;
|
||||
light[3].sow = 0.0f; light[3].tow = 1.0f;
|
||||
light[3].s = 0.0f; light[3].t = 1.0f;
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_NoDepthTest | PF_Corona);
|
||||
}
|
||||
|
@ -1170,13 +1170,13 @@ void HWR_SetLights(int viewnumber)
|
|||
// Add a light for dynamic lighting
|
||||
// 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;
|
||||
|
||||
//Hurdler: moved here because it's better;-)
|
||||
(void)patch;
|
||||
if (!cv_grdynamiclighting.value)
|
||||
if (!cv_gldynamiclighting.value)
|
||||
return;
|
||||
|
||||
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];
|
||||
if (!(p_lspr->type & DYNLIGHT_SPR))
|
||||
return;
|
||||
if ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value)
|
||||
if ((p_lspr->type != LIGHT_SPR) || cv_glstaticlighting.value)
|
||||
return;
|
||||
|
||||
LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x);
|
||||
|
@ -1229,10 +1229,10 @@ static void HWR_SetLight(void)
|
|||
{
|
||||
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++)
|
||||
{
|
||||
|
@ -1245,23 +1245,18 @@ static void HWR_SetLight(void)
|
|||
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.height = 128;
|
||||
lightmappatch.mipmap->width = 128;
|
||||
lightmappatch.mipmap->height = 128;
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
lightmappatch.mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_128;
|
||||
lightmappatch.mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_128;
|
||||
lightmappatch.mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
lightmappatch.mipmap->flags = 0; //TF_WRAPXY; // DEBUG: view the overdraw !
|
||||
}
|
||||
HWD.pfnSetTexture(lightmappatch.mipmap);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
//**********************************************************
|
||||
|
@ -1270,8 +1265,8 @@ static void HWR_SetLight(void)
|
|||
|
||||
#ifdef STATICLIGHT
|
||||
// is this really necessary?
|
||||
static sector_t *lgr_backsector;
|
||||
static seg_t *lgr_curline;
|
||||
static sector_t *lgl_backsector;
|
||||
static seg_t *lgl_curline;
|
||||
#endif
|
||||
|
||||
// p1 et p2 c'est le deux bou du seg en float
|
||||
|
@ -1309,27 +1304,27 @@ static void HWR_AddLightMapForLine(int lightnum, seg_t *line)
|
|||
*/
|
||||
FVector p1,p2;
|
||||
|
||||
lgr_curline = line;
|
||||
lgr_backsector = line->backsector;
|
||||
lgl_curline = line;
|
||||
lgl_backsector = line->backsector;
|
||||
|
||||
// Reject empty lines used for triggers and special events.
|
||||
// Identical floor and ceiling on both sides,
|
||||
// identical light levels on both sides,
|
||||
// and no middle texture.
|
||||
/*
|
||||
if ( lgr_backsector->ceilingpic == gr_frontsector->ceilingpic
|
||||
&& lgr_backsector->floorpic == gr_frontsector->floorpic
|
||||
&& lgr_backsector->lightlevel == gr_frontsector->lightlevel
|
||||
&& lgr_curline->sidedef->midtexture == 0)
|
||||
if ( lgl_backsector->ceilingpic == gl_frontsector->ceilingpic
|
||||
&& lgl_backsector->floorpic == gl_frontsector->floorpic
|
||||
&& lgl_backsector->lightlevel == gl_frontsector->lightlevel
|
||||
&& lgl_curline->sidedef->midtexture == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
p1.y = FIXED_TO_FLOAT(lgr_curline->v1->y);
|
||||
p1.x = FIXED_TO_FLOAT(lgr_curline->v1->x);
|
||||
p2.y = FIXED_TO_FLOAT(lgr_curline->v2->y);
|
||||
p2.x = FIXED_TO_FLOAT(lgr_curline->v2->x);
|
||||
p1.y = FIXED_TO_FLOAT(lgl_curline->v1->y);
|
||||
p1.x = FIXED_TO_FLOAT(lgl_curline->v1->x);
|
||||
p2.y = FIXED_TO_FLOAT(lgl_curline->v2->y);
|
||||
p2.x = FIXED_TO_FLOAT(lgl_curline->v2->x);
|
||||
|
||||
// check bbox of the seg
|
||||
// if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false)
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
// 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
|
||||
/// \file hw_light.h
|
||||
/// \brief Dynamic lighting & coronas add on by Hurdler
|
||||
|
||||
#ifndef _HW_LIGHTS_
|
||||
|
@ -30,7 +24,7 @@
|
|||
#define DL_MAX_LIGHT 256 // maximum number of lights (extra lights are ignored)
|
||||
|
||||
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_WallLighting(FOutVector *wlVerts);
|
||||
void HWR_ResetLights(void);
|
||||
|
@ -39,7 +33,7 @@ void HWR_SetLights(int viewnumber);
|
|||
#ifdef NEWCORONAS
|
||||
void HWR_DrawCoronas(void);
|
||||
#else
|
||||
void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr);
|
||||
void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr);
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,20 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
/// \file hw_main.h
|
||||
/// \brief 3D render mode functions
|
||||
|
||||
#ifndef __HWR_MAIN_H__
|
||||
|
@ -59,7 +52,6 @@ boolean HWR_Screenshot(const char *pathname);
|
|||
|
||||
void HWR_AddCommands(void);
|
||||
void HWR_AddSessionCommands(void);
|
||||
void HWR_CorrectSWTricks(void);
|
||||
void transform(float *cx, float *cy, float *cz);
|
||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
INT32 HWR_GetTextureUsed(void);
|
||||
|
@ -73,39 +65,63 @@ void HWR_MakeScreenFinalTexture(void);
|
|||
void HWR_DrawScreenFinalTexture(int width, int height);
|
||||
|
||||
// This stuff is put here so MD2's can use them
|
||||
UINT32 HWR_Lighting(INT32 light, UINT32 color, UINT32 fadecolor, boolean fogblockpoly, boolean plane);
|
||||
FUNCMATH UINT8 LightLevelToLum(INT32 l);
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap);
|
||||
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work
|
||||
|
||||
void HWR_ReadShaders(UINT16 wadnum, boolean PK3);
|
||||
boolean HWR_LoadShaders(void);
|
||||
|
||||
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
||||
|
||||
#ifdef ALAM_LIGHTING
|
||||
extern consvar_t cv_grdynamiclighting;
|
||||
extern consvar_t cv_grstaticlighting;
|
||||
extern consvar_t cv_grcoronas;
|
||||
extern consvar_t cv_grcoronasize;
|
||||
extern consvar_t cv_gldynamiclighting;
|
||||
extern consvar_t cv_glstaticlighting;
|
||||
extern consvar_t cv_glcoronas;
|
||||
extern consvar_t cv_glcoronasize;
|
||||
#endif
|
||||
extern consvar_t cv_grmodels;
|
||||
extern consvar_t cv_grmodelinterpolation;
|
||||
extern consvar_t cv_grmodellighting;
|
||||
extern consvar_t cv_grfog;
|
||||
extern consvar_t cv_grfogcolor;
|
||||
extern consvar_t cv_grfogdensity;
|
||||
extern consvar_t cv_grsoftwarefog;
|
||||
extern consvar_t cv_grfiltermode;
|
||||
extern consvar_t cv_granisotropicmode;
|
||||
extern consvar_t cv_grcorrecttricks;
|
||||
|
||||
extern consvar_t cv_glshaders;
|
||||
extern consvar_t cv_glmodels;
|
||||
extern consvar_t cv_glmodelinterpolation;
|
||||
extern consvar_t cv_glmodellighting;
|
||||
extern consvar_t cv_glfiltermode;
|
||||
extern consvar_t cv_glanisotropicmode;
|
||||
extern consvar_t cv_fovchange;
|
||||
extern consvar_t cv_grsolvetjoin;
|
||||
extern consvar_t cv_grspritebillboarding;
|
||||
extern consvar_t cv_grskydome;
|
||||
extern consvar_t cv_grfakecontrast;
|
||||
extern consvar_t cv_glsolvetjoin;
|
||||
extern consvar_t cv_glshearing;
|
||||
extern consvar_t cv_glspritebillboarding;
|
||||
extern consvar_t cv_glskydome;
|
||||
extern consvar_t cv_glfakecontrast;
|
||||
extern consvar_t cv_glslopecontrast;
|
||||
|
||||
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy;
|
||||
extern consvar_t cv_glbatching;
|
||||
|
||||
extern float gr_viewwindowx, gr_basewindowcentery;
|
||||
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowy;
|
||||
|
||||
extern float gl_viewwindowx, gl_basewindowcentery;
|
||||
|
||||
// BP: big hack for a test in lighting ref : 1249753487AB
|
||||
extern fixed_t *hwbbox;
|
||||
extern FTransform atransform;
|
||||
|
||||
|
||||
// Render stats
|
||||
extern int rs_hw_nodesorttime;
|
||||
extern int rs_hw_nodedrawtime;
|
||||
extern int rs_hw_spritesorttime;
|
||||
extern int rs_hw_spritedrawtime;
|
||||
|
||||
// Render stats for batching
|
||||
extern int rs_hw_numpolys;
|
||||
extern int rs_hw_numverts;
|
||||
extern int rs_hw_numcalls;
|
||||
extern int rs_hw_numshaders;
|
||||
extern int rs_hw_numtextures;
|
||||
extern int rs_hw_numpolyflags;
|
||||
extern int rs_hw_numcolors;
|
||||
extern int rs_hw_batchsorttime;
|
||||
extern int rs_hw_batchdrawtime;
|
||||
|
||||
extern boolean gl_shadersavailable;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,23 +1,16 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
// 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
|
||||
/// \brief MD2 Handling
|
||||
/// \file hw_md2.c
|
||||
/// \brief 3D Model Handling
|
||||
/// Inspired from md2.c by Mete Ciragan (mete@swissquake.ch)
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -148,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);
|
||||
}
|
||||
|
||||
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_infop png_info_ptr;
|
||||
|
@ -198,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);
|
||||
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
|
||||
fclose(png_FILE);
|
||||
Z_Free(grpatch->mipmap->grInfo.data);
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
return 0;
|
||||
}
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
|
@ -239,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_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));
|
||||
for (i = 0; i < height; i++)
|
||||
row_pointers[i] = PNG_image + i*pitch;
|
||||
|
@ -252,7 +245,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
|||
fclose(png_FILE);
|
||||
*w = (int)width;
|
||||
*h = (int)height;
|
||||
return GR_RGBA;
|
||||
return GL_TEXFMT_RGBA;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -278,7 +271,7 @@ typedef struct
|
|||
UINT8 filler[54];
|
||||
} 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)
|
||||
{
|
||||
PcxHeader header;
|
||||
|
@ -313,7 +306,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
|||
|
||||
pw = *w = header.xmax - header.xmin + 1;
|
||||
ph = *h = header.ymax - header.ymin + 1;
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &grpatch->mipmap->grInfo.data);
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &grpatch->mipmap->data);
|
||||
|
||||
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
|
||||
{
|
||||
|
@ -347,7 +340,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
|||
}
|
||||
}
|
||||
fclose(file);
|
||||
return GR_RGBA;
|
||||
return GL_TEXFMT_RGBA;
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
@ -361,7 +354,7 @@ static void md2_loadTexture(md2_t *model)
|
|||
if (model->grpatch)
|
||||
{
|
||||
grpatch = model->grpatch;
|
||||
Z_Free(grpatch->mipmap->grInfo.data);
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -370,19 +363,22 @@ static void md2_loadTexture(md2_t *model)
|
|||
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;
|
||||
UINT32 size;
|
||||
RGBA_t *image;
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
#endif
|
||||
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
{
|
||||
model->notexturefile = true; // mark it so its not searched for again repeatedly
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
|
@ -393,20 +389,13 @@ static void md2_loadTexture(md2_t *model)
|
|||
grpatch->mipmap->height = (UINT16)h;
|
||||
|
||||
// Lactozilla: Apply colour cube
|
||||
image = grpatch->mipmap->grInfo.data;
|
||||
image = grpatch->mipmap->data;
|
||||
size = w*h;
|
||||
while (size--)
|
||||
{
|
||||
V_CubeApply(&image->s.red, &image->s.green, &image->s.blue);
|
||||
image++;
|
||||
}
|
||||
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// not correct!
|
||||
grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
}
|
||||
|
@ -425,7 +414,7 @@ static void md2_loadBlendTexture(md2_t *model)
|
|||
if (model->blendgrpatch)
|
||||
{
|
||||
grpatch = model->blendgrpatch;
|
||||
Z_Free(grpatch->mipmap->grInfo.data);
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -434,16 +423,17 @@ static void md2_loadBlendTexture(md2_t *model)
|
|||
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;
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
#endif
|
||||
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
{
|
||||
model->noblendfile = true; // mark it so its not searched for again repeatedly
|
||||
Z_Free(filename);
|
||||
return;
|
||||
}
|
||||
|
@ -455,13 +445,6 @@ static void md2_loadBlendTexture(md2_t *model)
|
|||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// not correct!
|
||||
grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
|
||||
|
@ -476,8 +459,9 @@ void HWR_InitModels(void)
|
|||
size_t i;
|
||||
INT32 s;
|
||||
FILE *f;
|
||||
char name[18], filename[32];
|
||||
char name[24], filename[32];
|
||||
float scale, offset;
|
||||
size_t prefixlen;
|
||||
|
||||
CONS_Printf("HWR_InitModels()...\n");
|
||||
for (s = 0; s < MAXSKINS; s++)
|
||||
|
@ -485,6 +469,8 @@ void HWR_InitModels(void)
|
|||
md2_playermodels[s].scale = -1.0f;
|
||||
md2_playermodels[s].model = NULL;
|
||||
md2_playermodels[s].grpatch = NULL;
|
||||
md2_playermodels[s].notexturefile = false;
|
||||
md2_playermodels[s].noblendfile = false;
|
||||
md2_playermodels[s].skin = -1;
|
||||
md2_playermodels[s].notfound = true;
|
||||
md2_playermodels[s].error = false;
|
||||
|
@ -494,6 +480,8 @@ void HWR_InitModels(void)
|
|||
md2_models[i].scale = -1.0f;
|
||||
md2_models[i].model = NULL;
|
||||
md2_models[i].grpatch = NULL;
|
||||
md2_models[i].notexturefile = false;
|
||||
md2_models[i].noblendfile = false;
|
||||
md2_models[i].skin = -1;
|
||||
md2_models[i].notfound = true;
|
||||
md2_models[i].error = false;
|
||||
|
@ -509,46 +497,54 @@ void HWR_InitModels(void)
|
|||
nomd2s = true;
|
||||
return;
|
||||
}
|
||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
|
||||
// length of the player model prefix
|
||||
prefixlen = strlen(PLAYERMODELPREFIX);
|
||||
|
||||
while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
{
|
||||
if (stricmp(name, "PLAY") == 0)
|
||||
char *skinname = name;
|
||||
size_t len = strlen(name);
|
||||
|
||||
// check for the player model prefix.
|
||||
if (!strnicmp(name, PLAYERMODELPREFIX, prefixlen) && (len > prefixlen))
|
||||
{
|
||||
CONS_Printf("Model for sprite PLAY detected in models.dat, use a player skin instead!\n");
|
||||
continue;
|
||||
skinname += prefixlen;
|
||||
goto addskinmodel;
|
||||
}
|
||||
|
||||
// add sprite model
|
||||
if (len == 4) // must be 4 characters long exactly. otherwise it's not a sprite name.
|
||||
{
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
{
|
||||
if (stricmp(name, sprnames[i]) == 0)
|
||||
{
|
||||
//if (stricmp(name, "PLAY") == 0)
|
||||
//continue;
|
||||
|
||||
//CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset);
|
||||
md2_models[i].scale = scale;
|
||||
md2_models[i].offset = offset;
|
||||
md2_models[i].notfound = false;
|
||||
strcpy(md2_models[i].filename, filename);
|
||||
goto md2found;
|
||||
goto modelfound;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addskinmodel:
|
||||
// add player model
|
||||
for (s = 0; s < MAXSKINS; s++)
|
||||
{
|
||||
if (stricmp(name, skins[s].name) == 0)
|
||||
if (stricmp(skinname, skins[s].name) == 0)
|
||||
{
|
||||
//CONS_Printf(" Found: %s %s %f %f\n", name, filename, scale, offset);
|
||||
md2_playermodels[s].skin = s;
|
||||
md2_playermodels[s].scale = scale;
|
||||
md2_playermodels[s].offset = offset;
|
||||
md2_playermodels[s].notfound = false;
|
||||
strcpy(md2_playermodels[s].filename, filename);
|
||||
goto md2found;
|
||||
goto modelfound;
|
||||
}
|
||||
}
|
||||
// no sprite/player skin name found?!?
|
||||
//CONS_Printf("Unknown sprite/player skin %s detected in models.dat\n", name);
|
||||
md2found:
|
||||
|
||||
modelfound:
|
||||
// move on to next line...
|
||||
continue;
|
||||
}
|
||||
|
@ -558,8 +554,9 @@ md2found:
|
|||
void HWR_AddPlayerModel(int skin) // For skins that were added after startup
|
||||
{
|
||||
FILE *f;
|
||||
char name[18], filename[32];
|
||||
char name[24], filename[32];
|
||||
float scale, offset;
|
||||
size_t prefixlen;
|
||||
|
||||
if (nomd2s)
|
||||
return;
|
||||
|
@ -577,32 +574,42 @@ void HWR_AddPlayerModel(int skin) // For skins that were added after startup
|
|||
return;
|
||||
}
|
||||
|
||||
// Check for any model that match the names of player skins!
|
||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
// length of the player model prefix
|
||||
prefixlen = strlen(PLAYERMODELPREFIX);
|
||||
|
||||
// Check for any models that match the names of player skins!
|
||||
while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
{
|
||||
if (stricmp(name, skins[skin].name) == 0)
|
||||
char *skinname = name;
|
||||
size_t len = strlen(name);
|
||||
|
||||
// ignore the player model prefix.
|
||||
if (!strnicmp(name, PLAYERMODELPREFIX, prefixlen) && (len > prefixlen))
|
||||
skinname += prefixlen;
|
||||
|
||||
if (stricmp(skinname, skins[skin].name) == 0)
|
||||
{
|
||||
md2_playermodels[skin].skin = skin;
|
||||
md2_playermodels[skin].scale = scale;
|
||||
md2_playermodels[skin].offset = offset;
|
||||
md2_playermodels[skin].notfound = false;
|
||||
strcpy(md2_playermodels[skin].filename, filename);
|
||||
goto playermd2found;
|
||||
goto playermodelfound;
|
||||
}
|
||||
}
|
||||
|
||||
//CONS_Printf("Model for player skin %s not found\n", skins[skin].name);
|
||||
md2_playermodels[skin].notfound = true;
|
||||
playermd2found:
|
||||
playermodelfound:
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void HWR_AddSpriteModel(size_t spritenum) // For sprites that were added after startup
|
||||
{
|
||||
FILE *f;
|
||||
// name[18] is used to check for names in the models.dat file that match with sprites or player skins
|
||||
// name[24] is used to check for names in the models.dat file that match with sprites or player skins
|
||||
// sprite names are always 4 characters long, and names is for player skins can be up to 19 characters long
|
||||
char name[18], filename[32];
|
||||
// PLAYERMODELPREFIX is 6 characters long
|
||||
char name[24], filename[32];
|
||||
float scale, offset;
|
||||
|
||||
if (nomd2s)
|
||||
|
@ -622,22 +629,30 @@ void HWR_AddSpriteModel(size_t spritenum) // For sprites that were added after s
|
|||
return;
|
||||
}
|
||||
|
||||
// Check for any MD2s that match the names of sprite names!
|
||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
// Check for any models that match the names of sprite names!
|
||||
while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
{
|
||||
// length of the sprite name
|
||||
size_t len = strlen(name);
|
||||
if (len != 4) // must be 4 characters long exactly. otherwise it's not a sprite name.
|
||||
continue;
|
||||
|
||||
// check for the player model prefix.
|
||||
if (!strnicmp(name, PLAYERMODELPREFIX, strlen(PLAYERMODELPREFIX)))
|
||||
continue; // that's not a sprite...
|
||||
|
||||
if (stricmp(name, sprnames[spritenum]) == 0)
|
||||
{
|
||||
md2_models[spritenum].scale = scale;
|
||||
md2_models[spritenum].offset = offset;
|
||||
md2_models[spritenum].notfound = false;
|
||||
strcpy(md2_models[spritenum].filename, filename);
|
||||
goto spritemd2found;
|
||||
goto spritemodelfound;
|
||||
}
|
||||
}
|
||||
|
||||
//CONS_Printf("MD2 for sprite %s not found\n", sprnames[spritenum]);
|
||||
md2_models[spritenum].notfound = true;
|
||||
spritemd2found:
|
||||
spritemodelfound:
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
@ -649,12 +664,12 @@ spritemd2found:
|
|||
#define SETBRIGHTNESS(brightness,r,g,b) \
|
||||
brightness = (UINT8)(((1063*(UINT16)(r))/5000) + ((3576*(UINT16)(g))/5000) + ((361*(UINT16)(b))/5000))
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolornum_t color)
|
||||
{
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||
UINT8 translation[16]; // First the color index
|
||||
UINT16 translation[16]; // First the color index
|
||||
UINT8 cutoff[16]; // Brightness cutoff before using the next color
|
||||
UINT8 translen = 0;
|
||||
UINT8 i;
|
||||
|
@ -671,35 +686,35 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
// no wrap around, no chroma key
|
||||
grmip->flags = 0;
|
||||
// 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);
|
||||
grmip->grInfo.data = NULL;
|
||||
Z_Free(grmip->data);
|
||||
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);
|
||||
|
||||
image = gpatch->mipmap->grInfo.data;
|
||||
blendimage = blendgpatch->mipmap->grInfo.data;
|
||||
image = gpatch->mipmap->data;
|
||||
blendimage = blendgpatch->mipmap->data;
|
||||
|
||||
// TC_METALSONIC includes an actual skincolor translation, on top of its flashing.
|
||||
if (skinnum == TC_METALSONIC)
|
||||
color = SKINCOLOR_COBALT;
|
||||
|
||||
if (color != SKINCOLOR_NONE)
|
||||
if (color != SKINCOLOR_NONE && color < numskincolors)
|
||||
{
|
||||
UINT8 numdupes = 1;
|
||||
|
||||
translation[translen] = Color_Index[color-1][0];
|
||||
translation[translen] = skincolors[color].ramp[0];
|
||||
cutoff[translen] = 255;
|
||||
|
||||
for (i = 1; i < 16; i++)
|
||||
{
|
||||
if (translation[translen] == Color_Index[color-1][i])
|
||||
if (translation[translen] == skincolors[color].ramp[i])
|
||||
{
|
||||
numdupes++;
|
||||
continue;
|
||||
|
@ -713,7 +728,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
numdupes = 1;
|
||||
translen++;
|
||||
|
||||
translation[translen] = (UINT8)Color_Index[color-1][i];
|
||||
translation[translen] = (UINT16)skincolors[color].ramp[i];
|
||||
}
|
||||
|
||||
translen++;
|
||||
|
@ -921,11 +936,19 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
|
||||
blendcolor = V_GetColor(translation[firsti]);
|
||||
|
||||
if (secondi >= translen)
|
||||
mul = 0;
|
||||
|
||||
if (mul > 0) // If it's 0, then we only need the first color.
|
||||
{
|
||||
if (secondi >= translen) // blend to black
|
||||
#if 0
|
||||
if (secondi >= translen)
|
||||
{
|
||||
// blend to black
|
||||
nextcolor = V_GetColor(31);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
nextcolor = V_GetColor(translation[secondi]);
|
||||
|
||||
// Find difference between points
|
||||
|
@ -1015,29 +1038,37 @@ skippixel:
|
|||
|
||||
#undef SETBRIGHTNESS
|
||||
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolornum_t color)
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if ((colormap == colormaps || colormap == NULL) && (skinnum > TC_DEFAULT))
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((blendgpatch && blendgpatch->mipmap->format)
|
||||
&& (gpatch->width != blendgpatch->width || gpatch->height != blendgpatch->height))
|
||||
{
|
||||
// Blend image exists, but it's bad.
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap || (skinnum < TC_DEFAULT && grmip->tcindex == skinnum))
|
||||
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
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRMODELTEXTURE);
|
||||
Z_ChangeTag(grmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1046,29 +1077,20 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
|||
// If here, the blended texture has not been created
|
||||
// So we create it
|
||||
|
||||
if ((blendgpatch && blendgpatch->mipmap->grInfo.format)
|
||||
&& (gpatch->width != blendgpatch->width || gpatch->height != blendgpatch->height))
|
||||
{
|
||||
// Blend image exists, but it's bad.
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
//BP: WARNING: don't free it manually without clearing the cache of harware renderer
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
I_Error("%s: Out of memory", "HWR_GetBlendedTexture");
|
||||
grmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
newmip->tcindex = skinnum;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->grInfo.data, PU_HWRMODELTEXTURE);
|
||||
Z_ChangeTag(newmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
}
|
||||
|
||||
#define NORMALFOG 0x00000000
|
||||
|
@ -1086,14 +1108,14 @@ static boolean HWR_AllowModel(mobj_t *mobj)
|
|||
|
||||
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 model->interpolate[(mobj->frame & FF_FRAMEMASK)];
|
||||
}
|
||||
|
||||
static boolean HWR_CanInterpolateSprite2(modelspr2frames_t *spr2frame)
|
||||
{
|
||||
if (cv_grmodelinterpolation.value == 2) // Always interpolate
|
||||
if (cv_glmodelinterpolation.value == 2) // Always interpolate
|
||||
return true;
|
||||
return spr2frame->interpolate;
|
||||
}
|
||||
|
@ -1155,23 +1177,50 @@ static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t
|
|||
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
|
||||
//
|
||||
|
||||
boolean HWR_DrawModel(gr_vissprite_t *spr)
|
||||
boolean HWR_DrawModel(gl_vissprite_t *spr)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
md2_t *md2;
|
||||
|
||||
char filename[64];
|
||||
INT32 frame = 0;
|
||||
INT32 nextFrame = -1;
|
||||
UINT8 spr2 = 0;
|
||||
FTransform p;
|
||||
md2_t *md2;
|
||||
UINT8 color[4];
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
if (!cv_grmodels.value)
|
||||
if (!cv_glmodels.value)
|
||||
return false;
|
||||
|
||||
if (spr->precip)
|
||||
|
@ -1194,7 +1243,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
|
||||
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = *sector->lightlist[light].lightlevel;
|
||||
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
|
||||
|
||||
if (*sector->lightlist[light].extra_colormap)
|
||||
colormap = *sector->lightlist[light].extra_colormap;
|
||||
|
@ -1202,19 +1251,16 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
else
|
||||
{
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = sector->lightlevel;
|
||||
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
|
||||
|
||||
if (sector->extra_colormap)
|
||||
colormap = sector->extra_colormap;
|
||||
}
|
||||
|
||||
if (colormap)
|
||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
|
||||
else
|
||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
|
||||
HWR_Lighting(&Surf, lightlevel, colormap);
|
||||
}
|
||||
else
|
||||
Surf.FlatColor.rgba = 0xFFFFFFFF;
|
||||
Surf.PolyColor.rgba = 0xFFFFFFFF;
|
||||
|
||||
// Look at HWR_ProjectSprite for more
|
||||
{
|
||||
|
@ -1224,6 +1270,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
//mdlframe_t *next = NULL;
|
||||
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
|
||||
const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !(spr->mobj->frame & FF_VERTICALFLIP));
|
||||
const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !(spr->mobj->frame & FF_HORIZONTALFLIP));
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
spriteinfo_t *sprinfo;
|
||||
|
@ -1236,11 +1283,11 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
//durs = tics;
|
||||
|
||||
if (spr->mobj->flags2 & MF2_SHADOW)
|
||||
Surf.FlatColor.s.alpha = 0x40;
|
||||
Surf.PolyColor.s.alpha = 0x40;
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
else
|
||||
Surf.FlatColor.s.alpha = 0xFF;
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
|
@ -1259,6 +1306,19 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
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)
|
||||
return false; // we already failed loading this before :(
|
||||
if (!md2->model)
|
||||
|
@ -1270,6 +1330,10 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
if (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);
|
||||
}
|
||||
else
|
||||
|
@ -1287,18 +1351,10 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
//HWD.pfnSetBlend(blend); // This seems to actually break translucency?
|
||||
finalscale = md2->scale;
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
gpatch = md2->grpatch;
|
||||
if (!gpatch || !gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded)
|
||||
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
|
||||
&& (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded))
|
||||
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
|
||||
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
|
||||
{
|
||||
INT32 skinnum = INT32_MAX;
|
||||
INT32 skinnum = TC_DEFAULT;
|
||||
|
||||
if ((spr->mobj->flags & (MF_ENEMY|MF_BOSS)) && (spr->mobj->flags2 & MF2_FRET) && !(spr->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash"
|
||||
{
|
||||
|
@ -1309,7 +1365,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
else
|
||||
skinnum = TC_BOSS;
|
||||
}
|
||||
else if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE)
|
||||
else if ((skincolornum_t)spr->mobj->color != SKINCOLOR_NONE)
|
||||
{
|
||||
if (spr->mobj->colorized)
|
||||
skinnum = TC_RAINBOW;
|
||||
|
@ -1329,15 +1385,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
}
|
||||
|
||||
// Translation or skin number found
|
||||
if (skinnum != INT32_MAX)
|
||||
{
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sorry nothing
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
}
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolornum_t)spr->mobj->color);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1375,7 +1423,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
|
||||
#ifdef USE_MODEL_NEXTFRAME
|
||||
#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)
|
||||
durs = INTERPOLERATION_LIMIT;
|
||||
|
@ -1459,7 +1507,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
|
||||
// rotation pivot
|
||||
p.centerx = FIXED_TO_FLOAT(spr->mobj->radius/2);
|
||||
p.centery = FIXED_TO_FLOAT(spr->mobj->height/2);
|
||||
p.centery = FIXED_TO_FLOAT(spr->mobj->height/(flip ? -2 : 2));
|
||||
|
||||
// rotation axis
|
||||
if (sprinfo->available)
|
||||
|
@ -1471,6 +1519,9 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
p.rollflip = 1;
|
||||
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
|
||||
p.rollflip = -1;
|
||||
|
||||
if (flip)
|
||||
p.rollflip *= -1;
|
||||
}
|
||||
|
||||
p.anglex = 0.0f;
|
||||
|
@ -1490,11 +1541,6 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
}
|
||||
#endif
|
||||
|
||||
color[0] = Surf.FlatColor.s.red;
|
||||
color[1] = Surf.FlatColor.s.green;
|
||||
color[2] = Surf.FlatColor.s.blue;
|
||||
color[3] = Surf.FlatColor.s.alpha;
|
||||
|
||||
// SRB2CBTODO: MD2 scaling support
|
||||
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
|
||||
|
@ -1503,7 +1549,8 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, color);
|
||||
HWD.pfnSetShader(4); // model shader
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, hflip, &Surf);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1,21 +1,14 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
/// \brief MD2 Handling
|
||||
/// \file hw_md2.h
|
||||
/// \brief 3D Model Handling
|
||||
/// Inspired from md2.h by Mete Ciragan (mete@swissquake.ch)
|
||||
|
||||
#ifndef _HW_MD2_H_
|
||||
|
@ -35,7 +28,9 @@ typedef struct
|
|||
float offset;
|
||||
model_t *model;
|
||||
void *grpatch;
|
||||
boolean notexturefile; // true if texture file was not found
|
||||
void *blendgrpatch;
|
||||
boolean noblendfile; // true if blend texture file was not found
|
||||
boolean notfound;
|
||||
INT32 skin;
|
||||
boolean error;
|
||||
|
@ -47,6 +42,8 @@ extern md2_t md2_playermodels[MAXSKINS];
|
|||
void HWR_InitModels(void);
|
||||
void HWR_AddPlayerModel(INT32 skin);
|
||||
void HWR_AddSpriteModel(size_t spritenum);
|
||||
boolean HWR_DrawModel(gr_vissprite_t *spr);
|
||||
boolean HWR_DrawModel(gl_vissprite_t *spr);
|
||||
|
||||
#define PLAYERMODELPREFIX "PLAYER"
|
||||
|
||||
#endif // _HW_MD2_H_
|
||||
|
|
|
@ -1,918 +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 = §ors[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 = §ors[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;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (adjSector->c_slope) // Don't bother with slopes
|
||||
return false;
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (adjSector->f_slope) // Don't bother with slopes
|
||||
return false;
|
||||
#endif
|
||||
|
||||
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 = §ors[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 = §ors[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
|
|
@ -1,19 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2005 by Sonic Team Junior.
|
||||
//
|
||||
// Copyright (C) 2005 by SRB2 Jr. 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.
|
||||
// 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
|
||||
/// \file hws_data.h
|
||||
/// \brief 3D sound definitions
|
||||
|
||||
#ifndef __HWS_DATA_H__
|
||||
|
|
|
@ -206,7 +206,7 @@ int SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepth
|
|||
|
||||
if (iLastPFD)
|
||||
{
|
||||
DBG_Printf("WARNING : SetPixelFormat() called twise not supported by all drivers !\n");
|
||||
GL_DBG_Printf("WARNING : SetPixelFormat() called twise not supported by all drivers !\n");
|
||||
}
|
||||
|
||||
// set the pixel format only if different than the current
|
||||
|
@ -215,17 +215,17 @@ int SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepth
|
|||
else
|
||||
iLastPFD = iPFD;
|
||||
|
||||
DBG_Printf("SetupPixelFormat() - %d ColorBits - %d StencilBits - %d DepthBits\n",
|
||||
GL_DBG_Printf("SetupPixelFormat() - %d ColorBits - %d StencilBits - %d DepthBits\n",
|
||||
WantColorBits, WantStencilBits, WantDepthBits);
|
||||
|
||||
nPixelFormat = ChoosePixelFormat(hDC, &pfd);
|
||||
|
||||
if (nPixelFormat == 0)
|
||||
DBG_Printf("ChoosePixelFormat() FAILED\n");
|
||||
GL_DBG_Printf("ChoosePixelFormat() FAILED\n");
|
||||
|
||||
if (SetPixelFormat(hDC, nPixelFormat, &pfd) == 0)
|
||||
{
|
||||
DBG_Printf("SetPixelFormat() FAILED\n");
|
||||
GL_DBG_Printf("SetPixelFormat() FAILED\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
BOOL WantFullScreen = !(lvid->u.windowed); //(lvid->u.windowed ? 0 : CDS_FULLSCREEN);
|
||||
|
||||
UNREFERENCED_PARAMETER(pcurrentmode);
|
||||
DBG_Printf ("SetMode(): %dx%d %d bits (%s)\n",
|
||||
GL_DBG_Printf ("SetMode(): %dx%d %d bits (%s)\n",
|
||||
lvid->width, lvid->height, lvid->bpp*8,
|
||||
WantFullScreen ? "fullscreen" : "windowed");
|
||||
|
||||
|
@ -301,7 +301,7 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
hDC = GetDC(hWnd);
|
||||
if (!hDC)
|
||||
{
|
||||
DBG_Printf("GetDC() FAILED\n");
|
||||
GL_DBG_Printf("GetDC() FAILED\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -321,12 +321,12 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
hGLRC = pwglCreateContext(hDC);
|
||||
if (!hGLRC)
|
||||
{
|
||||
DBG_Printf("pwglCreateContext() FAILED\n");
|
||||
GL_DBG_Printf("pwglCreateContext() FAILED\n");
|
||||
return 0;
|
||||
}
|
||||
if (!pwglMakeCurrent(hDC, hGLRC))
|
||||
{
|
||||
DBG_Printf("wglMakeCurrent() FAILED\n");
|
||||
GL_DBG_Printf("wglMakeCurrent() FAILED\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -337,15 +337,15 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
//BP: why don't we make it earlier ?
|
||||
//Hurdler: we cannot do that before intialising gl context
|
||||
renderer = (LPCSTR)pglGetString(GL_RENDERER);
|
||||
DBG_Printf("Vendor : %s\n", pglGetString(GL_VENDOR));
|
||||
DBG_Printf("Renderer : %s\n", renderer);
|
||||
DBG_Printf("Version : %s\n", pglGetString(GL_VERSION));
|
||||
DBG_Printf("Extensions : %s\n", gl_extensions);
|
||||
GL_DBG_Printf("Vendor : %s\n", pglGetString(GL_VENDOR));
|
||||
GL_DBG_Printf("Renderer : %s\n", renderer);
|
||||
GL_DBG_Printf("Version : %s\n", pglGetString(GL_VERSION));
|
||||
GL_DBG_Printf("Extensions : %s\n", gl_extensions);
|
||||
|
||||
// BP: disable advenced feature that don't work on somes hardware
|
||||
// Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04
|
||||
if (strstr(renderer, "810")) oglflags |= GLF_NOZBUFREAD;
|
||||
DBG_Printf("oglflags : 0x%X\n", oglflags);
|
||||
GL_DBG_Printf("oglflags : 0x%X\n", oglflags);
|
||||
|
||||
#ifdef USE_WGL_SWAP
|
||||
if (isExtAvailable("WGL_EXT_swap_control",gl_extensions))
|
||||
|
@ -386,7 +386,7 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
// -----------------+
|
||||
static void UnSetRes(void)
|
||||
{
|
||||
DBG_Printf("UnSetRes()\n");
|
||||
GL_DBG_Printf("UnSetRes()\n");
|
||||
|
||||
pwglMakeCurrent(hDC, NULL);
|
||||
pwglDeleteContext(hGLRC);
|
||||
|
@ -437,7 +437,7 @@ EXPORT void HWRAPI(GetModeList) (vmode_t** pvidmodes, INT32 *numvidmodes)
|
|||
video_modes[iMode].misc = 0;
|
||||
video_modes[iMode].name = malloc(12 * sizeof (CHAR));
|
||||
sprintf(video_modes[iMode].name, "%dx%d", (INT32)Tmp.dmPelsWidth, (INT32)Tmp.dmPelsHeight);
|
||||
DBG_Printf ("Mode: %s\n", video_modes[iMode].name);
|
||||
GL_DBG_Printf ("Mode: %s\n", video_modes[iMode].name);
|
||||
video_modes[iMode].width = Tmp.dmPelsWidth;
|
||||
video_modes[iMode].height = Tmp.dmPelsHeight;
|
||||
video_modes[iMode].bytesperpixel = Tmp.dmBitsPerPel/8;
|
||||
|
@ -474,7 +474,7 @@ EXPORT void HWRAPI(GetModeList) (vmode_t** pvidmodes, INT32 *numvidmodes)
|
|||
HDC bpphdc;
|
||||
INT32 iBitsPerPel;
|
||||
|
||||
DBG_Printf ("HWRAPI GetModeList()\n");
|
||||
GL_DBG_Printf ("HWRAPI GetModeList()\n");
|
||||
|
||||
bpphdc = GetDC(NULL); // on obtient le bpp actuel
|
||||
iBitsPerPel = GetDeviceCaps(bpphdc, BITSPIXEL);
|
||||
|
@ -490,7 +490,7 @@ EXPORT void HWRAPI(GetModeList) (vmode_t** pvidmodes, INT32 *numvidmodes)
|
|||
video_modes[i].misc = 0;
|
||||
video_modes[i].name = malloc(12 * sizeof (CHAR));
|
||||
sprintf(video_modes[i].name, "%dx%d", res[i][0], res[i][1]);
|
||||
DBG_Printf ("Mode: %s\n", video_modes[i].name);
|
||||
GL_DBG_Printf ("Mode: %s\n", video_modes[i].name);
|
||||
video_modes[i].width = res[i][0];
|
||||
video_modes[i].height = res[i][1];
|
||||
video_modes[i].bytesperpixel = iBitsPerPel/8;
|
||||
|
@ -511,9 +511,9 @@ EXPORT void HWRAPI(Shutdown) (void)
|
|||
#ifdef DEBUG_TO_FILE
|
||||
long nb_centiemes;
|
||||
|
||||
DBG_Printf ("HWRAPI Shutdown()\n");
|
||||
GL_DBG_Printf ("HWRAPI Shutdown()\n");
|
||||
nb_centiemes = ((clock()-my_clock)*100)/CLOCKS_PER_SEC;
|
||||
DBG_Printf("Nb frames: %li; Nb sec: %2.2f -> %2.1f fps\n",
|
||||
GL_DBG_Printf("Nb frames: %li; Nb sec: %2.2f -> %2.1f fps\n",
|
||||
nb_frames, nb_centiemes/100.0f, (100*nb_frames)/(double)nb_centiemes);
|
||||
#endif
|
||||
|
||||
|
@ -530,7 +530,7 @@ EXPORT void HWRAPI(Shutdown) (void)
|
|||
}
|
||||
FreeLibrary(GLU32);
|
||||
FreeLibrary(OGL32);
|
||||
DBG_Printf ("HWRAPI Shutdown(DONE)\n");
|
||||
GL_DBG_Printf ("HWRAPI Shutdown(DONE)\n");
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
@ -543,7 +543,7 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
|||
#else
|
||||
UNREFERENCED_PARAMETER(waitvbl);
|
||||
#endif
|
||||
// DBG_Printf ("FinishUpdate()\n");
|
||||
// GL_DBG_Printf ("FinishUpdate()\n");
|
||||
#ifdef DEBUG_TO_FILE
|
||||
if ((++nb_frames)==2) // on ne commence pas <20> la premi<6D>re frame
|
||||
my_clock = clock();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue