mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 13:40:45 +00:00
Merge branch 'next' of https://git.magicalgirl.moe/STJr/SRB2.git into keep-body
# Conflicts: # src/g_game.c # src/p_setup.c
This commit is contained in:
commit
f209721ded
161 changed files with 24549 additions and 10964 deletions
78
.travis.yml
78
.travis.yml
|
@ -459,11 +459,15 @@ matrix:
|
|||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
|
@ -473,43 +477,24 @@ matrix:
|
|||
AND env(DPL_TERMINATE_MAIN) != "1"
|
||||
env:
|
||||
- _DPL_JOB_ENABLED=1
|
||||
- _DPL_JOB_NAME=bionic
|
||||
- _DPL_JOB_NAME=eoan
|
||||
- _DPL_DPUT_TARGET=1
|
||||
- _DPL_PACKAGE_SOURCE=1
|
||||
- PACKAGE_DISTRO=bionic
|
||||
- PACKAGE_SUBVERSION=~18.04bionic
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
dist: trusty
|
||||
if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1")
|
||||
AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1"))
|
||||
AND env(DPL_TERMINATE_MAIN) != "1"
|
||||
env:
|
||||
- _DPL_JOB_ENABLED=1
|
||||
- _DPL_JOB_NAME=trusty
|
||||
- _DPL_DPUT_TARGET=1
|
||||
- _DPL_PACKAGE_SOURCE=1
|
||||
- PACKAGE_DISTRO=trusty
|
||||
- PACKAGE_SUBVERSION=~14.04trusty
|
||||
- PACKAGE_DISTRO=eoan
|
||||
- PACKAGE_SUBVERSION=~19.10eoan
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
|
@ -528,11 +513,15 @@ matrix:
|
|||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
|
@ -542,20 +531,24 @@ matrix:
|
|||
AND env(DPL_TERMINATE_MAIN) != "1"
|
||||
env:
|
||||
- _DPL_JOB_ENABLED=1
|
||||
- _DPL_JOB_NAME=cosmic
|
||||
- _DPL_JOB_NAME=bionic
|
||||
- _DPL_DPUT_TARGET=1
|
||||
- _DPL_PACKAGE_SOURCE=1
|
||||
- PACKAGE_DISTRO=cosmic
|
||||
- PACKAGE_SUBVERSION=~18.10cosmic
|
||||
- PACKAGE_DISTRO=bionic
|
||||
- PACKAGE_SUBVERSION=~18.04bionic
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
|
@ -571,6 +564,33 @@ matrix:
|
|||
- PACKAGE_DISTRO=xenial
|
||||
- PACKAGE_SUBVERSION=~16.04xenial
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:stjr/srb2'
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- libopenmpt-dev
|
||||
- p7zip-full
|
||||
- gcc-4.8
|
||||
compiler: gcc-4.8
|
||||
dist: trusty
|
||||
if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1")
|
||||
AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1"))
|
||||
AND env(DPL_TERMINATE_MAIN) != "1"
|
||||
env:
|
||||
- _DPL_JOB_ENABLED=1
|
||||
- _DPL_JOB_NAME=trusty
|
||||
- _DPL_DPUT_TARGET=1
|
||||
- _DPL_PACKAGE_SOURCE=1
|
||||
- PACKAGE_DISTRO=trusty
|
||||
- PACKAGE_SUBVERSION=~14.04trusty
|
||||
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
|
||||
allow_failures:
|
||||
- compiler: clang-3.5
|
||||
- compiler: clang-3.6
|
||||
|
|
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
|
|||
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
|
||||
# Version change is fine.
|
||||
project(SRB2
|
||||
VERSION 2.1.25
|
||||
VERSION 2.2.0
|
||||
LANGUAGES C)
|
||||
|
||||
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
|
||||
|
@ -95,7 +95,6 @@ set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|||
|
||||
# Set EXE names so the assets CMakeLists can refer to its target
|
||||
set(SRB2_SDL2_EXE_NAME srb2 CACHE STRING "Executable binary output name")
|
||||
set(SRB2_WIN_EXE_NAME srb2dd CACHE STRING "Executable binary output name for DirectDraw build")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||
|
||||
|
|
29
appveyor.yml
29
appveyor.yml
|
@ -1,4 +1,4 @@
|
|||
version: 2.1.25.{branch}-{build}
|
||||
version: 2.2.0.{branch}-{build}
|
||||
os: MinGW
|
||||
|
||||
environment:
|
||||
|
@ -9,7 +9,7 @@ environment:
|
|||
# c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead
|
||||
MINGW_SDK: c:\msys64\mingw32
|
||||
# c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead
|
||||
MINGW_SDK_64: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64
|
||||
MINGW_SDK_64: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
|
||||
CFLAGS: -Wall -W -Werror -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3 -Wno-tautological-compare -Wno-error=suggest-attribute=noreturn
|
||||
NASM_ZIP: nasm-2.12.01
|
||||
NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip
|
||||
|
@ -29,15 +29,15 @@ environment:
|
|||
##############################
|
||||
DPL_ENABLED: 0
|
||||
DPL_TAG_ENABLED: 0
|
||||
DPL_INSTALLER_NAME: SRB2-v2123
|
||||
DPL_INSTALLER_NAME: SRB2-v220
|
||||
# Asset handling is barebones vs. Travis Deployer. We operate on 7z only.
|
||||
# Include the README files and the OpenGL batch in the main and patch archives.
|
||||
# The x86/x64 archives contain the DLL binaries.
|
||||
ASSET_ARCHIVE_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z
|
||||
ASSET_ARCHIVE_PATCH_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-patch-assets.7z
|
||||
ASSET_ARCHIVE_X86_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x86-assets.7z
|
||||
ASSET_ARCHIVE_X64_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x64-assets.7z
|
||||
ASSET_ARCHIVE_OPTIONAL_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z
|
||||
ASSET_ARCHIVE_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-assets.7z
|
||||
ASSET_ARCHIVE_PATCH_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-patch-assets.7z
|
||||
ASSET_ARCHIVE_X86_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-x86-assets.7z
|
||||
ASSET_ARCHIVE_X64_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-x64-assets.7z
|
||||
ASSET_ARCHIVE_OPTIONAL_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-optional-assets.7z
|
||||
# This is overridden to 1 for release tag builds
|
||||
ASSET_FILES_OPTIONAL_GET: 0
|
||||
# For patches, also include the X86/X64 DLLs.
|
||||
|
@ -55,8 +55,6 @@ cache:
|
|||
install:
|
||||
- if [%CONFIGURATION%] == [SDL64] ( set "X86_64=1" )
|
||||
- if [%CONFIGURATION%] == [SDL64] ( set "CONFIGURATION=SDL" )
|
||||
- if [%CONFIGURATION%] == [DD64] ( set "X86_64=1" )
|
||||
- if [%CONFIGURATION%] == [DD64] ( set "CONFIGURATION=DD" )
|
||||
- if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" )
|
||||
- if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" )
|
||||
|
||||
|
@ -75,13 +73,6 @@ install:
|
|||
configuration:
|
||||
- SDL
|
||||
- SDL64
|
||||
- DD
|
||||
- DD64
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- configuration: DD
|
||||
- configuration: DD64
|
||||
|
||||
before_build:
|
||||
- set "Path=%MINGW_SDK%\bin;%Path%"
|
||||
|
@ -92,8 +83,8 @@ 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 GCC73=1 NOOBJDUMP=1 %NOUPX%"
|
||||
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" )
|
||||
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 NOOBJDUMP=1 %NOUPX%"
|
||||
- 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"
|
||||
|
||||
build_script:
|
||||
|
|
|
@ -12,18 +12,22 @@ ENDFUNCTION(PREPEND)
|
|||
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
|
||||
CACHE STRING "Path to directory that contains all asset files for the installer.")
|
||||
|
||||
####################
|
||||
# POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list!
|
||||
####################
|
||||
|
||||
set(SRB2_ASSET_HASHED
|
||||
"srb2.pk3;\
|
||||
player.dta;\
|
||||
zones.pk3;\
|
||||
patch.pk3"
|
||||
zones.pk3"
|
||||
CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!"
|
||||
)
|
||||
|
||||
set(SRB2_ASSET_DOCS
|
||||
"README.txt;\
|
||||
LICENSE.txt;\
|
||||
LICENSE-3RD-PARTY.txt"
|
||||
LICENSE-3RD-PARTY.txt;\
|
||||
README-SDL.txt"
|
||||
CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!"
|
||||
)
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ Build-Depends: debhelper (>= 7.0.50~),
|
|||
libpng-dev | libpng16-dev | libpng12-dev (>= 1.2.7),
|
||||
zlib1g-dev,
|
||||
libgme-dev,
|
||||
libopenmpt-dev,
|
||||
libglu1-dev | libglu-dev,
|
||||
libosmesa6-dev | libgl-dev,
|
||||
nasm [i386]
|
||||
|
@ -24,6 +25,7 @@ Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS},
|
|||
libsdl2-mixer-2.0-0,
|
||||
zlib1g,
|
||||
libgme0,
|
||||
libopenmpt | libopenmpt0,
|
||||
libpng | libpng16-16 | libpng12-0
|
||||
Description: A cross-platform 3D Sonic fangame
|
||||
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
: ${_DPL_PACKAGE_ASSET} # Build asset installation package. Linux only.
|
||||
|
||||
# Asset File Parameters
|
||||
: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z}
|
||||
: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z}
|
||||
: ${ASSET_FILES_HASHED:=srb2.srb zones.dta player.dta rings.dta patch.dta}
|
||||
: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt}
|
||||
: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-assets.7z}
|
||||
: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-optional-assets.7z}
|
||||
: ${ASSET_FILES_HASHED:=srb2.pk3 zones.pk3 player.dta} # POST v2.2 NOTE: Don't forget to add patch.pk3!
|
||||
: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt README-SDL.txt}
|
||||
: ${ASSET_FILES_OPTIONAL_GET:=0}
|
||||
|
||||
# FTP Parameters
|
||||
|
@ -51,7 +51,7 @@
|
|||
|
||||
# Package Parameters
|
||||
: ${PACKAGE_NAME:=srb2}
|
||||
: ${PACKAGE_VERSION:=2.1.23}
|
||||
: ${PACKAGE_VERSION:=2.2.0}
|
||||
: ${PACKAGE_SUBVERSION} # Highly recommended to set this to reflect the distro series target (e.g., ~18.04bionic)
|
||||
: ${PACKAGE_REVISION} # Defaults to UTC timestamp
|
||||
: ${PACKAGE_INSTALL_PATH:=/usr/games/SRB2}
|
||||
|
@ -62,12 +62,12 @@
|
|||
: ${PACKAGE_GROUP_NAME_EMAIL:=Sonic Team Junior <stjr@srb2.org>}
|
||||
: ${PACKAGE_WEBSITE:=<http://www.srb2.org>}
|
||||
|
||||
: ${PACKAGE_ASSET_MINVERSION:=2.1.21} # Number this the version BEFORE the actual required version, because we do a > check
|
||||
: ${PACKAGE_ASSET_MAXVERSION:=2.1.24} # Number this the version AFTER the actual required version, because we do a < check
|
||||
: ${PACKAGE_ASSET_MINVERSION:=2.1.26} # Number this the version BEFORE the actual required version, because we do a > check
|
||||
: ${PACKAGE_ASSET_MAXVERSION:=2.2.1} # Number this the version AFTER the actual required version, because we do a < check
|
||||
|
||||
: ${PROGRAM_NAME:=Sonic Robo Blast 2}
|
||||
: ${PROGRAM_VENDOR:=Sonic Team Junior}
|
||||
: ${PROGRAM_VERSION:=2.1.23}
|
||||
: ${PROGRAM_VERSION:=2.2.0}
|
||||
: ${PROGRAM_DESCRIPTION:=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis.}
|
||||
: ${PROGRAM_FILENAME:=srb2}
|
||||
|
||||
|
|
77
extras/conf/Includes/Game_SRB222.cfg
Normal file
77
extras/conf/Includes/Game_SRB222.cfg
Normal file
|
@ -0,0 +1,77 @@
|
|||
// 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
|
||||
{
|
||||
}
|
309
extras/conf/Includes/SRB222_common.cfg
Normal file
309
extras/conf/Includes/SRB222_common.cfg
Normal file
|
@ -0,0 +1,309 @@
|
|||
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");
|
||||
}
|
||||
}
|
2486
extras/conf/Includes/SRB222_linedefs.cfg
Normal file
2486
extras/conf/Includes/SRB222_linedefs.cfg
Normal file
File diff suppressed because it is too large
Load diff
726
extras/conf/Includes/SRB222_misc.cfg
Normal file
726
extras/conf/Includes/SRB222_misc.cfg
Normal file
|
@ -0,0 +1,726 @@
|
|||
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";
|
||||
}
|
||||
}
|
109
extras/conf/Includes/SRB222_sectors.cfg
Normal file
109
extras/conf/Includes/SRB222_sectors.cfg
Normal file
|
@ -0,0 +1,109 @@
|
|||
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";
|
||||
}
|
||||
}
|
3398
extras/conf/Includes/SRB222_things.cfg
Normal file
3398
extras/conf/Includes/SRB222_things.cfg
Normal file
File diff suppressed because it is too large
Load diff
|
@ -690,9 +690,9 @@ linedeftypes
|
|||
title = "Chain Parameters";
|
||||
prefix = "(9)";
|
||||
flags32text = "[5] Swing instead of spin";
|
||||
flags128text = "[7] Make chain from end item";
|
||||
flags64text = "[6] Player-turnable chain";
|
||||
flags128text = "[7] Make chain from maces";
|
||||
flags256text = "[8] Spawn mace at origin";
|
||||
flags256text = "[8] Spawn link at origin";
|
||||
flags512text = "[9] Don't clip inside ground";
|
||||
flags1024text = "[10] No distance check";
|
||||
}
|
||||
|
@ -3389,14 +3389,14 @@ thingtypes
|
|||
}
|
||||
118
|
||||
{
|
||||
title = "CastleBot FaceStabber";
|
||||
title = "Lance-a-Bot";
|
||||
sprite = "CBFSA1";
|
||||
width = 32;
|
||||
height = 72;
|
||||
}
|
||||
1113
|
||||
{
|
||||
title = "Suspicious FaceStabber Statue";
|
||||
title = "Suspicious Lance-a-Bot Statue";
|
||||
sprite = "CBBSA1";
|
||||
width = 32;
|
||||
height = 72;
|
||||
|
@ -5006,7 +5006,7 @@ thingtypes
|
|||
{
|
||||
arrow = 1;
|
||||
blocking = 2;
|
||||
title = "FaceStabber Statue";
|
||||
title = "Lance-a-Bot Statue";
|
||||
sprite = "CBBSA1";
|
||||
width = 32;
|
||||
height = 72;
|
||||
|
|
38
extras/conf/SRB2_22Doom.cfg
Normal file
38
extras/conf/SRB2_22Doom.cfg
Normal file
|
@ -0,0 +1,38 @@
|
|||
/************************************************************************\
|
||||
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");
|
||||
}
|
47
extras/conf/SRB2_22UDMF.cfg
Normal file
47
extras/conf/SRB2_22UDMF.cfg
Normal file
|
@ -0,0 +1,47 @@
|
|||
/************************************************************************\
|
||||
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");
|
||||
}
|
|
@ -518,10 +518,6 @@ add_definitions(-DCMAKECONFIG)
|
|||
|
||||
add_subdirectory(sdl)
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
add_subdirectory(win32)
|
||||
endif()
|
||||
|
||||
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
|
||||
if(NOT ${SRB2_SDL2_AVAILABLE})
|
||||
message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(")
|
||||
endif()
|
||||
|
|
|
@ -245,6 +245,8 @@ void I_GetJoystick2Events(void){}
|
|||
|
||||
void I_GetMouseEvents(void){}
|
||||
|
||||
void I_UpdateMouseGrab(void){}
|
||||
|
||||
char *I_GetEnv(const char *name)
|
||||
{
|
||||
LOGW("I_GetEnv() called?!");
|
||||
|
|
|
@ -19,6 +19,7 @@ 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){}
|
||||
|
||||
|
@ -51,6 +52,11 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
return "A320x240";
|
||||
|
|
68
src/b_bot.c
68
src/b_bot.c
|
@ -127,13 +127,17 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
}
|
||||
|
||||
// Orientation
|
||||
if ((bot->pflags & (PF_SPINNING|PF_STARTDASH)) || flymode == 2)
|
||||
if (bot->pflags & (PF_SPINNING|PF_STARTDASH))
|
||||
{
|
||||
cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
|
||||
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
|
||||
}
|
||||
else if (flymode == 2)
|
||||
{
|
||||
cmd->angleturn = sonic->player->cmd.angleturn - (tails->angle >> 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd->angleturn = (ang - tails->angle) >> FRACBITS;
|
||||
cmd->angleturn = (ang - tails->angle) >> 16; // NOT FRACBITS DAMNIT
|
||||
}
|
||||
|
||||
// ********
|
||||
|
@ -222,7 +226,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
{
|
||||
if (dist < followthres && dist > touchdist) // Do positioning
|
||||
{
|
||||
cmd->angleturn = (ang - tails->angle) >> FRACBITS;
|
||||
cmd->angleturn = (ang - tails->angle) >> 16; // NOT FRACBITS DAMNIT
|
||||
cmd->forwardmove = 50;
|
||||
spinmode = true;
|
||||
}
|
||||
|
@ -230,7 +234,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
{
|
||||
if (!bmom && (!(bot->pflags & PF_SPINNING) || (bot->dashspeed && bot->pflags & PF_SPINNING)))
|
||||
{
|
||||
cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
|
||||
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
|
||||
spin = true;
|
||||
}
|
||||
spinmode = true;
|
||||
|
@ -244,7 +248,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
if (bot->pflags & PF_SPINNING || !spin_last)
|
||||
{
|
||||
spin = true;
|
||||
cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
|
||||
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
|
||||
cmd->forwardmove = MAXPLMOVE;
|
||||
spinmode = true;
|
||||
}
|
||||
|
@ -290,7 +294,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
else if (dist < followmin)
|
||||
{
|
||||
// Copy inputs
|
||||
cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
|
||||
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
|
||||
bot->drawangle = ang;
|
||||
cmd->forwardmove = 8 * pcmd->forwardmove / 10;
|
||||
cmd->sidemove = 8 * pcmd->sidemove / 10;
|
||||
|
@ -335,27 +339,6 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
jump_last = jump;
|
||||
spin_last = spin;
|
||||
|
||||
// ********
|
||||
// Thinkfly overlay
|
||||
if (thinkfly)
|
||||
{
|
||||
if (!tails->hnext)
|
||||
{
|
||||
P_SetTarget(&tails->hnext, P_SpawnMobjFromMobj(tails, 0, 0, 0, MT_OVERLAY));
|
||||
if (tails->hnext)
|
||||
{
|
||||
P_SetTarget(&tails->hnext->target, tails);
|
||||
P_SetTarget(&tails->hnext->hprev, tails);
|
||||
P_SetMobjState(tails->hnext, S_FLIGHTINDICATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tails->hnext && tails->hnext->type == MT_OVERLAY && tails->hnext->state == states+S_FLIGHTINDICATOR)
|
||||
{
|
||||
P_RemoveMobj(tails->hnext);
|
||||
P_SetTarget(&tails->hnext, NULL);
|
||||
}
|
||||
|
||||
// Turn the virtual keypresses into ticcmd_t.
|
||||
B_KeysToTiccmd(tails, cmd, forward, backward, left, right, false, false, jump, spin);
|
||||
|
||||
|
@ -379,7 +362,7 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
|||
}
|
||||
|
||||
// Bot AI isn't programmed in analog.
|
||||
CV_SetValue(&cv_analog2, false);
|
||||
CV_SetValue(&cv_analog[1], false);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Let Lua scripts build ticcmds
|
||||
|
@ -565,3 +548,30 @@ void B_RespawnBot(INT32 playernum)
|
|||
P_SetScale(tails, sonic->scale);
|
||||
tails->destscale = sonic->destscale;
|
||||
}
|
||||
|
||||
void B_HandleFlightIndicator(player_t *player)
|
||||
{
|
||||
mobj_t *tails = player->mo;
|
||||
|
||||
if (!tails)
|
||||
return;
|
||||
|
||||
if (thinkfly && player->bot == 1 && tails->health)
|
||||
{
|
||||
if (!tails->hnext)
|
||||
{
|
||||
P_SetTarget(&tails->hnext, P_SpawnMobjFromMobj(tails, 0, 0, 0, MT_OVERLAY));
|
||||
if (tails->hnext)
|
||||
{
|
||||
P_SetTarget(&tails->hnext->target, tails);
|
||||
P_SetTarget(&tails->hnext->hprev, tails);
|
||||
P_SetMobjState(tails->hnext, S_FLIGHTINDICATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tails->hnext && tails->hnext->type == MT_OVERLAY && tails->hnext->state == states+S_FLIGHTINDICATOR)
|
||||
{
|
||||
P_RemoveMobj(tails->hnext);
|
||||
P_SetTarget(&tails->hnext, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,3 +15,4 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
|
|||
boolean B_CheckRespawn(player_t *player);
|
||||
void B_MoveBlocked(player_t *player);
|
||||
void B_RespawnBot(INT32 playernum);
|
||||
void B_HandleFlightIndicator(player_t *player);
|
||||
|
|
114
src/command.c
114
src/command.c
|
@ -54,13 +54,15 @@ static void COM_Add_f(void);
|
|||
static void CV_EnforceExecVersion(void);
|
||||
static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
|
||||
static boolean CV_Command(void);
|
||||
static consvar_t *CV_FindVar(const char *name);
|
||||
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 char com_token[1024];
|
||||
static char *COM_Parse(char *data);
|
||||
|
||||
static char * COM_Purge (char *text, int *lenp);
|
||||
|
||||
CV_PossibleValue_t CV_OnOff[] = {{0, "Off"}, {1, "On"}, {0, NULL}};
|
||||
CV_PossibleValue_t CV_YesNo[] = {{0, "No"}, {1, "Yes"}, {0, NULL}};
|
||||
CV_PossibleValue_t CV_Unsigned[] = {{0, "MIN"}, {999999999, "MAX"}, {0, NULL}};
|
||||
|
@ -100,31 +102,61 @@ static cmdalias_t *com_alias; // aliases list
|
|||
|
||||
static vsbuf_t com_text; // variable sized buffer
|
||||
|
||||
/** Purges control characters out of some text.
|
||||
*
|
||||
* \param s The text.
|
||||
* \param np Optionally a pointer to fill with the new string length.
|
||||
* \return The text.
|
||||
* \sa COM_ExecuteString
|
||||
*/
|
||||
static char *
|
||||
COM_Purge (char *s, int *np)
|
||||
{
|
||||
char *t;
|
||||
char *p;
|
||||
int n;
|
||||
n = strlen(s);
|
||||
t = s + n + 1;
|
||||
p = s;
|
||||
while (( p = strchr(p, '\033') ))
|
||||
{
|
||||
memmove(p, &p[1], t - p - 1);
|
||||
n--;
|
||||
}
|
||||
if (np)
|
||||
(*np) = n;
|
||||
return s;
|
||||
}
|
||||
|
||||
/** Adds text into the command buffer for later execution.
|
||||
*
|
||||
* \param ptext The text to add.
|
||||
* \sa COM_BufInsertText
|
||||
* \sa COM_BufInsertTextEx
|
||||
*/
|
||||
void COM_BufAddText(const char *ptext)
|
||||
void COM_BufAddTextEx(const char *ptext, int flags)
|
||||
{
|
||||
size_t l;
|
||||
int l;
|
||||
char *text;
|
||||
|
||||
l = strlen(ptext);
|
||||
text = COM_Purge(Z_StrDup(ptext), &l);
|
||||
|
||||
if (com_text.cursize + l >= com_text.maxsize)
|
||||
if (com_text.cursize + 2 + l >= com_text.maxsize)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Command buffer full!\n"));
|
||||
return;
|
||||
}
|
||||
VS_Write(&com_text, ptext, l);
|
||||
|
||||
VS_WriteEx(&com_text, text, l, flags);
|
||||
|
||||
Z_Free(text);
|
||||
}
|
||||
|
||||
/** Adds command text and executes it immediately.
|
||||
*
|
||||
* \param ptext The text to execute. A newline is automatically added.
|
||||
* \sa COM_BufAddText
|
||||
* \sa COM_BufAddTextEx
|
||||
*/
|
||||
void COM_BufInsertText(const char *ptext)
|
||||
void COM_BufInsertTextEx(const char *ptext, int flags)
|
||||
{
|
||||
char *temp = NULL;
|
||||
size_t templen;
|
||||
|
@ -138,7 +170,7 @@ void COM_BufInsertText(const char *ptext)
|
|||
}
|
||||
|
||||
// add the entire text of the file (or alias)
|
||||
COM_BufAddText(ptext);
|
||||
COM_BufAddTextEx(ptext, flags);
|
||||
COM_BufExecute(); // do it right away
|
||||
|
||||
// add the copied off data
|
||||
|
@ -272,6 +304,7 @@ static size_t com_argc;
|
|||
static char *com_argv[MAX_ARGS];
|
||||
static const char *com_null_string = "";
|
||||
static char *com_args = NULL; // current command args or NULL
|
||||
static int com_flags;
|
||||
|
||||
static void Got_NetVar(UINT8 **p, INT32 playernum);
|
||||
|
||||
|
@ -394,12 +427,21 @@ static void COM_TokenizeString(char *ptext)
|
|||
|
||||
com_argc = 0;
|
||||
com_args = NULL;
|
||||
com_flags = 0;
|
||||
|
||||
while (com_argc < MAX_ARGS)
|
||||
{
|
||||
// Skip whitespace up to a newline.
|
||||
while (*ptext != '\0' && *ptext <= ' ' && *ptext != '\n')
|
||||
ptext++;
|
||||
{
|
||||
if (ptext[0] == '\033')
|
||||
{
|
||||
com_flags = (unsigned)ptext[1];
|
||||
ptext += 2;
|
||||
}
|
||||
else
|
||||
ptext++;
|
||||
}
|
||||
|
||||
// A newline means end of command in buffer,
|
||||
// thus end of this command's args too.
|
||||
|
@ -1016,6 +1058,15 @@ void VS_Write(vsbuf_t *buf, const void *data, size_t length)
|
|||
M_Memcpy(VS_GetSpace(buf, length), data, length);
|
||||
}
|
||||
|
||||
void VS_WriteEx(vsbuf_t *buf, const void *data, size_t length, int flags)
|
||||
{
|
||||
char *p;
|
||||
p = VS_GetSpace(buf, 2 + length);
|
||||
p[0] = '\033';
|
||||
p[1] = flags;
|
||||
M_Memcpy(&p[2], data, length);
|
||||
}
|
||||
|
||||
/** Prints text in a variable buffer. Like VS_Write() plus a
|
||||
* trailing NUL.
|
||||
*
|
||||
|
@ -1055,7 +1106,7 @@ static const char *cv_null_string = "";
|
|||
* \return Pointer to the variable if found, or NULL.
|
||||
* \sa CV_FindNetVar
|
||||
*/
|
||||
static consvar_t *CV_FindVar(const char *name)
|
||||
consvar_t *CV_FindVar(const char *name)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
|
||||
|
@ -2008,6 +2059,9 @@ static boolean CV_Command(void)
|
|||
if (!v)
|
||||
return false;
|
||||
|
||||
if (( com_flags & COM_SAFE ) && ( v->flags & CV_NOLUA ))
|
||||
return false;
|
||||
|
||||
// perform a variable print or set
|
||||
if (COM_Argc() == 1)
|
||||
{
|
||||
|
@ -2053,7 +2107,12 @@ void CV_SaveVariables(FILE *f)
|
|||
|
||||
// Silly hack for Min/Max vars
|
||||
if (!strcmp(cvar->string, "MAX") || !strcmp(cvar->string, "MIN"))
|
||||
sprintf(stringtowrite, "%d", cvar->value);
|
||||
{
|
||||
if (cvar->flags & CV_FLOAT)
|
||||
sprintf(stringtowrite, "%f", FIXED_TO_FLOAT(cvar->value));
|
||||
else
|
||||
sprintf(stringtowrite, "%d", cvar->value);
|
||||
}
|
||||
else
|
||||
strcpy(stringtowrite, cvar->string);
|
||||
|
||||
|
@ -2109,8 +2168,13 @@ skipwhite:
|
|||
com_token[len] = 0;
|
||||
return data;
|
||||
}
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
if (c == '\033')
|
||||
data++;
|
||||
else
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2126,10 +2190,22 @@ skipwhite:
|
|||
// parse a regular word
|
||||
do
|
||||
{
|
||||
com_token[len] = c;
|
||||
data++;
|
||||
len++;
|
||||
c = *data;
|
||||
if (c == '\033')
|
||||
{
|
||||
do
|
||||
{
|
||||
data += 2;
|
||||
c = *data;
|
||||
}
|
||||
while (c == '\033') ;
|
||||
}
|
||||
else
|
||||
{
|
||||
com_token[len] = c;
|
||||
data++;
|
||||
len++;
|
||||
c = *data;
|
||||
}
|
||||
if (c == '{' || c == '}' || c == ')'|| c == '(' || c == '\'')
|
||||
break;
|
||||
} while (c > 32);
|
||||
|
|
|
@ -20,6 +20,20 @@
|
|||
// Command buffer & command execution
|
||||
//===================================
|
||||
|
||||
/* Lua command registration flags. */
|
||||
enum
|
||||
{
|
||||
COM_ADMIN = 1,
|
||||
COM_SPLITSCREEN = 2,
|
||||
COM_LOCAL = 4,
|
||||
};
|
||||
|
||||
/* Command buffer flags. */
|
||||
enum
|
||||
{
|
||||
COM_SAFE = 1,
|
||||
};
|
||||
|
||||
typedef void (*com_func_t)(void);
|
||||
|
||||
void COM_AddCommand(const char *name, com_func_t func);
|
||||
|
@ -36,10 +50,12 @@ size_t COM_FirstOption(void);
|
|||
const char *COM_CompleteCommand(const char *partial, INT32 skips);
|
||||
|
||||
// insert at queu (at end of other command)
|
||||
void COM_BufAddText(const char *btext);
|
||||
#define COM_BufAddText(s) COM_BufAddTextEx(s, 0)
|
||||
void COM_BufAddTextEx(const char *btext, int flags);
|
||||
|
||||
// insert in head (before other command)
|
||||
void COM_BufInsertText(const char *btext);
|
||||
#define COM_BufInsertText(s) COM_BufInsertTextEx(s, 0)
|
||||
void COM_BufInsertTextEx(const char *btext, int flags);
|
||||
|
||||
// don't bother inserting, just do immediately
|
||||
void COM_ImmedExecute(const char *ptext);
|
||||
|
@ -71,6 +87,7 @@ void VS_Free(vsbuf_t *buf);
|
|||
void VS_Clear(vsbuf_t *buf);
|
||||
void *VS_GetSpace(vsbuf_t *buf, size_t length);
|
||||
void VS_Write(vsbuf_t *buf, const void *data, size_t length);
|
||||
void VS_WriteEx(vsbuf_t *buf, const void *data, size_t length, int flags);
|
||||
void VS_Print(vsbuf_t *buf, const char *data); // strcats onto the sizebuf
|
||||
|
||||
//==================
|
||||
|
@ -100,7 +117,8 @@ typedef enum
|
|||
CV_HIDEN = 1024, // variable is not part of the cvar list so cannot be accessed by the console
|
||||
// can only be set when we have the pointer to it
|
||||
// used on menus
|
||||
CV_CHEAT = 2048 // Don't let this be used in multiplayer unless cheats are on.
|
||||
CV_CHEAT = 2048, // Don't let this be used in multiplayer unless cheats are on.
|
||||
CV_NOLUA = 4096,/* don't let this be called from Lua */
|
||||
} cvflags_t;
|
||||
|
||||
typedef struct CV_PossibleValue_s
|
||||
|
@ -140,6 +158,9 @@ void CV_ToggleExecVersion(boolean enable);
|
|||
// register a variable for use at the console
|
||||
void CV_RegisterVar(consvar_t *variable);
|
||||
|
||||
// returns a console variable by name
|
||||
consvar_t *CV_FindVar(const char *name);
|
||||
|
||||
// sets changed to 0 for every console variable
|
||||
void CV_ClearChangedFlags(void);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "g_input.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "keys.h"
|
||||
#include "r_main.h"
|
||||
#include "r_defs.h"
|
||||
#include "sounds.h"
|
||||
#include "st_stuff.h"
|
||||
|
@ -31,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"
|
||||
|
@ -591,6 +593,8 @@ void CON_ToggleOff(void)
|
|||
CON_ClearHUD();
|
||||
con_forcepic = 0;
|
||||
con_clipviewtop = -1; // remove console clipping of view
|
||||
|
||||
I_UpdateMouseGrab();
|
||||
}
|
||||
|
||||
boolean CON_Ready(void)
|
||||
|
@ -609,14 +613,6 @@ void CON_Ticker(void)
|
|||
con_tick++;
|
||||
con_tick &= 7;
|
||||
|
||||
// if the menu is open then close the console.
|
||||
if (menuactive && con_destlines)
|
||||
{
|
||||
consoletoggle = false;
|
||||
con_destlines = 0;
|
||||
CON_ClearHUD();
|
||||
}
|
||||
|
||||
// console key was pushed
|
||||
if (consoletoggle)
|
||||
{
|
||||
|
@ -627,6 +623,7 @@ void CON_Ticker(void)
|
|||
{
|
||||
con_destlines = 0;
|
||||
CON_ClearHUD();
|
||||
I_UpdateMouseGrab();
|
||||
}
|
||||
else
|
||||
CON_ChangeHeight();
|
||||
|
@ -772,7 +769,7 @@ boolean CON_Responder(event_t *ev)
|
|||
// check for console toggle key
|
||||
if (ev->type != ev_console)
|
||||
{
|
||||
if (modeattacking || metalrecording)
|
||||
if (modeattacking || metalrecording || menuactive)
|
||||
return false;
|
||||
|
||||
if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1])
|
||||
|
@ -787,7 +784,7 @@ boolean CON_Responder(event_t *ev)
|
|||
// check other keys only if console prompt is active
|
||||
if (!consoleready && key < NUMINPUTS) // metzgermeister: boundary check!!
|
||||
{
|
||||
if (bindtable[key])
|
||||
if (! menuactive && bindtable[key])
|
||||
{
|
||||
COM_BufAddText(bindtable[key]);
|
||||
COM_BufAddText("\n");
|
||||
|
@ -810,6 +807,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)
|
||||
{
|
||||
|
@ -962,23 +986,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;
|
||||
|
@ -1285,10 +1292,10 @@ void CONS_Printf(const char *fmt, ...)
|
|||
con_scrollup = 0;
|
||||
|
||||
// if not in display loop, force screen update
|
||||
if (con_startup)
|
||||
if (con_startup && (!setrenderneeded))
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_CACHE);
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_PATCH);
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
V_DrawScaledPatch(0, 0, 0, con_backpic);
|
||||
|
@ -1545,10 +1552,15 @@ static void CON_DrawConsole(void)
|
|||
// draw console background
|
||||
if (cons_backpic.value || con_forcepic)
|
||||
{
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_CACHE);
|
||||
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_DrawScaledPatch(0, 0, 0, con_backpic);
|
||||
V_DrawCroppedPatch(0, 0, FRACUNIT, 0, con_backpic,
|
||||
0, ( BASEVIDHEIGHT - h ), BASEVIDWIDTH, h);
|
||||
|
||||
W_UnlockCachedPatch(con_backpic);
|
||||
}
|
||||
|
@ -1602,8 +1614,18 @@ void CON_Drawer(void)
|
|||
if (!con_started || !graphics_started)
|
||||
return;
|
||||
|
||||
if (needpatchrecache)
|
||||
{
|
||||
W_FlushCachedPatches();
|
||||
HU_LoadGraphics();
|
||||
}
|
||||
|
||||
if (con_recalc)
|
||||
{
|
||||
CON_RecalcSize();
|
||||
if (con_curlines <= 0)
|
||||
CON_ClearHUD();
|
||||
}
|
||||
|
||||
if (con_curlines > 0)
|
||||
CON_DrawConsole();
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
boolean server = true; // true or false but !server == client
|
||||
#define client (!server)
|
||||
boolean nodownload = false;
|
||||
static boolean serverrunning = false;
|
||||
boolean serverrunning = false;
|
||||
INT32 serverplayer = 0;
|
||||
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
|
||||
|
||||
|
@ -620,11 +620,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
|||
|
||||
rsp->health = LONG(players[i].mo->health);
|
||||
rsp->angle = (angle_t)LONG(players[i].mo->angle);
|
||||
#ifdef ROTSPRITE
|
||||
rsp->rollangle = (angle_t)LONG(players[i].mo->rollangle);
|
||||
#else
|
||||
rsp->rollangle = 0;
|
||||
#endif
|
||||
rsp->x = LONG(players[i].mo->x);
|
||||
rsp->y = LONG(players[i].mo->y);
|
||||
rsp->z = LONG(players[i].mo->z);
|
||||
|
@ -775,9 +771,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
|||
//At this point, the player should have a body, whether they were respawned or not.
|
||||
P_UnsetThingPosition(players[i].mo);
|
||||
players[i].mo->angle = (angle_t)LONG(rsp->angle);
|
||||
#ifdef ROTSPRITE
|
||||
players[i].mo->rollangle = (angle_t)LONG(rsp->rollangle);
|
||||
#endif
|
||||
players[i].mo->eflags = (UINT16)SHORT(rsp->eflags);
|
||||
players[i].mo->flags = LONG(rsp->flags);
|
||||
players[i].mo->flags2 = LONG(rsp->flags2);
|
||||
|
@ -1034,7 +1028,7 @@ static void SV_SendResynch(INT32 node)
|
|||
netbuffer->packettype = PT_RESYNCHEND;
|
||||
|
||||
netbuffer->u.resynchend.randomseed = P_GetRandSeed();
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
resynch_write_ctf(&netbuffer->u.resynchend);
|
||||
resynch_write_others(&netbuffer->u.resynchend);
|
||||
|
||||
|
@ -1277,8 +1271,12 @@ static boolean CL_SendJoin(void)
|
|||
if (splitscreen || botingame)
|
||||
localplayers++;
|
||||
netbuffer->u.clientcfg.localplayers = localplayers;
|
||||
netbuffer->u.clientcfg._255 = 255;
|
||||
netbuffer->u.clientcfg.packetversion = PACKETVERSION;
|
||||
netbuffer->u.clientcfg.version = VERSION;
|
||||
netbuffer->u.clientcfg.subversion = SUBVERSION;
|
||||
strncpy(netbuffer->u.clientcfg.application, SRB2APPLICATION,
|
||||
sizeof netbuffer->u.clientcfg.application);
|
||||
strncpy(netbuffer->u.clientcfg.names[0], cv_playername.zstring, MAXPLAYERNAME);
|
||||
strncpy(netbuffer->u.clientcfg.names[1], cv_playername2.zstring, MAXPLAYERNAME);
|
||||
return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak));
|
||||
|
@ -1289,15 +1287,20 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
UINT8 *p;
|
||||
|
||||
netbuffer->packettype = PT_SERVERINFO;
|
||||
netbuffer->u.serverinfo._255 = 255;
|
||||
netbuffer->u.serverinfo.packetversion = PACKETVERSION;
|
||||
netbuffer->u.serverinfo.version = VERSION;
|
||||
netbuffer->u.serverinfo.subversion = SUBVERSION;
|
||||
strncpy(netbuffer->u.serverinfo.application, SRB2APPLICATION,
|
||||
sizeof netbuffer->u.serverinfo.application);
|
||||
// return back the time value so client can compute their ping
|
||||
netbuffer->u.serverinfo.time = (tic_t)LONG(servertime);
|
||||
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
|
||||
|
||||
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
|
||||
netbuffer->u.serverinfo.maxplayer = (UINT8)cv_maxplayers.value;
|
||||
netbuffer->u.serverinfo.gametype = (UINT8)gametype;
|
||||
strncpy(netbuffer->u.serverinfo.gametypename, Gametype_Names[gametype],
|
||||
sizeof netbuffer->u.serverinfo.gametypename);
|
||||
netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame;
|
||||
netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled();
|
||||
netbuffer->u.serverinfo.isdedicated = (UINT8)dedicated;
|
||||
|
@ -1307,6 +1310,8 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
|
||||
M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, 16);
|
||||
|
||||
memset(netbuffer->u.serverinfo.maptitle, 0, sizeof netbuffer->u.serverinfo.maptitle);
|
||||
|
||||
if (mapheaderinfo[gamemap-1] && *mapheaderinfo[gamemap-1]->lvlttl)
|
||||
{
|
||||
char *read = mapheaderinfo[gamemap-1]->lvlttl, *writ = netbuffer->u.serverinfo.maptitle;
|
||||
|
@ -1325,8 +1330,6 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
else
|
||||
strncpy(netbuffer->u.serverinfo.maptitle, "UNKNOWN", 32);
|
||||
|
||||
netbuffer->u.serverinfo.maptitle[32] = '\0';
|
||||
|
||||
if (mapheaderinfo[gamemap-1] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
|
||||
netbuffer->u.serverinfo.iszone = 1;
|
||||
else
|
||||
|
@ -1628,6 +1631,7 @@ static void CL_LoadReceivedSavegame(void)
|
|||
|
||||
paused = false;
|
||||
demoplayback = false;
|
||||
titlemapinaction = TITLEMAP_OFF;
|
||||
titledemo = false;
|
||||
automapactive = false;
|
||||
|
||||
|
@ -1724,12 +1728,21 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
|||
if (serverlistcount >= MAXSERVERLIST)
|
||||
return; // list full
|
||||
|
||||
if (info->_255 != 255)
|
||||
return;/* old packet format */
|
||||
|
||||
if (info->packetversion != PACKETVERSION)
|
||||
return;/* old new packet format */
|
||||
|
||||
if (info->version != VERSION)
|
||||
return; // Not same version.
|
||||
|
||||
if (info->subversion != SUBVERSION)
|
||||
return; // Close, but no cigar.
|
||||
|
||||
if (strcmp(info->application, SRB2APPLICATION))
|
||||
return;/* that's a different mod */
|
||||
|
||||
i = serverlistcount++;
|
||||
}
|
||||
|
||||
|
@ -2117,13 +2130,10 @@ static void CL_ConnectToServer(boolean viams)
|
|||
|
||||
if (i != -1)
|
||||
{
|
||||
UINT8 num = serverlist[i].info.gametype;
|
||||
const char *gametypestr = NULL;
|
||||
char *gametypestr = serverlist[i].info.gametypename;
|
||||
CONS_Printf(M_GetText("Connecting to: %s\n"), serverlist[i].info.servername);
|
||||
if (num < NUMGAMETYPES)
|
||||
gametypestr = Gametype_Names[num];
|
||||
if (gametypestr)
|
||||
CONS_Printf(M_GetText("Gametype: %s\n"), gametypestr);
|
||||
gametypestr[sizeof serverlist[i].info.gametypename - 1] = '\0';
|
||||
CONS_Printf(M_GetText("Gametype: %s\n"), gametypestr);
|
||||
CONS_Printf(M_GetText("Version: %d.%d.%u\n"), serverlist[i].info.version/100,
|
||||
serverlist[i].info.version%100, serverlist[i].info.subversion);
|
||||
}
|
||||
|
@ -2434,7 +2444,7 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
}
|
||||
}
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!
|
||||
|
||||
// If in a special stage, redistribute the player's spheres across
|
||||
|
@ -2490,6 +2500,17 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
(void)reason;
|
||||
#endif
|
||||
|
||||
// don't look through someone's view who isn't there
|
||||
if (playernum == displayplayer)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
LUAh_ViewpointSwitch(&players[consoleplayer], &players[displayplayer], true);
|
||||
#endif
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
// Reset player data
|
||||
CL_ClearPlayer(playernum);
|
||||
|
||||
|
@ -2507,16 +2528,13 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
|
||||
}
|
||||
|
||||
if (playernum == displayplayer)
|
||||
displayplayer = consoleplayer; // don't look through someone's view who isn't there
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidatePlayer(&players[playernum]);
|
||||
#endif
|
||||
|
||||
if (G_TagGametype()) //Check if you still have a game. Location flexible. =P
|
||||
P_CheckSurvivors();
|
||||
else if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
else if (gametyperules & GTR_RACE)
|
||||
P_CheckRacers();
|
||||
}
|
||||
|
||||
|
@ -3011,8 +3029,8 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
|||
CL_RemovePlayer(pnum, kickreason);
|
||||
}
|
||||
|
||||
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
consvar_t cv_joinnextround = {"joinnextround", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
|
||||
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
consvar_t cv_joinnextround = {"joinnextround", "Off", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
|
||||
static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {32, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t rejointimeout_cons_t[] = {{1, "MIN"}, {60 * FRACUNIT, "MAX"}, {0, "Off"}, {0, NULL}};
|
||||
|
@ -3516,7 +3534,7 @@ void SV_StartSinglePlayerServer(void)
|
|||
server = true;
|
||||
netgame = false;
|
||||
multiplayer = false;
|
||||
gametype = GT_COOP;
|
||||
G_SetGametype(GT_COOP);
|
||||
|
||||
// no more tic the game with this settings!
|
||||
SV_StopServer();
|
||||
|
@ -3565,6 +3583,12 @@ static void HandleConnect(SINT8 node)
|
|||
|
||||
if (bannednode && bannednode[node])
|
||||
SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server"));
|
||||
else if (netbuffer->u.clientcfg._255 != 255 ||
|
||||
netbuffer->u.clientcfg.packetversion != PACKETVERSION)
|
||||
SV_SendRefuse(node, "Incompatible packet formats.");
|
||||
else if (strncmp(netbuffer->u.clientcfg.application, SRB2APPLICATION,
|
||||
sizeof netbuffer->u.clientcfg.application))
|
||||
SV_SendRefuse(node, "Different SRB2 modifications\nare not compatible.");
|
||||
else if (netbuffer->u.clientcfg.version != VERSION
|
||||
|| netbuffer->u.clientcfg.subversion != SUBVERSION)
|
||||
SV_SendRefuse(node, va(M_GetText("Different SRB2 versions cannot\nplay a netgame!\n(server version %d.%d.%d)"), VERSION/100, VERSION%100, SUBVERSION));
|
||||
|
@ -3687,6 +3711,10 @@ static void HandleServerInfo(SINT8 node)
|
|||
const tic_t ticdiff = (ticnow - ticthen)*1000/NEWTICRATE;
|
||||
netbuffer->u.serverinfo.time = (tic_t)LONG(ticdiff);
|
||||
netbuffer->u.serverinfo.servername[MAXSERVERNAME-1] = 0;
|
||||
netbuffer->u.serverinfo.application
|
||||
[sizeof netbuffer->u.serverinfo.application - 1] = '\0';
|
||||
netbuffer->u.serverinfo.gametypename
|
||||
[sizeof netbuffer->u.serverinfo.gametypename - 1] = '\0';
|
||||
|
||||
SL_InsertServer(&netbuffer->u.serverinfo, node);
|
||||
}
|
||||
|
@ -3798,7 +3826,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
|||
if (client)
|
||||
{
|
||||
maketic = gametic = neededtic = (tic_t)LONG(netbuffer->u.servercfg.gametic);
|
||||
gametype = netbuffer->u.servercfg.gametype;
|
||||
G_SetGametype(netbuffer->u.servercfg.gametype);
|
||||
modifiedgame = netbuffer->u.servercfg.modifiedgame;
|
||||
for (j = 0; j < MAXPLAYERS; j++)
|
||||
adminplayers[j] = netbuffer->u.servercfg.adminplayers[j];
|
||||
|
@ -4170,7 +4198,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||
|
||||
P_SetRandSeed(netbuffer->u.resynchend.randomseed);
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
resynch_read_ctf(&netbuffer->u.resynchend);
|
||||
resynch_read_others(&netbuffer->u.resynchend);
|
||||
|
||||
|
@ -4642,9 +4670,9 @@ static void Local_Maketic(INT32 realtics)
|
|||
// and G_MapEventsToControls
|
||||
if (!dedicated) rendergametic = gametic;
|
||||
// translate inputs (keyboard/mouse/joystick) into game controls
|
||||
G_BuildTiccmd(&localcmds, realtics);
|
||||
G_BuildTiccmd(&localcmds, realtics, 1);
|
||||
if (splitscreen || botingame)
|
||||
G_BuildTiccmd2(&localcmds2, realtics);
|
||||
G_BuildTiccmd(&localcmds2, realtics, 2);
|
||||
|
||||
localcmds.angleturn |= TICCMD_RECEIVED;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,16 @@
|
|||
#include "tables.h"
|
||||
#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.
|
||||
*/
|
||||
#define PACKETVERSION 2
|
||||
|
||||
// Network play related stuff.
|
||||
// There is a data struct that stores network
|
||||
// communication related stuff, and another
|
||||
|
@ -320,8 +330,13 @@ typedef struct {
|
|||
#pragma warning(default : 4200)
|
||||
#endif
|
||||
|
||||
#define MAXAPPLICATION 16
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 _255;/* see serverinfo_pak */
|
||||
UINT8 packetversion;
|
||||
char application[MAXAPPLICATION];
|
||||
UINT8 version; // Different versions don't work
|
||||
UINT8 subversion; // Contains build version
|
||||
UINT8 localplayers;
|
||||
|
@ -334,16 +349,23 @@ typedef struct
|
|||
// This packet is too large
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
In the old packet, 'version' is the first field. Now that field is set
|
||||
to 255 always, so older versions won't be confused with the new
|
||||
versions or vice-versa.
|
||||
*/
|
||||
UINT8 _255;
|
||||
UINT8 packetversion;
|
||||
char application[MAXAPPLICATION];
|
||||
UINT8 version;
|
||||
UINT8 subversion;
|
||||
UINT8 numberofplayer;
|
||||
UINT8 maxplayer;
|
||||
UINT8 gametype;
|
||||
char gametypename[24];
|
||||
UINT8 modifiedgame;
|
||||
UINT8 cheatsenabled;
|
||||
UINT8 isdedicated;
|
||||
UINT8 fileneedednum;
|
||||
SINT8 adminplayer;
|
||||
tic_t time;
|
||||
tic_t leveltime;
|
||||
char servername[MAXSERVERNAME];
|
||||
|
|
167
src/d_main.c
167
src/d_main.c
|
@ -108,6 +108,8 @@ boolean devparm = false; // started game with -devparm
|
|||
boolean singletics = false; // timedemo
|
||||
boolean lastdraw = false;
|
||||
|
||||
static void D_CheckRendererState(void);
|
||||
|
||||
postimg_t postimgtype = postimg_none;
|
||||
INT32 postimgparam;
|
||||
postimg_t postimgtype2 = postimg_none;
|
||||
|
@ -186,14 +188,14 @@ void D_ProcessEvents(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Menu input
|
||||
if (M_Responder(ev))
|
||||
continue; // menu ate the event
|
||||
|
||||
// console input
|
||||
if (CON_Responder(ev))
|
||||
continue; // ate the event
|
||||
|
||||
// Menu input
|
||||
if (M_Responder(ev))
|
||||
continue; // menu ate the event
|
||||
|
||||
G_Responder(ev);
|
||||
}
|
||||
}
|
||||
|
@ -212,6 +214,7 @@ INT16 wipetypepost = -1;
|
|||
|
||||
static void D_Display(void)
|
||||
{
|
||||
INT32 setrenderstillneeded = 0;
|
||||
boolean forcerefresh = false;
|
||||
static boolean wipe = false;
|
||||
INT32 wipedefindex = 0;
|
||||
|
@ -222,11 +225,38 @@ static void D_Display(void)
|
|||
if (nodrawers)
|
||||
return; // for comparative timing/profiling
|
||||
|
||||
// check for change of screen size (video mode)
|
||||
if (setmodeneeded && !wipe)
|
||||
SCR_SetMode(); // change video mode
|
||||
// Lactozilla: Switching renderers works by checking
|
||||
// if the game has to do it right when the frame
|
||||
// needs to render. If so, five things will happen:
|
||||
// 1. Interface functions will be called so
|
||||
// that switching to OpenGL creates a
|
||||
// GL context, and switching to Software
|
||||
// allocates screen buffers.
|
||||
// 2. Software will set drawer functions,
|
||||
// and OpenGL will load textures and
|
||||
// create plane polygons, if necessary.
|
||||
// 3. Functions related to switching video
|
||||
// modes (resolution) are called.
|
||||
// 4. Patch data is freed from memory,
|
||||
// and recached if necessary.
|
||||
// 5. The frame is ready to be drawn!
|
||||
|
||||
if (vid.recalc)
|
||||
// stop movie if needs to change renderer
|
||||
if (setrenderneeded && (moviemode == MM_APNG))
|
||||
M_StopMovie();
|
||||
|
||||
// check for change of renderer or screen size (video mode)
|
||||
if ((setrenderneeded || setmodeneeded) && !wipe)
|
||||
{
|
||||
if (setrenderneeded)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "setrenderneeded set (%d)\n", setrenderneeded);
|
||||
setrenderstillneeded = setrenderneeded;
|
||||
}
|
||||
SCR_SetMode(); // change video mode
|
||||
}
|
||||
|
||||
if (vid.recalc || setrenderstillneeded)
|
||||
{
|
||||
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
|
||||
#ifdef HWRENDER
|
||||
|
@ -237,12 +267,15 @@ static void D_Display(void)
|
|||
}
|
||||
|
||||
// change the view size if needed
|
||||
if (setsizeneeded)
|
||||
if (setsizeneeded || setrenderstillneeded)
|
||||
{
|
||||
R_ExecuteSetViewSize();
|
||||
forcerefresh = true; // force background redraw
|
||||
}
|
||||
|
||||
// Lactozilla: Renderer switching
|
||||
D_CheckRendererState();
|
||||
|
||||
// draw buffered stuff to screen
|
||||
// Used only by linux GGI version
|
||||
I_UpdateNoBlit();
|
||||
|
@ -274,7 +307,10 @@ static void D_Display(void)
|
|||
&& wipetypepre != UINT8_MAX)
|
||||
{
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
// Check for Mega Genesis fade
|
||||
wipestyleflags = WSF_FADEOUT;
|
||||
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);
|
||||
}
|
||||
|
@ -454,7 +490,7 @@ static void D_Display(void)
|
|||
py = 4;
|
||||
else
|
||||
py = viewwindowy + 4;
|
||||
patch = W_CachePatchName("M_PAUSE", PU_CACHE);
|
||||
patch = W_CachePatchName("M_PAUSE", PU_PATCH);
|
||||
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch);
|
||||
#else
|
||||
INT32 y = ((automapactive) ? (32) : (BASEVIDHEIGHT/2));
|
||||
|
@ -466,13 +502,12 @@ static void D_Display(void)
|
|||
// vid size change is now finished if it was on...
|
||||
vid.recalc = 0;
|
||||
|
||||
// FIXME: draw either console or menu, not the two
|
||||
if (gamestate != GS_TIMEATTACK)
|
||||
CON_Drawer();
|
||||
|
||||
M_Drawer(); // menu is drawn even on top of everything
|
||||
// focus lost moved to M_Drawer
|
||||
|
||||
if (gamestate != GS_TIMEATTACK)
|
||||
CON_Drawer();
|
||||
|
||||
//
|
||||
// wipe update
|
||||
//
|
||||
|
@ -488,6 +523,7 @@ static void D_Display(void)
|
|||
if (rendermode != render_none)
|
||||
{
|
||||
F_WipeEndScreen();
|
||||
|
||||
// Funny.
|
||||
if (WipeStageTitle && st_overlay)
|
||||
{
|
||||
|
@ -497,6 +533,14 @@ static void D_Display(void)
|
|||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
|
||||
F_WipeStartScreen();
|
||||
}
|
||||
|
||||
// Check for Mega Genesis fade
|
||||
if (F_ShouldColormapFade())
|
||||
{
|
||||
wipestyleflags |= WSF_FADEIN;
|
||||
wipestyleflags &= ~WSF_FADEOUT;
|
||||
}
|
||||
|
||||
F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
||||
}
|
||||
|
||||
|
@ -545,6 +589,25 @@ static void D_Display(void)
|
|||
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
}
|
||||
|
||||
needpatchflush = false;
|
||||
needpatchrecache = false;
|
||||
}
|
||||
|
||||
// Lactozilla: 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();
|
||||
|
||||
// some patches have been freed,
|
||||
// so cache them again
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
|
@ -562,9 +625,6 @@ void D_SRB2Loop(void)
|
|||
|
||||
// Pushing of + parameters is now done back in D_SRB2Main, not here.
|
||||
|
||||
CONS_Printf("I_StartupKeyboard()...\n");
|
||||
I_StartupKeyboard();
|
||||
|
||||
#ifdef _WINDOWS
|
||||
CONS_Printf("I_StartupMouse()...\n");
|
||||
I_DoStartupMouse();
|
||||
|
@ -591,8 +651,7 @@ void D_SRB2Loop(void)
|
|||
// hack to start on a nice clear console screen.
|
||||
COM_ImmedExecute("cls;version");
|
||||
|
||||
if (rendermode == render_soft)
|
||||
V_DrawScaledPatch(0, 0, 0, (patch_t *)W_CacheLumpNum(W_GetNumForName("CONSBACK"), PU_CACHE));
|
||||
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(W_GetNumForName("CONSBACK"), PU_CACHE));
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
|
||||
for (;;)
|
||||
|
@ -706,7 +765,7 @@ void D_StartTitle(void)
|
|||
|
||||
if (netgame)
|
||||
{
|
||||
if (gametype == GT_COOP)
|
||||
if (gametyperules & GTR_CAMPAIGN)
|
||||
{
|
||||
G_SetGamestate(GS_WAITINGPLAYERS); // hack to prevent a command repeat
|
||||
|
||||
|
@ -753,7 +812,7 @@ void D_StartTitle(void)
|
|||
|
||||
gameaction = ga_nothing;
|
||||
displayplayer = consoleplayer = 0;
|
||||
gametype = GT_COOP;
|
||||
G_SetGametype(GT_COOP);
|
||||
paused = false;
|
||||
advancedemo = false;
|
||||
F_InitMenuPresValues();
|
||||
|
@ -772,7 +831,7 @@ void D_StartTitle(void)
|
|||
CV_SetValue(&cv_usemouse, tutorialusemouse);
|
||||
CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
|
||||
CV_SetValue(&cv_mousemove, tutorialmousemove);
|
||||
CV_SetValue(&cv_analog, tutorialanalog);
|
||||
CV_SetValue(&cv_analog[0], tutorialanalog);
|
||||
M_StartMessage("Do you want to \x82save the recommended \x82movement controls?\x80\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls",
|
||||
M_TutorialSaveControlResponse, MM_YESNO);
|
||||
}
|
||||
|
@ -986,10 +1045,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();
|
||||
|
@ -1109,26 +1166,6 @@ void D_SRB2Main(void)
|
|||
if (M_CheckParm("-server") || dedicated)
|
||||
netgame = server = true;
|
||||
|
||||
if (M_CheckParm("-warp") && M_IsNextParm())
|
||||
{
|
||||
const char *word = M_GetNextParm();
|
||||
char ch; // use this with sscanf to catch non-digits with
|
||||
if (fastncmp(word, "MAP", 3)) // MAPxx name
|
||||
pstartmap = M_MapNumber(word[3], word[4]);
|
||||
else if (sscanf(word, "%d%c", &pstartmap, &ch) != 1) // a plain number
|
||||
I_Error("Cannot warp to map %s (invalid map name)\n", word);
|
||||
// Don't check if lump exists just yet because the wads haven't been loaded!
|
||||
// Just do a basic range check here.
|
||||
if (pstartmap < 1 || pstartmap > NUMMAPS)
|
||||
I_Error("Cannot warp to map %d (out of range)\n", pstartmap);
|
||||
else
|
||||
{
|
||||
if (!M_CheckParm("-server"))
|
||||
G_SetGameModified(true);
|
||||
autostart = true;
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
|
||||
Z_Init();
|
||||
|
||||
|
@ -1185,6 +1222,20 @@ 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
|
||||
|
@ -1193,6 +1244,13 @@ void D_SRB2Main(void)
|
|||
CONS_Printf("I_StartupGraphics()...\n");
|
||||
I_StartupGraphics();
|
||||
|
||||
#ifdef HWRENDER
|
||||
// Lactozilla: Add every hardware mode CVAR and CCMD.
|
||||
// Has to be done before the configuration file loads,
|
||||
// but after the OpenGL library loads.
|
||||
HWR_AddCommands();
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------- CONSOLE
|
||||
// setup loading screen
|
||||
SCR_Startup();
|
||||
|
@ -1223,6 +1281,16 @@ void D_SRB2Main(void)
|
|||
// set user default mode or mode set at cmdline
|
||||
SCR_CheckDefaultMode();
|
||||
|
||||
// Lactozilla: Does the render mode need to change?
|
||||
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
|
||||
{
|
||||
needpatchflush = true;
|
||||
needpatchrecache = true;
|
||||
VID_CheckRenderer();
|
||||
SCR_ChangeRendererCVars(setrenderneeded);
|
||||
}
|
||||
D_CheckRendererState();
|
||||
|
||||
wipegamestate = gamestate;
|
||||
|
||||
savedata.lives = 0; // flag this as not-used
|
||||
|
@ -1281,9 +1349,10 @@ void D_SRB2Main(void)
|
|||
I_StartupSound();
|
||||
I_InitMusic();
|
||||
S_InitSfxChannels(cv_soundvolume.value);
|
||||
S_InitMusicDefs();
|
||||
}
|
||||
|
||||
S_InitMusicDefs();
|
||||
|
||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
ST_Init();
|
||||
|
||||
|
@ -1402,14 +1471,14 @@ void D_SRB2Main(void)
|
|||
if (newgametype == -1) // reached end of the list with no match
|
||||
{
|
||||
j = atoi(sgametype); // assume they gave us a gametype number, which is okay too
|
||||
if (j >= 0 && j < NUMGAMETYPES)
|
||||
if (j >= 0 && j < gametypecount)
|
||||
newgametype = (INT16)j;
|
||||
}
|
||||
|
||||
if (newgametype != -1)
|
||||
{
|
||||
j = gametype;
|
||||
gametype = newgametype;
|
||||
G_SetGametype(newgametype);
|
||||
D_GameTypeChanged(j);
|
||||
}
|
||||
}
|
||||
|
@ -1445,7 +1514,7 @@ void D_SRB2Main(void)
|
|||
{
|
||||
levelstarttic = gametic;
|
||||
G_SetGamestate(GS_LEVEL);
|
||||
if (!P_SetupLevel(false))
|
||||
if (!P_LoadLevel(false))
|
||||
I_Quit(); // fail so reset game stuff
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ extern SINT8 nodetoplayer2[MAXNETNODES]; // Say the numplayer for this node if a
|
|||
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
|
||||
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
|
||||
|
||||
extern boolean serverrunning;
|
||||
|
||||
INT32 Net_GetFreeAcks(boolean urgent);
|
||||
void Net_AckTicker(void);
|
||||
|
||||
|
|
169
src/d_netcmd.c
169
src/d_netcmd.c
|
@ -327,6 +327,10 @@ consvar_t cv_numlaps = {"numlaps", "4", CV_NETVAR|CV_CALL|CV_NOINIT, numlaps_con
|
|||
static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "Map default"}, {0, NULL}};
|
||||
consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Point and time limits for every gametype
|
||||
INT32 pointlimits[NUMGAMETYPES];
|
||||
INT32 timelimits[NUMGAMETYPES];
|
||||
|
||||
// log elemental hazards -- not a netvar, is local to current player
|
||||
consvar_t cv_hazardlog = {"hazardlog", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -381,6 +385,9 @@ char timedemo_csv_id[256];
|
|||
boolean timedemo_quit;
|
||||
|
||||
INT16 gametype = GT_COOP;
|
||||
UINT32 gametyperules = 0;
|
||||
INT16 gametypecount = (GT_CTF + 1);
|
||||
|
||||
boolean splitscreen = false;
|
||||
boolean circuitmap = false;
|
||||
INT32 adminplayers[MAXPLAYERS];
|
||||
|
@ -775,6 +782,10 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_fireaxis2);
|
||||
CV_RegisterVar(&cv_firenaxis);
|
||||
CV_RegisterVar(&cv_firenaxis2);
|
||||
CV_RegisterVar(&cv_deadzone);
|
||||
CV_RegisterVar(&cv_deadzone2);
|
||||
CV_RegisterVar(&cv_digitaldeadzone);
|
||||
CV_RegisterVar(&cv_digitaldeadzone2);
|
||||
|
||||
// filesrch.c
|
||||
CV_RegisterVar(&cv_addons_option);
|
||||
|
@ -813,17 +824,35 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_joyscale2);
|
||||
|
||||
// Analog Control
|
||||
CV_RegisterVar(&cv_analog);
|
||||
CV_RegisterVar(&cv_analog2);
|
||||
CV_RegisterVar(&cv_useranalog);
|
||||
CV_RegisterVar(&cv_useranalog2);
|
||||
CV_RegisterVar(&cv_analog[0]);
|
||||
CV_RegisterVar(&cv_analog[1]);
|
||||
CV_RegisterVar(&cv_useranalog[0]);
|
||||
CV_RegisterVar(&cv_useranalog[1]);
|
||||
|
||||
// deez New User eXperiences
|
||||
CV_RegisterVar(&cv_directionchar);
|
||||
CV_RegisterVar(&cv_directionchar2);
|
||||
CV_RegisterVar(&cv_directionchar[0]);
|
||||
CV_RegisterVar(&cv_directionchar[1]);
|
||||
CV_RegisterVar(&cv_autobrake);
|
||||
CV_RegisterVar(&cv_autobrake2);
|
||||
|
||||
// hi here's some new controls
|
||||
CV_RegisterVar(&cv_cam_shiftfacing[0]);
|
||||
CV_RegisterVar(&cv_cam_shiftfacing[1]);
|
||||
CV_RegisterVar(&cv_cam_turnfacing[0]);
|
||||
CV_RegisterVar(&cv_cam_turnfacing[1]);
|
||||
CV_RegisterVar(&cv_cam_turnfacingability[0]);
|
||||
CV_RegisterVar(&cv_cam_turnfacingability[1]);
|
||||
CV_RegisterVar(&cv_cam_turnfacingspindash[0]);
|
||||
CV_RegisterVar(&cv_cam_turnfacingspindash[1]);
|
||||
CV_RegisterVar(&cv_cam_turnfacinginput[0]);
|
||||
CV_RegisterVar(&cv_cam_turnfacinginput[1]);
|
||||
CV_RegisterVar(&cv_cam_centertoggle[0]);
|
||||
CV_RegisterVar(&cv_cam_centertoggle[1]);
|
||||
CV_RegisterVar(&cv_cam_lockedinput[0]);
|
||||
CV_RegisterVar(&cv_cam_lockedinput[1]);
|
||||
CV_RegisterVar(&cv_cam_lockonboss[0]);
|
||||
CV_RegisterVar(&cv_cam_lockonboss[1]);
|
||||
|
||||
// s_sound.c
|
||||
CV_RegisterVar(&cv_soundvolume);
|
||||
CV_RegisterVar(&cv_closedcaptioning);
|
||||
|
@ -838,6 +867,10 @@ void D_RegisterClientCommands(void)
|
|||
// screen.c
|
||||
CV_RegisterVar(&cv_fullscreen);
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
CV_RegisterVar(&cv_renderer);
|
||||
#ifdef HWRENDER
|
||||
CV_RegisterVar(&cv_newrenderer);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_scr_depth);
|
||||
CV_RegisterVar(&cv_scr_width);
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
@ -1117,7 +1150,7 @@ UINT8 CanChangeSkin(INT32 playernum)
|
|||
return true;
|
||||
|
||||
// Can change skin during initial countdown.
|
||||
if ((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE)
|
||||
if ((gametyperules & GTR_RACE) && leveltime < 4*TICRATE)
|
||||
return true;
|
||||
|
||||
if (G_TagGametype())
|
||||
|
@ -1167,7 +1200,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;
|
||||
|
@ -1477,9 +1510,9 @@ void SendWeaponPref(void)
|
|||
buf[0] = 0;
|
||||
if (cv_flipcam.value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog.value)
|
||||
if (cv_analog[0].value && cv_directionchar[0].value != 2)
|
||||
buf[0] |= 2;
|
||||
if (cv_directionchar.value)
|
||||
if (cv_directionchar[0].value == 1)
|
||||
buf[0] |= 4;
|
||||
if (cv_autobrake.value)
|
||||
buf[0] |= 8;
|
||||
|
@ -1493,9 +1526,9 @@ void SendWeaponPref2(void)
|
|||
buf[0] = 0;
|
||||
if (cv_flipcam2.value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog2.value)
|
||||
if (cv_analog[1].value && cv_directionchar[1].value != 2)
|
||||
buf[0] |= 2;
|
||||
if (cv_directionchar2.value)
|
||||
if (cv_directionchar[1].value == 1)
|
||||
buf[0] |= 4;
|
||||
if (cv_autobrake2.value)
|
||||
buf[0] |= 8;
|
||||
|
@ -1789,18 +1822,15 @@ static void Command_Map_f(void)
|
|||
boolean newresetplayers;
|
||||
|
||||
boolean mustmodifygame;
|
||||
boolean usemapcode = false;
|
||||
|
||||
INT32 newmapnum;
|
||||
|
||||
char * mapname;
|
||||
size_t mapnamelen;
|
||||
char *realmapname = NULL;
|
||||
|
||||
INT32 newgametype = gametype;
|
||||
|
||||
INT32 d;
|
||||
char *p;
|
||||
|
||||
if (client && !IsPlayerAdmin(consoleplayer))
|
||||
{
|
||||
|
@ -1860,56 +1890,16 @@ static void Command_Map_f(void)
|
|||
}
|
||||
|
||||
mapname = ConcatCommandArgv(1, first_option);
|
||||
mapnamelen = strlen(mapname);
|
||||
|
||||
if (mapnamelen == 2)/* maybe two digit code */
|
||||
{
|
||||
if (( newmapnum = M_MapNumber(mapname[0], mapname[1]) ))
|
||||
usemapcode = true;
|
||||
}
|
||||
else if (mapnamelen == 5 && strnicmp(mapname, "MAP", 3) == 0)
|
||||
{
|
||||
if (( newmapnum = M_MapNumber(mapname[3], mapname[4]) ) == 0)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Invalid map code '%s'.\n"), mapname);
|
||||
Z_Free(mapname);
|
||||
return;
|
||||
}
|
||||
usemapcode = true;
|
||||
}
|
||||
newmapnum = G_FindMapByNameOrCode(mapname, &realmapname);
|
||||
|
||||
if (!usemapcode)
|
||||
{
|
||||
/* Now detect map number in base 10, which no one asked for. */
|
||||
newmapnum = strtol(mapname, &p, 10);
|
||||
if (*p == '\0')/* we got it */
|
||||
{
|
||||
if (newmapnum < 1 || newmapnum > NUMMAPS)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Invalid map number %d.\n"), newmapnum);
|
||||
Z_Free(mapname);
|
||||
return;
|
||||
}
|
||||
usemapcode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
newmapnum = G_FindMap(mapname, &realmapname, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (newmapnum == 0 || !mapheaderinfo[newmapnum-1])
|
||||
if (newmapnum == 0)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Could not find any map described as '%s'.\n"), mapname);
|
||||
Z_Free(mapname);
|
||||
return;
|
||||
}
|
||||
|
||||
if (usemapcode)
|
||||
{
|
||||
realmapname = G_BuildMapTitle(newmapnum);
|
||||
}
|
||||
|
||||
if (mustmodifygame && option_force)
|
||||
{
|
||||
G_SetGameModified(false);
|
||||
|
@ -1929,7 +1919,7 @@ static void Command_Map_f(void)
|
|||
if (isdigit(gametypename[0]))
|
||||
{
|
||||
d = atoi(gametypename);
|
||||
if (d >= 0 && d < NUMGAMETYPES)
|
||||
if (d >= 0 && d < gametypecount)
|
||||
newgametype = d;
|
||||
else
|
||||
{
|
||||
|
@ -1937,7 +1927,7 @@ static void Command_Map_f(void)
|
|||
"Gametype number %d is out of range. Use a number between"
|
||||
" 0 and %d inclusive. ...Or just use the name. :v\n",
|
||||
d,
|
||||
NUMGAMETYPES-1);
|
||||
gametypecount-1);
|
||||
Z_Free(realmapname);
|
||||
Z_Free(mapname);
|
||||
return;
|
||||
|
@ -2003,7 +1993,7 @@ static void Command_Map_f(void)
|
|||
CV_SetValue(&cv_usemouse, tutorialusemouse);
|
||||
CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
|
||||
CV_SetValue(&cv_mousemove, tutorialmousemove);
|
||||
CV_SetValue(&cv_analog, tutorialanalog);
|
||||
CV_SetValue(&cv_analog[0], tutorialanalog);
|
||||
}
|
||||
tutorialmode = false; // warping takes us out of tutorial mode
|
||||
|
||||
|
@ -2050,8 +2040,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
|
||||
lastgametype = gametype;
|
||||
gametype = READUINT8(*cp);
|
||||
G_SetGametype(gametype); // I fear putting that macro as an argument
|
||||
|
||||
if (gametype < 0 || gametype >= NUMGAMETYPES)
|
||||
if (gametype < 0 || gametype >= gametypecount)
|
||||
gametype = lastgametype;
|
||||
else if (gametype != lastgametype)
|
||||
D_GameTypeChanged(lastgametype); // emulate consvar_t behavior for gametype
|
||||
|
@ -2176,6 +2167,8 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
|||
else
|
||||
S_ResumeAudio();
|
||||
}
|
||||
|
||||
I_UpdateMouseGrab();
|
||||
}
|
||||
|
||||
// Command for stuck characters in netgames, griefing, etc.
|
||||
|
@ -2376,7 +2369,7 @@ static void Command_Teamchange_f(void)
|
|||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
|
@ -2473,7 +2466,7 @@ static void Command_Teamchange2_f(void)
|
|||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
|
@ -2602,7 +2595,7 @@ static void Command_ServerTeamChange_f(void)
|
|||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
|
@ -2673,6 +2666,16 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
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)))
|
||||
error = true;
|
||||
|
||||
//Make sure that the right team number is sent. Keep in mind that normal clients cannot change to certain teams in certain gametypes.
|
||||
switch (gametype)
|
||||
{
|
||||
|
@ -2823,7 +2826,15 @@ 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
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
|
@ -3523,7 +3534,7 @@ static void Command_ShowGametype_f(void)
|
|||
}
|
||||
|
||||
// get name string for current gametype
|
||||
if (gametype >= 0 && gametype < NUMGAMETYPES)
|
||||
if (gametype >= 0 && gametype < gametypecount)
|
||||
gametypestr = Gametype_Names[gametype];
|
||||
|
||||
if (gametypestr)
|
||||
|
@ -3585,7 +3596,7 @@ void ItemFinder_OnChange(void)
|
|||
static void PointLimit_OnChange(void)
|
||||
{
|
||||
// Don't allow pointlimit in Single Player/Co-Op/Race!
|
||||
if (server && Playing() && G_PlatformGametype())
|
||||
if (server && Playing() && !(gametyperules & GTR_POINTLIMIT))
|
||||
{
|
||||
if (cv_pointlimit.value)
|
||||
CV_StealthSetValue(&cv_pointlimit, 0);
|
||||
|
@ -3624,7 +3635,7 @@ static void CoopStarposts_OnChange(void)
|
|||
{
|
||||
INT32 i;
|
||||
|
||||
if (!(netgame || multiplayer) || gametype != GT_COOP)
|
||||
if (!(netgame || multiplayer) || !G_GametypeUsesCoopStarposts())
|
||||
return;
|
||||
|
||||
switch (cv_coopstarposts.value)
|
||||
|
@ -3679,7 +3690,7 @@ static void CoopLives_OnChange(void)
|
|||
{
|
||||
INT32 i;
|
||||
|
||||
if (!(netgame || multiplayer) || gametype != GT_COOP)
|
||||
if (!(netgame || multiplayer) || !G_GametypeUsesCoopLives())
|
||||
return;
|
||||
|
||||
switch (cv_cooplives.value)
|
||||
|
@ -3748,7 +3759,7 @@ UINT32 timelimitintics = 0;
|
|||
static void TimeLimit_OnChange(void)
|
||||
{
|
||||
// Don't allow timelimit in Single Player/Co-Op/Race!
|
||||
if (server && Playing() && cv_timelimit.value != 0 && G_PlatformGametype())
|
||||
if (server && Playing() && cv_timelimit.value != 0 && !(gametyperules & GTR_TIMELIMIT))
|
||||
{
|
||||
CV_SetValue(&cv_timelimit, 0);
|
||||
return;
|
||||
|
@ -3784,9 +3795,9 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
{
|
||||
const char *oldgt = NULL, *newgt = NULL;
|
||||
|
||||
if (lastgametype >= 0 && lastgametype < NUMGAMETYPES)
|
||||
if (lastgametype >= 0 && lastgametype < gametypecount)
|
||||
oldgt = Gametype_Names[lastgametype];
|
||||
if (gametype >= 0 && lastgametype < NUMGAMETYPES)
|
||||
if (gametype >= 0 && lastgametype < gametypecount)
|
||||
newgt = Gametype_Names[gametype];
|
||||
|
||||
if (oldgt && newgt)
|
||||
|
@ -3840,11 +3851,20 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
break;
|
||||
default:
|
||||
if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits
|
||||
{
|
||||
CV_SetValue(&cv_timelimit, timelimits[gametype]);
|
||||
CV_SetValue(&cv_pointlimit, pointlimits[gametype]);
|
||||
}
|
||||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!multiplayer && !netgame)
|
||||
{
|
||||
gametype = GT_COOP;
|
||||
G_SetGametype(GT_COOP);
|
||||
// These shouldn't matter anymore
|
||||
//CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue);
|
||||
//CV_SetValue(&cv_itemrespawn, 0);
|
||||
|
@ -3853,7 +3873,7 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
// reset timelimit and pointlimit in race/coop, prevent stupid cheats
|
||||
if (server)
|
||||
{
|
||||
if (G_PlatformGametype())
|
||||
if (!(gametyperules & GTR_POINTLIMIT))
|
||||
{
|
||||
if (cv_timelimit.value)
|
||||
CV_SetValue(&cv_timelimit, 0);
|
||||
|
@ -3871,6 +3891,7 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
|
||||
// When swapping to a gametype that supports spectators,
|
||||
// make everyone a spectator initially.
|
||||
// Averted with GTR_NOSPECTATORSPAWN.
|
||||
if (!splitscreen && (G_GametypeHasSpectators()))
|
||||
{
|
||||
INT32 i;
|
||||
|
@ -3878,7 +3899,7 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
if (playeringame[i])
|
||||
{
|
||||
players[i].ctfteam = 0;
|
||||
players[i].spectator = true;
|
||||
players[i].spectator = (gametyperules & GTR_NOSPECTATORSPAWN) ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
653
src/dehacked.c
653
src/dehacked.c
|
@ -22,6 +22,7 @@
|
|||
#include "m_menu.h"
|
||||
#include "m_misc.h"
|
||||
#include "f_finale.h"
|
||||
#include "y_inter.h"
|
||||
#include "dehacked.h"
|
||||
#include "st_stuff.h"
|
||||
#include "i_system.h"
|
||||
|
@ -76,6 +77,7 @@ static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
|
|||
static hudnum_t get_huditem(const char *word);
|
||||
static menutype_t get_menutype(const char *word);
|
||||
#ifndef HAVE_BLUA
|
||||
static INT16 get_gametype(const char *word);
|
||||
static powertype_t get_power(const char *word);
|
||||
#endif
|
||||
|
||||
|
@ -242,6 +244,7 @@ INT32 flags; Bits = 3232 MF_SOLID|MF_SHOOTABLE|MF_DROPOFF|M
|
|||
INT32 raisestate; Respawn frame = 32 S_NULL // raisestate
|
||||
}, */
|
||||
|
||||
#ifdef HWRENDER
|
||||
static INT32 searchvalue(const char *s)
|
||||
{
|
||||
while (s[0] != '=' && s[0])
|
||||
|
@ -255,7 +258,6 @@ static INT32 searchvalue(const char *s)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
static float searchfvalue(const char *s)
|
||||
{
|
||||
while (s[0] != '=' && s[0])
|
||||
|
@ -590,6 +592,16 @@ static void readfreeslots(MYFILE *f)
|
|||
} else
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n");
|
||||
}
|
||||
else if (fastcmp(type, "TOL"))
|
||||
{
|
||||
if (lastcustomtol > 31)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n");
|
||||
else
|
||||
{
|
||||
G_AddTOL((1<<lastcustomtol), word);
|
||||
lastcustomtol++;
|
||||
}
|
||||
}
|
||||
else
|
||||
deh_warning("Freeslots: unknown enum class '%s' for '%s_%s'", type, type, word);
|
||||
}
|
||||
|
@ -863,14 +875,12 @@ static void readspriteframe(MYFILE *f, spriteinfo_t *sprinfo, UINT8 frame)
|
|||
strupr(word);
|
||||
value = atoi(word2); // used for numerical settings
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (fastcmp(word, "XPIVOT"))
|
||||
sprinfo->pivot[frame].x = value;
|
||||
else if (fastcmp(word, "YPIVOT"))
|
||||
sprinfo->pivot[frame].y = value;
|
||||
else if (fastcmp(word, "ROTAXIS"))
|
||||
sprinfo->pivot[frame].rotaxis = value;
|
||||
#endif
|
||||
else
|
||||
{
|
||||
f->curpos = lastline;
|
||||
|
@ -886,7 +896,9 @@ static void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
|
|||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
char *word, *word2;
|
||||
char *tmp;
|
||||
#ifdef HWRENDER
|
||||
INT32 value;
|
||||
#endif
|
||||
char *lastline;
|
||||
INT32 skinnumbers[MAXSKINS];
|
||||
INT32 foundskins = 0;
|
||||
|
@ -947,9 +959,9 @@ static void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
|
|||
break;
|
||||
}
|
||||
strupr(word);
|
||||
#ifdef HWRENDER
|
||||
value = atoi(word2); // used for numerical settings
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (fastcmp(word, "LIGHTTYPE"))
|
||||
{
|
||||
if (sprite2)
|
||||
|
@ -1093,10 +1105,10 @@ static void readsprite2(MYFILE *f, INT32 num)
|
|||
Z_Free(s);
|
||||
}
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
const UINT16 flag;
|
||||
} TYPEOFLEVEL[] = {
|
||||
INT32 numtolinfo = NUMBASETOL;
|
||||
UINT32 lastcustomtol = 13;
|
||||
|
||||
tolinfo_t TYPEOFLEVEL[NUMMAXTOL] = {
|
||||
{"SOLO",TOL_SP},
|
||||
{"SP",TOL_SP},
|
||||
{"SINGLEPLAYER",TOL_SP},
|
||||
|
@ -1112,8 +1124,6 @@ static const struct {
|
|||
{"TAG",TOL_TAG},
|
||||
{"CTF",TOL_CTF},
|
||||
|
||||
{"CUSTOM",TOL_CUSTOM},
|
||||
|
||||
{"2D",TOL_2D},
|
||||
{"MARIO",TOL_MARIO},
|
||||
{"NIGHTS",TOL_NIGHTS},
|
||||
|
@ -1126,6 +1136,216 @@ static const struct {
|
|||
{NULL, 0}
|
||||
};
|
||||
|
||||
// copypasted from readPlayer :sleep:
|
||||
static const char *const GAMETYPERULE_LIST[];
|
||||
static void readgametype(MYFILE *f, char *gtname)
|
||||
{
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
char *word;
|
||||
char *word2, *word2lwr = NULL;
|
||||
char *tmp;
|
||||
INT32 i, j;
|
||||
|
||||
INT16 newgtidx = 0;
|
||||
UINT32 newgtrules = 0;
|
||||
UINT32 newgttol = 0;
|
||||
INT32 newgtpointlimit = 0;
|
||||
INT32 newgttimelimit = 0;
|
||||
UINT8 newgtleftcolor = 0;
|
||||
UINT8 newgtrightcolor = 0;
|
||||
INT16 newgtrankingstype = -1;
|
||||
int newgtinttype = 0;
|
||||
char gtdescription[441];
|
||||
char gtconst[MAXLINELEN];
|
||||
|
||||
// Empty strings.
|
||||
gtdescription[0] = '\0';
|
||||
gtconst[0] = '\0';
|
||||
|
||||
do
|
||||
{
|
||||
if (myfgets(s, MAXLINELEN, f))
|
||||
{
|
||||
if (s[0] == '\n')
|
||||
break;
|
||||
|
||||
word = strtok(s, " ");
|
||||
if (word)
|
||||
strupr(word);
|
||||
else
|
||||
break;
|
||||
|
||||
if (fastcmp(word, "DESCRIPTION"))
|
||||
{
|
||||
char *descr = NULL;
|
||||
|
||||
for (i = 0; i < MAXLINELEN-3; i++)
|
||||
{
|
||||
if (s[i] == '=')
|
||||
{
|
||||
descr = &s[i+2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (descr)
|
||||
{
|
||||
strcpy(gtdescription, descr);
|
||||
strcat(gtdescription, myhashfgets(descr, sizeof (gtdescription), f));
|
||||
}
|
||||
else
|
||||
strcpy(gtdescription, "");
|
||||
|
||||
// For some reason, cutting the string did not work above. Most likely due to strcpy or strcat...
|
||||
// It works down here, though.
|
||||
{
|
||||
INT32 numline = 0;
|
||||
for (i = 0; i < MAXLINELEN-1; i++)
|
||||
{
|
||||
if (numline < 20 && gtdescription[i] == '\n')
|
||||
numline++;
|
||||
|
||||
if (numline >= 20 || gtdescription[i] == '\0' || gtdescription[i] == '#')
|
||||
break;
|
||||
}
|
||||
}
|
||||
gtdescription[strlen(gtdescription)-1] = '\0';
|
||||
gtdescription[i] = '\0';
|
||||
continue;
|
||||
}
|
||||
|
||||
word2 = strtok(NULL, " = ");
|
||||
if (word2)
|
||||
{
|
||||
if (!word2lwr)
|
||||
word2lwr = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
strcpy(word2lwr, word2);
|
||||
strupr(word2);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
if (word2[strlen(word2)-1] == '\n')
|
||||
word2[strlen(word2)-1] = '\0';
|
||||
i = atoi(word2);
|
||||
|
||||
// Game type rules
|
||||
if (fastcmp(word, "RULES"))
|
||||
{
|
||||
// GTR_
|
||||
newgtrules = (UINT32)get_number(word2);
|
||||
}
|
||||
// Identifier
|
||||
else if (fastcmp(word, "IDENTIFIER"))
|
||||
{
|
||||
// GT_
|
||||
strncpy(gtconst, word2, MAXLINELEN);
|
||||
}
|
||||
// Point and time limits
|
||||
else if (fastcmp(word, "DEFAULTPOINTLIMIT"))
|
||||
newgtpointlimit = (INT32)i;
|
||||
else if (fastcmp(word, "DEFAULTTIMELIMIT"))
|
||||
newgttimelimit = (INT32)i;
|
||||
// Level platter
|
||||
else if (fastcmp(word, "HEADERCOLOR") || fastcmp(word, "HEADERCOLOUR"))
|
||||
newgtleftcolor = newgtrightcolor = (UINT8)get_number(word2);
|
||||
else if (fastcmp(word, "HEADERLEFTCOLOR") || fastcmp(word, "HEADERLEFTCOLOUR"))
|
||||
newgtleftcolor = (UINT8)get_number(word2);
|
||||
else if (fastcmp(word, "HEADERRIGHTCOLOR") || fastcmp(word, "HEADERRIGHTCOLOUR"))
|
||||
newgtrightcolor = (UINT8)get_number(word2);
|
||||
// Rankings type
|
||||
else if (fastcmp(word, "RANKINGTYPE"))
|
||||
{
|
||||
// Case insensitive
|
||||
newgtrankingstype = (int)get_number(word2);
|
||||
}
|
||||
// Intermission type
|
||||
else if (fastcmp(word, "INTERMISSIONTYPE"))
|
||||
{
|
||||
// Case sensitive
|
||||
newgtinttype = (int)get_number(word2lwr);
|
||||
}
|
||||
// Type of level
|
||||
else if (fastcmp(word, "TYPEOFLEVEL"))
|
||||
{
|
||||
if (i) // it's just a number
|
||||
newgttol = (UINT32)i;
|
||||
else
|
||||
{
|
||||
UINT16 tol = 0;
|
||||
tmp = strtok(word2,",");
|
||||
do {
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
if (fasticmp(tmp, TYPEOFLEVEL[i].name))
|
||||
break;
|
||||
if (!TYPEOFLEVEL[i].name)
|
||||
deh_warning("readgametype %s: unknown typeoflevel flag %s\n", gtname, tmp);
|
||||
tol |= TYPEOFLEVEL[i].flag;
|
||||
} while((tmp = strtok(NULL,",")) != NULL);
|
||||
newgttol = tol;
|
||||
}
|
||||
}
|
||||
// The SOC probably provided gametype rules as words,
|
||||
// instead of using the RULES keyword.
|
||||
// Like for example "NOSPECTATORSPAWN = TRUE".
|
||||
// This is completely valid, and looks better anyway.
|
||||
else
|
||||
{
|
||||
UINT32 wordgt = 0;
|
||||
for (j = 0; GAMETYPERULE_LIST[j]; j++)
|
||||
if (fastcmp(word, GAMETYPERULE_LIST[j])) {
|
||||
if (!j) // GTR_CAMPAIGN
|
||||
wordgt |= 1;
|
||||
else
|
||||
wordgt |= (1<<j);
|
||||
if (i || word2[0] == 'T' || word2[0] == 'Y')
|
||||
newgtrules |= wordgt;
|
||||
break;
|
||||
}
|
||||
if (!wordgt)
|
||||
deh_warning("readgametype %s: unknown word '%s'", gtname, word);
|
||||
}
|
||||
}
|
||||
} while (!myfeof(f)); // finish when the line is empty
|
||||
|
||||
// Free strings.
|
||||
Z_Free(s);
|
||||
if (word2lwr)
|
||||
Z_Free(word2lwr);
|
||||
|
||||
// Ran out of gametype slots
|
||||
if (gametypecount == NUMGAMETYPEFREESLOTS)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free gametype slots!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the new gametype
|
||||
newgtidx = G_AddGametype(newgtrules);
|
||||
G_AddGametypeTOL(newgtidx, newgttol);
|
||||
G_SetGametypeDescription(newgtidx, gtdescription, newgtleftcolor, newgtrightcolor);
|
||||
|
||||
// Not covered by G_AddGametype alone.
|
||||
if (newgtrankingstype == -1)
|
||||
newgtrankingstype = newgtidx;
|
||||
gametyperankings[newgtidx] = newgtrankingstype;
|
||||
intermissiontypes[newgtidx] = newgtinttype;
|
||||
pointlimits[newgtidx] = newgtpointlimit;
|
||||
timelimits[newgtidx] = newgttimelimit;
|
||||
|
||||
// Write the new gametype name.
|
||||
Gametype_Names[newgtidx] = Z_StrDup((const char *)gtname);
|
||||
|
||||
// Write the constant name.
|
||||
if (gtconst[0] == '\0')
|
||||
strncpy(gtconst, gtname, MAXLINELEN);
|
||||
G_AddGametypeConstant(newgtidx, (const char *)gtconst);
|
||||
|
||||
// Update gametype_cons_t accordingly.
|
||||
G_UpdateGametypeSelections();
|
||||
|
||||
CONS_Printf("Added gametype %s\n", Gametype_Names[newgtidx]);
|
||||
}
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
const mobjtype_t type;
|
||||
|
@ -1393,7 +1613,7 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
else if (fastcmp(word, "TYPEOFLEVEL"))
|
||||
{
|
||||
if (i) // it's just a number
|
||||
mapheaderinfo[num-1]->typeoflevel = (UINT16)i;
|
||||
mapheaderinfo[num-1]->typeoflevel = (UINT32)i;
|
||||
else
|
||||
{
|
||||
UINT16 tol = 0;
|
||||
|
@ -1409,6 +1629,11 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
mapheaderinfo[num-1]->typeoflevel = tol;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "KEYWORDS"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->keywords, word2,
|
||||
sizeof(mapheaderinfo[num-1]->keywords), va("Level header %d: keywords", num));
|
||||
}
|
||||
else if (fastcmp(word, "MUSIC"))
|
||||
{
|
||||
if (fastcmp(word2, "NONE"))
|
||||
|
@ -1518,10 +1743,27 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
deh_warning("Level header %d: invalid bonus type number %d", num, i);
|
||||
}
|
||||
|
||||
// Title card
|
||||
else if (fastcmp(word, "TITLECARDZIGZAG"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->ltzzpatch, word2,
|
||||
sizeof(mapheaderinfo[num-1]->ltzzpatch), va("Level header %d: title card zigzag patch name", num));
|
||||
}
|
||||
else if (fastcmp(word, "TITLECARDZIGZAGTEXT"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->ltzztext, word2,
|
||||
sizeof(mapheaderinfo[num-1]->ltzztext), va("Level header %d: title card zigzag text patch name", num));
|
||||
}
|
||||
else if (fastcmp(word, "TITLECARDACTDIAMOND"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->ltactdiamond, word2,
|
||||
sizeof(mapheaderinfo[num-1]->ltactdiamond), va("Level header %d: title card act diamond patch name", num));
|
||||
}
|
||||
|
||||
else if (fastcmp(word, "MAXBONUSLIVES"))
|
||||
mapheaderinfo[num-1]->maxbonuslives = (SINT8)i;
|
||||
else if (fastcmp(word, "LEVELFLAGS"))
|
||||
mapheaderinfo[num-1]->levelflags = (UINT8)i;
|
||||
mapheaderinfo[num-1]->levelflags = (UINT16)i;
|
||||
else if (fastcmp(word, "MENUFLAGS"))
|
||||
mapheaderinfo[num-1]->menuflags = (UINT8)i;
|
||||
|
||||
|
@ -2671,11 +2913,9 @@ static actionpointer_t actionpointers[] =
|
|||
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
|
||||
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
|
||||
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
|
||||
#ifdef ROTSPRITE
|
||||
{{A_RollAngle}, "A_ROLLANGLE"},
|
||||
{{A_ChangeRollAngleRelative},"A_CHANGEROLLANGLERELATIVE"},
|
||||
{{A_ChangeRollAngleAbsolute},"A_CHANGEROLLANGLEABSOLUTE"},
|
||||
#endif
|
||||
{{A_PlaySound}, "A_PLAYSOUND"},
|
||||
{{A_FindTarget}, "A_FINDTARGET"},
|
||||
{{A_FindTracer}, "A_FINDTRACER"},
|
||||
|
@ -3195,6 +3435,8 @@ static void readextraemblemdata(MYFILE *f, INT32 num)
|
|||
sizeof (extraemblems[num-1].description), va("Extra emblem %d: objective", num));
|
||||
else if (fastcmp(word, "CONDITIONSET"))
|
||||
extraemblems[num-1].conditionset = (UINT8)value;
|
||||
else if (fastcmp(word, "SHOWCONDITIONSET"))
|
||||
extraemblems[num-1].showconditionset = (UINT8)value;
|
||||
else
|
||||
{
|
||||
strupr(word2);
|
||||
|
@ -3281,6 +3523,8 @@ static void readunlockable(MYFILE *f, INT32 num)
|
|||
unlockables[num].height = (UINT16)i;
|
||||
else if (fastcmp(word, "CONDITIONSET"))
|
||||
unlockables[num].conditionset = (UINT8)i;
|
||||
else if (fastcmp(word, "SHOWCONDITIONSET"))
|
||||
unlockables[num].showconditionset = (UINT8)i;
|
||||
else if (fastcmp(word, "NOCECHO"))
|
||||
unlockables[num].nocecho = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y');
|
||||
else if (fastcmp(word, "NOCHECKLIST"))
|
||||
|
@ -4153,6 +4397,7 @@ static void ignorelines(MYFILE *f)
|
|||
static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
||||
{
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
char textline[MAXLINELEN];
|
||||
char *word;
|
||||
char *word2;
|
||||
INT32 i;
|
||||
|
@ -4173,6 +4418,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
char *traverse;
|
||||
|
||||
myfgets(s, MAXLINELEN, f);
|
||||
memcpy(textline, s, MAXLINELEN);
|
||||
if (s[0] == '\n' || s[0] == '#')
|
||||
continue;
|
||||
|
||||
|
@ -4361,6 +4607,36 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
ignorelines(f);
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "GAMETYPE"))
|
||||
{
|
||||
// Get the gametype name from textline
|
||||
// instead of word2, so that gametype names
|
||||
// aren't allcaps
|
||||
INT32 c;
|
||||
for (c = 0; c < MAXLINELEN; c++)
|
||||
{
|
||||
if (textline[c] == '\0')
|
||||
break;
|
||||
if (textline[c] == ' ')
|
||||
{
|
||||
char *gtname = (textline+c+1);
|
||||
if (gtname)
|
||||
{
|
||||
// remove funny characters
|
||||
INT32 j;
|
||||
for (j = 0; j < (MAXLINELEN - c); j++)
|
||||
{
|
||||
if (gtname[j] == '\0')
|
||||
break;
|
||||
if (gtname[j] < 32)
|
||||
gtname[j] = '\0';
|
||||
}
|
||||
readgametype(f, gtname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "CUTSCENE"))
|
||||
{
|
||||
if (i > 0 && i < 129)
|
||||
|
@ -4460,20 +4736,34 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
ignorelines(f);
|
||||
}
|
||||
}
|
||||
// Last I heard this crashes the game if you try to use it
|
||||
// so this is disabled for now
|
||||
// -- Monster Iestyn
|
||||
/* else if (fastcmp(word, "SRB2"))
|
||||
else if (fastcmp(word, "SRB2"))
|
||||
{
|
||||
INT32 ver = searchvalue(strtok(NULL, "\n"));
|
||||
if (ver != PATCHVERSION)
|
||||
deh_warning("Patch is for SRB2 version %d,\nonly version %d is supported", ver, PATCHVERSION);
|
||||
if (isdigit(word2[0]))
|
||||
{
|
||||
i = atoi(word2);
|
||||
if (i != PATCHVERSION)
|
||||
{
|
||||
deh_warning(
|
||||
"Patch is for SRB2 version %d, "
|
||||
"only version %d is supported",
|
||||
i,
|
||||
PATCHVERSION
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
deh_warning(
|
||||
"SRB2 version definition has incorrect format, "
|
||||
"use \"SRB2 %d\"",
|
||||
PATCHVERSION
|
||||
);
|
||||
}
|
||||
}
|
||||
// Clear all data in certain locations (mostly for unlocks)
|
||||
// Unless you REALLY want to piss people off,
|
||||
// define a custom gamedata /before/ doing this!!
|
||||
// (then again, modifiedgame will prevent game data saving anyway)
|
||||
*/
|
||||
else if (fastcmp(word, "CLEAR"))
|
||||
{
|
||||
boolean clearall = (fastcmp(word2, "ALL"));
|
||||
|
@ -4523,11 +4813,13 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
if (introchanged)
|
||||
{
|
||||
menuactive = false;
|
||||
I_UpdateMouseGrab();
|
||||
COM_BufAddText("playintro");
|
||||
}
|
||||
else if (titlechanged)
|
||||
{
|
||||
menuactive = false;
|
||||
I_UpdateMouseGrab();
|
||||
COM_BufAddText("exitgame"); // Command_ExitGame_f() but delayed
|
||||
}
|
||||
}
|
||||
|
@ -5728,6 +6020,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
|||
"S_SIGNSTOP",
|
||||
"S_SIGNBOARD",
|
||||
"S_EGGMANSIGN",
|
||||
"S_CLEARSIGN",
|
||||
|
||||
// Spike Ball
|
||||
"S_SPIKEBALL1",
|
||||
|
@ -8386,6 +8679,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
|
|||
"MT_NIGHTSCHIP", // NiGHTS Chip
|
||||
"MT_FLINGNIGHTSCHIP", // Lost NiGHTS Chip
|
||||
"MT_NIGHTSSTAR", // NiGHTS Star
|
||||
"MT_FLINGNIGHTSSTAR", // Lost NiGHTS Star
|
||||
"MT_NIGHTSSUPERLOOP",
|
||||
"MT_NIGHTSDRILLREFILL",
|
||||
"MT_NIGHTSHELPER",
|
||||
|
@ -8543,15 +8837,17 @@ static const char *const MOBJEFLAG_LIST[] = {
|
|||
"JUSTSTEPPEDDOWN", // used for ramp sectors
|
||||
"VERTICALFLIP", // Vertically flip sprite/allow upside-down physics
|
||||
"GOOWATER", // Goo water
|
||||
"TOUCHLAVA", // The mobj is touching a lava block
|
||||
"PUSHED", // Mobj was already pushed this tic
|
||||
"SPRUNG", // Mobj was already sprung this tic
|
||||
"APPLYPMOMZ", // Platform movement
|
||||
"TRACERANGLE", // Compute and trigger on mobj angle relative to tracer
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
static const char *const MAPTHINGFLAG_LIST[4] = {
|
||||
NULL,
|
||||
"EXTRA", // Extra flag for objects.
|
||||
"OBJECTFLIP", // Reverse gravity flag for objects.
|
||||
"OBJECTSPECIAL", // Special flag used with certain objects.
|
||||
"AMBUSH" // Deaf monsters/do not react to sound.
|
||||
|
@ -8617,6 +8913,42 @@ static const char *const PLAYERFLAG_LIST[] = {
|
|||
NULL // stop loop here.
|
||||
};
|
||||
|
||||
static const char *const GAMETYPERULE_LIST[] = {
|
||||
"CAMPAIGN",
|
||||
"RINGSLINGER",
|
||||
"SPECTATORS",
|
||||
"LIVES",
|
||||
"TEAMS",
|
||||
"FIRSTPERSON",
|
||||
"POWERSTONES",
|
||||
"TEAMFLAGS",
|
||||
"FRIENDLY",
|
||||
"SPECIALSTAGES",
|
||||
"EMERALDTOKENS",
|
||||
"EMERALDHUNT",
|
||||
"RACE",
|
||||
"TAG",
|
||||
"POINTLIMIT",
|
||||
"TIMELIMIT",
|
||||
"OVERTIME",
|
||||
"HURTMESSAGES",
|
||||
"FRIENDLYFIRE",
|
||||
"STARTCOUNTDOWN",
|
||||
"HIDEFROZEN",
|
||||
"BLINDFOLDED",
|
||||
"RESPAWNDELAY",
|
||||
"PITYSHIELD",
|
||||
"DEATHPENALTY",
|
||||
"NOSPECTATORSPAWN",
|
||||
"DEATHMATCHSTARTS",
|
||||
"SPAWNINVUL",
|
||||
"SPAWNENEMIES",
|
||||
"ALLOWEXIT",
|
||||
"NOTITLECARD",
|
||||
"CUTSCENES",
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Linedef flags
|
||||
static const char *const ML_LIST[16] = {
|
||||
|
@ -9032,21 +9364,6 @@ struct {
|
|||
{"tr_trans90",tr_trans90},
|
||||
{"NUMTRANSMAPS",NUMTRANSMAPS},
|
||||
|
||||
// Type of levels
|
||||
{"TOL_SP",TOL_SP},
|
||||
{"TOL_COOP",TOL_COOP},
|
||||
{"TOL_COMPETITION",TOL_COMPETITION},
|
||||
{"TOL_RACE",TOL_RACE},
|
||||
{"TOL_MATCH",TOL_MATCH},
|
||||
{"TOL_TAG",TOL_TAG},
|
||||
{"TOL_CTF",TOL_CTF},
|
||||
{"TOL_CUSTOM",TOL_CUSTOM},
|
||||
{"TOL_2D",TOL_2D},
|
||||
{"TOL_MARIO",TOL_MARIO},
|
||||
{"TOL_NIGHTS",TOL_NIGHTS},
|
||||
{"TOL_ERZ3",TOL_ERZ3},
|
||||
{"TOL_XMAS",TOL_XMAS},
|
||||
|
||||
// Level flags
|
||||
{"LF_SCRIPTISFILE",LF_SCRIPTISFILE},
|
||||
{"LF_SPEEDMUSIC",LF_SPEEDMUSIC},
|
||||
|
@ -9110,7 +9427,7 @@ struct {
|
|||
{"SH_FORCE",SH_FORCE},
|
||||
{"SH_FORCEHP",SH_FORCEHP}, // to be used as a bitmask only
|
||||
// Mostly for use with Mario mode.
|
||||
{"SH_FIREFLOWER", SH_FIREFLOWER},
|
||||
{"SH_FIREFLOWER",SH_FIREFLOWER},
|
||||
{"SH_STACK",SH_STACK},
|
||||
{"SH_NOSTACK",SH_NOSTACK},
|
||||
|
||||
|
@ -9125,7 +9442,7 @@ struct {
|
|||
{"CR_ROPEHANG",CR_ROPEHANG},
|
||||
{"CR_MACESPIN",CR_MACESPIN},
|
||||
{"CR_MINECART",CR_MINECART},
|
||||
{"CR_ROLLOUT", CR_ROLLOUT},
|
||||
{"CR_ROLLOUT",CR_ROLLOUT},
|
||||
{"CR_PTERABYTE",CR_PTERABYTE},
|
||||
|
||||
// Ring weapons (ringweapons_t)
|
||||
|
@ -9155,6 +9472,10 @@ struct {
|
|||
{"SF_MULTIABILITY",SF_MULTIABILITY},
|
||||
{"SF_NONIGHTSROTATION",SF_NONIGHTSROTATION},
|
||||
|
||||
// Dashmode constants
|
||||
{"DASHMODE_THRESHOLD",DASHMODE_THRESHOLD},
|
||||
{"DASHMODE_MAX",DASHMODE_MAX},
|
||||
|
||||
// Character abilities!
|
||||
// Primary
|
||||
{"CA_NONE",CA_NONE}, // now slot 0!
|
||||
|
@ -9229,15 +9550,16 @@ struct {
|
|||
{"DMG_CANHURTSELF",DMG_CANHURTSELF},
|
||||
{"DMG_DEATHMASK",DMG_DEATHMASK},
|
||||
|
||||
// Gametypes, for use with global var "gametype"
|
||||
{"GT_COOP",GT_COOP},
|
||||
{"GT_COMPETITION",GT_COMPETITION},
|
||||
{"GT_RACE",GT_RACE},
|
||||
{"GT_MATCH",GT_MATCH},
|
||||
{"GT_TEAMMATCH",GT_TEAMMATCH},
|
||||
{"GT_TAG",GT_TAG},
|
||||
{"GT_HIDEANDSEEK",GT_HIDEANDSEEK},
|
||||
{"GT_CTF",GT_CTF},
|
||||
// Intermission types
|
||||
{"int_none",int_none},
|
||||
{"int_coop",int_coop},
|
||||
{"int_match",int_match},
|
||||
{"int_teammatch",int_teammatch},
|
||||
//{"int_tag",int_tag},
|
||||
{"int_ctf",int_ctf},
|
||||
{"int_spec",int_spec},
|
||||
{"int_race",int_race},
|
||||
{"int_comp",int_comp},
|
||||
|
||||
// Jingles (jingletype_t)
|
||||
{"JT_NONE",JT_NONE},
|
||||
|
@ -9287,7 +9609,7 @@ struct {
|
|||
{"NUM_WEAPONS",NUM_WEAPONS},
|
||||
|
||||
// Value for infinite lives
|
||||
{"INFLIVES", INFLIVES},
|
||||
{"INFLIVES",INFLIVES},
|
||||
|
||||
// Got Flags, for player->gotflag!
|
||||
// Used to be MF_ for some stupid reason, now they're GF_ to stop them looking like mobjflags
|
||||
|
@ -9348,10 +9670,11 @@ struct {
|
|||
{"FF_QUICKSAND",FF_QUICKSAND}, ///< Quicksand!
|
||||
{"FF_PLATFORM",FF_PLATFORM}, ///< You can jump up through this to the top.
|
||||
{"FF_REVERSEPLATFORM",FF_REVERSEPLATFORM}, ///< A fall-through floor in normal gravity, a platform in reverse gravity.
|
||||
{"FF_INTANGABLEFLATS",FF_INTANGABLEFLATS}, ///< Both flats are intangable, but the sides are still solid.
|
||||
{"FF_INTANGIBLEFLATS",FF_INTANGIBLEFLATS}, ///< Both flats are intangible, but the sides are still solid.
|
||||
{"FF_INTANGABLEFLATS",FF_INTANGIBLEFLATS}, ///< Both flats are intangable, but the sides are still solid.
|
||||
{"FF_SHATTER",FF_SHATTER}, ///< Used with ::FF_BUSTUP. Bustable on mere touch.
|
||||
{"FF_SPINBUST",FF_SPINBUST}, ///< Used with ::FF_BUSTUP. Also bustable if you're in your spinning frames.
|
||||
{"FF_STRONGBUST",FF_STRONGBUST }, ///< Used with ::FF_BUSTUP. Only bustable by "strong" characters (Knuckles) and abilities (bouncing, twinspin, melee).
|
||||
{"FF_STRONGBUST",FF_STRONGBUST}, ///< Used with ::FF_BUSTUP. Only bustable by "strong" characters (Knuckles) and abilities (bouncing, twinspin, melee).
|
||||
{"FF_RIPPLE",FF_RIPPLE}, ///< Ripple the flats
|
||||
{"FF_COLORMAPONLY",FF_COLORMAPONLY}, ///< Only copy the colormap, not the lightlevel
|
||||
{"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
|
||||
|
@ -9410,12 +9733,10 @@ struct {
|
|||
{"DI_SOUTHEAST",DI_SOUTHEAST},
|
||||
{"NUMDIRS",NUMDIRS},
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// Sprite rotation axis (rotaxis_t)
|
||||
{"ROTAXIS_X",ROTAXIS_X},
|
||||
{"ROTAXIS_Y",ROTAXIS_Y},
|
||||
{"ROTAXIS_Z",ROTAXIS_Z},
|
||||
#endif
|
||||
|
||||
// Buttons (ticcmd_t)
|
||||
{"BT_WEAPONMASK",BT_WEAPONMASK}, //our first four bits.
|
||||
|
@ -9432,6 +9753,11 @@ struct {
|
|||
{"BT_CUSTOM2",BT_CUSTOM2}, // Lua customizable
|
||||
{"BT_CUSTOM3",BT_CUSTOM3}, // Lua customizable
|
||||
|
||||
// Lua command registration flags
|
||||
{"COM_ADMIN",COM_ADMIN},
|
||||
{"COM_SPLITSCREEN",COM_SPLITSCREEN},
|
||||
{"COM_LOCAL",COM_LOCAL},
|
||||
|
||||
// cvflags_t
|
||||
{"CV_SAVE",CV_SAVE},
|
||||
{"CV_CALL",CV_CALL},
|
||||
|
@ -9446,6 +9772,7 @@ struct {
|
|||
{"CV_HIDEN",CV_HIDEN},
|
||||
{"CV_HIDDEN",CV_HIDEN},
|
||||
{"CV_CHEAT",CV_CHEAT},
|
||||
{"CV_NOLUA",CV_NOLUA},
|
||||
|
||||
// v_video flags
|
||||
{"V_NOSCALEPATCH",V_NOSCALEPATCH},
|
||||
|
@ -9530,7 +9857,7 @@ struct {
|
|||
};
|
||||
|
||||
static mobjtype_t get_mobjtype(const char *word)
|
||||
{ // Returns the vlaue of MT_ enumerations
|
||||
{ // Returns the value of MT_ enumerations
|
||||
mobjtype_t i;
|
||||
if (*word >= '0' && *word <= '9')
|
||||
return atoi(word);
|
||||
|
@ -9682,8 +10009,22 @@ static menutype_t get_menutype(const char *word)
|
|||
}
|
||||
|
||||
#ifndef HAVE_BLUA
|
||||
static INT16 get_gametype(const char *word)
|
||||
{ // Returns the value of GT_ enumerations
|
||||
INT16 i;
|
||||
if (*word >= '0' && *word <= '9')
|
||||
return atoi(word);
|
||||
if (fastncmp("GT_",word,3))
|
||||
word += 3; // take off the GT_
|
||||
for (i = 0; i < NUMGAMETYPES; i++)
|
||||
if (fastcmp(word, Gametype_ConstantNames[i]+3))
|
||||
return i;
|
||||
deh_warning("Couldn't find gametype named 'GT_%s'",word);
|
||||
return GT_COOP;
|
||||
}
|
||||
|
||||
static powertype_t get_power(const char *word)
|
||||
{ // Returns the vlaue of pw_ enumerations
|
||||
{ // Returns the value of pw_ enumerations
|
||||
powertype_t i;
|
||||
if (*word >= '0' && *word <= '9')
|
||||
return atoi(word);
|
||||
|
@ -9877,11 +10218,42 @@ static fixed_t find_const(const char **rword)
|
|||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("MN_",word,4)) {
|
||||
else if (fastncmp("MN_",word,3)) {
|
||||
r = get_menutype(word);
|
||||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("GT_",word,4)) {
|
||||
r = get_gametype(word);
|
||||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("GTR_", word, 4)) {
|
||||
char *p = word+4;
|
||||
for (i = 0; GAMETYPERULE_LIST[i]; i++)
|
||||
if (fastcmp(p, GAMETYPERULE_LIST[i])) {
|
||||
free(word);
|
||||
return (1<<i);
|
||||
}
|
||||
|
||||
// Not found error
|
||||
const_warning("game type rule",word);
|
||||
free(word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("TOL_", word, 4)) {
|
||||
char *p = word+4;
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
if (fastcmp(p, TYPEOFLEVEL[i].name)) {
|
||||
free(word);
|
||||
return TYPEOFLEVEL[i].flag;
|
||||
}
|
||||
|
||||
// Not found error
|
||||
const_warning("typeoflevel",word);
|
||||
free(word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("HUD_",word,4)) {
|
||||
r = get_huditem(word);
|
||||
free(word);
|
||||
|
@ -10091,6 +10463,20 @@ static inline int lib_freeslot(lua_State *L)
|
|||
}
|
||||
r++;
|
||||
}
|
||||
else if (fastcmp(type, "TOL"))
|
||||
{
|
||||
if (lastcustomtol > 31)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n");
|
||||
else
|
||||
{
|
||||
UINT32 newtol = (1<<lastcustomtol);
|
||||
CONS_Printf("TypeOfLevel TOL_%s allocated.\n",word);
|
||||
G_AddTOL(newtol, word);
|
||||
lua_pushinteger(L, newtol);
|
||||
lastcustomtol++;
|
||||
r++;
|
||||
}
|
||||
}
|
||||
Z_Free(s);
|
||||
lua_remove(L, 1);
|
||||
continue;
|
||||
|
@ -10195,6 +10581,36 @@ static inline int lib_getenum(lua_State *L)
|
|||
if (mathlib) return luaL_error(L, "playerflag '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("GT_", word, 3)) {
|
||||
p = word;
|
||||
for (i = 0; Gametype_ConstantNames[i]; i++)
|
||||
if (fastcmp(p, Gametype_ConstantNames[i])) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "gametype '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("GTR_", word, 4)) {
|
||||
p = word+4;
|
||||
for (i = 0; GAMETYPERULE_LIST[i]; i++)
|
||||
if (fastcmp(p, GAMETYPERULE_LIST[i])) {
|
||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "game type rule '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("TOL_", word, 4)) {
|
||||
p = word+4;
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
if (fastcmp(p, TYPEOFLEVEL[i].name)) {
|
||||
lua_pushinteger(L, TYPEOFLEVEL[i].flag);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "typeoflevel '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("ML_", word, 3)) {
|
||||
p = word+3;
|
||||
for (i = 0; i < 16; i++)
|
||||
|
@ -10432,126 +10848,7 @@ static inline int lib_getenum(lua_State *L)
|
|||
// DYNAMIC variables too!!
|
||||
// Try not to add anything that would break netgames or timeattack replays here.
|
||||
// You know, like consoleplayer, displayplayer, secondarydisplayplayer, or gametime.
|
||||
if (fastcmp(word,"gamemap")) {
|
||||
lua_pushinteger(L, gamemap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"maptol")) {
|
||||
lua_pushinteger(L, maptol);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"ultimatemode")) {
|
||||
lua_pushboolean(L, ultimatemode != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mariomode")) {
|
||||
lua_pushboolean(L, mariomode != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"twodlevel")) {
|
||||
lua_pushboolean(L, twodlevel != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"circuitmap")) {
|
||||
lua_pushboolean(L, circuitmap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"netgame")) {
|
||||
lua_pushboolean(L, netgame);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"multiplayer")) {
|
||||
lua_pushboolean(L, multiplayer);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"modeattacking")) {
|
||||
lua_pushboolean(L, modeattacking);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"splitscreen")) {
|
||||
lua_pushboolean(L, splitscreen);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gamecomplete")) {
|
||||
lua_pushboolean(L, gamecomplete);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"devparm")) {
|
||||
lua_pushboolean(L, devparm);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"modifiedgame")) {
|
||||
lua_pushboolean(L, modifiedgame && !savemoddata);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"menuactive")) {
|
||||
lua_pushboolean(L, menuactive);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"paused")) {
|
||||
lua_pushboolean(L, paused);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"titlemap")) {
|
||||
lua_pushinteger(L, titlemap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"titlemapinaction")) {
|
||||
lua_pushboolean(L, (titlemapinaction != TITLEMAP_OFF));
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gametype")) {
|
||||
lua_pushinteger(L, gametype);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"leveltime")) {
|
||||
lua_pushinteger(L, leveltime);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"curWeather")) {
|
||||
lua_pushinteger(L, curWeather);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"globalweather")) {
|
||||
lua_pushinteger(L, globalweather);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"levelskynum")) {
|
||||
lua_pushinteger(L, levelskynum);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"globallevelskynum")) {
|
||||
lua_pushinteger(L, globallevelskynum);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusname")) {
|
||||
lua_pushstring(L, mapmusname);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusflags")) {
|
||||
lua_pushinteger(L, mapmusflags);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusposition")) {
|
||||
lua_pushinteger(L, mapmusposition);
|
||||
return 1;
|
||||
// local player variables, by popular request
|
||||
} else if (fastcmp(word,"consoleplayer")) { // player controlling console (aka local player 1)
|
||||
if (consoleplayer < 0 || !playeringame[consoleplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"displayplayer")) { // player visible on screen (aka display player 1)
|
||||
if (displayplayer < 0 || !playeringame[displayplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[displayplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"secondarydisplayplayer")) { // local/display player 2, for splitscreen
|
||||
if (!splitscreen || secondarydisplayplayer < 0 || !playeringame[secondarydisplayplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[secondarydisplayplayer], META_PLAYER);
|
||||
return 1;
|
||||
// end local player variables
|
||||
} else if (fastcmp(word,"server")) {
|
||||
if ((!multiplayer || !netgame) && !playeringame[serverplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"admin")) { // BACKWARDS COMPATIBILITY HACK: This was replaced with IsPlayerAdmin(), but some 2.1 Lua scripts still use the admin variable. It now points to the first admin player in the array.
|
||||
LUA_Deprecated(L, "admin", "IsPlayerAdmin(player)");
|
||||
if (!playeringame[adminplayers[0]] || IsPlayerAdmin(serverplayer))
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[adminplayers[0]], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"emeralds")) {
|
||||
lua_pushinteger(L, emeralds);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gravity")) {
|
||||
lua_pushinteger(L, gravity);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"VERSIONSTRING")) {
|
||||
lua_pushstring(L, VERSIONSTRING);
|
||||
return 1;
|
||||
} else if (fastcmp(word, "token")) {
|
||||
lua_pushinteger(L, token);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return LUA_PushGlobals(L, word);
|
||||
}
|
||||
|
||||
int LUA_EnumLib(lua_State *L)
|
||||
|
@ -10618,6 +10915,8 @@ static int lib_getActionName(lua_State *L)
|
|||
return luaL_typerror(L, 1, "action userdata or Lua function");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int LUA_SOCLib(lua_State *L)
|
||||
{
|
||||
lua_register(L,"freeslot",lib_freeslot);
|
||||
|
|
|
@ -47,7 +47,7 @@ extern const char *superactions[MAXRECURSION];
|
|||
extern UINT8 superstack;
|
||||
|
||||
// If the dehacked patch does not match this version, we throw a warning
|
||||
#define PATCHVERSION 210
|
||||
#define PATCHVERSION 220
|
||||
|
||||
#define MAXLINELEN 1024
|
||||
|
||||
|
|
|
@ -338,3 +338,8 @@ void I_StartupGraphics(void)
|
|||
graphics_started = true;
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
@ -378,6 +378,11 @@ INT32 VID_SetMode (INT32 modenum) //, UINT8 *palette)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
|
||||
|
||||
// converts a segm:offs 32bit pair to a 32bit flat ptr
|
||||
|
|
|
@ -98,8 +98,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>
|
||||
|
@ -127,8 +127,12 @@
|
|||
|
||||
#ifdef LOGMESSAGES
|
||||
extern FILE *logstream;
|
||||
extern char logfilename[1024];
|
||||
#endif
|
||||
|
||||
/* A mod name to further distinguish versions. */
|
||||
#define SRB2APPLICATION "SRB2"
|
||||
|
||||
//#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
|
||||
|
@ -450,16 +454,18 @@ char savegamename[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);
|
||||
void M_UnGetToken(void);
|
||||
UINT32 M_GetTokenPos(void);
|
||||
void M_SetTokenPos(UINT32 newPos);
|
||||
char *sizeu1(size_t num);
|
||||
char *sizeu2(size_t num);
|
||||
char *sizeu3(size_t num);
|
||||
|
@ -540,6 +546,8 @@ INT32 I_GetKey(void);
|
|||
#define PATHSEP "/"
|
||||
#endif
|
||||
|
||||
#define PUNCTUATION "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
||||
|
||||
// Compile date and time and revision.
|
||||
extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
|
||||
|
@ -623,13 +631,20 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// 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
|
||||
|
||||
/// Sprite rotation
|
||||
#define ROTSPRITE
|
||||
#define ROTANGLES 24 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
||||
#define ROTANGLES 72 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
||||
#define ROTANGDIFF (360 / ROTANGLES)
|
||||
|
||||
/// PNG support
|
||||
#ifndef HAVE_PNG
|
||||
#define NO_PNG_LUMPS
|
||||
#endif
|
||||
|
||||
/// Render flats on walls
|
||||
#define WALLFLATS
|
||||
|
||||
#endif // __DOOMDEF__
|
||||
|
|
118
src/doomstat.h
118
src/doomstat.h
|
@ -39,7 +39,7 @@ extern UINT32 mapmusposition;
|
|||
#define MUSIC_FORCERESET 0x4000 // -*--------------
|
||||
// Use other bits if necessary.
|
||||
|
||||
extern INT16 maptol;
|
||||
extern UINT32 maptol;
|
||||
extern UINT8 globalweather;
|
||||
extern INT32 curWeather;
|
||||
extern INT32 cursaveslot;
|
||||
|
@ -84,6 +84,9 @@ extern boolean addedtogame; // true after the server has added you
|
|||
extern boolean multiplayer;
|
||||
|
||||
extern INT16 gametype;
|
||||
extern UINT32 gametyperules;
|
||||
extern INT16 gametypecount;
|
||||
|
||||
extern boolean splitscreen;
|
||||
extern boolean circuitmap; // Does this level have 'circuit mode'?
|
||||
extern boolean fromlevelselect;
|
||||
|
@ -137,7 +140,7 @@ extern INT32 tutorialgcs; // which control scheme is loaded?
|
|||
extern INT32 tutorialusemouse; // store cv_usemouse user value
|
||||
extern INT32 tutorialfreelook; // store cv_alwaysfreelook user value
|
||||
extern INT32 tutorialmousemove; // store cv_mousemove user value
|
||||
extern INT32 tutorialanalog; // store cv_analog user value
|
||||
extern INT32 tutorialanalog; // store cv_analog[0] user value
|
||||
|
||||
extern boolean looptitle;
|
||||
|
||||
|
@ -284,8 +287,9 @@ typedef struct
|
|||
char lvlttl[22]; ///< Level name without "Zone". (21 character limit instead of 32, 21 characters can display on screen max anyway)
|
||||
char subttl[33]; ///< Subtitle for level
|
||||
UINT8 actnum; ///< Act number or 0 for none.
|
||||
UINT16 typeoflevel; ///< Combination of typeoflevel flags.
|
||||
UINT32 typeoflevel; ///< Combination of typeoflevel flags.
|
||||
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
|
||||
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.
|
||||
|
@ -310,12 +314,17 @@ typedef struct
|
|||
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
|
||||
SINT8 maxbonuslives; ///< How many bonus lives to award at Intermission? (-1 for unlimited.)
|
||||
|
||||
UINT8 levelflags; ///< LF_flags: merged booleans into one UINT8 for space, see below
|
||||
UINT16 levelflags; ///< LF_flags: merged booleans into one UINT16 for space, see below
|
||||
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
|
||||
|
||||
char selectheading[22]; ///< Level select heading. Allows for controllable grouping.
|
||||
UINT16 startrings; ///< Number of rings players start with.
|
||||
|
||||
// Title card.
|
||||
char ltzzpatch[8]; ///< Zig zag patch.
|
||||
char ltzztext[8]; ///< Zig zag text.
|
||||
char ltactdiamond[8]; ///< Act diamond.
|
||||
|
||||
// Freed animals stuff.
|
||||
UINT8 numFlickies; ///< Internal. For freed flicky support.
|
||||
mobjtype_t *flickies; ///< List of freeable flickies in this level. Allocated dynamically for space reasons. Be careful.
|
||||
|
@ -361,6 +370,73 @@ typedef struct
|
|||
|
||||
extern mapheader_t* mapheaderinfo[NUMMAPS];
|
||||
|
||||
// Gametypes
|
||||
#define NUMGAMETYPEFREESLOTS 128
|
||||
enum GameType
|
||||
{
|
||||
GT_COOP = 0, // also used in single player
|
||||
GT_COMPETITION, // Classic "Race"
|
||||
GT_RACE,
|
||||
|
||||
GT_MATCH,
|
||||
GT_TEAMMATCH,
|
||||
|
||||
GT_TAG,
|
||||
GT_HIDEANDSEEK,
|
||||
|
||||
GT_CTF, // capture the flag
|
||||
|
||||
GT_FIRSTFREESLOT,
|
||||
GT_LASTFREESLOT = GT_FIRSTFREESLOT + NUMGAMETYPEFREESLOTS - 1,
|
||||
NUMGAMETYPES
|
||||
};
|
||||
// If you alter this list, update dehacked.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c
|
||||
|
||||
// Gametype rules
|
||||
enum GameTypeRules
|
||||
{
|
||||
GTR_CAMPAIGN = 1, // Linear Co-op map progression, don't allow random maps
|
||||
GTR_RINGSLINGER = 1<<1, // Outside of Co-op, Competition, and Race (overriden by cv_ringslinger)
|
||||
GTR_SPECTATORS = 1<<2, // Outside of Co-op, Competition, and Race
|
||||
GTR_LIVES = 1<<3, // Co-op and Competition
|
||||
GTR_TEAMS = 1<<4, // Team Match, CTF
|
||||
GTR_FIRSTPERSON = 1<<5, // First person camera
|
||||
GTR_POWERSTONES = 1<<6, // Power stones (Match and CTF)
|
||||
GTR_TEAMFLAGS = 1<<7, // Gametype has team flags (CTF)
|
||||
GTR_FRIENDLY = 1<<8, // Co-op
|
||||
GTR_SPECIALSTAGES = 1<<9, // Allow special stages
|
||||
GTR_EMERALDTOKENS = 1<<10, // Spawn emerald tokens
|
||||
GTR_EMERALDHUNT = 1<<11, // Emerald Hunt
|
||||
GTR_RACE = 1<<12, // Race and Competition
|
||||
GTR_TAG = 1<<13, // Tag and Hide and Seek
|
||||
GTR_POINTLIMIT = 1<<14, // Ringslinger point limit
|
||||
GTR_TIMELIMIT = 1<<15, // Ringslinger time limit
|
||||
GTR_OVERTIME = 1<<16, // Allow overtime
|
||||
GTR_HURTMESSAGES = 1<<17, // Hit and death messages
|
||||
GTR_FRIENDLYFIRE = 1<<18, // Always allow friendly fire
|
||||
GTR_STARTCOUNTDOWN = 1<<19, // Hide time countdown (Tag and Hide and Seek)
|
||||
GTR_HIDEFROZEN = 1<<20, // Frozen after hide time (Hide and Seek, but not Tag)
|
||||
GTR_BLINDFOLDED = 1<<21, // Blindfolded view (Tag and Hide and Seek)
|
||||
GTR_RESPAWNDELAY = 1<<22, // Respawn delay
|
||||
GTR_PITYSHIELD = 1<<23, // Award pity shield
|
||||
GTR_DEATHPENALTY = 1<<24, // Death score penalty
|
||||
GTR_NOSPECTATORSPAWN = 1<<25, // Use with GTR_SPECTATORS, spawn in the map instead of with the spectators
|
||||
GTR_DEATHMATCHSTARTS = 1<<26, // Use deathmatch starts
|
||||
GTR_SPAWNINVUL = 1<<27, // Babysitting deterrent
|
||||
GTR_SPAWNENEMIES = 1<<28, // Spawn enemies
|
||||
GTR_ALLOWEXIT = 1<<29, // Allow exit sectors
|
||||
GTR_NOTITLECARD = 1<<30, // Don't show the title card
|
||||
GTR_CUTSCENES = 1<<31, // Play cutscenes, ending, credits, and evaluation
|
||||
};
|
||||
|
||||
// String names for gametypes
|
||||
extern const char *Gametype_Names[NUMGAMETYPES];
|
||||
extern const char *Gametype_ConstantNames[NUMGAMETYPES];
|
||||
|
||||
// Point and time limits for every gametype
|
||||
extern INT32 pointlimits[NUMGAMETYPES];
|
||||
extern INT32 timelimits[NUMGAMETYPES];
|
||||
|
||||
enum TypeOfLevel
|
||||
{
|
||||
TOL_SP = 0x01, ///< Single Player
|
||||
|
@ -376,36 +452,26 @@ enum TypeOfLevel
|
|||
TOL_CTF = 0x40, ///< Capture the Flag
|
||||
// CTF default = 64
|
||||
|
||||
TOL_CUSTOM = 0x80, ///< Custom (Lua-scripted, etc.)
|
||||
// 0x80 was here
|
||||
|
||||
TOL_2D = 0x0100, ///< 2D
|
||||
TOL_MARIO = 0x0200, ///< Mario
|
||||
TOL_NIGHTS = 0x0400, ///< NiGHTS
|
||||
TOL_ERZ3 = 0x0800, ///< ERZ3
|
||||
TOL_XMAS = 0x1000 ///< Christmas NiGHTS
|
||||
TOL_XMAS = 0x1000, ///< Christmas NiGHTS
|
||||
};
|
||||
|
||||
// Gametypes
|
||||
enum GameType
|
||||
#define NUMBASETOL 18
|
||||
#define NUMMAXTOL (18 + NUMGAMETYPEFREESLOTS)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GT_COOP = 0, // also used in single player
|
||||
GT_COMPETITION, // Classic "Race"
|
||||
GT_RACE,
|
||||
|
||||
GT_MATCH,
|
||||
GT_TEAMMATCH,
|
||||
|
||||
GT_TAG,
|
||||
GT_HIDEANDSEEK,
|
||||
|
||||
GT_CTF, // capture the flag
|
||||
|
||||
NUMGAMETYPES
|
||||
};
|
||||
// If you alter this list, update dehacked.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c
|
||||
|
||||
// String names for gametypes
|
||||
extern const char *Gametype_Names[NUMGAMETYPES];
|
||||
const char *name;
|
||||
UINT32 flag;
|
||||
} tolinfo_t;
|
||||
extern tolinfo_t TYPEOFLEVEL[NUMMAXTOL];
|
||||
extern INT32 numtolinfo;
|
||||
extern UINT32 lastcustomtol;
|
||||
|
||||
extern tic_t totalplaytime;
|
||||
|
||||
|
|
|
@ -150,6 +150,8 @@ void I_GetJoystick2Events(void){}
|
|||
|
||||
void I_GetMouseEvents(void){}
|
||||
|
||||
void I_UpdateMouseGrab(void){}
|
||||
|
||||
char *I_GetEnv(const char *name)
|
||||
{
|
||||
(void)name;
|
||||
|
|
|
@ -11,6 +11,7 @@ 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){}
|
||||
|
||||
|
@ -39,6 +40,11 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
(void)modenum;
|
||||
|
|
444
src/f_finale.c
444
src/f_finale.c
|
@ -530,78 +530,78 @@ static void F_IntroDrawScene(void)
|
|||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
background = W_CachePatchName("INTRO1", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO1", PU_PATCH);
|
||||
break;
|
||||
case 2:
|
||||
background = W_CachePatchName("INTRO2", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO2", PU_PATCH);
|
||||
break;
|
||||
case 3:
|
||||
background = W_CachePatchName("INTRO3", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO3", PU_PATCH);
|
||||
break;
|
||||
case 4:
|
||||
background = W_CachePatchName("INTRO4", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO4", PU_PATCH);
|
||||
break;
|
||||
case 5:
|
||||
if (intro_curtime >= 5*TICRATE)
|
||||
background = W_CachePatchName("RADAR", PU_CACHE);
|
||||
background = W_CachePatchName("RADAR", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("DRAT", PU_CACHE);
|
||||
background = W_CachePatchName("DRAT", PU_PATCH);
|
||||
break;
|
||||
case 6:
|
||||
background = W_CachePatchName("INTRO6", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO6", PU_PATCH);
|
||||
cx = 180;
|
||||
cy = 8;
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if (intro_curtime >= 7*TICRATE + ((TICRATE/7)*2))
|
||||
background = W_CachePatchName("SGRASS5", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS5", PU_PATCH);
|
||||
else if (intro_curtime >= 7*TICRATE + (TICRATE/7))
|
||||
background = W_CachePatchName("SGRASS4", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS4", PU_PATCH);
|
||||
else if (intro_curtime >= 7*TICRATE)
|
||||
background = W_CachePatchName("SGRASS3", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS3", PU_PATCH);
|
||||
else if (intro_curtime >= 6*TICRATE)
|
||||
background = W_CachePatchName("SGRASS2", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS2", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("SGRASS1", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS1", PU_PATCH);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
background = W_CachePatchName("WATCHING", PU_CACHE);
|
||||
background = W_CachePatchName("WATCHING", PU_PATCH);
|
||||
break;
|
||||
case 9:
|
||||
background = W_CachePatchName("ZOOMING", PU_CACHE);
|
||||
background = W_CachePatchName("ZOOMING", PU_PATCH);
|
||||
break;
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
background = W_CachePatchName("INTRO5", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO5", PU_PATCH);
|
||||
break;
|
||||
case 12:
|
||||
background = W_CachePatchName("REVENGE", PU_CACHE);
|
||||
background = W_CachePatchName("REVENGE", PU_PATCH);
|
||||
cx = 208;
|
||||
cy = 8;
|
||||
break;
|
||||
case 13:
|
||||
background = W_CachePatchName("CONFRONT", PU_CACHE);
|
||||
background = W_CachePatchName("CONFRONT", PU_PATCH);
|
||||
cy += 48;
|
||||
break;
|
||||
case 14:
|
||||
background = W_CachePatchName("TAILSSAD", PU_CACHE);
|
||||
background = W_CachePatchName("TAILSSAD", PU_PATCH);
|
||||
bgxoffs = 144;
|
||||
cx = 8;
|
||||
cy = 8;
|
||||
break;
|
||||
case 15:
|
||||
if (intro_curtime >= 7*TICRATE)
|
||||
background = W_CachePatchName("SONICDO2", PU_CACHE);
|
||||
background = W_CachePatchName("SONICDO2", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("SONICDO1", PU_CACHE);
|
||||
background = W_CachePatchName("SONICDO1", PU_PATCH);
|
||||
cx = 224;
|
||||
cy = 8;
|
||||
break;
|
||||
case 16:
|
||||
background = W_CachePatchName("INTRO7", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO7", PU_PATCH);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -631,30 +631,30 @@ static void F_IntroDrawScene(void)
|
|||
S_ChangeMusicInternal("_stjr", false);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2;
|
||||
y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2;
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
if (finalecount > 6) {
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH2", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH2", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
if (finalecount > 10) {
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH3", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH3", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
if (finalecount > 14) {
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH4", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH4", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
}
|
||||
else if (finalecount-30 < 20) { // Big eggy
|
||||
background = W_CachePatchName("FEEDIN", PU_CACHE);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(560<<FRACBITS, aspect)/2;
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(477<<FRACBITS, aspect);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOBOTTOM, background, aspect);
|
||||
}
|
||||
else if (finalecount-50 < 30) { // Zoom out
|
||||
fixed_t scale = FixedDiv(aspect, FixedDiv((finalecount-50)<<FRACBITS, (15<<FRACBITS))+FRACUNIT);
|
||||
background = W_CachePatchName("FEEDIN", PU_CACHE);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(560<<FRACBITS, aspect)/2 + (FixedMul(560<<FRACBITS, aspect) - FixedMul(560<<FRACBITS, scale));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(477<<FRACBITS, scale);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOBOTTOM, background, scale);
|
||||
|
@ -664,7 +664,7 @@ static void F_IntroDrawScene(void)
|
|||
{
|
||||
// Draw tiny eggy
|
||||
fixed_t scale = FixedMul(FRACUNIT/3, aspect);
|
||||
background = W_CachePatchName("FEEDIN", PU_CACHE);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(560<<FRACBITS, aspect)/2 + (FixedMul(560<<FRACBITS, aspect) - FixedMul(560<<FRACBITS, scale));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(477<<FRACBITS, scale);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOBOTTOM, background, scale);
|
||||
|
@ -675,34 +675,34 @@ static void F_IntroDrawScene(void)
|
|||
x = (-189*FRACUNIT) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
|
||||
// Draw the body
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the door
|
||||
V_DrawSciencePatch(x+FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x+FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel
|
||||
V_DrawSciencePatch(x+FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName(va("TYRE%02u",(abs(finalecount-144)/3)%16), PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x+FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName(va("TYRE%02u",(abs(finalecount-144)/3)%16), PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel cover
|
||||
V_DrawSciencePatch(x+FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x+FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
} else { // Pure Fat has stopped!
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
|
||||
// Draw the body
|
||||
V_DrawSciencePatch(0, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(0, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel
|
||||
V_DrawSciencePatch(FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("TYRE00", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("TYRE00", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel cover
|
||||
V_DrawSciencePatch(FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the door
|
||||
if (finalecount-TICRATE/2 > 4*TICRATE) { // Door is being raised!
|
||||
int ftime = (finalecount-TICRATE/2-4*TICRATE);
|
||||
y -= FixedDiv((ftime*ftime)<<FRACBITS, 23<<FRACBITS);
|
||||
}
|
||||
V_DrawSciencePatch(FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
}
|
||||
|
@ -716,27 +716,27 @@ static void F_IntroDrawScene(void)
|
|||
if (timetonext > 5*TICRATE && timetonext < 6*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG1", PU_CACHE);
|
||||
background = W_CachePatchName("BRITEGG1", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG1", PU_CACHE);
|
||||
background = W_CachePatchName("DARKEGG1", PU_PATCH);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
else if (timetonext > 3*TICRATE && timetonext < 4*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG2", PU_CACHE);
|
||||
background = W_CachePatchName("BRITEGG2", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG2", PU_CACHE);
|
||||
background = W_CachePatchName("DARKEGG2", PU_PATCH);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
else if (timetonext > 1*TICRATE && timetonext < 2*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG3", PU_CACHE);
|
||||
background = W_CachePatchName("BRITEGG3", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG3", PU_CACHE);
|
||||
background = W_CachePatchName("DARKEGG3", PU_PATCH);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
|
@ -768,79 +768,79 @@ static void F_IntroDrawScene(void)
|
|||
knucklesx += sonicx;
|
||||
sonicx += P_ReturnThrustX(NULL, finalecount * ANG10, 3);
|
||||
|
||||
V_DrawSmallScaledPatch(skyx, 0, 0, (patch = W_CachePatchName("INTROSKY", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(skyx, 0, 0, (patch = W_CachePatchName("INTROSKY", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(skyx - 320, 0, 0, patch);
|
||||
W_UnlockCachedPatch(patch);
|
||||
V_DrawSmallScaledPatch(grassx, 0, 0, (patch = W_CachePatchName("INTROGRS", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(grassx, 0, 0, (patch = W_CachePatchName("INTROGRS", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(grassx - 320, 0, 0, patch);
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
if (finalecount & 1)
|
||||
{
|
||||
// Sonic
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Appendages
|
||||
if (finalecount & 2)
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT4", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT4", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
// Tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Knuckles
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Appendages
|
||||
if (finalecount & 2)
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT3", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT3", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
// Tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Knuckles
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
|
@ -873,8 +873,8 @@ static void F_IntroDrawScene(void)
|
|||
y += (30*(FRACUNIT-scale));
|
||||
}
|
||||
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_LEVEL);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_PATCH);
|
||||
|
||||
if (worktics >= 5)
|
||||
trans = (worktics-5)>>1;
|
||||
|
@ -917,8 +917,9 @@ void F_IntroDrawer(void)
|
|||
{
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
wipestyleflags = WSF_FADEOUT;
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
F_TryColormapFade(31);
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(99,true);
|
||||
}
|
||||
|
@ -927,12 +928,11 @@ void F_IntroDrawer(void)
|
|||
}
|
||||
else if (intro_scenenum == 10)
|
||||
{
|
||||
// The only fade to white in the entire damn game.
|
||||
// (not true)
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
wipestyleflags = (WSF_FADEOUT|WSF_TOWHITE);
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(0);
|
||||
F_TryColormapFade(0);
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(99,true);
|
||||
}
|
||||
|
@ -941,8 +941,9 @@ void F_IntroDrawer(void)
|
|||
{
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
wipestyleflags = WSF_FADEOUT;
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
F_TryColormapFade(31);
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(99,true);
|
||||
}
|
||||
|
@ -977,6 +978,7 @@ void F_IntroDrawer(void)
|
|||
|
||||
F_WipeStartScreen();
|
||||
wipegamestate = -1;
|
||||
wipestyleflags = WSF_CROSSFADE;
|
||||
animtimer = stoptimer = 0;
|
||||
}
|
||||
|
||||
|
@ -986,7 +988,7 @@ void F_IntroDrawer(void)
|
|||
{
|
||||
if (intro_scenenum == 5 && intro_curtime == 5*TICRATE)
|
||||
{
|
||||
patch_t *radar = W_CachePatchName("RADAR", PU_CACHE);
|
||||
patch_t *radar = W_CachePatchName("RADAR", PU_PATCH);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -999,7 +1001,7 @@ void F_IntroDrawer(void)
|
|||
}
|
||||
else if (intro_scenenum == 7 && intro_curtime == 6*TICRATE) // Force a wipe here
|
||||
{
|
||||
patch_t *grass = W_CachePatchName("SGRASS2", PU_CACHE);
|
||||
patch_t *grass = W_CachePatchName("SGRASS2", PU_PATCH);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1012,7 +1014,7 @@ void F_IntroDrawer(void)
|
|||
}
|
||||
/*else if (intro_scenenum == 12 && intro_curtime == 7*TICRATE)
|
||||
{
|
||||
patch_t *confront = W_CachePatchName("CONFRONT", PU_CACHE);
|
||||
patch_t *confront = W_CachePatchName("CONFRONT", PU_PATCH);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1025,7 +1027,7 @@ void F_IntroDrawer(void)
|
|||
}*/
|
||||
if (intro_scenenum == 15 && intro_curtime == 7*TICRATE)
|
||||
{
|
||||
patch_t *sdo = W_CachePatchName("SONICDO2", PU_CACHE);
|
||||
patch_t *sdo = W_CachePatchName("SONICDO2", PU_PATCH);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1231,6 +1233,7 @@ static const char *credits[] = {
|
|||
"Thomas \"Shadow Hog\" Igoe",
|
||||
"Alexander \"DrTapeworm\" Moench-Ford",
|
||||
"\"Kaito Sinclaire\"",
|
||||
"\"QueenDelta\"",
|
||||
"Wessel \"sphere\" Smit",
|
||||
"\"Spazzo\"",
|
||||
"\"SSNTails\"",
|
||||
|
@ -1357,14 +1360,14 @@ void F_CreditDrawer(void)
|
|||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
// Zig Zagz
|
||||
V_DrawScaledPatch(-16, zagpos, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_CACHE));
|
||||
V_DrawScaledPatch(-16, zagpos - 320, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_CACHE));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_CACHE));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos - 320, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_CACHE));
|
||||
V_DrawScaledPatch(-16, zagpos, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(-16, zagpos - 320, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos - 320, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
|
||||
// Draw background pictures first
|
||||
for (i = 0; credits_pics[i].patch; i++)
|
||||
V_DrawSciencePatch(credits_pics[i].x<<FRACBITS, (280<<FRACBITS) + (((i*credits_height)<<FRACBITS)/(credits_numpics)) - 4*(animtimer<<FRACBITS)/5, 0, W_CachePatchName(credits_pics[i].patch, PU_CACHE), FRACUNIT>>1);
|
||||
V_DrawSciencePatch(credits_pics[i].x<<FRACBITS, (280<<FRACBITS) + (((i*credits_height)<<FRACBITS)/(credits_numpics)) - 4*(animtimer<<FRACBITS)/5, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH), FRACUNIT>>1);
|
||||
|
||||
// Dim the background
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
|
@ -1572,14 +1575,14 @@ void F_GameEvaluationDrawer(void)
|
|||
|
||||
if (goodending)
|
||||
{
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_LEVEL);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_PATCH);
|
||||
x -= FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
rockpat = W_CachePatchName("ROID0000", PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_PATCH);
|
||||
}
|
||||
|
||||
if (finalecount >= 5)
|
||||
|
@ -1611,20 +1614,20 @@ void F_GameEvaluationDrawer(void)
|
|||
// if j == 0 - alternate between 0 and 1
|
||||
// 1 - 1 and 2
|
||||
// 2 - 2 and not rendered
|
||||
V_DrawFixedPatch(x+sparkloffs[j-1][0], y+sparkloffs[j-1][1], FRACUNIT, 0, W_CachePatchName(va("ENDSPKL%.1d", (j - ((sparklloop & 1) ? 0 : 1))), PU_LEVEL), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE));
|
||||
V_DrawFixedPatch(x+sparkloffs[j-1][0], y+sparkloffs[j-1][1], FRACUNIT, 0, W_CachePatchName(va("ENDSPKL%.1d", (j - ((sparklloop & 1) ? 0 : 1))), PU_PATCH), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE));
|
||||
}
|
||||
j--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_LEVEL);
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_PATCH);
|
||||
V_DrawFixedPatch(x, y, scale, 0, eggrock, colormap[0]);
|
||||
if (trans < 10)
|
||||
V_DrawFixedPatch(x, y, scale, trans<<V_ALPHASHIFT, eggrock, colormap[1]);
|
||||
else if (sparklloop)
|
||||
V_DrawFixedPatch(x, y, scale, (10-sparklloop)<<V_ALPHASHIFT,
|
||||
W_CachePatchName("ENDEGRK0", PU_LEVEL), colormap[1]);
|
||||
W_CachePatchName("ENDEGRK0", PU_PATCH), colormap[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1638,7 +1641,7 @@ void F_GameEvaluationDrawer(void)
|
|||
eemeralds_cur += (360<<FRACBITS)/7;
|
||||
|
||||
patchname[4] = 'A'+(char)i;
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, ((emeralds & (1<<i)) ? 0 : V_80TRANS), W_CachePatchName(patchname, PU_LEVEL), NULL);
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, ((emeralds & (1<<i)) ? 0 : V_80TRANS), W_CachePatchName(patchname, PU_PATCH), NULL);
|
||||
}
|
||||
|
||||
V_DrawCreditString((BASEVIDWIDTH - V_CreditStringWidth(endingtext))<<(FRACBITS-1), (BASEVIDHEIGHT-100)<<(FRACBITS-1), 0, endingtext);
|
||||
|
@ -1751,6 +1754,83 @@ void F_GameEvaluationTicker(void)
|
|||
#define STOPPINGPOINT (14*TICRATE)
|
||||
#define SPARKLLOOPTIME 15 // must be odd
|
||||
|
||||
static void F_CacheEnding(void)
|
||||
{
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_PATCH);
|
||||
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_PATCH);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_PATCH);
|
||||
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_PATCH);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_PATCH);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_PATCH);
|
||||
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_PATCH);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_PATCH);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_PATCH);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDXPLD0", PU_PATCH);
|
||||
endxpld[1] = W_CachePatchName("ENDXPLD1", PU_PATCH);
|
||||
endxpld[2] = W_CachePatchName("ENDXPLD2", PU_PATCH);
|
||||
endxpld[3] = W_CachePatchName("ENDXPLD3", PU_PATCH);
|
||||
|
||||
endescp[0] = W_CachePatchName("ENDESCP0", PU_PATCH);
|
||||
endescp[1] = W_CachePatchName("ENDESCP1", PU_PATCH);
|
||||
endescp[2] = W_CachePatchName("ENDESCP2", PU_PATCH);
|
||||
endescp[3] = W_CachePatchName("ENDESCP3", PU_PATCH);
|
||||
endescp[4] = W_CachePatchName("ENDESCP4", PU_PATCH);
|
||||
|
||||
// so we only need to check once
|
||||
if ((goodending = ALL7EMERALDS(emeralds)))
|
||||
{
|
||||
UINT8 skinnum = players[consoleplayer].skin;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
if (skins[skinnum].sprites[SPR2_XTRA].numframes > (XTRA_ENDING+2))
|
||||
{
|
||||
sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
// character head, skin specific
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING];
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+1];
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+2];
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
}
|
||||
else // Show a star if your character doesn't have an ending firework display. (Basically the MISSINGs for this)
|
||||
{
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK3", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK4", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK5", PU_PATCH);
|
||||
}
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_PATCH);
|
||||
}
|
||||
else
|
||||
{
|
||||
// eggman, skin nonspecific
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_PATCH);
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_LEVEL);
|
||||
}
|
||||
}
|
||||
|
||||
static void F_CacheGoodEnding(void)
|
||||
{
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_PATCH);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_PATCH);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_PATCH);
|
||||
}
|
||||
|
||||
void F_StartEnding(void)
|
||||
{
|
||||
G_SetGamestate(GS_ENDING);
|
||||
|
@ -1766,7 +1846,7 @@ void F_StartEnding(void)
|
|||
gameaction = ga_nothing;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
S_StopMusic();
|
||||
S_StopMusic(); // todo: placeholder
|
||||
S_StopSounds();
|
||||
|
||||
finalecount = -10; // what? this totally isn't a hack. why are you asking?
|
||||
|
@ -1774,68 +1854,7 @@ void F_StartEnding(void)
|
|||
memset(sparkloffs, 0, sizeof(INT32)*3*2);
|
||||
sparklloop = 0;
|
||||
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_LEVEL);
|
||||
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_LEVEL);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_LEVEL);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_LEVEL);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_LEVEL);
|
||||
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_LEVEL);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_LEVEL);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_LEVEL);
|
||||
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_LEVEL);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_LEVEL);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_LEVEL);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDXPLD0", PU_LEVEL);
|
||||
endxpld[1] = W_CachePatchName("ENDXPLD1", PU_LEVEL);
|
||||
endxpld[2] = W_CachePatchName("ENDXPLD2", PU_LEVEL);
|
||||
endxpld[3] = W_CachePatchName("ENDXPLD3", PU_LEVEL);
|
||||
|
||||
endescp[0] = W_CachePatchName("ENDESCP0", PU_LEVEL);
|
||||
endescp[1] = W_CachePatchName("ENDESCP1", PU_LEVEL);
|
||||
endescp[2] = W_CachePatchName("ENDESCP2", PU_LEVEL);
|
||||
endescp[3] = W_CachePatchName("ENDESCP3", PU_LEVEL);
|
||||
endescp[4] = W_CachePatchName("ENDESCP4", PU_LEVEL);
|
||||
|
||||
// so we only need to check once
|
||||
if ((goodending = ALL7EMERALDS(emeralds)))
|
||||
{
|
||||
UINT8 skinnum = players[consoleplayer].skin;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
if (skins[skinnum].sprites[SPR2_XTRA].numframes > (XTRA_ENDING+2))
|
||||
{
|
||||
sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
// character head, skin specific
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING];
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+1];
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+2];
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
}
|
||||
else // Show a star if your character doesn't have an ending firework display. (Basically the MISSINGs for this)
|
||||
{
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK3", PU_LEVEL);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK4", PU_LEVEL);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK5", PU_LEVEL);
|
||||
}
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_LEVEL);
|
||||
}
|
||||
else
|
||||
{
|
||||
// eggman, skin nonspecific
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_LEVEL);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_LEVEL);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_LEVEL);
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_LEVEL);
|
||||
}
|
||||
F_CacheEnding();
|
||||
}
|
||||
|
||||
void F_EndingTicker(void)
|
||||
|
@ -1851,15 +1870,7 @@ void F_EndingTicker(void)
|
|||
S_ChangeMusicInternal((goodending ? "_endg" : "_endb"), false);
|
||||
|
||||
if (goodending && finalecount == INFLECTIONPOINT) // time to swap some assets
|
||||
{
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_LEVEL);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_LEVEL);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_LEVEL);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_LEVEL);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_LEVEL);
|
||||
}
|
||||
F_CacheGoodEnding();
|
||||
|
||||
if (++sparklloop == SPARKLLOOPTIME) // time to roll the randomisation again
|
||||
{
|
||||
|
@ -1878,10 +1889,17 @@ void F_EndingDrawer(void)
|
|||
INT32 x, y, i, j, parallaxticker;
|
||||
patch_t *rockpat;
|
||||
|
||||
if (needpatchrecache)
|
||||
{
|
||||
F_CacheEnding();
|
||||
if (goodending && finalecount >= INFLECTIONPOINT) // time to swap some assets
|
||||
F_CacheGoodEnding();
|
||||
}
|
||||
|
||||
if (!goodending || finalecount < INFLECTIONPOINT)
|
||||
rockpat = W_CachePatchName("ROID0000", PU_LEVEL);
|
||||
rockpat = W_CachePatchName("ROID0000", PU_PATCH);
|
||||
else
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_LEVEL);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_PATCH);
|
||||
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
|
@ -2365,11 +2383,11 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
|
|||
|
||||
if (!scrollxspeed && !scrollyspeed)
|
||||
{
|
||||
V_DrawPatchFill(W_CachePatchName(patchname, PU_CACHE));
|
||||
V_DrawPatchFill(W_CachePatchName(patchname, PU_PATCH));
|
||||
return;
|
||||
}
|
||||
|
||||
pat = W_CachePatchName(patchname, PU_CACHE);
|
||||
pat = W_CachePatchName(patchname, PU_PATCH);
|
||||
|
||||
patwidth = SHORT(pat->width);
|
||||
patheight = SHORT(pat->height);
|
||||
|
@ -2430,6 +2448,45 @@ else if (strlen(name) <= 6) \
|
|||
else \
|
||||
arr[0] = 0;
|
||||
|
||||
static void F_CacheTitleScreen(void)
|
||||
{
|
||||
switch(curttmode)
|
||||
{
|
||||
case TTMODE_OLD:
|
||||
case TTMODE_NONE:
|
||||
ttbanner = W_CachePatchName("TTBANNER", PU_LEVEL);
|
||||
ttwing = W_CachePatchName("TTWING", PU_LEVEL);
|
||||
ttsonic = W_CachePatchName("TTSONIC", PU_LEVEL);
|
||||
ttswave1 = W_CachePatchName("TTSWAVE1", PU_LEVEL);
|
||||
ttswave2 = W_CachePatchName("TTSWAVE2", PU_LEVEL);
|
||||
ttswip1 = W_CachePatchName("TTSWIP1", PU_LEVEL);
|
||||
ttsprep1 = W_CachePatchName("TTSPREP1", PU_LEVEL);
|
||||
ttsprep2 = W_CachePatchName("TTSPREP2", PU_LEVEL);
|
||||
ttspop1 = W_CachePatchName("TTSPOP1", PU_LEVEL);
|
||||
ttspop2 = W_CachePatchName("TTSPOP2", PU_LEVEL);
|
||||
ttspop3 = W_CachePatchName("TTSPOP3", PU_LEVEL);
|
||||
ttspop4 = W_CachePatchName("TTSPOP4", PU_LEVEL);
|
||||
ttspop5 = W_CachePatchName("TTSPOP5", PU_LEVEL);
|
||||
ttspop6 = W_CachePatchName("TTSPOP6", PU_LEVEL);
|
||||
ttspop7 = W_CachePatchName("TTSPOP7", PU_LEVEL);
|
||||
break;
|
||||
|
||||
// don't load alacroix gfx yet; we do that upon first draw.
|
||||
case TTMODE_ALACROIX:
|
||||
break;
|
||||
|
||||
case TTMODE_USER:
|
||||
{
|
||||
UINT16 i;
|
||||
lumpnum_t lumpnum;
|
||||
char lumpname[9];
|
||||
|
||||
LOADTTGFX(ttuser, curttname, TTMAX_USER)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void F_StartTitleScreen(void)
|
||||
{
|
||||
if (menupres[MN_MAIN].musname[0])
|
||||
|
@ -2491,7 +2548,7 @@ void F_StartTitleScreen(void)
|
|||
camera.x = startpos->x << FRACBITS;
|
||||
camera.y = startpos->y << FRACBITS;
|
||||
camera.subsector = R_PointInSubsector(camera.x, camera.y);
|
||||
camera.z = camera.subsector->sector->floorheight + ((startpos->options >> ZSHIFT) << FRACBITS);
|
||||
camera.z = camera.subsector->sector->floorheight + (startpos->z << FRACBITS);
|
||||
camera.angle = (startpos->angle % 360)*ANG1;
|
||||
camera.aiming = 0;
|
||||
}
|
||||
|
@ -2526,41 +2583,7 @@ void F_StartTitleScreen(void)
|
|||
demoDelayLeft = demoDelayTime;
|
||||
demoIdleLeft = demoIdleTime;
|
||||
|
||||
switch(curttmode)
|
||||
{
|
||||
case TTMODE_OLD:
|
||||
case TTMODE_NONE:
|
||||
ttbanner = W_CachePatchName("TTBANNER", PU_LEVEL);
|
||||
ttwing = W_CachePatchName("TTWING", PU_LEVEL);
|
||||
ttsonic = W_CachePatchName("TTSONIC", PU_LEVEL);
|
||||
ttswave1 = W_CachePatchName("TTSWAVE1", PU_LEVEL);
|
||||
ttswave2 = W_CachePatchName("TTSWAVE2", PU_LEVEL);
|
||||
ttswip1 = W_CachePatchName("TTSWIP1", PU_LEVEL);
|
||||
ttsprep1 = W_CachePatchName("TTSPREP1", PU_LEVEL);
|
||||
ttsprep2 = W_CachePatchName("TTSPREP2", PU_LEVEL);
|
||||
ttspop1 = W_CachePatchName("TTSPOP1", PU_LEVEL);
|
||||
ttspop2 = W_CachePatchName("TTSPOP2", PU_LEVEL);
|
||||
ttspop3 = W_CachePatchName("TTSPOP3", PU_LEVEL);
|
||||
ttspop4 = W_CachePatchName("TTSPOP4", PU_LEVEL);
|
||||
ttspop5 = W_CachePatchName("TTSPOP5", PU_LEVEL);
|
||||
ttspop6 = W_CachePatchName("TTSPOP6", PU_LEVEL);
|
||||
ttspop7 = W_CachePatchName("TTSPOP7", PU_LEVEL);
|
||||
break;
|
||||
|
||||
// don't load alacroix gfx yet; we do that upon first draw.
|
||||
case TTMODE_ALACROIX:
|
||||
break;
|
||||
|
||||
case TTMODE_USER:
|
||||
{
|
||||
UINT16 i;
|
||||
lumpnum_t lumpnum;
|
||||
char lumpname[9];
|
||||
|
||||
LOADTTGFX(ttuser, curttname, TTMAX_USER)
|
||||
break;
|
||||
}
|
||||
}
|
||||
F_CacheTitleScreen();
|
||||
}
|
||||
|
||||
static void F_UnloadAlacroixGraphics(SINT8 oldttscale)
|
||||
|
@ -2709,6 +2732,9 @@ void F_TitleScreenDrawer(void)
|
|||
if (modeattacking)
|
||||
return; // We likely came here from retrying. Don't do a damn thing.
|
||||
|
||||
if (needpatchrecache && (curttmode != TTMODE_ALACROIX))
|
||||
F_CacheTitleScreen();
|
||||
|
||||
// Draw that sky!
|
||||
if (curbgcolor >= 0)
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||
|
@ -2732,6 +2758,12 @@ void F_TitleScreenDrawer(void)
|
|||
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)
|
||||
{
|
||||
case TTMODE_OLD:
|
||||
|
@ -3596,6 +3628,8 @@ void F_StartContinue(void)
|
|||
return;
|
||||
}
|
||||
|
||||
wipestyleflags = WSF_FADEOUT;
|
||||
F_TryColormapFade(31);
|
||||
G_SetGamestate(GS_CONTINUING);
|
||||
gameaction = ga_nothing;
|
||||
|
||||
|
@ -3677,7 +3711,7 @@ void F_ContinueDrawer(void)
|
|||
V_DrawLevelTitle(x - (V_LevelNameWidth("Continue?")>>1), 16, 0, "Continue?");
|
||||
|
||||
// Two stars...
|
||||
patch = W_CachePatchName("CONTSTAR", PU_CACHE);
|
||||
patch = W_CachePatchName("CONTSTAR", PU_PATCH);
|
||||
V_DrawScaledPatch(x-32, 160, 0, patch);
|
||||
V_DrawScaledPatch(x+32, 160, 0, patch);
|
||||
|
||||
|
@ -3685,14 +3719,14 @@ void F_ContinueDrawer(void)
|
|||
if (timeleft > 9)
|
||||
{
|
||||
numbuf[7] = '1';
|
||||
V_DrawScaledPatch(x - 10, 160, 0, W_CachePatchName(numbuf, PU_CACHE));
|
||||
V_DrawScaledPatch(x - 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
numbuf[7] = '0';
|
||||
V_DrawScaledPatch(x + 10, 160, 0, W_CachePatchName(numbuf, PU_CACHE));
|
||||
V_DrawScaledPatch(x + 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
}
|
||||
else
|
||||
{
|
||||
numbuf[7] = '0'+timeleft;
|
||||
V_DrawScaledPatch(x, 160, 0, W_CachePatchName(numbuf, PU_CACHE));
|
||||
V_DrawScaledPatch(x, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
}
|
||||
|
||||
// Draw the continue markers! Show continues.
|
||||
|
@ -3719,7 +3753,7 @@ void F_ContinueDrawer(void)
|
|||
}
|
||||
|
||||
// Spotlight
|
||||
V_DrawScaledPatch(x, 140, 0, W_CachePatchName("CONTSPOT", PU_CACHE));
|
||||
V_DrawScaledPatch(x, 140, 0, W_CachePatchName("CONTSPOT", PU_PATCH));
|
||||
|
||||
// warping laser
|
||||
if (continuetime)
|
||||
|
@ -3756,8 +3790,8 @@ void F_ContinueDrawer(void)
|
|||
#define drawchar(dx, dy, n) {\
|
||||
sprdef = &contskins[n]->sprites[cont_spr2[n][0]];\
|
||||
sprframe = &sprdef->spriteframes[cont_spr2[n][1]];\
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_CACHE);\
|
||||
V_DrawFixedPatch((dx), (dy), FRACUNIT, (sprframe->flip & (1<<cont_spr2[n][2])) ? V_FLIP : 0, patch, contcolormaps[n]);\
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH);\
|
||||
V_DrawFixedPatch((dx), (dy), contskins[n]->highresscale, (sprframe->flip & (1<<cont_spr2[n][2])) ? V_FLIP : 0, patch, contcolormaps[n]);\
|
||||
}
|
||||
|
||||
if (offsy < 0)
|
||||
|
@ -4020,10 +4054,10 @@ void F_CutsceneDrawer(void)
|
|||
{
|
||||
if (cutscenes[cutnum]->scene[scenenum].pichires[picnum])
|
||||
V_DrawSmallScaledPatch(picxpos, picypos, 0,
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_CACHE));
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH));
|
||||
else
|
||||
V_DrawScaledPatch(picxpos,picypos, 0,
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_CACHE));
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH));
|
||||
}
|
||||
|
||||
if (dofadenow && rendermode != render_none)
|
||||
|
@ -4509,10 +4543,10 @@ void F_TextPromptDrawer(void)
|
|||
{
|
||||
if (textprompts[cutnum]->page[scenenum].pichires[picnum])
|
||||
V_DrawSmallScaledPatch(picxpos, picypos, 0,
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_CACHE));
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH));
|
||||
else
|
||||
V_DrawScaledPatch(picxpos,picypos, 0,
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_CACHE));
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH));
|
||||
}
|
||||
|
||||
// Draw background
|
||||
|
@ -4522,7 +4556,7 @@ void F_TextPromptDrawer(void)
|
|||
if (iconlump != LUMPERROR)
|
||||
{
|
||||
INT32 iconx, icony, scale, scaledsize;
|
||||
patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_CACHE);
|
||||
patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_PATCH);
|
||||
|
||||
// scale and center
|
||||
if (patch->width > patch->height)
|
||||
|
|
|
@ -146,7 +146,7 @@ extern boolean WipeStageTitle;
|
|||
typedef enum
|
||||
{
|
||||
WIPESTYLE_NORMAL,
|
||||
WIPESTYLE_LEVEL
|
||||
WIPESTYLE_COLORMAP
|
||||
} wipestyle_t;
|
||||
extern wipestyle_t wipestyle;
|
||||
|
||||
|
@ -159,6 +159,11 @@ typedef enum
|
|||
} wipestyleflags_t;
|
||||
extern wipestyleflags_t wipestyleflags;
|
||||
|
||||
// Even my function names are borderline
|
||||
boolean F_ShouldColormapFade(void);
|
||||
boolean F_TryColormapFade(UINT8 wipecolor);
|
||||
void F_DecideWipeStyle(void);
|
||||
|
||||
#define FADECOLORMAPDIV 8
|
||||
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
|
||||
|
||||
|
|
250
src/f_wipe.c
250
src/f_wipe.c
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
|
||||
// Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
|
@ -56,7 +56,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
|
|||
|
||||
0, // wipe_level_toblack
|
||||
UINT8_MAX, // wipe_intermission_toblack
|
||||
UINT8_MAX, // wipe_continuing_toblack
|
||||
0, // wipe_continuing_toblack
|
||||
0, // wipe_titlescreen_toblack
|
||||
0, // wipe_timeattack_toblack
|
||||
99, // wipe_credits_toblack
|
||||
|
@ -161,7 +161,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
|
|||
{
|
||||
// Determine pixel to use from fademask
|
||||
pcolor = &pMasterPalette[*lump++];
|
||||
if (wipestyle == WIPESTYLE_LEVEL)
|
||||
if (wipestyle == WIPESTYLE_COLORMAP)
|
||||
*mask++ = pcolor->s.red / FADECOLORMAPDIV;
|
||||
else
|
||||
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
|
||||
|
@ -191,7 +191,7 @@ void F_WipeStageTitle(void)
|
|||
{
|
||||
// draw level title
|
||||
if ((WipeStageTitle && st_overlay)
|
||||
&& (wipestyle == WIPESTYLE_LEVEL)
|
||||
&& (wipestyle == WIPESTYLE_COLORMAP)
|
||||
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
||||
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ static void F_DoWipe(fademask_t *fademask)
|
|||
relativepos += vid.width;
|
||||
}
|
||||
}
|
||||
else if (*mask >= ((wipestyle == WIPESTYLE_LEVEL) ? FADECOLORMAPROWS : 10))
|
||||
else if (*mask >= 10)
|
||||
{
|
||||
// shortcut - memcpy target to work
|
||||
while (draw_linestogo--)
|
||||
|
@ -293,25 +293,8 @@ static void F_DoWipe(fademask_t *fademask)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (wipestyle == WIPESTYLE_LEVEL)
|
||||
{
|
||||
int nmask;
|
||||
UINT8 *fade = fadecolormap;
|
||||
|
||||
if (wipestyleflags & WSF_TOWHITE)
|
||||
fade = fadecolormap + (FADECOLORMAPROWS * 256);
|
||||
|
||||
nmask = *mask;
|
||||
if (wipestyleflags & WSF_FADEIN)
|
||||
nmask = (FADECOLORMAPROWS-1) - nmask;
|
||||
|
||||
transtbl = fade + (nmask * 256);
|
||||
}
|
||||
else
|
||||
{
|
||||
// pointer to transtable that this mask would use
|
||||
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
||||
}
|
||||
// pointer to transtable that this mask would use
|
||||
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
||||
|
||||
// DRAWING LOOP
|
||||
while (draw_linestogo--)
|
||||
|
@ -321,16 +304,113 @@ static void F_DoWipe(fademask_t *fademask)
|
|||
e = e_base + relativepos;
|
||||
draw_rowstogo = draw_rowend - draw_rowstart;
|
||||
|
||||
if (wipestyle == WIPESTYLE_LEVEL)
|
||||
{
|
||||
while (draw_rowstogo--)
|
||||
*w++ = transtbl[*e++];
|
||||
}
|
||||
else
|
||||
{
|
||||
while (draw_rowstogo--)
|
||||
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
|
||||
}
|
||||
while (draw_rowstogo--)
|
||||
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
|
||||
|
||||
relativepos += vid.width;
|
||||
}
|
||||
// END DRAWING LOOP
|
||||
}
|
||||
|
||||
if (++maskx >= fademask->width)
|
||||
++masky, maskx = 0;
|
||||
} while (++mask < maskend);
|
||||
|
||||
free(scrxpos);
|
||||
free(scrypos);
|
||||
}
|
||||
}
|
||||
|
||||
static void F_DoColormapWipe(fademask_t *fademask, UINT8 *colormap)
|
||||
{
|
||||
// Lactozilla: F_DoWipe for WIPESTYLE_COLORMAP
|
||||
{
|
||||
// wipe screen, start, end
|
||||
UINT8 *w = wipe_scr;
|
||||
const UINT8 *s = wipe_scr_start;
|
||||
const UINT8 *e = wipe_scr_end;
|
||||
|
||||
// first pixel for each screen
|
||||
UINT8 *w_base = w;
|
||||
const UINT8 *s_base = s;
|
||||
const UINT8 *e_base = e;
|
||||
|
||||
// mask data, end
|
||||
UINT8 *transtbl;
|
||||
const UINT8 *mask = fademask->mask;
|
||||
const UINT8 *maskend = mask + fademask->size;
|
||||
|
||||
// rectangle draw hints
|
||||
UINT32 draw_linestart, draw_rowstart;
|
||||
UINT32 draw_lineend, draw_rowend;
|
||||
UINT32 draw_linestogo, draw_rowstogo;
|
||||
|
||||
// rectangle coordinates, etc.
|
||||
UINT16* scrxpos = (UINT16*)malloc((fademask->width + 1) * sizeof(UINT16));
|
||||
UINT16* scrypos = (UINT16*)malloc((fademask->height + 1) * sizeof(UINT16));
|
||||
UINT16 maskx, masky;
|
||||
UINT32 relativepos;
|
||||
|
||||
// ---
|
||||
// Screw it, we do the fixed point math ourselves up front.
|
||||
scrxpos[0] = 0;
|
||||
for (relativepos = 0, maskx = 1; maskx < fademask->width; ++maskx)
|
||||
scrxpos[maskx] = (relativepos += fademask->xscale)>>FRACBITS;
|
||||
scrxpos[fademask->width] = vid.width;
|
||||
|
||||
scrypos[0] = 0;
|
||||
for (relativepos = 0, masky = 1; masky < fademask->height; ++masky)
|
||||
scrypos[masky] = (relativepos += fademask->yscale)>>FRACBITS;
|
||||
scrypos[fademask->height] = vid.height;
|
||||
// ---
|
||||
|
||||
maskx = masky = 0;
|
||||
do
|
||||
{
|
||||
draw_rowstart = scrxpos[maskx];
|
||||
draw_rowend = scrxpos[maskx + 1];
|
||||
draw_linestart = scrypos[masky];
|
||||
draw_lineend = scrypos[masky + 1];
|
||||
|
||||
relativepos = (draw_linestart * vid.width) + draw_rowstart;
|
||||
draw_linestogo = draw_lineend - draw_linestart;
|
||||
|
||||
if (*mask == 0)
|
||||
{
|
||||
// shortcut - memcpy source to work
|
||||
while (draw_linestogo--)
|
||||
{
|
||||
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
|
||||
relativepos += vid.width;
|
||||
}
|
||||
}
|
||||
else if (*mask >= FADECOLORMAPROWS)
|
||||
{
|
||||
// shortcut - memcpy target to work
|
||||
while (draw_linestogo--)
|
||||
{
|
||||
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
|
||||
relativepos += vid.width;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int nmask = *mask;
|
||||
if (wipestyleflags & WSF_FADEIN)
|
||||
nmask = (FADECOLORMAPROWS-1) - nmask;
|
||||
|
||||
transtbl = colormap + (nmask * 256);
|
||||
|
||||
// DRAWING LOOP
|
||||
while (draw_linestogo--)
|
||||
{
|
||||
w = w_base + relativepos;
|
||||
s = s_base + relativepos;
|
||||
e = e_base + relativepos;
|
||||
draw_rowstogo = draw_rowend - draw_rowstart;
|
||||
|
||||
while (draw_rowstogo--)
|
||||
*w++ = transtbl[*e++];
|
||||
|
||||
relativepos += vid.width;
|
||||
}
|
||||
|
@ -382,6 +462,62 @@ void F_WipeEndScreen(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/** Verifies every condition for a colormapped fade.
|
||||
*/
|
||||
boolean F_ShouldColormapFade(void)
|
||||
{
|
||||
if ((wipestyleflags & (WSF_FADEIN|WSF_FADEOUT)) // only if one of those wipestyleflags are actually set
|
||||
&& !(wipestyleflags & WSF_CROSSFADE)) // and if not crossfading
|
||||
{
|
||||
// World
|
||||
return (gamestate == GS_LEVEL
|
||||
|| gamestate == GS_TITLESCREEN
|
||||
// Finales
|
||||
|| gamestate == GS_CONTINUING
|
||||
|| gamestate == GS_CREDITS
|
||||
|| gamestate == GS_EVALUATION
|
||||
|| gamestate == GS_INTRO
|
||||
|| gamestate == GS_ENDING
|
||||
// Menus
|
||||
|| gamestate == GS_TIMEATTACK);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Decides what wipe style to use.
|
||||
*/
|
||||
void F_DecideWipeStyle(void)
|
||||
{
|
||||
// Set default wipe style
|
||||
wipestyle = WIPESTYLE_NORMAL;
|
||||
|
||||
// Check for colormap wipe style
|
||||
if (F_ShouldColormapFade())
|
||||
wipestyle = WIPESTYLE_COLORMAP;
|
||||
}
|
||||
|
||||
/** Attempt to run a colormap fade,
|
||||
provided all the conditionals were properly met.
|
||||
Returns true if so.
|
||||
I demand you call F_RunWipe after this function.
|
||||
*/
|
||||
boolean F_TryColormapFade(UINT8 wipecolor)
|
||||
{
|
||||
if (F_ShouldColormapFade())
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
F_WipeColorFill(wipecolor);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
F_WipeColorFill(wipecolor);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** After setting up the screens you want to wipe,
|
||||
* calling this will do a 'typical' wipe.
|
||||
*/
|
||||
|
@ -399,18 +535,10 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
|||
paldiv = FixedDiv(257<<FRACBITS, 11<<FRACBITS);
|
||||
|
||||
// Init the wipe
|
||||
F_DecideWipeStyle();
|
||||
WipeInAction = true;
|
||||
wipe_scr = screens[0];
|
||||
|
||||
// don't know where else to put this.
|
||||
// this any good?
|
||||
if ((gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN)
|
||||
&& (wipestyleflags & (WSF_FADEIN|WSF_FADEOUT)) // only if one of those wipestyleflags are actually set
|
||||
&& !(wipestyleflags & WSF_CROSSFADE)) // and if not crossfading
|
||||
wipestyle = WIPESTYLE_LEVEL;
|
||||
else
|
||||
wipestyle = WIPESTYLE_NORMAL;
|
||||
|
||||
// lastwipetic should either be 0 or the tic we last wiped
|
||||
// on for fade-to-black
|
||||
for (;;)
|
||||
|
@ -425,21 +553,39 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
|||
I_Sleep();
|
||||
lastwipetic = nowtime;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
// Wipe styles
|
||||
if (wipestyle == WIPESTYLE_COLORMAP)
|
||||
{
|
||||
// send in the wipe type and wipe frame because we need to cache the graphic
|
||||
if (wipestyle == WIPESTYLE_LEVEL)
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
// send in the wipe type and wipe frame because we need to cache the graphic
|
||||
HWR_DoTintedWipe(wipetype, wipeframe-1);
|
||||
}
|
||||
else
|
||||
HWR_DoWipe(wipetype, wipeframe-1);
|
||||
#endif
|
||||
{
|
||||
UINT8 *colormap = fadecolormap;
|
||||
if (wipestyleflags & WSF_TOWHITE)
|
||||
colormap += (FADECOLORMAPROWS * 256);
|
||||
F_DoColormapWipe(fmask, colormap);
|
||||
}
|
||||
|
||||
// Draw the title card above the wipe
|
||||
F_WipeStageTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
// send in the wipe type and wipe frame because we need to cache the graphic
|
||||
HWR_DoWipe(wipetype, wipeframe-1);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
F_DoWipe(fmask);
|
||||
|
||||
if (wipestyle == WIPESTYLE_LEVEL)
|
||||
F_WipeStageTitle();
|
||||
F_DoWipe(fmask);
|
||||
}
|
||||
|
||||
I_OsPolling();
|
||||
I_UpdateNoBlit();
|
||||
|
|
1451
src/g_game.c
1451
src/g_game.c
File diff suppressed because it is too large
Load diff
58
src/g_game.h
58
src/g_game.h
|
@ -68,14 +68,37 @@ extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime,
|
|||
extern consvar_t cv_crosshair, cv_crosshair2;
|
||||
extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove;
|
||||
extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2;
|
||||
extern consvar_t cv_useranalog, cv_useranalog2;
|
||||
extern consvar_t cv_analog, cv_analog2;
|
||||
extern consvar_t cv_directionchar, cv_directionchar2;
|
||||
|
||||
extern consvar_t cv_useranalog[2], cv_analog[2];
|
||||
extern consvar_t cv_directionchar[2];
|
||||
|
||||
typedef enum {
|
||||
CS_LEGACY,
|
||||
CS_LMAOGALOG,
|
||||
CS_STANDARD,
|
||||
CS_SIMPLE = CS_LMAOGALOG|CS_STANDARD,
|
||||
} controlstyle_e;
|
||||
#define G_ControlStyle(ssplayer) (cv_directionchar[(ssplayer)-1].value == 3 ? CS_LMAOGALOG : ((cv_analog[(ssplayer)-1].value ? CS_LMAOGALOG : 0) | (cv_directionchar[(ssplayer)-1].value ? CS_STANDARD : 0)))
|
||||
#define P_ControlStyle(player) ((((player)->pflags & PF_ANALOGMODE) ? CS_LMAOGALOG : 0) | (((player)->pflags & PF_DIRECTIONCHAR) ? CS_STANDARD : 0))
|
||||
|
||||
extern consvar_t cv_autobrake, cv_autobrake2;
|
||||
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis;
|
||||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2;
|
||||
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis,cv_deadzone,cv_digitaldeadzone;
|
||||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2,cv_deadzone2,cv_digitaldeadzone2;
|
||||
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest;
|
||||
|
||||
// hi here's some new controls
|
||||
extern consvar_t cv_cam_shiftfacing[2], cv_cam_turnfacing[2],
|
||||
cv_cam_turnfacingability[2], cv_cam_turnfacingspindash[2], cv_cam_turnfacinginput[2],
|
||||
cv_cam_centertoggle[2], cv_cam_lockedinput[2], cv_cam_lockonboss[2];
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LOCK_BOSS = 1<<0,
|
||||
LOCK_ENEMY = 1<<1,
|
||||
LOCK_INTERESTS = 1<<2,
|
||||
} lockassist_e;
|
||||
|
||||
|
||||
// mouseaiming (looking up/down with the mouse or keyboard)
|
||||
#define KB_LOOKSPEED (1<<25)
|
||||
#define MAXPLMOVE (50)
|
||||
|
@ -83,8 +106,10 @@ extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_g
|
|||
|
||||
// build an internal map name MAPxx from map number
|
||||
const char *G_BuildMapName(INT32 map);
|
||||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics);
|
||||
void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics);
|
||||
|
||||
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);
|
||||
|
||||
// copy ticcmd_t to and fro the normal way
|
||||
ticcmd_t *G_CopyTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n);
|
||||
|
@ -129,6 +154,9 @@ INT32 G_FindMap(const char *query, char **foundmapnamep,
|
|||
mapsearchfreq_t **freqp, INT32 *freqc);
|
||||
void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc);
|
||||
|
||||
/* Match map name by search + 2 digit map code or map number. */
|
||||
INT32 G_FindMapByNameOrCode(const char *query, char **foundmapnamep);
|
||||
|
||||
// XMOD spawning
|
||||
mapthing_t *G_FindCTFStart(INT32 playernum);
|
||||
mapthing_t *G_FindMatchStart(INT32 playernum);
|
||||
|
@ -144,6 +172,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar,
|
|||
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.
|
||||
|
@ -203,14 +232,29 @@ 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];
|
||||
|
||||
void G_SetGametype(INT16 gametype);
|
||||
INT16 G_AddGametype(UINT32 rules);
|
||||
void G_AddGametypeConstant(INT16 gtype, const char *newgtconst);
|
||||
void G_UpdateGametypeSelections(void);
|
||||
void G_AddTOL(UINT32 newtol, const char *tolname);
|
||||
void G_AddGametypeTOL(INT16 gtype, UINT32 newtol);
|
||||
void G_SetGametypeDescription(INT16 gtype, char *descriptiontext, UINT8 leftcolor, UINT8 rightcolor);
|
||||
|
||||
INT32 G_GetGametypeByName(const char *gametypestr);
|
||||
boolean G_IsSpecialStage(INT32 mapnum);
|
||||
boolean G_GametypeUsesLives(void);
|
||||
boolean G_GametypeUsesCoopLives(void);
|
||||
boolean G_GametypeUsesCoopStarposts(void);
|
||||
boolean G_GametypeHasTeams(void);
|
||||
boolean G_GametypeHasSpectators(void);
|
||||
boolean G_RingSlingerGametype(void);
|
||||
boolean G_PlatformGametype(void);
|
||||
boolean G_TagGametype(void);
|
||||
boolean G_CompetitionGametype(void);
|
||||
boolean G_EnoughPlayersFinished(void);
|
||||
void G_ExitLevel(void);
|
||||
void G_NextLevel(void);
|
||||
|
|
|
@ -132,6 +132,7 @@ extern INT32 gamecontroldefault[num_gamecontrolschemes][num_gamecontrols][2]; //
|
|||
extern INT32 gamecontrolbisdefault[num_gamecontrolschemes][num_gamecontrols][2];
|
||||
#define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[gc][0]] || gamekeydown[gamecontrol[gc][1]])
|
||||
#define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrolbis[gc][0]] || gamekeydown[gamecontrolbis[gc][1]])
|
||||
#define PLAYERINPUTDOWN(p, gc) ((p) == 2 ? PLAYER2INPUTDOWN(gc) : PLAYER1INPUTDOWN(gc))
|
||||
|
||||
#define num_gcl_tutorial_check 6
|
||||
#define num_gcl_tutorial_used 8
|
||||
|
|
|
@ -449,8 +449,12 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
|||
// for each seg of the subsector
|
||||
for (; count--; lseg++)
|
||||
{
|
||||
//x,y,dx,dy (like a divline)
|
||||
line_t *line = lseg->linedef;
|
||||
|
||||
if (lseg->glseg)
|
||||
continue;
|
||||
|
||||
//x,y,dx,dy (like a divline)
|
||||
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
|
||||
p1.y = FIXED_TO_FLOAT(lseg->side ? line->v2->y : line->v1->y);
|
||||
p2.x = FIXED_TO_FLOAT(lseg->side ? line->v1->x : line->v2->x);
|
||||
|
@ -836,8 +840,10 @@ static INT32 SolveTProblem(void)
|
|||
return 0;
|
||||
|
||||
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
|
||||
#ifdef HWR_LOADING_SCREEN
|
||||
CON_Drawer(); //let the user know what we are doing
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
#endif
|
||||
|
||||
numsplitpoly = 0;
|
||||
|
||||
|
@ -964,9 +970,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
|||
CONS_Debug(DBG_RENDER, "Creating polygons, please wait...\n");
|
||||
#ifdef HWR_LOADING_SCREEN
|
||||
ls_count = ls_percent = 0; // reset the loading status
|
||||
#endif
|
||||
CON_Drawer(); //let the user know what we are doing
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
#endif
|
||||
|
||||
HWR_ClearPolys();
|
||||
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
#include "../r_patch.h"
|
||||
#include "../p_setup.h"
|
||||
|
||||
//Hurdler: 25/04/2000: used for new colormap code in hardware mode
|
||||
//static UINT8 *gr_colormap = NULL; // by default it must be NULL ! (because colormap tables are not initialized)
|
||||
boolean firetranslucent = false;
|
||||
|
||||
// Values set after a call to HWR_ResizeBlock()
|
||||
static INT32 blocksize, blockwidth, blockheight;
|
||||
|
||||
|
@ -122,18 +118,16 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
|||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
|
||||
if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel))
|
||||
alpha = 0x80;
|
||||
else
|
||||
alpha = 0xff;
|
||||
|
||||
//Hurdler: not perfect, but better than holes
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||
texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
else if (mipmap->colormap)
|
||||
if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// 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 ?)
|
||||
// Alam: SRB2 uses Mingw, HUGS
|
||||
|
@ -236,18 +230,16 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
|
||||
if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel))
|
||||
alpha = 0x80;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// transparent pixel
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||
alpha = 0x00;
|
||||
else
|
||||
alpha = 0xff;
|
||||
|
||||
//Hurdler: not perfect, but better than holes
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||
texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
else if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
||||
// Alam: SRB2 uses Mingw, HUGS
|
||||
|
@ -576,7 +568,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
|||
{
|
||||
UINT8 *block;
|
||||
INT32 bpp, i;
|
||||
UINT16 bu16 = ((0x00 <<8) | HWR_CHROMAKEY_EQUIVALENTCOLORINDEX);
|
||||
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||
|
||||
bpp = format2bpp[grMipmap->grInfo.format];
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data));
|
||||
|
@ -606,6 +598,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
texture_t *texture;
|
||||
texpatch_t *patch;
|
||||
patch_t *realpatch;
|
||||
UINT8 *pdata;
|
||||
|
||||
INT32 i;
|
||||
boolean skyspecial = false; //poor hack for Legacy large skies..
|
||||
|
@ -638,7 +631,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
INT32 j;
|
||||
RGBA_t col;
|
||||
|
||||
col = V_GetColor(HWR_CHROMAKEY_EQUIVALENTCOLORINDEX);
|
||||
col = V_GetColor(HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||
for (j = 0; j < blockheight; j++)
|
||||
{
|
||||
for (i = 0; i < blockwidth; i++)
|
||||
|
@ -654,19 +647,30 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
// Composite the columns together.
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
#ifndef NO_PNG_LUMPS
|
||||
boolean dealloc = true;
|
||||
size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump);
|
||||
#endif
|
||||
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
realpatch = (patch_t *)pdata;
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
||||
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
|
||||
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL);
|
||||
else
|
||||
#endif
|
||||
HWR_DrawTexturePatchInCache(&grtex->mipmap,
|
||||
blockwidth, blockheight,
|
||||
texture, patch,
|
||||
realpatch);
|
||||
Z_Unlock(realpatch);
|
||||
#ifdef WALLFLATS
|
||||
if (texture->type == TEXTURETYPE_FLAT)
|
||||
realpatch = R_FlatToPatch(pdata, texture->width, texture->height, 0, 0, NULL, false);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
(void)lumplength;
|
||||
dealloc = false;
|
||||
}
|
||||
|
||||
HWR_DrawTexturePatchInCache(&grtex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
|
||||
|
||||
if (dealloc)
|
||||
Z_Unlock(realpatch);
|
||||
}
|
||||
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
||||
if (format2bpp[grtex->mipmap.grInfo.format]==4)
|
||||
|
@ -694,7 +698,7 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
// lump is a png so convert it
|
||||
size_t len = W_LumpLengthPwad(grPatch->wadnum, grPatch->lumpnum);
|
||||
if ((patch != NULL) && R_IsLumpPNG((const UINT8 *)patch, len))
|
||||
patch = R_PNGToPatch((const UINT8 *)patch, len, NULL, true);
|
||||
patch = R_PNGToPatch((const UINT8 *)patch, len, NULL);
|
||||
#endif
|
||||
|
||||
// don't do it twice (like a cache)
|
||||
|
@ -760,15 +764,14 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
// CACHING HANDLING
|
||||
// =================================================
|
||||
|
||||
static size_t gr_numtextures;
|
||||
static GLTexture_t *gr_textures; // for ALL Doom textures
|
||||
static GLTexture_t *gr_textures2;
|
||||
static size_t gr_numtextures = 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
|
||||
|
||||
void HWR_InitTextureCache(void)
|
||||
{
|
||||
gr_numtextures = 0;
|
||||
gr_textures = NULL;
|
||||
gr_textures2 = NULL;
|
||||
gr_flats = NULL;
|
||||
}
|
||||
|
||||
// Callback function for HWR_FreeTextureCache.
|
||||
|
@ -776,29 +779,45 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
|||
{
|
||||
GLPatch_t* const pat = patch;
|
||||
(void)patchnum; //unused
|
||||
while (pat->mipmap && pat->mipmap->nextcolormap) // The mipmap must be valid, obviously
|
||||
|
||||
// The patch must be valid, obviously
|
||||
if (!pat)
|
||||
return;
|
||||
|
||||
// The mipmap must be valid, obviously
|
||||
while (pat->mipmap)
|
||||
{
|
||||
// Confusing at first, but pat->mipmap->nextcolormap
|
||||
// at the beginning of the loop is the first colormap
|
||||
// from the linked list of colormaps
|
||||
GLMipmap_t *next = pat->mipmap;
|
||||
if (!next) // No mipmap in this patch, break out of loop.
|
||||
// from the linked list of colormaps.
|
||||
GLMipmap_t *next = NULL;
|
||||
|
||||
// No mipmap in this patch, break out of the loop.
|
||||
if (!pat->mipmap)
|
||||
break;
|
||||
// Set the first colormap
|
||||
// to the one that comes after it
|
||||
next = next->nextcolormap;
|
||||
|
||||
// No colormap mipmap either.
|
||||
if (!pat->mipmap->nextcolormap)
|
||||
break;
|
||||
|
||||
// Set the first colormap to the one that comes after it.
|
||||
next = pat->mipmap->nextcolormap;
|
||||
pat->mipmap->nextcolormap = next->nextcolormap;
|
||||
// Free image data from memory
|
||||
|
||||
// Free image data from memory.
|
||||
if (next->grInfo.data)
|
||||
Z_Free(next->grInfo.data);
|
||||
// Free the old colormap from memory
|
||||
next->grInfo.data = NULL;
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_FreeTextureCache(void)
|
||||
void HWR_FreeMipmapCache(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// free references to the textures
|
||||
HWD.pfnClearMipMapCache();
|
||||
|
||||
|
@ -808,51 +827,46 @@ void HWR_FreeTextureCache(void)
|
|||
Z_FreeTag(PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
// Alam: free the Z_Blocks before freeing it's users
|
||||
|
||||
// free all patch colormaps after each level: must be done after ClearMipMapCache!
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
M_AATreeIterate(wadfiles[i]->hwrcache, FreeMipmapColormap);
|
||||
}
|
||||
|
||||
void HWR_FreeTextureCache(void)
|
||||
{
|
||||
// free references to the textures
|
||||
HWR_FreeMipmapCache();
|
||||
|
||||
// now the heap don't have any 'user' pointing to our
|
||||
// texturecache info, we can free it
|
||||
if (gr_textures)
|
||||
free(gr_textures);
|
||||
if (gr_textures2)
|
||||
free(gr_textures2);
|
||||
if (gr_flats)
|
||||
free(gr_flats);
|
||||
gr_textures = NULL;
|
||||
gr_textures2 = NULL;
|
||||
gr_flats = NULL;
|
||||
gr_numtextures = 0;
|
||||
}
|
||||
|
||||
void HWR_PrepLevelCache(size_t pnumtextures)
|
||||
void HWR_LoadTextures(size_t pnumtextures)
|
||||
{
|
||||
// problem: the mipmap cache management hold a list of mipmaps.. but they are
|
||||
// reallocated on each level..
|
||||
//sub-optimal, but 1) just need re-download stuff in hardware cache VERY fast
|
||||
// 2) sprite/menu stuff mixed with level textures so can't do anything else
|
||||
|
||||
// we must free it since numtextures changed
|
||||
HWR_FreeTextureCache();
|
||||
|
||||
// Why not Z_Malloc?
|
||||
gr_numtextures = pnumtextures;
|
||||
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
|
||||
if (gr_textures == NULL)
|
||||
I_Error("3D can't alloc gr_textures");
|
||||
gr_textures2 = calloc(pnumtextures, sizeof (*gr_textures2));
|
||||
if (gr_textures2 == NULL)
|
||||
I_Error("3D can't alloc gr_textures2");
|
||||
gr_textures = calloc(gr_numtextures, sizeof(*gr_textures));
|
||||
gr_flats = calloc(gr_numtextures, sizeof(*gr_flats));
|
||||
|
||||
// Doesn't tell you which it _is_, but hopefully
|
||||
// should never ever happen (right?!)
|
||||
if ((gr_textures == NULL) || (gr_flats == NULL))
|
||||
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
|
||||
}
|
||||
|
||||
void HWR_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
//Hudler: 16/10/99: added for OpenGL gamma correction
|
||||
RGBA_t gamma_correction = {0x7F7F7F7F};
|
||||
|
||||
//Hurdler 16/10/99: added for OpenGL gamma correction
|
||||
gamma_correction.s.red = (UINT8)cv_grgammared.value;
|
||||
gamma_correction.s.green = (UINT8)cv_grgammagreen.value;
|
||||
gamma_correction.s.blue = (UINT8)cv_grgammablue.value;
|
||||
HWD.pfnSetPalette(palette, &gamma_correction);
|
||||
HWD.pfnSetPalette(palette);
|
||||
|
||||
// hardware driver will flush there own cache if cache is non paletized
|
||||
// now flush data texture cache so 32 bit texture are recomputed
|
||||
|
@ -873,11 +887,16 @@ GLTexture_t *HWR_GetTexture(INT32 tex)
|
|||
if ((unsigned)tex >= gr_numtextures)
|
||||
I_Error("HWR_GetTexture: tex >= numtextures\n");
|
||||
#endif
|
||||
|
||||
// Every texture in memory, stored in the
|
||||
// hardware renderer's bit depth format. Wow!
|
||||
grtex = &gr_textures[tex];
|
||||
|
||||
// Generate texture if missing from the cache
|
||||
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded)
|
||||
HWR_GenerateTexture(tex, grtex);
|
||||
|
||||
// Tell the hardware driver to bind the current texture to the flat's mipmap
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
@ -938,6 +957,9 @@ 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;
|
||||
|
@ -963,6 +985,9 @@ 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)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
|
@ -989,13 +1014,19 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
if ((unsigned)texturenum >= gr_numtextures)
|
||||
I_Error("HWR_GetLevelFlat: texturenum >= numtextures\n");
|
||||
#endif
|
||||
|
||||
// Who knows?
|
||||
if (texturenum == 0 || texturenum == -1)
|
||||
return;
|
||||
grtex = &gr_textures2[texturenum];
|
||||
|
||||
// Every texture in memory, stored as a 8-bit flat. Wow!
|
||||
grtex = &gr_flats[texturenum];
|
||||
|
||||
// Generate flat if missing from the cache
|
||||
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded)
|
||||
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum);
|
||||
|
||||
// Tell the hardware driver to bind the current texture to the flat's mipmap
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
@ -1019,6 +1050,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
HWR_MakePatch(patch, gpatch, grmip, true);
|
||||
|
||||
// You can't free rawpatch for some reason?
|
||||
// (Obviously I can't, sprite rotation needs that...)
|
||||
if (!gpatch->rawpatch)
|
||||
Z_Free(patch);
|
||||
}
|
||||
|
@ -1034,6 +1066,9 @@ 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)
|
||||
{
|
||||
|
@ -1046,7 +1081,6 @@ void HWR_GetPatch(GLPatch_t *gpatch)
|
|||
|
||||
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
||||
// not fragment memory, and besides the REAL cache here is the hardware memory
|
||||
// You can't free rawpatch for some reason?
|
||||
if (!gpatch->rawpatch)
|
||||
Z_Free(ptr);
|
||||
}
|
||||
|
@ -1065,6 +1099,9 @@ 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
|
||||
|
@ -1190,6 +1227,9 @@ 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)
|
||||
|
@ -1284,23 +1324,6 @@ GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
|
|||
return HWR_GetCachedGLPatchPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
|
||||
}
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
GLPatch_t *HWR_GetCachedGLRotSprite(aatree_t *hwrcache, UINT16 rollangle, patch_t *rawpatch)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
|
||||
if (!(grpatch = M_AATreeGet(hwrcache, rollangle)))
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
grpatch->rawpatch = rawpatch;
|
||||
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, rollangle, grpatch);
|
||||
}
|
||||
|
||||
return grpatch;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Need to do this because they aren't powers of 2
|
||||
static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32 pblockheight,
|
||||
lumpnum_t fademasklumpnum, UINT16 fmwidth, UINT16 fmheight)
|
||||
|
@ -1393,6 +1416,9 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
|||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "../v_video.h"
|
||||
#include "hw_clip.h"
|
||||
#include "hw_glob.h"
|
||||
#include "../r_main.h"
|
||||
#include "../r_state.h"
|
||||
#include "../tables.h"
|
||||
#include "r_opengl/r_opengl.h"
|
||||
|
@ -328,7 +329,7 @@ angle_t gld_FrustumAngle(void)
|
|||
|
||||
// NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
|
||||
|
||||
float render_fov = FIXED_TO_FLOAT(cv_grfov.value);
|
||||
float render_fov = FIXED_TO_FLOAT(cv_fov.value);
|
||||
float render_fovratio = (float)BASEVIDWIDTH / (float)BASEVIDHEIGHT; // SRB2CBTODO: NEWCLIPTODO: Is this right?
|
||||
float render_multiplier = 64.0f / render_fovratio / RMUL;
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ struct GLMipmap_s
|
|||
|
||||
struct GLMipmap_s *nextcolormap;
|
||||
const UINT8 *colormap;
|
||||
INT32 tcindex;
|
||||
|
||||
// opengl
|
||||
struct GLMipmap_s *nextmipmap; // opengl : liste of all texture in opengl driver
|
||||
|
|
|
@ -42,7 +42,7 @@ typedef unsigned char FBOOLEAN;
|
|||
|
||||
// byte value for paletted graphics, which represent the transparent color
|
||||
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 255
|
||||
#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
|
||||
//#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
|
||||
|
||||
// the chroma key color shows on border sprites, set it to black
|
||||
#define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen()
|
||||
|
@ -115,13 +115,11 @@ typedef struct
|
|||
FLOAT fovxangle, fovyangle;
|
||||
UINT8 splitscreen;
|
||||
boolean flip; // screenflip
|
||||
#ifdef ROTSPRITE
|
||||
boolean roll;
|
||||
SINT8 rollflip;
|
||||
FLOAT rollangle; // done to not override USE_FTRANSFORM_ANGLEZ
|
||||
UINT8 rotaxis;
|
||||
FLOAT centerx, centery;
|
||||
#endif
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
boolean mirror; // SRB2Kart: Encore Mode
|
||||
#endif
|
||||
|
@ -220,11 +218,10 @@ typedef struct FSurfaceInfo FSurfaceInfo;
|
|||
//Hurdler: added for backward compatibility
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
HWD_SET_FOG_TABLE = 1,
|
||||
HWD_SET_MODEL_LIGHTING = 1,
|
||||
HWD_SET_FOG_MODE,
|
||||
HWD_SET_FOG_COLOR,
|
||||
HWD_SET_FOG_DENSITY,
|
||||
HWD_SET_FOV,
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
HWD_NUMSTATE
|
||||
|
|
|
@ -992,7 +992,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// top edge
|
||||
if (clearlines > basewindowy - 8)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH);
|
||||
for (x = 0; x < baseviewwidth; x += 8)
|
||||
HWR_DrawPatch(patch, basewindowx + x, basewindowy - 8,
|
||||
0);
|
||||
|
@ -1001,7 +1001,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// bottom edge
|
||||
if (clearlines > basewindowy + baseviewheight)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH);
|
||||
for (x = 0; x < baseviewwidth; x += 8)
|
||||
HWR_DrawPatch(patch, basewindowx + x,
|
||||
basewindowy + baseviewheight, 0);
|
||||
|
@ -1010,7 +1010,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// left edge
|
||||
if (clearlines > basewindowy)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH);
|
||||
for (y = 0; y < baseviewheight && basewindowy + y < clearlines;
|
||||
y += 8)
|
||||
{
|
||||
|
@ -1022,7 +1022,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// right edge
|
||||
if (clearlines > basewindowy)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH);
|
||||
for (y = 0; y < baseviewheight && basewindowy+y < clearlines;
|
||||
y += 8)
|
||||
{
|
||||
|
@ -1034,22 +1034,22 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// Draw beveled corners.
|
||||
if (clearlines > basewindowy - 8)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TL],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx - 8, basewindowy - 8, 0);
|
||||
|
||||
if (clearlines > basewindowy - 8)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TR],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx + baseviewwidth, basewindowy - 8, 0);
|
||||
|
||||
if (clearlines > basewindowy+baseviewheight)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BL],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx - 8, basewindowy + baseviewheight, 0);
|
||||
|
||||
if (clearlines > basewindowy + baseviewheight)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BR],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx + baseviewwidth,
|
||||
basewindowy + baseviewheight, 0);
|
||||
}
|
||||
|
|
|
@ -39,11 +39,7 @@ EXPORT void HWRAPI(Shutdown) (void);
|
|||
#ifdef _WINDOWS
|
||||
EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes);
|
||||
#endif
|
||||
#if defined (PURESDL) || defined (macintosh)
|
||||
EXPORT void HWRAPI(SetPalette) (INT32 *, RGBA_t *gamma);
|
||||
#else
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal, RGBA_t *pgamma);
|
||||
#endif
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal);
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
|
|
|
@ -100,6 +100,7 @@ void HWR_FreePolyPool(void);
|
|||
// --------
|
||||
void HWR_InitTextureCache(void);
|
||||
void HWR_FreeTextureCache(void);
|
||||
void HWR_FreeMipmapCache(void);
|
||||
void HWR_FreeExtraSubsectors(void);
|
||||
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat);
|
||||
|
@ -112,9 +113,6 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum);
|
|||
void HWR_SetPalette(RGBA_t *palette);
|
||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wad, UINT16 lump);
|
||||
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum);
|
||||
#ifdef ROTSPRITE
|
||||
GLPatch_t *HWR_GetCachedGLRotSprite(aatree_t *hwrcache, UINT16 rollangle, patch_t *rawpatch);
|
||||
#endif
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
||||
|
||||
// --------
|
||||
|
@ -127,6 +125,5 @@ extern consvar_t cv_grrounddown; // on/off
|
|||
|
||||
extern INT32 patchformat;
|
||||
extern INT32 textureformat;
|
||||
extern boolean firetranslucent;
|
||||
|
||||
#endif //_HW_GLOB_
|
||||
|
|
|
@ -374,7 +374,6 @@ light_t *t_lspr[NUMSPRITES] =
|
|||
&lspr[NOLIGHT], // SPR_ADST
|
||||
&lspr[NOLIGHT], // SPR_MCRT
|
||||
&lspr[NOLIGHT], // SPR_MCSP
|
||||
&lspr[NOLIGHT], // SPR_NON2
|
||||
&lspr[NOLIGHT], // SPR_SALD
|
||||
&lspr[NOLIGHT], // SPR_TRAE
|
||||
&lspr[NOLIGHT], // SPR_TRAI
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,6 +29,7 @@
|
|||
|
||||
// Startup & Shutdown the hardware mode renderer
|
||||
void HWR_Startup(void);
|
||||
void HWR_Switch(void);
|
||||
void HWR_Shutdown(void);
|
||||
|
||||
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
||||
|
@ -47,7 +48,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale
|
|||
void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
|
||||
void HWR_CreatePlanePolygons(INT32 bspnum);
|
||||
void HWR_CreateStaticLightmaps(INT32 bspnum);
|
||||
void HWR_PrepLevelCache(size_t pnumtextures);
|
||||
void HWR_LoadTextures(size_t pnumtextures);
|
||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
||||
void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 actualcolor, UINT8 strength);
|
||||
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 actualcolor); // Lat: separate flags from color since color needs to be an uint to work right.
|
||||
|
@ -57,6 +58,7 @@ UINT8 *HWR_GetScreenshot(void);
|
|||
boolean HWR_Screenshot(const char *pathname);
|
||||
|
||||
void HWR_AddCommands(void);
|
||||
void HWR_AddSessionCommands(void);
|
||||
void HWR_CorrectSWTricks(void);
|
||||
void transform(float *cx, float *cy, float *cz);
|
||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
|
@ -82,23 +84,21 @@ extern consvar_t cv_grstaticlighting;
|
|||
extern consvar_t cv_grcoronas;
|
||||
extern consvar_t cv_grcoronasize;
|
||||
#endif
|
||||
extern consvar_t cv_grfov;
|
||||
extern consvar_t cv_grmodels;
|
||||
extern consvar_t cv_grmodelinterpolation;
|
||||
extern consvar_t cv_grmodellighting;
|
||||
extern consvar_t cv_grfog;
|
||||
extern consvar_t cv_grfogcolor;
|
||||
extern consvar_t cv_grfogdensity;
|
||||
extern consvar_t cv_grsoftwarefog;
|
||||
extern consvar_t cv_grgammared;
|
||||
extern consvar_t cv_grgammagreen;
|
||||
extern consvar_t cv_grgammablue;
|
||||
extern consvar_t cv_grfiltermode;
|
||||
extern consvar_t cv_granisotropicmode;
|
||||
extern consvar_t cv_grcorrecttricks;
|
||||
extern consvar_t cv_grfovchange;
|
||||
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 float gr_viewwidth, gr_viewheight, gr_baseviewwindowy;
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
|||
|
||||
{
|
||||
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->grInfo.data);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRMODELTEXTURE, &grpatch->mipmap->grInfo.data);
|
||||
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
|
||||
for (i = 0; i < height; i++)
|
||||
row_pointers[i] = PNG_image + i*pitch;
|
||||
|
@ -313,7 +313,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
|||
|
||||
pw = *w = header.xmax - header.xmin + 1;
|
||||
ph = *h = header.ymax - header.ymin + 1;
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->grInfo.data);
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &grpatch->mipmap->grInfo.data);
|
||||
|
||||
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
|
||||
{
|
||||
|
@ -373,6 +373,9 @@ static void md2_loadTexture(md2_t *model)
|
|||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
UINT32 size;
|
||||
RGBA_t *image;
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
|
@ -389,6 +392,15 @@ static void md2_loadTexture(md2_t *model)
|
|||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
|
||||
// Lactozilla: Apply colour cube
|
||||
image = grpatch->mipmap->grInfo.data;
|
||||
size = w*h;
|
||||
while (size--)
|
||||
{
|
||||
V_CubeApply(&image->s.red, &image->s.green, &image->s.blue);
|
||||
image++;
|
||||
}
|
||||
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// not correct!
|
||||
grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
|
@ -397,7 +409,6 @@ static void md2_loadTexture(md2_t *model)
|
|||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
@ -453,7 +464,6 @@ static void md2_loadBlendTexture(md2_t *model)
|
|||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
|
||||
Z_Free(filename);
|
||||
}
|
||||
|
@ -637,18 +647,24 @@ spritemd2found:
|
|||
// 0.7152 to green
|
||||
// 0.0722 to blue
|
||||
#define SETBRIGHTNESS(brightness,r,g,b) \
|
||||
brightness = (UINT8)(((1063*((UINT16)r)/5000) + (3576*((UINT16)g)/5000) + (361*((UINT16)b)/5000)) / 3)
|
||||
brightness = (UINT8)(((1063*(UINT16)(r))/5000) + ((3576*(UINT16)(g))/5000) + ((361*(UINT16)(b))/5000))
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
|
||||
{
|
||||
UINT8 i;
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||
UINT8 translation[16]; // First the color index
|
||||
UINT8 cutoff[16]; // Brightness cutoff before using the next color
|
||||
UINT8 translen = 0;
|
||||
UINT8 i;
|
||||
|
||||
blendcolor = V_GetColor(0); // initialize
|
||||
memset(translation, 0, sizeof(translation));
|
||||
memset(cutoff, 0, sizeof(cutoff));
|
||||
|
||||
if (grmip->width == 0)
|
||||
{
|
||||
|
||||
grmip->width = gpatch->width;
|
||||
grmip->height = gpatch->height;
|
||||
|
||||
|
@ -658,113 +674,340 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
grmip->grInfo.format = GR_RGBA;
|
||||
}
|
||||
|
||||
Z_Free(grmip->grInfo.data);
|
||||
grmip->grInfo.data = NULL;
|
||||
if (grmip->grInfo.data)
|
||||
{
|
||||
Z_Free(grmip->grInfo.data);
|
||||
grmip->grInfo.data = NULL;
|
||||
}
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data);
|
||||
cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &grmip->grInfo.data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap->grInfo.data;
|
||||
blendimage = blendgpatch->mipmap->grInfo.data;
|
||||
|
||||
// Average all of the translation's colors
|
||||
if (color == SKINCOLOR_NONE || color >= MAXTRANSLATIONS)
|
||||
blendcolor = V_GetColor(0xff);
|
||||
else
|
||||
// TC_METALSONIC includes an actual skincolor translation, on top of its flashing.
|
||||
if (skinnum == TC_METALSONIC)
|
||||
color = SKINCOLOR_COBALT;
|
||||
|
||||
if (color != SKINCOLOR_NONE)
|
||||
{
|
||||
const UINT8 div = 6;
|
||||
const UINT8 start = 4;
|
||||
UINT32 r, g, b;
|
||||
UINT8 numdupes = 1;
|
||||
|
||||
blendcolor = V_GetColor(Color_Index[color-1][start]);
|
||||
r = (UINT32)(blendcolor.s.red*blendcolor.s.red);
|
||||
g = (UINT32)(blendcolor.s.green*blendcolor.s.green);
|
||||
b = (UINT32)(blendcolor.s.blue*blendcolor.s.blue);
|
||||
translation[translen] = Color_Index[color-1][0];
|
||||
cutoff[translen] = 255;
|
||||
|
||||
for (i = 1; i < div; i++)
|
||||
for (i = 1; i < 16; i++)
|
||||
{
|
||||
RGBA_t nextcolor = V_GetColor(Color_Index[color-1][start+i]);
|
||||
r += (UINT32)(nextcolor.s.red*nextcolor.s.red);
|
||||
g += (UINT32)(nextcolor.s.green*nextcolor.s.green);
|
||||
b += (UINT32)(nextcolor.s.blue*nextcolor.s.blue);
|
||||
if (translation[translen] == Color_Index[color-1][i])
|
||||
{
|
||||
numdupes++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (translen > 0)
|
||||
{
|
||||
cutoff[translen] = cutoff[translen-1] - (256 / (16 / numdupes));
|
||||
}
|
||||
|
||||
numdupes = 1;
|
||||
translen++;
|
||||
|
||||
translation[translen] = (UINT8)Color_Index[color-1][i];
|
||||
}
|
||||
|
||||
blendcolor.s.red = (UINT8)(FixedSqrt((r/div)<<FRACBITS)>>FRACBITS);
|
||||
blendcolor.s.green = (UINT8)(FixedSqrt((g/div)<<FRACBITS)>>FRACBITS);
|
||||
blendcolor.s.blue = (UINT8)(FixedSqrt((b/div)<<FRACBITS)>>FRACBITS);
|
||||
translen++;
|
||||
}
|
||||
|
||||
// rainbow support, could theoretically support boss ones too
|
||||
if (skinnum == TC_RAINBOW)
|
||||
while (size--)
|
||||
{
|
||||
while (size--)
|
||||
if (skinnum == TC_BOSS)
|
||||
{
|
||||
if (image->s.alpha == 0 && blendimage->s.alpha == 0)
|
||||
// Turn everything below a certain threshold white
|
||||
if ((image->s.red == image->s.green) && (image->s.green == image->s.blue) && image->s.blue < 127)
|
||||
{
|
||||
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
|
||||
cur->rgba = image->rgba;
|
||||
// Lactozilla: Invert the colors
|
||||
cur->s.red = cur->s.green = cur->s.blue = (255 - image->s.blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT32 tempcolor;
|
||||
UINT16 imagebright, blendbright, finalbright, colorbright;
|
||||
SETBRIGHTNESS(imagebright,image->s.red,image->s.green,image->s.blue);
|
||||
SETBRIGHTNESS(blendbright,blendimage->s.red,blendimage->s.green,blendimage->s.blue);
|
||||
// slightly dumb average between the blend image color and base image colour, usually one or the other will be fully opaque anyway
|
||||
finalbright = (imagebright*(255-blendimage->s.alpha))/255 + (blendbright*blendimage->s.alpha)/255;
|
||||
SETBRIGHTNESS(colorbright,blendcolor.s.red,blendcolor.s.green,blendcolor.s.blue);
|
||||
|
||||
tempcolor = (finalbright*blendcolor.s.red)/colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.red = (UINT8)tempcolor;
|
||||
tempcolor = (finalbright*blendcolor.s.green)/colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.green = (UINT8)tempcolor;
|
||||
tempcolor = (finalbright*blendcolor.s.blue)/colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.blue = (UINT8)tempcolor;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
cur->s.red = image->s.red;
|
||||
cur->s.green = image->s.green;
|
||||
cur->s.blue = image->s.blue;
|
||||
}
|
||||
|
||||
cur++; image++; blendimage++;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (size--)
|
||||
else if (skinnum == TC_ALLWHITE)
|
||||
{
|
||||
if (blendimage->s.alpha == 0)
|
||||
// Turn everything white
|
||||
cur->s.red = cur->s.green = cur->s.blue = 255;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Everything below requires a blend image
|
||||
if (blendimage == NULL)
|
||||
{
|
||||
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
|
||||
cur->rgba = image->rgba;
|
||||
goto skippixel;
|
||||
}
|
||||
|
||||
// Metal Sonic dash mode
|
||||
if (skinnum == TC_DASHMODE)
|
||||
{
|
||||
if (image->s.alpha == 0 && blendimage->s.alpha == 0)
|
||||
{
|
||||
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
|
||||
cur->rgba = image->rgba;
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT8 ialpha = 255 - blendimage->s.alpha, balpha = blendimage->s.alpha;
|
||||
RGBA_t icolor = *image, bcolor;
|
||||
|
||||
memset(&bcolor, 0x00, sizeof(RGBA_t));
|
||||
|
||||
if (blendimage->s.alpha)
|
||||
{
|
||||
bcolor.s.blue = 0;
|
||||
bcolor.s.red = 255;
|
||||
bcolor.s.green = (blendimage->s.red + blendimage->s.green + blendimage->s.blue) / 3;
|
||||
}
|
||||
|
||||
if (image->s.alpha && image->s.red > image->s.green << 1) // this is pretty arbitrary, but it works well for Metal Sonic
|
||||
{
|
||||
icolor.s.red = image->s.blue;
|
||||
icolor.s.blue = image->s.red;
|
||||
}
|
||||
|
||||
cur->s.red = (ialpha * icolor.s.red + balpha * bcolor.s.red)/255;
|
||||
cur->s.green = (ialpha * icolor.s.green + balpha * bcolor.s.green)/255;
|
||||
cur->s.blue = (ialpha * icolor.s.blue + balpha * bcolor.s.blue)/255;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 tempcolor;
|
||||
INT16 tempmult, tempalpha;
|
||||
tempalpha = -(abs(blendimage->s.red-127)-127)*2;
|
||||
if (tempalpha > 255)
|
||||
tempalpha = 255;
|
||||
else if (tempalpha < 0)
|
||||
tempalpha = 0;
|
||||
// All settings that use skincolors!
|
||||
UINT16 brightness;
|
||||
|
||||
tempmult = (blendimage->s.red-127)*2;
|
||||
if (tempmult > 255)
|
||||
tempmult = 255;
|
||||
else if (tempmult < 0)
|
||||
tempmult = 0;
|
||||
if (translen <= 0)
|
||||
{
|
||||
cur->rgba = image->rgba;
|
||||
goto skippixel;
|
||||
}
|
||||
|
||||
tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255;
|
||||
cur->s.red = (UINT8)tempcolor;
|
||||
tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255;
|
||||
cur->s.green = (UINT8)tempcolor;
|
||||
tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255;
|
||||
cur->s.blue = (UINT8)tempcolor;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
|
||||
if (skinnum == TC_RAINBOW)
|
||||
{
|
||||
if (image->s.alpha == 0 && blendimage->s.alpha == 0)
|
||||
{
|
||||
cur->rgba = image->rgba;
|
||||
goto skippixel;
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT16 imagebright, blendbright;
|
||||
SETBRIGHTNESS(imagebright,image->s.red,image->s.green,image->s.blue);
|
||||
SETBRIGHTNESS(blendbright,blendimage->s.red,blendimage->s.green,blendimage->s.blue);
|
||||
// slightly dumb average between the blend image color and base image colour, usually one or the other will be fully opaque anyway
|
||||
brightness = (imagebright*(255-blendimage->s.alpha))/255 + (blendbright*blendimage->s.alpha)/255;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (blendimage->s.alpha == 0)
|
||||
{
|
||||
cur->rgba = image->rgba;
|
||||
goto skippixel; // for metal sonic blend
|
||||
}
|
||||
else
|
||||
{
|
||||
SETBRIGHTNESS(brightness,blendimage->s.red,blendimage->s.green,blendimage->s.blue);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate a sort of "gradient" for the skincolor
|
||||
// (Me splitting this into a function didn't work, so I had to ruin this entire function's groove...)
|
||||
{
|
||||
RGBA_t nextcolor;
|
||||
UINT8 firsti, secondi, mul, mulmax;
|
||||
INT32 r, g, b;
|
||||
|
||||
// Rainbow needs to find the closest match to the textures themselves, instead of matching brightnesses to other colors.
|
||||
// Ensue horrible mess.
|
||||
if (skinnum == TC_RAINBOW)
|
||||
{
|
||||
UINT16 brightdif = 256;
|
||||
UINT8 colorbrightnesses[16];
|
||||
INT32 compare, m, d;
|
||||
|
||||
// Ignore pure white & pitch black
|
||||
if (brightness > 253 || brightness < 2)
|
||||
{
|
||||
cur->rgba = image->rgba;
|
||||
cur++; image++; blendimage++;
|
||||
continue;
|
||||
}
|
||||
|
||||
firsti = 0;
|
||||
mul = 0;
|
||||
mulmax = 1;
|
||||
|
||||
for (i = 0; i < translen; i++)
|
||||
{
|
||||
RGBA_t tempc = V_GetColor(translation[i]);
|
||||
SETBRIGHTNESS(colorbrightnesses[i], tempc.s.red, tempc.s.green, tempc.s.blue); // store brightnesses for comparison
|
||||
}
|
||||
|
||||
for (i = 0; i < translen; i++)
|
||||
{
|
||||
if (brightness > colorbrightnesses[i]) // don't allow greater matches (because calculating a makeshift gradient for this is already a huge mess as is)
|
||||
continue;
|
||||
|
||||
compare = abs((INT16)(colorbrightnesses[i]) - (INT16)(brightness));
|
||||
|
||||
if (compare < brightdif)
|
||||
{
|
||||
brightdif = (UINT16)compare;
|
||||
firsti = i; // best matching color that's equal brightness or darker
|
||||
}
|
||||
}
|
||||
|
||||
secondi = firsti+1; // next color in line
|
||||
if (secondi >= translen)
|
||||
{
|
||||
m = (INT16)brightness; // - 0;
|
||||
d = (INT16)colorbrightnesses[firsti]; // - 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m = (INT16)brightness - (INT16)colorbrightnesses[secondi];
|
||||
d = (INT16)colorbrightnesses[firsti] - (INT16)colorbrightnesses[secondi];
|
||||
}
|
||||
|
||||
if (m >= d)
|
||||
m = d-1;
|
||||
|
||||
mulmax = 16;
|
||||
|
||||
// calculate the "gradient" multiplier based on how close this color is to the one next in line
|
||||
if (m <= 0 || d <= 0)
|
||||
mul = 0;
|
||||
else
|
||||
mul = (mulmax-1) - ((m * mulmax) / d);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just convert brightness to a skincolor value, use distance to next position to find the gradient multipler
|
||||
firsti = 0;
|
||||
|
||||
for (i = 1; i < translen; i++)
|
||||
{
|
||||
if (brightness >= cutoff[i])
|
||||
break;
|
||||
firsti = i;
|
||||
}
|
||||
|
||||
secondi = firsti+1;
|
||||
|
||||
mulmax = cutoff[firsti];
|
||||
if (secondi < translen)
|
||||
mulmax -= cutoff[secondi];
|
||||
|
||||
mul = cutoff[firsti] - brightness;
|
||||
}
|
||||
|
||||
blendcolor = V_GetColor(translation[firsti]);
|
||||
|
||||
if (mul > 0) // If it's 0, then we only need the first color.
|
||||
{
|
||||
if (secondi >= translen) // blend to black
|
||||
nextcolor = V_GetColor(31);
|
||||
else
|
||||
nextcolor = V_GetColor(translation[secondi]);
|
||||
|
||||
// Find difference between points
|
||||
r = (INT32)(nextcolor.s.red - blendcolor.s.red);
|
||||
g = (INT32)(nextcolor.s.green - blendcolor.s.green);
|
||||
b = (INT32)(nextcolor.s.blue - blendcolor.s.blue);
|
||||
|
||||
// Find the gradient of the two points
|
||||
r = ((mul * r) / mulmax);
|
||||
g = ((mul * g) / mulmax);
|
||||
b = ((mul * b) / mulmax);
|
||||
|
||||
// Add gradient value to color
|
||||
blendcolor.s.red += r;
|
||||
blendcolor.s.green += g;
|
||||
blendcolor.s.blue += b;
|
||||
}
|
||||
}
|
||||
|
||||
if (skinnum == TC_RAINBOW)
|
||||
{
|
||||
UINT32 tempcolor;
|
||||
UINT16 colorbright;
|
||||
|
||||
SETBRIGHTNESS(colorbright,blendcolor.s.red,blendcolor.s.green,blendcolor.s.blue);
|
||||
if (colorbright == 0)
|
||||
colorbright = 1; // no dividing by 0 please
|
||||
|
||||
tempcolor = (brightness * blendcolor.s.red) / colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.red = (UINT8)tempcolor;
|
||||
|
||||
tempcolor = (brightness * blendcolor.s.green) / colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.green = (UINT8)tempcolor;
|
||||
|
||||
tempcolor = (brightness * blendcolor.s.blue) / colorbright;
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.blue = (UINT8)tempcolor;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Color strength depends on image alpha
|
||||
INT32 tempcolor;
|
||||
|
||||
tempcolor = ((image->s.red * (255-blendimage->s.alpha)) / 255) + ((blendcolor.s.red * blendimage->s.alpha) / 255);
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.red = (UINT8)tempcolor;
|
||||
|
||||
tempcolor = ((image->s.green * (255-blendimage->s.alpha)) / 255) + ((blendcolor.s.green * blendimage->s.alpha) / 255);
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.green = (UINT8)tempcolor;
|
||||
|
||||
tempcolor = ((image->s.blue * (255-blendimage->s.alpha)) / 255) + ((blendcolor.s.blue * blendimage->s.alpha) / 255);
|
||||
tempcolor = min(255, tempcolor);
|
||||
cur->s.blue = (UINT8)tempcolor;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
|
||||
skippixel:
|
||||
|
||||
// *Now* we can do Metal Sonic's flashing
|
||||
if (skinnum == TC_METALSONIC)
|
||||
{
|
||||
// Blend dark blue into white
|
||||
if (cur->s.alpha > 0 && cur->s.red == 0 && cur->s.green == 0 && cur->s.blue < 255 && cur->s.blue > 31)
|
||||
{
|
||||
// Sal: Invert non-blue
|
||||
cur->s.red = cur->s.green = (255 - cur->s.blue);
|
||||
cur->s.blue = 255;
|
||||
}
|
||||
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
}
|
||||
|
||||
cur++; image++; blendimage++;
|
||||
}
|
||||
|
||||
cur++; image++;
|
||||
|
||||
if (blendimage != NULL)
|
||||
blendimage++;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -777,24 +1020,24 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
|||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
if ((colormap == colormaps || colormap == NULL) && (skinnum > TC_DEFAULT))
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
if (grmip->colormap == colormap || (skinnum < TC_DEFAULT && grmip->tcindex == skinnum))
|
||||
{
|
||||
if (grmip->downloaded && grmip->grInfo.data)
|
||||
{
|
||||
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRMODELTEXTURE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -803,6 +1046,14 @@ 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
|
||||
|
@ -812,16 +1063,27 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
|||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
grmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
newmip->tcindex = skinnum;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(newmip->grInfo.data, PU_HWRMODELTEXTURE);
|
||||
}
|
||||
|
||||
#define NORMALFOG 0x00000000
|
||||
#define FADEFOG 0x19000000
|
||||
|
||||
static boolean HWR_AllowModel(mobj_t *mobj)
|
||||
{
|
||||
// Signpost overlay. Not needed.
|
||||
if (mobj->state-states == S_PLAY_SIGN)
|
||||
return false;
|
||||
|
||||
// Otherwise, render the model.
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean HWR_CanInterpolateModel(mobj_t *mobj, model_t *model)
|
||||
{
|
||||
if (cv_grmodelinterpolation.value == 2) // Always interpolate
|
||||
|
@ -897,7 +1159,7 @@ static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t
|
|||
// HWR_DrawModel
|
||||
//
|
||||
|
||||
void HWR_DrawModel(gr_vissprite_t *spr)
|
||||
boolean HWR_DrawModel(gr_vissprite_t *spr)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
|
@ -910,10 +1172,12 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
UINT8 color[4];
|
||||
|
||||
if (!cv_grmodels.value)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (spr->precip)
|
||||
return;
|
||||
return false;
|
||||
|
||||
memset(&p, 0x00, sizeof(FTransform));
|
||||
|
||||
// MD2 colormap fix
|
||||
// colormap test
|
||||
|
@ -921,7 +1185,7 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
{
|
||||
sector_t *sector = spr->mobj->subsector->sector;
|
||||
UINT8 lightlevel = 255;
|
||||
extracolormap_t *colormap = sector->extra_colormap;
|
||||
extracolormap_t *colormap = NULL;
|
||||
|
||||
if (sector->numlights)
|
||||
{
|
||||
|
@ -958,13 +1222,12 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
INT32 durs = spr->mobj->state->tics;
|
||||
INT32 tics = spr->mobj->tics;
|
||||
//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));
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
#ifdef ROTSPRITE
|
||||
spriteinfo_t *sprinfo;
|
||||
angle_t ang;
|
||||
#endif
|
||||
INT32 mod;
|
||||
float finalscale;
|
||||
|
||||
|
@ -988,20 +1251,16 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
{
|
||||
md2 = &md2_playermodels[(skin_t*)spr->mobj->skin-skins];
|
||||
md2->skin = (skin_t*)spr->mobj->skin-skins;
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &((skin_t *)spr->mobj->skin)->sprinfo[spr->mobj->sprite2];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
md2 = &md2_models[spr->mobj->sprite];
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[spr->mobj->sprite];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (md2->error)
|
||||
return; // we already failed loading this before :(
|
||||
return false; // we already failed loading this before :(
|
||||
if (!md2->model)
|
||||
{
|
||||
//CONS_Debug(DBG_RENDER, "Loading model... (%s)", sprnames[spr->mobj->sprite]);
|
||||
|
@ -1017,9 +1276,14 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
{
|
||||
//CONS_Debug(DBG_RENDER, " FAILED\n");
|
||||
md2->error = true; // prevent endless fail
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Lactozilla: Disallow certain models from rendering
|
||||
if (!HWR_AllowModel(spr->mobj))
|
||||
return false;
|
||||
|
||||
//HWD.pfnSetBlend(blend); // This seems to actually break translucency?
|
||||
finalscale = md2->scale;
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
|
@ -1034,43 +1298,44 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
|
||||
if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
{
|
||||
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
|
||||
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format
|
||||
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
|
||||
INT32 skinnum = INT32_MAX;
|
||||
|
||||
if ((spr->mobj->flags & (MF_ENEMY|MF_BOSS)) && (spr->mobj->flags2 & MF2_FRET) && !(spr->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash"
|
||||
{
|
||||
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"
|
||||
if (spr->mobj->type == MT_CYBRAKDEMON || spr->mobj->colorized)
|
||||
skinnum = TC_ALLWHITE;
|
||||
else if (spr->mobj->type == MT_METALSONIC_BATTLE)
|
||||
skinnum = TC_METALSONIC;
|
||||
else
|
||||
skinnum = TC_BOSS;
|
||||
}
|
||||
else if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE)
|
||||
{
|
||||
if (spr->mobj->colorized)
|
||||
skinnum = TC_RAINBOW;
|
||||
else if (spr->mobj->player && spr->mobj->player->dashmode >= DASHMODE_THRESHOLD
|
||||
&& (spr->mobj->player->charflags & SF_DASHMODE)
|
||||
&& ((leveltime/2) & 1))
|
||||
{
|
||||
if (spr->mobj->type == MT_CYBRAKDEMON || spr->mobj->colorized)
|
||||
skinnum = TC_ALLWHITE;
|
||||
else if (spr->mobj->type == MT_METALSONIC_BATTLE)
|
||||
skinnum = TC_METALSONIC;
|
||||
if (spr->mobj->player->charflags & SF_MACHINE)
|
||||
skinnum = TC_DASHMODE;
|
||||
else
|
||||
skinnum = TC_BOSS;
|
||||
}
|
||||
else if (spr->mobj->color)
|
||||
{
|
||||
if (spr->mobj->colorized)
|
||||
skinnum = TC_RAINBOW;
|
||||
else if (spr->mobj->player && spr->mobj->player->dashmode >= DASHMODE_THRESHOLD
|
||||
&& (spr->mobj->player->charflags & SF_DASHMODE)
|
||||
&& ((leveltime/2) & 1))
|
||||
{
|
||||
if (spr->mobj->player->charflags & SF_MACHINE)
|
||||
skinnum = TC_DASHMODE;
|
||||
else
|
||||
skinnum = TC_RAINBOW;
|
||||
}
|
||||
else if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
skinnum = (INT32)((skin_t*)spr->mobj->skin-skins);
|
||||
else
|
||||
skinnum = TC_DEFAULT;
|
||||
}
|
||||
else if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
skinnum = (INT32)((skin_t*)spr->mobj->skin-skins);
|
||||
else
|
||||
skinnum = TC_DEFAULT;
|
||||
}
|
||||
|
||||
// Translation or skin number found
|
||||
if (skinnum != INT32_MAX)
|
||||
{
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is safe, since we know the texture has been downloaded
|
||||
// Sorry nothing
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
|
@ -1168,14 +1433,12 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
|
||||
sprframe = &sprdef->spriteframes[spr->mobj->frame & FF_FRAMEMASK];
|
||||
|
||||
if (sprframe->rotate)
|
||||
if (sprframe->rotate || papersprite)
|
||||
{
|
||||
fixed_t anglef = AngleFixed(spr->mobj->angle);
|
||||
|
||||
if (spr->mobj->player)
|
||||
anglef = AngleFixed(spr->mobj->player->drawangle);
|
||||
else
|
||||
anglef = AngleFixed(spr->mobj->angle);
|
||||
|
||||
p.angley = FIXED_TO_FLOAT(anglef);
|
||||
}
|
||||
|
@ -1185,9 +1448,8 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
p.angley = FIXED_TO_FLOAT(anglef);
|
||||
}
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
p.rollangle = 0.0f;
|
||||
p.rollflip = 0;
|
||||
p.rollflip = 1;
|
||||
p.rotaxis = 0;
|
||||
if (spr->mobj->rollangle)
|
||||
{
|
||||
|
@ -1210,7 +1472,6 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
|
||||
p.rollflip = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
p.anglex = 0.0f;
|
||||
|
||||
|
@ -1244,6 +1505,8 @@ void HWR_DrawModel(gr_vissprite_t *spr)
|
|||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, color);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
|
|
|
@ -45,8 +45,8 @@ extern md2_t md2_models[NUMSPRITES];
|
|||
extern md2_t md2_playermodels[MAXSKINS];
|
||||
|
||||
void HWR_InitModels(void);
|
||||
void HWR_DrawModel(gr_vissprite_t *spr);
|
||||
void HWR_AddPlayerModel(INT32 skin);
|
||||
void HWR_AddSpriteModel(size_t spritenum);
|
||||
boolean HWR_DrawModel(gr_vissprite_t *spr);
|
||||
|
||||
#endif // _HW_MD2_H_
|
||||
|
|
|
@ -564,20 +564,15 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
|||
// : in OpenGL, we store values for conversion of paletted graphics when
|
||||
// : they are downloaded to the 3D card.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal, RGBA_t *gamma)
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = (UINT8)MIN((pal[i].s.red*gamma->s.red)/127, 255);
|
||||
myPaletteData[i].s.green = (UINT8)MIN((pal[i].s.green*gamma->s.green)/127, 255);
|
||||
myPaletteData[i].s.blue = (UINT8)MIN((pal[i].s.blue*gamma->s.blue)/127, 255);
|
||||
myPaletteData[i].s.alpha = pal[i].s.alpha;
|
||||
}
|
||||
|
||||
size_t palsize = (sizeof(RGBA_t) * 256);
|
||||
// on a palette change, you have to reload all of the textures
|
||||
Flush();
|
||||
if (memcmp(&myPaletteData, pal, palsize))
|
||||
{
|
||||
memcpy(&myPaletteData, pal, palsize);
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -85,7 +85,7 @@ static GLboolean MipMap = GL_FALSE;
|
|||
static GLint min_filter = GL_LINEAR;
|
||||
static GLint mag_filter = GL_LINEAR;
|
||||
static GLint anisotropic_filter = 0;
|
||||
static FTransform md2_transform;
|
||||
static boolean model_lighting = true;
|
||||
|
||||
const GLubyte *gl_extensions = NULL;
|
||||
|
||||
|
@ -221,11 +221,6 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
|
|||
#define pglDrawElements glDrawElements
|
||||
#define pglEnableClientState glEnableClientState
|
||||
#define pglDisableClientState glDisableClientState
|
||||
#define pglClientActiveTexture glClientActiveTexture
|
||||
#define pglGenBuffers glGenBuffers
|
||||
#define pglBindBuffer glBindBuffer
|
||||
#define pglBufferData glBufferData
|
||||
#define pglDeleteBuffers glDeleteBuffers
|
||||
|
||||
/* Lighting */
|
||||
#define pglShadeModel glShadeModel
|
||||
|
@ -331,15 +326,6 @@ typedef void (APIENTRY * PFNglEnableClientState) (GLenum cap);
|
|||
static PFNglEnableClientState pglEnableClientState;
|
||||
typedef void (APIENTRY * PFNglDisableClientState) (GLenum cap);
|
||||
static PFNglDisableClientState pglDisableClientState;
|
||||
typedef void (APIENTRY * PFNglGenBuffers) (GLsizei n, GLuint *buffers);
|
||||
static PFNglGenBuffers pglGenBuffers;
|
||||
typedef void (APIENTRY * PFNglBindBuffer) (GLenum target, GLuint buffer);
|
||||
static PFNglBindBuffer pglBindBuffer;
|
||||
typedef void (APIENTRY * PFNglBufferData) (GLenum target, GLsizei size, const GLvoid *data, GLenum usage);
|
||||
static PFNglBufferData pglBufferData;
|
||||
typedef void (APIENTRY * PFNglDeleteBuffers) (GLsizei n, const GLuint *buffers);
|
||||
static PFNglDeleteBuffers pglDeleteBuffers;
|
||||
|
||||
|
||||
/* Lighting */
|
||||
typedef void (APIENTRY * PFNglShadeModel) (GLenum mode);
|
||||
|
@ -397,6 +383,17 @@ static PFNglMultiTexCoord2fv pglMultiTexCoord2fv;
|
|||
typedef void (APIENTRY *PFNglClientActiveTexture) (GLenum);
|
||||
static PFNglClientActiveTexture pglClientActiveTexture;
|
||||
|
||||
/* 1.5 functions for buffers */
|
||||
typedef void (APIENTRY * PFNglGenBuffers) (GLsizei n, GLuint *buffers);
|
||||
static PFNglGenBuffers pglGenBuffers;
|
||||
typedef void (APIENTRY * PFNglBindBuffer) (GLenum target, GLuint buffer);
|
||||
static PFNglBindBuffer pglBindBuffer;
|
||||
typedef void (APIENTRY * PFNglBufferData) (GLenum target, GLsizei size, const GLvoid *data, GLenum usage);
|
||||
static PFNglBufferData pglBufferData;
|
||||
typedef void (APIENTRY * PFNglDeleteBuffers) (GLsizei n, const GLuint *buffers);
|
||||
static PFNglDeleteBuffers pglDeleteBuffers;
|
||||
|
||||
|
||||
/* 1.2 Parms */
|
||||
/* GL_CLAMP_TO_EDGE_EXT */
|
||||
#ifndef GL_CLAMP_TO_EDGE
|
||||
|
@ -512,6 +509,8 @@ boolean SetupGLFunc13(void)
|
|||
pglMultiTexCoord2f = GetGLFunc("glMultiTexCoord2f");
|
||||
pglClientActiveTexture = GetGLFunc("glClientActiveTexture");
|
||||
pglMultiTexCoord2fv = GetGLFunc("glMultiTexCoord2fv");
|
||||
|
||||
/* 1.5 funcs */
|
||||
pglGenBuffers = GetGLFunc("glGenBuffers");
|
||||
pglBindBuffer = GetGLFunc("glBindBuffer");
|
||||
pglBufferData = GetGLFunc("glBufferData");
|
||||
|
@ -724,8 +723,8 @@ void Flush(void)
|
|||
|
||||
while (gr_cachehead)
|
||||
{
|
||||
// ceci n'est pas du tout necessaire vu que tu les a charger normalement et
|
||||
// donc il sont dans ta liste !
|
||||
// this is not necessary at all, because you have loaded them normally,
|
||||
// and so they already are in your list!
|
||||
#if 0
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
FTextureInfo *tmp = gr_cachehead->nextskin;
|
||||
|
@ -1297,11 +1296,11 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
|
|||
|
||||
pTexInfo->nextmipmap = NULL;
|
||||
if (gr_cachetail)
|
||||
{ // insertion en fin de liste
|
||||
{ // insertion at the tail
|
||||
gr_cachetail->nextmipmap = pTexInfo;
|
||||
gr_cachetail = pTexInfo;
|
||||
}
|
||||
else // initialisation de la liste
|
||||
else // initialization of the linked list
|
||||
gr_cachetail = gr_cachehead = pTexInfo;
|
||||
}
|
||||
}
|
||||
|
@ -1435,7 +1434,7 @@ static const boolean gl_ext_arb_vertex_buffer_object = true;
|
|||
|
||||
// The texture offset to be applied to the texture coordinates in SkyVertex().
|
||||
static int rows, columns;
|
||||
static boolean yflip;
|
||||
static signed char yflip;
|
||||
static int texw, texh;
|
||||
static boolean foglayer;
|
||||
static float delta = 0.0f;
|
||||
|
@ -1660,16 +1659,9 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
|||
{
|
||||
switch (IdState)
|
||||
{
|
||||
|
||||
#if 0
|
||||
case 77:
|
||||
{
|
||||
//08/01/00: Hurdler this is a test for mirror
|
||||
if (!Value)
|
||||
ClearBuffer(false, true, 0); // clear depth buffer
|
||||
case HWD_SET_MODEL_LIGHTING:
|
||||
model_lighting = Value;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case HWD_SET_FOG_COLOR:
|
||||
{
|
||||
|
@ -1682,6 +1674,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
|||
pglFogfv(GL_FOG_COLOR, fogcolor);
|
||||
break;
|
||||
}
|
||||
|
||||
case HWD_SET_FOG_DENSITY:
|
||||
pglFogf(GL_FOG_DENSITY, Value*1200/(500*1000000.0f));
|
||||
break;
|
||||
|
@ -2046,16 +2039,25 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
}
|
||||
#endif
|
||||
|
||||
pglLightfv(GL_LIGHT0, GL_POSITION, LightPos);
|
||||
if (model_lighting)
|
||||
{
|
||||
pglLightfv(GL_LIGHT0, GL_POSITION, LightPos);
|
||||
pglShadeModel(GL_SMOOTH);
|
||||
}
|
||||
|
||||
pglShadeModel(GL_SMOOTH);
|
||||
if (color)
|
||||
{
|
||||
#ifdef GL_LIGHT_MODEL_AMBIENT
|
||||
pglEnable(GL_LIGHTING);
|
||||
pglMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient);
|
||||
pglMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
|
||||
if (model_lighting)
|
||||
{
|
||||
pglEnable(GL_LIGHTING);
|
||||
pglMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient);
|
||||
pglMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
pglColor4ubv((GLubyte*)color);
|
||||
|
||||
if (color[3] < 255)
|
||||
SetBlend(PF_Translucent|PF_Modulated|PF_Clip);
|
||||
else
|
||||
|
@ -2074,7 +2076,6 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
|
||||
pglRotatef(pos->anglex, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (pos->roll)
|
||||
{
|
||||
float roll = (1.0f * pos->rollflip);
|
||||
|
@ -2087,7 +2088,6 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
pglRotatef(pos->rollangle, roll, 0.0f, 0.0f);
|
||||
pglTranslatef(-pos->centerx, -pos->centery, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
pglScalef(scalex, scaley, scalez);
|
||||
|
||||
|
@ -2222,13 +2222,11 @@ EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration,
|
|||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
{
|
||||
static boolean special_splitscreen;
|
||||
float used_fov;
|
||||
pglLoadIdentity();
|
||||
if (stransform)
|
||||
{
|
||||
boolean fovx90;
|
||||
// keep a trace of the transformation for md2
|
||||
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
||||
|
||||
used_fov = stransform->fovxangle;
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
// mirroring from Kart
|
||||
if (stransform->mirror)
|
||||
|
@ -2244,45 +2242,57 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
|||
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
|
||||
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
|
||||
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
pglLoadIdentity();
|
||||
fovx90 = stransform->fovxangle > 0.0f && fabsf(stransform->fovxangle - 90.0f) < 0.5f;
|
||||
special_splitscreen = (stransform->splitscreen && fovx90);
|
||||
if (special_splitscreen)
|
||||
GLPerspective(53.13f, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
|
||||
else
|
||||
GLPerspective(stransform->fovxangle, ASPECT_RATIO);
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
special_splitscreen = stransform->splitscreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
used_fov = fov;
|
||||
pglScalef(1.0f, 1.0f, -1.0f);
|
||||
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
pglLoadIdentity();
|
||||
if (special_splitscreen)
|
||||
GLPerspective(53.13f, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
|
||||
else
|
||||
//Hurdler: is "fov" correct?
|
||||
GLPerspective(fov, ASPECT_RATIO);
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
pglLoadIdentity();
|
||||
|
||||
if (special_splitscreen)
|
||||
{
|
||||
used_fov = atan(tan(used_fov*M_PI/360)*0.8)*360/M_PI;
|
||||
GLPerspective(used_fov, 2*ASPECT_RATIO);
|
||||
}
|
||||
else
|
||||
GLPerspective(used_fov, ASPECT_RATIO);
|
||||
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
||||
}
|
||||
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
||||
{
|
||||
FTextureInfo* tmp = gr_cachehead;
|
||||
INT32 res = 0;
|
||||
FTextureInfo *tmp = gr_cachehead;
|
||||
INT32 res = 0;
|
||||
|
||||
while (tmp)
|
||||
{
|
||||
res += tmp->height*tmp->width*(screen_depth/8);
|
||||
// Figure out the correct bytes-per-pixel for this texture
|
||||
// I don't know which one the game actually _uses_ but this
|
||||
// follows format2bpp in hw_cache.c
|
||||
int bpp = 1;
|
||||
int format = tmp->grInfo.format;
|
||||
if (format == GR_RGBA)
|
||||
bpp = 4;
|
||||
else if (format == GR_TEXFMT_RGB_565
|
||||
|| format == GR_TEXFMT_ARGB_1555
|
||||
|| format == GR_TEXFMT_ARGB_4444
|
||||
|| format == GR_TEXFMT_ALPHA_INTENSITY_88
|
||||
|| format == GR_TEXFMT_AP_88)
|
||||
bpp = 2;
|
||||
|
||||
// Add it up!
|
||||
res += tmp->height*tmp->width*bpp;
|
||||
tmp = tmp->nextmipmap;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
142
src/hu_stuff.c
142
src/hu_stuff.c
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "m_menu.h" // gametype_cons_t
|
||||
#include "m_cond.h" // emblems
|
||||
#include "m_misc.h" // word jumping
|
||||
|
||||
#include "d_clisrv.h"
|
||||
|
||||
|
@ -501,37 +502,31 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
|||
// what we're gonna do now is check if the player exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
const char *newmsg;
|
||||
char *playernum = (char*) malloc(3);
|
||||
char playernum[3];
|
||||
INT32 spc = 1; // used if playernum[1] is a space.
|
||||
|
||||
strncpy(playernum, msg+3, 3);
|
||||
// check for undesirable characters in our "number"
|
||||
if (((playernum[0] < '0') || (playernum[0] > '9')) || ((playernum[1] < '0') || (playernum[1] > '9')))
|
||||
if (((playernum[0] < '0') || (playernum[0] > '9')) || ((playernum[1] < '0') || (playernum[1] > '9')))
|
||||
{
|
||||
// check if playernum[1] is a space
|
||||
if (playernum[1] == ' ')
|
||||
spc = 0;
|
||||
// let it slide
|
||||
// let it slide
|
||||
else
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<playernum> \'.", false);
|
||||
free(playernum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// I'm very bad at C, I swear I am, additional checks eww!
|
||||
if (spc != 0)
|
||||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<playernum> \'.", false);
|
||||
free(playernum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (spc != 0 && msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<playernum> \'.", false);
|
||||
return;
|
||||
}
|
||||
|
||||
target = atoi((const char*) playernum); // turn that into a number
|
||||
free(playernum);
|
||||
target = atoi(playernum); // turn that into a number
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
|
@ -1021,9 +1016,6 @@ void HU_Ticker(void)
|
|||
#ifndef NONET
|
||||
|
||||
static boolean teamtalk = false;
|
||||
/*static char chatchars[QUEUESIZE];
|
||||
static INT32 head = 0, tail = 0;*/
|
||||
// WHY DO YOU OVERCOMPLICATE EVERYTHING?????????
|
||||
|
||||
// Clear spaces so we don't end up with messages only made out of emptiness
|
||||
static boolean HU_clearChatSpaces(void)
|
||||
|
@ -1082,11 +1074,11 @@ static void HU_queueChatChar(char c)
|
|||
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
INT32 spc = 1; // used if playernum[1] is a space.
|
||||
char playernum[3];
|
||||
const char *newmsg;
|
||||
|
||||
// what we're gonna do now is check if the node exists
|
||||
// what we're gonna do now is check if the player exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
|
||||
// teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko.
|
||||
|
@ -1096,18 +1088,17 @@ static void HU_queueChatChar(char c)
|
|||
return;
|
||||
}
|
||||
|
||||
strncpy(nodenum, msg+3, 3);
|
||||
strncpy(playernum, msg+3, 3);
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
if (((playernum[0] < '0') || (playernum[0] > '9')) || ((playernum[1] < '0') || (playernum[1] > '9')))
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
// check if playernum[1] is a space
|
||||
if (playernum[1] == ' ')
|
||||
spc = 0;
|
||||
// let it slide
|
||||
else
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<player num> \'.", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1116,14 +1107,12 @@ static void HU_queueChatChar(char c)
|
|||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<player num> \'.", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
target = atoi(playernum); // turn that into a number
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
|
@ -1135,7 +1124,7 @@ static void HU_queueChatChar(char c)
|
|||
return;
|
||||
}
|
||||
|
||||
// we need to get rid of the /pm<node>
|
||||
// we need to get rid of the /pm<player num>
|
||||
newmsg = msg+5+spc;
|
||||
strlcpy(msg, newmsg, 255);
|
||||
}
|
||||
|
@ -1161,6 +1150,8 @@ void HU_clearChatChars(void)
|
|||
w_chat[i] = 0; // reset this.
|
||||
chat_on = false;
|
||||
c_input = 0;
|
||||
|
||||
I_UpdateMouseGrab();
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
|
@ -1311,6 +1302,7 @@ boolean HU_Responder(event_t *ev)
|
|||
chat_on = false;
|
||||
c_input = 0; // reset input cursor
|
||||
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
|
||||
I_UpdateMouseGrab();
|
||||
}
|
||||
else if (c == KEY_ESCAPE
|
||||
|| ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1]
|
||||
|
@ -1319,6 +1311,7 @@ boolean HU_Responder(event_t *ev)
|
|||
{
|
||||
chat_on = false;
|
||||
c_input = 0; // reset input cursor
|
||||
I_UpdateMouseGrab();
|
||||
}
|
||||
else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0 && !OLDCHAT) // CHAT SCROLLING YAYS!
|
||||
{
|
||||
|
@ -1333,9 +1326,19 @@ boolean HU_Responder(event_t *ev)
|
|||
chat_scrolltime = 4;
|
||||
}
|
||||
else if (c == KEY_LEFTARROW && c_input != 0 && !OLDCHAT) // i said go back
|
||||
c_input--;
|
||||
{
|
||||
if (ctrldown)
|
||||
c_input = M_JumpWordReverse(w_chat, c_input);
|
||||
else
|
||||
c_input--;
|
||||
}
|
||||
else if (c == KEY_RIGHTARROW && c_input < strlen(w_chat) && !OLDCHAT) // don't need to check for admin or w/e here since the chat won't ever contain anything if it's muted.
|
||||
c_input++;
|
||||
{
|
||||
if (ctrldown)
|
||||
c_input += M_JumpWord(&w_chat[c_input]);
|
||||
else
|
||||
c_input++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -1644,12 +1647,9 @@ static void HU_drawChatLog(INT32 offset)
|
|||
}
|
||||
chat_scrollmedown = false;
|
||||
|
||||
// getmaxscroll through a lazy hack. We do all these loops, so let's not do more loops that are gonna lag the game more. :P
|
||||
chat_maxscroll = (dy/charheight); // welcome to C, we don't know what min() and max() are.
|
||||
if (chat_maxscroll <= (UINT32)cv_chatheight.value)
|
||||
chat_maxscroll = 0;
|
||||
else
|
||||
chat_maxscroll -= cv_chatheight.value;
|
||||
// getmaxscroll through a lazy hack. We do all these loops,
|
||||
// so let's not do more loops that are gonna lag the game more. :P
|
||||
chat_maxscroll = max(dy / charheight - cv_chatheight.value, 0);
|
||||
|
||||
// if we're not bound by the time, autoscroll for next frame:
|
||||
if (atbottom)
|
||||
|
@ -1790,21 +1790,17 @@ static void HU_DrawChat(void)
|
|||
i = 0;
|
||||
for(i=0; (i<MAXPLAYERS); i++)
|
||||
{
|
||||
|
||||
// filter: (code needs optimization pls help I'm bad with C)
|
||||
if (w_chat[3])
|
||||
{
|
||||
char *nodenum;
|
||||
char playernum[3];
|
||||
UINT32 n;
|
||||
// right, that's half important: (w_chat[4] may be a space since /pm0 msg is perfectly acceptable!)
|
||||
if ( ( ((w_chat[3] != 0) && ((w_chat[3] < '0') || (w_chat[3] > '9'))) || ((w_chat[4] != 0) && (((w_chat[4] < '0') || (w_chat[4] > '9'))))) && (w_chat[4] != ' '))
|
||||
break;
|
||||
|
||||
|
||||
nodenum = (char*) malloc(3);
|
||||
strncpy(nodenum, w_chat+3, 3);
|
||||
n = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
strncpy(playernum, w_chat+3, 3);
|
||||
n = atoi(playernum); // turn that into a number
|
||||
// special cases:
|
||||
|
||||
if ((n == 0) && !(w_chat[4] == '0'))
|
||||
|
@ -1851,7 +1847,6 @@ static void HU_DrawChat(void)
|
|||
}
|
||||
|
||||
HU_drawChatLog(typelines-1); // typelines is the # of lines we're typing. If there's more than 1 then the log should scroll up to give us more space.
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2054,7 +2049,7 @@ static void HU_drawGametype(void)
|
|||
{
|
||||
const char *strvalue = NULL;
|
||||
|
||||
if (gametype < 0 || gametype >= NUMGAMETYPES)
|
||||
if (gametype < 0 || gametype >= gametypecount)
|
||||
return; // not a valid gametype???
|
||||
|
||||
strvalue = Gametype_Names[gametype];
|
||||
|
@ -2105,6 +2100,9 @@ static void HU_DrawDemoInfo(void)
|
|||
//
|
||||
void HU_Drawer(void)
|
||||
{
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
#ifndef NONET
|
||||
// draw chat string plus cursor
|
||||
if (chat_on)
|
||||
|
@ -2182,10 +2180,14 @@ void HU_Drawer(void)
|
|||
return;
|
||||
|
||||
// draw the crosshair, not when viewing demos nor with chasecam
|
||||
if (!automapactive && cv_crosshair.value && !demoplayback && !camera.chase && !players[displayplayer].spectator)
|
||||
if (!automapactive && cv_crosshair.value && !demoplayback &&
|
||||
(!camera.chase || ticcmd_ztargetfocus[0])
|
||||
&& !players[displayplayer].spectator)
|
||||
HU_DrawCrosshair();
|
||||
|
||||
if (!automapactive && cv_crosshair2.value && !demoplayback && !camera2.chase && !players[secondarydisplayplayer].spectator)
|
||||
if (!automapactive && cv_crosshair2.value && !demoplayback &&
|
||||
(!camera2.chase || ticcmd_ztargetfocus[1])
|
||||
&& !players[secondarydisplayplayer].spectator)
|
||||
HU_DrawCrosshair2();
|
||||
|
||||
// draw desynch text
|
||||
|
@ -2359,7 +2361,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
|||
|
||||
for (i = 0; i < scorelines; i++)
|
||||
{
|
||||
if (players[tab[i].num].spectator && gametype != GT_COOP)
|
||||
if (players[tab[i].num].spectator && gametyperankings[gametype] != GT_COOP)
|
||||
continue; //ignore them.
|
||||
|
||||
greycheck = greycheckdef;
|
||||
|
@ -2422,7 +2424,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
|||
}
|
||||
}
|
||||
|
||||
if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||
if (G_GametypeUsesLives() && !(G_GametypeUsesCoopLives() && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|(greycheck ? V_60TRANS : 0), va("%dx", players[tab[i].num].lives));
|
||||
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
|
||||
{
|
||||
|
@ -2435,7 +2437,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
|||
if (players[tab[i].num].exiting || (players[tab[i].num].pflags & PF_FINISHED))
|
||||
V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon);
|
||||
|
||||
if (gametype == GT_RACE)
|
||||
if (gametyperankings[gametype] == GT_RACE)
|
||||
{
|
||||
if (circuitmap)
|
||||
{
|
||||
|
@ -2529,7 +2531,7 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer)
|
|||
| (greycheck ? 0 : V_TRANSLUCENT)
|
||||
| V_ALLOWLOWERCASE, name);
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
{
|
||||
if (players[tab[i].num].gotflag & GF_REDFLAG) // Red
|
||||
V_DrawFixedPatch((x-10)*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, 0, rflagico, 0);
|
||||
|
@ -2657,7 +2659,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
|
|||
| (greycheck ? V_TRANSLUCENT : 0)
|
||||
| V_ALLOWLOWERCASE, name);
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
{
|
||||
if (players[tab[i].num].gotflag & GF_REDFLAG) // Red
|
||||
V_DrawSmallScaledPatch(x-28, y-4, 0, rflagico);
|
||||
|
@ -2714,7 +2716,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
|||
|
||||
for (i = 0; i < scorelines; i++)
|
||||
{
|
||||
if (players[tab[i].num].spectator && gametype != GT_COOP)
|
||||
if (players[tab[i].num].spectator && gametyperankings[gametype] != GT_COOP)
|
||||
continue; //ignore them.
|
||||
|
||||
greycheck = greycheckdef;
|
||||
|
@ -2731,7 +2733,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
|||
| (greycheck ? V_TRANSLUCENT : 0)
|
||||
| V_ALLOWLOWERCASE, name);
|
||||
|
||||
if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||
if (G_GametypeUsesLives() && !(G_GametypeUsesCoopLives() && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE, va("%dx", players[tab[i].num].lives));
|
||||
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
|
||||
V_DrawSmallScaledPatch(x-28, y-4, 0, tagico);
|
||||
|
@ -2780,7 +2782,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
|||
}
|
||||
|
||||
// All data drawn with thin string for space.
|
||||
if (gametype == GT_RACE)
|
||||
if (gametyperankings[gametype] == GT_RACE)
|
||||
{
|
||||
if (circuitmap)
|
||||
{
|
||||
|
@ -2820,7 +2822,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor
|
|||
|
||||
for (i = 0; i < scorelines; i++)
|
||||
{
|
||||
if (players[tab[i].num].spectator && gametype != GT_COOP)
|
||||
if (players[tab[i].num].spectator && gametyperankings[gametype] != GT_COOP)
|
||||
continue; //ignore them.
|
||||
|
||||
greycheck = greycheckdef;
|
||||
|
@ -2890,7 +2892,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor
|
|||
}
|
||||
|
||||
// All data drawn with thin string for space.
|
||||
if (gametype == GT_RACE)
|
||||
if (gametyperankings[gametype] == GT_RACE)
|
||||
{
|
||||
if (circuitmap)
|
||||
{
|
||||
|
@ -3014,21 +3016,21 @@ static void HU_DrawRankings(void)
|
|||
// draw the current gametype in the lower right
|
||||
HU_drawGametype();
|
||||
|
||||
if (gametype != GT_RACE && gametype != GT_COMPETITION && gametype != GT_COOP)
|
||||
if (gametyperules & (GTR_TIMELIMIT|GTR_POINTLIMIT))
|
||||
{
|
||||
if (cv_timelimit.value && timelimitintics > 0)
|
||||
if ((gametyperules & GTR_TIMELIMIT) && cv_timelimit.value && timelimitintics > 0)
|
||||
{
|
||||
V_DrawCenteredString(64, 8, 0, "TIME");
|
||||
V_DrawCenteredString(64, 16, 0, va("%i:%02i", G_TicsToMinutes(stplyr->realtime, true), G_TicsToSeconds(stplyr->realtime)));
|
||||
}
|
||||
|
||||
if (cv_pointlimit.value > 0)
|
||||
if ((gametyperules & GTR_POINTLIMIT) && cv_pointlimit.value > 0)
|
||||
{
|
||||
V_DrawCenteredString(256, 8, 0, "POINT LIMIT");
|
||||
V_DrawCenteredString(256, 16, 0, va("%d", cv_pointlimit.value));
|
||||
}
|
||||
}
|
||||
else if (gametype == GT_COOP)
|
||||
else if (gametyperankings[gametype] == GT_COOP)
|
||||
{
|
||||
INT32 totalscore = 0;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
|
@ -3062,7 +3064,7 @@ static void HU_DrawRankings(void)
|
|||
tab[i].num = -1;
|
||||
tab[i].name = 0;
|
||||
|
||||
if (gametype == GT_RACE && !circuitmap)
|
||||
if (gametyperankings[gametype] == GT_RACE && !circuitmap)
|
||||
tab[i].count = INT32_MAX;
|
||||
}
|
||||
|
||||
|
@ -3071,7 +3073,7 @@ static void HU_DrawRankings(void)
|
|||
if (!playeringame[j])
|
||||
continue;
|
||||
|
||||
if (gametype != GT_COOP && players[j].spectator)
|
||||
if (!G_PlatformGametype() && players[j].spectator)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
|
@ -3079,10 +3081,10 @@ static void HU_DrawRankings(void)
|
|||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
if (gametype != GT_COOP && players[i].spectator)
|
||||
if (!G_PlatformGametype() && players[i].spectator)
|
||||
continue;
|
||||
|
||||
if (gametype == GT_RACE)
|
||||
if (gametyperankings[gametype] == GT_RACE)
|
||||
{
|
||||
if (circuitmap)
|
||||
{
|
||||
|
@ -3105,7 +3107,7 @@ static void HU_DrawRankings(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (gametype == GT_COMPETITION)
|
||||
else if (gametyperankings[gametype] == GT_COMPETITION)
|
||||
{
|
||||
// todo put something more fitting for the gametype here, such as current
|
||||
// number of categories led
|
||||
|
|
|
@ -184,10 +184,6 @@ void I_StartupMouse(void);
|
|||
*/
|
||||
void I_StartupMouse2(void);
|
||||
|
||||
/** \brief keyboard startup, shutdown, handler
|
||||
*/
|
||||
void I_StartupKeyboard(void);
|
||||
|
||||
/** \brief setup timer irq and user timer routine.
|
||||
*/
|
||||
void I_StartupTimer(void);
|
||||
|
@ -292,6 +288,10 @@ void I_GetJoystick2Events(void);
|
|||
*/
|
||||
void I_GetMouseEvents(void);
|
||||
|
||||
/** \brief Checks if the mouse needs to be grabbed
|
||||
*/
|
||||
void I_UpdateMouseGrab(void);
|
||||
|
||||
char *I_GetEnv(const char *name);
|
||||
|
||||
INT32 I_PutEnv(char *variable);
|
||||
|
|
35
src/i_tcp.c
35
src/i_tcp.c
|
@ -209,7 +209,8 @@ static size_t numbans = 0;
|
|||
static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
|
||||
static boolean init_tcp_driver = false;
|
||||
|
||||
static char port_name[8] = DEFAULTPORT;
|
||||
static const char *serverport_name = DEFAULTPORT;
|
||||
static const char *clientport_name;/* any port */
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
|
@ -887,6 +888,7 @@ static boolean UDP_Socket(void)
|
|||
#ifdef HAVE_IPV6
|
||||
const INT32 b_ipv6 = M_CheckParm("-ipv6");
|
||||
#endif
|
||||
const char *serv;
|
||||
|
||||
|
||||
for (s = 0; s < mysocketses; s++)
|
||||
|
@ -902,11 +904,16 @@ static boolean UDP_Socket(void)
|
|||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_protocol = IPPROTO_UDP;
|
||||
|
||||
if (serverrunning)
|
||||
serv = serverport_name;
|
||||
else
|
||||
serv = clientport_name;
|
||||
|
||||
if (M_CheckParm("-bindaddr"))
|
||||
{
|
||||
while (M_IsNextParm())
|
||||
{
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -927,7 +934,7 @@ static boolean UDP_Socket(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
gaie = I_getaddrinfo("0.0.0.0", port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -942,8 +949,8 @@ static boolean UDP_Socket(void)
|
|||
#ifdef HAVE_MINIUPNPC
|
||||
if (UPNP_support)
|
||||
{
|
||||
I_UPnP_rem(port_name, "UDP");
|
||||
I_UPnP_add(NULL, port_name, "UDP");
|
||||
I_UPnP_rem(serverport_name, "UDP");
|
||||
I_UPnP_add(NULL, serverport_name, "UDP");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -960,7 +967,7 @@ static boolean UDP_Socket(void)
|
|||
{
|
||||
while (M_IsNextParm())
|
||||
{
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -981,7 +988,7 @@ static boolean UDP_Socket(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
gaie = I_getaddrinfo("::", port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo("::", serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -1421,15 +1428,19 @@ boolean I_InitTcpNetwork(void)
|
|||
if (!I_InitTcpDriver())
|
||||
return false;
|
||||
|
||||
if (M_CheckParm("-port"))
|
||||
if (M_CheckParm("-port") || M_CheckParm("-serverport"))
|
||||
// Combined -udpport and -clientport into -port
|
||||
// As it was really redundant having two seperate parms that does the same thing
|
||||
/* Sorry Steel, I'm adding these back. But -udpport is a stupid name. */
|
||||
{
|
||||
if (M_IsNextParm())
|
||||
strcpy(port_name, M_GetNextParm());
|
||||
else
|
||||
strcpy(port_name, "0");
|
||||
/*
|
||||
If it's NULL, that's okay! Because then
|
||||
we'll get a random port from getaddrinfo.
|
||||
*/
|
||||
serverport_name = M_GetNextParm();
|
||||
}
|
||||
if (M_CheckParm("-clientport"))
|
||||
clientport_name = M_GetNextParm();
|
||||
|
||||
// parse network game options,
|
||||
if (M_CheckParm("-server") || dedicated)
|
||||
|
|
|
@ -44,6 +44,7 @@ extern boolean highcolor;
|
|||
/** \brief setup video mode
|
||||
*/
|
||||
void I_StartupGraphics(void);
|
||||
void I_StartupHardwareGraphics(void);
|
||||
|
||||
/** \brief restore old video mode
|
||||
*/
|
||||
|
@ -84,6 +85,7 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h);
|
|||
\return currect video mode
|
||||
*/
|
||||
INT32 VID_SetMode(INT32 modenum);
|
||||
void VID_CheckRenderer(void);
|
||||
|
||||
/** \brief The VID_GetModeName function
|
||||
|
||||
|
|
74
src/info.c
74
src/info.c
|
@ -1849,18 +1849,19 @@ state_t states[NUMSTATES] =
|
|||
{SPR_BBLS, 3, 8, {A_BubbleCheck}, 0, 0, S_BUBBLES1}, // S_BUBBLES4
|
||||
|
||||
// Level End Sign
|
||||
{SPR_SIGN, 0, -1, {A_SignPlayer}, -3, 0, S_NULL}, // S_SIGN
|
||||
{SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSPIN2}, // S_SIGNSPIN1
|
||||
{SPR_SIGN, 0, 0, {A_Repeat}, 4, S_SIGNSPIN1, S_SIGNSPIN3}, // S_SIGNSPIN2
|
||||
{SPR_SIGN, 0, 0, {A_SignPlayer}, -2, 0, S_SIGNSPIN4}, // S_SIGNSPIN3
|
||||
{SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSPIN5}, // S_SIGNSPIN4
|
||||
{SPR_SIGN, 0, 0, {A_Repeat}, 4, S_SIGNSPIN4, S_SIGNSPIN6}, // S_SIGNSPIN5
|
||||
{SPR_SIGN, 0, 0, {A_SignPlayer}, -3, 0, S_SIGNSPIN1}, // S_SIGNSPIN6
|
||||
{SPR_SIGN, 0, 1, {A_SignPlayer}, -1, 0, S_SIGNSLOW}, // S_SIGNPLAYER
|
||||
{SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSLOW}, // S_SIGNSLOW
|
||||
{SPR_SIGN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SIGNSTOP
|
||||
{SPR_SIGN, FF_PAPERSPRITE|2, -1, {NULL}, 0, 0, S_NULL}, // S_SIGNBOARD
|
||||
{SPR_SIGN, FF_PAPERSPRITE|1, -1, {NULL}, 0, 29, S_NULL}, // S_EGGMANSIGN
|
||||
{SPR_SIGN, 0, -1, {A_SignPlayer}, -3, 0, S_NULL}, // S_SIGN
|
||||
{SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSPIN2}, // S_SIGNSPIN1
|
||||
{SPR_SIGN, 0, 0, {A_Repeat}, 4, S_SIGNSPIN1, S_SIGNSPIN3}, // S_SIGNSPIN2
|
||||
{SPR_SIGN, 0, 0, {A_SignPlayer}, -2, 0, S_SIGNSPIN4}, // S_SIGNSPIN3
|
||||
{SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSPIN5}, // S_SIGNSPIN4
|
||||
{SPR_SIGN, 0, 0, {A_Repeat}, 4, S_SIGNSPIN4, S_SIGNSPIN6}, // S_SIGNSPIN5
|
||||
{SPR_SIGN, 0, 0, {A_SignPlayer}, -3, 0, S_SIGNSPIN1}, // S_SIGNSPIN6
|
||||
{SPR_SIGN, 0, 1, {A_SignPlayer}, -1, 0, S_SIGNSLOW}, // S_SIGNPLAYER
|
||||
{SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSLOW}, // S_SIGNSLOW
|
||||
{SPR_SIGN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SIGNSTOP
|
||||
{SPR_SIGN, FF_PAPERSPRITE| 2, -1, {NULL}, 0, 0, S_NULL}, // S_SIGNBOARD
|
||||
{SPR_SIGN, FF_PAPERSPRITE| 1, -1, {NULL}, 0, 29, S_NULL}, // S_EGGMANSIGN
|
||||
{SPR_SIGN, FF_PAPERSPRITE|18, -1, {NULL}, 0, 29, S_NULL}, // S_CLEARSIGN
|
||||
|
||||
// Spike Ball
|
||||
{SPR_SPIK, 0, 1, {NULL}, 0, 0, S_SPIKEBALL2}, // S_SPIKEBALL1
|
||||
|
@ -3565,7 +3566,7 @@ state_t states[NUMSTATES] =
|
|||
{SPR_PUMA, FF_FULLBRIGHT|FF_TRANS60|8, 3, {NULL}, 0, 0, S_NULL}, // S_PUMATRAIL4
|
||||
|
||||
// Hammer
|
||||
{SPR_HAMM, FF_ANIMATE, -1, {NULL}, 4, 3, S_NULL}, // S_HAMMER
|
||||
{SPR_HAMM, FF_ANIMATE, -1, {NULL}, 3, 3, S_NULL}, // S_HAMMER
|
||||
|
||||
// Koopa
|
||||
{SPR_KOOP, 0, -1, {NULL}, 0, 0, S_NULL}, // S_KOOPA1
|
||||
|
@ -4492,7 +4493,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY, // flags
|
||||
MF_SCENERY|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
@ -5734,7 +5735,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // mass
|
||||
0, // damage
|
||||
sfx_spring, // activesound
|
||||
MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOCLIPTHING, // flags
|
||||
MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT, // flags
|
||||
S_EGGMOBILE2_POGO5 // raisestate
|
||||
},
|
||||
|
||||
|
@ -6273,7 +6274,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOGRAVITY|MF_NOBLOCKMAP|MF_NOTHINK, // flags
|
||||
MF_NOGRAVITY|MF_NOBLOCKMAP|MF_SCENERY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
@ -7850,7 +7851,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
MT_SPARK, // painchance
|
||||
sfx_s3kb8, // painsound
|
||||
S_EGGMANSIGN, // meleestate
|
||||
S_NULL, // missilestate
|
||||
S_CLEARSIGN, // missilestate
|
||||
S_SIGNSTOP, // deathstate
|
||||
S_NULL, // xdeathstate
|
||||
sfx_s3k64, // deathsound
|
||||
|
@ -11992,7 +11993,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
100, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
@ -12019,7 +12020,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
100, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
@ -19760,14 +19761,14 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
|
||||
{ // MT_FLINGNIGHTSCHIP
|
||||
-1, // doomednum
|
||||
S_NIGHTSCHIP, // spawnstate
|
||||
S_NIGHTSCHIP, // spawnstate
|
||||
1000, // spawnhealth
|
||||
S_NULL, // seestate
|
||||
sfx_None, // seesound
|
||||
MT_FLINGNIGHTSCHIP, // reactiontime
|
||||
MT_FLINGNIGHTSCHIP, // reactiontime
|
||||
sfx_None, // attacksound
|
||||
S_NULL, // painstate
|
||||
MT_NIGHTSCHIP, // painchance
|
||||
MT_NIGHTSCHIP, // painchance
|
||||
sfx_None, // painsound
|
||||
S_NULL, // meleestate
|
||||
S_NULL, // missilestate
|
||||
|
@ -19791,7 +19792,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
1000, // spawnhealth
|
||||
S_NIGHTSSTARXMAS, // seestate
|
||||
sfx_None, // seesound
|
||||
8, // reactiontime
|
||||
MT_FLINGNIGHTSSTAR, // reactiontime
|
||||
sfx_None, // attacksound
|
||||
S_NULL, // painstate
|
||||
0, // painchance
|
||||
|
@ -19812,6 +19813,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
{ // MT_FLINGNIGHTSSTAR
|
||||
-1, // doomednum
|
||||
S_NIGHTSSTAR, // spawnstate
|
||||
1000, // spawnhealth
|
||||
S_NIGHTSSTARXMAS, // seestate
|
||||
sfx_None, // seesound
|
||||
MT_FLINGNIGHTSSTAR, // reactiontime
|
||||
sfx_None, // attacksound
|
||||
S_NULL, // painstate
|
||||
MT_NIGHTSSTAR, // painchance
|
||||
sfx_s3k33, // painsound
|
||||
S_RING, // meleestate
|
||||
S_NULL, // missilestate
|
||||
S_SPRK1, // deathstate
|
||||
S_NULL, // xdeathstate
|
||||
sfx_ncitem, // deathsound
|
||||
38*FRACUNIT, // speed
|
||||
16*FRACUNIT, // radius
|
||||
24*FRACUNIT, // height
|
||||
0, // display offset
|
||||
100, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SLIDEME|MF_SPECIAL, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
{ // MT_NIGHTSSUPERLOOP
|
||||
1707, // doomednum
|
||||
S_NIGHTSSUPERLOOP, // spawnstate
|
||||
|
|
|
@ -155,11 +155,9 @@ void A_SpawnObjectAbsolute();
|
|||
void A_SpawnObjectRelative();
|
||||
void A_ChangeAngleRelative();
|
||||
void A_ChangeAngleAbsolute();
|
||||
#ifdef ROTSPRITE
|
||||
void A_RollAngle();
|
||||
void A_ChangeRollAngleRelative();
|
||||
void A_ChangeRollAngleAbsolute();
|
||||
#endif
|
||||
void A_PlaySound();
|
||||
void A_FindTarget();
|
||||
void A_FindTracer();
|
||||
|
@ -2023,6 +2021,7 @@ typedef enum state
|
|||
S_SIGNSTOP,
|
||||
S_SIGNBOARD,
|
||||
S_EGGMANSIGN,
|
||||
S_CLEARSIGN,
|
||||
|
||||
// Spike Ball
|
||||
S_SPIKEBALL1,
|
||||
|
@ -4704,6 +4703,7 @@ typedef enum mobj_type
|
|||
MT_NIGHTSCHIP, // NiGHTS Chip
|
||||
MT_FLINGNIGHTSCHIP, // Lost NiGHTS Chip
|
||||
MT_NIGHTSSTAR, // NiGHTS Star
|
||||
MT_FLINGNIGHTSSTAR, // Lost NiGHTS Star
|
||||
MT_NIGHTSSUPERLOOP,
|
||||
MT_NIGHTSDRILLREFILL,
|
||||
MT_NIGHTSHELPER,
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h" // So we can have P_SetupLevelSky
|
||||
#ifdef ESLOPE
|
||||
|
@ -23,6 +24,8 @@
|
|||
#include "m_random.h"
|
||||
#include "s_sound.h"
|
||||
#include "g_game.h"
|
||||
#include "m_menu.h"
|
||||
#include "y_inter.h"
|
||||
#include "hu_stuff.h" // HU_AddChatText
|
||||
#include "console.h"
|
||||
#include "d_netcmd.h" // IsPlayerAdmin
|
||||
|
@ -144,10 +147,8 @@ static const struct {
|
|||
{META_MOBJINFO, "mobjinfo_t"},
|
||||
{META_SFXINFO, "sfxinfo_t"},
|
||||
{META_SPRITEINFO, "spriteinfo_t"},
|
||||
#ifdef ROTSPRITE
|
||||
{META_PIVOTLIST, "spriteframepivot_t[]"},
|
||||
{META_FRAMEPIVOT, "spriteframepivot_t"},
|
||||
#endif
|
||||
|
||||
{META_MOBJ, "mobj_t"},
|
||||
{META_MAPTHING, "mapthing_t"},
|
||||
|
@ -2192,6 +2193,20 @@ static int lib_rPointInSubsector(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_rIsPointInSubsector(lua_State *L)
|
||||
{
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
subsector_t *sub = R_IsPointInSubsector(x, y);
|
||||
//HUDSAFE
|
||||
INLEVEL
|
||||
if (sub)
|
||||
LUA_PushUserdata(L, sub, META_SUBSECTOR);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// R_THINGS
|
||||
////////////
|
||||
|
||||
|
@ -2632,6 +2647,145 @@ static int lib_sStartMusicCaption(lua_State *L)
|
|||
// G_GAME
|
||||
////////////
|
||||
|
||||
// Copypasted from lib_cvRegisterVar :]
|
||||
static int lib_gAddGametype(lua_State *L)
|
||||
{
|
||||
const char *k;
|
||||
lua_Integer i;
|
||||
|
||||
const char *gtname = NULL;
|
||||
const char *gtconst = NULL;
|
||||
const char *gtdescription = NULL;
|
||||
INT16 newgtidx = 0;
|
||||
UINT32 newgtrules = 0;
|
||||
UINT32 newgttol = 0;
|
||||
INT32 newgtpointlimit = 0;
|
||||
INT32 newgttimelimit = 0;
|
||||
UINT8 newgtleftcolor = 0;
|
||||
UINT8 newgtrightcolor = 0;
|
||||
INT16 newgtrankingstype = -1;
|
||||
int newgtinttype = 0;
|
||||
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
lua_settop(L, 1); // Clear out all other possible arguments, leaving only the first one.
|
||||
|
||||
if (!lua_lumploading)
|
||||
return luaL_error(L, "This function cannot be called from within a hook or coroutine!");
|
||||
|
||||
// Ran out of gametype slots
|
||||
if (gametypecount == NUMGAMETYPEFREESLOTS)
|
||||
return luaL_error(L, "Ran out of free gametype slots!");
|
||||
|
||||
#define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("G_AddGametype") " (%s)", e);
|
||||
#define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1)))
|
||||
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, 1)) {
|
||||
// stack: gametype table, key/index, value
|
||||
// 1 2 3
|
||||
i = 0;
|
||||
k = NULL;
|
||||
if (lua_isnumber(L, 2))
|
||||
i = lua_tointeger(L, 2);
|
||||
else if (lua_isstring(L, 2))
|
||||
k = lua_tostring(L, 2);
|
||||
|
||||
// Sorry, no gametype rules as key names.
|
||||
if (i == 1 || (k && fasticmp(k, "name"))) {
|
||||
if (!lua_isstring(L, 3))
|
||||
TYPEERROR("name", LUA_TSTRING)
|
||||
gtname = Z_StrDup(lua_tostring(L, 3));
|
||||
} else if (i == 2 || (k && fasticmp(k, "identifier"))) {
|
||||
if (!lua_isstring(L, 3))
|
||||
TYPEERROR("identifier", LUA_TSTRING)
|
||||
gtconst = Z_StrDup(lua_tostring(L, 3));
|
||||
} else if (i == 3 || (k && fasticmp(k, "rules"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("rules", LUA_TNUMBER)
|
||||
newgtrules = (UINT32)lua_tointeger(L, 3);
|
||||
} else if (i == 4 || (k && fasticmp(k, "typeoflevel"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("typeoflevel", LUA_TNUMBER)
|
||||
newgttol = (UINT32)lua_tointeger(L, 3);
|
||||
} else if (i == 5 || (k && fasticmp(k, "rankingtype"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("rankingtype", LUA_TNUMBER)
|
||||
newgtrankingstype = (INT16)lua_tointeger(L, 3);
|
||||
} else if (i == 6 || (k && fasticmp(k, "intermissiontype"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("intermissiontype", LUA_TNUMBER)
|
||||
newgtinttype = (int)lua_tointeger(L, 3);
|
||||
} else if (i == 7 || (k && fasticmp(k, "defaultpointlimit"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("defaultpointlimit", LUA_TNUMBER)
|
||||
newgtpointlimit = (INT32)lua_tointeger(L, 3);
|
||||
} else if (i == 8 || (k && fasticmp(k, "defaulttimelimit"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("defaulttimelimit", LUA_TNUMBER)
|
||||
newgttimelimit = (INT32)lua_tointeger(L, 3);
|
||||
} else if (i == 9 || (k && fasticmp(k, "description"))) {
|
||||
if (!lua_isstring(L, 3))
|
||||
TYPEERROR("description", LUA_TSTRING)
|
||||
gtdescription = Z_StrDup(lua_tostring(L, 3));
|
||||
} else if (i == 10 || (k && fasticmp(k, "headerleftcolor"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("headerleftcolor", LUA_TNUMBER)
|
||||
newgtleftcolor = (UINT8)lua_tointeger(L, 3);
|
||||
} else if (i == 11 || (k && fasticmp(k, "headerrightcolor"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("headerrightcolor", LUA_TNUMBER)
|
||||
newgtrightcolor = (UINT8)lua_tointeger(L, 3);
|
||||
// Key name specified
|
||||
} else if ((!i) && (k && fasticmp(k, "headercolor"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("headercolor", LUA_TNUMBER)
|
||||
newgtleftcolor = newgtrightcolor = (UINT8)lua_tointeger(L, 3);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
#undef FIELDERROR
|
||||
#undef TYPEERROR
|
||||
|
||||
// pop gametype table
|
||||
lua_pop(L, 1);
|
||||
|
||||
// Set defaults
|
||||
if (gtname == NULL)
|
||||
gtname = Z_StrDup("Unnamed gametype");
|
||||
if (gtdescription == NULL)
|
||||
gtdescription = Z_StrDup("???");
|
||||
|
||||
// Add the new gametype
|
||||
newgtidx = G_AddGametype(newgtrules);
|
||||
G_AddGametypeTOL(newgtidx, newgttol);
|
||||
G_SetGametypeDescription(newgtidx, NULL, newgtleftcolor, newgtrightcolor);
|
||||
strncpy(gametypedesc[newgtidx].notes, gtdescription, 441);
|
||||
|
||||
// Not covered by G_AddGametype alone.
|
||||
if (newgtrankingstype == -1)
|
||||
newgtrankingstype = newgtidx;
|
||||
gametyperankings[newgtidx] = newgtrankingstype;
|
||||
intermissiontypes[newgtidx] = newgtinttype;
|
||||
pointlimits[newgtidx] = newgtpointlimit;
|
||||
timelimits[newgtidx] = newgttimelimit;
|
||||
|
||||
// Write the new gametype name.
|
||||
Gametype_Names[newgtidx] = gtname;
|
||||
|
||||
// Write the constant name.
|
||||
if (gtconst == NULL)
|
||||
gtconst = gtname;
|
||||
G_AddGametypeConstant(newgtidx, gtconst);
|
||||
|
||||
// Update gametype_cons_t accordingly.
|
||||
G_UpdateGametypeSelections();
|
||||
|
||||
// done
|
||||
CONS_Printf("Added gametype %s\n", Gametype_Names[newgtidx]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_gBuildMapName(lua_State *L)
|
||||
{
|
||||
INT32 map = luaL_optinteger(L, 1, gamemap);
|
||||
|
@ -2664,23 +2818,17 @@ static int lib_gSetCustomExitVars(lua_State *L)
|
|||
// Supported:
|
||||
// G_SetCustomExitVars(); [reset to defaults]
|
||||
// G_SetCustomExitVars(int) [nextmap override only]
|
||||
// G_SetCustomExitVars(bool) [skipstats only]
|
||||
// G_SetCustomExitVars(int, bool) [both of the above]
|
||||
// G_SetCustomExitVars(nil, int) [skipstats only]
|
||||
// G_SetCustomExitVars(int, int) [both of the above]
|
||||
|
||||
nextmapoverride = 0;
|
||||
skipstats = 0;
|
||||
|
||||
if (n >= 1)
|
||||
{
|
||||
if (lua_isnumber(L, 1) || n >= 2)
|
||||
{
|
||||
nextmapoverride = (INT16)luaL_checknumber(L, 1);
|
||||
lua_remove(L, 1); // remove nextmapoverride; skipstats now 1 if available
|
||||
}
|
||||
skipstats = luaL_optinteger(L, 2, 0);
|
||||
nextmapoverride = (INT16)luaL_optinteger(L, 1, 0);
|
||||
skipstats = (INT16)luaL_optinteger(L, 2, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextmapoverride = 0;
|
||||
skipstats = 0;
|
||||
}
|
||||
// ---
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2720,6 +2868,22 @@ static int lib_gGametypeUsesLives(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_gGametypeUsesCoopLives(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
INLEVEL
|
||||
lua_pushboolean(L, G_GametypeUsesCoopLives());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_gGametypeUsesCoopStarposts(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
INLEVEL
|
||||
lua_pushboolean(L, G_GametypeUsesCoopStarposts());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_gGametypeHasTeams(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
|
@ -2760,6 +2924,14 @@ static int lib_gTagGametype(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_gCompetitionGametype(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
INLEVEL
|
||||
lua_pushboolean(L, G_CompetitionGametype());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_gTicsToHours(lua_State *L)
|
||||
{
|
||||
tic_t rtic = luaL_checkinteger(L, 1);
|
||||
|
@ -2969,6 +3141,7 @@ static luaL_Reg lib[] = {
|
|||
{"R_PointToDist",lib_rPointToDist},
|
||||
{"R_PointToDist2",lib_rPointToDist2},
|
||||
{"R_PointInSubsector",lib_rPointInSubsector},
|
||||
{"R_IsPointInSubsector",lib_rIsPointInSubsector},
|
||||
|
||||
// r_things (sprite)
|
||||
{"R_Char2Frame",lib_rChar2Frame},
|
||||
|
@ -2997,6 +3170,7 @@ static luaL_Reg lib[] = {
|
|||
{"S_StartMusicCaption", lib_sStartMusicCaption},
|
||||
|
||||
// g_game
|
||||
{"G_AddGametype", lib_gAddGametype},
|
||||
{"G_BuildMapName",lib_gBuildMapName},
|
||||
{"G_DoReborn",lib_gDoReborn},
|
||||
{"G_SetCustomExitVars",lib_gSetCustomExitVars},
|
||||
|
@ -3004,11 +3178,14 @@ static luaL_Reg lib[] = {
|
|||
{"G_ExitLevel",lib_gExitLevel},
|
||||
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
||||
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
||||
{"G_GametypeUsesCoopLives",lib_gGametypeUsesCoopLives},
|
||||
{"G_GametypeUsesCoopStarposts",lib_gGametypeUsesCoopStarposts},
|
||||
{"G_GametypeHasTeams",lib_gGametypeHasTeams},
|
||||
{"G_GametypeHasSpectators",lib_gGametypeHasSpectators},
|
||||
{"G_RingSlingerGametype",lib_gRingSlingerGametype},
|
||||
{"G_PlatformGametype",lib_gPlatformGametype},
|
||||
{"G_TagGametype",lib_gTagGametype},
|
||||
{"G_CompetitionGametype",lib_gCompetitionGametype},
|
||||
{"G_TicsToHours",lib_gTicsToHours},
|
||||
{"G_TicsToMinutes",lib_gTicsToMinutes},
|
||||
{"G_TicsToSeconds",lib_gTicsToSeconds},
|
||||
|
|
|
@ -112,12 +112,12 @@ void COM_Lua_f(void)
|
|||
|
||||
lua_rawgeti(gL, -1, 2); // push flags from command info table
|
||||
if (lua_isboolean(gL, -1))
|
||||
flags = (lua_toboolean(gL, -1) ? 1 : 0);
|
||||
flags = (lua_toboolean(gL, -1) ? COM_ADMIN : 0);
|
||||
else
|
||||
flags = (UINT8)lua_tointeger(gL, -1);
|
||||
lua_pop(gL, 1); // pop flags
|
||||
|
||||
if (flags & 2) // flag 2: splitscreen player command.
|
||||
if (flags & COM_SPLITSCREEN) // flag 2: splitscreen player command.
|
||||
{
|
||||
if (!splitscreen)
|
||||
{
|
||||
|
@ -127,12 +127,12 @@ void COM_Lua_f(void)
|
|||
playernum = secondarydisplayplayer;
|
||||
}
|
||||
|
||||
if (netgame)
|
||||
if (netgame && !( flags & COM_LOCAL ))/* don't send local commands */
|
||||
{ // Send the command through the network
|
||||
UINT8 argc;
|
||||
lua_pop(gL, 1); // pop command info table
|
||||
|
||||
if (flags & 1 && !server && !IsPlayerAdmin(playernum)) // flag 1: only server/admin can use this command.
|
||||
if (flags & COM_ADMIN && !server && !IsPlayerAdmin(playernum)) // flag 1: only server/admin can use this command.
|
||||
{
|
||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||
return;
|
||||
|
@ -152,7 +152,7 @@ void COM_Lua_f(void)
|
|||
WRITEUINT8(p, argc);
|
||||
for (i = 0; i < argc; i++)
|
||||
WRITESTRINGN(p, COM_Argv(i), 255);
|
||||
if (flags & 2)
|
||||
if (flags & COM_SPLITSCREEN)
|
||||
SendNetXCmd2(XD_LUACMD, buf, p-buf);
|
||||
else
|
||||
SendNetXCmd(XD_LUACMD, buf, p-buf);
|
||||
|
@ -186,7 +186,15 @@ static int lib_comAddCommand(lua_State *L)
|
|||
if (lua_gettop(L) >= 3)
|
||||
{ // For the third argument, only take a boolean or a number.
|
||||
lua_settop(L, 3);
|
||||
if (lua_type(L, 3) != LUA_TBOOLEAN)
|
||||
if (lua_type(L, 3) == LUA_TBOOLEAN)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,
|
||||
"Using a boolean for admin commands is "
|
||||
"deprecated and will be removed.\n"
|
||||
"Use \"COM_ADMIN\" instead.\n"
|
||||
);
|
||||
}
|
||||
else
|
||||
luaL_checktype(L, 3, LUA_TNUMBER);
|
||||
}
|
||||
else
|
||||
|
@ -239,7 +247,7 @@ static int lib_comBufAddText(lua_State *L)
|
|||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (plr != &players[consoleplayer])
|
||||
return 0;
|
||||
COM_BufAddText(va("%s\n", luaL_checkstring(L, 2)));
|
||||
COM_BufAddTextEx(va("%s\n", luaL_checkstring(L, 2)), COM_SAFE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -256,7 +264,7 @@ static int lib_comBufInsertText(lua_State *L)
|
|||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (plr != &players[consoleplayer])
|
||||
return 0;
|
||||
COM_BufInsertText(va("%s\n", luaL_checkstring(L, 2)));
|
||||
COM_BufInsertTextEx(va("%s\n", luaL_checkstring(L, 2)), COM_SAFE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -421,6 +429,26 @@ static int lib_cvRegisterVar(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_cvFindVar(lua_State *L)
|
||||
{
|
||||
consvar_t *cv;
|
||||
if (( cv = CV_FindVar(luaL_checkstring(L,1)) ))
|
||||
{
|
||||
lua_settop(L,1);/* We only want one argument in the stack. */
|
||||
lua_pushlightuserdata(L, cv);/* Now the second value on stack. */
|
||||
luaL_getmetatable(L, META_CVAR);
|
||||
/*
|
||||
The metatable is the last value on the stack, so this
|
||||
applies it to the second value, which is the cvar.
|
||||
*/
|
||||
lua_setmetatable(L,2);
|
||||
lua_pushvalue(L,2);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CONS_Printf for a single player
|
||||
// Use 'print' in baselib for a global message.
|
||||
static int lib_consPrintf(lua_State *L)
|
||||
|
@ -460,6 +488,7 @@ static luaL_Reg lib[] = {
|
|||
{"COM_BufAddText", lib_comBufAddText},
|
||||
{"COM_BufInsertText", lib_comBufInsertText},
|
||||
{"CV_RegisterVar", lib_cvRegisterVar},
|
||||
{"CV_FindVar", lib_cvFindVar},
|
||||
{"CONS_Printf", lib_consPrintf},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -20,9 +20,12 @@ enum hook {
|
|||
hook_MapChange,
|
||||
hook_MapLoad,
|
||||
hook_PlayerJoin,
|
||||
hook_PreThinkFrame,
|
||||
hook_ThinkFrame,
|
||||
hook_PostThinkFrame,
|
||||
hook_MobjSpawn,
|
||||
hook_MobjCollide,
|
||||
hook_MobjLineCollide,
|
||||
hook_MobjMoveCollide,
|
||||
hook_TouchSpecial,
|
||||
hook_MobjFuse,
|
||||
|
@ -51,6 +54,10 @@ enum hook {
|
|||
hook_PlayerCanDamage,
|
||||
hook_PlayerQuit,
|
||||
hook_IntermissionThinker,
|
||||
hook_TeamSwitch,
|
||||
hook_ViewpointSwitch,
|
||||
hook_SeenPlayer,
|
||||
hook_PlayerThink,
|
||||
|
||||
hook_MAX // last hook
|
||||
};
|
||||
|
@ -59,12 +66,16 @@ extern const char *const hookNames[];
|
|||
void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load)
|
||||
void LUAh_MapLoad(void); // Hook for map load
|
||||
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
|
||||
void LUAh_PreThinkFrame(void); // Hook for frame (before mobj and player thinkers)
|
||||
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
|
||||
void LUAh_PostThinkFrame(void); // Hook for frame (at end of tick, ie after overlays, precipitation, specials)
|
||||
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
|
||||
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
|
||||
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
|
||||
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
|
||||
UINT8 LUAh_MobjLineCollideHook(mobj_t *thing, line_t *line, enum hook which);
|
||||
#define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type
|
||||
#define LUAh_MobjLineCollide(thing, line) LUAh_MobjLineCollideHook(thing, line, hook_MobjLineCollide) // Hook for PIT_CheckThing by (thing) mobj type
|
||||
#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type
|
||||
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
|
||||
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
|
||||
|
@ -93,5 +104,11 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj); // Hook for P_PlayerAft
|
|||
UINT8 LUAh_PlayerCanDamage(player_t *player, mobj_t *mobj); // Hook for P_PlayerCanDamage
|
||||
void LUAh_PlayerQuit(player_t *plr, kickreason_t reason); // Hook for player quitting
|
||||
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
||||
boolean LUAh_TeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble); // Hook for team switching in... uh....
|
||||
UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced); // Hook for spy mode
|
||||
#ifdef SEENAMES
|
||||
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK
|
||||
#endif
|
||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,9 +31,12 @@ const char *const hookNames[hook_MAX+1] = {
|
|||
"MapChange",
|
||||
"MapLoad",
|
||||
"PlayerJoin",
|
||||
"PreThinkFrame",
|
||||
"ThinkFrame",
|
||||
"PostThinkFrame",
|
||||
"MobjSpawn",
|
||||
"MobjCollide",
|
||||
"MobjLineCollide",
|
||||
"MobjMoveCollide",
|
||||
"TouchSpecial",
|
||||
"MobjFuse",
|
||||
|
@ -62,6 +65,10 @@ const char *const hookNames[hook_MAX+1] = {
|
|||
"PlayerCanDamage",
|
||||
"PlayerQuit",
|
||||
"IntermissionThinker",
|
||||
"TeamSwitch",
|
||||
"ViewpointSwitch",
|
||||
"SeenPlayer",
|
||||
"PlayerThink",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -121,6 +128,7 @@ static int lib_addHook(lua_State *L)
|
|||
// Take a mobjtype enum which this hook is specifically for.
|
||||
case hook_MobjSpawn:
|
||||
case hook_MobjCollide:
|
||||
case hook_MobjLineCollide:
|
||||
case hook_MobjMoveCollide:
|
||||
case hook_TouchSpecial:
|
||||
case hook_MobjFuse:
|
||||
|
@ -180,6 +188,7 @@ static int lib_addHook(lua_State *L)
|
|||
lastp = &mobjthinkerhooks[hook.s.mt];
|
||||
break;
|
||||
case hook_MobjCollide:
|
||||
case hook_MobjLineCollide:
|
||||
case hook_MobjMoveCollide:
|
||||
lastp = &mobjcollidehooks[hook.s.mt];
|
||||
break;
|
||||
|
@ -203,8 +212,12 @@ static int lib_addHook(lua_State *L)
|
|||
case hook_PlayerSpawn:
|
||||
case hook_FollowMobj:
|
||||
case hook_PlayerCanDamage:
|
||||
case hook_TeamSwitch:
|
||||
case hook_ViewpointSwitch:
|
||||
case hook_SeenPlayer:
|
||||
case hook_ShieldSpawn:
|
||||
case hook_ShieldSpecial:
|
||||
case hook_PlayerThink:
|
||||
lastp = &playerhooks;
|
||||
break;
|
||||
case hook_LinedefExecute:
|
||||
|
@ -407,6 +420,29 @@ void LUAh_PlayerJoin(int playernum)
|
|||
lua_settop(gL, 0);
|
||||
}
|
||||
|
||||
// Hook for frame (before mobj and player thinkers)
|
||||
void LUAh_PreThinkFrame(void)
|
||||
{
|
||||
hook_p hookp;
|
||||
if (!gL || !(hooksAvailable[hook_PreThinkFrame/8] & (1<<(hook_PreThinkFrame%8))))
|
||||
return;
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_PreThinkFrame)
|
||||
continue;
|
||||
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
if (lua_pcall(gL, 0, 0, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hook for frame (after mobj and player thinkers)
|
||||
void LUAh_ThinkFrame(void)
|
||||
{
|
||||
|
@ -430,6 +466,30 @@ void LUAh_ThinkFrame(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Hook for frame (at end of tick, ie after overlays, precipitation, specials)
|
||||
void LUAh_PostThinkFrame(void)
|
||||
{
|
||||
hook_p hookp;
|
||||
if (!gL || !(hooksAvailable[hook_PostThinkFrame/8] & (1<<(hook_PostThinkFrame%8))))
|
||||
return;
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_PostThinkFrame)
|
||||
continue;
|
||||
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
if (lua_pcall(gL, 0, 0, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hook for mobj collisions
|
||||
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which)
|
||||
{
|
||||
|
@ -509,6 +569,84 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which)
|
|||
return shouldCollide;
|
||||
}
|
||||
|
||||
UINT8 LUAh_MobjLineCollideHook(mobj_t *thing, line_t *line, enum hook which)
|
||||
{
|
||||
hook_p hookp;
|
||||
UINT8 shouldCollide = 0; // 0 = default, 1 = force yes, 2 = force no.
|
||||
if (!gL || !(hooksAvailable[which/8] & (1<<(which%8))))
|
||||
return 0;
|
||||
|
||||
I_Assert(thing->type < NUMMOBJTYPES);
|
||||
|
||||
lua_settop(gL, 0);
|
||||
|
||||
// Look for all generic mobj collision hooks
|
||||
for (hookp = mobjcollidehooks[MT_NULL]; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != which)
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
{
|
||||
LUA_PushUserdata(gL, thing, META_MOBJ);
|
||||
LUA_PushUserdata(gL, line, META_LINE);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -3);
|
||||
lua_pushvalue(gL, -3);
|
||||
if (lua_pcall(gL, 2, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
continue;
|
||||
}
|
||||
if (!lua_isnil(gL, -1))
|
||||
{ // if nil, leave shouldCollide = 0.
|
||||
if (lua_toboolean(gL, -1))
|
||||
shouldCollide = 1; // Force yes
|
||||
else
|
||||
shouldCollide = 2; // Force no
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
for (hookp = mobjcollidehooks[thing->type]; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != which)
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
{
|
||||
LUA_PushUserdata(gL, thing, META_MOBJ);
|
||||
LUA_PushUserdata(gL, line, META_LINE);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -3);
|
||||
lua_pushvalue(gL, -3);
|
||||
if (lua_pcall(gL, 2, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
continue;
|
||||
}
|
||||
if (!lua_isnil(gL, -1))
|
||||
{ // if nil, leave shouldCollide = 0.
|
||||
if (lua_toboolean(gL, -1))
|
||||
shouldCollide = 1; // Force yes
|
||||
else
|
||||
shouldCollide = 2; // Force no
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
return shouldCollide;
|
||||
}
|
||||
|
||||
// Hook for mobj thinkers
|
||||
boolean LUAh_MobjThinker(mobj_t *mo)
|
||||
{
|
||||
|
@ -657,14 +795,16 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
|
|||
LUA_PushUserdata(gL, inflictor, META_MOBJ);
|
||||
LUA_PushUserdata(gL, source, META_MOBJ);
|
||||
lua_pushinteger(gL, damage);
|
||||
lua_pushinteger(gL, damagetype);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
if (lua_pcall(gL, 4, 1, 0)) {
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
if (lua_pcall(gL, 5, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
|
@ -745,14 +885,16 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
|
|||
LUA_PushUserdata(gL, inflictor, META_MOBJ);
|
||||
LUA_PushUserdata(gL, source, META_MOBJ);
|
||||
lua_pushinteger(gL, damage);
|
||||
lua_pushinteger(gL, damagetype);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
if (lua_pcall(gL, 4, 1, 0)) {
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
if (lua_pcall(gL, 5, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
|
@ -823,13 +965,15 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8
|
|||
LUA_PushUserdata(gL, target, META_MOBJ);
|
||||
LUA_PushUserdata(gL, inflictor, META_MOBJ);
|
||||
LUA_PushUserdata(gL, source, META_MOBJ);
|
||||
lua_pushinteger(gL, damagetype);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
if (lua_pcall(gL, 3, 1, 0)) {
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
if (lua_pcall(gL, 4, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
|
@ -1346,4 +1490,146 @@ void LUAh_IntermissionThinker(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Hook for team switching
|
||||
// It's just an edit of LUAh_ViewpointSwitch.
|
||||
boolean LUAh_TeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble)
|
||||
{
|
||||
hook_p hookp;
|
||||
boolean canSwitchTeam = true;
|
||||
if (!gL || !(hooksAvailable[hook_TeamSwitch/8] & (1<<(hook_TeamSwitch%8))))
|
||||
return true;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
|
||||
for (hookp = playerhooks; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_TeamSwitch)
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
{
|
||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||
lua_pushinteger(gL, newteam);
|
||||
lua_pushboolean(gL, fromspectators);
|
||||
lua_pushboolean(gL, tryingautobalance);
|
||||
lua_pushboolean(gL, tryingscramble);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
if (lua_pcall(gL, 5, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
continue;
|
||||
}
|
||||
if (!lua_isnil(gL, -1) && !lua_toboolean(gL, -1))
|
||||
canSwitchTeam = false; // Can't switch team
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
return canSwitchTeam;
|
||||
}
|
||||
|
||||
// Hook for spy mode
|
||||
UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced)
|
||||
{
|
||||
hook_p hookp;
|
||||
UINT8 canSwitchView = 0; // 0 = default, 1 = force yes, 2 = force no.
|
||||
if (!gL || !(hooksAvailable[hook_ViewpointSwitch/8] & (1<<(hook_ViewpointSwitch%8))))
|
||||
return 0;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
hud_running = true; // local hook
|
||||
|
||||
for (hookp = playerhooks; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_ViewpointSwitch)
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
{
|
||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||
LUA_PushUserdata(gL, newdisplayplayer, META_PLAYER);
|
||||
lua_pushboolean(gL, forced);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
if (lua_pcall(gL, 3, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
continue;
|
||||
}
|
||||
if (!lua_isnil(gL, -1))
|
||||
{ // if nil, leave canSwitchView = 0.
|
||||
if (lua_toboolean(gL, -1))
|
||||
canSwitchView = 1; // Force viewpoint switch
|
||||
else
|
||||
canSwitchView = 2; // Skip viewpoint switch
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
return canSwitchView;
|
||||
}
|
||||
|
||||
// Hook for MT_NAMECHECK
|
||||
#ifdef SEENAMES
|
||||
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend)
|
||||
{
|
||||
hook_p hookp;
|
||||
boolean hasSeenPlayer = true;
|
||||
if (!gL || !(hooksAvailable[hook_SeenPlayer/8] & (1<<(hook_SeenPlayer%8))))
|
||||
return 0;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
hud_running = true; // local hook
|
||||
|
||||
for (hookp = playerhooks; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_SeenPlayer)
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
{
|
||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||
LUA_PushUserdata(gL, seenfriend, META_PLAYER);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -3);
|
||||
lua_pushvalue(gL, -3);
|
||||
if (lua_pcall(gL, 2, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
continue;
|
||||
}
|
||||
if (!lua_isnil(gL, -1) && !lua_toboolean(gL, -1))
|
||||
hasSeenPlayer = false; // Hasn't seen player
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
return hasSeenPlayer;
|
||||
}
|
||||
#endif // SEENAMES
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@ enum hud {
|
|||
// Match / CTF / Tag / Ringslinger
|
||||
hud_weaponrings,
|
||||
hud_powerstones,
|
||||
hud_teamscores,
|
||||
// NiGHTS mode
|
||||
hud_nightslink,
|
||||
hud_nightsdrill,
|
||||
|
@ -33,6 +34,9 @@ enum hud {
|
|||
hud_coopemeralds,
|
||||
hud_tokens,
|
||||
hud_tabemblems,
|
||||
// Intermission
|
||||
hud_intermissiontally,
|
||||
hud_intermissionmessages,
|
||||
hud_MAX
|
||||
};
|
||||
|
||||
|
@ -43,4 +47,5 @@ boolean LUA_HudEnabled(enum hud option);
|
|||
void LUAh_GameHUD(player_t *stplyr);
|
||||
void LUAh_ScoresHUD(void);
|
||||
void LUAh_TitleHUD(void);
|
||||
void LUAh_TitleCardHUD(player_t *stplyr);
|
||||
void LUAh_TitleCardHUD(player_t *stplayr);
|
||||
void LUAh_IntermissionHUD(void);
|
||||
|
|
141
src/lua_hudlib.c
141
src/lua_hudlib.c
|
@ -36,6 +36,11 @@ static UINT8 hud_enabled[(hud_MAX/8)+1];
|
|||
|
||||
static UINT8 hudAvailable; // hud hooks field
|
||||
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
static patchinfo_t *patchinfo, *patchinfohead;
|
||||
static int numluapatches;
|
||||
#endif
|
||||
|
||||
// must match enum hud in lua_hud.h
|
||||
static const char *const hud_disable_options[] = {
|
||||
"stagetitle",
|
||||
|
@ -48,6 +53,7 @@ static const char *const hud_disable_options[] = {
|
|||
|
||||
"weaponrings",
|
||||
"powerstones",
|
||||
"teamscores",
|
||||
|
||||
"nightslink",
|
||||
"nightsdrill",
|
||||
|
@ -60,6 +66,9 @@ static const char *const hud_disable_options[] = {
|
|||
"coopemeralds",
|
||||
"tokens",
|
||||
"tabemblems",
|
||||
|
||||
"intermissiontally",
|
||||
"intermissionmessages",
|
||||
NULL};
|
||||
|
||||
enum hudinfo {
|
||||
|
@ -92,12 +101,14 @@ static const char *const patch_opt[] = {
|
|||
enum hudhook {
|
||||
hudhook_game = 0,
|
||||
hudhook_scores,
|
||||
hudhook_intermission,
|
||||
hudhook_title,
|
||||
hudhook_titlecard
|
||||
};
|
||||
static const char *const hudhook_opt[] = {
|
||||
"game",
|
||||
"scores",
|
||||
"intermission",
|
||||
"title",
|
||||
"titlecard",
|
||||
NULL};
|
||||
|
@ -250,12 +261,17 @@ static int colormap_get(lua_State *L)
|
|||
|
||||
static int patch_get(lua_State *L)
|
||||
{
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
patch_t *patch = *((patch_t **)luaL_checkudata(L, 1, META_PATCH));
|
||||
#else
|
||||
patchinfo_t *patch = *((patchinfo_t **)luaL_checkudata(L, 1, META_PATCH));
|
||||
#endif
|
||||
enum patch field = luaL_checkoption(L, 2, NULL, patch_opt);
|
||||
|
||||
// patches are CURRENTLY always valid, expected to be cached with PU_STATIC
|
||||
// this may change in the future, so patch.valid still exists
|
||||
I_Assert(patch != NULL);
|
||||
if (!patch)
|
||||
return LUA_ErrInvalid(L, "patch_t");
|
||||
|
||||
switch (field)
|
||||
{
|
||||
|
@ -352,8 +368,59 @@ static int libd_patchExists(lua_State *L)
|
|||
|
||||
static int libd_cachePatch(lua_State *L)
|
||||
{
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
int i;
|
||||
lumpnum_t lumpnum;
|
||||
patchinfo_t *luapat;
|
||||
patch_t *realpatch;
|
||||
|
||||
HUDONLY
|
||||
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_STATIC), META_PATCH);
|
||||
|
||||
luapat = patchinfohead;
|
||||
lumpnum = W_CheckNumForName(luaL_checkstring(L, 1));
|
||||
if (lumpnum == LUMPERROR)
|
||||
lumpnum = W_GetNumForName("MISSING");
|
||||
|
||||
for (i = 0; i < numluapatches; i++)
|
||||
{
|
||||
// check if already cached
|
||||
if (luapat->wadnum == WADFILENUM(lumpnum) && luapat->lumpnum == LUMPNUM(lumpnum))
|
||||
{
|
||||
LUA_PushUserdata(L, luapat, META_PATCH);
|
||||
return 1;
|
||||
}
|
||||
luapat = luapat->next;
|
||||
if (!luapat)
|
||||
break;
|
||||
}
|
||||
|
||||
if (numluapatches > 0)
|
||||
{
|
||||
patchinfo->next = Z_Malloc(sizeof(patchinfo_t), PU_STATIC, NULL);
|
||||
patchinfo = patchinfo->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
patchinfo = Z_Malloc(sizeof(patchinfo_t), PU_STATIC, NULL);
|
||||
patchinfohead = patchinfo;
|
||||
}
|
||||
|
||||
realpatch = W_CachePatchNum(lumpnum, PU_PATCH);
|
||||
|
||||
patchinfo->width = realpatch->width;
|
||||
patchinfo->height = realpatch->height;
|
||||
patchinfo->leftoffset = realpatch->leftoffset;
|
||||
patchinfo->topoffset = realpatch->topoffset;
|
||||
|
||||
patchinfo->wadnum = WADFILENUM(lumpnum);
|
||||
patchinfo->lumpnum = LUMPNUM(lumpnum);
|
||||
|
||||
LUA_PushUserdata(L, patchinfo, META_PATCH);
|
||||
numluapatches++;
|
||||
#else
|
||||
HUDONLY
|
||||
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_PATCH), META_PATCH);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -401,15 +468,15 @@ static int libd_getSpritePatch(lua_State *L)
|
|||
|
||||
// convert WAD editor angle numbers (1-8) to internal angle numbers (0-7)
|
||||
// keep 0 the same since we'll make it default to angle 1 (which is internally 0)
|
||||
// in case somebody didn't know that angle 0 really just maps all 8 angles to the same patch
|
||||
// in case somebody didn't know that angle 0 really just maps all 8/16 angles to the same patch
|
||||
if (angle != 0)
|
||||
angle--;
|
||||
|
||||
if (angle >= 8) // out of range?
|
||||
if (angle >= ((sprframe->rotate & SRF_3DGE) ? 16 : 8)) // out of range?
|
||||
return 0;
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
@ -496,15 +563,15 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
|
||||
// convert WAD editor angle numbers (1-8) to internal angle numbers (0-7)
|
||||
// keep 0 the same since we'll make it default to angle 1 (which is internally 0)
|
||||
// in case somebody didn't know that angle 0 really just maps all 8 angles to the same patch
|
||||
// in case somebody didn't know that angle 0 really just maps all 8/16 angles to the same patch
|
||||
if (angle != 0)
|
||||
angle--;
|
||||
|
||||
if (angle >= 8) // out of range?
|
||||
if (angle >= ((sprframe->rotate & SRF_3DGE) ? 16 : 8)) // out of range?
|
||||
return 0;
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
@ -513,12 +580,22 @@ static int libd_draw(lua_State *L)
|
|||
{
|
||||
INT32 x, y, flags;
|
||||
patch_t *patch;
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
patchinfo_t *luapat;
|
||||
#endif
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
HUDONLY
|
||||
x = luaL_checkinteger(L, 1);
|
||||
y = luaL_checkinteger(L, 2);
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
luapat = *((patchinfo_t **)luaL_checkudata(L, 3, META_PATCH));
|
||||
patch = W_CachePatchNum((luapat->wadnum<<16)+luapat->lumpnum, PU_PATCH);
|
||||
#else
|
||||
patch = *((patch_t **)luaL_checkudata(L, 3, META_PATCH));
|
||||
if (!patch)
|
||||
return LUA_ErrInvalid(L, "patch_t");
|
||||
#endif
|
||||
flags = luaL_optinteger(L, 4, 0);
|
||||
if (!lua_isnoneornil(L, 5))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
|
||||
|
@ -534,6 +611,9 @@ static int libd_drawScaled(lua_State *L)
|
|||
fixed_t x, y, scale;
|
||||
INT32 flags;
|
||||
patch_t *patch;
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
patchinfo_t *luapat;
|
||||
#endif
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
HUDONLY
|
||||
|
@ -542,7 +622,14 @@ static int libd_drawScaled(lua_State *L)
|
|||
scale = luaL_checkinteger(L, 3);
|
||||
if (scale < 0)
|
||||
return luaL_error(L, "negative scale");
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
luapat = *((patchinfo_t **)luaL_checkudata(L, 4, META_PATCH));
|
||||
patch = W_CachePatchNum((luapat->wadnum<<16)+luapat->lumpnum, PU_PATCH);
|
||||
#else
|
||||
patch = *((patch_t **)luaL_checkudata(L, 4, META_PATCH));
|
||||
if (!patch)
|
||||
return LUA_ErrInvalid(L, "patch_t");
|
||||
#endif
|
||||
flags = luaL_optinteger(L, 5, 0);
|
||||
if (!lua_isnoneornil(L, 6))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 6, META_COLORMAP));
|
||||
|
@ -1041,6 +1128,10 @@ int LUA_HudLib(lua_State *L)
|
|||
{
|
||||
memset(hud_enabled, 0xff, (hud_MAX/8)+1);
|
||||
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
numluapatches = 0;
|
||||
#endif
|
||||
|
||||
lua_newtable(L); // HUD registry table
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, lib_draw);
|
||||
|
@ -1050,13 +1141,16 @@ int LUA_HudLib(lua_State *L)
|
|||
lua_rawseti(L, -2, 2); // HUD[2] = game rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 3); // HUD[2] = scores rendering functions array
|
||||
lua_rawseti(L, -2, 3); // HUD[3] = scores rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 4); // HUD[3] = title rendering functions array
|
||||
lua_rawseti(L, -2, 4); // HUD[4] = intermission rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 5); // HUD[4] = title card rendering functions array
|
||||
lua_rawseti(L, -2, 5); // HUD[5] = title rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 6); // HUD[6] = title card rendering functions array
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||
|
||||
luaL_newmetatable(L, META_HUDINFO);
|
||||
|
@ -1228,4 +1322,29 @@ void LUAh_TitleCardHUD(player_t *stplayr)
|
|||
hud_running = false;
|
||||
}
|
||||
|
||||
void LUAh_IntermissionHUD(void)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_intermission)))
|
||||
return;
|
||||
|
||||
hud_running = true;
|
||||
lua_pop(gL, -1);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, 4); // HUD[4] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1);
|
||||
}
|
||||
lua_pop(gL, -1);
|
||||
hud_running = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -266,7 +266,6 @@ static int lib_getSpriteInfo(lua_State *L)
|
|||
#define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to spriteinfo[] (%s)", e);
|
||||
#define TYPEERROR(f, t1, t2) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t1), lua_typename(L, t2)))
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
static int PopPivotSubTable(spriteframepivot_t *pivot, lua_State *L, int stk, int idx)
|
||||
{
|
||||
int okcool = 0;
|
||||
|
@ -360,7 +359,6 @@ static int PopPivotTable(spriteinfo_t *info, lua_State *L, int stk)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int lib_setSpriteInfo(lua_State *L)
|
||||
{
|
||||
|
@ -393,14 +391,11 @@ static int lib_setSpriteInfo(lua_State *L)
|
|||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
i = lua_tointeger(L, 2);
|
||||
#ifndef ROTSPRITE
|
||||
i++; // shift index in case of missing rotsprite support
|
||||
#endif
|
||||
}
|
||||
else
|
||||
str = luaL_checkstring(L, 2);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (i == 1 || (str && fastcmp(str, "pivot")))
|
||||
{
|
||||
// pivot[] is a table
|
||||
|
@ -409,7 +404,6 @@ static int lib_setSpriteInfo(lua_State *L)
|
|||
else
|
||||
FIELDERROR("pivot", va("%s expected, got %s", lua_typename(L, LUA_TTABLE), luaL_typename(L, -1)))
|
||||
}
|
||||
#endif
|
||||
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
@ -434,7 +428,6 @@ static int spriteinfo_get(lua_State *L)
|
|||
|
||||
I_Assert(sprinfo != NULL);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// push spriteframepivot_t userdata
|
||||
if (fastcmp(field, "pivot"))
|
||||
{
|
||||
|
@ -448,7 +441,6 @@ static int spriteinfo_get(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return luaL_error(L, LUA_QL("spriteinfo_t") " has no field named " LUA_QS, field);
|
||||
|
||||
return 0;
|
||||
|
@ -473,6 +465,7 @@ static int spriteinfo_set(lua_State *L)
|
|||
#ifdef ROTSPRITE
|
||||
if (sprites != NULL)
|
||||
R_FreeSingleRotSprite(&sprites[sprinfo-spriteinfo]);
|
||||
#endif
|
||||
|
||||
if (fastcmp(field, "pivot"))
|
||||
{
|
||||
|
@ -488,7 +481,6 @@ static int spriteinfo_set(lua_State *L)
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return luaL_error(L, va("Field %s does not exist in spriteinfo_t", field));
|
||||
|
||||
return 0;
|
||||
|
@ -506,7 +498,6 @@ static int spriteinfo_num(lua_State *L)
|
|||
}
|
||||
|
||||
// framepivot_t
|
||||
#ifdef ROTSPRITE
|
||||
static int pivotlist_get(lua_State *L)
|
||||
{
|
||||
void **userdata;
|
||||
|
@ -616,7 +607,6 @@ static int framepivot_num(lua_State *L)
|
|||
lua_pushinteger(L, 2);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////
|
||||
// STATE INFO //
|
||||
|
@ -1538,7 +1528,6 @@ int LUA_InfoLib(lua_State *L)
|
|||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
luaL_newmetatable(L, META_PIVOTLIST);
|
||||
lua_pushcfunction(L, pivotlist_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
@ -1560,7 +1549,6 @@ int LUA_InfoLib(lua_State *L)
|
|||
lua_pushcfunction(L, framepivot_num);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
#endif
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
|
|
|
@ -23,10 +23,8 @@ extern lua_State *gL;
|
|||
#define META_MOBJINFO "MOBJINFO_T*"
|
||||
#define META_SFXINFO "SFXINFO_T*"
|
||||
#define META_SPRITEINFO "SPRITEINFO_T*"
|
||||
#ifdef ROTSPRITE
|
||||
#define META_PIVOTLIST "SPRITEFRAMEPIVOT_T[]"
|
||||
#define META_FRAMEPIVOT "SPRITEFRAMEPIVOT_T*"
|
||||
#endif
|
||||
|
||||
#define META_MOBJ "MOBJ_T*"
|
||||
#define META_MAPTHING "MAPTHING_T*"
|
||||
|
|
|
@ -134,6 +134,7 @@ enum side_e {
|
|||
side_toptexture,
|
||||
side_bottomtexture,
|
||||
side_midtexture,
|
||||
side_line,
|
||||
side_sector,
|
||||
side_special,
|
||||
side_repeatcnt,
|
||||
|
@ -157,14 +158,20 @@ enum vertex_e {
|
|||
vertex_valid = 0,
|
||||
vertex_x,
|
||||
vertex_y,
|
||||
vertex_z
|
||||
vertex_floorz,
|
||||
vertex_floorzset,
|
||||
vertex_ceilingz,
|
||||
vertex_ceilingzset
|
||||
};
|
||||
|
||||
static const char *const vertex_opt[] = {
|
||||
"valid",
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
"floorz",
|
||||
"floorzset",
|
||||
"ceilingz",
|
||||
"ceilingzset",
|
||||
NULL};
|
||||
|
||||
enum ffloor_e {
|
||||
|
@ -445,7 +452,7 @@ static int sectorlines_get(lua_State *L)
|
|||
// get the "linecount" by shifting our retrieved memory address of "lines" to where "linecount" is in the sector_t, then dereferencing the result
|
||||
// we need this to determine the array's actual size, and therefore also the maximum value allowed as an index
|
||||
// this only works if seclines is actually a pointer to a sector's lines member in memory, oh boy
|
||||
numoflines = (size_t)(*(seclines - (offsetof(sector_t, lines) - offsetof(sector_t, linecount))));
|
||||
numoflines = (size_t)(*(size_t *)(((size_t)seclines) - (offsetof(sector_t, lines) - offsetof(sector_t, linecount))));
|
||||
|
||||
/* OLD HACK
|
||||
// check first linedef to figure which of its sectors owns this sector->lines pointer
|
||||
|
@ -479,7 +486,7 @@ static int sectorlines_num(lua_State *L)
|
|||
return luaL_error(L, "accessed sector_t.lines doesn't exist anymore.");
|
||||
|
||||
// see comments in the _get function above
|
||||
numoflines = (size_t)(*(seclines - (offsetof(sector_t, lines) - offsetof(sector_t, linecount))));
|
||||
numoflines = (size_t)(*(size_t *)(((size_t)seclines) - (offsetof(sector_t, lines) - offsetof(sector_t, linecount))));
|
||||
lua_pushinteger(L, numoflines);
|
||||
return 1;
|
||||
}
|
||||
|
@ -869,6 +876,9 @@ static int side_get(lua_State *L)
|
|||
case side_midtexture:
|
||||
lua_pushinteger(L, side->midtexture);
|
||||
return 1;
|
||||
case side_line:
|
||||
LUA_PushUserdata(L, side->line, META_LINE);
|
||||
return 1;
|
||||
case side_sector:
|
||||
LUA_PushUserdata(L, side->sector, META_SECTOR);
|
||||
return 1;
|
||||
|
@ -902,6 +912,7 @@ static int side_set(lua_State *L)
|
|||
switch(field)
|
||||
{
|
||||
case side_valid: // valid
|
||||
case side_line:
|
||||
case side_sector:
|
||||
case side_special:
|
||||
case side_text:
|
||||
|
@ -965,8 +976,17 @@ static int vertex_get(lua_State *L)
|
|||
case vertex_y:
|
||||
lua_pushfixed(L, vertex->y);
|
||||
return 1;
|
||||
case vertex_z:
|
||||
lua_pushfixed(L, vertex->z);
|
||||
case vertex_floorzset:
|
||||
lua_pushboolean(L, vertex->floorzset);
|
||||
return 1;
|
||||
case vertex_ceilingzset:
|
||||
lua_pushboolean(L, vertex->ceilingzset);
|
||||
return 1;
|
||||
case vertex_floorz:
|
||||
lua_pushfixed(L, vertex->floorz);
|
||||
return 1;
|
||||
case vertex_ceilingz:
|
||||
lua_pushfixed(L, vertex->ceilingz);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -2014,6 +2034,8 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->typeoflevel);
|
||||
else if (fastcmp(field,"nextlevel"))
|
||||
lua_pushinteger(L, header->nextlevel);
|
||||
else if (fastcmp(field,"keywords"))
|
||||
lua_pushstring(L, header->keywords);
|
||||
else if (fastcmp(field,"musname"))
|
||||
lua_pushstring(L, header->musname);
|
||||
else if (fastcmp(field,"mustrack"))
|
||||
|
@ -2071,6 +2093,12 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->levelselect);
|
||||
else if (fastcmp(field,"bonustype"))
|
||||
lua_pushinteger(L, header->bonustype);
|
||||
else if (fastcmp(field,"ltzzpatch"))
|
||||
lua_pushstring(L, header->ltzzpatch);
|
||||
else if (fastcmp(field,"ltzztext"))
|
||||
lua_pushstring(L, header->ltzztext);
|
||||
else if (fastcmp(field,"ltactdiamond"))
|
||||
lua_pushstring(L, header->ltactdiamond);
|
||||
else if (fastcmp(field,"maxbonuslives"))
|
||||
lua_pushinteger(L, header->maxbonuslives);
|
||||
else if (fastcmp(field,"levelflags"))
|
||||
|
|
|
@ -32,9 +32,7 @@ enum mobj_e {
|
|||
mobj_snext,
|
||||
mobj_sprev,
|
||||
mobj_angle,
|
||||
#ifdef ROTSPRITE
|
||||
mobj_rollangle,
|
||||
#endif
|
||||
mobj_sprite,
|
||||
mobj_frame,
|
||||
mobj_sprite2,
|
||||
|
@ -90,7 +88,8 @@ enum mobj_e {
|
|||
#ifdef ESLOPE
|
||||
mobj_standingslope,
|
||||
#endif
|
||||
mobj_colorized
|
||||
mobj_colorized,
|
||||
mobj_shadowscale
|
||||
};
|
||||
|
||||
static const char *const mobj_opt[] = {
|
||||
|
@ -101,9 +100,7 @@ static const char *const mobj_opt[] = {
|
|||
"snext",
|
||||
"sprev",
|
||||
"angle",
|
||||
#ifdef ROTSPRITE
|
||||
"rollangle",
|
||||
#endif
|
||||
"sprite",
|
||||
"frame",
|
||||
"sprite2",
|
||||
|
@ -160,6 +157,7 @@ static const char *const mobj_opt[] = {
|
|||
"standingslope",
|
||||
#endif
|
||||
"colorized",
|
||||
"shadowscale",
|
||||
NULL};
|
||||
|
||||
#define UNIMPLEMENTED luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", mobj_opt[field])
|
||||
|
@ -205,11 +203,9 @@ static int mobj_get(lua_State *L)
|
|||
case mobj_angle:
|
||||
lua_pushangle(L, mo->angle);
|
||||
break;
|
||||
#ifdef ROTSPRITE
|
||||
case mobj_rollangle:
|
||||
lua_pushangle(L, mo->rollangle);
|
||||
break;
|
||||
#endif
|
||||
case mobj_sprite:
|
||||
lua_pushinteger(L, mo->sprite);
|
||||
break;
|
||||
|
@ -396,6 +392,9 @@ static int mobj_get(lua_State *L)
|
|||
case mobj_colorized:
|
||||
lua_pushboolean(L, mo->colorized);
|
||||
break;
|
||||
case mobj_shadowscale:
|
||||
lua_pushfixed(L, mo->shadowscale);
|
||||
break;
|
||||
default: // extra custom variables in Lua memory
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
|
@ -462,11 +461,9 @@ static int mobj_set(lua_State *L)
|
|||
else if (mo->player == &players[secondarydisplayplayer])
|
||||
localangle2 = mo->angle;
|
||||
break;
|
||||
#ifdef ROTSPRITE
|
||||
case mobj_rollangle:
|
||||
mo->rollangle = luaL_checkangle(L, 3);
|
||||
break;
|
||||
#endif
|
||||
case mobj_sprite:
|
||||
mo->sprite = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
|
@ -727,6 +724,9 @@ static int mobj_set(lua_State *L)
|
|||
case mobj_colorized:
|
||||
mo->colorized = luaL_checkboolean(L, 3);
|
||||
break;
|
||||
case mobj_shadowscale:
|
||||
mo->shadowscale = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
default:
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
|
|
232
src/lua_script.c
232
src/lua_script.c
|
@ -18,7 +18,9 @@
|
|||
#include "w_wad.h"
|
||||
#include "p_setup.h"
|
||||
#include "r_state.h"
|
||||
#include "r_sky.h"
|
||||
#include "g_game.h"
|
||||
#include "f_finale.h"
|
||||
#include "byteptr.h"
|
||||
#include "p_saveg.h"
|
||||
#include "p_local.h"
|
||||
|
@ -79,8 +81,231 @@ FUNCNORETURN static int LUA_Panic(lua_State *L)
|
|||
#endif
|
||||
}
|
||||
|
||||
// Moved here from lib_getenum.
|
||||
int LUA_PushGlobals(lua_State *L, const char *word)
|
||||
{
|
||||
if (fastcmp(word,"gamemap")) {
|
||||
lua_pushinteger(L, gamemap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"maptol")) {
|
||||
lua_pushinteger(L, maptol);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"ultimatemode")) {
|
||||
lua_pushboolean(L, ultimatemode != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mariomode")) {
|
||||
lua_pushboolean(L, mariomode != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"twodlevel")) {
|
||||
lua_pushboolean(L, twodlevel != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"circuitmap")) {
|
||||
lua_pushboolean(L, circuitmap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"netgame")) {
|
||||
lua_pushboolean(L, netgame);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"multiplayer")) {
|
||||
lua_pushboolean(L, multiplayer);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"modeattacking")) {
|
||||
lua_pushboolean(L, modeattacking);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"splitscreen")) {
|
||||
lua_pushboolean(L, splitscreen);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gamecomplete")) {
|
||||
lua_pushboolean(L, gamecomplete);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"devparm")) {
|
||||
lua_pushboolean(L, devparm);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"modifiedgame")) {
|
||||
lua_pushboolean(L, modifiedgame && !savemoddata);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"menuactive")) {
|
||||
lua_pushboolean(L, menuactive);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"paused")) {
|
||||
lua_pushboolean(L, paused);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"bluescore")) {
|
||||
lua_pushinteger(L, bluescore);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"redscore")) {
|
||||
lua_pushinteger(L, redscore);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"timelimit")) {
|
||||
lua_pushinteger(L, cv_timelimit.value);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"pointlimit")) {
|
||||
lua_pushinteger(L, cv_pointlimit.value);
|
||||
return 1;
|
||||
// begin map vars
|
||||
} else if (fastcmp(word,"spstage_start")) {
|
||||
lua_pushinteger(L, spstage_start);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sstage_start")) {
|
||||
lua_pushinteger(L, sstage_start);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sstage_end")) {
|
||||
lua_pushinteger(L, sstage_end);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"smpstage_start")) {
|
||||
lua_pushinteger(L, smpstage_start);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"smpstage_end")) {
|
||||
lua_pushinteger(L, smpstage_end);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"titlemap")) {
|
||||
lua_pushinteger(L, titlemap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"titlemapinaction")) {
|
||||
lua_pushboolean(L, (titlemapinaction != TITLEMAP_OFF));
|
||||
return 1;
|
||||
} else if (fastcmp(word,"bootmap")) {
|
||||
lua_pushinteger(L, bootmap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"tutorialmap")) {
|
||||
lua_pushinteger(L, tutorialmap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"tutorialmode")) {
|
||||
lua_pushboolean(L, tutorialmode);
|
||||
return 1;
|
||||
// end map vars
|
||||
// begin CTF colors
|
||||
} else if (fastcmp(word,"skincolor_redteam")) {
|
||||
lua_pushinteger(L, skincolor_redteam);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"skincolor_blueteam")) {
|
||||
lua_pushinteger(L, skincolor_blueteam);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"skincolor_redring")) {
|
||||
lua_pushinteger(L, skincolor_redring);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"skincolor_bluering")) {
|
||||
lua_pushinteger(L, skincolor_bluering);
|
||||
return 1;
|
||||
// end CTF colors
|
||||
// begin timers
|
||||
} else if (fastcmp(word,"invulntics")) {
|
||||
lua_pushinteger(L, invulntics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sneakertics")) {
|
||||
lua_pushinteger(L, sneakertics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"flashingtics")) {
|
||||
lua_pushinteger(L, flashingtics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"tailsflytics")) {
|
||||
lua_pushinteger(L, tailsflytics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"underwatertics")) {
|
||||
lua_pushinteger(L, underwatertics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"spacetimetics")) {
|
||||
lua_pushinteger(L, spacetimetics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"extralifetics")) {
|
||||
lua_pushinteger(L, extralifetics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"nightslinktics")) {
|
||||
lua_pushinteger(L, nightslinktics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gameovertics")) {
|
||||
lua_pushinteger(L, gameovertics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"ammoremovaltics")) {
|
||||
lua_pushinteger(L, ammoremovaltics);
|
||||
return 1;
|
||||
// end timers
|
||||
} else if (fastcmp(word,"gametype")) {
|
||||
lua_pushinteger(L, gametype);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gametyperules")) {
|
||||
lua_pushinteger(L, gametyperules);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"leveltime")) {
|
||||
lua_pushinteger(L, leveltime);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sstimer")) {
|
||||
lua_pushinteger(L, sstimer);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"curWeather")) {
|
||||
lua_pushinteger(L, curWeather);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"globalweather")) {
|
||||
lua_pushinteger(L, globalweather);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"levelskynum")) {
|
||||
lua_pushinteger(L, levelskynum);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"globallevelskynum")) {
|
||||
lua_pushinteger(L, globallevelskynum);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusname")) {
|
||||
lua_pushstring(L, mapmusname);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusflags")) {
|
||||
lua_pushinteger(L, mapmusflags);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusposition")) {
|
||||
lua_pushinteger(L, mapmusposition);
|
||||
return 1;
|
||||
// local player variables, by popular request
|
||||
} else if (fastcmp(word,"consoleplayer")) { // player controlling console (aka local player 1)
|
||||
if (consoleplayer < 0 || !playeringame[consoleplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"displayplayer")) { // player visible on screen (aka display player 1)
|
||||
if (displayplayer < 0 || !playeringame[displayplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[displayplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"secondarydisplayplayer")) { // local/display player 2, for splitscreen
|
||||
if (!splitscreen || secondarydisplayplayer < 0 || !playeringame[secondarydisplayplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[secondarydisplayplayer], META_PLAYER);
|
||||
return 1;
|
||||
// end local player variables
|
||||
} else if (fastcmp(word,"server")) {
|
||||
if ((!multiplayer || !netgame) && !playeringame[serverplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"emeralds")) {
|
||||
lua_pushinteger(L, emeralds);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gravity")) {
|
||||
lua_pushinteger(L, gravity);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"VERSIONSTRING")) {
|
||||
lua_pushstring(L, VERSIONSTRING);
|
||||
return 1;
|
||||
} else if (fastcmp(word, "token")) {
|
||||
lua_pushinteger(L, token);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// See the above.
|
||||
int LUA_CheckGlobals(lua_State *L, const char *word)
|
||||
{
|
||||
if (fastcmp(word, "redscore"))
|
||||
redscore = (UINT32)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "bluescore"))
|
||||
bluescore = (UINT32)luaL_checkinteger(L, 2);
|
||||
else
|
||||
return 0;
|
||||
|
||||
// Global variable set, so return and don't error.
|
||||
return 1;
|
||||
}
|
||||
|
||||
// This function decides which global variables you are allowed to set.
|
||||
static int noglobals(lua_State *L)
|
||||
static int setglobals(lua_State *L)
|
||||
{
|
||||
const char *csname;
|
||||
char *name;
|
||||
|
@ -106,6 +331,9 @@ static int noglobals(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (LUA_CheckGlobals(L, csname))
|
||||
return 0;
|
||||
|
||||
Z_Free(name);
|
||||
return luaL_error(L, "Implicit global " LUA_QS " prevented. Create a local variable instead.", csname);
|
||||
}
|
||||
|
@ -144,7 +372,7 @@ static void LUA_ClearState(void)
|
|||
|
||||
// lock the global namespace
|
||||
lua_getmetatable(L, LUA_GLOBALSINDEX);
|
||||
lua_pushcfunction(L, noglobals);
|
||||
lua_pushcfunction(L, setglobals);
|
||||
lua_setfield(L, -2, "__newindex");
|
||||
lua_newtable(L);
|
||||
lua_setfield(L, -2, "__metatable");
|
||||
|
|
|
@ -54,6 +54,8 @@ void LUA_InvalidatePlayer(player_t *player);
|
|||
void LUA_Step(void);
|
||||
void LUA_Archive(void);
|
||||
void LUA_UnArchive(void);
|
||||
int LUA_PushGlobals(lua_State *L, const char *word);
|
||||
int LUA_CheckGlobals(lua_State *L, const char *word);
|
||||
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||
void LUA_CVarChanged(const char *name); // lua_consolelib.c
|
||||
int Lua_optoption(lua_State *L, int narg,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
|
||||
// Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 2013 by "Ninji".
|
||||
// Copyright (C) 2013-2019 by Sonic Team Junior.
|
||||
//
|
||||
|
@ -20,6 +20,10 @@
|
|||
#include "i_video.h"
|
||||
#include "m_misc.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
|
||||
// GIFs are always little-endian
|
||||
#include "byteptr.h"
|
||||
|
||||
|
@ -29,6 +33,7 @@ consvar_t cv_gif_downscale = {"gif_downscale", "On", CV_SAVE, CV_OnOff, NULL, 0
|
|||
#ifdef HAVE_ANIGIF
|
||||
static boolean gif_optimize = false; // So nobody can do something dumb
|
||||
static boolean gif_downscale = false; // like changing cvars mid output
|
||||
static RGBA_t *gif_palette = NULL;
|
||||
|
||||
static FILE *gif_out = NULL;
|
||||
static INT32 gif_frames = 0;
|
||||
|
@ -428,10 +433,7 @@ static void GIF_headwrite(void)
|
|||
|
||||
// write color table
|
||||
{
|
||||
RGBA_t *pal = ((cv_screenshot_colorprofile.value)
|
||||
? pLocalPalette
|
||||
: pMasterPalette);
|
||||
|
||||
RGBA_t *pal = gif_palette;
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
WRITEUINT8(p, pal[i].s.red);
|
||||
|
@ -457,6 +459,32 @@ const UINT8 gifframe_gchead[4] = {0x21,0xF9,0x04,0x04}; // GCE, bytes, packed by
|
|||
static UINT8 *gifframe_data = NULL;
|
||||
static size_t gifframe_size = 8192;
|
||||
|
||||
#ifdef HWRENDER
|
||||
static void hwrconvert(void)
|
||||
{
|
||||
UINT8 *linear = HWR_GetScreenshot();
|
||||
UINT8 *dest = screens[2];
|
||||
UINT8 r, g, b;
|
||||
INT32 x, y;
|
||||
size_t i = 0;
|
||||
|
||||
InitColorLUT(gif_palette);
|
||||
|
||||
for (y = 0; y < vid.height; y++)
|
||||
{
|
||||
for (x = 0; x < vid.width; x++, i += 3)
|
||||
{
|
||||
r = (UINT8)linear[i];
|
||||
g = (UINT8)linear[i + 1];
|
||||
b = (UINT8)linear[i + 2];
|
||||
dest[(y * vid.width) + x] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS];
|
||||
}
|
||||
}
|
||||
|
||||
free(linear);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// GIF_framewrite
|
||||
// writes a frame into the file.
|
||||
|
@ -482,7 +510,12 @@ static void GIF_framewrite(void)
|
|||
GIF_optimizeregion(cur_screen, movie_screen, &blitx, &blity, &blitw, &blith);
|
||||
|
||||
// blit to temp screen
|
||||
I_ReadScreen(movie_screen);
|
||||
if (rendermode == render_soft)
|
||||
I_ReadScreen(movie_screen);
|
||||
#ifdef HWRENDER
|
||||
else if (rendermode == render_opengl)
|
||||
hwrconvert();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -491,7 +524,18 @@ static void GIF_framewrite(void)
|
|||
blith = vid.height;
|
||||
|
||||
if (gif_frames == 0)
|
||||
I_ReadScreen(movie_screen);
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
I_ReadScreen(movie_screen);
|
||||
#ifdef HWRENDER
|
||||
else if (rendermode == render_opengl)
|
||||
{
|
||||
hwrconvert();
|
||||
VID_BlitLinearScreen(screens[2], screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
movie_screen = screens[0];
|
||||
}
|
||||
|
||||
|
@ -580,7 +624,7 @@ static void GIF_framewrite(void)
|
|||
//
|
||||
INT32 GIF_open(const char *filename)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
#if 0
|
||||
if (rendermode != render_soft)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("GIFs cannot be taken in non-software modes!\n"));
|
||||
|
@ -594,6 +638,16 @@ INT32 GIF_open(const char *filename)
|
|||
|
||||
gif_optimize = (!!cv_gif_optimize.value);
|
||||
gif_downscale = (!!cv_gif_downscale.value);
|
||||
|
||||
// GIF color table
|
||||
// In hardware mode, uses the master palette
|
||||
gif_palette = ((cv_screenshot_colorprofile.value
|
||||
#ifdef HWRENDER
|
||||
&& (rendermode == render_soft)
|
||||
#endif
|
||||
) ? pLocalPalette
|
||||
: pMasterPalette);
|
||||
|
||||
GIF_headwrite();
|
||||
gif_frames = 0;
|
||||
return 1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
|
||||
// Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 2013-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
|
|
|
@ -517,6 +517,7 @@ void Command_Teleport_f(void)
|
|||
if (!starpostnum) // spawnpoints...
|
||||
{
|
||||
mapthing_t *mt;
|
||||
fixed_t offset;
|
||||
|
||||
if (starpostpath >= numcoopstarts)
|
||||
{
|
||||
|
@ -527,6 +528,7 @@ void Command_Teleport_f(void)
|
|||
mt = playerstarts[starpostpath]; // Given above check, should never be NULL.
|
||||
intx = mt->x<<FRACBITS;
|
||||
inty = mt->y<<FRACBITS;
|
||||
offset = mt->z<<FRACBITS;
|
||||
|
||||
ss = R_IsPointInSubsector(intx, inty);
|
||||
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
|
||||
|
@ -538,17 +540,9 @@ void Command_Teleport_f(void)
|
|||
// Flagging a player's ambush will make them start on the ceiling
|
||||
// Objectflip inverts
|
||||
if (!!(mt->options & MTF_AMBUSH) ^ !!(mt->options & MTF_OBJECTFLIP))
|
||||
{
|
||||
intz = ss->sector->ceilingheight - p->mo->height;
|
||||
if (mt->options >> ZSHIFT)
|
||||
intz -= ((mt->options >> ZSHIFT) << FRACBITS);
|
||||
}
|
||||
intz = ss->sector->ceilingheight - p->mo->height - offset;
|
||||
else
|
||||
{
|
||||
intz = ss->sector->floorheight;
|
||||
if (mt->options >> ZSHIFT)
|
||||
intz += ((mt->options >> ZSHIFT) << FRACBITS);
|
||||
}
|
||||
intz = ss->sector->floorheight + offset;
|
||||
|
||||
if (mt->options & MTF_OBJECTFLIP) // flip the player!
|
||||
{
|
||||
|
@ -778,7 +772,7 @@ void Command_CauseCfail_f(void)
|
|||
P_SetThingPosition(players[consoleplayer].mo);
|
||||
|
||||
// CTF consistency test
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
{
|
||||
if (blueflag) {
|
||||
P_RemoveMobj(blueflag);
|
||||
|
@ -1106,7 +1100,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||
#else
|
||||
fixed_t cheight = sec->ceilingheight;
|
||||
#endif
|
||||
mt->options = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
|
||||
mt->z = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1115,12 +1109,11 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||
#else
|
||||
fixed_t fheight = sec->floorheight;
|
||||
#endif
|
||||
mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS);
|
||||
mt->z = (UINT16)((player->mo->z - fheight)>>FRACBITS);
|
||||
}
|
||||
mt->options <<= ZSHIFT;
|
||||
mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle)));
|
||||
|
||||
mt->options |= (UINT16)cv_opflags.value;
|
||||
mt->options = (mt->z << ZSHIFT) | (UINT16)cv_opflags.value;
|
||||
return mt;
|
||||
}
|
||||
|
||||
|
@ -1187,21 +1180,21 @@ void OP_NightsObjectplace(player_t *player)
|
|||
mt->options = (mt->options & ~(UINT16)cv_opflags.value) | (UINT16)cv_ophoopflags.value;
|
||||
mt->angle = (INT16)(mt->angle+(INT16)((FixedInt(FixedDiv(temp*FRACUNIT, 360*(FRACUNIT/256))))<<8));
|
||||
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
P_SpawnHoop(mt);
|
||||
}
|
||||
|
||||
// This places a bumper!
|
||||
if (cmd->buttons & BT_TOSSFLAG)
|
||||
{
|
||||
UINT16 vertangle = (UINT16)(player->anotherflyangle % 360);
|
||||
UINT16 newflags, newz;
|
||||
UINT16 newflags;
|
||||
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
if (!OP_HeightOkay(player, false))
|
||||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSBUMPER].doomednum, false);
|
||||
newz = min((mt->options >> ZSHIFT) - (mobjinfo[MT_NIGHTSBUMPER].height/4), 0);
|
||||
mt->z = min(mt->z - (mobjinfo[MT_NIGHTSBUMPER].height/4), 0);
|
||||
// height offset: from P_TouchSpecialThing case MT_NIGHTSBUMPER
|
||||
|
||||
// clockwise
|
||||
|
@ -1232,7 +1225,7 @@ void OP_NightsObjectplace(player_t *player)
|
|||
else // forward
|
||||
newflags = 0;
|
||||
|
||||
mt->options = (newz << ZSHIFT) | newflags;
|
||||
mt->options = (mt->z << ZSHIFT) | newflags;
|
||||
|
||||
// if NiGHTS is facing backwards, orient the Thing angle forwards so that the sprite angle
|
||||
// displays correctly. Backwards movement via the Thing flags is unaffected.
|
||||
|
@ -1250,7 +1243,7 @@ void OP_NightsObjectplace(player_t *player)
|
|||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_BLUESPHERE].doomednum, false);
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
P_SpawnMapThing(mt);
|
||||
}
|
||||
|
||||
// This places a ring!
|
||||
|
@ -1261,7 +1254,7 @@ void OP_NightsObjectplace(player_t *player)
|
|||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_RING].doomednum, false);
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
P_SpawnMapThing(mt);
|
||||
}
|
||||
|
||||
// This places a custom object as defined in the console cv_mapthingnum.
|
||||
|
@ -1293,15 +1286,10 @@ void OP_NightsObjectplace(player_t *player)
|
|||
mt = OP_CreateNewMapThing(player, (UINT16)cv_mapthingnum.value, false);
|
||||
mt->angle = angle;
|
||||
|
||||
if (mt->type == 300 // Ring
|
||||
|| mt->type == 308 || mt->type == 309 // Team Rings
|
||||
|| mt->type == 1706 // Sphere
|
||||
|| (mt->type >= 600 && mt->type <= 609) // Placement patterns
|
||||
|| mt->type == 1705 || mt->type == 1713 // NiGHTS Hoops
|
||||
|| mt->type == 1800) // Mario Coin
|
||||
{
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
}
|
||||
if (mt->type >= 600 && mt->type <= 609) // Placement patterns
|
||||
P_SpawnItemPattern(mt, false);
|
||||
else if (mt->type == 1705 || mt->type == 1713) // NiGHTS Hoops
|
||||
P_SpawnHoop(mt);
|
||||
else
|
||||
P_SpawnMapThing(mt);
|
||||
}
|
||||
|
@ -1316,7 +1304,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
|
||||
if (!player->climbing && (netgame || !cv_analog.value || (player->pflags & PF_SPINNING)))
|
||||
if (!player->climbing && (netgame || !cv_analog[0].value || (player->pflags & PF_SPINNING)))
|
||||
player->drawangle = player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
|
||||
|
||||
ticruned++;
|
||||
|
@ -1438,19 +1426,14 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)spawnthing, ceiling);
|
||||
if (mt->type == 300 // Ring
|
||||
|| mt->type == 308 || mt->type == 309 // Team Rings
|
||||
|| mt->type == 1706 // Nights Wing
|
||||
|| (mt->type >= 600 && mt->type <= 609) // Placement patterns
|
||||
|| mt->type == 1705 || mt->type == 1713 // NiGHTS Hoops
|
||||
|| mt->type == 1800) // Mario Coin
|
||||
{
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
}
|
||||
if (mt->type >= 600 && mt->type <= 609) // Placement patterns
|
||||
P_SpawnItemPattern(mt, false);
|
||||
else if (mt->type == 1705 || mt->type == 1713) // NiGHTS Hoops
|
||||
P_SpawnHoop(mt);
|
||||
else
|
||||
P_SpawnMapThing(mt);
|
||||
|
||||
CONS_Printf(M_GetText("Placed object type %d at %d, %d, %d, %d\n"), mt->type, mt->x, mt->y, mt->options>>ZSHIFT, mt->angle);
|
||||
CONS_Printf(M_GetText("Placed object type %d at %d, %d, %d, %d\n"), mt->type, mt->x, mt->y, mt->z, mt->angle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
|
||||
// Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 2012-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
|
|
16
src/m_cond.h
16
src/m_cond.h
|
@ -1,6 +1,6 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
|
||||
// Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 2012-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
|
@ -97,12 +97,13 @@ typedef struct
|
|||
} emblem_t;
|
||||
typedef struct
|
||||
{
|
||||
char name[20]; ///< Name of the goal (used in the "emblem awarded" cecho)
|
||||
char description[40];///< Description of goal (used in statistics)
|
||||
UINT8 conditionset; ///< Condition set that awards this emblem.
|
||||
UINT8 sprite; ///< emblem sprite to use, 0 - 25
|
||||
UINT8 color; ///< skincolor to use
|
||||
UINT8 collected; ///< Do you have this emblem?
|
||||
char name[20]; ///< Name of the goal (used in the "emblem awarded" cecho)
|
||||
char description[40]; ///< Description of goal (used in statistics)
|
||||
UINT8 conditionset; ///< Condition set that awards this emblem.
|
||||
UINT8 showconditionset; ///< Condition set that shows this emblem.
|
||||
UINT8 sprite; ///< emblem sprite to use, 0 - 25
|
||||
UINT8 color; ///< skincolor to use
|
||||
UINT8 collected; ///< Do you have this emblem?
|
||||
} extraemblem_t;
|
||||
|
||||
// Unlockable information
|
||||
|
@ -112,6 +113,7 @@ typedef struct
|
|||
char objective[64];
|
||||
UINT16 height; // menu height
|
||||
UINT8 conditionset;
|
||||
UINT8 showconditionset;
|
||||
INT16 type;
|
||||
INT16 variable;
|
||||
UINT8 nocecho;
|
||||
|
|
1161
src/m_menu.c
1161
src/m_menu.c
File diff suppressed because it is too large
Load diff
10
src/m_menu.h
10
src/m_menu.h
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
|
||||
// Copyright (C) 2011-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
|
@ -81,6 +81,8 @@ typedef enum
|
|||
MN_OP_P2JOYSTICK,
|
||||
MN_OP_P2CAMERA,
|
||||
|
||||
MN_OP_PLAYSTYLE,
|
||||
|
||||
MN_OP_VIDEO,
|
||||
MN_OP_VIDEOMODE,
|
||||
MN_OP_COLOR,
|
||||
|
@ -222,13 +224,14 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
|
|||
|
||||
// flags for items in the menu
|
||||
// menu handle (what we do when key is pressed
|
||||
#define IT_TYPE 14 // (2+4+8)
|
||||
#define IT_TYPE 15 // (1+2+4+8)
|
||||
#define IT_CALL 0 // call the function
|
||||
#define IT_SPACE 1 // no handling
|
||||
#define IT_ARROWS 2 // call function with 0 for left arrow and 1 for right arrow in param
|
||||
#define IT_KEYHANDLER 4 // call with the key in param
|
||||
#define IT_SUBMENU 6 // go to sub menu
|
||||
#define IT_CVAR 8 // handle as a cvar
|
||||
#define IT_SPACE 10 // no handling
|
||||
#define IT_PAIR 11 // no handling, define both sides of text
|
||||
#define IT_MSGHANDLER 12 // same as key but with event and sometime can handle y/n key (special for message)
|
||||
|
||||
#define IT_DISPLAY (48+64+128) // 16+32+64+128
|
||||
|
@ -371,6 +374,7 @@ typedef struct
|
|||
UINT8 col[2];
|
||||
char notes[441];
|
||||
} gtdesc_t;
|
||||
extern gtdesc_t gametypedesc[NUMGAMETYPES];
|
||||
|
||||
// mode descriptions for video mode menu
|
||||
typedef struct
|
||||
|
|
193
src/m_misc.c
193
src/m_misc.c
|
@ -600,12 +600,12 @@ void M_SaveConfig(const char *filename)
|
|||
CV_SetValue(&cv_usemouse, tutorialusemouse);
|
||||
CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
|
||||
CV_SetValue(&cv_mousemove, tutorialmousemove);
|
||||
CV_SetValue(&cv_analog, tutorialanalog);
|
||||
CV_SetValue(&cv_analog[0], tutorialanalog);
|
||||
CV_SaveVariables(f);
|
||||
CV_Set(&cv_usemouse, cv_usemouse.defaultvalue);
|
||||
CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue);
|
||||
CV_Set(&cv_mousemove, cv_mousemove.defaultvalue);
|
||||
CV_Set(&cv_analog, cv_analog.defaultvalue);
|
||||
CV_Set(&cv_analog[0], cv_analog[0].defaultvalue);
|
||||
}
|
||||
else
|
||||
CV_SaveVariables(f);
|
||||
|
@ -1161,12 +1161,8 @@ void M_StartMovie(void)
|
|||
switch (cv_moviemode.value)
|
||||
{
|
||||
case MM_GIF:
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
moviemode = M_StartMovieGIF(pathname);
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
moviemode = M_StartMovieGIF(pathname);
|
||||
break;
|
||||
case MM_APNG:
|
||||
moviemode = M_StartMovieAPNG(pathname);
|
||||
break;
|
||||
|
@ -1598,16 +1594,19 @@ boolean M_ScreenshotResponder(event_t *ev)
|
|||
// M_StartupLocale.
|
||||
// Sets up gettext to translate SRB2's strings.
|
||||
#ifdef GETTEXT
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#define GETTEXTDOMAIN1 "/usr/share/locale"
|
||||
#define GETTEXTDOMAIN2 "/usr/local/share/locale"
|
||||
#elif defined (_WIN32)
|
||||
#define GETTEXTDOMAIN1 "."
|
||||
#endif
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#define GETTEXTDOMAIN1 "/usr/share/locale"
|
||||
#define GETTEXTDOMAIN2 "/usr/local/share/locale"
|
||||
#elif defined (_WIN32)
|
||||
#define GETTEXTDOMAIN1 "."
|
||||
#endif
|
||||
#endif // GETTEXT
|
||||
|
||||
void M_StartupLocale(void)
|
||||
{
|
||||
#ifdef GETTEXT
|
||||
char *textdomhandle = NULL;
|
||||
#endif //GETTEXT
|
||||
|
||||
CONS_Printf("M_StartupLocale...\n");
|
||||
|
||||
|
@ -1616,6 +1615,7 @@ void M_StartupLocale(void)
|
|||
// Do not set numeric locale as that affects atof
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
#ifdef GETTEXT
|
||||
// FIXME: global name define anywhere?
|
||||
#ifdef GETTEXTDOMAIN1
|
||||
textdomhandle = bindtextdomain("srb2", GETTEXTDOMAIN1);
|
||||
|
@ -1636,8 +1636,8 @@ void M_StartupLocale(void)
|
|||
textdomain("srb2");
|
||||
else
|
||||
CONS_Printf("Could not find locale text domain!\n");
|
||||
#endif //GETTEXT
|
||||
}
|
||||
#endif
|
||||
|
||||
// ==========================================================================
|
||||
// MISC STRING FUNCTIONS
|
||||
|
@ -1783,7 +1783,7 @@ char *M_GetToken(const char *inputString)
|
|||
|| stringToUse[startPos] == '\r'
|
||||
|| stringToUse[startPos] == '\n'
|
||||
|| stringToUse[startPos] == '\0'
|
||||
|| stringToUse[startPos] == '"' // we're treating this as whitespace because SLADE likes adding it for no good reason
|
||||
|| stringToUse[startPos] == '=' || stringToUse[startPos] == ';' // UDMF TEXTMAP.
|
||||
|| inComment != 0)
|
||||
&& startPos < stringLength)
|
||||
{
|
||||
|
@ -1841,6 +1841,23 @@ char *M_GetToken(const char *inputString)
|
|||
texturesToken[1] = '\0';
|
||||
return texturesToken;
|
||||
}
|
||||
// Return entire string within quotes, except without the quotes.
|
||||
else if (stringToUse[startPos] == '"')
|
||||
{
|
||||
endPos = ++startPos;
|
||||
while (stringToUse[endPos] != '"' && endPos < stringLength)
|
||||
endPos++;
|
||||
|
||||
texturesTokenLength = endPos++ - startPos;
|
||||
// Assign the memory. Don't forget an extra byte for the end of the string!
|
||||
texturesToken = (char *)Z_Malloc((texturesTokenLength+1)*sizeof(char),PU_STATIC,NULL);
|
||||
// Copy the string.
|
||||
M_Memcpy(texturesToken, stringToUse+startPos, (size_t)texturesTokenLength);
|
||||
// Make the final character NUL.
|
||||
texturesToken[texturesTokenLength] = '\0';
|
||||
|
||||
return texturesToken;
|
||||
}
|
||||
|
||||
// Now find the end of the token. This includes several additional characters that are okay to capture as one character, but not trailing at the end of another token.
|
||||
endPos = startPos + 1;
|
||||
|
@ -1851,7 +1868,7 @@ char *M_GetToken(const char *inputString)
|
|||
&& stringToUse[endPos] != ','
|
||||
&& stringToUse[endPos] != '{'
|
||||
&& stringToUse[endPos] != '}'
|
||||
&& stringToUse[endPos] != '"' // see above
|
||||
&& stringToUse[endPos] != '=' && stringToUse[endPos] != ';' // UDMF TEXTMAP.
|
||||
&& inComment == 0)
|
||||
&& endPos < stringLength)
|
||||
{
|
||||
|
@ -1895,6 +1912,20 @@ void M_UnGetToken(void)
|
|||
endPos = oldendPos;
|
||||
}
|
||||
|
||||
/** Returns the current token's position.
|
||||
*/
|
||||
UINT32 M_GetTokenPos(void)
|
||||
{
|
||||
return endPos;
|
||||
}
|
||||
|
||||
/** Sets the current token's position.
|
||||
*/
|
||||
void M_SetTokenPos(UINT32 newPos)
|
||||
{
|
||||
endPos = newPos;
|
||||
}
|
||||
|
||||
/** Count bits in a number.
|
||||
*/
|
||||
UINT8 M_CountBits(UINT32 num, UINT8 size)
|
||||
|
@ -2453,3 +2484,131 @@ const char *M_FileError(FILE *fp)
|
|||
else
|
||||
return "end-of-file";
|
||||
}
|
||||
|
||||
/** Return the number of parts of this path.
|
||||
*/
|
||||
int M_PathParts(const char *path)
|
||||
{
|
||||
int n;
|
||||
const char *p;
|
||||
const char *t;
|
||||
if (path == NULL)
|
||||
return 0;
|
||||
for (n = 0, p = path ;; ++n)
|
||||
{
|
||||
t = p;
|
||||
if (( p = strchr(p, PATHSEP[0]) ))
|
||||
p += strspn(p, PATHSEP);
|
||||
else
|
||||
{
|
||||
if (*t)/* there is something after the final delimiter */
|
||||
n++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/** Check whether a path is an absolute path.
|
||||
*/
|
||||
boolean M_IsPathAbsolute(const char *path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return ( strncmp(&path[1], ":\\", 2) == 0 );
|
||||
#else
|
||||
return ( path[0] == '/' );
|
||||
#endif
|
||||
}
|
||||
|
||||
/** I_mkdir for each part of the path.
|
||||
*/
|
||||
void M_MkdirEachUntil(const char *cpath, int start, int end, int mode)
|
||||
{
|
||||
char path[MAX_WADPATH];
|
||||
char *p;
|
||||
char *t;
|
||||
|
||||
if (end > 0 && end <= start)
|
||||
return;
|
||||
|
||||
strlcpy(path, cpath, sizeof path);
|
||||
#ifdef _WIN32
|
||||
if (strncmp(&path[1], ":\\", 2) == 0)
|
||||
p = &path[3];
|
||||
else
|
||||
#endif
|
||||
p = path;
|
||||
|
||||
if (end > 0)
|
||||
end -= start;
|
||||
|
||||
for (; start > 0; --start)
|
||||
{
|
||||
p += strspn(p, PATHSEP);
|
||||
if (!( p = strchr(p, PATHSEP[0]) ))
|
||||
return;
|
||||
}
|
||||
p += strspn(p, PATHSEP);
|
||||
for (;;)
|
||||
{
|
||||
if (end > 0 && !--end)
|
||||
break;
|
||||
|
||||
t = p;
|
||||
if (( p = strchr(p, PATHSEP[0]) ))
|
||||
{
|
||||
*p = '\0';
|
||||
I_mkdir(path, mode);
|
||||
*p = PATHSEP[0];
|
||||
p += strspn(p, PATHSEP);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*t)
|
||||
I_mkdir(path, mode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void M_MkdirEach(const char *path, int start, int mode)
|
||||
{
|
||||
M_MkdirEachUntil(path, start, -1, mode);
|
||||
}
|
||||
|
||||
int M_JumpWord(const char *line)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = line[0];
|
||||
|
||||
if (isspace(c))
|
||||
return strspn(line, " ");
|
||||
else if (ispunct(c))
|
||||
return strspn(line, PUNCTUATION);
|
||||
else
|
||||
{
|
||||
if (isspace(line[1]))
|
||||
return 1 + strspn(&line[1], " ");
|
||||
else
|
||||
return strcspn(line, " "PUNCTUATION);
|
||||
}
|
||||
}
|
||||
|
||||
int M_JumpWordReverse(const char *line, int offset)
|
||||
{
|
||||
int (*is)(int);
|
||||
int c;
|
||||
c = line[--offset];
|
||||
if (isspace(c))
|
||||
is = isspace;
|
||||
else if (ispunct(c))
|
||||
is = ispunct;
|
||||
else
|
||||
is = isalnum;
|
||||
c = (*is)(line[offset]);
|
||||
while (offset > 0 &&
|
||||
(*is)(line[offset - 1]) == c)
|
||||
offset--;
|
||||
return offset;
|
||||
}
|
||||
|
|
13
src/m_misc.h
13
src/m_misc.h
|
@ -96,6 +96,19 @@ void M_SetupMemcpy(void);
|
|||
|
||||
const char *M_FileError(FILE *handle);
|
||||
|
||||
int M_PathParts (const char *path);
|
||||
boolean M_IsPathAbsolute (const char *path);
|
||||
void M_MkdirEach (const char *path, int start, int mode);
|
||||
void M_MkdirEachUntil (const char *path, int start, int end, int mode);
|
||||
|
||||
/* Return offset to the first word in a string. */
|
||||
/* E.g. cursor += M_JumpWord(line + cursor); */
|
||||
int M_JumpWord (const char *s);
|
||||
|
||||
/* Return index of the last word behind offset bytes in a string. */
|
||||
/* E.g. cursor = M_JumpWordReverse(line, cursor); */
|
||||
int M_JumpWordReverse (const char *line, int offset);
|
||||
|
||||
// counting bits, for weapon ammo code, usually
|
||||
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
|
||||
// Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
|
||||
// Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
|
|
110
src/mserv.c
110
src/mserv.c
|
@ -323,13 +323,9 @@ static INT32 GetServersList(void)
|
|||
//
|
||||
// MS_Connect()
|
||||
//
|
||||
static INT32 MS_Connect(const char *ip_addr, const char *str_port, INT32 async)
|
||||
#ifndef NONET
|
||||
static INT32 MS_SubConnect(const char *ip_addr, const char *str_port, INT32 async, struct sockaddr *bindaddr, socklen_t bindaddrlen)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)ip_addr;
|
||||
(void)str_port;
|
||||
(void)async;
|
||||
#else
|
||||
struct my_addrinfo *ai, *runp, hints;
|
||||
int gaie;
|
||||
|
||||
|
@ -356,50 +352,100 @@ static INT32 MS_Connect(const char *ip_addr, const char *str_port, INT32 async)
|
|||
socket_fd = socket(runp->ai_family, runp->ai_socktype, runp->ai_protocol);
|
||||
if (socket_fd != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
if (async) // do asynchronous connection
|
||||
if (!bindaddr || bind(socket_fd, bindaddr, bindaddrlen) == 0)
|
||||
{
|
||||
if (async) // do asynchronous connection
|
||||
{
|
||||
#ifdef FIONBIO
|
||||
#ifdef WATTCP
|
||||
char res = 1;
|
||||
char res = 1;
|
||||
#else
|
||||
unsigned long res = 1;
|
||||
unsigned long res = 1;
|
||||
#endif
|
||||
|
||||
ioctl(socket_fd, FIONBIO, &res);
|
||||
ioctl(socket_fd, FIONBIO, &res);
|
||||
#endif
|
||||
|
||||
if (connect(socket_fd, runp->ai_addr, (socklen_t)runp->ai_addrlen) == ERRSOCKET)
|
||||
{
|
||||
#ifdef _WIN32 // humm, on win32/win64 it doesn't work with EINPROGRESS (stupid windows)
|
||||
if (WSAGetLastError() != WSAEWOULDBLOCK)
|
||||
#else
|
||||
if (errno != EINPROGRESS)
|
||||
#endif
|
||||
if (connect(socket_fd, runp->ai_addr, (socklen_t)runp->ai_addrlen) == ERRSOCKET)
|
||||
{
|
||||
con_state = MSCS_FAILED;
|
||||
CloseConnection();
|
||||
I_freeaddrinfo(ai);
|
||||
return MS_CONNECT_ERROR;
|
||||
#ifdef _WIN32 // humm, on win32/win64 it doesn't work with EINPROGRESS (stupid windows)
|
||||
if (WSAGetLastError() != WSAEWOULDBLOCK)
|
||||
#else
|
||||
if (errno != EINPROGRESS)
|
||||
#endif
|
||||
{
|
||||
con_state = MSCS_FAILED;
|
||||
CloseConnection();
|
||||
I_freeaddrinfo(ai);
|
||||
return MS_CONNECT_ERROR;
|
||||
}
|
||||
}
|
||||
con_state = MSCS_WAITING;
|
||||
FD_ZERO(&wset);
|
||||
FD_SET(socket_fd, &wset);
|
||||
select_timeout.tv_sec = 0, select_timeout.tv_usec = 0;
|
||||
I_freeaddrinfo(ai);
|
||||
return 0;
|
||||
}
|
||||
else if (connect(socket_fd, runp->ai_addr, (socklen_t)runp->ai_addrlen) != ERRSOCKET)
|
||||
{
|
||||
I_freeaddrinfo(ai);
|
||||
return 0;
|
||||
}
|
||||
con_state = MSCS_WAITING;
|
||||
FD_ZERO(&wset);
|
||||
FD_SET(socket_fd, &wset);
|
||||
select_timeout.tv_sec = 0, select_timeout.tv_usec = 0;
|
||||
I_freeaddrinfo(ai);
|
||||
return 0;
|
||||
}
|
||||
else if (connect(socket_fd, runp->ai_addr, (socklen_t)runp->ai_addrlen) != ERRSOCKET)
|
||||
close(socket_fd);
|
||||
}
|
||||
runp = runp->ai_next;
|
||||
}
|
||||
I_freeaddrinfo(ai);
|
||||
return MS_CONNECT_ERROR;
|
||||
}
|
||||
#endif/*NONET xd*/
|
||||
|
||||
static INT32 MS_Connect(const char *ip_addr, const char *str_port, INT32 async)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)ip_addr;
|
||||
(void)str_port;
|
||||
(void)async;
|
||||
return MS_CONNECT_ERROR;
|
||||
#else
|
||||
const char *lhost;
|
||||
struct my_addrinfo hints;
|
||||
struct my_addrinfo *ai, *aip;
|
||||
int c;
|
||||
if (M_CheckParm("-bindaddr") && ( lhost = M_GetNextParm() ))
|
||||
{
|
||||
memset (&hints, 0x00, sizeof(hints));
|
||||
#ifdef AI_ADDRCONFIG
|
||||
hints.ai_flags = AI_ADDRCONFIG;
|
||||
#endif
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
if (( c = I_getaddrinfo(lhost, 0, &hints, &ai) ) != 0)
|
||||
{
|
||||
CONS_Printf(
|
||||
"mserv.c: bind to %s: %s\n",
|
||||
lhost,
|
||||
gai_strerror(c));
|
||||
return MS_GETHOSTBYNAME_ERROR;
|
||||
}
|
||||
for (aip = ai; aip; aip = aip->ai_next)
|
||||
{
|
||||
c = MS_SubConnect(ip_addr, str_port, async, aip->ai_addr, aip->ai_addrlen);
|
||||
if (c == 0)
|
||||
{
|
||||
I_freeaddrinfo(ai);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
runp = runp->ai_next;
|
||||
I_freeaddrinfo(ai);
|
||||
return c;
|
||||
}
|
||||
I_freeaddrinfo(ai);
|
||||
#endif
|
||||
return MS_CONNECT_ERROR;
|
||||
else
|
||||
return MS_SubConnect(ip_addr, str_port, async, 0, 0);
|
||||
#endif/*NONET xd*/
|
||||
}
|
||||
|
||||
#define NUM_LIST_SERVER MAXSERVERLIST
|
||||
|
|
131
src/p_enemy.c
131
src/p_enemy.c
|
@ -181,11 +181,9 @@ void A_SpawnObjectAbsolute(mobj_t *actor);
|
|||
void A_SpawnObjectRelative(mobj_t *actor);
|
||||
void A_ChangeAngleRelative(mobj_t *actor);
|
||||
void A_ChangeAngleAbsolute(mobj_t *actor);
|
||||
#ifdef ROTSPRITE
|
||||
void A_RollAngle(mobj_t *actor);
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor);
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor);
|
||||
#endif // ROTSPRITE
|
||||
void A_PlaySound(mobj_t *actor);
|
||||
void A_FindTarget(mobj_t *actor);
|
||||
void A_FindTracer(mobj_t *actor);
|
||||
|
@ -2266,7 +2264,7 @@ void A_CrushclawLaunch(mobj_t *actor)
|
|||
while (chain)
|
||||
{
|
||||
P_TeleportMove(chain, actor->target->x + idx, actor->target->y + idy, actor->target->z + idz);
|
||||
chain->watertop = chain->z;
|
||||
chain->movefactor = chain->z;
|
||||
idx += dx;
|
||||
idy += dy;
|
||||
idz += dz;
|
||||
|
@ -4988,7 +4986,7 @@ void A_ThrownRing(mobj_t *actor)
|
|||
continue;
|
||||
|
||||
// Don't home in on teammates.
|
||||
if (gametype == GT_CTF
|
||||
if ((gametyperules & GTR_TEAMFLAGS)
|
||||
&& actor->target->player->ctfteam == player->ctfteam)
|
||||
continue;
|
||||
}
|
||||
|
@ -5182,6 +5180,8 @@ void A_SignPlayer(mobj_t *actor)
|
|||
|
||||
if (signcolor)
|
||||
;
|
||||
else if (!skin->sprites[SPR2_SIGN].numframes)
|
||||
signcolor = facecolor;
|
||||
else if ((actor->target->player->skincolor == skin->prefcolor) && (skin->prefoppositecolor)) // Set it as the skin's preferred oppositecolor?
|
||||
signcolor = skin->prefoppositecolor;
|
||||
else if (actor->target->player->skincolor) // Set the sign to be an appropriate background color for this player's skincolor.
|
||||
|
@ -5192,33 +5192,25 @@ void A_SignPlayer(mobj_t *actor)
|
|||
else if (locvar1 != -3) // set to a defined skin
|
||||
{
|
||||
// I turned this function into a fucking mess. I'm so sorry. -Lach
|
||||
if (locvar1 == -2) // next skin
|
||||
if (locvar1 == -2) // random skin
|
||||
{
|
||||
#define skincheck(num) (player ? !R_SkinUsable(player-players, num) : skins[num].availability > 0)
|
||||
player_t *player = actor->target ? actor->target->player : NULL;
|
||||
UINT8 skinnum;
|
||||
#define skincheck(num) (player ? !R_SkinUsable(player-players, num) : skins[num].availability > 0)
|
||||
if (ov->skin == NULL) // pick a random skin to start with!
|
||||
UINT8 skincount = 0;
|
||||
for (skincount = 0; skincount < numskins; skincount++)
|
||||
if (!skincheck(skincount))
|
||||
skincount++;
|
||||
skinnum = P_RandomKey(skincount);
|
||||
for (skincount = 0; skincount < numskins; skincount++)
|
||||
{
|
||||
UINT8 skincount = 0;
|
||||
for (skincount = 0; skincount < numskins; skincount++)
|
||||
if (!skincheck(skincount))
|
||||
skincount++;
|
||||
skinnum = P_RandomKey(skincount);
|
||||
for (skincount = 0; skincount < numskins; skincount++)
|
||||
{
|
||||
if (skincount > skinnum)
|
||||
break;
|
||||
if (skincheck(skincount))
|
||||
skinnum++;
|
||||
}
|
||||
if (skincount > skinnum)
|
||||
break;
|
||||
if (skincheck(skincount))
|
||||
skinnum++;
|
||||
}
|
||||
else // otherwise, advance 1 skin
|
||||
{
|
||||
skinnum = (skin_t*)ov->skin-skins;
|
||||
while ((skinnum = (skinnum + 1) % numskins) && skincheck(skinnum));
|
||||
}
|
||||
#undef skincheck
|
||||
skin = &skins[skinnum];
|
||||
#undef skincheck
|
||||
}
|
||||
else // specific skin
|
||||
skin = &skins[locvar1];
|
||||
|
@ -5226,21 +5218,33 @@ void A_SignPlayer(mobj_t *actor)
|
|||
facecolor = skin->prefcolor;
|
||||
if (signcolor)
|
||||
;
|
||||
else if (!skin->sprites[SPR2_SIGN].numframes)
|
||||
signcolor = facecolor;
|
||||
else if (skin->prefoppositecolor)
|
||||
signcolor = skin->prefoppositecolor;
|
||||
else if (facecolor)
|
||||
signcolor = Color_Opposite[facecolor - 1][0];
|
||||
}
|
||||
|
||||
if (skin && skin->sprites[SPR2_SIGN].numframes) // player face
|
||||
if (skin)
|
||||
{
|
||||
ov->color = facecolor;
|
||||
ov->skin = skin;
|
||||
P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN
|
||||
if (skin->sprites[SPR2_SIGN].numframes) // player face
|
||||
{
|
||||
ov->color = facecolor;
|
||||
ov->skin = skin;
|
||||
P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN
|
||||
}
|
||||
else // CLEAR! sign
|
||||
{
|
||||
ov->color = SKINCOLOR_NONE;
|
||||
ov->skin = NULL; // needs to be NULL in the case of SF_HIRES characters
|
||||
P_SetMobjState(ov, actor->info->missilestate); // S_CLEARSIGN
|
||||
}
|
||||
}
|
||||
else // Eggman face
|
||||
{
|
||||
ov->color = SKINCOLOR_NONE;
|
||||
ov->skin = NULL;
|
||||
P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN
|
||||
if (!signcolor)
|
||||
signcolor = SKINCOLOR_CARBON;
|
||||
|
@ -6594,7 +6598,7 @@ void A_OldRingExplode(mobj_t *actor) {
|
|||
|
||||
if (changecolor)
|
||||
{
|
||||
if (gametype != GT_CTF)
|
||||
if (!(gametyperules & GTR_TEAMFLAGS))
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
|
@ -6610,7 +6614,7 @@ void A_OldRingExplode(mobj_t *actor) {
|
|||
|
||||
if (changecolor)
|
||||
{
|
||||
if (gametype != GT_CTF)
|
||||
if (!(gametyperules & GTR_TEAMFLAGS))
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
|
@ -6625,7 +6629,7 @@ void A_OldRingExplode(mobj_t *actor) {
|
|||
|
||||
if (changecolor)
|
||||
{
|
||||
if (gametype != GT_CTF)
|
||||
if (!(gametyperules & GTR_TEAMFLAGS))
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
|
@ -8630,7 +8634,6 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
|
|||
actor->angle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// Function: A_RollAngle
|
||||
//
|
||||
// Description: Changes the roll angle.
|
||||
|
@ -8666,16 +8669,10 @@ void A_RollAngle(mobj_t *actor)
|
|||
//
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor)
|
||||
{
|
||||
// Oh god, the old code /sucked/. Changed this and the absolute version to get a random range using amin and amax instead of
|
||||
// getting a random angle from the _entire_ spectrum and then clipping. While we're at it, do the angle conversion to the result
|
||||
// rather than the ranges, so <0 and >360 work as possible values. -Red
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
//angle_t angle = (P_RandomByte()+1)<<24;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
//const angle_t amin = FixedAngle(locvar1*FRACUNIT);
|
||||
//const angle_t amax = FixedAngle(locvar2*FRACUNIT);
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_ChangeRollAngleRelative", actor))
|
||||
return;
|
||||
|
@ -8685,11 +8682,6 @@ void A_ChangeRollAngleRelative(mobj_t *actor)
|
|||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleRelative: var1 is greater than var2");
|
||||
#endif
|
||||
/*
|
||||
if (angle < amin)
|
||||
angle = amin;
|
||||
if (angle > amax)
|
||||
angle = amax;*/
|
||||
|
||||
actor->rollangle += FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
@ -8705,11 +8697,8 @@ void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
|||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
//angle_t angle = (P_RandomByte()+1)<<24;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
//const angle_t amin = FixedAngle(locvar1*FRACUNIT);
|
||||
//const angle_t amax = FixedAngle(locvar2*FRACUNIT);
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_ChangeRollAngleAbsolute", actor))
|
||||
return;
|
||||
|
@ -8719,15 +8708,9 @@ void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
|||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleAbsolute: var1 is greater than var2");
|
||||
#endif
|
||||
/*
|
||||
if (angle < amin)
|
||||
angle = amin;
|
||||
if (angle > amax)
|
||||
angle = amax;*/
|
||||
|
||||
actor->rollangle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
#endif // ROTSPRITE
|
||||
|
||||
// Function: A_PlaySound
|
||||
//
|
||||
|
@ -13617,12 +13600,12 @@ static boolean PIT_DustDevilLaunch(mobj_t *thing)
|
|||
}
|
||||
else
|
||||
{ //Player on the top of the tornado.
|
||||
P_ResetPlayer(player);
|
||||
thing->z = dustdevil->z + dustdevil->height;
|
||||
thrust = 20 * FRACUNIT;
|
||||
player->powers[pw_nocontrol] = 0;
|
||||
S_StartSound(thing, sfx_wdjump);
|
||||
P_SetPlayerMobjState(thing, S_PLAY_FALL);
|
||||
player->pflags &= ~PF_JUMPED;
|
||||
}
|
||||
|
||||
thing->momz = thrust;
|
||||
|
@ -14251,7 +14234,7 @@ void A_SaloonDoorSpawn(mobj_t *actor)
|
|||
fixed_t c = FINECOSINE(fa)*locvar2;
|
||||
fixed_t s = FINESINE(fa)*locvar2;
|
||||
mobj_t *door;
|
||||
mobjflag2_t ambush = (actor->flags & MF2_AMBUSH);
|
||||
mobjflag2_t ambush = (actor->flags2 & MF2_AMBUSH);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_SaloonDoorSpawn", actor))
|
||||
|
@ -14629,12 +14612,9 @@ void A_RolloutRock(mobj_t *actor)
|
|||
if (!actor->tracer || P_MobjWasRemoved(actor->tracer) || !actor->tracer->health)
|
||||
actor->flags |= MF_PUSHABLE;
|
||||
|
||||
if (!(actor->flags & MF_PUSHABLE)) // if being ridden, don't disappear
|
||||
actor->fuse = 0;
|
||||
else if (!actor->fuse && actor->movecount == 1) // otherwise if rock has moved, set its fuse
|
||||
if (!(actor->flags & MF_PUSHABLE) || (actor->movecount != 1)) // if being ridden or haven't moved, don't disappear
|
||||
actor->fuse = actor->info->painchance;
|
||||
|
||||
if (actor->fuse && actor->fuse < 2*TICRATE)
|
||||
else if (actor->fuse < 2*TICRATE)
|
||||
actor->flags2 ^= MF2_DONTDRAW;
|
||||
|
||||
}
|
||||
|
@ -14715,20 +14695,35 @@ void A_DragonWing(mobj_t *actor)
|
|||
void A_DragonSegment(mobj_t *actor)
|
||||
{
|
||||
mobj_t *target = actor->target;
|
||||
fixed_t dist = P_AproxDistance(P_AproxDistance(actor->x - target->x, actor->y - target->y), actor->z - target->z);
|
||||
fixed_t radius = actor->radius + target->radius;
|
||||
angle_t hangle = R_PointToAngle2(target->x, target->y, actor->x, actor->y);
|
||||
angle_t zangle = R_PointToAngle2(0, target->z, dist, actor->z);
|
||||
fixed_t hdist = P_ReturnThrustX(target, zangle, radius);
|
||||
fixed_t xdist = P_ReturnThrustX(target, hangle, hdist);
|
||||
fixed_t ydist = P_ReturnThrustY(target, hangle, hdist);
|
||||
fixed_t zdist = P_ReturnThrustY(target, zangle, radius);
|
||||
fixed_t dist;
|
||||
fixed_t radius;
|
||||
angle_t hangle;
|
||||
angle_t zangle;
|
||||
fixed_t hdist;
|
||||
fixed_t xdist;
|
||||
fixed_t ydist;
|
||||
fixed_t zdist;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_DragonSegment", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (target == NULL || !target->health)
|
||||
{
|
||||
P_RemoveMobj(actor);
|
||||
return;
|
||||
}
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(actor->x - target->x, actor->y - target->y), actor->z - target->z);
|
||||
radius = actor->radius + target->radius;
|
||||
hangle = R_PointToAngle2(target->x, target->y, actor->x, actor->y);
|
||||
zangle = R_PointToAngle2(0, target->z, dist, actor->z);
|
||||
hdist = P_ReturnThrustX(target, zangle, radius);
|
||||
xdist = P_ReturnThrustX(target, hangle, hdist);
|
||||
ydist = P_ReturnThrustY(target, hangle, hdist);
|
||||
zdist = P_ReturnThrustY(target, zangle, radius);
|
||||
|
||||
actor->angle = hangle;
|
||||
P_TeleportMove(actor, target->x + xdist, target->y + ydist, target->z + zdist);
|
||||
}
|
||||
|
|
|
@ -433,7 +433,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|| special->state == &states[S_FANG_BOUNCE4]
|
||||
|| special->state == &states[S_FANG_PINCHBOUNCE3]
|
||||
|| special->state == &states[S_FANG_PINCHBOUNCE4])
|
||||
&& P_MobjFlip(special)*((special->z + special->height/2) - (toucher->z - toucher->height/2)) > (special->height/4))
|
||||
&& P_MobjFlip(special)*((special->z + special->height/2) - (toucher->z + toucher->height/2)) > (toucher->height/2))
|
||||
{
|
||||
P_DamageMobj(toucher, special, special, 1, 0);
|
||||
P_SetTarget(&special->tracer, toucher);
|
||||
|
@ -625,7 +625,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
P_AddPlayerScore(player, 1000);
|
||||
|
||||
if (gametype != GT_COOP || modeattacking) // score only?
|
||||
if (!(gametyperules & GTR_SPECIALSTAGES) || modeattacking) // score only?
|
||||
{
|
||||
S_StartSound(toucher, sfx_chchng);
|
||||
break;
|
||||
|
@ -1451,7 +1451,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
if (player->starpostnum >= special->health)
|
||||
return; // Already hit this post
|
||||
|
||||
if (cv_coopstarposts.value && gametype == GT_COOP && (netgame || multiplayer))
|
||||
if (cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (netgame || multiplayer))
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
@ -1807,7 +1807,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
return;
|
||||
|
||||
case MT_MINECARTSPAWNER:
|
||||
if (!player->bot && (special->fuse < TICRATE || player->powers[pw_carry] != CR_MINECART))
|
||||
if (!player->bot && special->fuse <= TICRATE && player->powers[pw_carry] != CR_MINECART)
|
||||
{
|
||||
mobj_t *mcart = P_SpawnMobj(special->x, special->y, special->z, MT_MINECART);
|
||||
P_SetTarget(&mcart->target, toucher);
|
||||
|
@ -1869,6 +1869,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
S_StartSound(toucher, special->info->deathsound); // was NULL, but changed to player so you could hear others pick up rings
|
||||
P_KillMobj(special, NULL, toucher, 0);
|
||||
special->shadowscale = 0;
|
||||
}
|
||||
|
||||
/** Prints death messages relating to a dying or hit player.
|
||||
|
@ -1888,7 +1889,7 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
|
|||
char targetname[MAXPLAYERNAME+4];
|
||||
char sourcename[MAXPLAYERNAME+4];
|
||||
|
||||
if (G_PlatformGametype())
|
||||
if (!(gametyperules & (GTR_RINGSLINGER|GTR_HURTMESSAGES)))
|
||||
return; // Not in coop, etc.
|
||||
|
||||
if (!player)
|
||||
|
@ -2093,7 +2094,7 @@ void P_CheckTimeLimit(void)
|
|||
if (!(multiplayer || netgame))
|
||||
return;
|
||||
|
||||
if (G_PlatformGametype())
|
||||
if (!(gametyperules & GTR_TIMELIMIT))
|
||||
return;
|
||||
|
||||
if (leveltime < timelimitintics)
|
||||
|
@ -2124,7 +2125,7 @@ void P_CheckTimeLimit(void)
|
|||
}
|
||||
|
||||
//Optional tie-breaker for Match/CTF
|
||||
else if (cv_overtime.value)
|
||||
else if ((cv_overtime.value) && (gametyperules & GTR_OVERTIME))
|
||||
{
|
||||
INT32 playerarray[MAXPLAYERS];
|
||||
INT32 tempplayer = 0;
|
||||
|
@ -2206,7 +2207,7 @@ void P_CheckPointLimit(void)
|
|||
if (!(multiplayer || netgame))
|
||||
return;
|
||||
|
||||
if (G_PlatformGametype())
|
||||
if (!(gametyperules & GTR_POINTLIMIT))
|
||||
return;
|
||||
|
||||
// pointlimit is nonzero, check if it's been reached by this player
|
||||
|
@ -2389,7 +2390,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
{
|
||||
if (metalrecording) // Ack! Metal Sonic shouldn't die! Cut the tape, end recording!
|
||||
G_StopMetalRecording(true);
|
||||
if (gametype == GT_MATCH // note, no team match suicide penalty
|
||||
if ((gametyperules & GTR_DEATHPENALTY) // note, no team match suicide penalty
|
||||
&& ((target == source) || (source == NULL && inflictor == NULL) || (source && !source->player)))
|
||||
{ // Suicide penalty
|
||||
if (target->player->score >= 50)
|
||||
|
@ -2481,9 +2482,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
|
||||
P_SetMobjState(scoremobj, scorestate);
|
||||
|
||||
// On ground? No chain starts.
|
||||
if (source->player->powers[pw_invulnerability] || !P_IsObjectOnGround(source))
|
||||
source->player->scoreadd = locscoreadd;
|
||||
source->player->scoreadd = locscoreadd;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2523,7 +2522,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
target->colorized = false;
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
|
||||
if ((target->player->lives <= 1) && (netgame || multiplayer) && (gametype == GT_COOP) && (cv_cooplives.value == 0))
|
||||
if ((target->player->lives <= 1) && (netgame || multiplayer) && G_GametypeUsesCoopLives() && (cv_cooplives.value == 0))
|
||||
;
|
||||
else if (!target->player->bot && !target->player->spectator && (target->player->lives != INFLIVES)
|
||||
&& G_GametypeUsesLives())
|
||||
|
@ -2533,7 +2532,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
if (target->player->lives <= 0) // Tails 03-14-2000
|
||||
{
|
||||
boolean gameovermus = false;
|
||||
if ((netgame || multiplayer) && (gametype == GT_COOP) && (cv_cooplives.value != 1))
|
||||
if ((netgame || multiplayer) && G_GametypeUsesCoopLives() && (cv_cooplives.value != 1))
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
|
@ -2962,7 +2961,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
Graue 12-22-2003 */
|
||||
}
|
||||
|
||||
static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
||||
static void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
tic_t oldnightstime = player->nightstime;
|
||||
|
@ -2978,7 +2977,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
|||
player->flyangle += 180; // Shuffle's BETTERNIGHTSMOVEMENT?
|
||||
player->flyangle %= 360;
|
||||
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
if (gametyperules & GTR_RACE)
|
||||
player->drillmeter -= 5*20;
|
||||
else
|
||||
{
|
||||
|
@ -3005,9 +3004,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
|||
P_SetPlayerMobjState(target, S_PLAY_NIGHTS_STUN);
|
||||
S_StartSound(target, sfx_nghurt);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
player->mo->rollangle = 0;
|
||||
#endif
|
||||
|
||||
if (oldnightstime > 10*TICRATE
|
||||
&& player->nightstime < 10*TICRATE)
|
||||
|
@ -3028,7 +3025,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
|||
}
|
||||
}
|
||||
|
||||
static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
(void)damage; //unused parm
|
||||
|
@ -3042,7 +3039,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
|||
return false;
|
||||
|
||||
// Ignore IT players shooting each other, unless friendlyfire is on.
|
||||
if ((player->pflags & PF_TAGIT && !((cv_friendlyfire.value || (damagetype & DMG_CANHURTSELF)) &&
|
||||
if ((player->pflags & PF_TAGIT && !((cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) &&
|
||||
source && source->player && source->player->pflags & PF_TAGIT)))
|
||||
{
|
||||
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
|
||||
|
@ -3058,7 +3055,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
|||
|
||||
// Don't allow players on the same team to hurt one another,
|
||||
// unless cv_friendlyfire is on.
|
||||
if (!(cv_friendlyfire.value || (damagetype & DMG_CANHURTSELF)) && (player->pflags & PF_TAGIT) == (source->player->pflags & PF_TAGIT))
|
||||
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) && (player->pflags & PF_TAGIT) == (source->player->pflags & PF_TAGIT))
|
||||
{
|
||||
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
|
||||
{
|
||||
|
@ -3132,7 +3129,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
|||
return true;
|
||||
}
|
||||
|
||||
static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
|
||||
|
@ -3143,7 +3140,7 @@ static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj
|
|||
return false;
|
||||
|
||||
// In COOP/RACE, you can't hurt other players unless cv_friendlyfire is on
|
||||
if (!cv_friendlyfire.value && (G_PlatformGametype()))
|
||||
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && (G_PlatformGametype()))
|
||||
{
|
||||
if (gametype == GT_COOP && inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) // co-op only
|
||||
{
|
||||
|
@ -3166,7 +3163,7 @@ static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj
|
|||
{
|
||||
// Don't allow players on the same team to hurt one another,
|
||||
// unless cv_friendlyfire is on.
|
||||
if (!cv_friendlyfire.value && target->player->ctfteam == source->player->ctfteam)
|
||||
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && target->player->ctfteam == source->player->ctfteam)
|
||||
{
|
||||
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
|
||||
{
|
||||
|
@ -3203,10 +3200,12 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
|
|||
player->powers[pw_carry] = CR_NONE;
|
||||
|
||||
// Burst weapons and emeralds in Match/CTF only
|
||||
if (source && (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF))
|
||||
if (source)
|
||||
{
|
||||
P_PlayerRingBurst(player, player->rings);
|
||||
P_PlayerEmeraldBurst(player, false);
|
||||
if ((gametyperules & GTR_RINGSLINGER) && !(gametyperules & GTR_TAG))
|
||||
P_PlayerRingBurst(player, player->rings);
|
||||
if (gametyperules & GTR_POWERSTONES)
|
||||
P_PlayerEmeraldBurst(player, false);
|
||||
}
|
||||
|
||||
// Get rid of shield
|
||||
|
@ -3224,7 +3223,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
|
|||
player->mo->flags2 &= ~MF2_DONTDRAW;
|
||||
|
||||
P_SetPlayerMobjState(player->mo, player->mo->info->deathstate);
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
{
|
||||
P_PlayerFlagBurst(player, false);
|
||||
if (source && source->player)
|
||||
|
@ -3349,7 +3348,7 @@ static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source,
|
|||
else
|
||||
S_StartSound (player->mo, sfx_shldls); // Ba-Dum! Shield loss.
|
||||
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
{
|
||||
P_PlayerFlagBurst(player, false);
|
||||
if (source && source->player)
|
||||
|
@ -3383,7 +3382,7 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
|
|||
P_AddPlayerScore(source->player, 50);
|
||||
}
|
||||
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
{
|
||||
P_PlayerFlagBurst(player, false);
|
||||
if (source && source->player)
|
||||
|
@ -3426,6 +3425,24 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super])
|
||||
return;
|
||||
|
||||
if (!cv_friendlyfire.value)
|
||||
{
|
||||
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
|
||||
{
|
||||
if (player->revitem != MT_LHRT && player->spinitem != MT_LHRT && player->thokitem != MT_LHRT) // Healers do not get to heal other healers.
|
||||
{
|
||||
P_SwitchShield(player, SH_PINK);
|
||||
S_StartSound(player->mo, mobjinfo[MT_PITY_ICON].seesound);
|
||||
}
|
||||
}
|
||||
|
||||
if (source->player->ctfteam == player->ctfteam)
|
||||
return;
|
||||
}
|
||||
|
||||
if (inflictor->type == MT_LHRT)
|
||||
return;
|
||||
|
||||
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
|
||||
{
|
||||
P_RemoveShield(player);
|
||||
|
@ -3442,7 +3459,7 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
|
||||
P_DoPlayerPain(player, inflictor, source);
|
||||
|
||||
if (gametype == GT_CTF && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))
|
||||
P_PlayerFlagBurst(player, false);
|
||||
|
||||
if (oldnightstime > 10*TICRATE
|
||||
|
@ -3593,7 +3610,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
{
|
||||
if (source == target)
|
||||
return false; // Don't hit yourself with your own paraloop, baka
|
||||
if (source && source->player && !cv_friendlyfire.value
|
||||
if (source && source->player && !(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE))
|
||||
&& (gametype == GT_COOP
|
||||
|| (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam)))
|
||||
return false; // Don't run eachother over in special stages and team games and such
|
||||
|
@ -3688,7 +3705,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
// by friendly fire. Spilling their rings and other items is enough.
|
||||
else if (!force && G_GametypeHasTeams()
|
||||
&& source && source->player && (source->player->ctfteam == player->ctfteam)
|
||||
&& cv_friendlyfire.value)
|
||||
&& (cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)))
|
||||
{
|
||||
damage = 0;
|
||||
P_ShieldDamage(player, inflictor, source, damage, damagetype);
|
||||
|
|
|
@ -115,10 +115,14 @@ typedef struct camera_s
|
|||
|
||||
extern camera_t camera, camera2;
|
||||
extern consvar_t cv_cam_dist, cv_cam_still, cv_cam_height;
|
||||
extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed, cv_cam_orbit, cv_cam_adjust;
|
||||
extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed, cv_cam_turnmultiplier, cv_cam_orbit, cv_cam_adjust;
|
||||
|
||||
extern consvar_t cv_cam2_dist, cv_cam2_still, cv_cam2_height;
|
||||
extern consvar_t cv_cam2_speed, cv_cam2_rotate, cv_cam2_rotspeed, cv_cam2_orbit, cv_cam2_adjust;
|
||||
extern consvar_t cv_cam2_speed, cv_cam2_rotate, cv_cam2_rotspeed, cv_cam2_turnmultiplier, cv_cam2_orbit, cv_cam2_adjust;
|
||||
|
||||
extern consvar_t cv_cam_savedist[2][2], cv_cam_saveheight[2][2];
|
||||
void CV_UpdateCamDist(void);
|
||||
void CV_UpdateCam2Dist(void);
|
||||
|
||||
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
|
||||
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
|
||||
|
@ -181,16 +185,14 @@ fixed_t P_ReturnThrustX(mobj_t *mo, angle_t angle, fixed_t move);
|
|||
fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move);
|
||||
void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move);
|
||||
|
||||
mobj_t *P_LookForFocusTarget(player_t *player, mobj_t *exclude, SINT8 direction, UINT8 lockonflags);
|
||||
|
||||
mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet);
|
||||
void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius);
|
||||
boolean P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user
|
||||
boolean P_SuperReady(player_t *player);
|
||||
void P_DoJump(player_t *player, boolean soundandstate);
|
||||
#if 0
|
||||
boolean P_AnalogMove(player_t *player);
|
||||
#else
|
||||
#define P_AnalogMove(player) (player->pflags & PF_ANALOGMODE)
|
||||
#endif
|
||||
#define P_AnalogMove(player) (P_ControlStyle(player) == CS_LMAOGALOG)
|
||||
boolean P_TransferToNextMare(player_t *player);
|
||||
UINT8 P_FindLowestMare(void);
|
||||
void P_FindEmerald(void);
|
||||
|
|
52
src/p_map.c
52
src/p_map.c
|
@ -377,7 +377,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
{
|
||||
object->angle = object->player->drawangle = spring->angle;
|
||||
|
||||
if (!demoplayback || P_AnalogMove(object->player))
|
||||
if (!demoplayback || P_ControlStyle(object->player) == CS_LMAOGALOG)
|
||||
{
|
||||
if (object->player == &players[consoleplayer])
|
||||
localangle = spring->angle;
|
||||
|
@ -426,7 +426,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
object->player->pflags |= pflags;
|
||||
object->player->secondjump = secondjump;
|
||||
}
|
||||
else if (object->player->dashmode >= 3*TICRATE)
|
||||
else if (object->player->dashmode >= DASHMODE_THRESHOLD)
|
||||
P_SetPlayerMobjState(object, S_PLAY_DASH);
|
||||
else if (P_IsObjectOnGround(object) && horizspeed >= FixedMul(object->player->runspeed, object->scale))
|
||||
P_SetPlayerMobjState(object, S_PLAY_RUN);
|
||||
|
@ -615,7 +615,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
|
|||
// Why block opposing teams from tailsflying each other?
|
||||
// Sneaking into the hands of a flying tails player in Race might be a viable strategy, who knows.
|
||||
/*
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION
|
||||
if ((gametyperules & GTR_RACE)
|
||||
|| (netgame && (tails->spectator || sonic->spectator))
|
||||
|| (G_TagGametype() && (!(tails->pflags & PF_TAGIT) != !(sonic->pflags & PF_TAGIT)))
|
||||
|| (gametype == GT_MATCH)
|
||||
|
@ -632,7 +632,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
|
|||
&& P_MobjFlip(tails->mo)*sonic->mo->momz <= 0)
|
||||
{
|
||||
if (sonic-players == consoleplayer && botingame)
|
||||
CV_SetValue(&cv_analog2, false);
|
||||
CV_SetValue(&cv_analog[1], false);
|
||||
P_ResetPlayer(sonic);
|
||||
P_SetTarget(&sonic->mo->tracer, tails->mo);
|
||||
sonic->powers[pw_carry] = CR_PLAYER;
|
||||
|
@ -644,7 +644,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
|
|||
}
|
||||
else {
|
||||
if (sonic-players == consoleplayer && botingame)
|
||||
CV_SetValue(&cv_analog2, true);
|
||||
CV_SetValue(&cv_analog[1], true);
|
||||
P_SetTarget(&sonic->mo->tracer, NULL);
|
||||
sonic->powers[pw_carry] = CR_NONE;
|
||||
}
|
||||
|
@ -745,9 +745,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
// So that NOTHING ELSE can see MT_NAMECHECK because it is client-side.
|
||||
if (tmthing->type == MT_NAMECHECK)
|
||||
{
|
||||
// Ignore things that aren't players, ignore spectators, ignore yourself.
|
||||
// (also don't bother to check that tmthing->target->player is non-NULL because we're not actually using it here.)
|
||||
if (!thing->player || thing->player->spectator || (tmthing->target && thing->player == tmthing->target->player))
|
||||
// Ignore things that aren't players, ignore spectators, ignore yourself.
|
||||
if (!thing->player || !(tmthing->target && tmthing->target->player) || thing->player->spectator || (tmthing->target && thing->player == tmthing->target->player))
|
||||
return true;
|
||||
|
||||
// Now check that you actually hit them.
|
||||
|
@ -760,6 +759,12 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (tmthing->z + tmthing->height < thing->z)
|
||||
return true; // underneath
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// REX HAS SEEN YOU
|
||||
if (!LUAh_SeenPlayer(tmthing->target->player, thing->player))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
seenplayer = thing->player;
|
||||
return false;
|
||||
}
|
||||
|
@ -801,7 +806,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
// SF_DASHMODE users destroy spikes and monitors, CA_TWINSPIN users and CA2_MELEE users destroy spikes.
|
||||
if ((tmthing->player)
|
||||
&& (((tmthing->player->charflags & SF_DASHMODE) && (tmthing->player->dashmode >= 3*TICRATE)
|
||||
&& ((((tmthing->player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)) && (tmthing->player->dashmode >= DASHMODE_THRESHOLD)
|
||||
&& (thing->flags & (MF_MONITOR)
|
||||
|| (thing->type == MT_SPIKE
|
||||
|| thing->type == MT_WALLSPIKE)))
|
||||
|
@ -829,13 +834,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
for (iter = thing->subsector->sector->thinglist; iter; iter = iter->snext)
|
||||
if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || P_AproxDistance(P_AproxDistance(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale))
|
||||
P_KillMobj(iter, tmthing, tmthing, 0);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
thing->health = 0;
|
||||
P_KillMobj(thing, tmthing, tmthing, 0);
|
||||
if (P_DamageMobj(thing, tmthing, tmthing, 1, 0))
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// vectorise metal - done in a special case as at this point neither has the right flags for touching
|
||||
|
@ -995,7 +1000,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (thing->type == MT_SALOONDOOR && tmthing->player)
|
||||
{
|
||||
mobj_t *ref = (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)) ? tmthing->tracer : tmthing;
|
||||
if ((thing->flags & MF2_AMBUSH) || ref != tmthing)
|
||||
if ((thing->flags2 & MF2_AMBUSH) || ref != tmthing)
|
||||
{
|
||||
fixed_t dm = min(FixedHypot(ref->momx, ref->momy), 16*FRACUNIT);
|
||||
angle_t ang = R_PointToAngle2(0, 0, ref->momx, ref->momy) - thing->angle;
|
||||
|
@ -1008,7 +1013,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
if (thing->type == MT_SALOONDOORCENTER && tmthing->player)
|
||||
{
|
||||
if ((thing->flags & MF2_AMBUSH) || (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)))
|
||||
if ((thing->flags2 & MF2_AMBUSH) || (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1322,7 +1327,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
thing->angle = tmthing->angle;
|
||||
|
||||
if (!demoplayback || P_AnalogMove(thing->player))
|
||||
if (!demoplayback || P_ControlStyle(thing->player) == CS_LMAOGALOG)
|
||||
{
|
||||
if (thing->player == &players[consoleplayer])
|
||||
localangle = thing->angle;
|
||||
|
@ -1621,7 +1626,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
}
|
||||
else if (thing->player) {
|
||||
if (thing->player-players == consoleplayer && botingame)
|
||||
CV_SetValue(&cv_analog2, true);
|
||||
CV_SetValue(&cv_analog[1], true);
|
||||
if (thing->player->powers[pw_carry] == CR_PLAYER)
|
||||
{
|
||||
P_SetTarget(&thing->tracer, NULL);
|
||||
|
@ -1943,6 +1948,19 @@ static boolean PIT_CheckLine(line_t *ld)
|
|||
|
||||
// this line is out of the if so upper and lower textures can be hit by a splat
|
||||
blockingline = ld;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjLineCollide(tmthing, blockingline); // checks hook for thing's type
|
||||
if (P_MobjWasRemoved(tmthing))
|
||||
return true; // one of them was removed???
|
||||
if (shouldCollide == 1)
|
||||
return false; // force collide
|
||||
else if (shouldCollide == 2)
|
||||
return true; // force no collide
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!ld->backsector) // one sided line
|
||||
{
|
||||
if (P_PointOnLineSide(tmthing->x, tmthing->y, ld))
|
||||
|
@ -3491,7 +3509,7 @@ isblocking:
|
|||
&& canclimb)
|
||||
{
|
||||
slidemo->angle = climbangle;
|
||||
/*if (!demoplayback || P_AnalogMove(slidemo->player))
|
||||
/*if (!demoplayback || P_ControlStyle(slidemo->player) == CS_LMAOGALOG)
|
||||
{
|
||||
if (slidemo->player == &players[consoleplayer])
|
||||
localangle = slidemo->angle;
|
||||
|
|
|
@ -78,68 +78,37 @@ void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result)
|
|||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// P_ClosestPointOnLine3D
|
||||
// Finds the closest point on a given line to the supplied point IN 3D!!!
|
||||
//
|
||||
void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result)
|
||||
/// Similar to FV3_ClosestPointOnLine() except it actually works.
|
||||
void P_ClosestPointOnLine3D(const vector3_t *p, const vector3_t *Line, vector3_t *result)
|
||||
{
|
||||
fixed_t startx = line->v1->x;
|
||||
fixed_t starty = line->v1->y;
|
||||
fixed_t startz = line->v1->z;
|
||||
fixed_t dx = line->dx;
|
||||
fixed_t dy = line->dy;
|
||||
fixed_t dz = line->v2->z - line->v1->z;
|
||||
const vector3_t* v1 = &Line[0];
|
||||
const vector3_t* v2 = &Line[1];
|
||||
vector3_t c, V, n;
|
||||
fixed_t t, d;
|
||||
FV3_SubEx(v2, v1, &V);
|
||||
FV3_SubEx(p, v1, &c);
|
||||
|
||||
// Determine t (the length of the vector from <20>Line[0]<5D> to <20>p<EFBFBD>)
|
||||
fixed_t cx, cy, cz;
|
||||
fixed_t vx, vy, vz;
|
||||
fixed_t magnitude;
|
||||
fixed_t t;
|
||||
d = R_PointToDist2(0, v2->z, R_PointToDist2(v2->x, v2->y, v1->x, v1->y), v1->z);
|
||||
FV3_Copy(&n, &V);
|
||||
FV3_Divide(&n, d);
|
||||
|
||||
//Sub (p, &Line[0], &c);
|
||||
cx = x - startx;
|
||||
cy = y - starty;
|
||||
cz = z - startz;
|
||||
|
||||
//Sub (&Line[1], &Line[0], &V);
|
||||
vx = dx;
|
||||
vy = dy;
|
||||
vz = dz;
|
||||
|
||||
//Normalize (&V, &V);
|
||||
magnitude = R_PointToDist2(0, line->v2->z, R_PointToDist2(line->v2->x, line->v2->y, startx, starty), startz);
|
||||
vx = FixedDiv(vx, magnitude);
|
||||
vy = FixedDiv(vy, magnitude);
|
||||
vz = FixedDiv(vz, magnitude);
|
||||
|
||||
t = (FixedMul(vx, cx) + FixedMul(vy, cy) + FixedMul(vz, cz));
|
||||
t = FV3_Dot(&n, &c);
|
||||
|
||||
// Set closest point to the end if it extends past -Red
|
||||
if (t <= 0)
|
||||
{
|
||||
result->x = line->v1->x;
|
||||
result->y = line->v1->y;
|
||||
result->z = line->v1->z;
|
||||
FV3_Copy(result, v1);
|
||||
return;
|
||||
}
|
||||
else if (t >= magnitude)
|
||||
else if (t >= d)
|
||||
{
|
||||
result->x = line->v2->x;
|
||||
result->y = line->v2->y;
|
||||
result->z = line->v2->z;
|
||||
FV3_Copy(result, v2);
|
||||
return;
|
||||
}
|
||||
|
||||
// Return the point between <20>Line[0]<5D> and <20>Line[1]<5D>
|
||||
vx = FixedMul(vx, t);
|
||||
vy = FixedMul(vy, t);
|
||||
vz = FixedMul(vz, t);
|
||||
FV3_Mul(&n, t);
|
||||
|
||||
//Add (&Line[0], &V, out);
|
||||
result->x = startx + vx;
|
||||
result->y = starty + vy;
|
||||
result->z = startz + vz;
|
||||
FV3_AddEx(v1, &n, result);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -674,7 +643,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
delta1 = abs(mobj->z - (bottomheight + ((topheight - bottomheight)/2)));
|
||||
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
|
||||
|
||||
if (delta1 >= delta2 && (rover->flags & FF_INTANGABLEFLATS) != FF_PLATFORM) // thing is below FOF
|
||||
if (delta1 >= delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_PLATFORM) // thing is below FOF
|
||||
{
|
||||
if (bottomheight < opentop) {
|
||||
opentop = bottomheight;
|
||||
|
@ -687,7 +656,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
highceiling = bottomheight;
|
||||
}
|
||||
|
||||
if (delta1 < delta2 && (rover->flags & FF_INTANGABLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF
|
||||
if (delta1 < delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF
|
||||
{
|
||||
if (topheight > openbottom) {
|
||||
openbottom = topheight;
|
||||
|
@ -720,7 +689,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
delta1 = abs(mobj->z - (bottomheight + ((topheight - bottomheight)/2)));
|
||||
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
|
||||
|
||||
if (delta1 >= delta2 && (rover->flags & FF_INTANGABLEFLATS) != FF_PLATFORM) // thing is below FOF
|
||||
if (delta1 >= delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_PLATFORM) // thing is below FOF
|
||||
{
|
||||
if (bottomheight < opentop) {
|
||||
opentop = bottomheight;
|
||||
|
@ -733,7 +702,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
highceiling = bottomheight;
|
||||
}
|
||||
|
||||
if (delta1 < delta2 && (rover->flags & FF_INTANGABLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF
|
||||
if (delta1 < delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF
|
||||
{
|
||||
if (topheight > openbottom) {
|
||||
openbottom = topheight;
|
||||
|
|
|
@ -43,7 +43,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
|
|||
|
||||
FUNCMATH fixed_t P_AproxDistance(fixed_t dx, fixed_t dy);
|
||||
void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result);
|
||||
void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result);
|
||||
void P_ClosestPointOnLine3D(const vector3_t *p, const vector3_t *line, vector3_t *result);
|
||||
INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line);
|
||||
void P_MakeDivline(line_t *li, divline_t *dl);
|
||||
void P_CameraLineOpening(line_t *plinedef);
|
||||
|
|
8832
src/p_mobj.c
8832
src/p_mobj.c
File diff suppressed because it is too large
Load diff
11
src/p_mobj.h
11
src/p_mobj.h
|
@ -279,9 +279,7 @@ typedef struct mobj_s
|
|||
|
||||
// More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
#ifdef ROTSPRITE
|
||||
angle_t rollangle;
|
||||
#endif
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT8 sprite2; // player sprites
|
||||
|
@ -377,6 +375,7 @@ typedef struct mobj_s
|
|||
#endif
|
||||
|
||||
boolean colorized; // Whether the mobj uses the rainbow colormap
|
||||
fixed_t shadowscale; // If this object casts a shadow, and the size relative to radius
|
||||
|
||||
// WARNING: New fields must be added separately to savegame and Lua.
|
||||
} mobj_t;
|
||||
|
@ -402,9 +401,7 @@ typedef struct precipmobj_s
|
|||
|
||||
// More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
#ifdef ROTSPRITE
|
||||
angle_t rollangle;
|
||||
#endif
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT8 sprite2; // player sprites
|
||||
|
@ -456,8 +453,10 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing);
|
|||
void P_MovePlayerToStarpost(INT32 playernum);
|
||||
void P_AfterPlayerSpawn(INT32 playernum);
|
||||
|
||||
void P_SpawnMapThing(mapthing_t *mthing);
|
||||
void P_SpawnHoopsAndRings(mapthing_t *mthing, boolean bonustime);
|
||||
mobj_t *P_SpawnMapThing(mapthing_t *mthing);
|
||||
void P_SpawnHoop(mapthing_t *mthing);
|
||||
void P_SetBonusTime(mobj_t *mobj);
|
||||
void P_SpawnItemPattern(mapthing_t *mthing, boolean bonustime);
|
||||
void P_SpawnHoopOfSomething(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle);
|
||||
void P_SpawnPrecipitation(void);
|
||||
void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, statenum_t nstate, angle_t rotangle, boolean spawncenter);
|
||||
|
|
|
@ -400,6 +400,8 @@ static void Polyobj_findSegs(polyobj_t *po, seg_t *seg)
|
|||
// Find backfacings
|
||||
for (s = 0; s < numsegs; s++)
|
||||
{
|
||||
if (segs[s].glseg)
|
||||
continue;
|
||||
if (segs[s].linedef == seg->linedef
|
||||
&& segs[s].side == 1)
|
||||
{
|
||||
|
@ -436,6 +438,8 @@ newseg:
|
|||
// seg's ending vertex.
|
||||
for (i = 0; i < numsegs; ++i)
|
||||
{
|
||||
if (segs[i].glseg)
|
||||
continue;
|
||||
if (segs[i].side != 0) // needs to be frontfacing
|
||||
continue;
|
||||
if (segs[i].v1->x == seg->v2->x && segs[i].v1->y == seg->v2->y)
|
||||
|
@ -460,6 +464,9 @@ newseg:
|
|||
// Find backfacings
|
||||
for (q = 0; q < numsegs; q++)
|
||||
{
|
||||
if (segs[q].glseg)
|
||||
continue;
|
||||
|
||||
if (segs[q].linedef == segs[i].linedef
|
||||
&& segs[q].side == 1)
|
||||
{
|
||||
|
@ -606,6 +613,9 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
|
|||
INT32 poflags = POF_SOLID|POF_TESTHEIGHT|POF_RENDERSIDES;
|
||||
INT32 parentID = 0, potrans = 0;
|
||||
|
||||
if (seg->glseg)
|
||||
continue;
|
||||
|
||||
if (seg->side != 0) // needs to be frontfacing
|
||||
continue;
|
||||
|
||||
|
@ -1341,9 +1351,9 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
|
|||
if (turnthings == 2 || (turnthings == 1 && !mo->player)) {
|
||||
mo->angle += delta;
|
||||
if (mo->player == &players[consoleplayer])
|
||||
localangle = mo->angle;
|
||||
localangle += delta;
|
||||
else if (mo->player == &players[secondarydisplayplayer])
|
||||
localangle2 = mo->angle;
|
||||
localangle2 += delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1815,6 +1825,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
if (po->thinker == NULL)
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
/*
|
||||
// Find out target first.
|
||||
// We redo this each tic to make savegame compatibility easier.
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
|
@ -1833,6 +1844,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
target = th->target;
|
||||
|
||||
if (!target)
|
||||
{
|
||||
|
@ -2015,6 +2029,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
|
||||
target = waypoint;
|
||||
th->pointnum = target->health;
|
||||
// Set the mobj as your target! -- Monster Iestyn 27/12/19
|
||||
P_SetTarget(&th->target, target);
|
||||
|
||||
// calculate MOMX/MOMY/MOMZ for next waypoint
|
||||
// change slope
|
||||
|
@ -2641,6 +2657,9 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
|||
|
||||
// Set pointnum
|
||||
th->pointnum = target->health;
|
||||
th->target = NULL; // set to NULL first so the below doesn't go wrong
|
||||
// Set the mobj as your target! -- Monster Iestyn 27/12/19
|
||||
P_SetTarget(&th->target, target);
|
||||
|
||||
// We don't deal with the mirror crap here, we'll
|
||||
// handle that in the T_Thinker function.
|
||||
|
|
|
@ -161,6 +161,8 @@ typedef struct polywaypoint_s
|
|||
fixed_t diffx;
|
||||
fixed_t diffy;
|
||||
fixed_t diffz;
|
||||
|
||||
mobj_t *target; // next waypoint mobj
|
||||
} polywaypoint_t;
|
||||
|
||||
typedef struct polyslidedoor_s
|
||||
|
|
119
src/p_saveg.c
119
src/p_saveg.c
|
@ -779,14 +779,13 @@ static void P_NetArchiveWorld(void)
|
|||
size_t i;
|
||||
INT32 statsec = 0, statline = 0;
|
||||
const line_t *li = lines;
|
||||
const line_t *spawnli = spawnlines;
|
||||
const side_t *si;
|
||||
const side_t *spawnsi;
|
||||
UINT8 *put;
|
||||
|
||||
// reload the map just to see difference
|
||||
mapsector_t *ms;
|
||||
mapsidedef_t *msd;
|
||||
maplinedef_t *mld;
|
||||
const sector_t *ss = sectors;
|
||||
const sector_t *spawnss = spawnsectors;
|
||||
UINT8 diff, diff2, diff3;
|
||||
|
||||
// initialize colormap vars because paranoia
|
||||
|
@ -795,65 +794,45 @@ static void P_NetArchiveWorld(void)
|
|||
WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD);
|
||||
put = save_p;
|
||||
|
||||
if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
|
||||
{ // HACK: Open wad file rather quickly so we can get the data from the relevant lumps
|
||||
UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
|
||||
filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
|
||||
#define retrieve_mapdata(d, f)\
|
||||
d = Z_Malloc((f)->size, PU_CACHE, NULL); \
|
||||
M_Memcpy(d, wadData + (f)->filepos, (f)->size)
|
||||
retrieve_mapdata(ms, fileinfo + ML_SECTORS);
|
||||
retrieve_mapdata(mld, fileinfo + ML_LINEDEFS);
|
||||
retrieve_mapdata(msd, fileinfo + ML_SIDEDEFS);
|
||||
#undef retrieve_mapdata
|
||||
Z_Free(wadData); // we're done with this now
|
||||
}
|
||||
else // phew it's just a WAD
|
||||
{
|
||||
ms = W_CacheLumpNum(lastloadedmaplumpnum+ML_SECTORS, PU_CACHE);
|
||||
mld = W_CacheLumpNum(lastloadedmaplumpnum+ML_LINEDEFS, PU_CACHE);
|
||||
msd = W_CacheLumpNum(lastloadedmaplumpnum+ML_SIDEDEFS, PU_CACHE);
|
||||
}
|
||||
|
||||
for (i = 0; i < numsectors; i++, ss++, ms++)
|
||||
for (i = 0; i < numsectors; i++, ss++, spawnss++)
|
||||
{
|
||||
diff = diff2 = diff3 = 0;
|
||||
if (ss->floorheight != SHORT(ms->floorheight)<<FRACBITS)
|
||||
if (ss->floorheight != spawnss->floorheight)
|
||||
diff |= SD_FLOORHT;
|
||||
if (ss->ceilingheight != SHORT(ms->ceilingheight)<<FRACBITS)
|
||||
if (ss->ceilingheight != spawnss->ceilingheight)
|
||||
diff |= SD_CEILHT;
|
||||
//
|
||||
// flats
|
||||
//
|
||||
if (ss->floorpic != P_CheckLevelFlat(ms->floorpic))
|
||||
if (ss->floorpic != spawnss->floorpic)
|
||||
diff |= SD_FLOORPIC;
|
||||
if (ss->ceilingpic != P_CheckLevelFlat(ms->ceilingpic))
|
||||
if (ss->ceilingpic != spawnss->ceilingpic)
|
||||
diff |= SD_CEILPIC;
|
||||
|
||||
if (ss->lightlevel != SHORT(ms->lightlevel))
|
||||
if (ss->lightlevel != spawnss->lightlevel)
|
||||
diff |= SD_LIGHT;
|
||||
if (ss->special != SHORT(ms->special))
|
||||
if (ss->special != spawnss->special)
|
||||
diff |= SD_SPECIAL;
|
||||
|
||||
if (ss->floor_xoffs != ss->spawn_flr_xoffs)
|
||||
if (ss->floor_xoffs != spawnss->floor_xoffs)
|
||||
diff2 |= SD_FXOFFS;
|
||||
if (ss->floor_yoffs != ss->spawn_flr_yoffs)
|
||||
if (ss->floor_yoffs != spawnss->floor_yoffs)
|
||||
diff2 |= SD_FYOFFS;
|
||||
if (ss->ceiling_xoffs != ss->spawn_ceil_xoffs)
|
||||
if (ss->ceiling_xoffs != spawnss->ceiling_xoffs)
|
||||
diff2 |= SD_CXOFFS;
|
||||
if (ss->ceiling_yoffs != ss->spawn_ceil_yoffs)
|
||||
if (ss->ceiling_yoffs != spawnss->ceiling_yoffs)
|
||||
diff2 |= SD_CYOFFS;
|
||||
if (ss->floorpic_angle != ss->spawn_flrpic_angle)
|
||||
if (ss->floorpic_angle != spawnss->floorpic_angle)
|
||||
diff2 |= SD_FLOORANG;
|
||||
if (ss->ceilingpic_angle != ss->spawn_flrpic_angle)
|
||||
if (ss->ceilingpic_angle != spawnss->ceilingpic_angle)
|
||||
diff2 |= SD_CEILANG;
|
||||
|
||||
if (ss->tag != SHORT(ms->tag))
|
||||
if (ss->tag != spawnss->tag)
|
||||
diff2 |= SD_TAG;
|
||||
if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag)
|
||||
if (ss->nexttag != spawnss->nexttag || ss->firsttag != spawnss->firsttag)
|
||||
diff3 |= SD_TAGLIST;
|
||||
|
||||
if (ss->extra_colormap != ss->spawn_extra_colormap)
|
||||
if (ss->extra_colormap != spawnss->extra_colormap)
|
||||
diff3 |= SD_COLORMAP;
|
||||
|
||||
// Check if any of the sector's FOFs differ from how they spawned
|
||||
|
@ -957,45 +936,41 @@ static void P_NetArchiveWorld(void)
|
|||
WRITEUINT16(put, 0xffff);
|
||||
|
||||
// do lines
|
||||
for (i = 0; i < numlines; i++, mld++, li++)
|
||||
for (i = 0; i < numlines; i++, spawnli++, li++)
|
||||
{
|
||||
diff = diff2 = diff3 = 0;
|
||||
|
||||
if (li->special != SHORT(mld->special))
|
||||
if (li->special != spawnli->special)
|
||||
diff |= LD_SPECIAL;
|
||||
|
||||
if (SHORT(mld->special) == 321 || SHORT(mld->special) == 322) // only reason li->callcount would be non-zero is if either of these are involved
|
||||
if (spawnli->special == 321 || spawnli->special == 322) // only reason li->callcount would be non-zero is if either of these are involved
|
||||
diff |= LD_CLLCOUNT;
|
||||
|
||||
if (li->sidenum[0] != 0xffff)
|
||||
{
|
||||
si = &sides[li->sidenum[0]];
|
||||
if (si->textureoffset != SHORT(msd[li->sidenum[0]].textureoffset)<<FRACBITS)
|
||||
spawnsi = &spawnsides[li->sidenum[0]];
|
||||
if (si->textureoffset != spawnsi->textureoffset)
|
||||
diff |= LD_S1TEXOFF;
|
||||
//SoM: 4/1/2000: Some textures are colormaps. Don't worry about invalid textures.
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[0]].toptexture) != -1
|
||||
&& si->toptexture != R_TextureNumForName(msd[li->sidenum[0]].toptexture))
|
||||
if (si->toptexture != spawnsi->toptexture)
|
||||
diff |= LD_S1TOPTEX;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[0]].bottomtexture) != -1
|
||||
&& si->bottomtexture != R_TextureNumForName(msd[li->sidenum[0]].bottomtexture))
|
||||
if (si->bottomtexture != spawnsi->bottomtexture)
|
||||
diff |= LD_S1BOTTEX;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[0]].midtexture) != -1
|
||||
&& si->midtexture != R_TextureNumForName(msd[li->sidenum[0]].midtexture))
|
||||
if (si->midtexture != spawnsi->midtexture)
|
||||
diff |= LD_S1MIDTEX;
|
||||
}
|
||||
if (li->sidenum[1] != 0xffff)
|
||||
{
|
||||
si = &sides[li->sidenum[1]];
|
||||
if (si->textureoffset != SHORT(msd[li->sidenum[1]].textureoffset)<<FRACBITS)
|
||||
spawnsi = &spawnsides[li->sidenum[1]];
|
||||
if (si->textureoffset != spawnsi->textureoffset)
|
||||
diff2 |= LD_S2TEXOFF;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[1]].toptexture) != -1
|
||||
&& si->toptexture != R_TextureNumForName(msd[li->sidenum[1]].toptexture))
|
||||
if (si->toptexture != spawnsi->toptexture)
|
||||
diff2 |= LD_S2TOPTEX;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[1]].bottomtexture) != -1
|
||||
&& si->bottomtexture != R_TextureNumForName(msd[li->sidenum[1]].bottomtexture))
|
||||
if (si->bottomtexture != spawnsi->bottomtexture)
|
||||
diff2 |= LD_S2BOTTEX;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[1]].midtexture) != -1
|
||||
&& si->midtexture != R_TextureNumForName(msd[li->sidenum[1]].midtexture))
|
||||
if (si->midtexture != spawnsi->midtexture)
|
||||
diff2 |= LD_S2MIDTEX;
|
||||
if (diff2)
|
||||
diff |= LD_DIFF2;
|
||||
|
@ -1279,9 +1254,7 @@ typedef enum
|
|||
MD2_SLOPE = 1<<11,
|
||||
#endif
|
||||
MD2_COLORIZED = 1<<12,
|
||||
#ifdef ROTSPRITE
|
||||
MD2_ROLLANGLE = 1<<13,
|
||||
#endif
|
||||
} mobj_diff2_t;
|
||||
|
||||
typedef enum
|
||||
|
@ -1501,10 +1474,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
#endif
|
||||
if (mobj->colorized)
|
||||
diff2 |= MD2_COLORIZED;
|
||||
#ifdef ROTSPRITE
|
||||
if (mobj->rollangle)
|
||||
diff2 |= MD2_ROLLANGLE;
|
||||
#endif
|
||||
if (diff2 != 0)
|
||||
diff |= MD_MORE;
|
||||
|
||||
|
@ -1669,10 +1640,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
#endif
|
||||
if (diff2 & MD2_COLORIZED)
|
||||
WRITEUINT8(save_p, mobj->colorized);
|
||||
#ifdef ROTSPRITE
|
||||
if (diff2 & MD2_ROLLANGLE)
|
||||
WRITEANGLE(save_p, mobj->rollangle);
|
||||
#endif
|
||||
|
||||
WRITEUINT32(save_p, mobj->mobjnum);
|
||||
}
|
||||
|
@ -2088,6 +2057,7 @@ static void SavePolywaypointThinker(const thinker_t *th, UINT8 type)
|
|||
WRITEFIXED(save_p, ht->diffx);
|
||||
WRITEFIXED(save_p, ht->diffy);
|
||||
WRITEFIXED(save_p, ht->diffz);
|
||||
WRITEUINT32(save_p, SaveMobjnum(ht->target));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2565,7 +2535,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
|
||||
if (mapthings[spawnpointnum].type == 1705 || mapthings[spawnpointnum].type == 1713) // NiGHTS Hoop special case
|
||||
{
|
||||
P_SpawnHoopsAndRings(&mapthings[spawnpointnum], false);
|
||||
P_SpawnHoop(&mapthings[spawnpointnum]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2749,12 +2719,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
#endif
|
||||
if (diff2 & MD2_COLORIZED)
|
||||
mobj->colorized = READUINT8(save_p);
|
||||
#ifdef ROTSPRITE
|
||||
if (diff2 & MD2_ROLLANGLE)
|
||||
mobj->rollangle = READANGLE(save_p);
|
||||
else
|
||||
mobj->rollangle = 0;
|
||||
#endif
|
||||
|
||||
if (diff & MD_REDFLAG)
|
||||
{
|
||||
|
@ -3281,6 +3247,7 @@ static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker)
|
|||
ht->diffx = READFIXED(save_p);
|
||||
ht->diffy = READFIXED(save_p);
|
||||
ht->diffz = READFIXED(save_p);
|
||||
ht->target = LoadMobj(READUINT32(save_p));
|
||||
return &ht->thinker;
|
||||
}
|
||||
|
||||
|
@ -3575,6 +3542,7 @@ static void P_NetUnArchiveThinkers(void)
|
|||
|
||||
case tc_polywaypoint:
|
||||
th = LoadPolywaypointThinker((actionf_p1)T_PolyObjWaypoint);
|
||||
restoreNum = true;
|
||||
break;
|
||||
|
||||
case tc_polyslidedoor:
|
||||
|
@ -3636,9 +3604,9 @@ static void P_NetUnArchiveThinkers(void)
|
|||
if (restoreNum)
|
||||
{
|
||||
executor_t *delay = NULL;
|
||||
polywaypoint_t *polywp = NULL;
|
||||
UINT32 mobjnum;
|
||||
for (currentthinker = thlist[THINK_MAIN].next; currentthinker != &thlist[THINK_MAIN];
|
||||
currentthinker = currentthinker->next)
|
||||
for (currentthinker = thlist[THINK_MAIN].next; currentthinker != &thlist[THINK_MAIN]; currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay)
|
||||
continue;
|
||||
|
@ -3647,6 +3615,15 @@ static void P_NetUnArchiveThinkers(void)
|
|||
continue;
|
||||
delay->caller = P_FindNewPosition(mobjnum);
|
||||
}
|
||||
for (currentthinker = thlist[THINK_POLYOBJ].next; currentthinker != &thlist[THINK_POLYOBJ]; currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 != (actionf_p1)T_PolyObjWaypoint)
|
||||
continue;
|
||||
polywp = (void *)currentthinker;
|
||||
if (!(mobjnum = (UINT32)(size_t)polywp->target))
|
||||
continue;
|
||||
polywp->target = P_FindNewPosition(mobjnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4101,7 +4078,7 @@ static inline boolean P_NetUnArchiveMisc(void)
|
|||
|
||||
tokenlist = READUINT32(save_p);
|
||||
|
||||
if (!P_SetupLevel(true))
|
||||
if (!P_LoadLevel(true))
|
||||
return false;
|
||||
|
||||
// get the time
|
||||
|
|
3183
src/p_setup.c
3183
src/p_setup.c
File diff suppressed because it is too large
Load diff
|
@ -96,8 +96,11 @@ void P_SetupLevelSky(INT32 skynum, boolean global);
|
|||
#ifdef SCANTHINGS
|
||||
void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
||||
#endif
|
||||
void P_LoadThingsOnly(void);
|
||||
boolean P_SetupLevel(boolean skipprecip);
|
||||
void P_RespawnThings(void);
|
||||
boolean P_LoadLevel(boolean fromnetsave);
|
||||
#ifdef HWRENDER
|
||||
void HWR_SetupLevel(void);
|
||||
#endif
|
||||
boolean P_AddWadFile(const char *wadfilename);
|
||||
boolean P_RunSOC(const char *socfilename);
|
||||
void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue