Merge branch 'next' into keycodes-only

This commit is contained in:
Jaime Ita Passos 2021-07-08 19:14:20 -03:00
commit 4bd5c91b54
308 changed files with 23250 additions and 19051 deletions

4
.gitignore vendored
View file

@ -13,11 +13,11 @@ Win32_LIB_ASM_Release
*.dgb *.dgb
*.debug *.debug
*.debug.txt *.debug.txt
/bin/VC10/
/objs/VC10/
*.user *.user
*.db *.db
*.opendb *.opendb
/.vs /.vs
/debian /debian
/assets/debian /assets/debian
/make
/bin

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.13)
# Enable CCache early # Enable CCache early
set(SRB2_USE_CCACHE OFF CACHE BOOL "Use CCache") set(SRB2_USE_CCACHE OFF CACHE BOOL "Use CCache")
@ -34,12 +34,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
### Useful functions ### Useful functions
# Prepend sources with current source directory # Add sources from Sourcefile
function(prepend_sources SOURCE_FILES) function(target_sourcefile type)
foreach(SOURCE_FILE ${${SOURCE_FILES}}) file(STRINGS Sourcefile list
set(MODIFIED ${MODIFIED} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) REGEX "[-0-9A-Za-z_]+\.${type}")
endforeach() target_sources(SRB2SDL2 PRIVATE ${list})
set(${SOURCE_FILES} ${MODIFIED} PARENT_SCOPE)
endfunction() endfunction()
# Macro to add OSX framework # Macro to add OSX framework

8
Makefile Normal file
View file

@ -0,0 +1,8 @@
ifdef SILENT
MAKEFLAGS+=--no-print-directory
endif
all :
% ::
@$(MAKE) -C src $(MAKECMDGOALS)

View file

@ -1,4 +1,5 @@
# Sonic Robo Blast 2 # Sonic Robo Blast 2
[![latest release](https://badgen.net/github/release/STJr/SRB2/stable)](https://github.com/STJr/SRB2/releases/latest)
[![Build status](https://ci.appveyor.com/api/projects/status/399d4hcw9yy7hg2y?svg=true)](https://ci.appveyor.com/project/STJr/srb2) [![Build status](https://ci.appveyor.com/api/projects/status/399d4hcw9yy7hg2y?svg=true)](https://ci.appveyor.com/project/STJr/srb2)
[![Build status](https://travis-ci.org/STJr/SRB2.svg?branch=master)](https://travis-ci.org/STJr/SRB2) [![Build status](https://travis-ci.org/STJr/SRB2.svg?branch=master)](https://travis-ci.org/STJr/SRB2)

View file

@ -1,16 +1,12 @@
version: 2.2.8.{branch}-{build} version: 2.2.9.{branch}-{build}
os: MinGW os: MinGW
environment: environment:
CC: ccache CC: i686-w64-mingw32-gcc
CCACHE_CC: i686-w64-mingw32-gcc
CCACHE_CC_64: x86_64-w64-mingw32-gcc
WINDRES: windres WINDRES: windres
# c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead # c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead
MINGW_SDK: c:\msys64\mingw32 MINGW_SDK: c:\msys64\mingw32
# c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead CFLAGS: -Wno-implicit-fallthrough
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_ZIP: nasm-2.12.01
NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip
UPX_ZIP: upx391w UPX_ZIP: upx391w
@ -19,8 +15,6 @@ environment:
CCACHE_URL: http://alam.srb2.org/ccache.exe CCACHE_URL: http://alam.srb2.org/ccache.exe
CCACHE_COMPRESS: true CCACHE_COMPRESS: true
CCACHE_DIR: C:\Users\appveyor\.ccache CCACHE_DIR: C:\Users\appveyor\.ccache
# Disable UPX by default. The user can override this in their Appveyor project settings
NOUPX: 1
############################## ##############################
# DEPLOYER VARIABLES # DEPLOYER VARIABLES
# DPL_ENABLED=1 builds installers for branch names starting with `deployer`. # DPL_ENABLED=1 builds installers for branch names starting with `deployer`.
@ -53,11 +47,6 @@ cache:
- C:\Users\appveyor\srb2_cache - C:\Users\appveyor\srb2_cache
install: install:
- if [%CONFIGURATION%] == [SDL64] ( set "X86_64=1" )
- if [%CONFIGURATION%] == [SDL64] ( set "CONFIGURATION=SDL" )
- if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" )
- if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" )
- if not exist "%NASM_ZIP%.zip" appveyor DownloadFile "%NASM_URL%" -FileName "%NASM_ZIP%.zip" - if not exist "%NASM_ZIP%.zip" appveyor DownloadFile "%NASM_URL%" -FileName "%NASM_ZIP%.zip"
- 7z x -y "%NASM_ZIP%.zip" -o%TMP% >null - 7z x -y "%NASM_ZIP%.zip" -o%TMP% >null
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%NASM_ZIP%" "%MINGW_SDK%\bin" nasm.exe || exit 0 - robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%NASM_ZIP%" "%MINGW_SDK%\bin" nasm.exe || exit 0
@ -72,43 +61,31 @@ install:
configuration: configuration:
- SDL - SDL
- SDL64
before_build: before_build:
- set "Path=%MINGW_SDK%\bin;%Path%" - set "Path=%MINGW_SDK%\bin;%Path%"
- if [%X86_64%] == [1] ( x86_64-w64-mingw32-gcc --version ) else ( i686-w64-mingw32-gcc --version )
- mingw32-make --version - mingw32-make --version
- if not [%X86_64%] == [1] ( nasm -v ) - nasm -v
- if not [%NOUPX%] == [1] ( upx -V ) - if not [%NOUPX%] == [1] ( upx -V )
- ccache -V - ccache -V
- ccache -s - ccache -s
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
- if defined [%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%] ( set "COMMIT=%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%" ) else ( set "COMMIT=%APPVEYOR_REPO_COMMIT%" ) - if defined [%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%] ( set "COMMIT=%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%" ) else ( set "COMMIT=%APPVEYOR_REPO_COMMIT%" )
- cmd: git rev-parse --short %COMMIT%>%TMP%/gitshort.txt - cmd: git rev-parse --short %COMMIT%>%TMP%/gitshort.txt
- cmd: set /P GITSHORT=<%TMP%/gitshort.txt - cmd: set /P GITSHORT=<%TMP%/gitshort.txt
# for pull requests, take the owner's name only, if this isn't the same repo of course # for pull requests, take the owner's name only, if this isn't the same repo of course
- set "REPO=%APPVEYOR_REPO_BRANCH%" - set "REPO=%APPVEYOR_REPO_BRANCH%"
- if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [] ( if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [%APPVEYOR_REPO_NAME%] ( for /f "delims=/" %%a in ("%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%") do set "REPO=%%a-%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%" ) ) - if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [] ( if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [%APPVEYOR_REPO_NAME%] ( for /f "delims=/" %%a in ("%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%") do set "REPO=%%a-%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%" ) )
- set "EXENAME=EXENAME=srb2win-%REPO%-%GITSHORT%.exe" - set "SRB2_MFLAGS=-C src NOECHOFILENAMES=1 CCACHE=1 EXENAME=srb2win-%REPO%-%GITSHORT%.exe"
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 NOOBJDUMP=1 %NOUPX% %EXENAME%"
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1 GCC81=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" )
- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"
build_script: build_script:
- cmd: mingw32-make.exe %SRB2_MFLAGS% clean - cmd: mingw32-make.exe %SRB2_MFLAGS% clean
- cmd: mingw32-make.exe %SRB2_MFLAGS% ERRORMODE=1 -k - cmd: mingw32-make.exe %SRB2_MFLAGS% ERRORMODE=1 -k
after_build: after_build:
- if [%X86_64%] == [1] (
set "BUILD_PATH=bin\Mingw64\Release"
) else (
set "BUILD_PATH=bin\Mingw\Release"
)
- if [%X86_64%] == [1] ( set "CONFIGURATION=%CONFIGURATION%64" )
- ccache -s - ccache -s
- set BUILD_ARCHIVE=%REPO%-%GITSHORT%-%CONFIGURATION%.7z - set BUILD_ARCHIVE=%REPO%-%GITSHORT%-%CONFIGURATION%.7z
- set BUILDSARCHIVE=%REPO%-%CONFIGURATION%.7z - set BUILDSARCHIVE=%REPO%-%CONFIGURATION%.7z
- cmd: 7z a %BUILD_ARCHIVE% %BUILD_PATH% -xr!.gitignore - cmd: 7z a %BUILD_ARCHIVE% bin -xr!.gitignore
- appveyor PushArtifact %BUILD_ARCHIVE% - appveyor PushArtifact %BUILD_ARCHIVE%
#- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE% #- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE%
#- appveyor PushArtifact %BUILDSARCHIVE% #- appveyor PushArtifact %BUILDSARCHIVE%
@ -139,3 +116,4 @@ test: off
on_finish: on_finish:
#- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:<ip>:<port> #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:<ip>:<port>
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) #- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# vim: et ts=1

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1 +0,0 @@
/lsdlsrb2

View file

@ -1,3 +0,0 @@
/lsdlsrb2
/pnd
/*.mo

View file

@ -1 +0,0 @@
/lsdlsrb2

View file

@ -1 +0,0 @@
/lsdlsrb2

View file

@ -1,3 +0,0 @@
*.exe
*.mo
r_opengl.dll

View file

@ -1,4 +0,0 @@
*.exe
*.mo
r_opengl.dll
*.bat

View file

@ -1,3 +0,0 @@
/srb2sdl.exe
/srb2win.exe
/r_opengl.dll

View file

@ -1,3 +0,0 @@
/srb2sdl.exe
/srb2win.exe
/r_opengl.dll

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/VC/.gitignore vendored
View file

@ -1,2 +0,0 @@
/Release
/Debug

2
bin/VC9/.gitignore vendored
View file

@ -1,2 +0,0 @@
/Win32
/x64

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -640,6 +640,39 @@ linedeftypes
prefix = "(63)"; prefix = "(63)";
} }
96
{
title = "Apply Tag to Tagged Sectors";
prefix = "(96)";
flags1024text = "[10] Offsets are target tags";
flags8192text = "[13] Use front side offsets";
flags32768text = "[15] Use back side offsets";
}
97
{
title = "Apply Tag to Front Sector";
prefix = "(97)";
flags8192text = "[13] Use front side offsets";
flags32768text = "[15] Use back side offsets";
}
98
{
title = "Apply Tag to Back Sector";
prefix = "(98)";
flags8192text = "[13] Use front side offsets";
flags32768text = "[15] Use back side offsets";
}
99
{
title = "Apply Tag to Front and Back Sectors";
prefix = "(99)";
flags8192text = "[13] Use front side offsets";
flags32768text = "[15] Use back side offsets";
}
540 540
{ {
title = "Floor Friction"; title = "Floor Friction";
@ -746,13 +779,13 @@ linedeftypes
20 20
{ {
title = "First Line"; title = "PolyObject First Line";
prefix = "(20)"; prefix = "(20)";
} }
22 22
{ {
title = "Parameters"; title = "PolyObject Parameters";
prefix = "(22)"; prefix = "(22)";
flags8text = "[3] Set translucency by X offset"; flags8text = "[3] Set translucency by X offset";
flags32text = "[5] Render outer sides only"; flags32text = "[5] Render outer sides only";
@ -765,19 +798,19 @@ linedeftypes
30 30
{ {
title = "Waving Flag"; title = "PolyObject Waving Flag";
prefix = "(30)"; prefix = "(30)";
} }
31 31
{ {
title = "Displacement by Front Sector"; title = "Move PolyObject by Front Sector Displacement";
prefix = "(31)"; prefix = "(31)";
} }
32 32
{ {
title = "Angular Displacement by Front Sector"; title = "Rotate PolyObject by Front Sector Displacement";
prefix = "(32)"; prefix = "(32)";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
flags512text = "[9] Turn all objects"; flags512text = "[9] Turn all objects";
@ -2498,35 +2531,35 @@ linedeftypes
480 480
{ {
title = "Door Slide"; title = "PolyObject Door Slide";
prefix = "(480)"; prefix = "(480)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
} }
481 481
{ {
title = "Door Swing"; title = "PolyObject Door Swing";
prefix = "(481)"; prefix = "(481)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
} }
482 482
{ {
title = "Move"; title = "Move PolyObject";
prefix = "(482)"; prefix = "(482)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
} }
483 483
{ {
title = "Move, Override"; title = "Move PolyObject, Override";
prefix = "(483)"; prefix = "(483)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
} }
484 484
{ {
title = "Rotate Right"; title = "Rotate PolyObject Right";
prefix = "(484)"; prefix = "(484)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
@ -2535,7 +2568,7 @@ linedeftypes
485 485
{ {
title = "Rotate Right, Override"; title = "Rotate PolyObject Right, Override";
prefix = "(485)"; prefix = "(485)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
@ -2544,7 +2577,7 @@ linedeftypes
486 486
{ {
title = "Rotate Left"; title = "Rotate PolyObject Left";
prefix = "(486)"; prefix = "(486)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
@ -2553,7 +2586,7 @@ linedeftypes
487 487
{ {
title = "Rotate Left, Override"; title = "Rotate PolyObject Left, Override";
prefix = "(487)"; prefix = "(487)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
@ -2562,7 +2595,7 @@ linedeftypes
488 488
{ {
title = "Move by Waypoints"; title = "Move PolyObject by Waypoints";
prefix = "(488)"; prefix = "(488)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags32text = "[5] Reverse order"; flags32text = "[5] Reverse order";
@ -2573,7 +2606,7 @@ linedeftypes
489 489
{ {
title = "Turn Invisible, Intangible"; title = "Turn PolyObject Invisible, Intangible";
prefix = "(489)"; prefix = "(489)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Only invisible"; flags64text = "[6] Only invisible";
@ -2581,7 +2614,7 @@ linedeftypes
490 490
{ {
title = "Turn Visible, Tangible"; title = "Turn PolyObject Visible, Tangible";
prefix = "(490)"; prefix = "(490)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Only visible"; flags64text = "[6] Only visible";
@ -2589,7 +2622,7 @@ linedeftypes
491 491
{ {
title = "Set Translucency"; title = "Set PolyObject Translucency";
prefix = "(491)"; prefix = "(491)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags16text = "[4] Set raw alpha by Front X"; flags16text = "[4] Set raw alpha by Front X";
@ -2598,7 +2631,7 @@ linedeftypes
492 492
{ {
title = "Fade Translucency"; title = "Fade PolyObject Translucency";
prefix = "(492)"; prefix = "(492)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags16text = "[4] Set raw alpha by Front X"; flags16text = "[4] Set raw alpha by Front X";
@ -3059,6 +3092,78 @@ linedeftypes
slopeargs = 3; slopeargs = 3;
} }
723
{
title = "Copy Backside Floor Slope from Line Tag";
prefix = "(720)";
slope = "copy";
slopeargs = 4;
}
724
{
title = "Copy Backside Ceiling Slope from Line Tag";
prefix = "(721)";
slope = "copy";
slopeargs = 8;
}
725
{
title = "Copy Backside Floor and Ceiling Slope from Line Tag";
prefix = "(722)";
slope = "copy";
slopeargs = 12;
}
730
{
title = "Copy Frontside Floor Slope to Backside";
prefix = "(730)";
slope = "copy";
copyslopeargs = 1;
}
731
{
title = "Copy Frontside Ceiling Slope to Backside";
prefix = "(731)";
slope = "copy";
copyslopeargs = 4;
}
732
{
title = "Copy Frontside Floor and Ceiling Slope to Backside";
prefix = "(732)";
slope = "copy";
copyslopeargs = 5;
}
733
{
title = "Copy Backside Floor Slope to Frontside";
prefix = "(733)";
slope = "copy";
copyslopeargs = 2;
}
734
{
title = "Copy Backside Ceiling Slope to Frontside";
prefix = "(734)";
slope = "copy";
copyslopeargs = 8;
}
735
{
title = "Copy Backside Floor and Ceiling Slope to Frontside";
prefix = "(735)";
slope = "copy";
copyslopeargs = 10;
}
799 799
{ {
title = "Set Tagged Dynamic Slope Vertex to Front Sector Height"; title = "Set Tagged Dynamic Slope Vertex to Front Sector Height";
@ -3393,6 +3498,7 @@ thingtypes
width = 8; width = 8;
height = 28; height = 28;
angletext = "Jump strength"; angletext = "Jump strength";
fixedrotation = 1;
} }
103 103
{ {
@ -3431,6 +3537,7 @@ thingtypes
width = 12; width = 12;
height = 64; height = 64;
angletext = "Firing delay"; angletext = "Firing delay";
fixedrotation = 1;
} }
122 122
{ {
@ -3482,6 +3589,7 @@ thingtypes
sprite = "ARCHA1"; sprite = "ARCHA1";
width = 24; width = 24;
height = 32; height = 32;
flags8text = "[8] Don't jump away";
} }
118 118
{ {
@ -3547,9 +3655,10 @@ thingtypes
{ {
title = "Pterabyte Spawner"; title = "Pterabyte Spawner";
sprite = "PTERA2A8"; sprite = "PTERA2A8";
width = 16; width = 24;
height = 16; height = 48;
parametertext = "No. Pterabytes"; parametertext = "Spawns +1";
arrow = 0;
} }
136 136
{ {
@ -3771,6 +3880,7 @@ thingtypes
height = 16; height = 16;
sprite = "internal:capsule"; sprite = "internal:capsule";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
292 292
{ {
@ -3781,11 +3891,13 @@ thingtypes
flags8text = "[8] Sea Egg shooting point"; flags8text = "[8] Sea Egg shooting point";
sprite = "internal:eggmanway"; sprite = "internal:eggmanway";
angletext = "No. (Sea Egg)"; angletext = "No. (Sea Egg)";
fixedrotation = 1;
flagsvaluetext = "No. (Brak)"; flagsvaluetext = "No. (Brak)";
parametertext = "Next"; parametertext = "Next";
} }
293 293
{ {
arrow = 0;
title = "Metal Sonic Gather Point"; title = "Metal Sonic Gather Point";
sprite = "internal:metal"; sprite = "internal:metal";
width = 8; width = 8;
@ -3793,6 +3905,7 @@ thingtypes
} }
294 294
{ {
arrow = 0;
title = "Fang Waypoint"; title = "Fang Waypoint";
flags8text = "[8] Center waypoint"; flags8text = "[8] Center waypoint";
sprite = "internal:eggmanway"; sprite = "internal:eggmanway";
@ -3820,79 +3933,79 @@ thingtypes
301 301
{ {
title = "Bounce Ring"; title = "Bounce Ring";
sprite = "internal:RNGBA0"; sprite = "RNGBA0";
} }
302 302
{ {
title = "Rail Ring"; title = "Rail Ring";
sprite = "internal:RNGRA0"; sprite = "RNGRA0";
} }
303 303
{ {
title = "Infinity Ring"; title = "Infinity Ring";
sprite = "internal:RNGIA0"; sprite = "RNGIA0";
} }
304 304
{ {
title = "Automatic Ring"; title = "Automatic Ring";
sprite = "internal:RNGAA0"; sprite = "RNGAA0";
} }
305 305
{ {
title = "Explosion Ring"; title = "Explosion Ring";
sprite = "internal:RNGEA0"; sprite = "RNGEA0";
} }
306 306
{ {
title = "Scatter Ring"; title = "Scatter Ring";
sprite = "internal:RNGSA0"; sprite = "RNGSA0";
} }
307 307
{ {
title = "Grenade Ring"; title = "Grenade Ring";
sprite = "internal:RNGGA0"; sprite = "RNGGA0";
} }
308 308
{ {
title = "CTF Team Ring (Red)"; title = "CTF Team Ring (Red)";
sprite = "internal:RRNGA0"; sprite = "internal:TRNGA0r";
width = 16; width = 16;
} }
309 309
{ {
title = "CTF Team Ring (Blue)"; title = "CTF Team Ring (Blue)";
sprite = "internal:BRNGA0"; sprite = "internal:TRNGA0b";
width = 16; width = 16;
} }
330 330
{ {
title = "Bounce Ring Panel"; title = "Bounce Ring Panel";
sprite = "internal:PIKBA0"; sprite = "PIKBA0";
} }
331 331
{ {
title = "Rail Ring Panel"; title = "Rail Ring Panel";
sprite = "internal:PIKRA0"; sprite = "PIKRA0";
} }
332 332
{ {
title = "Automatic Ring Panel"; title = "Automatic Ring Panel";
sprite = "internal:PIKAA0"; sprite = "PIKAA0";
} }
333 333
{ {
title = "Explosion Ring Panel"; title = "Explosion Ring Panel";
sprite = "internal:PIKEA0"; sprite = "PIKEA0";
} }
334 334
{ {
title = "Scatter Ring Panel"; title = "Scatter Ring Panel";
sprite = "internal:PIKSA0"; sprite = "PIKSA0";
} }
335 335
{ {
title = "Grenade Ring Panel"; title = "Grenade Ring Panel";
sprite = "internal:PIKGA0"; sprite = "PIKGA0";
} }
} }
@ -3986,6 +4099,7 @@ thingtypes
flags8height = 24; flags8height = 24;
flags8text = "[8] Float"; flags8text = "[8] Float";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
} }
@ -4000,6 +4114,7 @@ thingtypes
flags4text = "[4] Random (Strong)"; flags4text = "[4] Random (Strong)";
flags8text = "[8] Random (Weak)"; flags8text = "[8] Random (Weak)";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
400 400
{ {
@ -4131,6 +4246,7 @@ thingtypes
height = 44; height = 44;
flags1text = "[1] Run linedef executor on pop"; flags1text = "[1] Run linedef executor on pop";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
431 431
{ {
@ -4228,6 +4344,7 @@ thingtypes
height = 128; height = 128;
flags4text = "[4] Respawn at center"; flags4text = "[4] Respawn at center";
angletext = "Angle/Order"; angletext = "Angle/Order";
fixedrotation = 1;
parametertext = "Order"; parametertext = "Order";
} }
520 520
@ -4259,7 +4376,7 @@ thingtypes
flags1text = "[1] Start retracted"; flags1text = "[1] Start retracted";
flags4text = "[4] Retractable"; flags4text = "[4] Retractable";
flags8text = "[8] Intangible"; flags8text = "[8] Intangible";
parametertext = "Initial delay"; parametertext = "Start delay";
} }
523 523
{ {
@ -4271,7 +4388,8 @@ thingtypes
flags4text = "[4] Retractable"; flags4text = "[4] Retractable";
flags8text = "[8] Intangible"; flags8text = "[8] Intangible";
angletext = "Retraction interval"; angletext = "Retraction interval";
parametertext = "Initial delay"; fixedrotation = 1;
parametertext = "Start delay";
} }
1130 1130
{ {
@ -4320,6 +4438,7 @@ thingtypes
flags4text = "[4] Invisible"; flags4text = "[4] Invisible";
flags8text = "[8] No distance check"; flags8text = "[8] No distance check";
angletext = "Lift height"; angletext = "Lift height";
fixedrotation = 1;
} }
541 541
{ {
@ -4335,6 +4454,7 @@ thingtypes
width = 32; width = 32;
height = 64; height = 64;
angletext = "Strength"; angletext = "Strength";
fixedrotation = 1;
} }
543 543
{ {
@ -4344,6 +4464,7 @@ thingtypes
height = 64; height = 64;
flags8text = "[8] Respawn"; flags8text = "[8] Respawn";
angletext = "Color"; angletext = "Color";
fixedrotation = 1;
} }
550 550
{ {
@ -4617,6 +4738,9 @@ thingtypes
title = "Slope Vertex"; title = "Slope Vertex";
sprite = "internal:vertexslope"; sprite = "internal:vertexslope";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
parametertext = "Absolute?";
flagsvaluetext = "Absolute Z";
} }
751 751
@ -4638,6 +4762,7 @@ thingtypes
title = "Zoom Tube Waypoint"; title = "Zoom Tube Waypoint";
sprite = "internal:zoom"; sprite = "internal:zoom";
angletext = "Order"; angletext = "Order";
fixedrotation = 1;
} }
754 754
@ -4647,6 +4772,7 @@ thingtypes
flags8text = "[8] Push using XYZ"; flags8text = "[8] Push using XYZ";
sprite = "GWLGA0"; sprite = "GWLGA0";
angletext = "Radius"; angletext = "Radius";
fixedrotation = 1;
} }
755 755
{ {
@ -4655,6 +4781,7 @@ thingtypes
flags8text = "[8] Pull using XYZ"; flags8text = "[8] Pull using XYZ";
sprite = "GWLRA0"; sprite = "GWLRA0";
angletext = "Radius"; angletext = "Radius";
fixedrotation = 1;
} }
756 756
{ {
@ -4663,6 +4790,7 @@ thingtypes
width = 32; width = 32;
height = 16; height = 16;
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
757 757
{ {
@ -4671,6 +4799,7 @@ thingtypes
width = 8; width = 8;
height = 16; height = 16;
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
758 758
{ {
@ -4681,21 +4810,24 @@ thingtypes
{ {
title = "PolyObject Anchor"; title = "PolyObject Anchor";
sprite = "internal:polyanchor"; sprite = "internal:polyanchor";
angletext = "ID"; angletext = "Tag";
fixedrotation = 1;
} }
761 761
{ {
title = "PolyObject Spawn Point"; title = "PolyObject Spawn Point";
sprite = "internal:polycenter"; sprite = "internal:polycenter";
angletext = "ID"; angletext = "Tag";
fixedrotation = 1;
} }
762 762
{ {
title = "PolyObject Spawn Point (Crush)"; title = "PolyObject Spawn Point (Crush)";
sprite = "internal:polycentercrush"; sprite = "internal:polycentercrush";
angletext = "ID"; angletext = "Tag";
fixedrotation = 1;
} }
780 780
{ {
@ -4703,6 +4835,7 @@ thingtypes
sprite = "internal:skyb"; sprite = "internal:skyb";
flags4text = "[4] In-map centerpoint"; flags4text = "[4] In-map centerpoint";
parametertext = "ID"; parametertext = "ID";
fixedrotation = 1;
} }
} }
@ -4897,6 +5030,7 @@ thingtypes
height = 16; height = 16;
hangs = 1; hangs = 1;
angletext = "Dripping interval"; angletext = "Dripping interval";
fixedrotation = 1;
} }
1003 1003
{ {
@ -4953,7 +5087,7 @@ thingtypes
1011 1011
{ {
title = "Stalagmite (DSZ2)"; title = "Stalagmite (DSZ2)";
sprite = "DSTGA0"; sprite = "DSTGB0";
width = 8; width = 8;
height = 116; height = 116;
flags4text = "[4] Double size"; flags4text = "[4] Double size";
@ -5038,6 +5172,8 @@ thingtypes
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
flags8text = "[8] Double size"; flags8text = "[8] Double size";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1105 1105
{ {
@ -5048,6 +5184,8 @@ thingtypes
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
flags8text = "[8] Double size"; flags8text = "[8] Double size";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1106 1106
{ {
@ -5058,6 +5196,8 @@ thingtypes
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
flags8text = "[8] Red spring"; flags8text = "[8] Red spring";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1107 1107
{ {
@ -5067,6 +5207,8 @@ thingtypes
height = 34; height = 34;
flags8text = "[8] Double size"; flags8text = "[8] Double size";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1108 1108
{ {
@ -5086,6 +5228,8 @@ thingtypes
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
flags8text = "[8] Double size"; flags8text = "[8] Double size";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1110 1110
{ {
@ -5095,6 +5239,8 @@ thingtypes
height = 34; height = 34;
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1111 1111
{ {
@ -5224,6 +5370,7 @@ thingtypes
sprite = "EGR1A1"; sprite = "EGR1A1";
width = 20; width = 20;
height = 72; height = 72;
arrow = 1;
} }
1128 1128
{ {
@ -5272,6 +5419,7 @@ thingtypes
width = 8; width = 8;
height = 16; height = 16;
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
1203 1203
{ {
@ -5342,6 +5490,7 @@ thingtypes
sprite = "WWSGAR"; sprite = "WWSGAR";
width = 22; width = 22;
height = 64; height = 64;
arrow = 1;
} }
1213 1213
{ {
@ -5349,6 +5498,7 @@ thingtypes
sprite = "WWS2AR"; sprite = "WWS2AR";
width = 22; width = 22;
height = 64; height = 64;
arrow = 1;
} }
1214 1214
{ {
@ -5356,6 +5506,7 @@ thingtypes
sprite = "WWS3ALAR"; sprite = "WWS3ALAR";
width = 16; width = 16;
height = 192; height = 192;
arrow = 1;
} }
1215 1215
{ {
@ -5371,6 +5522,7 @@ thingtypes
sprite = "BARRA1"; sprite = "BARRA1";
width = 24; width = 24;
height = 63; height = 63;
arrow = 1;
} }
1217 1217
{ {
@ -5392,6 +5544,7 @@ thingtypes
sprite = "MCRTCLFR"; sprite = "MCRTCLFR";
width = 22; width = 22;
height = 32; height = 32;
arrow = 1;
} }
1220 1220
{ {
@ -5399,6 +5552,7 @@ thingtypes
sprite = "MCRTIR"; sprite = "MCRTIR";
width = 32; width = 32;
height = 32; height = 32;
arrow = 1;
} }
1221 1221
{ {
@ -5406,6 +5560,7 @@ thingtypes
sprite = "SALDARAL"; sprite = "SALDARAL";
width = 96; width = 96;
height = 160; height = 160;
arrow = 1;
flags8text = "[8] Allow non-minecart players"; flags8text = "[8] Allow non-minecart players";
} }
1222 1222
@ -5467,6 +5622,7 @@ thingtypes
height = 40; height = 40;
flags8text = "[8] Waves vertically"; flags8text = "[8] Waves vertically";
angletext = "On/Off time"; angletext = "On/Off time";
fixedrotation = 1;
parametertext = "Strength"; parametertext = "Strength";
} }
1301 1301
@ -5477,6 +5633,7 @@ thingtypes
height = 40; height = 40;
flags8text = "[8] Shoot downwards"; flags8text = "[8] Shoot downwards";
angletext = "On/Off time"; angletext = "On/Off time";
fixedrotation = 1;
parametertext = "Strength"; parametertext = "Strength";
} }
1302 1302
@ -5500,6 +5657,7 @@ thingtypes
width = 30; width = 30;
height = 32; height = 32;
angletext = "Initial delay"; angletext = "Initial delay";
fixedrotation = 1;
flags8text = "[8] Double size"; flags8text = "[8] Double size";
} }
1305 1305
@ -5537,6 +5695,7 @@ thingtypes
sprite = "WVINALAR"; sprite = "WVINALAR";
width = 1; width = 1;
height = 288; height = 288;
arrow = 1;
} }
1310 1310
{ {
@ -5544,6 +5703,7 @@ thingtypes
sprite = "WVINBLBR"; sprite = "WVINBLBR";
width = 1; width = 1;
height = 288; height = 288;
arrow = 1;
} }
} }
@ -5901,6 +6061,7 @@ thingtypes
width = 8; width = 8;
height = 4096; height = 4096;
sprite = "UNKNA0"; sprite = "UNKNA0";
fixedrotation = 1;
1700 1700
{ {
@ -5959,6 +6120,7 @@ thingtypes
flags4text = "[4] Align player to top"; flags4text = "[4] Align player to top";
flags8text = "[8] Die upon time up"; flags8text = "[8] Die upon time up";
angletext = "Time limit"; angletext = "Time limit";
fixedrotation = 1;
parametertext = "Height"; parametertext = "Height";
} }
1704 1704
@ -5971,6 +6133,7 @@ thingtypes
unflippable = true; unflippable = true;
flagsvaluetext = "Pitch"; flagsvaluetext = "Pitch";
angletext = "Yaw"; angletext = "Yaw";
fixedrotation = 1;
} }
1705 1705
{ {
@ -5983,6 +6146,7 @@ thingtypes
centerHitbox = true; centerHitbox = true;
flagsvaluetext = "Height"; flagsvaluetext = "Height";
angletext = "Pitch/Yaw"; angletext = "Pitch/Yaw";
fixedrotation = 1;
} }
1706 1706
{ {
@ -6104,6 +6268,7 @@ thingtypes
width = 8; width = 8;
height = 16; height = 16;
angletext = "Jump strength"; angletext = "Jump strength";
fixedrotation = 1;
} }
1806 1806
{ {
@ -6336,6 +6501,7 @@ thingtypes
width = 18; width = 18;
height = 28; height = 28;
angletext = "Initial delay"; angletext = "Initial delay";
fixedrotation = 1;
} }
2001 2001
{ {
@ -6459,6 +6625,7 @@ thingtypes
sprite = "XMS6A0"; sprite = "XMS6A0";
width = 52; width = 52;
height = 106; height = 106;
hangs = 1;
} }
} }
@ -6472,6 +6639,7 @@ thingtypes
flags4text = "[4] No movement"; flags4text = "[4] No movement";
flags8text = "[8] Hop"; flags8text = "[8] Hop";
angletext = "Radius"; angletext = "Radius";
fixedrotation = 1;
2200 2200
{ {

View file

@ -1247,6 +1247,7 @@ patterns
sprite = "SPHRA0"; sprite = "SPHRA0";
width = 96; width = 96;
height = 192; height = 192;
}
609 609
{ {
title = "Circle of Rings and Spheres (Big)"; title = "Circle of Rings and Spheres (Big)";

8
objs/.gitignore vendored
View file

@ -1,8 +0,0 @@
#All folders
SRB2.res
depend.dep
depend.ped
*.o
#VC9 folder only
/VC9/Win32
/VC9/x64

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/VC/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/VC9/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,232 +1,14 @@
# SRB2 Core # SRB2 Core
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
# Core sources # Core sources
set(SRB2_CORE_SOURCES target_sourcefile(c)
am_map.c target_sources(SRB2SDL2 PRIVATE comptime.c md5.c config.h)
b_bot.c
command.c
comptime.c
console.c
d_clisrv.c
d_main.c
d_net.c
d_netcmd.c
d_netfil.c
dehacked.c
f_finale.c
f_wipe.c
filesrch.c
g_demo.c
g_game.c
g_input.c
hu_stuff.c
i_tcp.c
info.c
lzf.c
m_aatree.c
m_anigif.c
m_argv.c
m_bbox.c
m_cheat.c
m_cond.c
m_fixed.c
m_menu.c
m_misc.c
m_perfstats.c
m_queue.c
m_random.c
md5.c
mserv.c
http-mserv.c
s_sound.c
screen.c
sounds.c
st_stuff.c
#string.c
tables.c
v_video.c
w_wad.c
y_inter.c
z_zone.c
)
set(SRB2_CORE_HEADERS set(SRB2_ASM_SOURCES vid_copy.s)
am_map.h
b_bot.h
byteptr.h
command.h
console.h
d_clisrv.h
d_event.h
d_main.h
d_net.h
d_netcmd.h
d_netfil.h
d_player.h
d_think.h
d_ticcmd.h
dehacked.h
doomdata.h
doomdef.h
doomstat.h
doomtype.h
endian.h
f_finale.h
fastcmp.h
filesrch.h
g_demo.h
g_game.h
g_input.h
g_state.h
hu_stuff.h
i_joy.h
i_net.h
i_sound.h
i_system.h
i_tcp.h
i_video.h
info.h
keys.h
lzf.h
m_aatree.h
m_anigif.h
m_argv.h
m_bbox.h
m_cheat.h
m_cond.h
m_dllist.h
m_fixed.h
m_menu.h
m_misc.h
m_perfstats.h
m_queue.h
m_random.h
m_swap.h
md5.h
mserv.h
p5prof.h
s_sound.h
screen.h
sounds.h
st_stuff.h
tables.h
v_video.h
w_wad.h
y_inter.h
z_zone.h
config.h.in
)
set(SRB2_CORE_RENDER_SOURCES
r_bsp.c
r_data.c
r_draw.c
r_main.c
r_plane.c
r_segs.c
r_skins.c
r_sky.c
r_splats.c
r_things.c
r_textures.c
r_patch.c
r_patchrotation.c
r_picformats.c
r_portal.c
r_bsp.h
r_data.h
r_defs.h
r_draw.h
r_local.h
r_main.h
r_plane.h
r_segs.h
r_skins.h
r_sky.h
r_splats.h
r_state.h
r_things.h
r_textures.h
r_patch.h
r_patchrotation.h
r_picformats.h
r_portal.h
)
set(SRB2_CORE_GAME_SOURCES
p_ceilng.c
p_enemy.c
p_floor.c
p_inter.c
p_lights.c
p_map.c
p_maputl.c
p_mobj.c
p_polyobj.c
p_saveg.c
p_setup.c
p_sight.c
p_slopes.c
p_spec.c
p_telept.c
p_tick.c
p_user.c
taglist.c
p_local.h
p_maputl.h
p_mobj.h
p_polyobj.h
p_pspr.h
p_saveg.h
p_setup.h
p_slopes.h
p_spec.h
p_tick.h
taglist.h
)
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
endif()
prepend_sources(SRB2_CORE_SOURCES)
prepend_sources(SRB2_CORE_HEADERS)
prepend_sources(SRB2_CORE_RENDER_SOURCES)
prepend_sources(SRB2_CORE_GAME_SOURCES)
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/config.h)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
set(SRB2_ASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/vid_copy.s
)
set(SRB2_NASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/tmap_mmx.nas
${CMAKE_CURRENT_SOURCE_DIR}/tmap.nas
)
if(MSVC)
list(APPEND SRB2_NASM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tmap_vc.nas)
endif()
set(SRB2_NASM_OBJECTS
${CMAKE_CURRENT_BINARY_DIR}/tmap_mmx.obj
${CMAKE_CURRENT_BINARY_DIR}/tmap.obj
)
if(MSVC)
list(APPEND SRB2_NASM_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/tmap_vc.obj)
endif()
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
set(SRB2_NASM_SOURCES tmap_mmx.nas tmap.nas)
### Configuration ### Configuration
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
@ -262,91 +44,7 @@ if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).") "Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
endif() endif()
set(SRB2_LUA_SOURCES add_subdirectory(blua)
lua_baselib.c
lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
lua_infolib.c
lua_maplib.c
lua_mathlib.c
lua_mobjlib.c
lua_playerlib.c
lua_polyobjlib.c
lua_script.c
lua_skinlib.c
lua_thinkerlib.c
)
set(SRB2_LUA_HEADERS
lua_hook.h
lua_hud.h
lua_libs.h
lua_script.h
)
prepend_sources(SRB2_LUA_SOURCES)
prepend_sources(SRB2_LUA_HEADERS)
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
set(SRB2_BLUA_SOURCES
blua/lapi.c
blua/lauxlib.c
blua/lbaselib.c
blua/lcode.c
blua/ldebug.c
blua/ldo.c
blua/ldump.c
blua/lfunc.c
blua/lgc.c
blua/linit.c
blua/liolib.c
blua/llex.c
blua/lmem.c
blua/lobject.c
blua/lopcodes.c
blua/lparser.c
blua/lstate.c
blua/lstring.c
blua/lstrlib.c
blua/ltable.c
blua/ltablib.c
blua/ltm.c
blua/lundump.c
blua/lvm.c
blua/lzio.c
)
set(SRB2_BLUA_HEADERS
blua/lapi.h
blua/lauxlib.h
blua/lcode.h
blua/ldebug.h
blua/ldo.h
blua/lfunc.h
blua/lgc.h
blua/llex.h
blua/llimits.h
blua/lmem.h
blua/lobject.h
blua/lopcodes.h
blua/lparser.h
blua/lstate.h
blua/lstring.h
blua/ltable.h
blua/ltm.h
blua/lua.h
blua/luaconf.h
blua/lualib.h
blua/lundump.h
blua/lvm.h
blua/lzio.h
)
prepend_sources(SRB2_BLUA_SOURCES)
prepend_sources(SRB2_BLUA_HEADERS)
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
if(${SRB2_CONFIG_HAVE_GME}) if(${SRB2_CONFIG_HAVE_GME})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
@ -362,7 +60,7 @@ if(${SRB2_CONFIG_HAVE_GME})
endif() endif()
if(${GME_FOUND}) if(${GME_FOUND})
set(SRB2_HAVE_GME ON) set(SRB2_HAVE_GME ON)
add_definitions(-DHAVE_LIBGME) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_LIBGME)
else() else()
message(WARNING "You have specified that GME is available but it was not found.") message(WARNING "You have specified that GME is available but it was not found.")
endif() endif()
@ -382,7 +80,7 @@ if(${SRB2_CONFIG_HAVE_OPENMPT})
endif() endif()
if(${OPENMPT_FOUND}) if(${OPENMPT_FOUND})
set(SRB2_HAVE_OPENMPT ON) set(SRB2_HAVE_OPENMPT ON)
add_definitions(-DHAVE_OPENMPT) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
else() else()
message(WARNING "You have specified that OpenMPT is available but it was not found.") message(WARNING "You have specified that OpenMPT is available but it was not found.")
endif() endif()
@ -405,8 +103,7 @@ if(${SRB2_CONFIG_HAVE_MIXERX})
endif() endif()
if(${MIXERX_FOUND}) if(${MIXERX_FOUND})
set(SRB2_HAVE_MIXERX ON) set(SRB2_HAVE_MIXERX ON)
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXERX)
add_definitions(-DHAVE_MIXERX)
else() else()
message(WARNING "You have specified that SDL Mixer X is available but it was not found.") message(WARNING "You have specified that SDL Mixer X is available but it was not found.")
endif() endif()
@ -426,7 +123,7 @@ if(${SRB2_CONFIG_HAVE_ZLIB})
endif() endif()
if(${ZLIB_FOUND}) if(${ZLIB_FOUND})
set(SRB2_HAVE_ZLIB ON) set(SRB2_HAVE_ZLIB ON)
add_definitions(-DHAVE_ZLIB) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB)
else() else()
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2 may not compile correctly.") message(WARNING "You have specified that ZLIB is available but it was not found. SRB2 may not compile correctly.")
endif() endif()
@ -447,14 +144,9 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
endif() endif()
if(${PNG_FOUND}) if(${PNG_FOUND})
set(SRB2_HAVE_PNG ON) set(SRB2_HAVE_PNG ON)
add_definitions(-DHAVE_PNG) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_PNG)
add_definitions(-D_LARGEFILE64_SOURCE) target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE)
set(SRB2_PNG_SOURCES apng.c) target_sources(SRB2SDL2 PRIVATE apng.c)
set(SRB2_PNG_HEADERS apng.h)
prepend_sources(SRB2_PNG_SOURCES)
prepend_sources(SRB2_PNG_HEADERS)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}
${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS})
else() else()
message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.") message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.")
endif() endif()
@ -475,7 +167,7 @@ if(${SRB2_CONFIG_HAVE_CURL})
endif() endif()
if(${CURL_FOUND}) if(${CURL_FOUND})
set(SRB2_HAVE_CURL ON) set(SRB2_HAVE_CURL ON)
add_definitions(-DHAVE_CURL) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_CURL)
else() else()
message(WARNING "You have specified that CURL is available but it was not found. SRB2 may not compile correctly.") message(WARNING "You have specified that CURL is available but it was not found. SRB2 may not compile correctly.")
endif() endif()
@ -483,59 +175,19 @@ endif()
if(${SRB2_CONFIG_HAVE_THREADS}) if(${SRB2_CONFIG_HAVE_THREADS})
set(SRB2_HAVE_THREADS ON) set(SRB2_HAVE_THREADS ON)
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/i_threads.h) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
add_definitions(-DHAVE_THREADS)
endif() endif()
if(${SRB2_CONFIG_HWRENDER}) if(${SRB2_CONFIG_HWRENDER})
add_definitions(-DHWRENDER) target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
set(SRB2_HWRENDER_SOURCES add_subdirectory(hardware)
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.c
)
set (SRB2_HWRENDER_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.h
)
set(SRB2_R_OPENGL_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.c
)
set(SRB2_R_OPENGL_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
)
endif() endif()
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL}) if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
find_package(OpenGL) find_package(OpenGL)
if(${OPENGL_FOUND}) if(${OPENGL_FOUND})
add_definitions(-DHWRENDER) target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
add_definitions(-DSTATIC_OPENGL) target_compile_definitions(SRB2SDL2 PRIVATE -DSTATIC_OPENGL)
else() else()
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.") message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
endif() endif()
@ -556,12 +208,16 @@ if(${SRB2_CONFIG_USEASM})
set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.") set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
enable_language(ASM_NASM) enable_language(ASM_NASM)
endif() endif()
set(SRB2_USEASM ON) set(SRB2_USEASM ON)
add_definitions(-DUSEASM) target_compile_definitions(SRB2SDL2 PRIVATE -DUSEASM)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -mfpmath=sse") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -mfpmath=sse")
target_sources(SRB2SDL2 PRIVATE ${SRB2_ASM_SOURCES}
${SRB2_NASM_SOURCES})
else() else()
set(SRB2_USEASM OFF) set(SRB2_USEASM OFF)
add_definitions(-DNONX86 -DNORUSEASM) target_compile_definitions(SRB2SDL2 PRIVATE -DNONX86 -DNORUSEASM)
endif() endif()
# Targets # Targets
@ -597,7 +253,9 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
endif() endif()
add_definitions(-DCMAKECONFIG) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-trigraphs)
target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG)
#add_library(SRB2Core STATIC #add_library(SRB2Core STATIC
# ${SRB2_CORE_SOURCES} # ${SRB2_CORE_SOURCES}

File diff suppressed because it is too large Load diff

View file

@ -1,462 +0,0 @@
# vim: ft=make
#
# Makefile.cfg for SRB2
#
#
# GNU compiler & tools' flags
# and other things
#
# See the following variable don't start with 'GCC'. This is
# to avoid a false positive with the version detection...
SUPPORTED_GCC_VERSIONS:=\
101 102\
91 92 93\
81 82 83 84\
71 72 73 74 75\
61 62 63 64\
51 52 53 54 55\
40 41 42 43 44 45 46 47 48 49
LATEST_GCC_VERSION=10.2
# gcc or g++
ifdef PREFIX
CC=$(PREFIX)-gcc
CXX=$(PREFIX)-g++
OBJCOPY=$(PREFIX)-objcopy
OBJDUMP=$(PREFIX)-objdump
STRIP=$(PREFIX)-strip
WINDRES=$(PREFIX)-windres
else
OBJCOPY=objcopy
OBJDUMP=objdump
STRIP=strip
WINDRES=windres
endif
# because Apple screws with us on this
# need to get bintools from homebrew
ifdef MACOSX
CC=clang
CXX=clang
OBJCOPY=gobjcopy
OBJDUMP=gobjdump
endif
# Automatically set version flag, but not if one was manually set
ifeq (,$(filter GCC%,$(.VARIABLES)))
version:=$(shell $(CC) --version)
# check if this is in fact GCC
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))
version:=$(shell $(CC) -dumpversion)
# Turn version into words of major, minor
v:=$(subst ., ,$(version))
# concat. major minor
v:=$(word 1,$(v))$(word 2,$(v))
# If this version is not in the list, default to the latest supported
ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS)))
$(info\
Your compiler version, GCC $(version), is not supported by the Makefile.\
The Makefile will assume GCC $(LATEST_GCC_VERSION).)
GCC$(subst .,,$(LATEST_GCC_VERSION))=1
else
$(info Detected GCC $(version) (GCC$(v)))
GCC$(v)=1
endif
endif
endif
ifdef GCC102
GCC101=1
endif
ifdef GCC101
GCC93=1
endif
ifdef GCC93
GCC92=1
endif
ifdef GCC92
GCC91=1
endif
ifdef GCC91
GCC84=1
endif
ifdef GCC84
GCC83=1
endif
ifdef GCC83
GCC82=1
endif
ifdef GCC82
GCC81=1
endif
ifdef GCC81
GCC75=1
endif
ifdef GCC75
GCC74=1
endif
ifdef GCC74
GCC73=1
endif
ifdef GCC73
GCC72=1
endif
ifdef GCC72
GCC71=1
endif
ifdef GCC71
GCC64=1
endif
ifdef GCC64
GCC63=1
endif
ifdef GCC63
GCC62=1
endif
ifdef GCC62
GCC61=1
endif
ifdef GCC61
GCC55=1
endif
ifdef GCC55
GCC54=1
endif
ifdef GCC54
GCC53=1
endif
ifdef GCC53
GCC52=1
endif
ifdef GCC52
GCC51=1
endif
ifdef GCC51
GCC49=1
endif
ifdef GCC49
GCC48=1
endif
ifdef GCC48
GCC47=1
endif
ifdef GCC47
GCC46=1
endif
ifdef GCC46
GCC45=1
endif
ifdef GCC45
GCC44=1
endif
ifdef GCC44
GCC43=1
endif
ifdef GCC43
GCC42=1
endif
ifdef GCC42
GCC41=1
endif
ifdef GCC41
GCC40=1
VCHELP=1
endif
ifdef GCC295
GCC29=1
endif
OLDWFLAGS:=$(WFLAGS)
# -W -Wno-unused
WFLAGS=-Wall
ifndef GCC295
#WFLAGS+=-Wno-packed
endif
ifndef RELAXWARNINGS
WFLAGS+=-W
#WFLAGS+=-Wno-sign-compare
ifndef GCC295
WFLAGS+=-Wno-div-by-zero
endif
#WFLAGS+=-Wsystem-headers
WFLAGS+=-Wfloat-equal
#WFLAGS+=-Wtraditional
ifdef VCHELP
WFLAGS+=-Wdeclaration-after-statement
WFLAGS+=-Wno-error=declaration-after-statement
endif
WFLAGS+=-Wundef
ifndef GCC295
WFLAGS+=-Wendif-labels
endif
ifdef GCC41
WFLAGS+=-Wshadow
endif
#WFLAGS+=-Wlarger-than-%len%
WFLAGS+=-Wpointer-arith -Wbad-function-cast
ifdef GCC45
#WFLAGS+=-Wc++-compat
endif
WFLAGS+=-Wcast-qual
ifndef NOCASTALIGNWARN
WFLAGS+=-Wcast-align
endif
WFLAGS+=-Wwrite-strings
ifndef ERRORMODE
#WFLAGS+=-Wconversion
ifdef GCC43
#WFLAGS+=-Wno-sign-conversion
endif
endif
WFLAGS+=-Wsign-compare
ifdef GCC91
WFLAGS+=-Wno-error=address-of-packed-member
endif
ifdef GCC45
WFLAGS+=-Wlogical-op
endif
WFLAGS+=-Waggregate-return
ifdef HAIKU
ifdef GCC41
#WFLAGS+=-Wno-attributes
endif
endif
#WFLAGS+=-Wstrict-prototypes
ifdef GCC40
WFLAGS+=-Wold-style-definition
endif
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
ifdef GCC40
WFLAGS+=-Wmissing-field-initializers
endif
WFLAGS+=-Wmissing-noreturn
#WFLAGS+=-Wmissing-format-attribute
#WFLAGS+=-Wno-multichar
#WFLAGS+=-Wno-deprecated-declarations
#WFLAGS+=-Wpacked
#WFLAGS+=-Wpadded
#WFLAGS+=-Wredundant-decls
WFLAGS+=-Wnested-externs
#WFLAGS+=-Wunreachable-code
WFLAGS+=-Winline
ifdef GCC43
WFLAGS+=-funit-at-a-time
WFLAGS+=-Wlogical-op
endif
ifndef GCC295
WFLAGS+=-Wdisabled-optimization
endif
endif
WFLAGS+=-Wformat-y2k
ifdef GCC71
WFLAGS+=-Wno-error=format-overflow=2
endif
WFLAGS+=-Wformat-security
ifndef GCC29
#WFLAGS+=-Winit-self
endif
ifdef GCC46
WFLAGS+=-Wno-suggest-attribute=noreturn
endif
ifdef NOLDWARNING
LDFLAGS+=-Wl,--as-needed
endif
ifdef ERRORMODE
WFLAGS+=-Werror
endif
WFLAGS+=$(OLDWFLAGS)
ifdef GCC43
#WFLAGS+=-Wno-error=clobbered
endif
ifdef GCC44
WFLAGS+=-Wno-error=array-bounds
endif
ifdef GCC46
WFLAGS+=-Wno-error=suggest-attribute=noreturn
endif
ifdef GCC54
WFLAGS+=-Wno-logical-op -Wno-error=logical-op
endif
ifdef GCC61
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
endif
ifdef GCC71
WFLAGS+=-Wimplicit-fallthrough=4
endif
ifdef GCC81
WFLAGS+=-Wno-error=format-overflow
WFLAGS+=-Wno-error=stringop-truncation
WFLAGS+=-Wno-error=stringop-overflow
WFLAGS+=-Wno-format-overflow
WFLAGS+=-Wno-stringop-truncation
WFLAGS+=-Wno-stringop-overflow
WFLAGS+=-Wno-error=multistatement-macros
endif
#indicate platform and what interface use with
ifndef LINUX
ifndef FREEBSD
ifndef CYGWIN32
ifndef MINGW
ifndef MINGW64
ifndef SDL
ifndef DUMMY
$(error No interface or platform flag defined)
endif
endif
endif
endif
endif
endif
endif
#determine the interface directory (where you put all i_*.c)
i_net_o=$(OBJDIR)/i_net.o
i_system_o=$(OBJDIR)/i_system.o
i_sound_o=$(OBJDIR)/i_sound.o
i_main_o=$(OBJDIR)/i_main.o
#set OBJDIR and BIN's starting place
OBJDIR=../objs
BIN=../bin
#Nasm ASM and rm
ifdef YASM
NASM?=yasm
else
NASM?=nasm
endif
REMOVE?=rm -f
MKDIR?=mkdir -p
GZIP?=gzip
GZIP_OPTS?=-9 -f -n
GZIP_OPT2=$(GZIP_OPTS) --rsyncable
UPX?=upx
UPX_OPTS?=--best --preserve-build-id
ifndef ECHO
UPX_OPTS+=-q
endif
#Interface Setup
ifdef DUMMY
INTERFACE=dummy
OBJDIR:=$(OBJDIR)/dummy
BIN:=$(BIN)/dummy
else
ifdef LINUX
NASMFORMAT=elf -DLINUX
SDL=1
ifdef LINUX64
OBJDIR:=$(OBJDIR)/Linux64
BIN:=$(BIN)/Linux64
else
OBJDIR:=$(OBJDIR)/Linux
BIN:=$(BIN)/Linux
endif
else
ifdef FREEBSD
INTERFACE=sdl
NASMFORMAT=elf -DLINUX
SDL=1
OBJDIR:=$(OBJDIR)/FreeBSD
BIN:=$(BIN)/FreeBSD
else
ifdef SOLARIS
INTERFACE=sdl
NASMFORMAT=elf -DLINUX
SDL=1
OBJDIR:=$(OBJDIR)/Solaris
BIN:=$(BIN)/Solaris
else
ifdef CYGWIN32
INTERFACE=sdl
NASMFORMAT=win32
SDL=1
OBJDIR:=$(OBJDIR)/cygwin
BIN:=$(BIN)/Cygwin
else
ifdef MINGW64
INTERFACE=win32
#NASMFORMAT=win64
OBJDIR:=$(OBJDIR)/Mingw64
BIN:=$(BIN)/Mingw64
else
ifdef MINGW
INTERFACE=win32
NASMFORMAT=win32
OBJDIR:=$(OBJDIR)/Mingw
BIN:=$(BIN)/Mingw
endif
endif
endif
endif
endif
endif
endif
ifdef ARCHNAME
OBJDIR:=$(OBJDIR)/$(ARCHNAME)
BIN:=$(BIN)/$(ARCHNAME)
endif
OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC)
ifdef SDL
INTERFACE=sdl
OBJDIR:=$(OBJDIR)/SDL
endif
ifndef DUMMY
ifdef DEBUGMODE
OBJDIR:=$(OBJDIR)/Debug
BIN:=$(BIN)/Debug
else
OBJDIR:=$(OBJDIR)/Release
BIN:=$(BIN)/Release
endif
endif

103
src/Makefile.d/detect.mk Normal file
View file

@ -0,0 +1,103 @@
#
# Detect the host system and compiler version.
#
# Previously featured:\
PANDORA\
HAIKU\
DUMMY\
DJGPPDOS\
SOLARIS\
MACOSX\
all_systems:=\
LINUX64\
MINGW64\
MINGW\
UNIX\
LINUX\
FREEBSD\
SDL\
# check for user specified system
ifeq (,$(filter $(all_systems),$(.VARIABLES)))
ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
_m=Detected a Windows system,\
compiling for 32-bit MinGW SDL...)
$(call Print,$(_m))
# go for a 32-bit sdl mingw exe by default
MINGW:=1
else # if you on the *nix
system:=$(shell uname -s)
ifeq ($(system),Linux)
new_system:=LINUX
else
$(error \
Could not automatically detect your system,\
try specifying a system manually)
endif
ifeq ($(shell getconf LONG_BIT),64)
system+=64-bit
new_system:=$(new_system)64
endif
$(call Print,Detected $(system) ($(new_system))...)
$(new_system):=1
endif
endif
# This must have high to low order.
gcc_versions:=\
102 101\
93 92 91\
84 83 82 81\
75 74 73 72 71\
64 63 62 61\
55 54 53 52 51\
49 48 47 46 45 44 43 42 41 40
latest_gcc_version:=10.2
# Automatically set version flag, but not if one was
# manually set. And don't bother if this is a clean only
# run.
ifeq (,$(call Wildvar,GCC% destructive))
version:=$(shell $(CC) --version)
# check if this is in fact GCC
ifneq (,$(or $(findstring gcc,$(version)),\
$(findstring GCC,$(version))))
version:=$(shell $(CC) -dumpversion)
# Turn version into words of major, minor
v:=$(subst ., ,$(version))
# concat. major minor
v:=$(word 1,$(v))$(word 2,$(v))
# If this version is not in the list,
# default to the latest supported
ifeq (,$(filter $(v),$(gcc_versions)))
define line =
Your compiler version, GCC $(version), \
is not supported by the Makefile.
The Makefile will assume GCC $(latest_gcc_version).
endef
$(call Print,$(line))
GCC$(subst .,,$(latest_gcc_version)):=1
else
$(call Print,Detected GCC $(version) (GCC$(v)))
GCC$(v):=1
endif
endif
endif

View file

@ -0,0 +1,75 @@
#
# Makefile for feature flags.
#
passthru_opts+=\
NONET NO_IPV6 NOHW NOMD5 NOPOSTPROCESSING\
MOBJCONSISTANCY PACKETDROP ZDEBUG\
HAVE_MINIUPNPC\
# build with debugging information
ifdef DEBUGMODE
PACKETDROP=1
opts+=-DPARANOIA -DRANGECHECK
endif
ifndef NOHW
opts+=-DHWRENDER
sources+=$(call List,hardware/Sourcefile)
endif
ifndef NOASM
ifndef NONX86
sources+=tmap.nas tmap_mmx.nas
opts+=-DUSEASM
endif
endif
ifndef NOMD5
sources+=md5.c
endif
ifndef NOZLIB
ifndef NOPNG
ifdef PNG_PKGCONFIG
$(eval $(call Use_pkg_config,PNG_PKGCONFIG))
else
PNG_CONFIG?=$(call Prefix,libpng-config)
$(eval $(call Configure,PNG,$(PNG_CONFIG) \
$(if $(PNG_STATIC),--static),,--ldflags))
endif
ifdef LINUX
opts+=-D_LARGFILE64_SOURCE
endif
opts+=-DHAVE_PNG
sources+=apng.c
endif
endif
ifndef NONET
ifndef NOCURL
CURLCONFIG?=curl-config
$(eval $(call Configure,CURL,$(CURLCONFIG)))
opts+=-DHAVE_CURL
endif
endif
ifdef HAVE_MINIUPNPC
libs+=-lminiupnpc
endif
# (Valgrind is a memory debugger.)
ifdef VALGRIND
VALGRIND_PKGCONFIG?=valgrind
$(eval $(call Use_pkg_config,VALGRIND))
ZDEBUG=1
opts+=-DHAVE_VALGRIND
endif
default_packages:=\
GME/libgme/LIBGME\
OPENMPT/libopenmpt/LIBOPENMPT\
ZLIB/zlib\
$(foreach p,$(default_packages),\
$(eval $(call Check_pkg_config,$(p))))

42
src/Makefile.d/nix.mk Normal file
View file

@ -0,0 +1,42 @@
#
# Makefile options for unices (linux, bsd...)
#
EXENAME?=lsdl2srb2
opts+=-DUNIXCOMMON -DLUA_USE_POSIX
# Use -rdynamic so a backtrace log shows function names
# instead of addresses
libs+=-lm -rdynamic
ifndef nasm_format
nasm_format:=elf -DLINUX
endif
ifndef NOHW
opts+=-I/usr/X11R6/include
libs+=-L/usr/X11R6/lib
endif
SDL=1
# In common usage.
ifdef LINUX
libs+=-lrt
passthru_opts+=NOTERMIOS
endif
# Tested by Steel, as of release 2.2.8.
ifdef FREEBSD
opts+=-I/usr/X11R6/include -DLINUX -DFREEBSD
libs+=-L/usr/X11R6/lib -lipx -lkvm
endif
# FIXME: UNTESTED
#ifdef SOLARIS
#NOIPX=1
#NOASM=1
#opts+=-I/usr/local/include -I/opt/sfw/include \
# -DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
#libs+=-L/opt/sfw/lib -lsocket -lnsl
#endif

16
src/Makefile.d/old.mk Normal file
View file

@ -0,0 +1,16 @@
#
# Warn about old build directories and offer to purge.
#
_old:=$(wildcard $(addprefix ../bin/,FreeBSD Linux \
Linux64 Mingw Mingw64 SDL dummy) ../objs ../dep)
ifdef _old
$(foreach v,$(_old),$(info $(abspath $(v))))
$(info )
$(info These directories are no longer\
required and should be removed.)
$(info You may remove them manually or\
by using 'make distclean')
$(error )
endif

View file

@ -0,0 +1,69 @@
#
# Platform specific options.
#
PKG_CONFIG?=pkg-config
ifdef WINDOWSHELL
rmrf=-2>NUL DEL /S /Q
mkdir=-2>NUL MD
cat=TYPE
else
rmrf=rm -rf
mkdir=mkdir -p
cat=cat
endif
ifdef LINUX64
LINUX=1
endif
ifdef MINGW64
MINGW=1
endif
ifdef LINUX
UNIX=1
ifdef LINUX64
NONX86=1
# LINUX64 does not imply X86_64=1;
# could mean ARM64 or Itanium
platform=linux/64
else
platform=linux
endif
else ifdef FREEBSD
UNIX=1
platform=freebsd
else ifdef SOLARIS # FIXME: UNTESTED
UNIX=1
platform=solaris
else ifdef CYGWIN32 # FIXME: UNTESTED
nasm_format=win32
platform=cygwin
else ifdef MINGW
ifdef MINGW64
NONX86=1
NOASM=1
# MINGW64 should not necessarily imply X86_64=1,
# but we make that assumption elsewhere
# Once that changes, remove this
X86_64=1
platform=mingw/64
else
platform=mingw
endif
include Makefile.d/win32.mk
endif
ifdef platform
makedir:=$(makedir)/$(platform)
endif
ifdef UNIX
include Makefile.d/nix.mk
endif
ifdef SDL
include Makefile.d/sdl.mk
endif

79
src/Makefile.d/sdl.mk Normal file
View file

@ -0,0 +1,79 @@
#
# Makefile options for SDL2 backend.
#
#
# SDL...., *looks at Alam*, THIS IS A MESS!
#
# ...a little bird flexes its muscles...
#
makedir:=$(makedir)/SDL
sources+=$(call List,sdl/Sourcefile)
opts+=-DDIRECTFULLSCREEN -DHAVE_SDL
# FIXME: UNTESTED
#ifdef PANDORA
#include sdl/SRB2Pandora/Makefile.cfg
#endif #ifdef PANDORA
# FIXME: UNTESTED
#ifdef CYGWIN32
#include sdl/MakeCYG.cfg
#endif #ifdef CYGWIN32
ifndef NOHW
sources+=sdl/ogl_sdl.c
endif
ifdef NOMIXER
sources+=sdl/sdl_sound.c
else
opts+=-DHAVE_MIXER
sources+=sdl/mixer_sound.c
ifdef HAVE_MIXERX
opts+=-DHAVE_MIXERX
libs+=-lSDL2_mixer_ext
else
libs+=-lSDL2_mixer
endif
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c
endif
ifdef SDL_PKGCONFIG
$(eval $(call Use_pkg_config,SDL))
else
SDL_CONFIG?=$(call Prefix,sdl2-config)
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) \
$(if $(STATIC),--static-libs,--libs))
$(eval $(call Propogate_flags,SDL))
endif
# use the x86 asm code
ifndef CYGWIN32
ifndef NOASM
USEASM=1
endif
endif
ifdef MINGW
ifndef NOSDLMAIN
SDLMAIN=1
endif
endif
ifdef SDLMAIN
opts+=-DSDLMAIN
else
ifdef MINGW
opts+=-Umain
libs+=-mconsole
endif
endif

93
src/Makefile.d/util.mk Normal file
View file

@ -0,0 +1,93 @@
#
# Utility macros for the rest of the Makefiles.
#
Ifnot=$(if $(1),$(3),$(2))
Ifndef=$(call Ifnot,$($(1)),$(2),$(3))
# Match and expand a list of variables by pattern.
Wildvar=$(foreach v,$(filter $(1),$(.VARIABLES)),$($(v)))
# Read a list of words from file and prepend each with the
# directory of the file.
_cat=$(shell $(cat) $(call Windows_path,$(1)))
List=$(addprefix $(dir $(1)),$(call _cat,$(1)))
# Convert path separators to backslash on Windows.
Windows_path=$(if $(WINDOWSHELL),$(subst /,\,$(1)),$(1))
define Propogate_flags =
opts+=$$($(1)_CFLAGS)
libs+=$$($(1)_LDFLAGS)
endef
# Set library's _CFLAGS and _LDFLAGS from some command.
# Automatically propogates the flags too.
# 1: variable prefix (e.g. CURL)
# 2: start of command (e.g. curl-config)
# --- optional ----
# 3: CFLAGS command arguments, default '--cflags'
# 4: LDFLAGS command arguments, default '--libs'
# 5: common command arguments at the end of command
define Configure =
$(1)_CFLAGS?=$$(shell $(2) $(or $(3),--cflags) $(5))
$(1)_LDFLAGS?=$$(shell $(2) $(or $(4),--libs) $(5))
$(call Propogate_flags,$(1))
endef
# Configure library with pkg-config. The package name is
# taken from a _PKGCONFIG variable.
# 1: variable prefix
#
# LIBGME_PKGCONFIG=libgme
# $(eval $(call Use_pkg_config,LIBGME))
define Use_pkg_config =
$(call Configure,$(1),$(PKG_CONFIG),,,$($(1)_PKGCONFIG))
endef
# Check disabling flag and configure package in one step
# according to delimited argument.
# (There is only one argument, but it split by slash.)
# 1/: short form library name (uppercase). This is
# prefixed with 'NO' and 'HAVE_'. E.g. NOGME, HAVE_GME
# /2: package name (e.g. libgme)
# /3: variable prefix
#
# The following example would check if NOGME is not
# defined before attempting to define LIBGME_CFLAGS and
# LIBGME_LDFLAGS as with Use_pkg_config.
#
# $(eval $(call Check_pkg_config,GME/libgme/LIBGME))
define Check_pkg_config =
_p:=$(subst /, ,$(1))
_v1:=$$(word 1,$$(_p))
_v2:=$$(or $$(word 3,$$(_p)),$$(_v1))
ifndef NO$$(_v1)
$$(_v2)_PKGCONFIG?=$$(word 2,$$(_p))
$$(eval $$(call Use_pkg_config,$$(_v2)))
opts+=-DHAVE_$$(_v1)
endif
endef
# $(call Prefix,gcc)
Prefix=$(if $(PREFIX),$(PREFIX)-)$(1)
Echo=
Echo_name=
Print=
ifndef SILENT
Echo=@echo $(1)
ifndef ECHO
ifndef NOECHOFILENAMES
Echo_name=$(call Echo,-- $(1) ...)
endif
endif
ifndef MAKE_RESTARTS
ifndef destructive
Print=$(info $(1))
endif
endif
endif
.=$(call Ifndef,ECHO,@)

177
src/Makefile.d/versions.mk Normal file
View file

@ -0,0 +1,177 @@
#
# Flags to put a sock in GCC!
#
# See the versions list in detect.mk
# This will define all version flags going backward.
# Yes, it's magic.
define _predecessor =
ifdef GCC$(firstword $(1))
GCC$(lastword $(1)):=1
endif
endef
_n:=$(words $(gcc_versions))
$(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
$(addprefix =,$(wordlist 2,$(_n),$(gcc_versions)))),\
$(and $(findstring =,$(v)),\
$(eval $(call _predecessor,$(subst =, ,$(v))))))
# -W -Wno-unused
WFLAGS:=-Wall -Wno-trigraphs
ifndef GCC295
#WFLAGS+=-Wno-packed
endif
ifndef RELAXWARNINGS
WFLAGS+=-W
#WFLAGS+=-Wno-sign-compare
ifndef GCC295
WFLAGS+=-Wno-div-by-zero
endif
#WFLAGS+=-Wsystem-headers
WFLAGS+=-Wfloat-equal
#WFLAGS+=-Wtraditional
WFLAGS+=-Wundef
ifndef GCC295
WFLAGS+=-Wendif-labels
endif
ifdef GCC41
WFLAGS+=-Wdeclaration-after-statement
WFLAGS+=-Wno-error=declaration-after-statement
WFLAGS+=-Wshadow
endif
#WFLAGS+=-Wlarger-than-%len%
WFLAGS+=-Wpointer-arith -Wbad-function-cast
ifdef GCC45
#WFLAGS+=-Wc++-compat
endif
WFLAGS+=-Wcast-qual
ifndef NOCASTALIGNWARN
WFLAGS+=-Wcast-align
endif
WFLAGS+=-Wwrite-strings
ifndef ERRORMODE
#WFLAGS+=-Wconversion
ifdef GCC43
#WFLAGS+=-Wno-sign-conversion
endif
endif
WFLAGS+=-Wsign-compare
ifdef GCC91
WFLAGS+=-Wno-error=address-of-packed-member
endif
ifdef GCC45
WFLAGS+=-Wlogical-op
endif
WFLAGS+=-Waggregate-return
ifdef HAIKU
ifdef GCC41
#WFLAGS+=-Wno-attributes
endif
endif
#WFLAGS+=-Wstrict-prototypes
ifdef GCC40
WFLAGS+=-Wold-style-definition
endif
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
ifdef GCC40
WFLAGS+=-Wmissing-field-initializers
endif
WFLAGS+=-Wmissing-noreturn
#WFLAGS+=-Wmissing-format-attribute
#WFLAGS+=-Wno-multichar
#WFLAGS+=-Wno-deprecated-declarations
#WFLAGS+=-Wpacked
#WFLAGS+=-Wpadded
#WFLAGS+=-Wredundant-decls
WFLAGS+=-Wnested-externs
#WFLAGS+=-Wunreachable-code
WFLAGS+=-Winline
ifdef GCC43
WFLAGS+=-funit-at-a-time
WFLAGS+=-Wlogical-op
endif
ifndef GCC295
WFLAGS+=-Wdisabled-optimization
endif
endif
WFLAGS+=-Wformat-y2k
ifdef GCC71
WFLAGS+=-Wno-error=format-overflow=2
endif
WFLAGS+=-Wformat-security
ifndef GCC29
#WFLAGS+=-Winit-self
endif
ifdef GCC46
WFLAGS+=-Wno-suggest-attribute=noreturn
endif
ifdef NOLDWARNING
LDFLAGS+=-Wl,--as-needed
endif
ifdef ERRORMODE
WFLAGS+=-Werror
endif
ifdef GCC43
#WFLAGS+=-Wno-error=clobbered
endif
ifdef GCC44
WFLAGS+=-Wno-error=array-bounds
endif
ifdef GCC46
WFLAGS+=-Wno-error=suggest-attribute=noreturn
endif
ifdef GCC54
WFLAGS+=-Wno-logical-op -Wno-error=logical-op
endif
ifdef GCC61
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
endif
ifdef GCC71
WFLAGS+=-Wimplicit-fallthrough=4
endif
ifdef GCC81
WFLAGS+=-Wno-error=format-overflow
WFLAGS+=-Wno-error=stringop-truncation
WFLAGS+=-Wno-error=stringop-overflow
WFLAGS+=-Wno-format-overflow
WFLAGS+=-Wno-stringop-truncation
WFLAGS+=-Wno-stringop-overflow
WFLAGS+=-Wno-error=multistatement-macros
endif
ifdef NONX86
ifdef X86_64 # yeah that SEEMS contradictory
opts+=-march=nocona
endif
else
ifndef GCC29
opts+=-msse3 -mfpmath=sse
else
opts+=-mpentium
endif
endif
ifdef DEBUGMODE
ifdef GCC48
opts+=-Og
else
opts+=O0
endif
endif
ifdef VALGRIND
ifdef GCC46
WFLAGS+=-Wno-error=unused-but-set-variable
WFLAGS+=-Wno-unused-but-set-variable
endif
endif
# Lua
ifdef GCC43
ifndef GCC44
WFLAGS+=-Wno-logical-op
endif
endif

99
src/Makefile.d/win32.mk Normal file
View file

@ -0,0 +1,99 @@
#
# Mingw, if you don't know, that's Win32/Win64
#
ifndef MINGW64
EXENAME?=srb2win.exe
else
EXENAME?=srb2win64.exe
endif
sources+=win32/Srb2win.rc
opts+=-DSTDC_HEADERS
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
nasm_format:=win32
SDL=1
ifndef NOHW
opts+=-DUSE_WGL_SWAP
endif
ifdef MINGW64
libs+=-lws2_32
else
ifdef NO_IPV6
libs+=-lwsock32
else
libs+=-lws2_32
endif
endif
ifndef NONET
ifndef MINGW64 # miniupnc is broken with MINGW64
opts+=-I../libs -DSTATIC_MINIUPNPC
libs+=-L../libs/miniupnpc/mingw$(32) -lws2_32 -liphlpapi
endif
endif
ifndef MINGW64
32=32
x86=x86
i686=i686
else
32=64
x86=x86_64
i686=x86_64
endif
mingw:=$(i686)-w64-mingw32
define _set =
$(1)_CFLAGS?=$($(1)_opts)
$(1)_LDFLAGS?=$($(1)_libs)
endef
lib:=../libs/gme
LIBGME_opts:=-I$(lib)/include
LIBGME_libs:=-L$(lib)/win$(32) -lgme
$(eval $(call _set,LIBGME))
lib:=../libs/libopenmpt
LIBOPENMPT_opts:=-I$(lib)/inc
LIBOPENMPT_libs:=-L$(lib)/lib/$(x86)/mingw -lopenmpt
$(eval $(call _set,LIBOPENMPT))
ifndef NOMIXERX
HAVE_MIXERX=1
lib:=../libs/SDLMixerX/$(mingw)
else
lib:=../libs/SDL2_mixer/$(mingw)
endif
mixer_opts:=-I$(lib)/include/SDL2
mixer_libs:=-L$(lib)/lib
lib:=../libs/SDL2/$(mingw)
SDL_opts:=-I$(lib)/include/SDL2\
$(mixer_opts) -Dmain=SDL_main
SDL_libs:=-L$(lib)/lib $(mixer_libs)\
-lmingw32 -lSDL2main -lSDL2 -mwindows
$(eval $(call _set,SDL))
lib:=../libs/zlib
ZLIB_opts:=-I$(lib)
ZLIB_libs:=-L$(lib)/win32 -lz$(32)
$(eval $(call _set,ZLIB))
ifndef PNG_CONFIG
lib:=../libs/libpng-src
PNG_opts:=-I$(lib)
PNG_libs:=-L$(lib)/projects -lpng$(32)
$(eval $(call _set,PNG))
endif
lib:=../libs/curl
CURL_opts:=-I$(lib)/include
CURL_libs:=-L$(lib)/lib$(32) -lcurl
$(eval $(call _set,CURL))

98
src/Sourcefile Normal file
View file

@ -0,0 +1,98 @@
string.c
d_main.c
d_clisrv.c
d_net.c
d_netfil.c
d_netcmd.c
dehacked.c
deh_soc.c
deh_lua.c
deh_tables.c
z_zone.c
f_finale.c
f_wipe.c
g_demo.c
g_game.c
g_input.c
am_map.c
command.c
console.c
hu_stuff.c
y_inter.c
st_stuff.c
m_aatree.c
m_anigif.c
m_argv.c
m_bbox.c
m_cheat.c
m_cond.c
m_easing.c
m_fixed.c
m_menu.c
m_misc.c
m_perfstats.c
m_random.c
m_queue.c
info.c
p_ceilng.c
p_enemy.c
p_floor.c
p_inter.c
p_lights.c
p_map.c
p_maputl.c
p_mobj.c
p_polyobj.c
p_saveg.c
p_setup.c
p_sight.c
p_spec.c
p_telept.c
p_tick.c
p_user.c
p_slopes.c
tables.c
r_bsp.c
r_data.c
r_draw.c
r_main.c
r_plane.c
r_segs.c
r_skins.c
r_sky.c
r_splats.c
r_things.c
r_textures.c
r_patch.c
r_patchrotation.c
r_picformats.c
r_portal.c
screen.c
taglist.c
v_video.c
s_sound.c
sounds.c
w_wad.c
filesrch.c
mserv.c
http-mserv.c
i_tcp.c
lzf.c
vid_copy.s
b_bot.c
lua_script.c
lua_baselib.c
lua_mathlib.c
lua_hooklib.c
lua_consolelib.c
lua_infolib.c
lua_mobjlib.c
lua_playerlib.c
lua_skinlib.c
lua_thinkerlib.c
lua_maplib.c
lua_taglib.c
lua_polyobjlib.c
lua_blockmaplib.c
lua_hudlib.c
lua_inputlib.c

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,5 +1,5 @@
/* /*
Copyright 2019-2020, James R. Copyright 2019-2021, James R.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/* /*
Copyright 2019-2020, James R. Copyright 2019-2021, James R.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz. // Copyright (C) 2007-2016 by John "JTE" Muniz.
// Copyright (C) 2011-2020 by Sonic Team Junior. // Copyright (C) 2011-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -75,7 +75,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
return; return;
// Lua can handle it! // Lua can handle it!
if (LUAh_BotAI(sonic, tails, cmd)) if (LUA_HookBotAI(sonic, tails, cmd))
return; return;
if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC) if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC)
@ -363,7 +363,7 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
CV_SetValue(&cv_analog[1], false); CV_SetValue(&cv_analog[1], false);
// Let Lua scripts build ticcmds // Let Lua scripts build ticcmds
if (LUAh_BotTiccmd(player, cmd)) if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd)))
return; return;
// We don't have any main character AI, sorry. D: // We don't have any main character AI, sorry. D:
@ -461,7 +461,7 @@ boolean B_CheckRespawn(player_t *player)
// B_RespawnBot doesn't do anything if the condition above this isn't met // B_RespawnBot doesn't do anything if the condition above this isn't met
{ {
UINT8 shouldForce = LUAh_BotRespawn(sonic, tails); UINT8 shouldForce = LUA_Hook2Mobj(sonic, tails, MOBJ_HOOK(BotRespawn));
if (P_MobjWasRemoved(sonic) || P_MobjWasRemoved(tails)) if (P_MobjWasRemoved(sonic) || P_MobjWasRemoved(tails))
return (shouldForce == 1); // mobj was removed return (shouldForce == 1); // mobj was removed

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz. // Copyright (C) 2007-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2020 by Sonic Team Junior. // Copyright (C) 2012-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

1
src/blua/CMakeLists.txt Normal file
View file

@ -0,0 +1 @@
target_sourcefile(c)

View file

@ -1,52 +0,0 @@
ifdef UNIXCOMMON
LUA_CFLAGS+=-DLUA_USE_POSIX
endif
ifdef LINUX
LUA_CFLAGS+=-DLUA_USE_POSIX
endif
ifdef GCC43
ifndef GCC44
WFLAGS+=-Wno-logical-op
endif
endif
OBJS:=$(OBJS) \
$(OBJDIR)/lapi.o \
$(OBJDIR)/lbaselib.o \
$(OBJDIR)/ldo.o \
$(OBJDIR)/lfunc.o \
$(OBJDIR)/linit.o \
$(OBJDIR)/liolib.o \
$(OBJDIR)/llex.o \
$(OBJDIR)/lmem.o \
$(OBJDIR)/lobject.o \
$(OBJDIR)/lstate.o \
$(OBJDIR)/lstrlib.o \
$(OBJDIR)/ltablib.o \
$(OBJDIR)/lundump.o \
$(OBJDIR)/lzio.o \
$(OBJDIR)/lauxlib.o \
$(OBJDIR)/lcode.o \
$(OBJDIR)/ldebug.o \
$(OBJDIR)/ldump.o \
$(OBJDIR)/lgc.o \
$(OBJDIR)/lopcodes.o \
$(OBJDIR)/lparser.o \
$(OBJDIR)/lstring.o \
$(OBJDIR)/ltable.o \
$(OBJDIR)/ltm.o \
$(OBJDIR)/lvm.o \
$(OBJDIR)/lua_script.o \
$(OBJDIR)/lua_baselib.o \
$(OBJDIR)/lua_mathlib.o \
$(OBJDIR)/lua_hooklib.o \
$(OBJDIR)/lua_consolelib.o \
$(OBJDIR)/lua_infolib.o \
$(OBJDIR)/lua_mobjlib.o \
$(OBJDIR)/lua_playerlib.o \
$(OBJDIR)/lua_skinlib.o \
$(OBJDIR)/lua_thinkerlib.o \
$(OBJDIR)/lua_maplib.o \
$(OBJDIR)/lua_polyobjlib.o \
$(OBJDIR)/lua_blockmaplib.o \
$(OBJDIR)/lua_hudlib.o

25
src/blua/Sourcefile Normal file
View file

@ -0,0 +1,25 @@
lapi.c
lbaselib.c
ldo.c
lfunc.c
linit.c
liolib.c
llex.c
lmem.c
lobject.c
lstate.c
lstrlib.c
ltablib.c
lundump.c
lzio.c
lauxlib.c
lcode.c
ldebug.c
ldump.c
lgc.c
lopcodes.c
lparser.c
lstring.c
ltable.c
ltm.c
lvm.c

View file

@ -686,6 +686,15 @@ static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) {
} }
static void codeunaryarith (FuncState *fs, OpCode op, expdesc *e) {
expdesc e2;
e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
if (op == OP_LEN || !isnumeral(e))
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
codearith(fs, op, e, &e2);
}
static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
expdesc *e2) { expdesc *e2) {
int o1 = luaK_exp2RK(fs, e1); int o1 = luaK_exp2RK(fs, e1);
@ -703,27 +712,11 @@ static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
expdesc e2;
e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
switch (op) { switch (op) {
case OPR_MINUS: { case OPR_MINUS: codeunaryarith(fs, OP_UNM, e); break;
if (!isnumeral(e)) case OPR_BNOT: codeunaryarith(fs, OP_BNOT, e); break;
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
codearith(fs, OP_UNM, e, &e2);
break;
}
case OPR_BNOT: {
if (e->k == VK)
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
codearith(fs, OP_BNOT, e, &e2);
break;
}
case OPR_NOT: codenot(fs, e); break; case OPR_NOT: codenot(fs, e); break;
case OPR_LEN: { case OPR_LEN: codeunaryarith(fs, OP_LEN, e); break;
luaK_exp2anyreg(fs, e); /* cannot operate on constants */
codearith(fs, OP_LEN, e, &e2);
break;
}
default: lua_assert(0); default: lua_assert(0);
} }
} }

View file

@ -277,6 +277,9 @@ void Got_LuaFile(UINT8 **cp, INT32 playernum)
if (!luafiletransfers) if (!luafiletransfers)
I_Error("No Lua file transfer\n"); I_Error("No Lua file transfer\n");
lua_settop(gL, 0); // Just in case...
lua_pushcfunction(gL, LUA_GetErrorMessage);
// Retrieve the callback and push it on the stack // Retrieve the callback and push it on the stack
lua_pushfstring(gL, FMT_FILECALLBACKID, luafiletransfers->id); lua_pushfstring(gL, FMT_FILECALLBACKID, luafiletransfers->id);
lua_gettable(gL, LUA_REGISTRYINDEX); lua_gettable(gL, LUA_REGISTRYINDEX);
@ -304,7 +307,8 @@ void Got_LuaFile(UINT8 **cp, INT32 playernum)
lua_pushstring(gL, luafiletransfers->filename); lua_pushstring(gL, luafiletransfers->filename);
// Call the callback // Call the callback
LUA_Call(gL, 2); LUA_Call(gL, 2, 0, 1);
lua_settop(gL, 0);
if (success) if (success)
{ {

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -1433,6 +1433,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
if (var->revert.allocated) if (var->revert.allocated)
{ {
Z_Free(var->revert.v.string); Z_Free(var->revert.v.string);
var->revert.allocated = false; // the below value is not allocated in zone memory, don't try to free it!
} }
var->revert.v.const_munge = var->PossibleValue[i].strvalue; var->revert.v.const_munge = var->PossibleValue[i].strvalue;
@ -1440,6 +1441,10 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
return; return;
} }
// free the old value string
Z_Free(var->zstring);
var->zstring = NULL;
var->value = var->PossibleValue[i].value; var->value = var->PossibleValue[i].value;
var->string = var->PossibleValue[i].strvalue; var->string = var->PossibleValue[i].strvalue;
goto finish; goto finish;
@ -1502,13 +1507,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
found: found:
if (client && execversion_enabled) if (client && execversion_enabled)
{ {
if (var->revert.allocated)
{
Z_Free(var->revert.v.string);
}
var->revert.v.const_munge = var->PossibleValue[i].strvalue; var->revert.v.const_munge = var->PossibleValue[i].strvalue;
return; return;
} }
@ -1523,6 +1522,7 @@ found:
if (var->revert.allocated) if (var->revert.allocated)
{ {
Z_Free(var->revert.v.string); Z_Free(var->revert.v.string);
// Z_StrDup creates a new zone memory block, so we can keep the allocated flag on
} }
var->revert.v.string = Z_StrDup(valstr); var->revert.v.string = Z_StrDup(valstr);
@ -1577,7 +1577,7 @@ finish:
} }
var->flags |= CV_MODIFIED; var->flags |= CV_MODIFIED;
// raise 'on change' code // raise 'on change' code
LUA_CVarChanged(var->name); // let consolelib know what cvar this is. LUA_CVarChanged(var); // let consolelib know what cvar this is.
if (var->flags & CV_CALL && !stealth) if (var->flags & CV_CALL && !stealth)
var->func(); var->func();
@ -1787,6 +1787,7 @@ void CV_RevertNetVars(void)
if (cvar->revert.allocated) if (cvar->revert.allocated)
{ {
Z_Free(cvar->revert.v.string); Z_Free(cvar->revert.v.string);
cvar->revert.allocated = false; // no value being held now
} }
cvar->revert.v.string = NULL; cvar->revert.v.string = NULL;

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -158,7 +158,7 @@ typedef struct consvar_s //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NUL
/* name, defaultvalue, flags, PossibleValue, func */ /* name, defaultvalue, flags, PossibleValue, func */
#define CVAR_INIT( ... ) \ #define CVAR_INIT( ... ) \
{ __VA_ARGS__, 0, NULL, NULL, {0}, 0U, (char)0, NULL } { __VA_ARGS__, 0, NULL, NULL, {0, {NULL}}, 0U, (char)0, NULL }
#ifdef OLD22DEMOCOMPAT #ifdef OLD22DEMOCOMPAT
typedef struct old_demo_var old_demo_var_t; typedef struct old_demo_var old_demo_var_t;

View file

@ -34,12 +34,13 @@
* Last updated 2020 / 07 / 10 - v2.2.6 - player.dta & patch.pk3 * Last updated 2020 / 07 / 10 - v2.2.6 - player.dta & patch.pk3
* Last updated 2020 / 09 / 27 - v2.2.7 - patch.pk3 * Last updated 2020 / 09 / 27 - v2.2.7 - patch.pk3
* Last updated 2020 / 10 / 02 - v2.2.8 - patch.pk3 * Last updated 2020 / 10 / 02 - v2.2.8 - patch.pk3
* Last updated 2021 / 05 / 06 - v2.2.9 - patch.pk3 & zones.pk3
*/ */
#define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" #define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28"
#define ASSET_HASH_ZONES_PK3 "f7e88afb6af7996a834c7d663144bead" #define ASSET_HASH_ZONES_PK3 "f8f3e2b5deacf40f14e36686a07d44bb"
#define ASSET_HASH_PLAYER_DTA "49dad7b24634c89728cc3e0b689e12bb" #define ASSET_HASH_PLAYER_DTA "49dad7b24634c89728cc3e0b689e12bb"
#ifdef USE_PATCH_DTA #ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_PK3 "466cdf60075262b3f5baa5e07f0999e8" #define ASSET_HASH_PATCH_PK3 "7d467a883f7887b3c311798ee2f56b6a"
#endif #endif
#endif #endif

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -221,7 +221,7 @@ static void CONS_Bind_f(void)
for (key = 0; key < NUMINPUTS; key++) for (key = 0; key < NUMINPUTS; key++)
if (bindtable[key]) if (bindtable[key])
{ {
CONS_Printf("%s : \"%s\"\n", G_KeynumToString(key), bindtable[key]); CONS_Printf("%s : \"%s\"\n", G_KeyNumToString(key), bindtable[key]);
na = 1; na = 1;
} }
if (!na) if (!na)
@ -229,7 +229,7 @@ static void CONS_Bind_f(void)
return; return;
} }
key = G_KeyStringtoNum(COM_Argv(1)); key = G_KeyStringToNum(COM_Argv(1));
if (key <= 0 || key >= NUMINPUTS) if (key <= 0 || key >= NUMINPUTS)
{ {
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n")); CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));
@ -360,30 +360,48 @@ static void CON_SetupColormaps(void)
for (i = 0; i < (256*15); i++, ++memorysrc) for (i = 0; i < (256*15); i++, ++memorysrc)
*memorysrc = (UINT8)(i & 0xFF); // remap each color to itself... *memorysrc = (UINT8)(i & 0xFF); // remap each color to itself...
#define colset(map, a, b, c) \ #define colset(map, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
map[1] = (UINT8)a;\ map[0x0] = (UINT8)a;\
map[3] = (UINT8)b;\ map[0x1] = (UINT8)b;\
map[9] = (UINT8)c map[0x2] = (UINT8)c;\
map[0x3] = (UINT8)d;\
map[0x4] = (UINT8)e;\
map[0x5] = (UINT8)f;\
map[0x6] = (UINT8)g;\
map[0x7] = (UINT8)h;\
map[0x8] = (UINT8)i;\
map[0x9] = (UINT8)j;\
map[0xA] = (UINT8)k;\
map[0xB] = (UINT8)l;\
map[0xC] = (UINT8)m;\
map[0xD] = (UINT8)n;\
map[0xE] = (UINT8)o;\
map[0xF] = (UINT8)p;
colset(magentamap, 177, 178, 184); // Tried to keep the colors vanilla while adding some shades in between them ~SonicX8000
colset(yellowmap, 82, 73, 66);
colset(lgreenmap, 97, 98, 106); // 0x1 0x3 0x9 0xF
colset(bluemap, 146, 147, 155); colset(magentamap, 177, 177, 178, 178, 178, 180, 180, 180, 182, 182, 182, 182, 184, 184, 184, 185);
colset(redmap, 210, 32, 39); colset(yellowmap, 82, 82, 73, 73, 73, 64, 64, 64, 66, 66, 66, 66, 67, 67, 67, 68);
colset(graymap, 6, 8, 14); colset(lgreenmap, 96, 96, 98, 98, 98, 101, 101, 101, 104, 104, 104, 104, 106, 106, 106, 107);
colset(orangemap, 51, 52, 57); colset(bluemap, 146, 146, 147, 147, 147, 149, 149, 149, 152, 152, 152, 152, 155, 155, 155, 157);
colset(skymap, 129, 130, 133); colset(redmap, 32, 32, 33, 33, 33, 35, 35, 35, 39, 39, 39, 39, 42, 42, 42, 44);
colset(purplemap, 160, 161, 163); colset(graymap, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23);
colset(aquamap, 120, 121, 123); colset(orangemap, 50, 50, 52, 52, 52, 54, 54, 54, 56, 56, 56, 56, 59, 59, 59, 60);
colset(peridotmap, 88, 188, 190); colset(skymap, 129, 129, 130, 130, 130, 131, 131, 131, 133, 133, 133, 133, 135, 135, 135, 136);
colset(azuremap, 144, 145, 170); colset(purplemap, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165);
colset(brownmap, 219, 221, 224); colset(aquamap, 120, 120, 121, 121, 121, 122, 122, 122, 123, 123, 123, 123, 124, 124, 124, 125);
colset(rosymap, 200, 201, 203); colset(peridotmap, 72, 72, 188, 188, 189, 189, 189, 189, 190, 190, 190, 190, 191, 191, 191, 94);
colset(invertmap, 27, 26, 22); colset(azuremap, 144, 144, 145, 145, 145, 146, 146, 146, 170, 170, 170, 170, 171, 171, 171, 172);
invertmap[26] = (UINT8)3; colset(brownmap, 219, 219, 221, 221, 221, 222, 222, 222, 224, 224, 224, 224, 227, 227, 227, 229);
colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 202, 203, 203, 203, 203, 204, 204, 204, 205);
#undef colset #undef colset
// Yeah just straight up invert it like a normal person
for (i = 0x00; i <= 0x1F; i++)
invertmap[0x1F - i] = i;
// Init back colormap // Init back colormap
CON_SetupBackColormap(); CON_SetupBackColormap();
} }
@ -808,6 +826,12 @@ static void CON_InputDelSelection(void)
Lock_state(); Lock_state();
if (!input_cur)
{
Unlock_state();
return;
}
if (input_cur > input_sel) if (input_cur > input_sel)
{ {
start = input_sel; start = input_sel;
@ -1289,10 +1313,6 @@ boolean CON_Responder(event_t *ev)
if (key < 32 || key > 127) if (key < 32 || key > 127)
return true; return true;
// add key to cmd line here
if (key >= 'A' && key <= 'Z' && !(shiftdown ^ capslock)) //this is only really necessary for dedicated servers
key = key + 'a' - 'A';
if (input_sel != input_cur) if (input_sel != input_cur)
CON_InputDelSelection(); CON_InputDelSelection();
CON_InputAddChar(key); CON_InputAddChar(key);
@ -1687,12 +1707,15 @@ static void CON_DrawHudlines(void)
{ {
charflags = (*p & 0x7f) << V_CHARCOLORSHIFT; charflags = (*p & 0x7f) << V_CHARCOLORSHIFT;
p++; p++;
c++;
} }
if (c >= con_width)
break;
if (*p < HU_FONTSTART) if (*p < HU_FONTSTART)
;//charwidth = 4 * con_scalefactor; ;//charwidth = 4 * con_scalefactor;
else else
{ {
//charwidth = SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor; //charwidth = (hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true); V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true);
} }
} }
@ -1808,7 +1831,10 @@ static void CON_DrawConsole(void)
{ {
charflags = (*p & 0x7f) << V_CHARCOLORSHIFT; charflags = (*p & 0x7f) << V_CHARCOLORSHIFT;
p++; p++;
c++;
} }
if (c >= con_width)
break;
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true); V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true);
} }
} }

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -1565,15 +1565,6 @@ static void CL_LoadReceivedSavegame(boolean reloading)
} }
CONS_Printf("\"\n"); CONS_Printf("\"\n");
} }
else
{
CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n"));
Z_Free(savebuffer);
save_p = NULL;
if (unlink(tmpsave) == -1)
CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s\n"), tmpsave);
return;
}
// done // done
Z_Free(savebuffer); Z_Free(savebuffer);
@ -1595,9 +1586,7 @@ static void CL_ReloadReceivedSavegame(void)
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[i]); LUA_InvalidatePlayer(&players[i]);
#endif
sprintf(player_names[i], "Player %d", i + 1); sprintf(player_names[i], "Player %d", i + 1);
} }
@ -2260,11 +2249,15 @@ void D_SaveBan(void)
size_t i; size_t i;
banreason_t *reasonlist = reasonhead; banreason_t *reasonlist = reasonhead;
const char *address, *mask; const char *address, *mask;
const char *path = va("%s"PATHSEP"%s", srb2home, "ban.txt");
if (!reasonhead) if (!reasonhead)
{
remove(path);
return; return;
}
f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "w"); f = fopen(path, "w");
if (!f) if (!f)
{ {
@ -2308,16 +2301,14 @@ static void Ban_Add(const char *reason)
reasontail = reasonlist; reasontail = reasonlist;
} }
static void Command_ClearBans(void) static void Ban_Clear(void)
{ {
banreason_t *temp; banreason_t *temp;
if (!I_ClearBans)
return;
I_ClearBans(); I_ClearBans();
D_SaveBan();
reasontail = NULL; reasontail = NULL;
while (reasonhead) while (reasonhead)
{ {
temp = reasonhead->next; temp = reasonhead->next;
@ -2327,6 +2318,15 @@ static void Command_ClearBans(void)
} }
} }
static void Command_ClearBans(void)
{
if (!I_ClearBans)
return;
Ban_Clear();
D_SaveBan();
}
static void Ban_Load_File(boolean warning) static void Ban_Load_File(boolean warning)
{ {
FILE *f; FILE *f;
@ -2334,6 +2334,9 @@ static void Ban_Load_File(boolean warning)
const char *address, *mask; const char *address, *mask;
char buffer[MAX_WADPATH]; char buffer[MAX_WADPATH];
if (!I_ClearBans)
return;
f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "r"); f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "r");
if (!f) if (!f)
@ -2343,13 +2346,7 @@ static void Ban_Load_File(boolean warning)
return; return;
} }
if (I_ClearBans) Ban_Clear();
Command_ClearBans();
else
{
fclose(f);
return;
}
for (i=0; fgets(buffer, (int)sizeof(buffer), f); i++) for (i=0; fgets(buffer, (int)sizeof(buffer), f); i++)
{ {
@ -2539,14 +2536,14 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
} }
} }
LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting LUA_HookPlayerQuit(&players[playernum], reason); // Lua hook for player quitting
// don't look through someone's view who isn't there // don't look through someone's view who isn't there
if (playernum == displayplayer) if (playernum == displayplayer)
{ {
// Call ViewpointSwitch hooks here. // Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed. // The viewpoint was forcibly changed.
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true); LUA_HookViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
displayplayer = consoleplayer; displayplayer = consoleplayer;
} }
@ -2955,7 +2952,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
{ {
case KICK_MSG_GO_AWAY: case KICK_MSG_GO_AWAY:
if (!players[pnum].quittime) if (!players[pnum].quittime)
HU_AddChatText(va("\x82*%s has been kicked (Go away)", player_names[pnum]), false); HU_AddChatText(va("\x82*%s has been kicked (No reason given)", player_names[pnum]), false);
kickreason = KR_KICK; kickreason = KR_KICK;
break; break;
case KICK_MSG_PING_HIGH: case KICK_MSG_PING_HIGH:
@ -2963,7 +2960,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
kickreason = KR_PINGLIMIT; kickreason = KR_PINGLIMIT;
break; break;
case KICK_MSG_CON_FAIL: case KICK_MSG_CON_FAIL:
HU_AddChatText(va("\x82*%s left the game (Synch Failure)", player_names[pnum]), false); HU_AddChatText(va("\x82*%s left the game (Synch failure)", player_names[pnum]), false);
kickreason = KR_SYNCH; kickreason = KR_SYNCH;
if (M_CheckParm("-consisdump")) // Helps debugging some problems if (M_CheckParm("-consisdump")) // Helps debugging some problems
@ -3009,7 +3006,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
kickreason = KR_LEAVE; kickreason = KR_LEAVE;
break; break;
case KICK_MSG_BANNED: case KICK_MSG_BANNED:
HU_AddChatText(va("\x82*%s has been banned (Don't come back)", player_names[pnum]), false); HU_AddChatText(va("\x82*%s has been banned (No reason given)", player_names[pnum]), false);
kickreason = KR_BAN; kickreason = KR_BAN;
break; break;
case KICK_MSG_CUSTOM_KICK: case KICK_MSG_CUSTOM_KICK:
@ -3026,8 +3023,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
if (pnum == consoleplayer) if (pnum == consoleplayer)
{ {
if (Playing()) LUA_HookBool(false, HOOK(GameQuit));
LUAh_GameQuit();
#ifdef DUMPCONSISTENCY #ifdef DUMPCONSISTENCY
if (msg == KICK_MSG_CON_FAIL) SV_SavedGame(); if (msg == KICK_MSG_CON_FAIL) SV_SavedGame();
#endif #endif
@ -3107,7 +3103,7 @@ consvar_t cv_maxplayers = CVAR_INIT ("maxplayers", "8", CV_SAVE|CV_NETVAR, maxpl
static CV_PossibleValue_t joindelay_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, "Off"}, {0, NULL}}; static CV_PossibleValue_t joindelay_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, "Off"}, {0, NULL}};
consvar_t cv_joindelay = CVAR_INIT ("joindelay", "10", CV_SAVE|CV_NETVAR, joindelay_cons_t, NULL); consvar_t cv_joindelay = CVAR_INIT ("joindelay", "10", CV_SAVE|CV_NETVAR, joindelay_cons_t, NULL);
static CV_PossibleValue_t rejointimeout_cons_t[] = {{1, "MIN"}, {60 * FRACUNIT, "MAX"}, {0, "Off"}, {0, NULL}}; static CV_PossibleValue_t rejointimeout_cons_t[] = {{1, "MIN"}, {60 * FRACUNIT, "MAX"}, {0, "Off"}, {0, NULL}};
consvar_t cv_rejointimeout = CVAR_INIT ("rejointimeout", "Off", CV_SAVE|CV_NETVAR|CV_FLOAT, rejointimeout_cons_t, NULL); consvar_t cv_rejointimeout = CVAR_INIT ("rejointimeout", "2", CV_SAVE|CV_NETVAR|CV_FLOAT, rejointimeout_cons_t, NULL);
static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "No"}, {0, NULL}}; static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "No"}, {0, NULL}};
consvar_t cv_resynchattempts = CVAR_INIT ("resynchattempts", "10", CV_SAVE|CV_NETVAR, resynchattempts_cons_t, NULL); consvar_t cv_resynchattempts = CVAR_INIT ("resynchattempts", "10", CV_SAVE|CV_NETVAR, resynchattempts_cons_t, NULL);
@ -3447,7 +3443,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
COM_BufAddText(va("sayto %d %s\n", newplayernum, motd)); COM_BufAddText(va("sayto %d %s\n", newplayernum, motd));
if (!rejoined) if (!rejoined)
LUAh_PlayerJoin(newplayernum); LUA_HookInt(newplayernum, HOOK(PlayerJoin));
} }
static boolean SV_AddWaitingPlayers(const char *name, const char *name2) static boolean SV_AddWaitingPlayers(const char *name, const char *name2)
@ -3727,8 +3723,7 @@ static void HandleConnect(SINT8 node)
static void HandleShutdown(SINT8 node) static void HandleShutdown(SINT8 node)
{ {
(void)node; (void)node;
if (Playing()) LUA_HookBool(false, HOOK(GameQuit));
LUAh_GameQuit();
D_QuitNetGame(); D_QuitNetGame();
CL_Reset(); CL_Reset();
D_StartTitle(); D_StartTitle();
@ -3743,8 +3738,7 @@ static void HandleShutdown(SINT8 node)
static void HandleTimeout(SINT8 node) static void HandleTimeout(SINT8 node)
{ {
(void)node; (void)node;
if (Playing()) LUA_HookBool(false, HOOK(GameQuit));
LUAh_GameQuit();
D_QuitNetGame(); D_QuitNetGame();
CL_Reset(); CL_Reset();
D_StartTitle(); D_StartTitle();
@ -4265,7 +4259,7 @@ static void HandlePacketFromPlayer(SINT8 node)
case PT_RECEIVEDGAMESTATE: case PT_RECEIVEDGAMESTATE:
sendingsavegame[node] = false; sendingsavegame[node] = false;
resendingsavegame[node] = false; resendingsavegame[node] = false;
savegameresendcooldown[node] = I_GetTime() + 15 * TICRATE; savegameresendcooldown[node] = I_GetTime() + 5 * TICRATE;
break; break;
// -------------------------------------------- CLIENT RECEIVE ---------- // -------------------------------------------- CLIENT RECEIVE ----------
case PT_SERVERTICS: case PT_SERVERTICS:
@ -4477,6 +4471,8 @@ static INT16 Consistancy(void)
ret += P_GetRandSeed(); ret += P_GetRandSeed();
#ifdef MOBJCONSISTANCY #ifdef MOBJCONSISTANCY
if (gamestate == GS_LEVEL)
{
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{ {
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
@ -4543,6 +4539,7 @@ static INT16 Consistancy(void)
ret += mo->frame; ret += mo->frame;
} }
} }
}
#endif #endif
DEBFILE(va("Consistancy = %u\n", (ret & 0xFFFF))); DEBFILE(va("Consistancy = %u\n", (ret & 0xFFFF)));
@ -4847,14 +4844,14 @@ void TryRunTics(tic_t realtics)
{ {
DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic)); DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic));
ps_tictime = I_GetTimeMicros(); ps_tictime = I_GetPreciseTime();
G_Ticker((gametic % NEWTICRATERATIO) == 0); G_Ticker((gametic % NEWTICRATERATIO) == 0);
ExtraDataTicker(); ExtraDataTicker();
gametic++; gametic++;
consistancy[gametic%BACKUPTICS] = Consistancy(); consistancy[gametic%BACKUPTICS] = Consistancy();
ps_tictime = I_GetTimeMicros() - ps_tictime; ps_tictime = I_GetPreciseTime() - ps_tictime;
// Leave a certain amount of tics present in the net buffer as long as we've ran at least one tic this frame. // Leave a certain amount of tics present in the net buffer as long as we've ran at least one tic this frame.
if (client && gamestate == GS_LEVEL && leveltime > 3 && neededtic <= gametic + cv_netticbuffer.value) if (client && gamestate == GS_LEVEL && leveltime > 3 && neededtic <= gametic + cv_netticbuffer.value)

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -15,7 +15,7 @@
/// plus functions to parse command line parameters, configure game /// plus functions to parse command line parameters, configure game
/// parameters, and call the startup functions. /// parameters, and call the startup functions.
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@ -61,7 +61,7 @@
#include "p_local.h" // chasecam #include "p_local.h" // chasecam
#include "mserv.h" // ms_RoomId #include "mserv.h" // ms_RoomId
#include "m_misc.h" // screenshot functionality #include "m_misc.h" // screenshot functionality
#include "dehacked.h" // Dehacked list test #include "deh_tables.h" // Dehacked list test
#include "m_cond.h" // condition initialization #include "m_cond.h" // condition initialization
#include "fastcmp.h" #include "fastcmp.h"
#include "keys.h" #include "keys.h"
@ -175,10 +175,53 @@ void D_ProcessEvents(void)
boolean eaten; boolean eaten;
// Reset possibly stale mouse info
G_SetMouseDeltas(0, 0, 1);
G_SetMouseDeltas(0, 0, 2);
mouse.buttons &= ~(MB_SCROLLUP|MB_SCROLLDOWN);
mouse2.buttons &= ~(MB_SCROLLUP|MB_SCROLLDOWN);
for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1)) for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1))
{ {
boolean hooked = false;
ev = &events[eventtail]; ev = &events[eventtail];
// Set mouse buttons early in case event is eaten later
if (ev->type == ev_keydown || ev->type == ev_keyup)
{
// Mouse buttons
if ((UINT32)(ev->data1 - KEY_MOUSE1) < MOUSEBUTTONS)
{
if (ev->type == ev_keydown)
mouse.buttons |= 1 << (ev->data1 - KEY_MOUSE1);
else
mouse.buttons &= ~(1 << (ev->data1 - KEY_MOUSE1));
}
else if ((UINT32)(ev->data1 - KEY_2MOUSE1) < MOUSEBUTTONS)
{
if (ev->type == ev_keydown)
mouse2.buttons |= 1 << (ev->data1 - KEY_2MOUSE1);
else
mouse2.buttons &= ~(1 << (ev->data1 - KEY_2MOUSE1));
}
// Scroll (has no keyup event)
else switch (ev->data1) {
case KEY_MOUSEWHEELUP:
mouse.buttons |= MB_SCROLLUP;
break;
case KEY_MOUSEWHEELDOWN:
mouse.buttons |= MB_SCROLLDOWN;
break;
case KEY_2MOUSEWHEELUP:
mouse2.buttons |= MB_SCROLLUP;
break;
case KEY_2MOUSEWHEELDOWN:
mouse2.buttons |= MB_SCROLLDOWN;
break;
}
}
// Screenshots over everything so that they can be taken anywhere. // Screenshots over everything so that they can be taken anywhere.
if (M_ScreenshotResponder(ev)) if (M_ScreenshotResponder(ev))
continue; // ate the event continue; // ate the event
@ -189,6 +232,12 @@ void D_ProcessEvents(void)
continue; continue;
} }
if (!CON_Ready() && !menuactive) {
if (G_LuaResponder(ev))
continue;
hooked = true;
}
// Menu input // Menu input
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex); I_lock_mutex(&m_menu_mutex);
@ -203,6 +252,12 @@ void D_ProcessEvents(void)
if (eaten) if (eaten)
continue; // menu ate the event continue; // menu ate the event
if (!hooked && !CON_Ready()) {
if (G_LuaResponder(ev))
continue;
hooked = true;
}
// console input // console input
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
I_lock_mutex(&con_mutex); I_lock_mutex(&con_mutex);
@ -217,8 +272,16 @@ void D_ProcessEvents(void)
if (eaten) if (eaten)
continue; // ate the event continue; // ate the event
if (!hooked && G_LuaResponder(ev))
continue;
G_Responder(ev); G_Responder(ev);
} }
if (mouse.rdx || mouse.rdy)
G_SetMouseDeltas(mouse.rdx, mouse.rdy, 1);
if (mouse2.rdx || mouse2.rdy)
G_SetMouseDeltas(mouse2.rdx, mouse2.rdy, 2);
} }
// //
@ -413,7 +476,7 @@ static void D_Display(void)
if (!automapactive && !dedicated && cv_renderview.value) if (!automapactive && !dedicated && cv_renderview.value)
{ {
ps_rendercalltime = I_GetTimeMicros(); ps_rendercalltime = I_GetPreciseTime();
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
{ {
topleft = screens[0] + viewwindowy*vid.width + viewwindowx; topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
@ -460,7 +523,7 @@ static void D_Display(void)
if (postimgtype2) if (postimgtype2)
V_DoPostProcessor(1, postimgtype2, postimgparam2); V_DoPostProcessor(1, postimgtype2, postimgparam2);
} }
ps_rendercalltime = I_GetTimeMicros() - ps_rendercalltime; ps_rendercalltime = I_GetPreciseTime() - ps_rendercalltime;
} }
if (lastdraw) if (lastdraw)
@ -474,7 +537,7 @@ static void D_Display(void)
lastdraw = false; lastdraw = false;
} }
ps_uitime = I_GetTimeMicros(); ps_uitime = I_GetPreciseTime();
if (gamestate == GS_LEVEL) if (gamestate == GS_LEVEL)
{ {
@ -487,7 +550,7 @@ static void D_Display(void)
} }
else else
{ {
ps_uitime = I_GetTimeMicros(); ps_uitime = I_GetPreciseTime();
} }
} }
@ -507,7 +570,7 @@ static void D_Display(void)
else else
py = viewwindowy + 4; py = viewwindowy + 4;
patch = W_CachePatchName("M_PAUSE", PU_PATCH); patch = W_CachePatchName("M_PAUSE", PU_PATCH);
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch); V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - patch->width)/2, py, 0, patch);
#else #else
INT32 y = ((automapactive) ? (32) : (BASEVIDHEIGHT/2)); INT32 y = ((automapactive) ? (32) : (BASEVIDHEIGHT/2));
M_DrawTextBox((BASEVIDWIDTH/2) - (60), y - (16), 13, 2); M_DrawTextBox((BASEVIDWIDTH/2) - (60), y - (16), 13, 2);
@ -529,7 +592,7 @@ static void D_Display(void)
CON_Drawer(); CON_Drawer();
ps_uitime = I_GetTimeMicros() - ps_uitime; ps_uitime = I_GetPreciseTime() - ps_uitime;
// //
// wipe update // wipe update
@ -615,9 +678,9 @@ static void D_Display(void)
M_DrawPerfStats(); M_DrawPerfStats();
} }
ps_swaptime = I_GetTimeMicros(); ps_swaptime = I_GetPreciseTime();
I_FinishUpdate(); // page flip or blit buffer I_FinishUpdate(); // page flip or blit buffer
ps_swaptime = I_GetTimeMicros() - ps_swaptime; ps_swaptime = I_GetPreciseTime() - ps_swaptime;
} }
} }
@ -652,6 +715,8 @@ void D_SRB2Loop(void)
SCR_SetMode(); // change video mode SCR_SetMode(); // change video mode
SCR_Recalc(); SCR_Recalc();
chosenrendermode = render_none;
// Check and print which version is executed. // Check and print which version is executed.
// Use this as the border between setup and the main game loop being entered. // Use this as the border between setup and the main game loop being entered.
CONS_Printf( CONS_Printf(
@ -932,7 +997,7 @@ static void IdentifyVersion(void)
char *srb2wad; char *srb2wad;
const char *srb2waddir = NULL; const char *srb2waddir = NULL;
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) #if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
// change to the directory where 'srb2.pk3' is found // change to the directory where 'srb2.pk3' is found
srb2waddir = I_LocateWad(); srb2waddir = I_LocateWad();
#endif #endif
@ -996,7 +1061,7 @@ static void IdentifyVersion(void)
#define MUSICTEST(str) \ #define MUSICTEST(str) \
{\ {\
const char *musicpath = va(pandf,srb2waddir,str);\ const char *musicpath = va(pandf,srb2waddir,str);\
int ms = W_VerifyNMUSlumps(musicpath); \ int ms = W_VerifyNMUSlumps(musicpath, false); \
if (ms == 1) \ if (ms == 1) \
D_AddFile(startupwadfiles, musicpath); \ D_AddFile(startupwadfiles, musicpath); \
else if (ms == 0) \ else if (ms == 0) \
@ -1043,7 +1108,7 @@ void D_SRB2Main(void)
// Print GPL notice for our console users (Linux) // Print GPL notice for our console users (Linux)
CONS_Printf( CONS_Printf(
"\n\nSonic Robo Blast 2\n" "\n\nSonic Robo Blast 2\n"
"Copyright (C) 1998-2020 by Sonic Team Junior\n\n" "Copyright (C) 1998-2021 by Sonic Team Junior\n\n"
"This program comes with ABSOLUTELY NO WARRANTY.\n\n" "This program comes with ABSOLUTELY NO WARRANTY.\n\n"
"This is free software, and you are welcome to redistribute it\n" "This is free software, and you are welcome to redistribute it\n"
"and/or modify it under the terms of the GNU General Public License\n" "and/or modify it under the terms of the GNU General Public License\n"
@ -1070,7 +1135,7 @@ void D_SRB2Main(void)
G_LoadGameSettings(); G_LoadGameSettings();
// Test Dehacked lists // Test Dehacked lists
DEH_Check(); DEH_TableCheck();
// Netgame URL special case: change working dir to EXE folder. // Netgame URL special case: change working dir to EXE folder.
ChangeDirForUrlHandler(); ChangeDirForUrlHandler();
@ -1105,7 +1170,7 @@ void D_SRB2Main(void)
if (!userhome) if (!userhome)
{ {
#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) #if (defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)
I_Error("Please set $HOME to your home directory\n"); I_Error("Please set $HOME to your home directory\n");
#else #else
if (dedicated) if (dedicated)
@ -1185,14 +1250,10 @@ void D_SRB2Main(void)
const char *s = M_GetNextParm(); const char *s = M_GetNextParm();
if (s) // Check for NULL? if (s) // Check for NULL?
{
if (!W_VerifyNMUSlumps(s))
G_SetGameModified(true);
D_AddFile(startuppwads, s); D_AddFile(startuppwads, s);
} }
} }
} }
}
// get map from parms // get map from parms
@ -1289,26 +1350,13 @@ void D_SRB2Main(void)
G_LoadGameData(); G_LoadGameData();
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) #if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
#endif #endif
// set user default mode or mode set at cmdline // set user default mode or mode set at cmdline
SCR_CheckDefaultMode(); SCR_CheckDefaultMode();
// Lactozilla: Check if the render mode needs to change.
if (setrenderneeded)
{
CONS_Printf(M_GetText("Switching the renderer...\n"));
// Switch the renderer in the interface
if (VID_CheckRenderer())
con_refresh = true; // Allow explicit screen refresh again
// Set cv_renderer to the new render mode
CV_StealthSetValue(&cv_renderer, rendermode);
}
wipegamestate = gamestate; wipegamestate = gamestate;
savedata.lives = 0; // flag this as not-used savedata.lives = 0; // flag this as not-used
@ -1568,7 +1616,7 @@ const char *D_Home(void)
userhome = M_GetNextParm(); userhome = M_GetNextParm();
else else
{ {
#if !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__) #if !(defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON))
if (FIL_FileOK(CONFIGFILENAME)) if (FIL_FileOK(CONFIGFILENAME))
usehome = false; // Let's NOT use home usehome = false; // Let's NOT use home
else else

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -40,10 +40,6 @@ void D_SRB2Main(void);
// Called by IO functions when input is detected. // Called by IO functions when input is detected.
void D_PostEvent(const event_t *ev); void D_PostEvent(const event_t *ev);
#if defined (PC_DOS) && !defined (DOXYGEN)
void D_PostEvent_end(void); // delimiter for locking memory
#endif
void D_ProcessEvents(void); void D_ProcessEvents(void);
const char *D_Home(void); const char *D_Home(void);

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -168,7 +168,7 @@ void SendWeaponPref(void);
void SendWeaponPref2(void); void SendWeaponPref2(void);
static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}}; static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}};
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
static CV_PossibleValue_t mouse2port_cons_t[] = {{0, "/dev/gpmdata"}, {1, "/dev/ttyS0"}, static CV_PossibleValue_t mouse2port_cons_t[] = {{0, "/dev/gpmdata"}, {1, "/dev/ttyS0"},
{2, "/dev/ttyS1"}, {3, "/dev/ttyS2"}, {4, "/dev/ttyS3"}, {0, NULL}}; {2, "/dev/ttyS1"}, {3, "/dev/ttyS2"}, {4, "/dev/ttyS3"}, {0, NULL}};
#else #else
@ -214,11 +214,9 @@ consvar_t cv_respawntime = CVAR_INIT ("respawndelay", "3", CV_SAVE|CV_NETVAR|CV_
consvar_t cv_competitionboxes = CVAR_INIT ("competitionboxes", "Mystery", CV_SAVE|CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL); consvar_t cv_competitionboxes = CVAR_INIT ("competitionboxes", "Mystery", CV_SAVE|CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL);
#ifdef SEENAMES
static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}}; static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}};
consvar_t cv_seenames = CVAR_INIT ("seenames", "Ally/Foe", CV_SAVE, seenames_cons_t, 0); consvar_t cv_seenames = CVAR_INIT ("seenames", "Ally/Foe", CV_SAVE, seenames_cons_t, 0);
consvar_t cv_allowseenames = CVAR_INIT ("allowseenames", "Yes", CV_SAVE|CV_NETVAR, CV_YesNo, NULL); consvar_t cv_allowseenames = CVAR_INIT ("allowseenames", "Yes", CV_SAVE|CV_NETVAR, CV_YesNo, NULL);
#endif
// names // names
consvar_t cv_playername = CVAR_INIT ("name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange); consvar_t cv_playername = CVAR_INIT ("name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange);
@ -257,7 +255,7 @@ consvar_t cv_joyscale2 = CVAR_INIT ("padscale2", "1", CV_SAVE|CV_CALL, NULL, I_J
consvar_t cv_joyscale = CVAR_INIT ("padscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save consvar_t cv_joyscale = CVAR_INIT ("padscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save
consvar_t cv_joyscale2 = CVAR_INIT ("padscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save consvar_t cv_joyscale2 = CVAR_INIT ("padscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save
#endif #endif
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
consvar_t cv_mouse2port = CVAR_INIT ("mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL); consvar_t cv_mouse2port = CVAR_INIT ("mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL);
consvar_t cv_mouse2opt = CVAR_INIT ("mouse2opt", "0", CV_SAVE, NULL, NULL); consvar_t cv_mouse2opt = CVAR_INIT ("mouse2opt", "0", CV_SAVE, NULL, NULL);
#else #else
@ -374,6 +372,7 @@ consvar_t cv_sleep = CVAR_INIT ("cpusleep", "1", CV_SAVE, sleeping_cons_t, NULL)
static CV_PossibleValue_t perfstats_cons_t[] = { static CV_PossibleValue_t perfstats_cons_t[] = {
{0, "Off"}, {1, "Rendering"}, {2, "Logic"}, {3, "ThinkFrame"}, {0, NULL}}; {0, "Off"}, {1, "Rendering"}, {2, "Logic"}, {3, "ThinkFrame"}, {0, NULL}};
consvar_t cv_perfstats = CVAR_INIT ("perfstats", "Off", 0, perfstats_cons_t, NULL); consvar_t cv_perfstats = CVAR_INIT ("perfstats", "Off", 0, perfstats_cons_t, NULL);
consvar_t cv_freedemocamera = CVAR_INIT("freedemocamera", "Off", CV_SAVE, CV_OnOff, NULL);
char timedemo_name[256]; char timedemo_name[256];
boolean timedemo_csv; boolean timedemo_csv;
@ -596,9 +595,7 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_pingtimeout); CV_RegisterVar(&cv_pingtimeout);
CV_RegisterVar(&cv_showping); CV_RegisterVar(&cv_showping);
#ifdef SEENAMES
CV_RegisterVar(&cv_allowseenames); CV_RegisterVar(&cv_allowseenames);
#endif
CV_RegisterVar(&cv_dummyconsvar); CV_RegisterVar(&cv_dummyconsvar);
} }
@ -669,6 +666,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_zlib_strategya); CV_RegisterVar(&cv_zlib_strategya);
CV_RegisterVar(&cv_zlib_window_bitsa); CV_RegisterVar(&cv_zlib_window_bitsa);
CV_RegisterVar(&cv_apng_delay); CV_RegisterVar(&cv_apng_delay);
CV_RegisterVar(&cv_apng_downscale);
// GIF variables // GIF variables
CV_RegisterVar(&cv_gif_optimize); CV_RegisterVar(&cv_gif_optimize);
CV_RegisterVar(&cv_gif_downscale); CV_RegisterVar(&cv_gif_downscale);
@ -689,9 +687,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_defaultplayercolor2); CV_RegisterVar(&cv_defaultplayercolor2);
CV_RegisterVar(&cv_defaultskin2); CV_RegisterVar(&cv_defaultskin2);
#ifdef SEENAMES
CV_RegisterVar(&cv_seenames); CV_RegisterVar(&cv_seenames);
#endif
CV_RegisterVar(&cv_rollingdemos); CV_RegisterVar(&cv_rollingdemos);
CV_RegisterVar(&cv_netstat); CV_RegisterVar(&cv_netstat);
CV_RegisterVar(&cv_netticbuffer); CV_RegisterVar(&cv_netticbuffer);
@ -792,7 +788,7 @@ void D_RegisterClientCommands(void)
// WARNING: the order is important when initialising mouse2 // WARNING: the order is important when initialising mouse2
// we need the mouse2port // we need the mouse2port
CV_RegisterVar(&cv_mouse2port); CV_RegisterVar(&cv_mouse2port);
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
CV_RegisterVar(&cv_mouse2opt); CV_RegisterVar(&cv_mouse2opt);
#endif #endif
CV_RegisterVar(&cv_controlperkey); CV_RegisterVar(&cv_controlperkey);
@ -892,6 +888,8 @@ void D_RegisterClientCommands(void)
// CV_RegisterVar(&cv_grid); // CV_RegisterVar(&cv_grid);
// CV_RegisterVar(&cv_snapto); // CV_RegisterVar(&cv_snapto);
CV_RegisterVar(&cv_freedemocamera);
// add cheat commands // add cheat commands
COM_AddCommand("noclip", Command_CheatNoClip_f); COM_AddCommand("noclip", Command_CheatNoClip_f);
COM_AddCommand("god", Command_CheatGod_f); COM_AddCommand("god", Command_CheatGod_f);
@ -1331,8 +1329,9 @@ static void SendNameAndColor(void)
cv_skin.value = R_SkinAvailable(cv_skin.string); cv_skin.value = R_SkinAvailable(cv_skin.string);
if ((cv_skin.value < 0) || !R_SkinUsable(consoleplayer, cv_skin.value)) if ((cv_skin.value < 0) || !R_SkinUsable(consoleplayer, cv_skin.value))
{ {
CV_StealthSet(&cv_skin, DEFAULTSKIN); INT32 defaultSkinNum = GetPlayerDefaultSkin(consoleplayer);
cv_skin.value = 0; CV_StealthSet(&cv_skin, skins[defaultSkinNum].name);
cv_skin.value = defaultSkinNum;
} }
// Finally write out the complete packet and send it off. // Finally write out the complete packet and send it off.
@ -1493,7 +1492,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer])) if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer]))
{ {
boolean kick = false; boolean kick = false;
INT32 s; UINT32 unlockShift = 0;
UINT32 i;
// team colors // team colors
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
@ -1509,12 +1509,29 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
kick = true; kick = true;
// availabilities // availabilities
for (s = 0; s < MAXSKINS; s++) for (i = 0; i < MAXUNLOCKABLES; i++)
{ {
if (!skins[s].availability && (p->availabilities & (1 << s))) if (unlockables[i].type != SECRET_SKIN)
{
continue;
}
unlockShift++;
}
// If they set an invalid bit to true, then likely a modified client
if (unlockShift < 32) // 32 is the max the data type allows
{
UINT32 illegalMask = UINT32_MAX;
for (i = 0; i < unlockShift; i++)
{
illegalMask &= ~(1 << i);
}
if ((p->availabilities & illegalMask) != 0)
{ {
kick = true; kick = true;
break;
} }
} }
@ -2116,7 +2133,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
} }
mapnumber = M_MapNumber(mapname[3], mapname[4]); mapnumber = M_MapNumber(mapname[3], mapname[4]);
LUAh_MapChange(mapnumber); LUA_HookInt(mapnumber, HOOK(MapChange));
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS); G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS);
if (demoplayback && !timingdemo) if (demoplayback && !timingdemo)
@ -2148,7 +2165,7 @@ static void Command_Pause(void)
if (cv_pause.value || server || (IsPlayerAdmin(consoleplayer))) if (cv_pause.value || server || (IsPlayerAdmin(consoleplayer)))
{ {
if (modeattacking || !(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION)) if (modeattacking || !(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION) || (marathonmode && gamestate == GS_INTERMISSION))
{ {
CONS_Printf(M_GetText("You can't pause here.\n")); CONS_Printf(M_GetText("You can't pause here.\n"));
return; return;
@ -2701,7 +2718,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
} }
// Don't switch team, just go away, please, go awaayyyy, aaauuauugghhhghgh // 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)) if (!LUA_HookTeamSwitch(&players[playernum], NetPacket.packet.newteam, players[playernum].spectator, NetPacket.packet.autobalance, NetPacket.packet.scrambled))
return; return;
//no status changes after hidetime //no status changes after hidetime
@ -2862,7 +2879,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
// Call ViewpointSwitch hooks here. // Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed. // The viewpoint was forcibly changed.
if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal. if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal.
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true); LUA_HookViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
displayplayer = consoleplayer; displayplayer = consoleplayer;
} }
@ -3307,7 +3324,13 @@ static void Command_Addfile(void)
if (!isprint(fn[i]) || fn[i] == ';') if (!isprint(fn[i]) || fn[i] == ';')
return; return;
musiconly = W_VerifyNMUSlumps(fn); musiconly = W_VerifyNMUSlumps(fn, false);
if (musiconly == -1)
{
addedfiles[numfilesadded++] = fn;
continue;
}
if (!musiconly) if (!musiconly)
{ {
@ -3619,8 +3642,7 @@ static void Command_Playintro_f(void)
*/ */
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void) FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void)
{ {
if (Playing()) LUA_HookBool(true, HOOK(GameQuit));
LUAh_GameQuit();
I_Quit(); I_Quit();
} }
@ -4282,8 +4304,7 @@ void Command_ExitGame_f(void)
{ {
INT32 i; INT32 i;
if (Playing()) LUA_HookBool(false, HOOK(GameQuit));
LUAh_GameQuit();
D_QuitNetGame(); D_QuitNetGame();
CL_Reset(); CL_Reset();

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -31,9 +31,7 @@ extern consvar_t cv_defaultskin;
extern consvar_t cv_defaultplayercolor2; extern consvar_t cv_defaultplayercolor2;
extern consvar_t cv_defaultskin2; extern consvar_t cv_defaultskin2;
#ifdef SEENAMES
extern consvar_t cv_seenames, cv_allowseenames; extern consvar_t cv_seenames, cv_allowseenames;
#endif
extern consvar_t cv_usemouse; extern consvar_t cv_usemouse;
extern consvar_t cv_usejoystick; extern consvar_t cv_usejoystick;
extern consvar_t cv_usejoystick2; extern consvar_t cv_usejoystick2;
@ -47,7 +45,7 @@ extern consvar_t cv_joyscale2;
// splitscreen with second mouse // splitscreen with second mouse
extern consvar_t cv_mouse2port; extern consvar_t cv_mouse2port;
extern consvar_t cv_usemouse2; extern consvar_t cv_usemouse2;
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
extern consvar_t cv_mouse2opt; extern consvar_t cv_mouse2opt;
#endif #endif
@ -118,6 +116,8 @@ extern boolean timedemo_csv;
extern char timedemo_csv_id[256]; extern char timedemo_csv_id[256];
extern boolean timedemo_quit; extern boolean timedemo_quit;
extern consvar_t cv_freedemocamera;
typedef enum typedef enum
{ {
XD_NAMEANDCOLOR = 1, XD_NAMEANDCOLOR = 1,

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -15,7 +15,7 @@
#include <time.h> #include <time.h>
#if defined (_WIN32) || defined (__DJGPP__) #ifdef _WIN32
#include <io.h> #include <io.h>
#include <direct.h> #include <direct.h>
#else #else
@ -30,10 +30,6 @@
#elif defined (_WIN32) #elif defined (_WIN32)
#include <sys/utime.h> #include <sys/utime.h>
#endif #endif
#ifdef __DJGPP__
#include <dir.h>
#include <utime.h>
#endif
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
@ -562,7 +558,7 @@ static void SV_PrepareSendLuaFileToNextNode(void)
// Find a client to send the file to // Find a client to send the file to
for (i = 1; i < MAXNETNODES; i++) for (i = 1; i < MAXNETNODES; i++)
if (nodeingame[i] && luafiletransfers->nodestatus[i] == LFTNS_WAITING) // Node waiting if (luafiletransfers->nodestatus[i] == LFTNS_WAITING) // Node waiting
{ {
// Tell the client we're about to send them the file // Tell the client we're about to send them the file
netbuffer->packettype = PT_SENDINGLUAFILE; netbuffer->packettype = PT_SENDINGLUAFILE;
@ -570,6 +566,7 @@ static void SV_PrepareSendLuaFileToNextNode(void)
I_Error("Failed to send a PT_SENDINGLUAFILE packet\n"); // !!! Todo: Handle failure a bit better lol I_Error("Failed to send a PT_SENDINGLUAFILE packet\n"); // !!! Todo: Handle failure a bit better lol
luafiletransfers->nodestatus[i] = LFTNS_ASKED; luafiletransfers->nodestatus[i] = LFTNS_ASKED;
luafiletransfers->nodetimeouts[i] = I_GetTime() + 30 * TICRATE;
return; return;
} }
@ -588,7 +585,7 @@ void SV_PrepareSendLuaFile(void)
// Set status to "waiting" for everyone // Set status to "waiting" for everyone
for (i = 0; i < MAXNETNODES; i++) for (i = 0; i < MAXNETNODES; i++)
luafiletransfers->nodestatus[i] = LFTNS_WAITING; luafiletransfers->nodestatus[i] = (nodeingame[i] ? LFTNS_WAITING : LFTNS_NONE);
if (FIL_ReadFileOK(luafiletransfers->realfilename)) if (FIL_ReadFileOK(luafiletransfers->realfilename))
{ {
@ -649,13 +646,15 @@ void RemoveAllLuaFileTransfers(void)
void SV_AbortLuaFileTransfer(INT32 node) void SV_AbortLuaFileTransfer(INT32 node)
{ {
if (luafiletransfers if (luafiletransfers)
&& (luafiletransfers->nodestatus[node] == LFTNS_ASKED {
|| luafiletransfers->nodestatus[node] == LFTNS_SENDING)) if (luafiletransfers->nodestatus[node] == LFTNS_ASKED
|| luafiletransfers->nodestatus[node] == LFTNS_SENDING)
{ {
luafiletransfers->nodestatus[node] = LFTNS_WAITING;
SV_PrepareSendLuaFileToNextNode(); SV_PrepareSendLuaFileToNextNode();
} }
luafiletransfers->nodestatus[node] = LFTNS_NONE;
}
} }
void CL_PrepareDownloadLuaFile(void) void CL_PrepareDownloadLuaFile(void)
@ -928,6 +927,22 @@ void FileSendTicker(void)
filetx_t *f; filetx_t *f;
INT32 packetsent, ram, i, j; INT32 packetsent, ram, i, j;
// If someone is taking too long to download, kick them with a timeout
// to prevent blocking the rest of the server...
if (luafiletransfers)
{
for (i = 1; i < MAXNETNODES; i++)
{
luafiletransfernodestatus_t status = luafiletransfers->nodestatus[i];
if (status != LFTNS_NONE && status != LFTNS_WAITING && status != LFTNS_SENT
&& I_GetTime() > luafiletransfers->nodetimeouts[i])
{
Net_ConnectionTimeout(i);
}
}
}
if (!filestosend) // No file to send if (!filestosend) // No file to send
return; return;

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -85,6 +85,7 @@ boolean PT_RequestFile(INT32 node);
typedef enum typedef enum
{ {
LFTNS_NONE, // This node is not connected
LFTNS_WAITING, // This node is waiting for the server to send the file LFTNS_WAITING, // This node is waiting for the server to send the file
LFTNS_ASKED, // The server has told the node they're ready to send the file LFTNS_ASKED, // The server has told the node they're ready to send the file
LFTNS_SENDING, // The server is sending the file to this node LFTNS_SENDING, // The server is sending the file to this node
@ -99,6 +100,7 @@ typedef struct luafiletransfer_s
INT32 id; // Callback ID INT32 id; // Callback ID
boolean ongoing; boolean ongoing;
luafiletransfernodestatus_t nodestatus[MAXNETNODES]; luafiletransfernodestatus_t nodestatus[MAXNETNODES];
tic_t nodetimeouts[MAXNETNODES];
struct luafiletransfer_s *next; struct luafiletransfer_s *next;
} luafiletransfer_t; } luafiletransfer_t;

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -52,6 +52,8 @@ typedef enum
SF_NOSUPERSPRITES = 1<<16, // Don't use super sprites while super SF_NOSUPERSPRITES = 1<<16, // Don't use super sprites while super
SF_NOSUPERJUMPBOOST = 1<<17, // Disable the jump boost given while super (i.e. Knuckles) SF_NOSUPERJUMPBOOST = 1<<17, // Disable the jump boost given while super (i.e. Knuckles)
SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles) SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles)
SF_NOSHIELDABILITY = 1<<19, // Disable shield abilities
// free up to and including 1<<31 // free up to and including 1<<31
} skinflags_t; } skinflags_t;

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -21,6 +21,8 @@
#pragma interface #pragma interface
#endif #endif
#define MAXPREDICTTICS 12
// Button/action code definitions. // Button/action code definitions.
typedef enum typedef enum
{ {
@ -63,6 +65,7 @@ typedef struct
INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos
INT16 aiming; // vertical aiming, see G_BuildTicCmd INT16 aiming; // vertical aiming, see G_BuildTicCmd
UINT16 buttons; UINT16 buttons;
UINT8 latency; // Netgames: how many tics ago was this ticcmd generated from this player's end?
} ATTRPACK ticcmd_t; } ATTRPACK ticcmd_t;
#if defined(_MSC_VER) #if defined(_MSC_VER)

670
src/deh_lua.c Normal file
View file

@ -0,0 +1,670 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file deh_lua.c
/// \brief Lua SOC library
#include "g_game.h"
#include "s_sound.h"
#include "z_zone.h"
#include "m_menu.h"
#include "m_misc.h"
#include "p_local.h"
#include "st_stuff.h"
#include "fastcmp.h"
#include "lua_script.h"
#include "lua_libs.h"
#include "dehacked.h"
#include "deh_lua.h"
#include "deh_tables.h"
// freeslot takes a name (string only!)
// and allocates it to the appropriate free slot.
// Returns the slot number allocated for it or nil if failed.
// ex. freeslot("MT_MYTHING","S_MYSTATE1","S_MYSTATE2")
// TODO: Error checking! @.@; There's currently no way to know which ones failed and why!
//
static inline int lib_freeslot(lua_State *L)
{
int n = lua_gettop(L);
int r = 0; // args returned
char *s, *type,*word;
if (!lua_lumploading)
return luaL_error(L, "This function cannot be called from within a hook or coroutine!");
while (n-- > 0)
{
s = Z_StrDup(luaL_checkstring(L,1));
type = strtok(s, "_");
if (type)
strupr(type);
else {
Z_Free(s);
return luaL_error(L, "Unknown enum type in '%s'\n", luaL_checkstring(L, 1));
}
word = strtok(NULL, "\n");
if (word)
strupr(word);
else {
Z_Free(s);
return luaL_error(L, "Missing enum name in '%s'\n", luaL_checkstring(L, 1));
}
if (fastcmp(type, "SFX")) {
sfxenum_t sfx;
strlwr(word);
CONS_Printf("Sound sfx_%s allocated.\n",word);
sfx = S_AddSoundFx(word, false, 0, false);
if (sfx != sfx_None) {
lua_pushinteger(L, sfx);
r++;
} else
CONS_Alert(CONS_WARNING, "Ran out of free SFX slots!\n");
}
else if (fastcmp(type, "SPR"))
{
char wad;
spritenum_t j;
lua_getfield(L, LUA_REGISTRYINDEX, "WAD");
wad = (char)lua_tointeger(L, -1);
lua_pop(L, 1);
for (j = SPR_FIRSTFREESLOT; j <= SPR_LASTFREESLOT; j++)
{
if (used_spr[(j-SPR_FIRSTFREESLOT)/8] & (1<<(j%8)))
{
if (!sprnames[j][4] && memcmp(sprnames[j],word,4)==0)
sprnames[j][4] = wad;
continue; // Already allocated, next.
}
// Found a free slot!
CONS_Printf("Sprite SPR_%s allocated.\n",word);
strncpy(sprnames[j],word,4);
//sprnames[j][4] = 0;
used_spr[(j-SPR_FIRSTFREESLOT)/8] |= 1<<(j%8); // Okay, this sprite slot has been named now.
lua_pushinteger(L, j);
r++;
break;
}
if (j > SPR_LASTFREESLOT)
CONS_Alert(CONS_WARNING, "Ran out of free sprite slots!\n");
}
else if (fastcmp(type, "S"))
{
statenum_t i;
for (i = 0; i < NUMSTATEFREESLOTS; i++)
if (!FREE_STATES[i]) {
CONS_Printf("State S_%s allocated.\n",word);
FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_STATES[i],word);
lua_pushinteger(L, S_FIRSTFREESLOT + i);
r++;
break;
}
if (i == NUMSTATEFREESLOTS)
CONS_Alert(CONS_WARNING, "Ran out of free State slots!\n");
}
else if (fastcmp(type, "MT"))
{
mobjtype_t i;
for (i = 0; i < NUMMOBJFREESLOTS; i++)
if (!FREE_MOBJS[i]) {
CONS_Printf("MobjType MT_%s allocated.\n",word);
FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_MOBJS[i],word);
lua_pushinteger(L, MT_FIRSTFREESLOT + i);
r++;
break;
}
if (i == NUMMOBJFREESLOTS)
CONS_Alert(CONS_WARNING, "Ran out of free MobjType slots!\n");
}
else if (fastcmp(type, "SKINCOLOR"))
{
skincolornum_t i;
for (i = 0; i < NUMCOLORFREESLOTS; i++)
if (!FREE_SKINCOLORS[i]) {
CONS_Printf("Skincolor SKINCOLOR_%s allocated.\n",word);
FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_SKINCOLORS[i],word);
M_AddMenuColor(numskincolors++);
lua_pushinteger(L, SKINCOLOR_FIRSTFREESLOT + i);
r++;
break;
}
if (i == NUMCOLORFREESLOTS)
CONS_Alert(CONS_WARNING, "Ran out of free skincolor slots!\n");
}
else if (fastcmp(type, "SPR2"))
{
// Search if we already have an SPR2 by that name...
playersprite_t i;
for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++)
if (memcmp(spr2names[i],word,4) == 0)
break;
// We don't, so allocate a new one.
if (i >= free_spr2) {
if (free_spr2 < NUMPLAYERSPRITES)
{
CONS_Printf("Sprite SPR2_%s allocated.\n",word);
strncpy(spr2names[free_spr2],word,4);
spr2defaults[free_spr2] = 0;
lua_pushinteger(L, free_spr2);
r++;
spr2names[free_spr2++][4] = 0;
} else
CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n");
}
}
else if (fastcmp(type, "TOL"))
{
// Search if we already have a typeoflevel by that name...
int i;
for (i = 0; TYPEOFLEVEL[i].name; i++)
if (fastcmp(word, TYPEOFLEVEL[i].name))
break;
// We don't, so allocate a new one.
if (TYPEOFLEVEL[i].name == NULL) {
if (lastcustomtol == (UINT32)MAXTOL) // Unless you have way too many, since they're flags.
CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n");
else {
CONS_Printf("TypeOfLevel TOL_%s allocated.\n",word);
G_AddTOL(lastcustomtol, word);
lua_pushinteger(L, lastcustomtol);
lastcustomtol <<= 1;
r++;
}
}
}
Z_Free(s);
lua_remove(L, 1);
continue;
}
return r;
}
// Wrapper for ALL A_Action functions.
// Arguments: mobj_t actor, int var1, int var2
static int action_call(lua_State *L)
{
//actionf_t *action = lua_touserdata(L,lua_upvalueindex(1));
actionf_t *action = *((actionf_t **)luaL_checkudata(L, 1, META_ACTION));
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
var1 = (INT32)luaL_optinteger(L, 3, 0);
var2 = (INT32)luaL_optinteger(L, 4, 0);
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
action->acp1(actor);
return 0;
}
// Hardcoded A_Action name to call for super() or NULL if super() would be invalid.
// Set in lua_infolib.
const char *superactions[MAXRECURSION];
UINT8 superstack = 0;
static int lib_dummysuper(lua_State *L)
{
return luaL_error(L, "Can't call super() outside of hardcode-replacing A_Action functions being called by state changes!"); // convoluted, I know. @_@;;
}
static inline int lib_getenum(lua_State *L)
{
const char *word, *p;
fixed_t i;
boolean mathlib = lua_toboolean(L, lua_upvalueindex(1));
if (lua_type(L,2) != LUA_TSTRING)
return 0;
word = lua_tostring(L,2);
if (strlen(word) == 1) { // Assume sprite frame if length 1.
if (*word >= 'A' && *word <= '~')
{
lua_pushinteger(L, *word-'A');
return 1;
}
if (mathlib) return luaL_error(L, "constant '%s' could not be parsed.\n", word);
return 0;
}
else if (fastncmp("MF_", word, 3)) {
p = word+3;
for (i = 0; MOBJFLAG_LIST[i]; i++)
if (fastcmp(p, MOBJFLAG_LIST[i])) {
lua_pushinteger(L, ((lua_Integer)1<<i));
return 1;
}
if (mathlib) return luaL_error(L, "mobjflag '%s' could not be found.\n", word);
return 0;
}
else if (fastncmp("MF2_", word, 4)) {
p = word+4;
for (i = 0; MOBJFLAG2_LIST[i]; i++)
if (fastcmp(p, MOBJFLAG2_LIST[i])) {
lua_pushinteger(L, ((lua_Integer)1<<i));
return 1;
}
if (mathlib) return luaL_error(L, "mobjflag2 '%s' could not be found.\n", word);
return 0;
}
else if (fastncmp("MFE_", word, 4)) {
p = word+4;
for (i = 0; MOBJEFLAG_LIST[i]; i++)
if (fastcmp(p, MOBJEFLAG_LIST[i])) {
lua_pushinteger(L, ((lua_Integer)1<<i));
return 1;
}
if (mathlib) return luaL_error(L, "mobjeflag '%s' could not be found.\n", word);
return 0;
}
else if (fastncmp("MTF_", word, 4)) {
p = word+4;
for (i = 0; i < 4; i++)
if (MAPTHINGFLAG_LIST[i] && fastcmp(p, MAPTHINGFLAG_LIST[i])) {
lua_pushinteger(L, ((lua_Integer)1<<i));
return 1;
}
if (mathlib) return luaL_error(L, "mapthingflag '%s' could not be found.\n", word);
return 0;
}
else if (fastncmp("PF_", word, 3)) {
p = word+3;
for (i = 0; PLAYERFLAG_LIST[i]; i++)
if (fastcmp(p, PLAYERFLAG_LIST[i])) {
lua_pushinteger(L, ((lua_Integer)1<<i));
return 1;
}
if (fastcmp(p, "FULLSTASIS"))
{
lua_pushinteger(L, (lua_Integer)PF_FULLSTASIS);
return 1;
}
else if (fastcmp(p, "USEDOWN")) // Remove case when 2.3 nears release...
{
lua_pushinteger(L, (lua_Integer)PF_SPINDOWN);
return 1;
}
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++)
if (ML_LIST[i] && fastcmp(p, ML_LIST[i])) {
lua_pushinteger(L, ((lua_Integer)1<<i));
return 1;
}
if (mathlib) return luaL_error(L, "linedef flag '%s' could not be found.\n", word);
return 0;
}
else if (fastncmp("S_",word,2)) {
p = word+2;
for (i = 0; i < NUMSTATEFREESLOTS; i++) {
if (!FREE_STATES[i])
break;
if (fastcmp(p, FREE_STATES[i])) {
lua_pushinteger(L, S_FIRSTFREESLOT+i);
return 1;
}
}
for (i = 0; i < S_FIRSTFREESLOT; i++)
if (fastcmp(p, STATE_LIST[i]+2)) {
lua_pushinteger(L, i);
return 1;
}
return luaL_error(L, "state '%s' does not exist.\n", word);
}
else if (fastncmp("MT_",word,3)) {
p = word+3;
for (i = 0; i < NUMMOBJFREESLOTS; i++) {
if (!FREE_MOBJS[i])
break;
if (fastcmp(p, FREE_MOBJS[i])) {
lua_pushinteger(L, MT_FIRSTFREESLOT+i);
return 1;
}
}
for (i = 0; i < MT_FIRSTFREESLOT; i++)
if (fastcmp(p, MOBJTYPE_LIST[i]+3)) {
lua_pushinteger(L, i);
return 1;
}
return luaL_error(L, "mobjtype '%s' does not exist.\n", word);
}
else if (fastncmp("SPR_",word,4)) {
p = word+4;
for (i = 0; i < NUMSPRITES; i++)
if (!sprnames[i][4] && fastncmp(p,sprnames[i],4)) {
lua_pushinteger(L, i);
return 1;
}
if (mathlib) return luaL_error(L, "sprite '%s' could not be found.\n", word);
return 0;
}
else if (fastncmp("SPR2_",word,5)) {
p = word+5;
for (i = 0; i < (fixed_t)free_spr2; i++)
if (!spr2names[i][4])
{
// special 3-char cases, e.g. SPR2_RUN
// the spr2names entry will have "_" on the end, as in "RUN_"
if (spr2names[i][3] == '_' && !p[3]) {
if (fastncmp(p,spr2names[i],3)) {
lua_pushinteger(L, i);
return 1;
}
}
else if (fastncmp(p,spr2names[i],4)) {
lua_pushinteger(L, i);
return 1;
}
}
if (mathlib) return luaL_error(L, "player sprite '%s' could not be found.\n", word);
return 0;
}
else if (!mathlib && fastncmp("sfx_",word,4)) {
p = word+4;
for (i = 0; i < NUMSFX; i++)
if (S_sfx[i].name && fastcmp(p, S_sfx[i].name)) {
lua_pushinteger(L, i);
return 1;
}
return 0;
}
else if (mathlib && fastncmp("SFX_",word,4)) { // SOCs are ALL CAPS!
p = word+4;
for (i = 0; i < NUMSFX; i++)
if (S_sfx[i].name && fasticmp(p, S_sfx[i].name)) {
lua_pushinteger(L, i);
return 1;
}
return luaL_error(L, "sfx '%s' could not be found.\n", word);
}
else if (mathlib && fastncmp("DS",word,2)) {
p = word+2;
for (i = 0; i < NUMSFX; i++)
if (S_sfx[i].name && fasticmp(p, S_sfx[i].name)) {
lua_pushinteger(L, i);
return 1;
}
if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word);
return 0;
}
else if (!mathlib && fastncmp("pw_",word,3)) {
p = word+3;
for (i = 0; i < NUMPOWERS; i++)
if (fasticmp(p, POWERS_LIST[i])) {
lua_pushinteger(L, i);
return 1;
}
return 0;
}
else if (mathlib && fastncmp("PW_",word,3)) { // SOCs are ALL CAPS!
p = word+3;
for (i = 0; i < NUMPOWERS; i++)
if (fastcmp(p, POWERS_LIST[i])) {
lua_pushinteger(L, i);
return 1;
}
return luaL_error(L, "power '%s' could not be found.\n", word);
}
else if (fastncmp("HUD_",word,4)) {
p = word+4;
for (i = 0; i < NUMHUDITEMS; i++)
if (fastcmp(p, HUDITEMS_LIST[i])) {
lua_pushinteger(L, i);
return 1;
}
if (mathlib) return luaL_error(L, "huditem '%s' could not be found.\n", word);
return 0;
}
else if (fastncmp("SKINCOLOR_",word,10)) {
p = word+10;
for (i = 0; i < NUMCOLORFREESLOTS; i++) {
if (!FREE_SKINCOLORS[i])
break;
if (fastcmp(p, FREE_SKINCOLORS[i])) {
lua_pushinteger(L, SKINCOLOR_FIRSTFREESLOT+i);
return 1;
}
}
for (i = 0; i < SKINCOLOR_FIRSTFREESLOT; i++)
if (fastcmp(p, COLOR_ENUMS[i])) {
lua_pushinteger(L, i);
return 1;
}
return luaL_error(L, "skincolor '%s' could not be found.\n", word);
}
else if (fastncmp("GRADE_",word,6))
{
p = word+6;
for (i = 0; NIGHTSGRADE_LIST[i]; i++)
if (*p == NIGHTSGRADE_LIST[i])
{
lua_pushinteger(L, i);
return 1;
}
if (mathlib) return luaL_error(L, "NiGHTS grade '%s' could not be found.\n", word);
return 0;
}
else if (fastncmp("MN_",word,3)) {
p = word+3;
for (i = 0; i < NUMMENUTYPES; i++)
if (fastcmp(p, MENUTYPES_LIST[i])) {
lua_pushinteger(L, i);
return 1;
}
if (mathlib) return luaL_error(L, "menutype '%s' could not be found.\n", word);
return 0;
}
else if (!mathlib && fastncmp("A_",word,2)) {
char *caps;
// Try to get a Lua action first.
/// \todo Push a closure that sets superactions[] and superstack.
lua_getfield(L, LUA_REGISTRYINDEX, LREG_ACTIONS);
// actions are stored in all uppercase.
caps = Z_StrDup(word);
strupr(caps);
lua_getfield(L, -1, caps);
Z_Free(caps);
if (!lua_isnil(L, -1))
return 1; // Success! :D That was easy.
// Welp, that failed.
lua_pop(L, 2); // pop nil and LREG_ACTIONS
// Hardcoded actions as callable Lua functions!
// Retrieving them from this metatable allows them to be case-insensitive!
for (i = 0; actionpointers[i].name; i++)
if (fasticmp(word, actionpointers[i].name)) {
// We push the actionf_t* itself as userdata!
LUA_PushUserdata(L, &actionpointers[i].action, META_ACTION);
return 1;
}
return 0;
}
else if (!mathlib && fastcmp("super",word))
{
if (!superstack)
{
lua_pushcfunction(L, lib_dummysuper);
return 1;
}
for (i = 0; actionpointers[i].name; i++)
if (fasticmp(superactions[superstack-1], actionpointers[i].name)) {
LUA_PushUserdata(L, &actionpointers[i].action, META_ACTION);
return 1;
}
return 0;
}
if (fastcmp(word, "BT_USE")) // Remove case when 2.3 nears release...
{
lua_pushinteger(L, (lua_Integer)BT_SPIN);
return 1;
}
for (i = 0; INT_CONST[i].n; i++)
if (fastcmp(word,INT_CONST[i].n)) {
lua_pushinteger(L, INT_CONST[i].v);
return 1;
}
if (mathlib) return luaL_error(L, "constant '%s' could not be parsed.\n", word);
// DYNAMIC variables too!!
// Try not to add anything that would break netgames or timeattack replays here.
// You know, like consoleplayer, displayplayer, secondarydisplayplayer, or gametime.
return LUA_PushGlobals(L, word);
}
int LUA_EnumLib(lua_State *L)
{
if (lua_gettop(L) == 0)
lua_pushboolean(L, 0);
// Set the global metatable
lua_createtable(L, 0, 1);
lua_pushvalue(L, 1); // boolean passed to LUA_EnumLib as first argument.
lua_pushcclosure(L, lib_getenum, 1);
lua_setfield(L, -2, "__index");
lua_setmetatable(L, LUA_GLOBALSINDEX);
return 0;
}
// getActionName(action) -> return action's string name
static int lib_getActionName(lua_State *L)
{
if (lua_isuserdata(L, 1)) // arg 1 is built-in action, expect action userdata
{
actionf_t *action = *((actionf_t **)luaL_checkudata(L, 1, META_ACTION));
const char *name = NULL;
if (!action)
return luaL_error(L, "not a valid action?");
name = LUA_GetActionName(action);
if (!name) // that can't be right?
return luaL_error(L, "no name string could be found for this action");
lua_pushstring(L, name);
return 1;
}
else if (lua_isfunction(L, 1)) // arg 1 is a function (either C or Lua)
{
lua_settop(L, 1); // set top of stack to 1 (removing any extra args, which there shouldn't be)
// get the name for this action, if possible.
lua_getfield(L, LUA_REGISTRYINDEX, LREG_ACTIONS);
lua_pushnil(L);
// Lua stack at this point:
// 1 ... -2 -1
// arg ... LREG_ACTIONS nil
while (lua_next(L, -2))
{
// Lua stack at this point:
// 1 ... -3 -2 -1
// arg ... LREG_ACTIONS "A_ACTION" function
if (lua_rawequal(L, -1, 1)) // is this the same as the arg?
{
// make sure the key (i.e. "A_ACTION") is a string first
// (note: we don't use lua_isstring because it also returns true for numbers)
if (lua_type(L, -2) == LUA_TSTRING)
{
lua_pushvalue(L, -2); // push "A_ACTION" string to top of stack
return 1;
}
lua_pop(L, 2); // pop the name and function
break; // probably should have succeeded but we didn't, so end the loop
}
lua_pop(L, 1);
}
lua_pop(L, 1); // pop LREG_ACTIONS
return 0; // return nothing (don't error)
}
return luaL_typerror(L, 1, "action userdata or Lua function");
}
int LUA_SOCLib(lua_State *L)
{
lua_register(L,"freeslot",lib_freeslot);
lua_register(L,"getActionName",lib_getActionName);
luaL_newmetatable(L, META_ACTION);
lua_pushcfunction(L, action_call);
lua_setfield(L, -2, "__call");
lua_pop(L, 1);
return 0;
}
const char *LUA_GetActionName(void *action)
{
actionf_t *act = (actionf_t *)action;
size_t z;
for (z = 0; actionpointers[z].name; z++)
{
if (actionpointers[z].action.acv == act->acv)
return actionpointers[z].name;
}
return NULL;
}
void LUA_SetActionByName(void *state, const char *actiontocompare)
{
state_t *st = (state_t *)state;
size_t z;
for (z = 0; actionpointers[z].name; z++)
{
if (fasticmp(actiontocompare, actionpointers[z].name))
{
st->action = actionpointers[z].action;
st->action.acv = actionpointers[z].action.acv; // assign
st->action.acp1 = actionpointers[z].action.acp1;
return;
}
}
}
enum actionnum LUA_GetActionNumByName(const char *actiontocompare)
{
size_t z;
for (z = 0; actionpointers[z].name; z++)
if (fasticmp(actiontocompare, actionpointers[z].name))
return z;
return z;
}

21
src/deh_lua.h Normal file
View file

@ -0,0 +1,21 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file deh_lua.h
/// \brief Lua SOC library
#ifndef __DEH_LUA_H__
#define __DEH_LUA_H__
boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
const char *LUA_GetActionName(void *action);
void LUA_SetActionByName(void *state, const char *actiontocompare);
enum actionnum LUA_GetActionNumByName(const char *actiontocompare);
#endif

4478
src/deh_soc.c Normal file

File diff suppressed because it is too large Load diff

88
src/deh_soc.h Normal file
View file

@ -0,0 +1,88 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file deh_soc.h
/// \brief Load SOC file and change tables and text
#ifndef __DEH_SOC_H__
#define __DEH_SOC_H__
#include "doomdef.h"
#include "g_game.h"
#include "sounds.h"
#include "info.h"
#include "d_think.h"
#include "m_argv.h"
#include "z_zone.h"
#include "w_wad.h"
#include "m_menu.h"
#include "m_misc.h"
#include "f_finale.h"
#include "st_stuff.h"
#include "i_system.h"
#include "p_setup.h"
#include "r_data.h"
#include "r_textures.h"
#include "r_draw.h"
#include "r_picformats.h"
#include "r_things.h" // R_Char2Frame
#include "r_sky.h"
#include "fastcmp.h"
#include "lua_script.h" // Reluctantly included for LUA_EvalMath
#include "d_clisrv.h"
#ifdef HWRENDER
#include "hardware/hw_light.h"
#endif
#include "info.h"
#include "dehacked.h"
#include "doomdef.h" // HWRENDER
// Crazy word-reading stuff
/// \todo Put these in a seperate file or something.
mobjtype_t get_mobjtype(const char *word);
statenum_t get_state(const char *word);
spritenum_t get_sprite(const char *word);
playersprite_t get_sprite2(const char *word);
sfxenum_t get_sfx(const char *word);
hudnum_t get_huditem(const char *word);
menutype_t get_menutype(const char *word);
//INT16 get_gametype(const char *word);
//powertype_t get_power(const char *word);
skincolornum_t get_skincolor(const char *word);
void readwipes(MYFILE *f);
void readmaincfg(MYFILE *f);
void readconditionset(MYFILE *f, UINT8 setnum);
void readunlockable(MYFILE *f, INT32 num);
void readextraemblemdata(MYFILE *f, INT32 num);
void reademblemdata(MYFILE *f, INT32 num);
void readsound(MYFILE *f, INT32 num);
void readframe(MYFILE *f, INT32 num);
void readhuditem(MYFILE *f, INT32 num);
void readmenu(MYFILE *f, INT32 num);
void readtextprompt(MYFILE *f, INT32 num);
void readcutscene(MYFILE *f, INT32 num);
void readlevelheader(MYFILE *f, INT32 num);
void readgametype(MYFILE *f, char *gtname);
void readsprite2(MYFILE *f, INT32 num);
void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2);
#ifdef HWRENDER
void readlight(MYFILE *f, INT32 num);
#endif
void readskincolor(MYFILE *f, INT32 num);
void readthing(MYFILE *f, INT32 num);
void readfreeslots(MYFILE *f);
void readPlayer(MYFILE *f, INT32 num);
void clear_emblems(void);
void clear_unlockables(void);
void clear_levels(void);
void clear_conditionsets(void);
#endif

5556
src/deh_tables.c Normal file

File diff suppressed because it is too large Load diff

78
src/deh_tables.h Normal file
View file

@ -0,0 +1,78 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file deh_tables.h
/// \brief Define DeHackEd tables.
#ifndef __DEH_TABLES_H__
#define __DEH_TABLES_H__
#include "doomdef.h" // Constants
#include "d_think.h" // actionf_t
#include "info.h" // Mobj, state, sprite, etc constants
#include "lua_script.h"
// Free slot names
// The crazy word-reading stuff uses these.
extern char *FREE_STATES[NUMSTATEFREESLOTS];
extern char *FREE_MOBJS[NUMMOBJFREESLOTS];
extern char *FREE_SKINCOLORS[NUMCOLORFREESLOTS];
extern UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
#define initfreeslots() {\
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
memset(FREE_SKINCOLORS,0,sizeof(char *) * NUMCOLORFREESLOTS);\
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
}
struct flickytypes_s {
const char *name;
const mobjtype_t type;
};
#define MAXFLICKIES 64
/** Action pointer for reading actions from Dehacked lumps.
*/
typedef struct
{
actionf_t action; ///< Function pointer corresponding to the actual action.
const char *name; ///< Name of the action in ALL CAPS.
} actionpointer_t;
struct int_const_s {
const char *n;
// has to be able to hold both fixed_t and angle_t, so drastic measure!!
lua_Integer v;
};
extern const char NIGHTSGRADE_LIST[];
extern struct flickytypes_s FLICKYTYPES[];
extern actionpointer_t actionpointers[]; // Array mapping action names to action functions.
extern const char *const STATE_LIST[];
extern const char *const MOBJTYPE_LIST[];
extern const char *const MOBJFLAG_LIST[];
extern const char *const MOBJFLAG2_LIST[]; // \tMF2_(\S+).*// (.+) --> \t"\1", // \2
extern const char *const MOBJEFLAG_LIST[];
extern const char *const MAPTHINGFLAG_LIST[4];
extern const char *const PLAYERFLAG_LIST[];
extern const char *const GAMETYPERULE_LIST[];
extern const char *const ML_LIST[16]; // Linedef flags
extern const char *COLOR_ENUMS[];
extern const char *const POWERS_LIST[];
extern const char *const HUDITEMS_LIST[];
extern const char *const MENUTYPES_LIST[];
extern struct int_const_s const INT_CONST[];
// Moved to this file because it can't work compile-time otherwise
void DEH_TableCheck(void);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -30,16 +30,16 @@ typedef enum
void DEH_LoadDehackedLump(lumpnum_t lumpnum); void DEH_LoadDehackedLump(lumpnum_t lumpnum);
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile); void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile);
void DEH_Check(void);
fixed_t get_number(const char *word); fixed_t get_number(const char *word);
FUNCPRINTF void deh_warning(const char *first, ...);
boolean LUA_SetLuaAction(void *state, const char *actiontocompare); void deh_strlcpy(char *dst, const char *src, size_t size, const char *warntext);
const char *LUA_GetActionName(void *action);
void LUA_SetActionByName(void *state, const char *actiontocompare);
extern boolean deh_loaded; extern boolean deh_loaded;
extern boolean gamedataadded;
extern boolean titlechanged;
extern boolean introchanged;
#define MAXRECURSION 30 #define MAXRECURSION 30
extern const char *superactions[MAXRECURSION]; extern const char *superactions[MAXRECURSION];
extern UINT8 superstack; extern UINT8 superstack;
@ -60,4 +60,5 @@ typedef struct
} MYFILE; } MYFILE;
#define myfeof(a) (a->data + a->size <= a->curpos) #define myfeof(a) (a->data + a->size <= a->curpos)
char *myfgets(char *buf, size_t bufsize, MYFILE *f); char *myfgets(char *buf, size_t bufsize, MYFILE *f);
char *myhashfgets(char *buf, size_t bufsize, MYFILE *f);
#endif #endif

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -100,7 +100,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <ctype.h> #include <ctype.h>
#if defined (_WIN32) || defined (__DJGPP__) #ifdef _WIN32
#include <io.h> #include <io.h>
#endif #endif
@ -112,7 +112,7 @@
//#define PARANOIA // do some tests that never fail but maybe //#define PARANOIA // do some tests that never fail but maybe
// turn this on by make etc.. DEBUGMODE = 1 or use the Debug profile in the VC++ projects // turn this on by make etc.. DEBUGMODE = 1 or use the Debug profile in the VC++ projects
//#endif //#endif
#if defined (_WIN32) || (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (macintosh) #if defined (_WIN32) || defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (macintosh)
#define LOGMESSAGES // write message in log.txt #define LOGMESSAGES // write message in log.txt
#endif #endif
@ -415,7 +415,7 @@ enum {
}; };
// Name of local directory for config files and savegames // Name of local directory for config files and savegames
#if (((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)) && !defined (__APPLE__) #if (defined (__unix__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (__APPLE__)
#define DEFAULTDIR ".srb2" #define DEFAULTDIR ".srb2"
#else #else
#define DEFAULTDIR "srb2" #define DEFAULTDIR "srb2"
@ -582,9 +582,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Dumps the contents of a network save game upon consistency failure for debugging. /// Dumps the contents of a network save game upon consistency failure for debugging.
//#define DUMPCONSISTENCY //#define DUMPCONSISTENCY
/// See name of player in your crosshair
#define SEENAMES
/// Who put weights on my recycler? ... Inuyasha did. /// Who put weights on my recycler? ... Inuyasha did.
/// \note XMOD port. /// \note XMOD port.
//#define WEIGHTEDRECYCLER //#define WEIGHTEDRECYCLER
@ -607,10 +604,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.) /// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG //#define REDSANALOG
/// Backwards compatibility with musicslots.
/// \note You should leave this enabled unless you're working with a future SRB2 version.
#define MUSICSLOT_COMPATIBILITY
/// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls. /// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls.
//#define PAPER_COLLISIONCORRECTION //#define PAPER_COLLISIONCORRECTION

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