From 793fe4e6032c5bce93b005a62a2c20e8d2075d8c Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Tue, 15 Jan 2019 18:03:15 -0400 Subject: [PATCH 01/32] Fixed another minor typo or two --- code/botlib/be_aas.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/botlib/be_aas.h b/code/botlib/be_aas.h index dbf24bc1..cb7d73c9 100644 --- a/code/botlib/be_aas.h +++ b/code/botlib/be_aas.h @@ -217,5 +217,5 @@ typedef struct aas_predictroute_s int endcontents; //contents at the end of movement prediction int endtravelflags; //end travel flags int numareas; //number of areas predicted ahead - int time; //time predicted ahead (in hundreth of a sec) + int time; //time predicted ahead (in hundredths of a sec) } aas_predictroute_t; From 9500f06b8f9a1c42f166880161117f689aea19fd Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Tue, 15 Jan 2019 18:18:40 -0400 Subject: [PATCH 02/32] Minor typo correction to be_aas_file.c --- code/botlib/be_aas_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/botlib/be_aas_file.c b/code/botlib/be_aas_file.c index f4d91720..3de8f780 100644 --- a/code/botlib/be_aas_file.c +++ b/code/botlib/be_aas_file.c @@ -277,7 +277,7 @@ void AAS_FileInfo(void) aasworld.reachabilitysize * sizeof(aas_reachability_t) + aasworld.numportals * sizeof(aas_portal_t) + aasworld.numclusters * sizeof(aas_cluster_t); - botimport.Print(PRT_MESSAGE, "optimzed size %d KB\n", optimized >> 10); + botimport.Print(PRT_MESSAGE, "optimized size %d KB\n", optimized >> 10); } //end of the function AAS_FileInfo #endif //AASFILEDEBUG //=========================================================================== From afb102a8b6ddc2d1b69724157186d9a6f77d4852 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Thu, 17 Jan 2019 09:05:50 -0400 Subject: [PATCH 03/32] Updated .gitgnore to latest GitHub template --- misc/msvc12/.gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/msvc12/.gitignore b/misc/msvc12/.gitignore index 4ba92b04..3e8a1553 100644 --- a/misc/msvc12/.gitignore +++ b/misc/msvc12/.gitignore @@ -211,7 +211,7 @@ _pkginfo.txt # files ending in .cache can be ignored *.[Cc]ache # but keep track of directories ending in .cache -!*.[Cc]ache/ +!?*.[Cc]ache/ # Others ClientBin/ @@ -336,3 +336,6 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb From 22722f2108633f9002bc45730373ce7219b18d87 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Thu, 17 Jan 2019 09:34:15 -0400 Subject: [PATCH 04/32] Add .gitignore to msvc10 folder --- misc/msvc10/.gitignore | 341 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 341 insertions(+) create mode 100644 misc/msvc10/.gitignore diff --git a/misc/msvc10/.gitignore b/misc/msvc10/.gitignore new file mode 100644 index 00000000..3e8a1553 --- /dev/null +++ b/misc/msvc10/.gitignore @@ -0,0 +1,341 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ +# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true +**/wwwroot/lib/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb From 2d3b8b5c2727cdc98373324a77801faf45da92dc Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Thu, 17 Jan 2019 09:35:18 -0400 Subject: [PATCH 05/32] Added .gitignore to msvc11 folder --- misc/msvc11/.gitignore | 341 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 341 insertions(+) create mode 100644 misc/msvc11/.gitignore diff --git a/misc/msvc11/.gitignore b/misc/msvc11/.gitignore new file mode 100644 index 00000000..3e8a1553 --- /dev/null +++ b/misc/msvc11/.gitignore @@ -0,0 +1,341 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ +# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true +**/wwwroot/lib/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb From 0549613351935e9a638ed79b9dad8b4ae1cdd150 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Thu, 17 Jan 2019 09:36:10 -0400 Subject: [PATCH 06/32] Added .gitignore to msvc folder --- misc/msvc/.gitignore | 341 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 341 insertions(+) create mode 100644 misc/msvc/.gitignore diff --git a/misc/msvc/.gitignore b/misc/msvc/.gitignore new file mode 100644 index 00000000..3e8a1553 --- /dev/null +++ b/misc/msvc/.gitignore @@ -0,0 +1,341 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ +# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true +**/wwwroot/lib/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb From efd55cab9de35d33050ef246c7ac0d3cc47739f6 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 11 Jun 2023 11:41:59 -0500 Subject: [PATCH 07/32] nsis: Remove Speex library The game doesn't support it anymore. --- misc/nsis/Makefile | 6 ------ misc/nsis/ioquake3.nsi.in | 6 ------ 2 files changed, 12 deletions(-) diff --git a/misc/nsis/Makefile b/misc/nsis/Makefile index 3875e4e5..a17d2a45 100644 --- a/misc/nsis/Makefile +++ b/misc/nsis/Makefile @@ -22,9 +22,6 @@ endif ifndef USE_CURL_DLOPEN USE_CURL_DLOPEN=0 endif -ifndef USE_INTERNAL_SPEEX -USE_INTERNAL_SPEEX=1 -endif ifndef USE_INTERNAL_ZLIB USE_INTERNAL_ZLIB=1 endif @@ -56,9 +53,6 @@ endif ifeq ($(USE_CURL_DLOPEN),1) DEFINES+= -DUSE_CURL_DLOPEN endif -ifeq ($(USE_INTERNAL_SPEEX),1) - DEFINES+= -DUSE_INTERNAL_SPEEX -endif ifeq ($(USE_INTERNAL_ZLIB),1) DEFINES+= -DUSE_INTERNAL_ZLIB endif diff --git a/misc/nsis/ioquake3.nsi.in b/misc/nsis/ioquake3.nsi.in index 7e2b07df..0da3a7b6 100644 --- a/misc/nsis/ioquake3.nsi.in +++ b/misc/nsis/ioquake3.nsi.in @@ -78,9 +78,6 @@ Section "ioquake3 (required)" ioquake3 ; Set output path to the installation directory. SetOutPath $INSTDIR -!ifndef USE_INTERNAL_SPEEX - File "libspeex.dll" -!endif !ifndef USE_INTERNAL_ZLIB File "zlib1.dll" !endif @@ -200,9 +197,6 @@ Section "Uninstall" Delete $INSTDIR\id-readme.txt Delete $INSTDIR\voip-readme.txt -!ifndef USE_INTERNAL_SPEEX - Delete $INSTDIR\libspeex.dll -!endif !ifndef USE_INTERNAL_ZLIB Delete $INSTDIR\zlib1.dll !endif From 9738176849bcf09566e2ad602d07e40a9a8d18ef Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 11 Jun 2023 11:48:42 -0500 Subject: [PATCH 08/32] nsis: Require installing SDL It's required to run and unlikely to be installed system wide. --- misc/nsis/ioquake3.nsi.in | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/misc/nsis/ioquake3.nsi.in b/misc/nsis/ioquake3.nsi.in index 0da3a7b6..082a7163 100644 --- a/misc/nsis/ioquake3.nsi.in +++ b/misc/nsis/ioquake3.nsi.in @@ -78,6 +78,7 @@ Section "ioquake3 (required)" ioquake3 ; Set output path to the installation directory. SetOutPath $INSTDIR + File "../../build/release-mingw32-x86/SDL2.dll" !ifndef USE_INTERNAL_ZLIB File "zlib1.dll" !endif @@ -139,14 +140,6 @@ Section "Protocol Handler" ProtocolHandler SectionEnd -Section "SDL2.dll" SDL - - SetOutPath $INSTDIR - - File "../../build/release-mingw32-x86/SDL2.dll" - -SectionEnd - !ifdef USE_OPENAL_DLOPEN Section "OpenAL-Soft library" OpenAL @@ -197,6 +190,7 @@ Section "Uninstall" Delete $INSTDIR\id-readme.txt Delete $INSTDIR\voip-readme.txt + Delete $INSTDIR\SDL2.dll !ifndef USE_INTERNAL_ZLIB Delete $INSTDIR\zlib1.dll !endif @@ -204,7 +198,6 @@ Section "Uninstall" Delete $INSTDIR\jpeg8c.dll !endif - Delete $INSTDIR\SDL2.dll !ifdef USE_OPENAL_DLOPEN Delete $INSTDIR\OpenAL32.dll !endif @@ -230,7 +223,6 @@ SectionEnd !insertmacro MUI_DESCRIPTION_TEXT ${ioquake3} "The game executables." !insertmacro MUI_DESCRIPTION_TEXT ${StartMenuShortcuts} "Create shortcuts in the start menu." !insertmacro MUI_DESCRIPTION_TEXT ${ProtocolHandler} "The protocol handler lets you connect to a game by clicking a link in a web browser." - !insertmacro MUI_DESCRIPTION_TEXT ${SDL} "SDL files." !ifdef USE_OPENAL_DLOPEN !insertmacro MUI_DESCRIPTION_TEXT ${OpenAL} "OpenAL files." !endif From 5362af3858d83fb1c6ec03ad731be3fe28bbfb21 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 11 Jun 2023 13:26:00 -0500 Subject: [PATCH 09/32] nsis: Display ioquake3 version Display version in the installer and add/remove software. --- misc/nsis/ioquake3.nsi.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/misc/nsis/ioquake3.nsi.in b/misc/nsis/ioquake3.nsi.in index 082a7163..f78c1437 100644 --- a/misc/nsis/ioquake3.nsi.in +++ b/misc/nsis/ioquake3.nsi.in @@ -7,6 +7,8 @@ ; ; you have to copy OpenAL32.dll here manually +!define VERSION "XXXVERSIONXXX" + !define MULTIUSER_MUI !define MULTIUSER_EXECUTIONLEVEL Highest !define MULTIUSER_INSTALLMODE_COMMANDLINE @@ -24,7 +26,7 @@ Name "ioquake3" ; The file to write -OutFile "ioquake3-XXXVERSIONXXX-XXXRELEASEXXX.x86.exe" +OutFile "ioquake3-${VERSION}-XXXRELEASEXXX.x86.exe" ; The default installation directory ; set by Multiuser.nsh @@ -71,7 +73,7 @@ Function un.onInit FunctionEnd ; The stuff to install -Section "ioquake3 (required)" ioquake3 +Section "ioquake3 ${VERSION} (required)" ioquake3 SectionIn RO @@ -114,6 +116,7 @@ Section "ioquake3 (required)" ioquake3 ; Write the uninstall keys for Windows WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\ioquake3" "DisplayName" "ioquake3" + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\ioquake3" "DisplayVersion" "${VERSION}" WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\ioquake3" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\ioquake3" "NoModify" 1 WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\ioquake3" "NoRepair" 1 From 221465f3b44639536631cbb7ba20e12fa5e7e179 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 11 Jun 2023 17:05:12 -0500 Subject: [PATCH 10/32] nsis: Add better descriptions for OpenAL and libcurl --- misc/nsis/ioquake3.nsi.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/nsis/ioquake3.nsi.in b/misc/nsis/ioquake3.nsi.in index f78c1437..d0333f46 100644 --- a/misc/nsis/ioquake3.nsi.in +++ b/misc/nsis/ioquake3.nsi.in @@ -227,9 +227,9 @@ SectionEnd !insertmacro MUI_DESCRIPTION_TEXT ${StartMenuShortcuts} "Create shortcuts in the start menu." !insertmacro MUI_DESCRIPTION_TEXT ${ProtocolHandler} "The protocol handler lets you connect to a game by clicking a link in a web browser." !ifdef USE_OPENAL_DLOPEN - !insertmacro MUI_DESCRIPTION_TEXT ${OpenAL} "OpenAL files." + !insertmacro MUI_DESCRIPTION_TEXT ${OpenAL} "Advanced audio mixer that supports surround sound." !endif !ifdef USE_CURL_DLOPEN - !insertmacro MUI_DESCRIPTION_TEXT ${libcurl} "libcurl files." + !insertmacro MUI_DESCRIPTION_TEXT ${libcurl} "Used for HTTP file downloads." !endif !insertmacro MUI_FUNCTION_DESCRIPTION_END From a119e67fb8c20d1eacebdaa54744660478898a03 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 11 Jun 2023 16:41:15 -0500 Subject: [PATCH 11/32] nsis: Fix CustomUrlArguments for protocol handler --- misc/nsis/ioquake3.nsi.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/nsis/ioquake3.nsi.in b/misc/nsis/ioquake3.nsi.in index d0333f46..fe765f03 100644 --- a/misc/nsis/ioquake3.nsi.in +++ b/misc/nsis/ioquake3.nsi.in @@ -136,7 +136,7 @@ SectionEnd Section "Protocol Handler" ProtocolHandler WriteRegStr SHCTX "Software\Classes\quake3" "CustomUrlApplication" "$INSTDIR\ioquake3.x86.exe" - WriteRegStr SHCTX "Software\Classes\quake3" "CustomUrlArguments" '"%1"' + WriteRegStr SHCTX "Software\Classes\quake3" "CustomUrlArguments" '--uri "%1"' WriteRegStr SHCTX "Software\Classes\quake3" "URL Protocol" "" WriteRegStr SHCTX "Software\Classes\quake3\DefaultIcon" "" "$INSTDIR\ioquake3.x86.exe,0" WriteRegStr SHCTX "Software\Classes\quake3\shell\open\command" "" '"$INSTDIR\ioquake3.x86.exe" --uri "%1"' From 2bca424fcea98b30f0a6575327ee645d010f38b2 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 11 Jun 2023 12:32:13 -0500 Subject: [PATCH 12/32] nsis: Only uninstall protocol handler for this installation --- misc/nsis/ioquake3.nsi.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/misc/nsis/ioquake3.nsi.in b/misc/nsis/ioquake3.nsi.in index fe765f03..a4bf5cb5 100644 --- a/misc/nsis/ioquake3.nsi.in +++ b/misc/nsis/ioquake3.nsi.in @@ -22,6 +22,8 @@ !include "MUI2.nsh" !define MUI_ICON "../quake3.ico" +!include LogicLib.nsh + ; The name of the installer Name "ioquake3" @@ -172,7 +174,11 @@ Section "Uninstall" ; Remove registry keys DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\ioquake3" DeleteRegKey SHCTX "Software\ioquake3" - DeleteRegKey SHCTX "Software\Classes\quake3" + + ReadRegStr $0 SHCTX "Software\Classes\quake3\shell\open\command" "" + ${If} $0 == '"$INSTDIR\ioquake3.x86.exe" --uri "%1"' + DeleteRegKey SHCTX "Software\Classes\quake3" + ${EndIf} ; Remove files and uninstaller Delete $INSTDIR\baseq3\cgamex86.dll From 10a45cbdc131a35530d89bd3cfc2a7eed74b54cc Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 6 Jul 2023 02:42:09 -0500 Subject: [PATCH 13/32] Don't list mod directories at Windows drive root The mod list on Windows would search the root of the drive if fs_basepath, fs_homepath, fs_steampath, or fs_gogpath are blank ("") (which is usually the case). The issue is in the low-level Sys_ListFiles() but it only affects the mod menu, on Windows. It cannot be abused by console commands to list system files outside of the virtual filesystem. --- If a directory at the root of the drive of the working directory contained a pk3 file, the directory was listed in the mods menu. The virtual filesystem doesn't add blank directory names to the search path so it cannot load mods from the drive root. (Unless of course you set a fs_*path cvar to "C:\".) Sys_ListFiles() with blank directory caused Windows to use "\*" for the search path and "\" prefix means root of drive. Unix opendir("") failed so nothing was listed for blank directory. Sys_ListFilteredFiles() with blank directory _and_ specifying subdirs could access any directory (on Windows and Unix-like) but no code uses this or makes it accessible. These functions are only used for initializing the virtual filesystem and listing mods. They are not accessible by anything else such as a console command. Only the mods menu, on Windows, is affected. --- code/sys/sys_unix.c | 9 +++++++++ code/sys/sys_win32.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index e0c63238..66b6fa17 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -346,6 +346,10 @@ void Sys_ListFilteredFiles( const char *basedir, char *subdirs, char *filter, ch return; } + if ( basedir[0] == '\0' ) { + return; + } + if (strlen(subdirs)) { Com_sprintf( search, sizeof(search), "%s/%s", basedir, subdirs ); } @@ -425,6 +429,11 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter return listCopy; } + if ( directory[0] == '\0' ) { + *numfiles = 0; + return NULL; + } + if ( !extension) extension = ""; diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index e40caaa0..d5e1c637 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -483,6 +483,10 @@ void Sys_ListFilteredFiles( const char *basedir, char *subdirs, char *filter, ch return; } + if ( basedir[0] == '\0' ) { + return; + } + if (strlen(subdirs)) { Com_sprintf( search, sizeof(search), "%s\\%s\\*", basedir, subdirs ); } @@ -584,6 +588,11 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter return listCopy; } + if ( directory[0] == '\0' ) { + *numfiles = 0; + return NULL; + } + if ( !extension) { extension = ""; } From 5327a21d5f2b120258dde8ce813abd02d273b82a Mon Sep 17 00:00:00 2001 From: AsciiWolf Date: Tue, 25 Jul 2023 14:22:06 +0200 Subject: [PATCH 14/32] Add AppStream metadata --- misc/setup/org.ioquake3.IOQuake3.metainfo.xml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 misc/setup/org.ioquake3.IOQuake3.metainfo.xml diff --git a/misc/setup/org.ioquake3.IOQuake3.metainfo.xml b/misc/setup/org.ioquake3.IOQuake3.metainfo.xml new file mode 100644 index 00000000..8af20788 --- /dev/null +++ b/misc/setup/org.ioquake3.IOQuake3.metainfo.xml @@ -0,0 +1,34 @@ + + + org.ioquake3.IOQuake3 + ioquake3.desktop + CC0-1.0 + GPL-2.0 + ioquake3 + Free and open-source Quake 3 based engine + +

+ ioquake3 is a free and open-source software first person shooter engine based on the Quake 3: Arena and Quake 3: Team Arena source code. +

+

+ The source code is licensed under the GPL version 2, and was first released under that license by id software on August 20th, 2005. Since then, + our dedicated team has been working hard to improve it, fixing bugs, and adding just the right new features to make the engine even better than before. +

+
+ https://ioquake3.org + https://github.com/ioquake/ioq3/issues + + + https://media.indiedb.com/images/engines/1/1/91/6l2hb3o.jpg + + + https://media.indiedb.com/images/engines/1/1/91/ioquake3.jpg + + + The ioquake Group + + intense + intense + intense + +
From e5c688b342b8e7edd88bc670c02c9050e007fcab Mon Sep 17 00:00:00 2001 From: Jack Slater Date: Mon, 7 Aug 2023 08:02:39 -0700 Subject: [PATCH 15/32] Update org.ioquake3.ioquake3.metainfo.xml fixed the case of the filename and removed the hotlinked screenshots of original quake 3. --- ...ake3.metainfo.xml => org.ioquake3.ioquake3.metainfo.xml} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename misc/setup/{org.ioquake3.IOQuake3.metainfo.xml => org.ioquake3.ioquake3.metainfo.xml} (86%) diff --git a/misc/setup/org.ioquake3.IOQuake3.metainfo.xml b/misc/setup/org.ioquake3.ioquake3.metainfo.xml similarity index 86% rename from misc/setup/org.ioquake3.IOQuake3.metainfo.xml rename to misc/setup/org.ioquake3.ioquake3.metainfo.xml index 8af20788..23d5756d 100644 --- a/misc/setup/org.ioquake3.IOQuake3.metainfo.xml +++ b/misc/setup/org.ioquake3.ioquake3.metainfo.xml @@ -1,6 +1,6 @@ - org.ioquake3.IOQuake3 + org.ioquake3.ioquake3 ioquake3.desktop CC0-1.0 GPL-2.0 @@ -19,10 +19,10 @@ https://github.com/ioquake/ioq3/issues - https://media.indiedb.com/images/engines/1/1/91/6l2hb3o.jpg + TK - https://media.indiedb.com/images/engines/1/1/91/ioquake3.jpg + TK The ioquake Group From b1e6ef14254fdcb77cbe2f602c22549d3fb0eb78 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 15 Aug 2023 05:33:02 -0500 Subject: [PATCH 16/32] Improve AppStream metainfo --- misc/setup/org.ioquake3.ioquake3.metainfo.xml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/misc/setup/org.ioquake3.ioquake3.metainfo.xml b/misc/setup/org.ioquake3.ioquake3.metainfo.xml index 23d5756d..a416464c 100644 --- a/misc/setup/org.ioquake3.ioquake3.metainfo.xml +++ b/misc/setup/org.ioquake3.ioquake3.metainfo.xml @@ -1,9 +1,9 @@ - + org.ioquake3.ioquake3 ioquake3.desktop CC0-1.0 - GPL-2.0 + GPL-2.0-or-later ioquake3 Free and open-source Quake 3 based engine @@ -17,18 +17,12 @@ https://ioquake3.org https://github.com/ioquake/ioq3/issues - - - TK - - - TK - - + https://github.com/ioquake/ioq3 The ioquake Group - intense + intense intense intense + intense From 78359180a447f1292787b8a8ebaa6405c6f87eed Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 17 Aug 2023 08:01:31 -0500 Subject: [PATCH 17/32] Build QVMs even if there is no QVM JIT The QVM interpreter works on all platforms. If building QVMs is an issue, that should probably be handled separate from whether there is a QVM JIT compiler. This enables building QVMs by default on Linux arm64. --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index e658f2c4..25ba0a9f 100644 --- a/Makefile +++ b/Makefile @@ -1069,7 +1069,6 @@ endif ifneq ($(HAVE_VM_COMPILED),true) BASE_CFLAGS += -DNO_VM_COMPILED - BUILD_GAME_QVM=0 endif TARGETS = From a81df34905fab89ad478237c269fc26bb1262489 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 18 Nov 2023 19:10:53 -0600 Subject: [PATCH 18/32] OpenGL2: Fix border for cg_viewsize using HDR/FB-MSAA w/postProcess If using renderFBO (r_hdr 1 or r_ext_framebuffer_multisample > 0) and r_postProcess 1, the viewport border (cg_viewsize < 100) which is drawn before the world scene was drawn to the renderFBO but not copied to the default framebuffer. Now 2D before the world scene is drawn to the default framebuffer directly for r_postProcess 1 like 2D drawn after the world scene. --- code/renderergl2/tr_backend.c | 24 +++++------------------- code/renderergl2/tr_local.h | 1 - 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/code/renderergl2/tr_backend.c b/code/renderergl2/tr_backend.c index ba3e2abb..12783b44 100644 --- a/code/renderergl2/tr_backend.c +++ b/code/renderergl2/tr_backend.c @@ -342,9 +342,7 @@ void RB_BeginDrawingView (void) { { FBO_t *fbo = backEnd.viewParms.targetFbo; - // FIXME: HUGE HACK: render to the screen fbo if we've already postprocessed the frame and aren't drawing more world - // drawing more world check is in case of double renders, such as skyportals - if (fbo == NULL && !(backEnd.framePostProcessed && (backEnd.refdef.rdflags & RDF_NOWORLDMODEL))) + if (fbo == NULL && (!r_postProcess->integer || !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL))) fbo = tr.renderFbo; if (tr.renderCubeFbo && fbo == tr.renderCubeFbo) @@ -708,10 +706,9 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte * ri.Printf( PRINT_ALL, "qglTexSubImage2D %i, %i: %i msec\n", cols, rows, end - start ); } - // FIXME: HUGE hack if (glRefConfig.framebufferObject) { - FBO_Bind(backEnd.framePostProcessed ? NULL : tr.renderFbo); + FBO_Bind(r_postProcess->integer ? NULL : tr.renderFbo); } RB_SetGL2D(); @@ -795,9 +792,8 @@ const void *RB_StretchPic ( const void *data ) { cmd = (const stretchPicCommand_t *)data; - // FIXME: HUGE hack if (glRefConfig.framebufferObject) - FBO_Bind(backEnd.framePostProcessed ? NULL : tr.renderFbo); + FBO_Bind(r_postProcess->integer ? NULL : tr.renderFbo); RB_SetGL2D(); @@ -1313,14 +1309,7 @@ const void *RB_ClearDepth(const void *data) if (glRefConfig.framebufferObject) { - if (!tr.renderFbo || backEnd.framePostProcessed) - { - FBO_Bind(NULL); - } - else - { - FBO_Bind(tr.renderFbo); - } + FBO_Bind(tr.renderFbo); } qglClear(GL_DEPTH_BUFFER_BIT); @@ -1378,7 +1367,7 @@ const void *RB_SwapBuffers( const void *data ) { if (glRefConfig.framebufferObject) { - if (!backEnd.framePostProcessed) + if (!r_postProcess->integer) { if (tr.msaaResolveFbo && r_hdr->integer) { @@ -1401,7 +1390,6 @@ const void *RB_SwapBuffers( const void *data ) { GLimp_EndFrame(); - backEnd.framePostProcessed = qfalse; backEnd.projection2D = qfalse; return (const void *)(cmd + 1); @@ -1655,8 +1643,6 @@ const void *RB_PostProcess(const void *data) } #endif - backEnd.framePostProcessed = qtrue; - return (const void *)(cmd + 1); } diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index 668dbbdd..adbb3d59 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -1472,7 +1472,6 @@ typedef struct { FBO_t *last2DFBO; qboolean colorMask[4]; - qboolean framePostProcessed; qboolean depthFill; } backEndState_t; From f7c12a1cf77335145800507b1cc50b0957e9e381 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 18 Nov 2023 19:31:09 -0600 Subject: [PATCH 19/32] OpenGL2: Fix r_clear when using HDR/FB-MSAA --- code/renderergl2/tr_backend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/renderergl2/tr_backend.c b/code/renderergl2/tr_backend.c index 12783b44..6b61217b 100644 --- a/code/renderergl2/tr_backend.c +++ b/code/renderergl2/tr_backend.c @@ -1197,6 +1197,13 @@ const void *RB_DrawBuffer( const void *data ) { if ( r_clear->integer ) { qglClearColor( 1, 0, 0.5, 1 ); qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + if (glRefConfig.framebufferObject && tr.renderFbo) { + FBO_Bind(tr.renderFbo); + + qglClearColor( 1, 0, 0.5, 1 ); + qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + } } return (const void *)(cmd + 1); From 03bc4eb810f1531704d44c2d918a6031b1d73ba2 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Mon, 20 Nov 2023 17:16:32 -0600 Subject: [PATCH 20/32] OpenGL2: Fix FB-MSAA on AMD Windows driver Fix r_ext_framebuffer_multisample > 0 causing the screen to always be solid black when using AMD Windows driver. The AMD Windows driver requires binding renderbuffer for it to be valid. The OpenGL2 renderer uses GL_EXT_direct_state_access that shouldn't require this. It would be required for Core/GL_ARB_direct_state_access. It seems like a driver bug. --- code/renderergl2/tr_fbo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/renderergl2/tr_fbo.c b/code/renderergl2/tr_fbo.c index 26f50c3f..b0a9478f 100644 --- a/code/renderergl2/tr_fbo.c +++ b/code/renderergl2/tr_fbo.c @@ -170,9 +170,13 @@ void FBO_CreateBuffer(FBO_t *fbo, int format, int index, int multisample) } absent = *pRenderBuffer == 0; - if (absent) + if (absent) { qglGenRenderbuffers(1, pRenderBuffer); + // workaround AMD Windows driver requiring bind to create renderbuffer + GL_BindRenderbuffer(*pRenderBuffer); + } + if (multisample && glRefConfig.framebufferMultisample) qglNamedRenderbufferStorageMultisampleEXT(*pRenderBuffer, multisample, format, fbo->width, fbo->height); else From 972635ea5a3d1057d9a958c2cb1815dff05ab33b Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Wed, 22 Nov 2023 19:38:50 -0600 Subject: [PATCH 21/32] OpenGL2: Fix updating the loading screen with r_cubeMapping 1 Generating cubemaps set backEnd.viewParms.isMirror = qtrue while the loading screen said 'loading... maps/q3dm1.bsp' and it just stayed like that until done loading (no additional messages or item icons) because all 2D drawing was culled due to flipped culling for isMirror. This was noticed because a recent commit fixed RB_ShowImages() to be drawn to the screen instead of draw into renderFbo and never blit to the screen. Now the loading screen draws over it as expected. Mentioned commit: a81df34905fab89ad478237c269fc26bb1262489 "OpenGL2: Fix border for cg_viewsize using HDR/FB-MSAA w/postProcess" --- code/renderergl2/tr_backend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/renderergl2/tr_backend.c b/code/renderergl2/tr_backend.c index 6b61217b..7387101b 100644 --- a/code/renderergl2/tr_backend.c +++ b/code/renderergl2/tr_backend.c @@ -1169,6 +1169,13 @@ const void *RB_DrawSurfs( const void *data ) { qglGenerateTextureMipmapEXT(cubemap->image->texnum, GL_TEXTURE_CUBE_MAP); } + // FIXME? backEnd.viewParms doesn't get properly initialized for 2D drawing. + // r_cubeMapping 1 generates cubemaps with R_RenderCubemapSide() + // and sets isMirror = qtrue. Clear it here to prevent it from leaking + // to 2D drawing and causing the loading screen to be culled. + backEnd.viewParms.isMirror = qfalse; + backEnd.viewParms.flags = 0; + return (const void *)(cmd + 1); } From ae0878ca618a737d7f8e843e8f4867bd34712cbe Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Wed, 20 Dec 2023 23:12:56 -0600 Subject: [PATCH 22/32] OpenGL2: Fix q3map2 lightstyles effects Fixes World of Padman wop_trashmap. For r_mergeLightmaps 1 - Fix tcMod transform on "map $lightmap" stages - Fix external lightmap image texcoords if shader also has an internal lightmap For r_sunlightMode 1 - Fix "tcGen lightmap" stages with blendFunc GL_SRC_ALPHA GL_ONE being converted to white image + modulate lightmap and drawing incorrectly --- code/renderergl2/tr_bsp.c | 1 + code/renderergl2/tr_shader.c | 107 ++++++++++++++++++++++++++++++++--- 2 files changed, 99 insertions(+), 9 deletions(-) diff --git a/code/renderergl2/tr_bsp.c b/code/renderergl2/tr_bsp.c index ad5fe3a3..b316351e 100644 --- a/code/renderergl2/tr_bsp.c +++ b/code/renderergl2/tr_bsp.c @@ -497,6 +497,7 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) { } +// If FatPackU() or FatPackV() changes, update FixFatLightmapTexCoords() static float FatPackU(float input, int lightmapnum) { if (lightmapnum < 0) diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index 0cd78a78..c899363e 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -2580,13 +2580,15 @@ static int CollapseStagesToGLSL(void) numStages++; } - // convert any remaining lightmap stages to a lighting pass with a white texture + // convert any remaining lightmap stages with no blending or blendfunc filter + // to a lighting pass with a white texture // only do this with r_sunlightMode non-zero, as it's only for correct shadows. if (r_sunlightMode->integer && shader.numDeforms == 0) { for (i = 0; i < MAX_SHADER_STAGES; i++) { shaderStage_t *pStage = &stages[i]; + int blendBits; if (!pStage->active) continue; @@ -2594,15 +2596,23 @@ static int CollapseStagesToGLSL(void) if (pStage->adjustColorsForFog) continue; - if (pStage->bundle[TB_DIFFUSEMAP].tcGen == TCGEN_LIGHTMAP) - { - pStage->glslShaderGroup = tr.lightallShader; - pStage->glslShaderIndex = LIGHTDEF_USE_LIGHTMAP; - pStage->bundle[TB_LIGHTMAP] = pStage->bundle[TB_DIFFUSEMAP]; - pStage->bundle[TB_DIFFUSEMAP].image[0] = tr.whiteImage; - pStage->bundle[TB_DIFFUSEMAP].isLightmap = qfalse; - pStage->bundle[TB_DIFFUSEMAP].tcGen = TCGEN_TEXTURE; + if (pStage->bundle[TB_DIFFUSEMAP].tcGen != TCGEN_LIGHTMAP) + continue; + + blendBits = pStage->stateBits & (GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS); + + if (blendBits != 0 && + blendBits != (GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO) && + blendBits != (GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR)) { + continue; } + + pStage->glslShaderGroup = tr.lightallShader; + pStage->glslShaderIndex = LIGHTDEF_USE_LIGHTMAP; + pStage->bundle[TB_LIGHTMAP] = pStage->bundle[TB_DIFFUSEMAP]; + pStage->bundle[TB_DIFFUSEMAP].image[0] = tr.whiteImage; + pStage->bundle[TB_DIFFUSEMAP].isLightmap = qfalse; + pStage->bundle[TB_DIFFUSEMAP].tcGen = TCGEN_TEXTURE; } } @@ -2890,6 +2900,83 @@ static void VertexLightingCollapse( void ) { } } +/* +================= +FixFatLightmapTexCoords + +Handle edge cases of altering lightmap texcoords for fat lightmap atlas +================= +*/ +static void FixFatLightmapTexCoords(void) +{ + texModInfo_t *tmi; + int lightmapnum; + int stage; + int size; + int i; + + if ( !r_mergeLightmaps->integer || tr.fatLightmapCols <= 0) { + return; + } + + if ( shader.lightmapIndex < 0 ) { + // no internal lightmap, texcoords were not modified + return; + } + + lightmapnum = shader.lightmapIndex; + + if (tr.worldDeluxeMapping) + lightmapnum >>= 1; + + lightmapnum %= (tr.fatLightmapCols * tr.fatLightmapRows); + + for ( stage = 0; stage < MAX_SHADER_STAGES; stage++ ) { + shaderStage_t *pStage = &stages[stage]; + + if ( !pStage->active ) { + break; + } + + // fix tcMod transform for internal lightmaps, it may be used by q3map2 lightstyles + if ( pStage->bundle[0].isLightmap ) { + for ( i = 0; i < pStage->bundle[0].numTexMods; i++ ) { + tmi = &pStage->bundle[0].texMods[i]; + + if ( tmi->type == TMOD_TRANSFORM ) { + tmi->translate[0] /= (float)tr.fatLightmapCols; + tmi->translate[1] /= (float)tr.fatLightmapRows; + } + } + } + // add a tcMod transform for external lightmaps to convert back to the original texcoords + else if ( pStage->bundle[0].tcGen == TCGEN_LIGHTMAP ) { + if ( pStage->bundle[0].numTexMods == TR_MAX_TEXMODS ) { + ri.Printf( PRINT_DEVELOPER, "WARNING: too many tcmods to fix external lightmap texcoords for r_mergeLightmaps in shader '%s'", shader.name ); + } else { + size = pStage->bundle[0].numTexMods * sizeof( texModInfo_t ); + + if ( size ) { + memmove( &pStage->bundle[0].texMods[1], &pStage->bundle[0].texMods[0], size ); + } + + tmi = &pStage->bundle[0].texMods[0]; + pStage->bundle[0].numTexMods++; + + tmi->matrix[0][0] = tr.fatLightmapCols; + tmi->matrix[0][1] = 0; + tmi->matrix[1][0] = 0; + tmi->matrix[1][1] = tr.fatLightmapRows; + + tmi->translate[0] = -(lightmapnum % tr.fatLightmapCols); + tmi->translate[1] = -(lightmapnum / tr.fatLightmapCols); + + tmi->type = TMOD_TRANSFORM; + } + } + } +} + /* =============== InitShader @@ -3081,6 +3168,8 @@ static shader_t *FinishShader( void ) { hasLightmapStage = qfalse; } + FixFatLightmapTexCoords(); + // // look for multitexture potential // From b07ff2a3cacf64dcd774499ec63e4b59c6bd849e Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 22 Dec 2023 22:00:57 -0600 Subject: [PATCH 23/32] OpenGL2: Fix parsing q3gl2_sun without two additional tokens If mapLightScale and shadowScale weren't included at the end of q3gl2_sun, the next shader line was skipped by SkipRestOfLine(). COM_ParseExt() with allowLineBreaks=qfalse, returns "" once and then goes to the next line anyway. (Doesn't work well multiple "optional" tokens. It looks like a vanilla bug.) --- code/renderergl2/tr_shader.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index c899363e..4b9fa991 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -1841,12 +1841,17 @@ static qboolean ParseShader( char **text ) tr.sunShadowScale = atof(token); // parse twice, since older shaders may include mapLightScale before sunShadowScale - token = COM_ParseExt( text, qfalse ); - if (token[0]) - tr.sunShadowScale = atof(token); + if (token[0]) { + token = COM_ParseExt( text, qfalse ); + if (token[0]) { + tr.sunShadowScale = atof(token); + } + } } - SkipRestOfLine( text ); + if (token[0]) { + SkipRestOfLine( text ); + } continue; } // tonemap parms From 5ede35d8ddf22a99afa7f487deebf52d4f986cde Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 26 Dec 2023 07:24:06 -0600 Subject: [PATCH 24/32] Fix building QVMs on Linux with Windows line endings On non-Windows, compiling QVM tools failed if dagcheck.md had CRLF line endings and compiling QVMs failed if game source had CRLF line endings. Also made Windows open the files as binary (no automatic CRLF to LF) so it behaves the same as on non-Windows. --- code/tools/lcc/cpp/lex.c | 20 ++++++++++++++++++++ code/tools/lcc/cpp/unix.c | 6 ++++++ code/tools/lcc/lburg/gram.c | 22 ++++++++++++++++++++++ code/tools/lcc/lburg/gram.y | 22 ++++++++++++++++++++++ code/tools/lcc/lburg/lburg.c | 4 ++-- 5 files changed, 72 insertions(+), 2 deletions(-) diff --git a/code/tools/lcc/cpp/lex.c b/code/tools/lcc/cpp/lex.c index 8030354e..66092e1b 100644 --- a/code/tools/lcc/cpp/lex.c +++ b/code/tools/lcc/cpp/lex.c @@ -511,6 +511,25 @@ foldline(Source *s) return 0; } +// This doesn't have proper tracking across read() to only remove \r from \r\n sequence. +// The lexer doesn't correctly handle standalone \r anyway though. +int +crlf_to_lf(unsigned char *buf, int n) { + int i, count; + + count = 0; + + for (i = 0; i < n; i++) { + if (buf[i] == '\r') { + continue; + } + + buf[count++] = buf[i]; + } + + return count; +} + int fillbuf(Source *s) { @@ -521,6 +540,7 @@ fillbuf(Source *s) error(FATAL, "Input buffer overflow"); if (s->fd<0 || (n=read(s->fd, (char *)s->inl, INS/8)) <= 0) n = 0; + n = crlf_to_lf(s->inl, n); if ((*s->inp&0xff) == EOB) /* sentinel character appears in input */ *s->inp = EOFC; s->inl += n; diff --git a/code/tools/lcc/cpp/unix.c b/code/tools/lcc/cpp/unix.c index bac841d8..56f1fff5 100644 --- a/code/tools/lcc/cpp/unix.c +++ b/code/tools/lcc/cpp/unix.c @@ -65,6 +65,9 @@ setup(int argc, char **argv) fp = (char*)newstring((uchar*)argv[optind], strlen(argv[optind]), 0); if ((fd = open(fp, 0)) <= 0) error(FATAL, "Can't open input file %s", fp); +#ifdef WIN32 + _setmode(fd, _O_BINARY); +#endif } if (optind+1 Date: Sat, 6 Jan 2024 08:20:30 -0600 Subject: [PATCH 25/32] OpenGL2: Fix applying tcMod turb Shader stage tcMods for matrix and turb effects need to be applied in order for turb to be correct and all tcMod turb need to be applied instead of only the last one. Quake 3's textures/liquids/slime1 had tcMod turb and then tcMod scale. OpenGL2 applied the matrix first and then turb which had the wrong result. --- code/renderergl2/glsl/generic_vp.glsl | 54 ++++++++--- code/renderergl2/glsl/lightall_vp.glsl | 48 +++++++--- code/renderergl2/tr_glsl.c | 10 +- code/renderergl2/tr_local.h | 10 +- code/renderergl2/tr_shade.c | 128 +++++++++++++++++-------- code/renderergl2/tr_sky.c | 17 ++-- 6 files changed, 190 insertions(+), 77 deletions(-) diff --git a/code/renderergl2/glsl/generic_vp.glsl b/code/renderergl2/glsl/generic_vp.glsl index a0055263..e6af9f81 100644 --- a/code/renderergl2/glsl/generic_vp.glsl +++ b/code/renderergl2/glsl/generic_vp.glsl @@ -16,8 +16,16 @@ attribute vec4 attr_TexCoord0; attribute vec4 attr_TexCoord1; #endif -uniform vec4 u_DiffuseTexMatrix; -uniform vec4 u_DiffuseTexOffTurb; +#if defined(USE_TCMOD) +uniform vec4 u_DiffuseTexMatrix0; +uniform vec4 u_DiffuseTexMatrix1; +uniform vec4 u_DiffuseTexMatrix2; +uniform vec4 u_DiffuseTexMatrix3; +uniform vec4 u_DiffuseTexMatrix4; +uniform vec4 u_DiffuseTexMatrix5; +uniform vec4 u_DiffuseTexMatrix6; +uniform vec4 u_DiffuseTexMatrix7; +#endif #if defined(USE_TCGEN) || defined(USE_RGBAGEN) uniform vec3 u_LocalViewOrigin; @@ -140,19 +148,28 @@ vec2 GenTexCoords(int TCGen, vec3 position, vec3 normal, vec3 TCGenVector0, vec3 #endif #if defined(USE_TCMOD) -vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb) +vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix[8]) { - float amplitude = offTurb.z; - float phase = offTurb.w * 2.0 * M_PI; - vec2 st2; - st2.x = st.x * texMatrix.x + (st.y * texMatrix.z + offTurb.x); - st2.y = st.x * texMatrix.y + (st.y * texMatrix.w + offTurb.y); - + vec2 st2 = st; vec2 offsetPos = vec2(position.x + position.z, position.y); - - vec2 texOffset = sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(phase)); - - return st2 + texOffset * amplitude; + + st2 = vec2(st2.x * texMatrix[0].x + st2.y * texMatrix[0].y + texMatrix[0].z, + st2.x * texMatrix[1].x + st2.y * texMatrix[1].y + texMatrix[1].z); + st2 += texMatrix[0].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[1].w * 2.0 * M_PI)); + + st2 = vec2(st2.x * texMatrix[2].x + st2.y * texMatrix[2].y + texMatrix[2].z, + st2.x * texMatrix[3].x + st2.y * texMatrix[3].y + texMatrix[3].z); + st2 += texMatrix[2].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[3].w * 2.0 * M_PI)); + + st2 = vec2(st2.x * texMatrix[4].x + st2.y * texMatrix[4].y + texMatrix[4].z, + st2.x * texMatrix[5].x + st2.y * texMatrix[5].y + texMatrix[5].z); + st2 += texMatrix[4].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[5].w * 2.0 * M_PI)); + + st2 = vec2(st2.x * texMatrix[6].x + st2.y * texMatrix[6].y + texMatrix[6].z, + st2.x * texMatrix[7].x + st2.y * texMatrix[7].y + texMatrix[7].z); + st2 += texMatrix[6].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[7].w * 2.0 * M_PI)); + + return st2; } #endif @@ -236,7 +253,16 @@ void main() #endif #if defined(USE_TCMOD) - var_DiffuseTex = ModTexCoords(tex, position, u_DiffuseTexMatrix, u_DiffuseTexOffTurb); + vec4 diffuseTexMatrix[8]; + diffuseTexMatrix[0] = u_DiffuseTexMatrix0; + diffuseTexMatrix[1] = u_DiffuseTexMatrix1; + diffuseTexMatrix[2] = u_DiffuseTexMatrix2; + diffuseTexMatrix[3] = u_DiffuseTexMatrix3; + diffuseTexMatrix[4] = u_DiffuseTexMatrix4; + diffuseTexMatrix[5] = u_DiffuseTexMatrix5; + diffuseTexMatrix[6] = u_DiffuseTexMatrix6; + diffuseTexMatrix[7] = u_DiffuseTexMatrix7; + var_DiffuseTex = ModTexCoords(tex, position, diffuseTexMatrix); #else var_DiffuseTex = tex; #endif diff --git a/code/renderergl2/glsl/lightall_vp.glsl b/code/renderergl2/glsl/lightall_vp.glsl index 428cf1e6..8ff5e7bb 100644 --- a/code/renderergl2/glsl/lightall_vp.glsl +++ b/code/renderergl2/glsl/lightall_vp.glsl @@ -37,8 +37,14 @@ uniform vec3 u_LocalViewOrigin; #endif #if defined(USE_TCMOD) -uniform vec4 u_DiffuseTexMatrix; -uniform vec4 u_DiffuseTexOffTurb; +uniform vec4 u_DiffuseTexMatrix0; +uniform vec4 u_DiffuseTexMatrix1; +uniform vec4 u_DiffuseTexMatrix2; +uniform vec4 u_DiffuseTexMatrix3; +uniform vec4 u_DiffuseTexMatrix4; +uniform vec4 u_DiffuseTexMatrix5; +uniform vec4 u_DiffuseTexMatrix6; +uniform vec4 u_DiffuseTexMatrix7; #endif uniform mat4 u_ModelViewProjectionMatrix; @@ -114,19 +120,28 @@ vec2 GenTexCoords(int TCGen, vec3 position, vec3 normal, vec3 TCGenVector0, vec3 #endif #if defined(USE_TCMOD) -vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb) +vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix[8]) { - float amplitude = offTurb.z; - float phase = offTurb.w * 2.0 * M_PI; - vec2 st2; - st2.x = st.x * texMatrix.x + (st.y * texMatrix.z + offTurb.x); - st2.y = st.x * texMatrix.y + (st.y * texMatrix.w + offTurb.y); - + vec2 st2 = st; vec2 offsetPos = vec2(position.x + position.z, position.y); - vec2 texOffset = sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(phase)); + st2 = vec2(st2.x * texMatrix[0].x + st2.y * texMatrix[0].y + texMatrix[0].z, + st2.x * texMatrix[1].x + st2.y * texMatrix[1].y + texMatrix[1].z); + st2 += texMatrix[0].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[1].w * 2.0 * M_PI)); + + st2 = vec2(st2.x * texMatrix[2].x + st2.y * texMatrix[2].y + texMatrix[2].z, + st2.x * texMatrix[3].x + st2.y * texMatrix[3].y + texMatrix[3].z); + st2 += texMatrix[2].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[3].w * 2.0 * M_PI)); + + st2 = vec2(st2.x * texMatrix[4].x + st2.y * texMatrix[4].y + texMatrix[4].z, + st2.x * texMatrix[5].x + st2.y * texMatrix[5].y + texMatrix[5].z); + st2 += texMatrix[4].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[5].w * 2.0 * M_PI)); + + st2 = vec2(st2.x * texMatrix[6].x + st2.y * texMatrix[6].y + texMatrix[6].z, + st2.x * texMatrix[7].x + st2.y * texMatrix[7].y + texMatrix[7].z); + st2 += texMatrix[6].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[7].w * 2.0 * M_PI)); - return st2 + texOffset * amplitude; + return st2; } #endif @@ -183,7 +198,16 @@ void main() #endif #if defined(USE_TCMOD) - var_TexCoords.xy = ModTexCoords(texCoords, position, u_DiffuseTexMatrix, u_DiffuseTexOffTurb); + vec4 diffuseTexMatrix[8]; + diffuseTexMatrix[0] = u_DiffuseTexMatrix0; + diffuseTexMatrix[1] = u_DiffuseTexMatrix1; + diffuseTexMatrix[2] = u_DiffuseTexMatrix2; + diffuseTexMatrix[3] = u_DiffuseTexMatrix3; + diffuseTexMatrix[4] = u_DiffuseTexMatrix4; + diffuseTexMatrix[5] = u_DiffuseTexMatrix5; + diffuseTexMatrix[6] = u_DiffuseTexMatrix6; + diffuseTexMatrix[7] = u_DiffuseTexMatrix7; + var_TexCoords.xy = ModTexCoords(texCoords, position, diffuseTexMatrix); #else var_TexCoords.xy = texCoords; #endif diff --git a/code/renderergl2/tr_glsl.c b/code/renderergl2/tr_glsl.c index 86cca599..2c834f10 100644 --- a/code/renderergl2/tr_glsl.c +++ b/code/renderergl2/tr_glsl.c @@ -88,8 +88,14 @@ static uniformInfo_t uniformsInfo[] = { "u_EnableTextures", GLSL_VEC4 }, - { "u_DiffuseTexMatrix", GLSL_VEC4 }, - { "u_DiffuseTexOffTurb", GLSL_VEC4 }, + { "u_DiffuseTexMatrix0", GLSL_VEC4 }, + { "u_DiffuseTexMatrix1", GLSL_VEC4 }, + { "u_DiffuseTexMatrix2", GLSL_VEC4 }, + { "u_DiffuseTexMatrix3", GLSL_VEC4 }, + { "u_DiffuseTexMatrix4", GLSL_VEC4 }, + { "u_DiffuseTexMatrix5", GLSL_VEC4 }, + { "u_DiffuseTexMatrix6", GLSL_VEC4 }, + { "u_DiffuseTexMatrix7", GLSL_VEC4 }, { "u_TCGen0", GLSL_INT }, { "u_TCGen0Vector0", GLSL_VEC3 }, diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index adbb3d59..4ee61fde 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -637,8 +637,14 @@ typedef enum UNIFORM_ENABLETEXTURES, - UNIFORM_DIFFUSETEXMATRIX, - UNIFORM_DIFFUSETEXOFFTURB, + UNIFORM_DIFFUSETEXMATRIX0, + UNIFORM_DIFFUSETEXMATRIX1, + UNIFORM_DIFFUSETEXMATRIX2, + UNIFORM_DIFFUSETEXMATRIX3, + UNIFORM_DIFFUSETEXMATRIX4, + UNIFORM_DIFFUSETEXMATRIX5, + UNIFORM_DIFFUSETEXMATRIX6, + UNIFORM_DIFFUSETEXMATRIX7, UNIFORM_TCGEN0, UNIFORM_TCGEN0VECTOR0, diff --git a/code/renderergl2/tr_shade.c b/code/renderergl2/tr_shade.c index 5300898c..21f9543a 100644 --- a/code/renderergl2/tr_shade.c +++ b/code/renderergl2/tr_shade.c @@ -181,33 +181,30 @@ extern float EvalWaveForm( const waveForm_t *wf ); extern float EvalWaveFormClamped( const waveForm_t *wf ); -static void ComputeTexMods( shaderStage_t *pStage, int bundleNum, float *outMatrix, float *outOffTurb) +static void ComputeTexMods( shaderStage_t *pStage, int bundleNum, vec4_t outMatrix[8]) { int tm; - float matrix[6], currentmatrix[6]; + float matrix[6]; + float tmpmatrix[6]; + float currentmatrix[6]; + float turb[2]; textureBundle_t *bundle = &pStage->bundle[bundleNum]; - - matrix[0] = 1.0f; matrix[2] = 0.0f; matrix[4] = 0.0f; - matrix[1] = 0.0f; matrix[3] = 1.0f; matrix[5] = 0.0f; + qboolean hasTurb = qfalse; currentmatrix[0] = 1.0f; currentmatrix[2] = 0.0f; currentmatrix[4] = 0.0f; currentmatrix[1] = 0.0f; currentmatrix[3] = 1.0f; currentmatrix[5] = 0.0f; - outMatrix[0] = 1.0f; outMatrix[2] = 0.0f; - outMatrix[1] = 0.0f; outMatrix[3] = 1.0f; - - outOffTurb[0] = 0.0f; outOffTurb[1] = 0.0f; outOffTurb[2] = 0.0f; outOffTurb[3] = 0.0f; - for ( tm = 0; tm < bundle->numTexMods ; tm++ ) { switch ( bundle->texMods[tm].type ) { case TMOD_NONE: - tm = TR_MAX_TEXMODS; // break out of for loop + matrix[0] = 1.0f; matrix[2] = 0.0f; matrix[4] = 0.0f; + matrix[1] = 0.0f; matrix[3] = 1.0f; matrix[5] = 0.0f; break; case TMOD_TURBULENT: - RB_CalcTurbulentFactors(&bundle->texMods[tm].wave, &outOffTurb[2], &outOffTurb[3]); + RB_CalcTurbulentFactors(&bundle->texMods[tm].wave, &turb[0], &turb[1]); break; case TMOD_ENTITY_TRANSLATE: @@ -246,35 +243,68 @@ static void ComputeTexMods( shaderStage_t *pStage, int bundleNum, float *outMatr switch ( bundle->texMods[tm].type ) { - case TMOD_NONE: case TMOD_TURBULENT: - default: + outMatrix[tm*2+0][0] = 1; outMatrix[tm*2+0][1] = 0; outMatrix[tm*2+0][2] = 0; + outMatrix[tm*2+1][0] = 0; outMatrix[tm*2+1][1] = 1; outMatrix[tm*2+1][2] = 0; + + outMatrix[tm*2+0][3] = turb[0]; + outMatrix[tm*2+1][3] = turb[1]; + + hasTurb = qtrue; break; + case TMOD_NONE: case TMOD_ENTITY_TRANSLATE: case TMOD_SCROLL: case TMOD_SCALE: case TMOD_STRETCH: case TMOD_TRANSFORM: case TMOD_ROTATE: - outMatrix[0] = matrix[0] * currentmatrix[0] + matrix[2] * currentmatrix[1]; - outMatrix[1] = matrix[1] * currentmatrix[0] + matrix[3] * currentmatrix[1]; + default: + outMatrix[tm*2+0][0] = matrix[0]; outMatrix[tm*2+0][1] = matrix[2]; outMatrix[tm*2+0][2] = matrix[4]; + outMatrix[tm*2+1][0] = matrix[1]; outMatrix[tm*2+1][1] = matrix[3]; outMatrix[tm*2+1][2] = matrix[5]; - outMatrix[2] = matrix[0] * currentmatrix[2] + matrix[2] * currentmatrix[3]; - outMatrix[3] = matrix[1] * currentmatrix[2] + matrix[3] * currentmatrix[3]; + outMatrix[tm*2+0][3] = 0; + outMatrix[tm*2+1][3] = 0; - outOffTurb[0] = matrix[0] * currentmatrix[4] + matrix[2] * currentmatrix[5] + matrix[4]; - outOffTurb[1] = matrix[1] * currentmatrix[4] + matrix[3] * currentmatrix[5] + matrix[5]; + tmpmatrix[0] = matrix[0] * currentmatrix[0] + matrix[2] * currentmatrix[1]; + tmpmatrix[1] = matrix[1] * currentmatrix[0] + matrix[3] * currentmatrix[1]; - currentmatrix[0] = outMatrix[0]; - currentmatrix[1] = outMatrix[1]; - currentmatrix[2] = outMatrix[2]; - currentmatrix[3] = outMatrix[3]; - currentmatrix[4] = outOffTurb[0]; - currentmatrix[5] = outOffTurb[1]; + tmpmatrix[2] = matrix[0] * currentmatrix[2] + matrix[2] * currentmatrix[3]; + tmpmatrix[3] = matrix[1] * currentmatrix[2] + matrix[3] * currentmatrix[3]; + + tmpmatrix[4] = matrix[0] * currentmatrix[4] + matrix[2] * currentmatrix[5] + matrix[4]; + tmpmatrix[5] = matrix[1] * currentmatrix[4] + matrix[3] * currentmatrix[5] + matrix[5]; + + currentmatrix[0] = tmpmatrix[0]; + currentmatrix[1] = tmpmatrix[1]; + currentmatrix[2] = tmpmatrix[2]; + currentmatrix[3] = tmpmatrix[3]; + currentmatrix[4] = tmpmatrix[4]; + currentmatrix[5] = tmpmatrix[5]; break; } } + + // if turb isn't used, only one matrix is needed + if ( !hasTurb ) { + tm = 0; + + outMatrix[tm*2+0][0] = currentmatrix[0]; outMatrix[tm*2+0][1] = currentmatrix[2]; outMatrix[tm*2+0][2] = currentmatrix[4]; + outMatrix[tm*2+1][0] = currentmatrix[1]; outMatrix[tm*2+1][1] = currentmatrix[3]; outMatrix[tm*2+1][2] = currentmatrix[5]; + + outMatrix[tm*2+0][3] = 0; + outMatrix[tm*2+1][3] = 0; + tm++; + } + + for ( ; tm < TR_MAX_TEXMODS ; tm++ ) { + outMatrix[tm*2+0][0] = 1; outMatrix[tm*2+0][1] = 0; outMatrix[tm*2+0][2] = 0; + outMatrix[tm*2+1][0] = 0; outMatrix[tm*2+1][1] = 1; outMatrix[tm*2+1][2] = 0; + + outMatrix[tm*2+0][3] = 0; + outMatrix[tm*2+1][3] = 0; + } } @@ -665,8 +695,7 @@ static void ForwardDlight( void ) { dlight_t *dl; shaderProgram_t *sp; vec4_t vector; - vec4_t texMatrix; - vec4_t texOffTurb; + vec4_t texMatrix[8]; if ( !( tess.dlightBits & ( 1 << l ) ) ) { continue; // this surface definitely doesn't have any of this light @@ -792,9 +821,15 @@ static void ForwardDlight( void ) { if (r_dlightMode->integer >= 2) GL_BindToTMU(tr.shadowCubemaps[l], TB_SHADOWMAP); - ComputeTexMods( pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb ); - GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix); - GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, texOffTurb); + ComputeTexMods( pStage, TB_DIFFUSEMAP, texMatrix ); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX0, texMatrix[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX1, texMatrix[1]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX2, texMatrix[2]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX3, texMatrix[3]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX4, texMatrix[4]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX5, texMatrix[5]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX6, texMatrix[6]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX7, texMatrix[7]); GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, pStage->bundle[0].tcGen); @@ -996,8 +1031,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) { shaderStage_t *pStage = input->xstages[stage]; shaderProgram_t *sp; - vec4_t texMatrix; - vec4_t texOffTurb; + vec4_t texMatrix[8]; if ( !pStage ) { @@ -1184,19 +1218,31 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) if (r_lightmap->integer) { - vec4_t v; - VectorSet4(v, 1.0f, 0.0f, 0.0f, 1.0f); - GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, v); - VectorSet4(v, 0.0f, 0.0f, 0.0f, 0.0f); - GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, v); + vec4_t st[2]; + VectorSet4(st[0], 1.0f, 0.0f, 0.0f, 0.0f); + VectorSet4(st[1], 0.0f, 1.0f, 0.0f, 0.0f); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX0, st[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX1, st[1]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX2, st[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX3, st[1]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX4, st[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX5, st[1]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX6, st[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX7, st[1]); GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, TCGEN_LIGHTMAP); } else { - ComputeTexMods(pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb); - GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix); - GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, texOffTurb); + ComputeTexMods(pStage, TB_DIFFUSEMAP, texMatrix); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX0, texMatrix[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX1, texMatrix[1]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX2, texMatrix[2]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX3, texMatrix[3]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX4, texMatrix[4]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX5, texMatrix[5]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX6, texMatrix[6]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX7, texMatrix[7]); GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, pStage->bundle[0].tcGen); if (pStage->bundle[0].tcGen == TCGEN_VECTOR) diff --git a/code/renderergl2/tr_sky.c b/code/renderergl2/tr_sky.c index 94f68d26..c79f48f5 100644 --- a/code/renderergl2/tr_sky.c +++ b/code/renderergl2/tr_sky.c @@ -435,7 +435,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max */ { shaderProgram_t *sp = &tr.lightallShader[0]; - vec4_t vector; + vec4_t st[2]; GLSL_BindProgram(sp); @@ -453,11 +453,16 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max color[3] = 0.0f; GLSL_SetUniformVec4(sp, UNIFORM_VERTCOLOR, color); - VectorSet4(vector, 1.0, 0.0, 0.0, 1.0); - GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, vector); - - VectorSet4(vector, 0.0, 0.0, 0.0, 0.0); - GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, vector); + VectorSet4(st[0], 1.0f, 0.0f, 0.0f, 0.0f); + VectorSet4(st[1], 0.0f, 1.0f, 0.0f, 0.0f); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX0, st[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX1, st[1]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX2, st[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX3, st[1]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX4, st[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX5, st[1]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX6, st[0]); + GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX7, st[1]); GLSL_SetUniformInt(sp, UNIFORM_ALPHATEST, 0); } From 7426ac217685e430424d4aa7ba27149924446a0f Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 8 Feb 2024 15:17:05 -0600 Subject: [PATCH 26/32] OpenGL2: Fix sun rays being affected by the viewport size Using r_drawSunRays 1, r_hdr 0, cg_viewsize 50 caused the sun rays to only draw properly in the bottom right quarter of the world viewport. The scissor rectangle for the world viewport was applied to the first FBO_FastBlit() in RB_SunRays(). Set glScissor() in FBO_FastBlit() as it's done in FBO_Blit() and FBO_BlitFromTexture(). Sun rays probably worked correctly with r_hdr 1 because the blit for HDR changed the scissor state. --- code/renderergl2/tr_fbo.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/code/renderergl2/tr_fbo.c b/code/renderergl2/tr_fbo.c index b0a9478f..223cbe7f 100644 --- a/code/renderergl2/tr_fbo.c +++ b/code/renderergl2/tr_fbo.c @@ -648,10 +648,30 @@ void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int bu int width = dst ? dst->width : glConfig.vidWidth; int height = dst ? dst->height : glConfig.vidHeight; + qglScissor(0, 0, width, height); + VectorSet4(dstBoxFinal, 0, 0, width, height); } else { + ivec4_t scissorBox; + + Vector4Copy(dstBox, scissorBox); + + if (scissorBox[2] < 0) + { + scissorBox[0] += scissorBox[2]; + scissorBox[2] = fabsf(scissorBox[2]); + } + + if (scissorBox[3] < 0) + { + scissorBox[1] += scissorBox[3]; + scissorBox[3] = fabsf(scissorBox[3]); + } + + qglScissor(scissorBox[0], scissorBox[1], scissorBox[2], scissorBox[3]); + VectorSet4(dstBoxFinal, dstBox[0], dstBox[1], dstBox[0] + dstBox[2], dstBox[1] + dstBox[3]); } From eaefa355801f0c30dbbb58945c995aeab614389c Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 9 Feb 2024 09:48:51 -0600 Subject: [PATCH 27/32] OpenGL2: Fix merged lightmap hacks to have real lightmap index This fixes the texcoord range to be 0.0 to 1.0 for external lightmaps in shaders that also have an internal lightmap. (Instead of 2.0 to 3.0 for example.) This only affects clampMap as repeating wrapping sampled the correct location. I haven't found such a shader but I need to get real lightmap index for future merged lightmap hacks. --- code/renderergl2/tr_bsp.c | 6 +++--- code/renderergl2/tr_local.h | 1 + code/renderergl2/tr_shader.c | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/code/renderergl2/tr_bsp.c b/code/renderergl2/tr_bsp.c index b316351e..15f5f3cd 100644 --- a/code/renderergl2/tr_bsp.c +++ b/code/renderergl2/tr_bsp.c @@ -617,7 +617,7 @@ static shader_t *ShaderForShaderNum( int shaderNum, int lightmapNum ) { lightmapNum = LIGHTMAP_WHITEIMAGE; } - shader = R_FindShader( dsh->shader, lightmapNum, qtrue ); + shader = R_FindShaderEx( dsh->shader, FatLightmap( lightmapNum ), qtrue, lightmapNum ); // if the shader had errors, just use default shader if ( shader->defaultShader ) { @@ -706,7 +706,7 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, float *hdrVertColors, surf->fogIndex = LittleLong( ds->fogNum ) + 1; // get shader value - surf->shader = ShaderForShaderNum( ds->shaderNum, FatLightmap(realLightmapNum) ); + surf->shader = ShaderForShaderNum( ds->shaderNum, realLightmapNum ); if ( r_singleShader->integer && !surf->shader->isSky ) { surf->shader = tr.defaultShader; } @@ -813,7 +813,7 @@ static void ParseMesh ( dsurface_t *ds, drawVert_t *verts, float *hdrVertColors, surf->fogIndex = LittleLong( ds->fogNum ) + 1; // get shader value - surf->shader = ShaderForShaderNum( ds->shaderNum, FatLightmap(realLightmapNum) ); + surf->shader = ShaderForShaderNum( ds->shaderNum, realLightmapNum ); if ( r_singleShader->integer && !surf->shader->isSky ) { surf->shader = tr.defaultShader; } diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index 4ee61fde..6a0aa36f 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -1995,6 +1995,7 @@ const void *RB_TakeVideoFrameCmd( const void *data ); // tr_shader.c // shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImage ); +shader_t *R_FindShaderEx( const char *name, int lightmapIndex, qboolean mipRawImage, int realLightmapIndex ); shader_t *R_GetShaderByHandle( qhandle_t hShader ); shader_t *R_GetShaderByState( int index, long *cycleTime ); shader_t *R_FindShaderByName( const char *name ); diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index 4b9fa991..cfd87f05 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -30,6 +30,7 @@ static char *s_shaderText; static shaderStage_t stages[MAX_SHADER_STAGES]; static shader_t shader; static texModInfo_t texMods[MAX_SHADER_STAGES][TR_MAX_TEXMODS]; +static int shader_realLightmapIndex; #define FILE_HASH_SIZE 1024 static shader_t* hashTable[FILE_HASH_SIZE]; @@ -2929,7 +2930,7 @@ static void FixFatLightmapTexCoords(void) return; } - lightmapnum = shader.lightmapIndex; + lightmapnum = shader_realLightmapIndex; if (tr.worldDeluxeMapping) lightmapnum >>= 1; @@ -2987,7 +2988,7 @@ static void FixFatLightmapTexCoords(void) InitShader =============== */ -static void InitShader( const char *name, int lightmapIndex ) { +static void InitShaderEx( const char *name, int lightmapIndex, int realLightmapIndex ) { int i; // clear the global shader @@ -2996,6 +2997,7 @@ static void InitShader( const char *name, int lightmapIndex ) { Q_strncpyz( shader.name, name, sizeof( shader.name ) ); shader.lightmapIndex = lightmapIndex; + shader_realLightmapIndex = realLightmapIndex; for ( i = 0 ; i < MAX_SHADER_STAGES ; i++ ) { stages[i].bundle[0].texMods = texMods[i]; @@ -3016,6 +3018,10 @@ static void InitShader( const char *name, int lightmapIndex ) { } } +static void InitShader( const char *name, int lightmapIndex ) { + InitShaderEx( name, lightmapIndex, lightmapIndex ); +} + /* ========================= FinishShader @@ -3337,6 +3343,10 @@ most world construction surfaces. =============== */ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImage ) { + return R_FindShaderEx( name, lightmapIndex, mipRawImage, lightmapIndex ); +} + +shader_t *R_FindShaderEx( const char *name, int lightmapIndex, qboolean mipRawImage, int realLightmapIndex ) { char strippedName[MAX_QPATH]; int hash; char *shaderText; @@ -3376,7 +3386,7 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag } } - InitShader( strippedName, lightmapIndex ); + InitShaderEx( strippedName, lightmapIndex, realLightmapIndex ); // // attempt to define shader from an explicit parameter file From e3abcffeb01fed31ce37ff0f014fedd347ff1cc0 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 10 Feb 2024 14:38:18 -0600 Subject: [PATCH 28/32] OpenGL2: Fix using merged lightmaps with tcGen environment tcGen environment generates texcoords in range of 0.0 to 1.0 and they need to be offset to the position/size in the merged lightmap atlas. This also needs to be after tcMods so they apply for the original range. This fixes tcMod scale used by main_q3abanner and shinygrate1_4. This issue was visible on the blue monitor (comp3c) near the plasmagun in q3dm0 and the Quake III Arena banner in q3dm17. Affected shaders in Quake 3 and Team Arena maps: textures/base_wall/comp3 textures/base_wall/comp3b textures/base_wall/comp3b_dark textures/base_wall/comp3c textures/base_wall/main_q3abanner textures/base_wall/shinygrate1_4 textures/sfx/teslacoil All of the shaders are used by q3dm0 but other maps also use some. --- code/renderergl2/tr_shader.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index cfd87f05..ba075510 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -2944,8 +2944,8 @@ static void FixFatLightmapTexCoords(void) break; } - // fix tcMod transform for internal lightmaps, it may be used by q3map2 lightstyles if ( pStage->bundle[0].isLightmap ) { + // fix tcMod transform for internal lightmaps, it may be used by q3map2 lightstyles for ( i = 0; i < pStage->bundle[0].numTexMods; i++ ) { tmi = &pStage->bundle[0].texMods[i]; @@ -2954,11 +2954,32 @@ static void FixFatLightmapTexCoords(void) tmi->translate[1] /= (float)tr.fatLightmapRows; } } + + // fix tcGen environment for internal lightmaps to be limited to the sub-image of the atlas + // this is done last so other tcMods are applied first in the 0.0 to 1.0 space + if ( pStage->bundle[0].tcGen == TCGEN_ENVIRONMENT_MAPPED ) { + if ( pStage->bundle[0].numTexMods == TR_MAX_TEXMODS ) { + ri.Printf( PRINT_DEVELOPER, "WARNING: too many tcmods to fix lightmap texcoords for r_mergeLightmaps in shader '%s'", shader.name ); + } else { + tmi = &pStage->bundle[0].texMods[pStage->bundle[0].numTexMods]; + pStage->bundle[0].numTexMods++; + + tmi->matrix[0][0] = 1.0f / tr.fatLightmapCols; + tmi->matrix[0][1] = 0; + tmi->matrix[1][0] = 0; + tmi->matrix[1][1] = 1.0f / tr.fatLightmapRows; + + tmi->translate[0] = ( lightmapnum % tr.fatLightmapCols ) / (float)tr.fatLightmapCols; + tmi->translate[1] = ( lightmapnum / tr.fatLightmapCols ) / (float)tr.fatLightmapRows; + + tmi->type = TMOD_TRANSFORM; + } + } } // add a tcMod transform for external lightmaps to convert back to the original texcoords else if ( pStage->bundle[0].tcGen == TCGEN_LIGHTMAP ) { if ( pStage->bundle[0].numTexMods == TR_MAX_TEXMODS ) { - ri.Printf( PRINT_DEVELOPER, "WARNING: too many tcmods to fix external lightmap texcoords for r_mergeLightmaps in shader '%s'", shader.name ); + ri.Printf( PRINT_DEVELOPER, "WARNING: too many tcmods to fix lightmap texcoords for r_mergeLightmaps in shader '%s'", shader.name ); } else { size = pStage->bundle[0].numTexMods * sizeof( texModInfo_t ); @@ -2974,8 +2995,8 @@ static void FixFatLightmapTexCoords(void) tmi->matrix[1][0] = 0; tmi->matrix[1][1] = tr.fatLightmapRows; - tmi->translate[0] = -(lightmapnum % tr.fatLightmapCols); - tmi->translate[1] = -(lightmapnum / tr.fatLightmapCols); + tmi->translate[0] = -( lightmapnum % tr.fatLightmapCols ); + tmi->translate[1] = -( lightmapnum / tr.fatLightmapCols ); tmi->type = TMOD_TRANSFORM; } From 5d60f6035a74ff2d4e44c34b2671ea3fc4861afd Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 10 Feb 2024 14:50:35 -0600 Subject: [PATCH 29/32] OpenGL2: Fix hack for tcMod transform on merged lightmaps When using merged lightmaps, only change tcMod transform for tcGen lightmap. --- code/renderergl2/tr_shader.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index ba075510..b08a9328 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -2946,12 +2946,14 @@ static void FixFatLightmapTexCoords(void) if ( pStage->bundle[0].isLightmap ) { // fix tcMod transform for internal lightmaps, it may be used by q3map2 lightstyles - for ( i = 0; i < pStage->bundle[0].numTexMods; i++ ) { - tmi = &pStage->bundle[0].texMods[i]; + if ( pStage->bundle[0].tcGen == TCGEN_LIGHTMAP ) { + for ( i = 0; i < pStage->bundle[0].numTexMods; i++ ) { + tmi = &pStage->bundle[0].texMods[i]; - if ( tmi->type == TMOD_TRANSFORM ) { - tmi->translate[0] /= (float)tr.fatLightmapCols; - tmi->translate[1] /= (float)tr.fatLightmapRows; + if ( tmi->type == TMOD_TRANSFORM ) { + tmi->translate[0] /= (float)tr.fatLightmapCols; + tmi->translate[1] /= (float)tr.fatLightmapRows; + } } } From 9881c561ad1796a68ddb88616d7da6d806f29a60 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 13 Feb 2024 05:50:01 -0600 Subject: [PATCH 30/32] OpenGL2: Fix flares behind mirror being visible When r_ext_framebuffer_multisample > 0 was used, flares behind the mirror in q3tourney6 were incorrectly visible. This was because it checks scene depth in the depth prepass which only drew opaque surfaces. It also needs to contain depth for mirror/portal surfaces. --- code/renderergl2/tr_backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/renderergl2/tr_backend.c b/code/renderergl2/tr_backend.c index 7387101b..5c160ab4 100644 --- a/code/renderergl2/tr_backend.c +++ b/code/renderergl2/tr_backend.c @@ -455,7 +455,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { for (i = 0, drawSurf = drawSurfs ; i < numDrawSurfs ; i++, drawSurf++) { if ( drawSurf->sort == oldSort && drawSurf->cubemapIndex == oldCubemapIndex) { - if (backEnd.depthFill && shader && shader->sort != SS_OPAQUE) + if (backEnd.depthFill && shader && (shader->sort != SS_OPAQUE && shader->sort != SS_PORTAL)) continue; // fast path, same as previous sort @@ -484,7 +484,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { oldCubemapIndex = cubemapIndex; } - if (backEnd.depthFill && shader && shader->sort != SS_OPAQUE) + if (backEnd.depthFill && shader && (shader->sort != SS_OPAQUE && shader->sort != SS_PORTAL)) continue; // From 7d711f812150f7726311ecddd7ee7bf182316859 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 17 Feb 2024 15:37:18 -0600 Subject: [PATCH 31/32] Fix running on Windows XP Newer mingw-w64 changed default Windows version compatibility. Need to specify older behavior for EnumProcesses() to avoid "missing K32EnumProcesses()" runtime error. --- code/sys/sys_win32.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index d5e1c637..7d806a16 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ +// Use EnumProcesses() with Windows XP compatibility +#define PSAPI_VERSION 1 + #include "../qcommon/q_shared.h" #include "../qcommon/qcommon.h" #include "sys_local.h" From 2cd1a7ef4abf5212b3a113cbb4e54483bc427eb1 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Mon, 26 Feb 2024 12:11:57 -0600 Subject: [PATCH 32/32] Fix GitHub Actions CI deprecation warnings --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 393b88fd..5d2cc660 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ jobs: name: Linux runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Dependencies run: | sudo apt-get update @@ -15,7 +15,7 @@ jobs: run: make release env: ARCHIVE: 1 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Linux path: build/*.zip @@ -23,14 +23,14 @@ jobs: name: Windows runs-on: windows-2019 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Compile run: | choco install zip make release env: ARCHIVE: 1 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Windows path: build/*.zip @@ -38,12 +38,12 @@ jobs: name: macOS runs-on: macos-11 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Compile run: make release env: ARCHIVE: 1 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: macOS path: build/*.zip