mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 17:48:46 -10:00
Compare commits
140
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a520e810f2 | ||
|
|
b1b197cc9a | ||
|
|
941b7298cc | ||
|
|
637a9621f1 | ||
|
|
70c5aa88f2 | ||
|
|
1857f9b928 | ||
|
|
fb4169ba9f | ||
|
|
1448256140 | ||
|
|
7de592bf9b | ||
|
|
783852a115 | ||
|
|
84fd7123a5 | ||
|
|
ff9d06cfe1 | ||
|
|
a158029120 | ||
|
|
96e8d5b66e | ||
|
|
85fd0b0498 | ||
|
|
5d3e6789e6 | ||
|
|
b8e5a395dd | ||
|
|
1a1c3df379 | ||
|
|
0dc0d67c76 | ||
|
|
0edb360fc2 | ||
|
|
1743e5f5d4 | ||
|
|
ed3f07284d | ||
|
|
c1b222ffd5 | ||
|
|
3503b9214b | ||
|
|
aff8cc8095 | ||
|
|
884581a836 | ||
|
|
98af9dd903 | ||
|
|
ea37b3cb17 | ||
|
|
3035a868ab | ||
|
|
a88c50b6f2 | ||
|
|
ac24ca9fd3 | ||
|
|
d085951767 | ||
|
|
c3f19631ce | ||
|
|
ca9eff3bc5 | ||
|
|
0a19616bc9 | ||
|
|
255e9aa21e | ||
|
|
550f459747 | ||
|
|
6da72bb1a0 | ||
|
|
c7fbefeb58 | ||
|
|
98e316bca6 | ||
|
|
78a1e5baab | ||
|
|
080ce8419a | ||
|
|
06e9248079 | ||
|
|
e04c60ed6f | ||
|
|
81d9ca8e4a | ||
|
|
bf2ca61e5a | ||
|
|
ffe647be79 | ||
|
|
fff2e6d1fc | ||
|
|
23e46ae7c4 | ||
|
|
74d270270e | ||
|
|
df69d195fe | ||
|
|
6c871ac339 | ||
|
|
24afebb808 | ||
|
|
6aac8c7bde | ||
|
|
a2da77e14c | ||
|
|
7ca6b679b7 | ||
|
|
3d6bbb0b9b | ||
|
|
a912956601 | ||
|
|
a769a7ef87 | ||
|
|
991e09006e | ||
|
|
3e6c3f6f62 | ||
|
|
2ee3dd70ea | ||
|
|
c259dfb9cd | ||
|
|
2947c7972d | ||
|
|
eda8c65b58 | ||
|
|
186f8ff5b9 | ||
|
|
c86c4c3822 | ||
|
|
bea9d56feb | ||
|
|
dc6d2be515 | ||
|
|
298ec5519c | ||
|
|
7025e3443e | ||
|
|
88b87b86fc | ||
|
|
b34ca3cfed | ||
|
|
1b2eece53a | ||
|
|
e8313fa577 | ||
|
|
5a8454e956 | ||
|
|
f6b1eaa846 | ||
|
|
d20ff9b367 | ||
|
|
a3ab30cd96 | ||
|
|
48f76f7cd1 | ||
|
|
eb165123ac | ||
|
|
c30ce55942 | ||
|
|
9447d74da8 | ||
|
|
043e6a79a8 | ||
|
|
97416feb2a | ||
|
|
aac3bbde8e | ||
|
|
8f3ef45fc9 | ||
|
|
762997fc7d | ||
|
|
43a46641eb | ||
|
|
47bd990bca | ||
|
|
ec3313ffea | ||
|
|
f2c099a7a9 | ||
|
|
e6c6cc3864 | ||
|
|
5ee1b6d243 | ||
|
|
3577c005e2 | ||
|
|
b2891bfe21 | ||
|
|
82aa027d0d | ||
|
|
902d40f3df | ||
|
|
e82fc4ac2f | ||
|
|
71673241fd | ||
|
|
f93cb23d43 | ||
|
|
0415b69407 | ||
|
|
e4775948d7 | ||
|
|
8958de35bc | ||
|
|
c03dbea7ea | ||
|
|
9107da8c9c | ||
|
|
1abb1833aa | ||
|
|
a2e70b8c5c | ||
|
|
1029de8073 | ||
|
|
3abcb24815 | ||
|
|
13d68bdfc6 | ||
|
|
de0bbaa4f6 | ||
|
|
ce569d400e | ||
|
|
adb94dc4d2 | ||
|
|
916082d910 | ||
|
|
e52f23d45d | ||
|
|
2dfc086c94 | ||
|
|
0a53aff061 | ||
|
|
2dab381e88 | ||
|
|
83514409f3 | ||
|
|
340f39f44d | ||
|
|
418a944127 | ||
|
|
22180c0b45 | ||
|
|
2949ca2628 | ||
|
|
dbf952e031 | ||
|
|
21cc93ffd6 | ||
|
|
c06ed08e74 | ||
|
|
89a9932ac5 | ||
|
|
5b1285e608 | ||
|
|
d5d33379a3 | ||
|
|
accbc1d25d | ||
|
|
8acff8e02c | ||
|
|
89d13ab774 | ||
|
|
8850efce7f | ||
|
|
4b36e3c379 | ||
|
|
c008dfc303 | ||
|
|
8f76537b02 | ||
|
|
36ae38a532 | ||
|
|
bcf49b9630 | ||
|
|
654f3545fc |
No files matched your search
+23
-14
@@ -23,6 +23,19 @@ addons:
|
||||
build_command: "ci/travis/script.sh"
|
||||
# must match TRAVIS_BRANCH check below
|
||||
branch_pattern: coverity_scan
|
||||
env:
|
||||
global:
|
||||
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
||||
# via the "travis encrypt" command using the project repo's public key
|
||||
# also note that fork's don't get access to secure keys
|
||||
# you have to test using a branch in the main repo
|
||||
- secure: "C3wF967ZeliwwP1vC12EMIBOaC568n26Z/cPnwzn317ve59DWH3YSfPZVgvt08GzmaXITGGsJvPB+qxfGoKvQzYE4O1B73q81RpUe5pB3IhF+ThQ91VfQZIRJR5xEGJaLINUlHTTZGX5jxlkVO9wAcauVj/s3b8sQ3dvUZauPvk="
|
||||
# These declarations set INDIEGAMES_USER and INDIEGAMES_PASSWORD for uploading nightly builds to the indiegames server
|
||||
- secure: "lUuRu8XIi8MKNf1ebOfyC4iVEpPyASojJIDWXRo2bNqEF4ILAljXdkVeXeN6H5yKCHD52cxCNTtyePIG/o3p3QEuGSVud9bDS3D7LaQicLETGGrsw3l07U49gF2OKHXGopg0MzBbZUU9QmhoFTAe8t6PV9NDuEayYCheqvTqjZg="
|
||||
- secure: "E/DHLYcPK/hBUqxBYYlUqp5sjgvIqY5A0qRHyQ4bmjsB+WB/Xx71bGCSiF7hk6lTxar1ZI1i5RAXXh9AIvNVaYAIdEOlCP+q3gvwCYuc5naZEKmkxlUCf0oEL4O9Fye93A/3VkFHuBdC1TGPYYf69m4W5r4367wWO9dPRIdWpJA="
|
||||
# These declarations set FS2DOWNLOADS_USER and FS2DOWNLOADS_PASSWORD
|
||||
- secure: "h6GbMX2jLsW1bS9fCM9fthOSJ1nfQQIRWi6EUH2p8u4NFLD5Bfi/C8JhQPKHUzyo3wvKkSHl+PsW7bgr1oXLusRwAur/dtv2N3imqvtbfIz305b00hZlsvbcYmQmUzQFSAdOGShK57JJ5aKQKccaUBP25KqB7Q+JaqBRdaMBS54="
|
||||
- secure: "fUDAPAUUaaYZy8I4zU3SJ0JcK7aw4eb6eTdaEr7LyNyTMSfPgwY6P1MrbSQC0lJNQIUQ5ffjdxE5g7D7OYpoJF9L14ni4UY8t2QASt7kmpgcYihmjeuYy8FQXgmFG8CTxiWBPKTybZJ7voQcvIvRaNG7b2wM9PMfc5lRIondB6c="
|
||||
deploy:
|
||||
- provider: releases
|
||||
api_key:
|
||||
@@ -34,21 +47,19 @@ deploy:
|
||||
condition: '"$RELEASE_BUILD" == true'
|
||||
tags: true
|
||||
|
||||
- provider: bintray
|
||||
user: sirknightly
|
||||
key:
|
||||
secure: "CZtvDW/zPf1Nxru21i8Wd+9hgiBRA8VowWBX0gmCOGgRq9WHISttKQQmBWGHuyVZ3rYvtE4Va2bR+2qRN+TFNkUUuOCOQkdBJTCal9nS3G/LprEmsOashG0Q5PTfMMBnlKzKxaxGJW6UhFj2GySmHEAjsFLVpuNWGJeeZgZQ3UE="
|
||||
file: ci/bintray.json
|
||||
- provider: script
|
||||
script: bash ci/travis/ftp_deploy.sh
|
||||
on:
|
||||
condition: '"$NIGHTLY_BUILD" == true'
|
||||
tags: true
|
||||
env:
|
||||
global:
|
||||
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
||||
# via the "travis encrypt" command using the project repo's public key
|
||||
# also note that fork's don't get access to secure keys
|
||||
# you have to test using a branch in the main repo
|
||||
- secure: "C3wF967ZeliwwP1vC12EMIBOaC568n26Z/cPnwzn317ve59DWH3YSfPZVgvt08GzmaXITGGsJvPB+qxfGoKvQzYE4O1B73q81RpUe5pB3IhF+ThQ91VfQZIRJR5xEGJaLINUlHTTZGX5jxlkVO9wAcauVj/s3b8sQ3dvUZauPvk="
|
||||
|
||||
- provider: script
|
||||
skip_cleanup: true
|
||||
script: bash ci/travis/ftp_deploy.sh
|
||||
on:
|
||||
condition: $TEST_BUILD = true
|
||||
all_branches: true
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# note that gcc Debug MUST be 1st for Coverity
|
||||
@@ -111,5 +122,3 @@ before_script:
|
||||
- "./ci/travis/before_script.sh"
|
||||
script:
|
||||
- if [ "$BUILD_DEPLOYMENT" = true ] ; then ./ci/travis/release.sh ; else ./ci/travis/script.sh ; fi
|
||||
before_deploy:
|
||||
- "./ci/travis/before_deploy.sh"
|
||||
+32
-10
@@ -25,15 +25,37 @@ deploy:
|
||||
on:
|
||||
ReleaseBuild: true # deploy on release push only
|
||||
|
||||
- provider: BinTray
|
||||
username: sirknightly
|
||||
api_key:
|
||||
secure: pYWqfiZhIWvFYdjVWPXNaHobmnkXIWa4+LwoiyMTEiu4Z0CiCAW0ZrMfTKVkORKz
|
||||
subject: scp-fs2open
|
||||
repo: FSO
|
||||
package: nightly
|
||||
version: $(VersionName)
|
||||
publish: true
|
||||
override: true
|
||||
- provider: FTP
|
||||
protocol: sftp
|
||||
host: scp.indiegames.us
|
||||
username:
|
||||
secure: SFivQZfatqWHXK1ijYK3GQ==
|
||||
password:
|
||||
secure: q6Zk/412o1ri+NEya1dl1Q==
|
||||
folder: public_html/builds/nightly/$(VersionName)
|
||||
on:
|
||||
NightlyBuild: true # deploy on nightly push only
|
||||
|
||||
- provider: FTP
|
||||
protocol: ftp
|
||||
host: swc.fs2downloads.com
|
||||
username:
|
||||
secure: EXg2ADoKzMduZF90ip2Q0g==
|
||||
password:
|
||||
secure: x0LL0uY9yBAQ7JTARhQ6AA==
|
||||
folder: swc.fs2downloads.com/builds/nightly/$(VersionName)
|
||||
beta: true
|
||||
on:
|
||||
NightlyBuild: true # deploy on nightly push only
|
||||
|
||||
- provider: FTP
|
||||
protocol: ftp
|
||||
host: swc.fs2downloads.com
|
||||
username:
|
||||
secure: EXg2ADoKzMduZF90ip2Q0g==
|
||||
password:
|
||||
secure: x0LL0uY9yBAQ7JTARhQ6AA==
|
||||
folder: swc.fs2downloads.com/builds/test/$(VersionName)
|
||||
beta: true
|
||||
on:
|
||||
TestBuild: true # deploy on test build push only
|
||||
+34
-5
@@ -4,6 +4,7 @@ class BuildConfig {
|
||||
[string]$PackageType
|
||||
[string]$Toolset
|
||||
[string]$SimdType
|
||||
[Bool]$SourcePackage
|
||||
}
|
||||
|
||||
$NightlyConfigurations = @(
|
||||
@@ -12,12 +13,14 @@ $NightlyConfigurations = @(
|
||||
PackageType="Win64";
|
||||
Toolset="v140_xp";
|
||||
SimdType="SSE2";
|
||||
SourcePackage=$false;
|
||||
},
|
||||
[BuildConfig]@{
|
||||
Generator="Visual Studio 14 2015";
|
||||
PackageType="Win32";
|
||||
Toolset="v140_xp";
|
||||
SimdType="SSE2";
|
||||
SourcePackage=$false;
|
||||
}
|
||||
)
|
||||
$ReleaseConfigurations = @(
|
||||
@@ -26,24 +29,28 @@ $ReleaseConfigurations = @(
|
||||
PackageType="Win32";
|
||||
Toolset="v140_xp";
|
||||
SimdType="SSE2";
|
||||
SourcePackage=$true;
|
||||
}
|
||||
[BuildConfig]@{
|
||||
Generator="Visual Studio 14 2015";
|
||||
PackageType="Win32-AVX";
|
||||
Toolset="v140_xp";
|
||||
SimdType="AVX";
|
||||
SourcePackage=$false;
|
||||
}
|
||||
[BuildConfig]@{
|
||||
Generator="Visual Studio 14 2015 Win64";
|
||||
PackageType="Win64";
|
||||
Toolset="v140_xp";
|
||||
SimdType="SSE2";
|
||||
SourcePackage=$false;
|
||||
}
|
||||
[BuildConfig]@{
|
||||
Generator="Visual Studio 14 2015 Win64";
|
||||
PackageType="Win64-AVX";
|
||||
Toolset="v140_xp";
|
||||
SimdType="AVX";
|
||||
SourcePackage=$false;
|
||||
}
|
||||
)
|
||||
|
||||
@@ -52,16 +59,21 @@ $BuildConfigurations = $null
|
||||
# Default values
|
||||
$ReleaseBuild = $false
|
||||
$NightlyBuild = $false
|
||||
$DeployBuild = $false
|
||||
$TestBuild = $false
|
||||
|
||||
if ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^release_(.*)")) {
|
||||
# Set to true to test either the release or the nightly part of this script
|
||||
$ReleaseTest = $false
|
||||
$NightlyTest = $false
|
||||
$TestBuildTest = $false
|
||||
|
||||
if ($ReleaseTest -Or ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^release_(.*)"))) {
|
||||
# Tag matches
|
||||
$ReleaseBuild = $true
|
||||
$PackageName = "fs2_open_$($matches[1])"
|
||||
$BuildConfigurations = $ReleaseConfigurations
|
||||
}
|
||||
|
||||
if ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^nightly_(.*)")) {
|
||||
if ($NightlyTest -Or ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^nightly_(.*)"))) {
|
||||
# Tag matches
|
||||
$NightlyBuild = $true
|
||||
$PackageName = "nightly_$($matches[1])"
|
||||
@@ -69,19 +81,31 @@ if ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REP
|
||||
$BuildConfigurations = $NightlyConfigurations
|
||||
}
|
||||
|
||||
if ($TestBuildTest -Or ([System.Convert]::ToInt32($env:APPVEYOR_PULL_REQUEST_NUMBER) -le 0 -And ("$env:APPVEYOR_REPO_BRANCH" -match "^test\/(.*)"))) {
|
||||
# Tag matches
|
||||
$TestBuild = $true
|
||||
$PackageName = "test_$($matches[1])"
|
||||
Set-AppveyorBuildVariable 'VersionName' "$($matches[1])"
|
||||
$BuildConfigurations = $NightlyConfigurations
|
||||
|
||||
# Override the revision string so that the builds are named correctly
|
||||
[System.IO.File]::WriteAllLines("$env:APPVEYOR_BUILD_FOLDER/version_override.cmake", "set(FSO_VERSION_REVISION_STR $env:VersionName)")
|
||||
}
|
||||
|
||||
# Multiply by 2 so that we can add 0 or 1 for debug or release Configs
|
||||
$buildID = [convert]::ToInt32($env:BuildID) * 2
|
||||
if ($Env:Configuration -eq "Release") {
|
||||
$buildID = $buildID + 1
|
||||
}
|
||||
Write-Host "$buildID"
|
||||
|
||||
if ($ReleaseBuild -Or $NightlyBuild) {
|
||||
$DeployBuild = $false
|
||||
if ($ReleaseBuild -Or $NightlyBuild -Or $TestBuild) {
|
||||
$DeployBuild = $true
|
||||
}
|
||||
|
||||
Set-AppveyorBuildVariable 'ReleaseBuild' "$ReleaseBuild"
|
||||
Set-AppveyorBuildVariable 'NightlyBuild' "$NightlyBuild"
|
||||
Set-AppveyorBuildVariable 'TestBuild' "$TestBuild"
|
||||
|
||||
New-Item build -type directory
|
||||
Set-Location -Path build
|
||||
@@ -94,6 +118,11 @@ if ($DeployBuild) {
|
||||
}
|
||||
|
||||
$buildConfig = $BuildConfigurations[$buildID]
|
||||
|
||||
if ($buildConfig.SourcePackage -eq $True) {
|
||||
7z a -xr'!.git' "$($PackageName)-source-Win.zip" "$env:APPVEYOR_BUILD_FOLDER"
|
||||
Push-AppveyorArtifact "$($PackageName)-source-Win.zip"
|
||||
}
|
||||
|
||||
cmake -DCMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER/../install" -DFSO_USE_SPEECH="ON" `
|
||||
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$($buildConfig.SimdType)" `
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
if ([System.Convert]::ToBoolean($env:ReleaseBuild) -Or [System.Convert]::ToBoolean($env:NightlyBuild)) {
|
||||
if ([System.Convert]::ToBoolean($env:ReleaseBuild) -Or [System.Convert]::ToBoolean($env:NightlyBuild) -Or [System.Convert]::ToBoolean($env:TestBuild)) {
|
||||
# Skip tests for deployment
|
||||
exit 0
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
RELEASE_BUILD=false
|
||||
NIGHTLY_BUILD=false
|
||||
TEST_BUILD=false
|
||||
|
||||
BUILD_DEPLOYMENT=false
|
||||
BUILD_CONFIGS="Release FastDebug"
|
||||
VERSION_NAME=""
|
||||
@@ -9,10 +11,12 @@ PACKAGE_NAME=""
|
||||
|
||||
RELEASE_PATTERN="^release_(.*)$"
|
||||
NIGHTLY_PATTERN="^nightly_(.*)$"
|
||||
TEST_BUILD_PATTERN="^test\/(.*)$"
|
||||
|
||||
# These are for testing
|
||||
NIGHTLY_TEST=false
|
||||
RELEASE_TEST=false
|
||||
TEST_BUILD_TEST=false
|
||||
|
||||
if [ "$RELEASE_TEST" = true ] || [[ "$TRAVIS_TAG" =~ $RELEASE_PATTERN ]]; then
|
||||
echo "This is a release tag!";
|
||||
@@ -25,8 +29,22 @@ if [ "$NIGHTLY_TEST" = true ] || [[ "$TRAVIS_TAG" =~ $NIGHTLY_PATTERN ]]; then
|
||||
VERSION_NAME="${BASH_REMATCH[1]}";
|
||||
PACKAGE_NAME="nightly_${BASH_REMATCH[1]}";
|
||||
fi
|
||||
if [ "$TEST_BUILD_TEST" = true ] || [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" =~ $TEST_BUILD_PATTERN ]]; then
|
||||
echo "This is a test build branch!";
|
||||
TEST_BUILD=true;
|
||||
if [ "$TEST_BUILD_TEST" = true ]; then
|
||||
VERSION_NAME="test";
|
||||
PACKAGE_NAME="test_test";
|
||||
else
|
||||
VERSION_NAME="${BASH_REMATCH[1]}";
|
||||
PACKAGE_NAME="test_${BASH_REMATCH[1]}";
|
||||
fi
|
||||
|
||||
if ([ "$RELEASE_BUILD" = true ] || [ "$NIGHTLY_BUILD" = true ]); then
|
||||
# Override the revision string so that the builds are named correctly
|
||||
echo "set(FSO_VERSION_REVISION_STR $VERSION_NAME)" > "$TRAVIS_BUILD_DIR/version_override.cmake"
|
||||
fi
|
||||
|
||||
if ([ "$RELEASE_BUILD" = true ] || [ "$NIGHTLY_BUILD" = true ] || [ "$TEST_BUILD" = true ]); then
|
||||
BUILD_DEPLOYMENT=true;
|
||||
fi
|
||||
|
||||
@@ -44,6 +62,7 @@ fi
|
||||
|
||||
export RELEASE_BUILD
|
||||
export NIGHTLY_BUILD
|
||||
export TEST_BUILD
|
||||
export BUILD_DEPLOYMENT
|
||||
export BUILD_CONFIGS
|
||||
export VERSION_NAME
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if [[ ! "$(curl -V)" == *"sftp"* ]]; then
|
||||
# Before
|
||||
echo "Before:"
|
||||
curl -V
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
|
||||
# Since the Travis CI people are not capable of enabling SSH/SCP support for their libcurl we need to build that manually...
|
||||
# These commands are based on the tutorial from here: http://zeroset.mnim.org/2013/03/14/sftp-support-for-curl-in-ubuntu-12-10-quantal-quetzal-and-later/
|
||||
mkdir /tmp/curl
|
||||
cd /tmp/curl
|
||||
sudo apt-get update
|
||||
sudo apt-get install build-essential debhelper libssh2-1-dev libgnutls-dev libidn11-dev libkrb5-dev libldap2-dev libnss3-dev librtmp-dev libtool openssh-server quilt
|
||||
apt-get source curl
|
||||
sudo apt-get build-dep curl
|
||||
|
||||
cd curl-*
|
||||
export DEB_BUILD_OPTIONS="nocheck"
|
||||
sudo dpkg-buildpackage -uc -us -j"$(grep -c ^processor /proc/cpuinfo)"
|
||||
|
||||
cd ..
|
||||
dpkg -l | grep curl
|
||||
ls -al
|
||||
sudo dpkg -i curl*.deb
|
||||
sudo dpkg -i libcurl3*.deb
|
||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
brew install curl --with-libssh2
|
||||
export PATH="/usr/local/opt/curl/bin:$PATH"
|
||||
fi
|
||||
|
||||
# After
|
||||
echo "After:"
|
||||
curl -V
|
||||
fi
|
||||
|
||||
cd /tmp/builds
|
||||
|
||||
for file in *; do
|
||||
if [ "$TEST_BUILD" = true ]; then
|
||||
# Upload to fs2downloads
|
||||
curl -k "ftp://swc.fs2downloads.com/swc.fs2downloads.com/builds/test/$VERSION_NAME/" --user "$FS2DOWNLOADS_USER:$FS2DOWNLOADS_PASSWORD" -T "$file" --ftp-create-dirs
|
||||
else
|
||||
# Upload to indiegames
|
||||
curl -k "sftp://scp.indiegames.us/~/public_html/builds/nightly/$VERSION_NAME/" --user "$INDIEGAMES_USER:$INDIEGAMES_PASSWORD" -T "$file" --ftp-create-dirs
|
||||
|
||||
# Upload to fs2downloads
|
||||
curl -k "ftp://swc.fs2downloads.com/swc.fs2downloads.com/builds/nightly/$VERSION_NAME/" --user "$FS2DOWNLOADS_USER:$FS2DOWNLOADS_PASSWORD" -T "$file" --ftp-create-dirs
|
||||
fi
|
||||
done
|
||||
@@ -4,6 +4,11 @@ set -ex
|
||||
mkdir -p /tmp/builds
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
if [ "$RELEASE_BUILD" = true ]; then
|
||||
PARENT_DIR="$(basename $PWD)"
|
||||
(cd .. && tar cvf /tmp/builds/$PACKAGE_NAME-source-Unix.tar.gz --exclude-vcs "$PARENT_DIR")
|
||||
fi
|
||||
|
||||
cd build
|
||||
for config in $BUILD_CONFIGS
|
||||
do
|
||||
|
||||
@@ -1,2 +1,18 @@
|
||||
|
||||
target_compile_definitions(platform INTERFACE SCP_SOLARIS)
|
||||
|
||||
find_library(SOCKET_LIB socket)
|
||||
|
||||
if (NOT SOCKET_LIB)
|
||||
message(FATAL_ERROR "Couldn't find libsocket! Please install it and rerun the configuration.")
|
||||
else()
|
||||
target_link_libraries(platform INTERFACE "${SOCKET_LIB}")
|
||||
endif()
|
||||
|
||||
find_library(NSL_LIB nsl)
|
||||
|
||||
if (NOT NSL_LIB)
|
||||
message(FATAL_ERROR "Couldn't find libnsl! Please install it and rerun the configuration.")
|
||||
else()
|
||||
target_link_libraries(platform INTERFACE "${NSL_LIB}")
|
||||
endif()
|
||||
@@ -7,6 +7,7 @@ include(CheckLibraryExists)
|
||||
include(CheckPrototypeDefinition)
|
||||
include(CheckStructHasMember)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckCXXSymbolExists)
|
||||
include(CheckTypeSize)
|
||||
|
||||
CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
|
||||
@@ -14,10 +15,19 @@ CHECK_INCLUDE_FILE_CXX("cxxabi.h" HAVE_CXXAPI_H)
|
||||
|
||||
CHECK_TYPE_SIZE("max_align_t" MAX_ALIGN_T)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_REQUIRED_FLAGS "-std=c++11") # required for g++ <= 5
|
||||
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "cstddef")
|
||||
CHECK_TYPE_SIZE("std::max_align_t" STD_MAX_ALIGN_T LANGUAGE CXX)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "type_traits")
|
||||
CHECK_TYPE_SIZE("std::is_trivially_copyable<int>" STD_IS_TRIVIALLY_COPYABLE LANGUAGE CXX)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS)
|
||||
|
||||
|
||||
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
|
||||
CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#cmakedefine HAVE_MAX_ALIGN_T
|
||||
#cmakedefine HAVE_STD_MAX_ALIGN_T
|
||||
|
||||
#cmakedefine HAVE_STD_IS_TRIVIALLY_COPYABLE
|
||||
|
||||
#cmakedefine01 IS_64BIT
|
||||
|
||||
#cmakedefine01 HAVE_STRCASECMP
|
||||
|
||||
@@ -20,7 +20,7 @@ ENDIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# Copy release settings to FastDebug
|
||||
set(CMAKE_C_FLAGS_FASTDEBUG "${CMAKE_C_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_FASTDEBUG "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_FASTDEBUG "${CMAKE_EXE_LINKER_RELEASE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_FASTDEBUG "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||
set(CMAKE_STATIC_LINKER_FLAGS_FASTDEBUG "${CMAKE_STATIC_LINKER_FLAGS_RELEASE}")
|
||||
|
||||
if (MSVC)
|
||||
|
||||
+3
-3
@@ -3814,7 +3814,7 @@ float ai_path_0()
|
||||
int path_num;
|
||||
Assert(aip->active_goal >= 0);
|
||||
ai_goal *aigp = &aip->goals[aip->active_goal];
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] || aigp->flags[AI::Goal_Flags::Docker_index_valid]);
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
|
||||
|
||||
path_num = ai_return_path_num_from_dockbay(&Objects[aip->goal_objnum], aigp->dockee.index);
|
||||
ai_find_path(Pl_objp, aip->goal_objnum, path_num, 0);
|
||||
@@ -3957,7 +3957,7 @@ float ai_path_1()
|
||||
int path_num;
|
||||
Assert(aip->active_goal >= 0);
|
||||
ai_goal *aigp = &aip->goals[aip->active_goal];
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] || aigp->flags[AI::Goal_Flags::Docker_index_valid]);
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
|
||||
|
||||
path_num = ai_return_path_num_from_dockbay(&Objects[aip->goal_objnum], aigp->dockee.index);
|
||||
ai_find_path(Pl_objp, aip->goal_objnum, path_num, 0);
|
||||
@@ -10399,7 +10399,7 @@ void ai_get_dock_goal_indexes(object *objp, ai_info *aip, ai_goal *aigp, object
|
||||
{
|
||||
// get them from the active goal
|
||||
Assert(aigp != NULL);
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] || aigp->flags[AI::Goal_Flags::Docker_index_valid]);
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
|
||||
docker_index = aigp->docker.index;
|
||||
dockee_index = aigp->dockee.index;
|
||||
Assert(docker_index >= 0);
|
||||
|
||||
+1
-1
@@ -1640,7 +1640,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
}
|
||||
else
|
||||
{
|
||||
Int3(); // get ALLENDER
|
||||
mprintf(("Potentially incorrect behaviour in AI goal for ship %s: Ship %s could not be found among currently active, departed, or yet-to-arrive ships.\nPlease check the mission file.\n", Ships[objp->instance].ship_name, aigp->target_name));
|
||||
status = SHIP_STATUS_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-1
@@ -733,6 +733,10 @@ anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
|
||||
|
||||
anim_read_header(ptr, fp);
|
||||
|
||||
if (ptr->width < 0 || ptr->height < 0) {
|
||||
Error(LOCATION, "Ani file %s has a faulty header and cannot be loaded.", name);
|
||||
}
|
||||
|
||||
if(ptr->num_keys > 0){
|
||||
ptr->keys = (key_frame*)vm_malloc(sizeof(key_frame) * ptr->num_keys);
|
||||
Assert(ptr->keys != NULL);
|
||||
@@ -761,7 +765,7 @@ anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
|
||||
}
|
||||
|
||||
// couldn't memory-map file... must be in a packfile, so stream manually
|
||||
if ( file_mapped && !ptr->cfile_ptr ) {
|
||||
if ( file_mapped == PAGE_FROM_MEM && !ptr->cfile_ptr ) {
|
||||
ptr->flags &= ~ANF_MEM_MAPPED;
|
||||
ptr->flags |= ANF_STREAMED;
|
||||
ptr->cfile_ptr = cfopen(name, "rb", CFILE_NORMAL, cf_dir_type);
|
||||
@@ -969,6 +973,11 @@ void anim_display_info(char *real_filename)
|
||||
}
|
||||
|
||||
anim_read_header(&A, fp);
|
||||
|
||||
if (A.width < 0 || A.height < 0) {
|
||||
Error(LOCATION, "Ani file %s has a faulty header and cannot be loaded.", filename);
|
||||
}
|
||||
|
||||
// read the keyframe frame nums and offsets
|
||||
key_frame_nums = (int*)vm_malloc(sizeof(int)*A.num_keys);
|
||||
Assert(key_frame_nums != NULL);
|
||||
|
||||
@@ -40,9 +40,8 @@ typedef struct {
|
||||
|
||||
enum
|
||||
{
|
||||
PAGE_FROM_MEM = 0,
|
||||
PAGE_FROM_DISK = 1,
|
||||
PAGE_FROM_DISK_FORCED = 2
|
||||
PAGE_FROM_DISK = 0,
|
||||
PAGE_FROM_MEM = 1
|
||||
};
|
||||
|
||||
extern int Anim_paused;
|
||||
@@ -59,7 +58,7 @@ int anim_stop_playing(anim_instance* anim_instance);
|
||||
int anim_show_next_frame(anim_instance *instance, float frametime);
|
||||
void anim_release_all_instances(int screen_id = 0);
|
||||
void anim_release_render_instance(anim_instance* instance);
|
||||
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_MEM);
|
||||
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_DISK);
|
||||
int anim_free(anim *ptr);
|
||||
int anim_playing(anim_instance *ai);
|
||||
int anim_write_frames_out(char *filename);
|
||||
|
||||
@@ -1568,8 +1568,12 @@ void asteroid_maybe_break_up(object *pasteroid_obj)
|
||||
vec3d tempv = dir_vec;
|
||||
vm_vec_random_cone(&dir_vec, &tempv, (360.0f / total_roids / 2));
|
||||
|
||||
// Make the roid inherit half of the parent's velocity
|
||||
vm_vec_copy_normalize(&parent_vel, &pasteroid_obj->phys_info.vel);
|
||||
// Make the roid inherit half of parent's directional movement
|
||||
if (!IS_VEC_NULL(&pasteroid_obj->phys_info.vel)) {
|
||||
vm_vec_copy_normalize(&parent_vel, &pasteroid_obj->phys_info.vel);
|
||||
} else {
|
||||
vm_vec_rand_vec_quick(&parent_vel);
|
||||
}
|
||||
vm_vec_scale(&parent_vel, 0.5f);
|
||||
|
||||
// Make the hit position affect the direction, but only a little
|
||||
|
||||
@@ -1619,6 +1619,10 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
#endif
|
||||
anim_read_header(&the_anim, img_cfp);
|
||||
|
||||
if (the_anim.width < 0 || the_anim.height < 0) {
|
||||
Error(LOCATION, "Ani file %s has a faulty header and cannot be loaded.", real_filename);
|
||||
}
|
||||
|
||||
anim_frames = the_anim.total_frames;
|
||||
anim_fps = the_anim.fps;
|
||||
if (anim_fps == 0) {
|
||||
|
||||
+20
-20
@@ -987,32 +987,32 @@ void os_init_cmdline(int argc, char *argv[])
|
||||
delete[] buf;
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// parse user specific cmdline_fso config file (will supersede options in global file)
|
||||
fp = fopen(os_get_config_path("data/cmdline_fso.cfg").c_str(), "rt");
|
||||
|
||||
// parse user specific cmdline_fso config file (will supersede options in global file)
|
||||
fp = fopen(os_get_config_path("data/cmdline_fso.cfg").c_str(), "rt");
|
||||
// if the file exists, get a single line, and deal with it
|
||||
if ( fp ) {
|
||||
char *buf, *p;
|
||||
|
||||
// if the file exists, get a single line, and deal with it
|
||||
if ( fp ) {
|
||||
char *buf, *p;
|
||||
auto len = static_cast<int>(filelength( fileno(fp) )) + 2;
|
||||
buf = new char [len];
|
||||
|
||||
auto len = static_cast<int>(filelength( fileno(fp) )) + 2;
|
||||
buf = new char [len];
|
||||
if (fgets(buf, len-1, fp) != nullptr)
|
||||
{
|
||||
// replace the newline character with a NULL
|
||||
if ( (p = strrchr(buf, '\n')) != NULL ) {
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
if (fgets(buf, len-1, fp) != nullptr)
|
||||
{
|
||||
// replace the newline character with a NULL
|
||||
if ( (p = strrchr(buf, '\n')) != NULL ) {
|
||||
*p = '\0';
|
||||
// append a space for the os_parse_parms() check
|
||||
strcat_s(buf, len, " ");
|
||||
|
||||
os_process_cmdline(buf);
|
||||
}
|
||||
|
||||
// append a space for the os_parse_parms() check
|
||||
strcat_s(buf, len, " ");
|
||||
|
||||
os_process_cmdline(buf);
|
||||
delete [] buf;
|
||||
fclose(fp);
|
||||
}
|
||||
delete [] buf;
|
||||
fclose(fp);
|
||||
}
|
||||
} // If cmdline included PARSE_COMMAND_LINE_STRING
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ void main()
|
||||
// Normal map - convert from DXT5nm
|
||||
vec2 normalSample;
|
||||
normal.rg = normalSample = (texture(sNormalmap, texCoord).ag * 2.0) - 1.0;
|
||||
normal.b = sqrt(1.0 - dot(normal.rg, normal.rg));
|
||||
normal.b = clamp(sqrt(1.0 - dot(normal.rg, normal.rg)), 0.0001, 1.0);
|
||||
normal = fragTangentMatrix * normal;
|
||||
float norm = length(normal);
|
||||
// prevent breaking of normal maps
|
||||
|
||||
@@ -123,8 +123,8 @@ class flagset {
|
||||
bool any_set() { return values.any(); }
|
||||
bool none_set() { return values.none(); }
|
||||
|
||||
void from_long(std::uint64_t num) { values = num; }
|
||||
std::uint64_t to_long() const { return values.to_ulong(); }
|
||||
void from_u64(std::uint64_t num) { values = (unsigned long) num; }
|
||||
std::uint64_t to_u64() const { return (std::uint64_t) values.to_ulong(); }
|
||||
};
|
||||
|
||||
#define FLAG_LIST(Type) enum class Type : size_t
|
||||
|
||||
@@ -318,6 +318,7 @@ const size_t INVALID_SIZE = static_cast<size_t>(-1);
|
||||
|
||||
#ifdef SCP_SOLARIS // Solaris
|
||||
#define INTEL_INT(x) x
|
||||
#define INTEL_LONG(x) x
|
||||
#define INTEL_SHORT(x) x
|
||||
#define INTEL_FLOAT(x) (*x)
|
||||
#elif BYTE_ORDER == BIG_ENDIAN
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/version.h"
|
||||
|
||||
namespace version
|
||||
namespace gameversion
|
||||
{
|
||||
bool check_at_least(int major, int minor, int build, int revision)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "project.h"
|
||||
|
||||
namespace version
|
||||
namespace gameversion
|
||||
{
|
||||
/**
|
||||
* @brief Checks if the current version is at least the given version
|
||||
|
||||
@@ -226,6 +226,7 @@ int generic_anim_stream(generic_anim *ga, const bool cache)
|
||||
mprintf(("Failed to load apng: %s\n", e.what() ));
|
||||
delete ga->png.anim;
|
||||
ga->png.anim = nullptr;
|
||||
ga->type = BM_TYPE_NONE;
|
||||
return -1;
|
||||
}
|
||||
nprintf(("apng", "apng read OK (%ix%i@%i) duration (%f)\n", ga->png.anim->w, ga->png.anim->h,
|
||||
@@ -322,8 +323,8 @@ void generic_anim_unload(generic_anim *ga)
|
||||
if(ga->num_frames > 0) {
|
||||
if(ga->streaming) {
|
||||
if(ga->type == BM_TYPE_ANI) {
|
||||
anim_free(ga->ani.animation);
|
||||
free_anim_instance(ga->ani.instance);
|
||||
anim_free(ga->ani.animation);
|
||||
}
|
||||
if(ga->type == BM_TYPE_EFF) {
|
||||
if(ga->eff.next_frame >= 0)
|
||||
|
||||
@@ -553,7 +553,7 @@ void gr_opengl_string_old(float sx, float sy, const char* s, const char* end, fo
|
||||
break;
|
||||
}
|
||||
|
||||
letter = font::get_char_width_old(fontData, s[0], s[1], &width, &spacing);
|
||||
letter = font::get_char_width_old(fontData, (ubyte)s[0], (ubyte)s[1], &width, &spacing);
|
||||
s++;
|
||||
|
||||
// not in font, draw as space
|
||||
@@ -781,8 +781,14 @@ void gr_opengl_string(float sx, float sy, const char *s, int resize_mode, int in
|
||||
|
||||
if (specialChar) {
|
||||
if (pass == 1) {
|
||||
// We compute the top offset of the special character by aligning it to the base line of the string
|
||||
// This is done by moving to the base line of the string by adding the ascender value and then
|
||||
// accounting for the height of the text with the height of the special font
|
||||
auto yOffset = nvgFont->getTopOffset() +
|
||||
(nvgFont->getAscender() - nvgFont->getSpecialCharacterFont()->h);
|
||||
|
||||
gr_opengl_string_old(sx + x * scaleX,
|
||||
sy + (y + nvgFont->getTopOffset()) * scaleY,
|
||||
sy + (y + yOffset) * scaleY,
|
||||
text,
|
||||
text + 1,
|
||||
nvgFont->getSpecialCharacterFont(),
|
||||
@@ -793,24 +799,21 @@ void gr_opengl_string(float sx, float sy, const char *s, int resize_mode, int in
|
||||
|
||||
int width;
|
||||
int spacing;
|
||||
get_char_width_old(nvgFont->getSpecialCharacterFont(), *text, '\0', &width, &spacing);
|
||||
get_char_width_old(nvgFont->getSpecialCharacterFont(), (ubyte)*text, (ubyte)*(text + 1), &width, &spacing);
|
||||
|
||||
x += spacing;
|
||||
x += i2fl(spacing) * invscaleX;
|
||||
}
|
||||
else if (doRender) {
|
||||
if (doRender && tokenLength > 0) {
|
||||
float advance;
|
||||
float currentX = x;
|
||||
float currentX = x * scaleX;
|
||||
float currentY = y + nvgFont->getTopOffset();
|
||||
|
||||
if (pass == 0) {
|
||||
advance = path->text(currentX, currentY, text, text + tokenLength) - currentX;
|
||||
}
|
||||
else {
|
||||
advance =
|
||||
path->textBounds(currentX, currentY, text, text + tokenLength, nullptr) - currentX;
|
||||
path->text(currentX, currentY, text, text + tokenLength);
|
||||
}
|
||||
|
||||
advance = path->textBounds(0.f, 0.f, text, text + tokenLength, nullptr);
|
||||
x += advance * invscaleX;
|
||||
}
|
||||
}
|
||||
@@ -2198,8 +2201,8 @@ void gr_opengl_deferred_lighting_finish()
|
||||
}
|
||||
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, Scene_color_texture, 0);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, Scene_depth_texture, 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
|
||||
|
||||
gr_end_view_matrix();
|
||||
gr_end_proj_matrix();
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace font
|
||||
|
||||
float FSFont::getHeight() const
|
||||
{
|
||||
return this->getTextHeight() + this->offsetTop + this->offsetBottom;
|
||||
return _height;
|
||||
}
|
||||
|
||||
const SCP_string &FSFont::getName() const
|
||||
@@ -45,13 +45,26 @@ namespace font
|
||||
return this->name;
|
||||
}
|
||||
|
||||
void FSFont::checkHeight() {
|
||||
float height = this->getTextHeight() + this->offsetTop + this->offsetBottom;
|
||||
void FSFont::computeFontMetrics() {
|
||||
_height = this->getTextHeight() + this->offsetTop + this->offsetBottom;
|
||||
|
||||
if (height <= 1.0f)
|
||||
// By default the base line of the font is also the lowest point of the font
|
||||
_ascender = _height;
|
||||
_descender = 0.0f;
|
||||
|
||||
checkFontMetrics();
|
||||
}
|
||||
void FSFont::checkFontMetrics() {
|
||||
if (_height <= 1.0f)
|
||||
{
|
||||
Warning(LOCATION, "The height of font %s has an invalid height of %f, must be greater than one!",
|
||||
getName().c_str(), height);
|
||||
getName().c_str(), _height);
|
||||
}
|
||||
}
|
||||
float FSFont::getAscender() {
|
||||
return _ascender;
|
||||
}
|
||||
float FSFont::getDescender() {
|
||||
return _descender;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,12 @@ namespace font
|
||||
float offsetTop; //!< The offset at the top of a line of text
|
||||
float offsetBottom; //!< The offset at the bottom of a line of text
|
||||
|
||||
float _height;
|
||||
float _ascender;
|
||||
float _descender;
|
||||
|
||||
void checkFontMetrics();
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@@ -92,7 +98,7 @@ namespace font
|
||||
*
|
||||
* @return The height.
|
||||
*/
|
||||
virtual float getHeight() const;
|
||||
float getHeight() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the height of this font in pixels without the top and bottom offsets.
|
||||
@@ -155,6 +161,21 @@ namespace font
|
||||
*/
|
||||
void setBottomOffset(float newOffset);
|
||||
|
||||
void checkHeight();
|
||||
/**
|
||||
* @brief Recomputes the font metrics
|
||||
*/
|
||||
virtual void computeFontMetrics();
|
||||
|
||||
/**
|
||||
* @brief Gets the ascender value of this font
|
||||
* @return The ascender value
|
||||
*/
|
||||
float getAscender();
|
||||
|
||||
/**
|
||||
* @breif Gets the descender value of this font
|
||||
* @return The descender value
|
||||
*/
|
||||
float getDescender();
|
||||
};
|
||||
}
|
||||
@@ -108,21 +108,7 @@ namespace font
|
||||
|
||||
float NVGFont::getTextHeight() const
|
||||
{
|
||||
auto path = graphics::paths::PathRenderer::instance();
|
||||
|
||||
path->saveState();
|
||||
path->resetState();
|
||||
|
||||
path->fontFaceId(m_handle);
|
||||
path->fontSize(m_size);
|
||||
path->textLetterSpacing(m_letterSpacing);
|
||||
|
||||
float lineh;
|
||||
path->textMetrics(nullptr, nullptr, &lineh);
|
||||
|
||||
path->restoreState();
|
||||
|
||||
return lineh;
|
||||
return m_lineHeight;
|
||||
}
|
||||
|
||||
extern int get_char_width_old(font* fnt, ubyte c1, ubyte c2, int *width, int* spacing);
|
||||
@@ -189,6 +175,13 @@ namespace font
|
||||
|
||||
int charWidth;
|
||||
int spacing;
|
||||
|
||||
if (m_specialCharacters == nullptr) {
|
||||
Error(LOCATION,
|
||||
"Font %s has no special characters font! This is usually caused by ignoring a font table parsing warning.",
|
||||
getName().c_str());
|
||||
}
|
||||
|
||||
get_char_width_old(m_specialCharacters, static_cast<ubyte>(*s), '\0', &charWidth, &spacing);
|
||||
|
||||
lineWidth += i2fl(spacing);
|
||||
@@ -225,4 +218,22 @@ namespace font
|
||||
|
||||
path->restoreState();
|
||||
}
|
||||
void NVGFont::computeFontMetrics() {
|
||||
auto path = graphics::paths::PathRenderer::instance();
|
||||
|
||||
path->saveState();
|
||||
path->resetState();
|
||||
|
||||
path->fontFaceId(m_handle);
|
||||
path->fontSize(m_size);
|
||||
path->textLetterSpacing(m_letterSpacing);
|
||||
|
||||
path->textMetrics(&_ascender, &_descender, &m_lineHeight);
|
||||
|
||||
path->restoreState();
|
||||
|
||||
_height = m_lineHeight + this->offsetTop + this->offsetBottom;
|
||||
|
||||
checkFontMetrics();
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ namespace font
|
||||
|
||||
font* m_specialCharacters;
|
||||
|
||||
float m_lineHeight = 0.0f;
|
||||
|
||||
public:
|
||||
NVGFont();
|
||||
virtual ~NVGFont();
|
||||
@@ -39,6 +41,8 @@ namespace font
|
||||
virtual void getStringSize(const char *text, size_t textLen, int resize_mode,
|
||||
float *width, float *height) const SCP_OVERRIDE;
|
||||
|
||||
void computeFontMetrics() override;
|
||||
|
||||
static size_t getTokenLength(const char *string, size_t maxLength);
|
||||
};
|
||||
}
|
||||
@@ -188,13 +188,22 @@ namespace
|
||||
else
|
||||
{
|
||||
fo::font* fontData = FontManager::loadFontOld("font01.vf");
|
||||
nvgFont->setSpecialCharacterFont(fontData);
|
||||
|
||||
if (fontData == nullptr) {
|
||||
error_display(0,
|
||||
"Failed to load default font \"%s\" for special characters of font \"%s\"! "
|
||||
"This font is required for rendering special characters and will cause an error later.",
|
||||
"font01.vf",
|
||||
fontFilename.c_str());
|
||||
} else {
|
||||
nvgFont->setSpecialCharacterFont(fontData);
|
||||
}
|
||||
}
|
||||
|
||||
nvgFont->setName(fontStr);
|
||||
|
||||
// Make sure that the height is not invalid
|
||||
nvgFont->checkHeight();
|
||||
nvgFont->computeFontMetrics();
|
||||
}
|
||||
|
||||
void parse_vfnt_font(const SCP_string& fontFilename)
|
||||
@@ -291,7 +300,7 @@ namespace
|
||||
font->setBottomOffset(temp);
|
||||
}
|
||||
// Make sure that the height is not invalid
|
||||
font->checkHeight();
|
||||
font->computeFontMetrics();
|
||||
}
|
||||
|
||||
void font_parse_setup(const char *fileName)
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
#ifdef _WIN64
|
||||
#define TRACKIRBRIDGEDLLNAME "scptrackir64.dll"
|
||||
#else
|
||||
#define TRACKIRBRIDGEDLLNAME "scptrackir.dll"
|
||||
#endif
|
||||
|
||||
#define SCP_INITRESULT_SUCCESS 0
|
||||
#define SCP_INITRESULT_BADKEY 1
|
||||
|
||||
@@ -950,7 +950,6 @@ void HudGaugeWeaponLinking::render(float frametime)
|
||||
|
||||
switch( num_banks ) {
|
||||
case 0:
|
||||
Int3();
|
||||
gauge_index = -1;
|
||||
break;
|
||||
|
||||
|
||||
@@ -590,14 +590,16 @@ void HudGaugeShield::showShields(object *objp, int mode)
|
||||
|
||||
vm_angles_2_matrix(&object_orient, &rot_angles);
|
||||
|
||||
gr_screen.clip_width = 112;
|
||||
gr_screen.clip_height = 93;
|
||||
const int CLIP_WIDTH = 112;
|
||||
const int CLIP_HEIGHT = 93;
|
||||
gr_screen.clip_width = CLIP_WIDTH;
|
||||
gr_screen.clip_height = CLIP_HEIGHT;
|
||||
|
||||
//Fire it up
|
||||
if(g3_yourself)
|
||||
g3_start_frame(1);
|
||||
hud_save_restore_camera_data(1);
|
||||
setClip(sx, sy, 112, 93);
|
||||
setClip(sx, sy, CLIP_WIDTH, CLIP_HEIGHT);
|
||||
|
||||
//if(!digitus_improbus)
|
||||
g3_set_view_matrix( &sip->closeup_pos, &vmd_identity_matrix, sip->closeup_zoom * 2.5f);
|
||||
@@ -707,7 +709,7 @@ void HudGaugeShield::showShields(object *objp, int mode)
|
||||
//Ugh, draw four shield quadrants
|
||||
static const int TRI_EDGE = 6;
|
||||
static const int BAR_LENGTH = 112;
|
||||
static const int BAR_HEIGHT = 54;
|
||||
static const int BAR_HEIGHT = 63;
|
||||
static const int BAR_WIDTH = 6;
|
||||
static const int SHIELD_OFFSET = BAR_WIDTH + TRI_EDGE + 3;
|
||||
|
||||
|
||||
@@ -3289,7 +3289,11 @@ void hud_show_message_sender()
|
||||
targetp = &Objects[Ships[Message_shipnum].objnum];
|
||||
Assert ( targetp != NULL );
|
||||
|
||||
Assert ( targetp->type == OBJ_SHIP );
|
||||
if (targetp->type != OBJ_SHIP) {
|
||||
// if it's not a ship (maybe it got ship-vanished in the middle of talking) then clear Message_shipnum
|
||||
Message_shipnum = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't do this for the ship you're flying!
|
||||
if ( targetp == Player_obj ) {
|
||||
|
||||
+49
-7
@@ -52,6 +52,34 @@ static int joy_ff_has_valid_effects();
|
||||
static int joy_ff_effect_playing(haptic_effect_t *eff);
|
||||
static void joy_ff_start_effect(haptic_effect_t *eff, const char *name);
|
||||
|
||||
static void check_and_print_haptic_feature(uint32_t flags, uint32_t check_flag, const char* description) {
|
||||
auto has_flag = (flags & check_flag) == check_flag;
|
||||
|
||||
mprintf((" Supports %s: %s\n", description, has_flag ? "true" : "false"));
|
||||
}
|
||||
|
||||
static void print_haptic_support() {
|
||||
mprintf((" Haptic feature support:\n"));
|
||||
|
||||
auto supported = SDL_HapticQuery(haptic);
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_CONSTANT, "Constant effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_SINE, "Sine effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_LEFTRIGHT, "Left right effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_TRIANGLE, "Triangle effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_SAWTOOTHUP, "Sawtooth up effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_SAWTOOTHDOWN, "Sawtooth down effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_RAMP, "Ramp effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_SPRING, "Spring effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_DAMPER, "Damper effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_INERTIA, "Inertia effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_FRICTION, "Friction effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_CUSTOM, "Custom effect");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_GAIN, "global gain");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_AUTOCENTER, "Autocenter");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_STATUS, "Status query");
|
||||
check_and_print_haptic_feature(supported, SDL_HAPTIC_PAUSE, "Pause effects");
|
||||
}
|
||||
|
||||
int joy_ff_init()
|
||||
{
|
||||
int ff_enabled = 0;
|
||||
@@ -118,6 +146,7 @@ int joy_ff_init()
|
||||
mprintf((" Number of haptic axes: %d\n", SDL_HapticNumAxes(haptic)));
|
||||
mprintf((" Number of effects supported: %d\n", SDL_HapticNumEffects(haptic)));
|
||||
mprintf((" Number of simultaneous effects: %d\n", SDL_HapticNumEffectsPlaying(haptic)));
|
||||
print_haptic_support();
|
||||
|
||||
mprintf((" ... Haptic successfully initialized!\n"));
|
||||
|
||||
@@ -130,6 +159,11 @@ void joy_ff_shutdown()
|
||||
return;
|
||||
}
|
||||
|
||||
if (pSpring.loaded) {
|
||||
SDL_HapticStopEffect(haptic, pSpring.id);
|
||||
}
|
||||
joy_ff_stop_effects();
|
||||
|
||||
SDL_HapticClose(haptic);
|
||||
haptic = NULL;
|
||||
|
||||
@@ -292,7 +326,7 @@ static int joy_ff_create_effects()
|
||||
pAfterburn1.eff.periodic.direction.dir[0] = 0;
|
||||
pAfterburn1.eff.periodic.length = SDL_HAPTIC_INFINITY;
|
||||
pAfterburn1.eff.periodic.period = 20;
|
||||
pAfterburn1.eff.periodic.magnitude = 0x6665;
|
||||
pAfterburn1.eff.periodic.magnitude = 0x3332;
|
||||
|
||||
pAfterburn1.id = SDL_HapticNewEffect(haptic, &pAfterburn1.eff);
|
||||
|
||||
@@ -310,7 +344,7 @@ static int joy_ff_create_effects()
|
||||
pAfterburn2.eff.periodic.direction.dir[0] = 9000;
|
||||
pAfterburn2.eff.periodic.length = 125;
|
||||
pAfterburn2.eff.periodic.period = 100;
|
||||
pAfterburn2.eff.periodic.magnitude = 0x3332;
|
||||
pAfterburn2.eff.periodic.magnitude = 0x1999;
|
||||
|
||||
pAfterburn2.id = SDL_HapticNewEffect(haptic, &pAfterburn2.eff);
|
||||
|
||||
@@ -416,7 +450,15 @@ void joy_ff_stop_effects()
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_HapticStopAll(haptic);
|
||||
joy_ff_afterburn_off();
|
||||
|
||||
if (pDeathroll1.loaded) {
|
||||
SDL_HapticStopEffect(haptic, pDeathroll1.id);
|
||||
}
|
||||
|
||||
if (pDeathroll2.loaded) {
|
||||
SDL_HapticStopEffect(haptic, pDeathroll2.id);
|
||||
}
|
||||
}
|
||||
|
||||
void joy_ff_mission_init(vec3d v)
|
||||
@@ -632,7 +674,7 @@ void joy_ff_docked()
|
||||
|
||||
SDL_HapticStopEffect(haptic, pDock.id);
|
||||
|
||||
pDock.eff.periodic.magnitude = 0x7fff;
|
||||
pDock.eff.periodic.magnitude = 0x3332;
|
||||
|
||||
if ( SDL_HapticUpdateEffect(haptic, pDock.id, &pDock.eff) < 0 ) {
|
||||
mprintf(("HapticERROR: Unable to update pDock:\n %s\n", SDL_GetError()));
|
||||
@@ -653,7 +695,7 @@ void joy_ff_play_reload_effect()
|
||||
|
||||
SDL_HapticStopEffect(haptic, pDock.id);
|
||||
|
||||
pDock.eff.periodic.magnitude = 0x3fff;
|
||||
pDock.eff.periodic.magnitude = 0x1999;
|
||||
|
||||
if ( SDL_HapticUpdateEffect(haptic, pDock.id, &pDock.eff) < 0 ) {
|
||||
mprintf(("HapticERROR: Unable to update pDock:\n %s\n", SDL_GetError()));
|
||||
@@ -674,7 +716,7 @@ void joy_ff_afterburn_on()
|
||||
SDL_HapticStopEffect(haptic, pAfterburn1.id);
|
||||
|
||||
pAfterburn1.eff.periodic.length = SDL_HAPTIC_INFINITY;
|
||||
pAfterburn1.eff.periodic.magnitude = 0x3fff;
|
||||
pAfterburn1.eff.periodic.magnitude = 0x3332;
|
||||
|
||||
if ( SDL_HapticUpdateEffect(haptic, pAfterburn1.id, &pAfterburn1.eff) < 0 ) {
|
||||
mprintf(("HapticERROR: Unable to update pAfterburn1:\n %s\n", SDL_GetError()));
|
||||
@@ -685,7 +727,7 @@ void joy_ff_afterburn_on()
|
||||
SDL_HapticStopEffect(haptic, pAfterburn2.id);
|
||||
|
||||
pAfterburn2.eff.periodic.length = SDL_HAPTIC_INFINITY;
|
||||
pAfterburn2.eff.periodic.magnitude = 0x3fff;
|
||||
pAfterburn2.eff.periodic.magnitude = 0x1999;
|
||||
|
||||
if ( SDL_HapticUpdateEffect(haptic, pAfterburn2.id, &pAfterburn2.eff) < 0 ) {
|
||||
mprintf(("HapticERROR: Unable to update pAfterburn2:\n %s\n", SDL_GetError()));
|
||||
|
||||
@@ -254,9 +254,6 @@ void light_add_point(const vec3d *pos, float r1, float r2, float intensity, floa
|
||||
Assertion( r1 > 0.0f, "Invalid radius r1 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r1 );
|
||||
Assertion( r2 > 0.0f, "Invalid radius r2 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r2 );
|
||||
|
||||
if (r1 < 0.0001f || r2 < 0.0001f)
|
||||
return;
|
||||
|
||||
if(!specular){
|
||||
spec_r = r;
|
||||
spec_g = g;
|
||||
@@ -298,8 +295,9 @@ void light_add_point(const vec3d *pos, float r1, float r2, float intensity, floa
|
||||
|
||||
void light_add_point_unique(const vec3d *pos, float r1, float r2, float intensity, float r, float g, float b, int affected_objnum, float spec_r, float spec_g, float spec_b, bool specular)
|
||||
{
|
||||
Assert(r1 >0);
|
||||
Assert(r2 >0);
|
||||
Assertion(r1 > 0.0f, "Invalid radius r1 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r1);
|
||||
Assertion(r2 > 0.0f, "Invalid radius r2 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r2);
|
||||
|
||||
if(!specular){
|
||||
spec_r = r;
|
||||
spec_g = g;
|
||||
@@ -341,8 +339,9 @@ void light_add_point_unique(const vec3d *pos, float r1, float r2, float intensit
|
||||
// beams affect every ship except the firing ship
|
||||
void light_add_tube(const vec3d *p0, const vec3d *p1, float r1, float r2, float intensity, float r, float g, float b, int affected_objnum, float spec_r, float spec_g, float spec_b, bool specular)
|
||||
{
|
||||
Assert(r1 >0);
|
||||
Assert(r2 >0);
|
||||
Assertion(r1 > 0.0f, "Invalid radius r1 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r1);
|
||||
Assertion(r2 > 0.0f, "Invalid radius r2 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r2);
|
||||
|
||||
if(!specular){
|
||||
spec_r = r;
|
||||
spec_g = g;
|
||||
@@ -1044,9 +1043,6 @@ void light_add_cone(const vec3d *pos, const vec3d *dir, float angle, float inner
|
||||
Assertion( r1 > 0.0f, "Invalid radius r1 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r1 );
|
||||
Assertion( r2 > 0.0f, "Invalid radius r2 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r2 );
|
||||
|
||||
if (r1 < 0.0001f || r2 < 0.0001f)
|
||||
return;
|
||||
|
||||
if(!specular){
|
||||
spec_r = r;
|
||||
spec_g = g;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "sound/audiostr.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include <lua.h>
|
||||
|
||||
|
||||
// This is the fs2_open credit list, please only add yourself if you have actually contributed code
|
||||
@@ -97,7 +98,7 @@ const char *fs2_open_credit_text =
|
||||
"Ogg Vorbis - (C) 2005, Xiph.Org Foundation\n"
|
||||
"JPEG - Independent JPEG Group, (C) 1991-1998, Thomas G. Lane\n"
|
||||
"libpng - Copyright (C) 1998-2010 Glenn Randers-Pehrson\n"
|
||||
"liblua - Copyright (C) 1994-2008 Lua.org, PUC-Rio\n"
|
||||
"liblua (" LUA_RELEASE ") - " LUA_COPYRIGHT "\n"
|
||||
"zlib - Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler\n"
|
||||
"FXAA - Copyright (c) 2010 NVIDIA Corporation. All rights reserved.\n"
|
||||
"This software uses libraries from the FFmpeg project under the LGPLv2.1\n"
|
||||
|
||||
@@ -997,10 +997,11 @@ void options_menu_init()
|
||||
// create slider
|
||||
for ( i = 0; i < NUM_OPTIONS_SLIDERS; i++ ) {
|
||||
Options_sliders[gr_screen.res][i].slider.create(&Ui_window, Options_sliders[gr_screen.res][i].x, Options_sliders[gr_screen.res][i].y,
|
||||
Options_sliders[gr_screen.res][i].dots, Options_sliders[gr_screen.res][i].filename,
|
||||
Options_sliders[gr_screen.res][i].hotspot, Options_sliders[gr_screen.res][i].left_filename, Options_sliders[gr_screen.res][i].left_mask, Options_sliders[gr_screen.res][i].left_x, Options_sliders[gr_screen.res][i].left_y,
|
||||
Options_sliders[gr_screen.res][i].right_filename, Options_sliders[gr_screen.res][i].right_mask, Options_sliders[gr_screen.res][i].right_x, Options_sliders[gr_screen.res][i].right_y,
|
||||
Options_sliders[gr_screen.res][i].dot_w);
|
||||
Options_sliders[gr_screen.res][i].dots, Options_sliders[gr_screen.res][i].filename,
|
||||
Options_sliders[gr_screen.res][i].hotspot,
|
||||
Options_sliders[gr_screen.res][i].right_filename, Options_sliders[gr_screen.res][i].right_mask, Options_sliders[gr_screen.res][i].right_x, Options_sliders[gr_screen.res][i].right_y,
|
||||
Options_sliders[gr_screen.res][i].left_filename, Options_sliders[gr_screen.res][i].left_mask, Options_sliders[gr_screen.res][i].left_x, Options_sliders[gr_screen.res][i].left_y,
|
||||
Options_sliders[gr_screen.res][i].dot_w);
|
||||
}
|
||||
|
||||
// maybe disable the skill slider
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "graphics/font.h"
|
||||
#include "graphics/shadows.h"
|
||||
#include "io/key.h"
|
||||
#include "io/mouse.h"
|
||||
#include "lighting/lighting.h"
|
||||
|
||||
@@ -748,11 +748,6 @@ void message_mission_free_avi(int m_index)
|
||||
if ( (m_index < 0) || (m_index >= Num_message_avis) )
|
||||
return;
|
||||
|
||||
// Make sure this code doesn't get run if the talking head guage is off
|
||||
// helps prevent a crash on jump out if this code doesn't work right
|
||||
if ( !hud_gauge_active(HUD_TALKING_HEAD) )
|
||||
return;
|
||||
|
||||
generic_anim_unload(&Message_avis[m_index].anim_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -2409,7 +2409,8 @@ int parse_create_object_sub(p_object *p_objp)
|
||||
}
|
||||
}
|
||||
|
||||
if (Game_mode & GM_IN_MISSION) {
|
||||
// If the ship is in a wing, this will be done in mission_set_wing_arrival_location() instead
|
||||
if (Game_mode & GM_IN_MISSION && shipp->wingnum == -1) {
|
||||
if (anchor_objnum >= 0)
|
||||
Script_system.SetHookObjects(2, "Ship", &Objects[objnum], "Parent", &Objects[anchor_objnum]);
|
||||
else
|
||||
@@ -3035,7 +3036,13 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
|
||||
parse_string_flag_list(p_objp->flags, Parse_object_flags, num_parse_object_flags, &unparsed);
|
||||
if (!unparsed.empty()) {
|
||||
for (size_t k = 0; k < unparsed.size(); ++k) {
|
||||
WarningEx(LOCATION, "Unknown flag in parse object flags: %s", unparsed[k].c_str());
|
||||
// catch typos or deprecations
|
||||
if (!stricmp(unparsed[k].c_str(), "no-collide") || !stricmp(unparsed[k].c_str(), "no_collide")) {
|
||||
p_objp->flags.set(Mission::Parse_Object_Flags::OF_No_collide);
|
||||
}
|
||||
else {
|
||||
WarningEx(LOCATION, "Unknown flag in parse object flags: %s", unparsed[k].c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6026,6 +6033,7 @@ void mission_parse_close()
|
||||
void mission_set_wing_arrival_location( wing *wingp, int num_to_set )
|
||||
{
|
||||
int index;
|
||||
int anchor_objnum = -1;
|
||||
|
||||
// get the starting index into the ship_index array of the first ship whose location we need set.
|
||||
|
||||
@@ -6035,7 +6043,7 @@ void mission_set_wing_arrival_location( wing *wingp, int num_to_set )
|
||||
object *objp;
|
||||
|
||||
objp = &Objects[Ships[wingp->ship_index[index]].objnum];
|
||||
mission_set_arrival_location(wingp->arrival_anchor, wingp->arrival_location, wingp->arrival_distance, OBJ_INDEX(objp), wingp->arrival_path_mask, NULL, NULL);
|
||||
anchor_objnum = mission_set_arrival_location(wingp->arrival_anchor, wingp->arrival_location, wingp->arrival_distance, OBJ_INDEX(objp), wingp->arrival_path_mask, NULL, NULL);
|
||||
|
||||
index++;
|
||||
}
|
||||
@@ -6049,7 +6057,8 @@ void mission_set_wing_arrival_location( wing *wingp, int num_to_set )
|
||||
// or in front of some other ship.
|
||||
index = wingp->current_count - num_to_set;
|
||||
leader_objp = &Objects[Ships[wingp->ship_index[index]].objnum];
|
||||
if (mission_set_arrival_location(wingp->arrival_anchor, wingp->arrival_location, wingp->arrival_distance, OBJ_INDEX(leader_objp), wingp->arrival_path_mask, &pos, &orient) != -1) {
|
||||
anchor_objnum = mission_set_arrival_location(wingp->arrival_anchor, wingp->arrival_location, wingp->arrival_distance, OBJ_INDEX(leader_objp), wingp->arrival_path_mask, &pos, &orient);
|
||||
if (anchor_objnum != -1) {
|
||||
// modify the remaining ships created
|
||||
index++;
|
||||
wing_index = 1;
|
||||
@@ -6068,10 +6077,21 @@ void mission_set_wing_arrival_location( wing *wingp, int num_to_set )
|
||||
}
|
||||
}
|
||||
|
||||
// create warp effect if in mission and not arriving from docking bay
|
||||
if ( (Game_mode & GM_IN_MISSION) && (wingp->arrival_location != ARRIVE_FROM_DOCK_BAY) ) {
|
||||
if (Game_mode & GM_IN_MISSION) {
|
||||
for ( index = wingp->current_count - num_to_set; index < wingp->current_count; index ++ ) {
|
||||
shipfx_warpin_start( &Objects[Ships[wingp->ship_index[index]].objnum] );
|
||||
object *objp = &Objects[Ships[wingp->ship_index[index]].objnum];
|
||||
|
||||
if (anchor_objnum >= 0)
|
||||
Script_system.SetHookObjects(2, "Ship", objp, "Parent", &Objects[anchor_objnum]);
|
||||
else
|
||||
Script_system.SetHookObjects(2, "Ship", objp, "Parent", NULL);
|
||||
|
||||
Script_system.RunCondition(CHA_ONSHIPARRIVE, 0, NULL, objp);
|
||||
Script_system.RemHookVars(2, "Ship", "Parent");
|
||||
|
||||
if (wingp->arrival_location != ARRIVE_FROM_DOCK_BAY) {
|
||||
shipfx_warpin_start(objp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "graphics/shadows.h"
|
||||
#include "graphics/opengl/gropenglshader.h"
|
||||
#include "hud/hudwingmanstatus.h"
|
||||
#include "io/key.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "gamehelp/contexthelp.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "graphics/shadows.h"
|
||||
#include "hud/hudbrackets.h"
|
||||
#include "io/mouse.h"
|
||||
#include "io/timer.h"
|
||||
@@ -2009,13 +2010,7 @@ void weapon_select_init()
|
||||
|
||||
WeaponSelectMaskBitmap = bm_load(Wl_loadout_select_mask[Uses_apply_all_button][gr_screen.res]);
|
||||
if (WeaponSelectMaskBitmap < 0) {
|
||||
if (gr_screen.res == GR_640) {
|
||||
Error(LOCATION,"Could not load in 'weaponloadout-m'!");
|
||||
} else if (gr_screen.res == GR_1024) {
|
||||
Error(LOCATION,"Could not load in '2_weaponloadout-m'!");
|
||||
} else {
|
||||
Error(LOCATION,"Could not load in 'weaponloadout-m'!");
|
||||
}
|
||||
Error(LOCATION,"Could not load in '%s'!", Wl_loadout_select_mask[Uses_apply_all_button][gr_screen.res]);
|
||||
}
|
||||
|
||||
Weaponselect_mask_w = -1;
|
||||
|
||||
@@ -53,35 +53,35 @@ void parse_mod_table(const char *filename)
|
||||
|
||||
// start parsing
|
||||
optional_string("#GAME SETTINGS");
|
||||
|
||||
|
||||
if (optional_string("$Minimum version:")) {
|
||||
int major = 0;
|
||||
int minor = 0;
|
||||
int build = 0;
|
||||
int revision = 0;
|
||||
|
||||
|
||||
required_string("+Major:");
|
||||
stuff_int(&major);
|
||||
|
||||
|
||||
required_string("+Minor:");
|
||||
stuff_int(&minor);
|
||||
|
||||
|
||||
required_string("+Build:");
|
||||
stuff_int(&build);
|
||||
|
||||
|
||||
if (optional_string("+Revision:")) {
|
||||
stuff_int(&revision);
|
||||
}
|
||||
|
||||
mprintf(("Game Settings Table: Parsed minimum version of %s\n", version::format_version(major, minor, build, revision).c_str()));
|
||||
|
||||
if (!version::check_at_least(major, minor, build, revision)) {
|
||||
|
||||
mprintf(("Game Settings Table: Parsed minimum version of %s\n", gameversion::format_version(major, minor, build, revision).c_str()));
|
||||
|
||||
if (!gameversion::check_at_least(major, minor, build, revision)) {
|
||||
Error(LOCATION, "This modification needs at least version %s of FreeSpace Open. However, the current is only %s!",
|
||||
version::format_version(major, minor, build, revision).c_str(),
|
||||
version::format_version(FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD, FS_VERSION_REVIS).c_str());
|
||||
gameversion::format_version(major, minor, build, revision).c_str(),
|
||||
gameversion::format_version(FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD, FS_VERSION_REVIS).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
optional_string("#CAMPAIGN SETTINGS");
|
||||
|
||||
if (optional_string("$Default Campaign File Name:")) {
|
||||
@@ -215,19 +215,16 @@ void parse_mod_table(const char *filename)
|
||||
Briefing_window_FOV = fov;
|
||||
}
|
||||
|
||||
|
||||
if (optional_string("$Generic Pain Flash Factor:")) {
|
||||
if (optional_string("$Generic Pain Flash Factor:")) {
|
||||
stuff_float(&Generic_pain_flash_factor);
|
||||
if (Generic_pain_flash_factor != 1.0f)
|
||||
mprintf(("Game Settings Table: Setting generic pain flash factor to %.2f\n", Generic_pain_flash_factor));
|
||||
|
||||
}
|
||||
|
||||
if (optional_string("$Shield Pain Flash Factor:")) {
|
||||
|
||||
if (optional_string("$Shield Pain Flash Factor:")) {
|
||||
stuff_float(&Shield_pain_flash_factor);
|
||||
if (Shield_pain_flash_factor != 0.0f)
|
||||
mprintf(("Game Settings Table: Setting shield pain flash factor to %.2f\n", Shield_pain_flash_factor));
|
||||
|
||||
}
|
||||
|
||||
optional_string("#NETWORK SETTINGS");
|
||||
@@ -343,7 +340,7 @@ void parse_mod_table(const char *filename)
|
||||
}
|
||||
|
||||
void mod_table_init()
|
||||
{
|
||||
{
|
||||
// first parse the default table
|
||||
parse_mod_table(NULL);
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef _MODELRENDER_H
|
||||
#define _MODELRENDER_H
|
||||
|
||||
#include "graphics/opengl/gropengltnl.h"
|
||||
#include "graphics/material.h"
|
||||
#include "lighting/lighting.h"
|
||||
#include "math/vecmat.h"
|
||||
|
||||
@@ -972,7 +972,7 @@ void multi_ingame_handle_timeout()
|
||||
void process_ingame_ships_packet( ubyte *data, header *hinfo )
|
||||
{
|
||||
int offset, team, j;
|
||||
uint64_t oflags, sflags;
|
||||
std::uint64_t oflags, sflags;
|
||||
ubyte p_type;
|
||||
ushort net_signature;
|
||||
short wing_data;
|
||||
@@ -1039,12 +1039,12 @@ void process_ingame_ships_packet( ubyte *data, header *hinfo )
|
||||
multi_set_network_signature( net_signature, MULTI_SIG_SHIP );
|
||||
objnum = parse_create_object( p_objp );
|
||||
ship_num = Objects[objnum].instance;
|
||||
Objects[objnum].flags.from_long(oflags);
|
||||
Objects[objnum].flags.from_u64(oflags);
|
||||
Objects[objnum].net_signature = net_signature;
|
||||
|
||||
// assign any common data
|
||||
strcpy_s(Ships[ship_num].ship_name, ship_name);
|
||||
Ships[ship_num].flags.from_long(sflags);
|
||||
Ships[ship_num].flags.from_u64(sflags);
|
||||
Ships[ship_num].team = team;
|
||||
Ships[ship_num].wingnum = (int)wing_data;
|
||||
|
||||
@@ -1132,8 +1132,8 @@ void send_ingame_ships_packet(net_player *player)
|
||||
ADD_DATA( p_type );
|
||||
ADD_STRING( shipp->ship_name );
|
||||
ADD_USHORT( Objects[so->objnum].net_signature );
|
||||
ADD_ULONG( shipp->flags.to_long() );
|
||||
ADD_ULONG( Objects[so->objnum].flags.to_long() );
|
||||
ADD_ULONG( shipp->flags.to_u64() );
|
||||
ADD_ULONG( Objects[so->objnum].flags.to_u64() );
|
||||
ADD_INT( shipp->team );
|
||||
wing_data = (short)shipp->wingnum;
|
||||
ADD_SHORT(wing_data);
|
||||
@@ -1809,7 +1809,7 @@ void send_ingame_ship_update_packet(net_player *p,ship *sp)
|
||||
// just send net signature, shield and hull percentages
|
||||
objp = &Objects[sp->objnum];
|
||||
ADD_USHORT(objp->net_signature);
|
||||
ADD_ULONG(objp->flags.to_long());
|
||||
ADD_ULONG(objp->flags.to_u64());
|
||||
ADD_INT(objp->n_quadrants);
|
||||
ADD_FLOAT(objp->hull_strength);
|
||||
|
||||
@@ -1853,7 +1853,7 @@ void process_ingame_ship_update_packet(ubyte *data, header *hinfo)
|
||||
return;
|
||||
}
|
||||
// otherwise read in the ship values
|
||||
lookup->flags.from_long(flags);
|
||||
lookup->flags.from_u64(flags);
|
||||
lookup->n_quadrants = n_quadrants;
|
||||
GET_FLOAT(lookup->hull_strength);
|
||||
for(idx=0;idx<n_quadrants;idx++){
|
||||
|
||||
@@ -526,7 +526,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data
|
||||
// flag
|
||||
support_extra = 1;
|
||||
PACK_BYTE( support_extra );
|
||||
PACK_ULONG( Ai_info[shipp->ai_index].ai_flags.to_long() );
|
||||
PACK_ULONG( Ai_info[shipp->ai_index].ai_flags.to_u64() );
|
||||
PACK_INT( Ai_info[shipp->ai_index].mode );
|
||||
PACK_INT( Ai_info[shipp->ai_index].submode );
|
||||
|
||||
@@ -940,7 +940,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data)
|
||||
if(support_extra){
|
||||
ushort dock_sig;
|
||||
int ai_mode, ai_submode;
|
||||
std::int64_t ai_flags;
|
||||
std::uint64_t ai_flags;
|
||||
|
||||
// flag
|
||||
GET_ULONG(ai_flags);
|
||||
@@ -950,7 +950,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data)
|
||||
|
||||
// valid ship?
|
||||
if((shipp != NULL) && (shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)){
|
||||
Ai_info[shipp->ai_index].ai_flags.from_long(ai_flags);
|
||||
Ai_info[shipp->ai_index].ai_flags.from_u64(ai_flags);
|
||||
Ai_info[shipp->ai_index].mode = ai_mode;
|
||||
Ai_info[shipp->ai_index].submode = ai_submode;
|
||||
|
||||
|
||||
@@ -4902,7 +4902,7 @@ void process_repair_info_packet(ubyte *data, header *hinfo)
|
||||
ai_info *aip = &Ai_info[Ships[repair_objp->instance].ai_index];
|
||||
Assert(aip->active_goal >= 0);
|
||||
ai_goal *aigp = &aip->goals[aip->active_goal];
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid, AI::Goal_Flags::Docker_index_valid]);
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
|
||||
|
||||
int docker_index = aigp->docker.index;
|
||||
int dockee_index = aigp->dockee.index;
|
||||
@@ -5020,7 +5020,7 @@ void send_ai_info_update_packet( object *objp, char what, object * other_objp )
|
||||
|
||||
// for docking, add the dock and dockee index
|
||||
if (aigp->ai_mode & (AI_GOAL_DOCK | AI_GOAL_REARM_REPAIR)) {
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] || aigp->flags[AI::Goal_Flags::Docker_index_valid]);
|
||||
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
|
||||
Assert( (aigp->docker.index >= 0) && (aigp->docker.index < UCHAR_MAX) );
|
||||
Assert( (aigp->dockee.index >= 0) && (aigp->dockee.index < UCHAR_MAX) );
|
||||
docker_index = (ubyte) aigp->docker.index;
|
||||
|
||||
+22
-14
@@ -357,23 +357,15 @@ namespace os
|
||||
}
|
||||
gr_activate(1);
|
||||
}
|
||||
|
||||
void ReleaseWarning(const char* filename, int line, const char* format, ...)
|
||||
{
|
||||
Global_warning_count++;
|
||||
|
||||
// Actual implementation of the warning function. Used by the various warning functions
|
||||
void WarningImpl(const char* filename, int line, const SCP_string& text)
|
||||
{
|
||||
filename = clean_filename(filename);
|
||||
|
||||
// output to the debug log before anything else (so that we have a complete record)
|
||||
|
||||
SCP_string formatMessage;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsprintf(formatMessage, format, args);
|
||||
va_end(args);
|
||||
|
||||
|
||||
SCP_string printfString = formatMessage;
|
||||
SCP_string printfString = text;
|
||||
std::transform(printfString.begin(), printfString.end(), printfString.begin(), replaceNewline);
|
||||
|
||||
mprintf(("WARNING: \"%s\" at %s:%d\n", printfString.c_str(), filename, line));
|
||||
@@ -388,7 +380,7 @@ namespace os
|
||||
}
|
||||
|
||||
SCP_stringstream boxMsgStream;
|
||||
boxMsgStream << "Warning: " << formatMessage << "\n";
|
||||
boxMsgStream << "Warning: " << text << "\n";
|
||||
boxMsgStream << "File: " << filename << "\n";
|
||||
boxMsgStream << "Line: " << line << "\n";
|
||||
|
||||
@@ -442,9 +434,25 @@ namespace os
|
||||
|
||||
gr_activate(1);
|
||||
}
|
||||
|
||||
|
||||
void ReleaseWarning(const char* filename, int line, const char* format, ...) {
|
||||
Global_warning_count++;
|
||||
|
||||
SCP_string msg;
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(msg, format, args);
|
||||
va_end(args);
|
||||
|
||||
WarningImpl(filename, line, msg);
|
||||
}
|
||||
|
||||
void Warning(const char* filename, int line, const char* format, ...)
|
||||
{
|
||||
Global_warning_count++;
|
||||
|
||||
#ifndef NDEBUG
|
||||
SCP_string msg;
|
||||
va_list args;
|
||||
@@ -453,7 +461,7 @@ namespace os
|
||||
vsprintf(msg, format, args);
|
||||
va_end(args);
|
||||
|
||||
ReleaseWarning(filename, line, "%s", msg.c_str());
|
||||
WarningImpl(filename, line, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -391,11 +391,6 @@ void debug_int3(const char *file, int line)
|
||||
#endif
|
||||
|
||||
gr_activate(1);
|
||||
// we have to call os_deinit() before abort() so we make sure that SDL gets
|
||||
// closed out and we don't lose video/input control
|
||||
os_deinit();
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
namespace os
|
||||
|
||||
@@ -2857,7 +2857,7 @@ int stuff_int_list(int *ilp, int max_ints, int lookup_type)
|
||||
break;
|
||||
|
||||
default:
|
||||
Error(LOCATION,"Unknown lookup_type in stuff_int_list");
|
||||
Error(LOCATION,"Unknown lookup_type %d in stuff_int_list", lookup_type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3079,7 +3079,7 @@ void mark_int_list(int *ilp, int max_ints, int lookup_type)
|
||||
break;
|
||||
|
||||
default:
|
||||
Error(LOCATION,"Unknown lookup_type in stuff_int_list");
|
||||
Error(LOCATION,"Unknown lookup_type %d in mark_int_list", lookup_type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3438,7 +3438,7 @@ char *split_str_once(char *src, int max_pixel_w)
|
||||
// returns: number of lines src is broken into
|
||||
// -1 is returned when an error occurs
|
||||
//
|
||||
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char)
|
||||
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char, bool strip_leading_whitespace)
|
||||
{
|
||||
char buffer[SPLIT_STR_BUFFER_SIZE];
|
||||
const char *breakpoint = NULL;
|
||||
@@ -3457,7 +3457,7 @@ int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str
|
||||
ignore_until_whitespace = 0;
|
||||
|
||||
// get rid of any leading whitespace
|
||||
while (is_white_space(*src))
|
||||
while (strip_leading_whitespace && is_white_space(*src))
|
||||
src++;
|
||||
|
||||
new_line = 1;
|
||||
@@ -3472,7 +3472,7 @@ int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str
|
||||
// starting a new line of text, init stuff for that
|
||||
if (new_line) {
|
||||
p_str[line_num] = NULL;
|
||||
if (is_gray_space(*src))
|
||||
if (strip_leading_whitespace && is_gray_space(*src))
|
||||
continue;
|
||||
|
||||
p_str[line_num] = src;
|
||||
@@ -3560,7 +3560,7 @@ int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str
|
||||
return line_num;
|
||||
}
|
||||
|
||||
int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_vector<const char*> &p_str, char ignore_char)
|
||||
int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_vector<const char*> &p_str, char ignore_char, bool strip_leading_whitespace)
|
||||
{
|
||||
char buffer[SPLIT_STR_BUFFER_SIZE];
|
||||
const char *breakpoint = NULL;
|
||||
@@ -3574,7 +3574,7 @@ int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_ve
|
||||
memset(buffer, 0, SPLIT_STR_BUFFER_SIZE);
|
||||
|
||||
// get rid of any leading whitespace
|
||||
while (is_white_space(*src))
|
||||
while (strip_leading_whitespace && is_white_space(*src))
|
||||
src++;
|
||||
|
||||
p_str.clear();
|
||||
@@ -3585,7 +3585,7 @@ int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_ve
|
||||
|
||||
// starting a new line of text, init stuff for that
|
||||
if (new_line) {
|
||||
if (is_gray_space(*src))
|
||||
if (strip_leading_whitespace && is_gray_space(*src))
|
||||
continue;
|
||||
|
||||
p_str.push_back(src);
|
||||
|
||||
@@ -186,7 +186,12 @@ template<class T>
|
||||
void stuff_flagset(T *dest) {
|
||||
long l;
|
||||
bool success = atol2(&l);
|
||||
dest->from_long(l);
|
||||
|
||||
if (l < 0) {
|
||||
error_display(0, "Expected flagset value but got negative value %lu!\n", l);
|
||||
l = 0;
|
||||
}
|
||||
dest->from_u64((std::uint64_t) l);
|
||||
|
||||
if (!success)
|
||||
skip_token();
|
||||
@@ -196,7 +201,7 @@ void stuff_flagset(T *dest) {
|
||||
if (*Mp == ',')
|
||||
Mp++;
|
||||
|
||||
diag_printf("Stuffed flagset: %ld\n", dest->to_long());
|
||||
diag_printf("Stuffed flagset: %" PRIu64 "\n", dest->to_u64());
|
||||
}
|
||||
|
||||
extern int stuff_int_list(int *ilp, int max_ints, int lookup_type = RAW_INTEGER_TYPE);
|
||||
@@ -262,8 +267,8 @@ extern void maybe_convert_foreign_characters(SCP_string &text);
|
||||
extern size_t get_converted_string_length(const char *text);
|
||||
extern size_t get_converted_string_length(const SCP_string &text);
|
||||
char *split_str_once(char *src, int max_pixel_w);
|
||||
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char = -1);
|
||||
int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_vector<const char*> &p_str, char ignore_char = -1);
|
||||
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char = -1, bool strip_leading_whitespace = true);
|
||||
int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_vector<const char*> &p_str, char ignore_char = -1, bool strip_leading_whitespace = true);
|
||||
|
||||
// fred
|
||||
extern int required_string_fred(char *pstr, char *end = NULL);
|
||||
|
||||
+41
-38
@@ -1538,23 +1538,27 @@ int is_sexp_top_level( int node )
|
||||
/**
|
||||
* Find argument number
|
||||
*/
|
||||
int find_argnum(int parent, int arg)
|
||||
int find_argnum(int parent_node, int arg_node)
|
||||
{
|
||||
int n, tally;
|
||||
Assertion((parent_node >= 0) && (parent_node < Num_sexp_nodes), "find_argnum was passed an invalid parent!");
|
||||
Assertion((arg_node >= 0) && (arg_node < Num_sexp_nodes), "find_argnum was passed an invalid child!");
|
||||
|
||||
n = CDR(parent);
|
||||
n = CDR(parent_node);
|
||||
tally = 0;
|
||||
|
||||
while (CAR(n) != arg)
|
||||
while (n >= 0)
|
||||
{
|
||||
if (n == -1)
|
||||
return -1;
|
||||
// check if there is an operator node at this position which matches our expected node
|
||||
if (CAR(n) == arg_node)
|
||||
return tally;
|
||||
|
||||
tally++;
|
||||
n = CDR(n);
|
||||
}
|
||||
|
||||
return tally;
|
||||
// argument node not found
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15020,7 +15024,7 @@ int sexp_targeted(int node)
|
||||
}
|
||||
|
||||
z = ship_name_lookup(CTEXT(node), 1);
|
||||
if ((z < 0) || !Player_ai || (Ships[z].objnum != Player_ai->target_objnum)){
|
||||
if ((z < 0) || !Player_ai || (Ships[z].objnum != Players_target)){
|
||||
return SEXP_FALSE;
|
||||
}
|
||||
|
||||
@@ -15031,7 +15035,7 @@ int sexp_targeted(int node)
|
||||
}
|
||||
|
||||
if (CDR(CDR(node)) >= 0) {
|
||||
ptr = Player_ai->targeted_subsys;
|
||||
ptr = Players_targeted_subsys;
|
||||
if (!ptr || subsystem_stricmp(ptr->system_info->subobj_name, CTEXT(CDR(CDR(node))))){
|
||||
return SEXP_FALSE;
|
||||
}
|
||||
@@ -15047,7 +15051,7 @@ int sexp_node_targeted(int node)
|
||||
|
||||
CJumpNode *jnp = jumpnode_get_by_name(CTEXT(node));
|
||||
|
||||
if (jnp==NULL || !Player_ai || (jnp->GetSCPObjectNumber() != Player_ai->target_objnum)){
|
||||
if (jnp==NULL || !Player_ai || (jnp->GetSCPObjectNumber() != Players_target)){
|
||||
return SEXP_FALSE;
|
||||
}
|
||||
|
||||
@@ -20433,8 +20437,7 @@ void sexp_string_set_substring(int node)
|
||||
void sexp_debug(int node)
|
||||
{
|
||||
int i;
|
||||
char *id;
|
||||
char temp_buf[MESSAGE_LENGTH] = {""};
|
||||
SCP_string warning_message;
|
||||
|
||||
#ifdef NDEBUG
|
||||
int no_release_message;
|
||||
@@ -20442,25 +20445,29 @@ void sexp_debug(int node)
|
||||
#endif
|
||||
|
||||
node = CDR(node);
|
||||
Assertion (node >= 0, "No message defined in debug SEXP");
|
||||
id = CTEXT(node);
|
||||
Assertion (node >= 0, "No message defined in debug SEXP");
|
||||
|
||||
// we'll suppose it's the string for now
|
||||
warning_message = CTEXT(node);
|
||||
|
||||
// but use an actual message if one exists
|
||||
for (i=0; i<Num_messages; i++) {
|
||||
// find the message
|
||||
if ( !stricmp(id, Messages[i].name) ) {
|
||||
//replace variables if necessary
|
||||
strcpy_s(temp_buf, Messages[i].message);
|
||||
sexp_replace_variable_names_with_values(temp_buf, MESSAGE_LENGTH);
|
||||
if ( !stricmp(Messages[i].name, warning_message.c_str()) ) {
|
||||
warning_message = Messages[i].message;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// replace variables if necessary
|
||||
sexp_replace_variable_names_with_values(warning_message);
|
||||
|
||||
//send the message
|
||||
#ifndef NDEBUG
|
||||
Warning(LOCATION, "%s", temp_buf);
|
||||
Warning(LOCATION, "%s", warning_message.c_str());
|
||||
#else
|
||||
if (!no_release_message) {
|
||||
ReleaseWarning(LOCATION, "%s", temp_buf);
|
||||
ReleaseWarning(LOCATION, "%s", warning_message.c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -22294,7 +22301,7 @@ void sexp_manipulate_colgroup(int node, bool add_to_group) {
|
||||
if (add_to_group) {
|
||||
colgroup_id |= (1<<group);
|
||||
} else {
|
||||
colgroup_id &= !(1<<group);
|
||||
colgroup_id &= ~(1<<group);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25028,20 +25035,18 @@ int eval_sexp(int cur_node, int referenced_node)
|
||||
if (sexp_val < 0)
|
||||
{
|
||||
int parent_node = find_parent_operator(cur_node);
|
||||
int arg_num = find_argnum(parent_node, cur_node);
|
||||
|
||||
// make sure everything works okay
|
||||
if (arg_num == -1)
|
||||
// if the SEXP has no parent, the point is moot
|
||||
if (parent_node >= 0)
|
||||
{
|
||||
SCP_string sexp_text;
|
||||
convert_sexp_to_string(sexp_text, cur_node, SEXP_ERROR_CHECK_MODE);
|
||||
Error(LOCATION, "Error finding sexp argument. Received value %d for sexp:\n%s", sexp_val, sexp_text.c_str());
|
||||
}
|
||||
int arg_num = find_argnum(parent_node, cur_node);
|
||||
Assertion(arg_num >= 0, "Error finding sexp argument. The SEXP is not listed among its parent's children.");
|
||||
|
||||
// if we need a positive value, make it positive
|
||||
if (query_operator_argument_type(get_operator_index(parent_node), arg_num) == OPF_POSITIVE)
|
||||
{
|
||||
sexp_val *= -1;
|
||||
// if we need a positive value, make it positive
|
||||
if (query_operator_argument_type(get_operator_index(parent_node), arg_num) == OPF_POSITIVE)
|
||||
{
|
||||
sexp_val *= -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26182,10 +26187,8 @@ int query_operator_argument_type(int op, int argnum)
|
||||
case OP_DEBUG:
|
||||
if (argnum == 0) {
|
||||
return OPF_BOOL;
|
||||
}else if (argnum == 1) {
|
||||
return OPF_MESSAGE;
|
||||
}else {
|
||||
return OPF_STRING;
|
||||
} else {
|
||||
return OPF_MESSAGE_OR_STRING;
|
||||
}
|
||||
|
||||
case OP_HAS_TIME_ELAPSED:
|
||||
@@ -31660,8 +31663,8 @@ sexp_help_struct Sexp_help[] = {
|
||||
{ OP_DEBUG, "debug\r\n"
|
||||
"\tPops up a warning on debug builds (and optionally on release builds)\r\n"
|
||||
"Takes 1 or more arguments...\r\n"
|
||||
"\t1:\t If false, popup messages in release builds too. Defaults to true.\r\n"
|
||||
"\t2:\tName of a message which will appear in the warning (optional)\r\n"},
|
||||
"\t1:\tLimit warning to debug builds. If false, display warning in release builds too. Defaults to true.\r\n"
|
||||
"\t2:\tA short string which will appear in the warning, or a message if the string matches a message name.\r\n"},
|
||||
|
||||
{ OP_GRANT_PROMOTION, "Grant promotion (Action operator)\r\n"
|
||||
"\tIn a single player game, this function grants a player an automatic promotion to the "
|
||||
@@ -31730,7 +31733,7 @@ sexp_help_struct Sexp_help[] = {
|
||||
"have scanned each one.\r\n\r\n"
|
||||
"Returns a boolean value after <delay> seconds when all cargo is known. Takes 2 or more arguments...\r\n"
|
||||
"\t1:\tDelay in seconds after which sexpression will return true when all cargo scanned."
|
||||
"\tRest:\tNames of ships/cargo to check for cargo known.." },
|
||||
"\tRest:\tNames of ships/cargo to check for cargo known." },
|
||||
|
||||
{ OP_WAS_PROMOTION_GRANTED, "Was promotion granted (Boolean operator)\r\n"
|
||||
"\tReturns true if a promotion was granted via the 'Grant promotion' operator in the mission.\r\n\r\n"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#define FS2_OPEN_ADE_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "platformChecks.h"
|
||||
|
||||
extern "C" {
|
||||
#include <lauxlib.h>
|
||||
@@ -226,8 +227,9 @@ template<class StoreType>
|
||||
class ade_obj: public ade_lib_handle {
|
||||
public:
|
||||
// Make sure that the stored type is compatible with our requirements
|
||||
#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
|
||||
static_assert(std::is_trivially_copyable<StoreType>::value, "ADE object types must be trivially copyable!");
|
||||
|
||||
#endif
|
||||
ade_obj(const char* in_name, const char* in_desc, const ade_lib_handle* in_deriv = NULL) {
|
||||
ade_table_entry ate;
|
||||
|
||||
|
||||
@@ -1084,8 +1084,8 @@ ADE_FUNC(drawString, l_Graphics, "string Message, [number X1, number Y1, number
|
||||
}
|
||||
else
|
||||
{
|
||||
int linelengths[MAX_TEXT_LINES];
|
||||
const char *linestarts[MAX_TEXT_LINES];
|
||||
SCP_vector<int> linelengths;
|
||||
SCP_vector<const char*> linestarts;
|
||||
|
||||
if (y2 >= 0 && y2 < y)
|
||||
{
|
||||
@@ -1097,7 +1097,7 @@ ADE_FUNC(drawString, l_Graphics, "string Message, [number X1, number Y1, number
|
||||
y2 = temp;
|
||||
}
|
||||
|
||||
num_lines = split_str(s, x2-x, linelengths, linestarts, MAX_TEXT_LINES);
|
||||
num_lines = split_str(s, x2-x, linelengths, linestarts, -1, false);
|
||||
|
||||
//Make sure we don't go over size
|
||||
int line_ht = gr_get_font_height();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "vecmath.h"
|
||||
#include "team.h"
|
||||
#include "mc_info.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
|
||||
namespace scripting {
|
||||
namespace api {
|
||||
@@ -285,7 +286,7 @@ ADE_VIRTVAR(Team, l_Weapon, "team", "Weapon's team", "team", "Weapon team, or in
|
||||
|
||||
weapon *wp = &Weapons[oh->objp->instance];
|
||||
|
||||
if(ADE_SETTING_VAR && nt > -1 && nt < Num_teams) {
|
||||
if(ADE_SETTING_VAR && nt > -1 && nt < Num_iffs) {
|
||||
wp->team = nt;
|
||||
}
|
||||
|
||||
|
||||
@@ -271,6 +271,9 @@ void script_state::OutputLuaMeta(FILE *fp)
|
||||
ade_table_entry *ate;
|
||||
fputs("<dl>\n", fp);
|
||||
|
||||
//***Version info
|
||||
fprintf(fp, "<dd>Version: %s</dd>\n", LUA_RELEASE);
|
||||
|
||||
SCP_vector<ade_table_entry*> table_entries;
|
||||
|
||||
//***TOC: Libraries
|
||||
|
||||
@@ -97,39 +97,39 @@ LuaTable::iterator LuaTable::end() {
|
||||
return iterator(); // Empty iterator
|
||||
}
|
||||
|
||||
LuaTableIterator::LuaTableIterator(const LuaTable& t) : _L(t.getLuaState()) {
|
||||
_stackTop = lua_gettop(_L);
|
||||
LuaTableIterator::LuaTableIterator(const LuaTable& t) : _luaState(t.getLuaState()) {
|
||||
_stackTop = lua_gettop(_luaState);
|
||||
|
||||
t.pushValue();
|
||||
lua_pushnil(_L);
|
||||
lua_pushnil(_luaState);
|
||||
|
||||
toNextElement();
|
||||
}
|
||||
LuaTableIterator::~LuaTableIterator() {
|
||||
lua_settop(_L, _stackTop);
|
||||
lua_settop(_luaState, _stackTop);
|
||||
}
|
||||
bool LuaTableIterator::hasElement() {
|
||||
return _hasElement;
|
||||
}
|
||||
void LuaTableIterator::toNextElement() {
|
||||
auto ret = lua_next(_L, -2);
|
||||
auto ret = lua_next(_luaState, -2);
|
||||
|
||||
_hasElement = ret != 0;
|
||||
|
||||
if (_hasElement) {
|
||||
LuaValue key;
|
||||
key.setReference(UniqueLuaReference::create(_L, -2));
|
||||
key.setReference(UniqueLuaReference::create(_luaState, -2));
|
||||
|
||||
LuaValue value;
|
||||
value.setReference(UniqueLuaReference::create(_L, -1));
|
||||
value.setReference(UniqueLuaReference::create(_luaState, -1));
|
||||
|
||||
_currentVal = std::make_pair(key, value);
|
||||
|
||||
// Remove value from stack
|
||||
lua_pop(_L, 1);
|
||||
lua_pop(_luaState, 1);
|
||||
}
|
||||
}
|
||||
std::pair<LuaValue, LuaValue> LuaTableIterator::getElement() {
|
||||
return _currentVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ class LuaTable;
|
||||
* be in the exact same state when you call the next method of this class.
|
||||
*/
|
||||
class LuaTableIterator {
|
||||
lua_State* _L = nullptr;
|
||||
lua_State* _luaState = nullptr;
|
||||
|
||||
int _stackTop = 0;
|
||||
|
||||
|
||||
+29
-17
@@ -3430,9 +3430,17 @@ int parse_ship_values(ship_info* sip, const bool is_template, const bool first_t
|
||||
Warning(LOCATION, "Use of '%s' flag for %s '%s' - this flag is no longer needed.", Ship_flags[idx].name, info_type_name, sip->name);
|
||||
else
|
||||
sip->flags.set(Ship_flags[idx].def);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// catch typos or deprecations
|
||||
if (!stricmp(ship_strings[i], "no-collide") || !stricmp(ship_strings[i], "no_collide")) {
|
||||
flag_found = true;
|
||||
sip->flags.set(Ship::Info_Flags::No_collide);
|
||||
}
|
||||
|
||||
if ( !flag_found && (ship_type_index < 0) )
|
||||
Warning(LOCATION, "Bogus string in ship flags: %s\n", ship_strings[i]);
|
||||
}
|
||||
@@ -10910,6 +10918,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
float dist_mult;
|
||||
dist_mult = sip->minimum_convergence_distance / dist_to_aim;
|
||||
vm_vec_scale_add(&predicted_target_pos, &obj->pos, &plr_to_target_vec, dist_mult);
|
||||
dist_to_aim = sip->minimum_convergence_distance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13612,10 +13621,7 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
// loading equipment moving into place
|
||||
if ( aip->rearm_first_missile == TRUE )
|
||||
{
|
||||
swp->secondary_bank_rearm_time[i] = timestamp(snd_get_duration(Snds[SND_MISSILE_START_LOAD].id));
|
||||
|
||||
if (i == swp->num_secondary_banks - 1)
|
||||
aip->rearm_first_missile = FALSE;
|
||||
swp->secondary_bank_rearm_time[i] = timestamp(snd_get_duration(Snds[SND_MISSILE_START_LOAD].id));
|
||||
}
|
||||
|
||||
if ( swp->secondary_bank_ammo[i] < swp->secondary_bank_start_ammo[i] )
|
||||
@@ -13651,8 +13657,13 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
banks_full++;
|
||||
}
|
||||
|
||||
if ((aip->rearm_first_missile == TRUE) && (i == swp->num_secondary_banks - 1) && (banks_full != swp->num_secondary_banks))
|
||||
if ((aip->rearm_first_missile == TRUE) && (i == swp->num_secondary_banks - 1))
|
||||
{
|
||||
if ((banks_full != swp->num_secondary_banks))
|
||||
snd_play_3d( &Snds[SND_MISSILE_START_LOAD], &objp->pos, &View_position );
|
||||
|
||||
aip->rearm_first_missile = FALSE;
|
||||
}
|
||||
} // end for
|
||||
|
||||
// rearm ballistic primaries - Goober5000
|
||||
@@ -13680,10 +13691,7 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
else
|
||||
sound_index = SND_MISSILE_START_LOAD;
|
||||
|
||||
swp->primary_bank_rearm_time[i] = timestamp(snd_get_duration(Snds[sound_index].id));
|
||||
|
||||
if (i == last_ballistic_idx)
|
||||
aip->rearm_first_ballistic_primary = FALSE;
|
||||
swp->primary_bank_rearm_time[i] = timestamp(snd_get_duration(Snds[sound_index].id));
|
||||
}
|
||||
|
||||
if ( swp->primary_bank_ammo[i] < swp->primary_bank_start_ammo[i] )
|
||||
@@ -13727,16 +13735,20 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
primary_banks_full++;
|
||||
}
|
||||
|
||||
if ((aip->rearm_first_ballistic_primary == TRUE) && (i == last_ballistic_idx) && (primary_banks_full != swp->num_primary_banks))
|
||||
if ((aip->rearm_first_ballistic_primary == TRUE) && (i == last_ballistic_idx))
|
||||
{
|
||||
// Goober5000
|
||||
int sound_index;
|
||||
if (Snds[SND_BALLISTIC_START_LOAD].id >= 0)
|
||||
sound_index = SND_BALLISTIC_START_LOAD;
|
||||
else
|
||||
sound_index = SND_MISSILE_START_LOAD;
|
||||
if (primary_banks_full != swp->num_primary_banks) {
|
||||
// Goober5000
|
||||
int sound_index;
|
||||
if (Snds[SND_BALLISTIC_START_LOAD].id >= 0)
|
||||
sound_index = SND_BALLISTIC_START_LOAD;
|
||||
else
|
||||
sound_index = SND_MISSILE_START_LOAD;
|
||||
|
||||
snd_play_3d( &Snds[sound_index], &objp->pos, &View_position );
|
||||
snd_play_3d( &Snds[sound_index], &objp->pos, &View_position );
|
||||
}
|
||||
|
||||
aip->rearm_first_ballistic_primary = FALSE;
|
||||
}
|
||||
} // end for
|
||||
} // end if (subsys_all_ok)
|
||||
|
||||
@@ -105,12 +105,10 @@ void parse_rank_tbl()
|
||||
required_string("#End");
|
||||
|
||||
// be sure that all rank points are in order
|
||||
#ifndef NDEBUG
|
||||
for (idx = 0; idx < NUM_RANKS - 1; idx++) {
|
||||
if (Ranks[idx].points >= Ranks[idx + 1].points)
|
||||
Int3();
|
||||
Warning(LOCATION, "Rank #%d (%s) has a higher \"$Points:\" value (%d) than the following rank (%s, %d points). This shouldn't actually crash FSO, but it might result in unexpected or incorrect behavior.\n", idx + 1, Ranks[idx].name, Ranks[idx].points, Ranks[idx+1].name, Ranks[idx+1].points);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
|
||||
+16
-16
@@ -53,9 +53,9 @@ void show_stats_label(int stage, int sx, int sy, int dy)
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hits", 118));
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary hit %%", 119));
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary hit %", 119));
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hit %%", 120));
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hit %", 120));
|
||||
sy += 2*dy;
|
||||
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary weapon shots", 121));
|
||||
@@ -64,9 +64,9 @@ void show_stats_label(int stage, int sx, int sy, int dy)
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hits", 123));
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary hit %%", 124));
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary hit %", 124));
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hit %%", 125));
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hit %", 125));
|
||||
sy += 2*dy;
|
||||
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Assists", 126));
|
||||
@@ -93,9 +93,9 @@ void show_stats_label(int stage, int sx, int sy, int dy)
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hits", 118));
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary hit %%", 119));
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary hit %", 119));
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hit %%", 120));
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hit %", 120));
|
||||
sy += 2*dy;
|
||||
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary weapon shots", 121));
|
||||
@@ -104,9 +104,9 @@ void show_stats_label(int stage, int sx, int sy, int dy)
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hits", 123));
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary hit %%", 124));
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary hit %", 124));
|
||||
sy += dy;
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hit %%", 125));
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hit %", 125));
|
||||
sy += 2*dy;
|
||||
|
||||
gr_printf_menu(sx,sy,"%s", XSTR( "Assists", 126));
|
||||
@@ -153,13 +153,13 @@ void show_stats_numbers(int stage, int sx, int sy, int dy,int add_mission)
|
||||
if(Active_player->stats.mp_shots_fired>0)
|
||||
pct=(float)100.0*((float)Active_player->stats.mp_shots_hit/(float)Active_player->stats.mp_shots_fired);
|
||||
else pct=(float)0.0;
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %");
|
||||
gr_printf_menu(sx,sy,"%s", text);
|
||||
sy += dy;
|
||||
if(Active_player->stats.mp_shots_fired>0)
|
||||
pct=(float)100.0*((float)Active_player->stats.mp_bonehead_hits/(float)Active_player->stats.mp_shots_fired);
|
||||
else pct=(float)0.0;
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %");
|
||||
gr_printf_menu(sx,sy,"%s", text);
|
||||
sy += 2*dy;
|
||||
|
||||
@@ -176,13 +176,13 @@ void show_stats_numbers(int stage, int sx, int sy, int dy,int add_mission)
|
||||
if(Active_player->stats.ms_shots_fired>0)
|
||||
pct=(float)100.0*((float)Active_player->stats.ms_shots_hit/(float)Active_player->stats.ms_shots_fired);
|
||||
else pct=(float)0.0;
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %");
|
||||
gr_printf_menu(sx,sy,"%s", text);
|
||||
sy += dy;
|
||||
if(Active_player->stats.ms_shots_fired>0)
|
||||
pct=(float)100.0*((float)Active_player->stats.ms_bonehead_hits/(float)Active_player->stats.ms_shots_fired);
|
||||
else pct=(float)0.0;
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %");
|
||||
gr_printf_menu(sx,sy,"%s", text);
|
||||
sy += 2*dy;
|
||||
|
||||
@@ -237,13 +237,13 @@ void show_stats_numbers(int stage, int sx, int sy, int dy,int add_mission)
|
||||
if((Active_player->stats.p_shots_fired + add.p_shots_fired)>0)
|
||||
pct=(float)100.0*((float)(Active_player->stats.p_shots_hit+add.p_shots_hit)/(float)(Active_player->stats.p_shots_fired + add.p_shots_fired));
|
||||
else pct=(float)0.0;
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %");
|
||||
gr_printf_menu(sx,sy,"%s", text);
|
||||
sy += dy;
|
||||
if((Active_player->stats.p_bonehead_hits + add.p_bonehead_hits)>0)
|
||||
pct=(float)100.0*((float)(Active_player->stats.p_bonehead_hits+add.p_bonehead_hits)/(float)(Active_player->stats.p_shots_fired + add.p_shots_fired));
|
||||
else pct=(float)0.0;
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %");
|
||||
gr_printf_menu(sx,sy,"%s", text);
|
||||
sy += 2*dy;
|
||||
|
||||
@@ -260,13 +260,13 @@ void show_stats_numbers(int stage, int sx, int sy, int dy,int add_mission)
|
||||
if((Active_player->stats.s_shots_fired+add.s_shots_fired)>0)
|
||||
pct=(float)100.0*((float)(Active_player->stats.s_shots_hit + add.s_shots_hit)/(float)(Active_player->stats.s_shots_fired + add.s_shots_fired));
|
||||
else pct=(float)0.0;
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %");
|
||||
gr_printf_menu(sx,sy,"%s", text);
|
||||
sy += dy;
|
||||
if((Active_player->stats.s_bonehead_hits + add.s_bonehead_hits)>0)
|
||||
pct=(float)100.0*((float)(Active_player->stats.s_bonehead_hits+add.s_bonehead_hits)/(float)(Active_player->stats.s_shots_fired+add.s_shots_fired));
|
||||
else pct=(float)0.0;
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
|
||||
sprintf(text,"%d",(int)pct); strcat_s(text," %");
|
||||
gr_printf_menu(sx,sy,"%s", text);
|
||||
sy += 2*dy;
|
||||
|
||||
|
||||
@@ -136,6 +136,17 @@ void FrameProfiler::processEvent(const trace_event* event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_mainThreadID == -1) {
|
||||
// We need the ID of the main thread to filter out multi threaded events. We just assume that the first event
|
||||
// of the main process we see is from the main thread. That should be a safe assumption.
|
||||
_mainThreadID = event->tid;
|
||||
}
|
||||
|
||||
if (event->tid != _mainThreadID) {
|
||||
// Multithreaded events don't have a deterministic sequence and that confuses the old profiling system
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->duration == 0) {
|
||||
// Discard events with no duration
|
||||
return;
|
||||
|
||||
@@ -41,6 +41,8 @@ class FrameProfiler {
|
||||
|
||||
SCP_vector<profile_sample_history> history;
|
||||
|
||||
std::int64_t _mainThreadID = -1;
|
||||
|
||||
SCP_string content;
|
||||
|
||||
/**
|
||||
|
||||
@@ -89,7 +89,7 @@ Category CutsceneProcessVideoData("Process video data", true);
|
||||
Category CutsceneProcessAudioData("Process audio data", false);
|
||||
|
||||
Category CutsceneFFmpegVideoDecoder("FFmpeg decode video", false);
|
||||
Category CutsceneFFmpegAudioDecoder("FFmpeg decode video", false);
|
||||
Category CutsceneFFmpegAudioDecoder("FFmpeg decode audio", false);
|
||||
|
||||
Category LoadMissionLoad("Load mission", false);
|
||||
Category LoadPostMissionLoad("Mission load post processing", false);
|
||||
|
||||
+57
-48
@@ -28,6 +28,7 @@
|
||||
|
||||
static const char *Default_shockwave_2D_filename = "shockwave01";
|
||||
static const char *Default_shockwave_3D_filename = "shockwave.pof";
|
||||
static int Default_2D_shockwave_index = -1;
|
||||
static int Default_shockwave_loaded = 0;
|
||||
|
||||
SCP_vector<shockwave_info> Shockwave_info;
|
||||
@@ -158,8 +159,8 @@ int shockwave_create(int parent_objnum, vec3d *pos, shockwave_create_info *sci,
|
||||
*/
|
||||
void shockwave_delete(object *objp)
|
||||
{
|
||||
Assert(objp->type == OBJ_SHOCKWAVE);
|
||||
Assert(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES);
|
||||
Assertion(objp->type == OBJ_SHOCKWAVE, "shockwave_delete() called on an object with a type of %d instead of OBJ_SHOCKWAVE (%d); get a coder!\n", objp->type, OBJ_SHOCKWAVE);
|
||||
Assertion(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES, "shockwave_delete() called on an object with an invalid instance of %d (should be 0-%d); get a coder!\n", objp->instance, MAX_SHOCKWAVES - 1);
|
||||
|
||||
Shockwaves[objp->instance].flags = 0;
|
||||
Shockwaves[objp->instance].objnum = -1;
|
||||
@@ -190,7 +191,7 @@ void shockwave_set_framenum(int index)
|
||||
shockwave *sw;
|
||||
shockwave_info *si;
|
||||
|
||||
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
|
||||
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_set_framenum called with an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
|
||||
|
||||
sw = &Shockwaves[index];
|
||||
si = &Shockwave_info[sw->shockwave_info_index];
|
||||
@@ -236,8 +237,8 @@ void shockwave_move(object *shockwave_objp, float frametime)
|
||||
float blast,damage;
|
||||
int i;
|
||||
|
||||
Assert(shockwave_objp->type == OBJ_SHOCKWAVE);
|
||||
Assert(shockwave_objp->instance >= 0 && shockwave_objp->instance < MAX_SHOCKWAVES);
|
||||
Assertion(shockwave_objp->type == OBJ_SHOCKWAVE, "shockwave_move() called on an object of type %d instead of OBJ_SHOCKWAVE (%d); get a coder!\n", shockwave_objp->type, OBJ_SHOCKWAVE);
|
||||
Assertion(shockwave_objp->instance >= 0 && shockwave_objp->instance < MAX_SHOCKWAVES, "shockwave_move() called on an object with an instance of %d (should be 0-%d); get a coder!\n", shockwave_objp->instance, MAX_SHOCKWAVES - 1);
|
||||
sw = &Shockwaves[shockwave_objp->instance];
|
||||
|
||||
// if the shockwave has a delay on it
|
||||
@@ -367,8 +368,8 @@ void shockwave_render(object *objp, model_draw_list *scene)
|
||||
shockwave *sw;
|
||||
vertex p;
|
||||
|
||||
Assert(objp->type == OBJ_SHOCKWAVE);
|
||||
Assert(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES);
|
||||
Assertion(objp->type == OBJ_SHOCKWAVE, "shockwave_render() called on an object of type %d instead of OBJ_SHOCKWAVE (%d); get a coder!\n", objp->type, OBJ_SHOCKWAVE);
|
||||
Assertion(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES, "shockwave_render() called on an object with an instance of %d (should be 0-%d); get a coder!\n", objp->instance, MAX_SHOCKWAVES - 1);
|
||||
|
||||
sw = &Shockwaves[objp->instance];
|
||||
|
||||
@@ -395,11 +396,11 @@ void shockwave_render(object *objp, model_draw_list *scene)
|
||||
|
||||
model_render_queue( &render_info, scene, sw->model_id, &Objects[sw->objnum].orient, &sw->pos);
|
||||
|
||||
if ( Cmdline_fb_explosions ) {
|
||||
if ( Cmdline_fb_explosions && Default_2D_shockwave_index > -1) {
|
||||
g3_transfer_vertex(&p, &sw->pos);
|
||||
|
||||
float intensity = ((sw->time_elapsed / sw->total_time) > 0.9f) ? (1.0f - (sw->time_elapsed / sw->total_time))*10.0f : 1.0f;
|
||||
batching_add_distortion_bitmap_rotated(Shockwave_info[1].bitmap_id + shockwave_get_framenum(objp->instance, Shockwave_info[1].bitmap_id), &p, fl_radians(sw->rot_angles.p), sw->radius, intensity);
|
||||
batching_add_distortion_bitmap_rotated(Shockwave_info[Default_2D_shockwave_index].bitmap_id + shockwave_get_framenum(objp->instance, Shockwave_info[Default_2D_shockwave_index].bitmap_id), &p, fl_radians(sw->rot_angles.p), sw->radius, intensity);
|
||||
}
|
||||
} else {
|
||||
g3_transfer_vertex(&p, &sw->pos);
|
||||
@@ -418,7 +419,6 @@ void shockwave_render(object *objp, model_draw_list *scene)
|
||||
*/
|
||||
int shockwave_load(const char *s_name, bool shock_3D)
|
||||
{
|
||||
size_t i;
|
||||
int s_index = -1;
|
||||
shockwave_info *si = NULL;
|
||||
|
||||
@@ -428,9 +428,9 @@ int shockwave_load(const char *s_name, bool shock_3D)
|
||||
if ( !VALID_FNAME(s_name) )
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < Shockwave_info.size(); i++) {
|
||||
if ( !stricmp(Shockwave_info[i].filename, s_name) ) {
|
||||
s_index = (int)i;
|
||||
for (auto it = Shockwave_info.cbegin(); it != Shockwave_info.cend(); ++it) {
|
||||
if ( !stricmp(it->filename, s_name) ) {
|
||||
s_index = (int)std::distance(Shockwave_info.cbegin(), it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -494,6 +494,7 @@ void shockwave_level_init()
|
||||
mprintf(("SHOCKWAVE => Default model load: SUCCEEDED!!\n"));
|
||||
else
|
||||
mprintf(("SHOCKWAVE => Default model load: FAILED!! Falling back to 2D effect...\n"));
|
||||
Assertion(i <= 0, "Default 3D shockwave should be the first shockwave loaded, but instead got loaded into index %d; get a coder!\n", i);
|
||||
}
|
||||
|
||||
// next, try the 2d shockwave effect, unless the 3d effect was loaded
|
||||
@@ -507,6 +508,8 @@ void shockwave_level_init()
|
||||
mprintf(("SHOCKWAVE => Default animation load: SUCCEEDED!!\n"));
|
||||
else
|
||||
mprintf(("SHOCKWAVE => Default animation load: FAILED!! Checking if 3d effect was already tried...\n"));
|
||||
Assertion(i <= 1, "Default 2D shockwave should be either the first or second shockwave loaded, but instead got loaded into index %d; get a coder!\n", i);
|
||||
Default_2D_shockwave_index = i;
|
||||
}
|
||||
|
||||
// chief1983 - The first patch broke mods that don't provide a 2d shockwave or define a specific shockwave for each model/weapon (shame on them)
|
||||
@@ -521,6 +524,7 @@ void shockwave_level_init()
|
||||
mprintf(("SHOCKWAVE => Default model load: SUCCEEDED!!\n"));
|
||||
else
|
||||
mprintf(("SHOCKWAVE => Default model load: FAILED!! No effect loaded...\n"));
|
||||
Assertion(i <= 0, "Default 3D shockwave should be the first shockwave loaded, but instead got loaded into index %d; get a coder!\n", i);
|
||||
}
|
||||
|
||||
if (i < 0)
|
||||
@@ -530,11 +534,14 @@ void shockwave_level_init()
|
||||
} else {
|
||||
// have to make sure that the default 3D model is still valid and usable
|
||||
// the 2D shockwave shouldn't need anything like this
|
||||
if (Shockwave_info[0].model_id >= 0)
|
||||
if (Shockwave_info[0].model_id >= 0) {
|
||||
Assertion(!strcmp(Shockwave_info[0].filename, Default_shockwave_3D_filename), "Shockwave_info[0] should be the default shockwave, but somehow isn't.\nShockwave_info[0].filename = \"%s\"\nDefault_shockwave_3D_filename = \"%s\"\nGet a coder!\n", Shockwave_info[0].filename, Default_shockwave_3D_filename);
|
||||
Shockwave_info[0].model_id = model_load( Default_shockwave_3D_filename, 0, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
Assert( ((Shockwave_info[0].bitmap_id >= 0) || (Shockwave_info[0].model_id >= 0)) );
|
||||
Assertion( !Shockwave_info.empty(), "Default shockwave claims to be loaded, but Shockwave_info vector is empty!");
|
||||
Assertion( ((Shockwave_info[0].bitmap_id >= 0) || (Shockwave_info[0].model_id >= 0)), "Default shockwave claims to be loaded, but has no bitmap or model; get a coder!\n" );
|
||||
|
||||
list_init(&Shockwave_list);
|
||||
|
||||
@@ -557,28 +564,32 @@ void shockwave_level_close()
|
||||
|
||||
shockwave_delete_all();
|
||||
|
||||
size_t i;
|
||||
Assertion( !Shockwave_info.empty(), "Shockwave_info is empty in shockwave_level_close() despite theoretically having been initialized correctly; get a coder!\n");
|
||||
|
||||
// unload default shockwave, and erase all others
|
||||
for (i = 0; i < Shockwave_info.size(); i++) {
|
||||
if ( !i ) {
|
||||
if (Shockwave_info[i].bitmap_id >= 0)
|
||||
bm_unload( Shockwave_info[i].bitmap_id );
|
||||
else if (Shockwave_info[i].model_id >= 0)
|
||||
model_page_out_textures( Shockwave_info[i].model_id );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Shockwave_info[i].bitmap_id >= 0)
|
||||
bm_release( Shockwave_info[i].bitmap_id );
|
||||
|
||||
if (Shockwave_info[i].model_id >= 0)
|
||||
model_unload( Shockwave_info[i].model_id );
|
||||
|
||||
Shockwave_info.erase( Shockwave_info.begin() + i );
|
||||
auto it = Shockwave_info.begin();
|
||||
if (it->bitmap_id >= 0)
|
||||
bm_unload( it->bitmap_id );
|
||||
else if (it->model_id >= 0)
|
||||
model_page_out_textures( it->model_id );
|
||||
if (Default_2D_shockwave_index == 1) {
|
||||
// 3D shockwaves and framebuffer shockwaves are both enabled and the default 2D shockwave is in the next slot of the vector
|
||||
++it;
|
||||
Assertion(it->bitmap_id >= 0, "Default 2D shockwave was loaded but is somehow missing its bitmap; get a coder!\n");
|
||||
bm_unload(it->bitmap_id);
|
||||
}
|
||||
|
||||
for (++it; it != Shockwave_info.end(); ++it) {
|
||||
if (it->bitmap_id >= 0)
|
||||
bm_release( it->bitmap_id );
|
||||
|
||||
if (it->model_id >= 0)
|
||||
model_unload( it->model_id );
|
||||
}
|
||||
|
||||
// if there's no extra shockwaves, this is still fine (erasing from end() to end() is both valid and a no-op)
|
||||
Shockwave_info.erase( Shockwave_info.begin() + (Default_2D_shockwave_index == 1 ? 2 : 1), Shockwave_info.end() );
|
||||
|
||||
Shockwave_inited = 0;
|
||||
}
|
||||
|
||||
@@ -605,7 +616,7 @@ void shockwave_move_all(float frametime)
|
||||
*/
|
||||
int shockwave_get_weapon_index(int index)
|
||||
{
|
||||
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
|
||||
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_weapon_index() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
|
||||
return Shockwaves[index].weapon_info_index;
|
||||
}
|
||||
|
||||
@@ -614,7 +625,7 @@ int shockwave_get_weapon_index(int index)
|
||||
*/
|
||||
float shockwave_get_max_radius(int index)
|
||||
{
|
||||
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
|
||||
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_max_radius() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
|
||||
return Shockwaves[index].outer_radius;
|
||||
}
|
||||
|
||||
@@ -623,7 +634,7 @@ float shockwave_get_max_radius(int index)
|
||||
*/
|
||||
float shockwave_get_min_radius(int index)
|
||||
{
|
||||
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
|
||||
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_min_radius() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
|
||||
return Shockwaves[index].inner_radius;
|
||||
}
|
||||
|
||||
@@ -632,7 +643,7 @@ float shockwave_get_min_radius(int index)
|
||||
*/
|
||||
float shockwave_get_damage(int index)
|
||||
{
|
||||
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
|
||||
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_damage() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
|
||||
return Shockwaves[index].damage;
|
||||
}
|
||||
|
||||
@@ -641,7 +652,7 @@ float shockwave_get_damage(int index)
|
||||
*/
|
||||
int shockwave_get_damage_type_idx(int index)
|
||||
{
|
||||
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
|
||||
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_damage_type_idx() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
|
||||
return Shockwaves[index].damage_type_idx;
|
||||
}
|
||||
|
||||
@@ -650,25 +661,23 @@ int shockwave_get_damage_type_idx(int index)
|
||||
*/
|
||||
int shockwave_get_flags(int index)
|
||||
{
|
||||
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
|
||||
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_flags() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
|
||||
return Shockwaves[index].flags;
|
||||
}
|
||||
|
||||
void shockwave_page_in()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
// load in shockwaves
|
||||
for (i = 0; i < Shockwave_info.size(); i++) {
|
||||
if (Shockwave_info[i].bitmap_id >= 0) {
|
||||
bm_page_in_texture( Shockwave_info[i].bitmap_id, Shockwave_info[i].num_frames );
|
||||
} else if (Shockwave_info[i].model_id >= 0) {
|
||||
for (auto it = Shockwave_info.begin(); it != Shockwave_info.end(); ++it) {
|
||||
if (it->bitmap_id >= 0) {
|
||||
bm_page_in_texture( it->bitmap_id, it->num_frames );
|
||||
} else if (it->model_id >= 0) {
|
||||
// for a model we have to run model_load() on it again to make sure
|
||||
// that it's ref_count is sane for this mission
|
||||
int idx __UNUSED = model_load( Shockwave_info[i].filename, 0, NULL );
|
||||
Assert( idx == Shockwave_info[i].model_id );
|
||||
int idx __UNUSED = model_load( it->filename, 0, NULL );
|
||||
Assertion( idx == it->model_id , "Shockwave_info[" SIZE_T_ARG "] got two different model_ids: %d and %d. Filename is \"%s\". Get a coder!\n", std::distance(Shockwave_info.begin(), it), idx, it->model_id, it->filename);
|
||||
|
||||
model_page_in_textures( Shockwave_info[i].model_id );
|
||||
model_page_in_textures( it->model_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
-10
@@ -2337,12 +2337,8 @@ int parse_weapon(int subtype, bool replace, const char *filename)
|
||||
if ( optional_string("+Texture:") ) {
|
||||
stuff_string(fname, F_NAME, NAME_LENGTH);
|
||||
|
||||
// invisible textures are okay
|
||||
if (!stricmp(fname, "invisible")) {
|
||||
generic_anim_init(&bsip->texture);
|
||||
} else {
|
||||
generic_anim_init(&bsip->texture, fname);
|
||||
}
|
||||
// invisible textures are okay - see weapon_clean_entries()
|
||||
generic_anim_init(&bsip->texture, fname);
|
||||
}
|
||||
|
||||
// The E -- Dummied out due to not being used anywhere
|
||||
@@ -3081,7 +3077,15 @@ void weapon_clean_entries()
|
||||
int removed = 0;
|
||||
|
||||
for (int s_idx = 0; s_idx < wip->b_info.beam_num_sections; s_idx++) {
|
||||
if ( !strlen(wip->b_info.sections[s_idx].texture.filename) ) {
|
||||
beam_weapon_section_info *bsip = &wip->b_info.sections[s_idx];
|
||||
|
||||
// If this is an invisible beam section, we want to keep it. Originally invisible sections were initialized as they were parsed,
|
||||
// but then they were inadvertently cleaned up in this function. So let's properly set the filename here while not removing the section.
|
||||
if ( !stricmp(bsip->texture.filename, "invisible") ) {
|
||||
memset(bsip->texture.filename, 0, MAX_FILENAME_LEN);
|
||||
}
|
||||
// Now remove empty beam sections as before
|
||||
else if ( !strlen(bsip->texture.filename) ) {
|
||||
int new_idx = s_idx + 1;
|
||||
|
||||
while (new_idx < MAX_BEAM_SECTIONS) {
|
||||
@@ -3097,6 +3101,10 @@ void weapon_clean_entries()
|
||||
mprintf(("NOTE: weapon-cleanup is removing %i stale beam sections, out of %i original, from '%s'.\n", removed, wip->b_info.beam_num_sections, wip->name));
|
||||
wip->b_info.beam_num_sections -= removed;
|
||||
}
|
||||
|
||||
if (wip->b_info.beam_num_sections == 0) {
|
||||
Warning(LOCATION, "The beam '%s' has 0 usable sections!", wip->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4518,7 +4526,11 @@ static void weapon_set_state(weapon_info* wip, weapon* wp, WeaponState state)
|
||||
return;
|
||||
}
|
||||
|
||||
if (wp->weapon_state == WeaponState::INVALID)
|
||||
auto current_state = wp->weapon_state;
|
||||
|
||||
wp->weapon_state = state;
|
||||
|
||||
if (current_state == WeaponState::INVALID)
|
||||
{
|
||||
// First weapon state, create the in-flight effect
|
||||
auto map_entry = wip->state_effects.find(WeaponState::NORMAL);
|
||||
@@ -4534,8 +4546,6 @@ static void weapon_set_state(weapon_info* wip, weapon* wp, WeaponState state)
|
||||
}
|
||||
}
|
||||
|
||||
wp->weapon_state = state;
|
||||
|
||||
auto map_entry = wip->state_effects.find(wp->weapon_state);
|
||||
|
||||
if (map_entry != wip->state_effects.end())
|
||||
|
||||
+36
-16
@@ -30,6 +30,21 @@ void initial_status_mark_dock_leader_helper(object *objp, dock_function_info *in
|
||||
void initial_status_unmark_dock_handled_flag(object *objp, dock_function_info *infop);
|
||||
void reset_arrival_to_false(int shipnum, bool reset_wing);
|
||||
|
||||
/**
|
||||
* @brief Handles setting a flag on a flagset when the value is inconsistent
|
||||
*
|
||||
* This is necessary in case multiple ships with inconsistent object flags have been selected in which case
|
||||
* that flag may not be edited since it would corrupt the value of that flag. This function simplifies handling
|
||||
* that case.
|
||||
*/
|
||||
template<typename T>
|
||||
static void handle_inconsistent_flag(flagset<T>& flags, T flag, int value) {
|
||||
if (value == 1) {
|
||||
flags.set(flag);
|
||||
} else if (value == 0) {
|
||||
flags.remove(flag);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// initial_status dialog
|
||||
@@ -438,17 +453,21 @@ void initial_status::OnOK()
|
||||
if (hflag)
|
||||
MODIFY(objp->hull_strength, (float) m_hull);
|
||||
|
||||
objp->flags.set(Object::Object_Flags::No_shields, m_has_shields == 0);
|
||||
if (m_has_shields == 1)
|
||||
objp->flags.remove(Object::Object_Flags::No_shields);
|
||||
else if (m_has_shields == 0)
|
||||
objp->flags.set(Object::Object_Flags::No_shields);
|
||||
|
||||
auto shipp = &Ships[get_ship_from_obj(objp)];
|
||||
|
||||
shipp->flags.set(Ship::Ship_Flags::Force_shields_on, m_force_shields == 1);
|
||||
shipp->flags.set(Ship::Ship_Flags::Ship_locked, m_ship_locked == 1);
|
||||
shipp->flags.set(Ship::Ship_Flags::Weapons_locked, m_weapons_locked == 1);
|
||||
shipp->flags.set(Ship::Ship_Flags::Primaries_locked, m_primaries_locked == 1);
|
||||
shipp->flags.set(Ship::Ship_Flags::Secondaries_locked, m_secondaries_locked == 1);
|
||||
shipp->flags.set(Ship::Ship_Flags::Lock_all_turrets_initially, m_turrets_locked == 1);
|
||||
shipp->flags.set(Ship::Ship_Flags::Afterburner_locked, m_afterburner_locked == 1);
|
||||
// We need to ensure that we handle the inconsistent "boolean" value correctly
|
||||
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Force_shields_on, m_force_shields);
|
||||
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Ship_locked, m_ship_locked);
|
||||
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Weapons_locked, m_weapons_locked);
|
||||
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Primaries_locked, m_primaries_locked);
|
||||
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Secondaries_locked, m_secondaries_locked);
|
||||
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Lock_all_turrets_initially, m_turrets_locked);
|
||||
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Afterburner_locked, m_afterburner_locked);
|
||||
}
|
||||
|
||||
objp = GET_NEXT(objp);
|
||||
@@ -459,15 +478,16 @@ void initial_status::OnOK()
|
||||
MODIFY(Objects[cur_object_index].shield_quadrant[0], (float) m_shields);
|
||||
MODIFY(Objects[cur_object_index].hull_strength, (float) m_hull);
|
||||
|
||||
Objects[cur_object_index].flags.set(Object::Object_Flags::No_shields, m_has_shields != 0);
|
||||
Objects[cur_object_index].flags.set(Object::Object_Flags::No_shields, m_has_shields == 0);
|
||||
|
||||
Ships[m_ship].flags.set(Ship::Ship_Flags::Force_shields_on, m_force_shields == 1);
|
||||
Ships[m_ship].flags.set(Ship::Ship_Flags::Ship_locked, m_ship_locked == 1);
|
||||
Ships[m_ship].flags.set(Ship::Ship_Flags::Weapons_locked, m_weapons_locked == 1);
|
||||
Ships[m_ship].flags.set(Ship::Ship_Flags::Primaries_locked, m_primaries_locked == 1);
|
||||
Ships[m_ship].flags.set(Ship::Ship_Flags::Secondaries_locked, m_secondaries_locked == 1);
|
||||
Ships[m_ship].flags.set(Ship::Ship_Flags::Lock_all_turrets_initially, m_turrets_locked == 1);
|
||||
Ships[m_ship].flags.set(Ship::Ship_Flags::Afterburner_locked, m_afterburner_locked == 1);
|
||||
// We need to ensure that we handle the inconsistent "boolean" value correctly. Not strictly needed here but just to be safe...
|
||||
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Force_shields_on, m_force_shields);
|
||||
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Ship_locked, m_ship_locked);
|
||||
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Weapons_locked, m_weapons_locked);
|
||||
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Primaries_locked, m_primaries_locked);
|
||||
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Secondaries_locked, m_secondaries_locked);
|
||||
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Lock_all_turrets_initially, m_turrets_locked);
|
||||
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Afterburner_locked, m_afterburner_locked);
|
||||
}
|
||||
|
||||
if (m_team_color_setting.IsWindowEnabled() && m_team_color_setting.GetCurSel() > 0)
|
||||
|
||||
@@ -2201,7 +2201,7 @@ int CFred_mission_save::save_mission_info() {
|
||||
fout("\n+Flags:");
|
||||
}
|
||||
|
||||
fout(" %d", The_mission.flags);
|
||||
fout(" %" PRIu64, The_mission.flags.to_u64());
|
||||
|
||||
// maybe write out Nebula intensity
|
||||
if (The_mission.flags[Mission::Mission_Flags::Fullneb]) {
|
||||
|
||||
@@ -210,22 +210,24 @@ void orient_editor::update_object(object *ptr)
|
||||
vec3d v, loc;
|
||||
matrix m;
|
||||
|
||||
memset(&v, 0, sizeof(vec3d));
|
||||
vm_vec_zero(&v);
|
||||
loc.xyz.x = convert(m_location_x);
|
||||
loc.xyz.y = convert(m_location_y);
|
||||
loc.xyz.z = convert(m_location_z);
|
||||
if (((CButton *) GetDlgItem(IDC_POINT_TO_OBJECT))->GetCheck() == 1) {
|
||||
v = Objects[index[m_object_index]].pos;
|
||||
vm_vec_sub2(&v, &ptr->pos);
|
||||
|
||||
if (m_object_index >= 0) {
|
||||
v = Objects[index[m_object_index]].pos;
|
||||
vm_vec_sub2(&v, &ptr->pos);
|
||||
}
|
||||
} else if (((CButton *) GetDlgItem(IDC_POINT_TO_LOCATION))->GetCheck() == 1) {
|
||||
vm_vec_sub(&v, &loc, &ptr->pos);
|
||||
|
||||
} else {
|
||||
Assert(0); // neither radio button is checked.
|
||||
Assertion(0, "neither radio button is checked!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!v.xyz.x && !v.xyz.y && !v.xyz.z){
|
||||
if (IS_VEC_NULL(&v)) {
|
||||
return; // can't point to itself.
|
||||
}
|
||||
|
||||
|
||||
+48
-65
@@ -2187,7 +2187,7 @@ void sexp_list_item::destroy()
|
||||
}
|
||||
}
|
||||
|
||||
int sexp_tree::add_default_operator(int op, int argnum)
|
||||
int sexp_tree::add_default_operator(int op_index, int argnum)
|
||||
{
|
||||
char buf[256];
|
||||
int index;
|
||||
@@ -2196,7 +2196,7 @@ int sexp_tree::add_default_operator(int op, int argnum)
|
||||
|
||||
h = item_handle;
|
||||
index = item_index;
|
||||
if (get_default_value(&item, buf, op, argnum))
|
||||
if (get_default_value(&item, buf, op_index, argnum))
|
||||
return -1;
|
||||
|
||||
if (item.type & SEXPT_OPERATOR) {
|
||||
@@ -2206,57 +2206,48 @@ int sexp_tree::add_default_operator(int op, int argnum)
|
||||
item_handle = h;
|
||||
|
||||
} else {
|
||||
// special case for modify-variable (data added 1st arg is variable)
|
||||
//if ( !stricmp(Operators[op].text, "modify-variable") ) {
|
||||
if ( query_operator_argument_type(op, argnum) == OPF_VARIABLE_NAME)
|
||||
{
|
||||
if ((argnum == 0 && Operators[op].value == OP_MODIFY_VARIABLE) ||
|
||||
(argnum == 8 && Operators[op].value == OP_ADD_BACKGROUND_BITMAP) ||
|
||||
(argnum == 5 && Operators[op].value == OP_ADD_SUN_BITMAP) ||
|
||||
(argnum == 2 && Operators[op].value == OP_STRING_CONCATENATE) ||
|
||||
(argnum == 1 && Operators[op].value == OP_INT_TO_STRING) ||
|
||||
(argnum == 3 && Operators[op].value == OP_STRING_GET_SUBSTRING) ||
|
||||
(argnum == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING) ||
|
||||
(argnum == 1 && Operators[op].value == OP_COPY_VARIABLE_FROM_INDEX) ||
|
||||
(argnum == 1 && Operators[op].value == OP_SCRIPT_EVAL_STRING))
|
||||
{
|
||||
|
||||
int sexp_var_index = get_index_sexp_variable_name(item.text);
|
||||
Assert(sexp_var_index != -1);
|
||||
int type = SEXPT_VALID | SEXPT_VARIABLE;
|
||||
if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_STRING) {
|
||||
type |= SEXPT_STRING;
|
||||
} else if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_NUMBER) {
|
||||
type |= SEXPT_NUMBER;
|
||||
} else {
|
||||
Int3();
|
||||
}
|
||||
|
||||
char node_text[2*TOKEN_LENGTH + 2];
|
||||
sprintf(node_text, "%s(%s)", item.text, Sexp_variables[sexp_var_index].text);
|
||||
add_variable_data(node_text, type);
|
||||
// special case for sexps that take variables
|
||||
if (query_operator_argument_type(op_index, argnum) == OPF_VARIABLE_NAME) {
|
||||
int sexp_var_index = get_index_sexp_variable_name(item.text);
|
||||
Assert(sexp_var_index != -1);
|
||||
int type = SEXPT_VALID | SEXPT_VARIABLE;
|
||||
if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_STRING) {
|
||||
type |= SEXPT_STRING;
|
||||
} else if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_NUMBER) {
|
||||
type |= SEXPT_NUMBER;
|
||||
} else {
|
||||
// the the variable name
|
||||
char buf2[256];
|
||||
Assert(argnum == 1);
|
||||
sexp_list_item temp_item;
|
||||
get_default_value(&temp_item, buf2, op, 0);
|
||||
int sexp_var_index = get_index_sexp_variable_name(temp_item.text);
|
||||
Assert(sexp_var_index != -1);
|
||||
|
||||
// from name get type
|
||||
int temp_type = Sexp_variables[sexp_var_index].type;
|
||||
int type = 0;
|
||||
if (temp_type & SEXP_VARIABLE_NUMBER) {
|
||||
type = SEXPT_VALID | SEXPT_NUMBER;
|
||||
} else if (temp_type & SEXP_VARIABLE_STRING) {
|
||||
type = SEXPT_VALID | SEXPT_STRING;
|
||||
} else {
|
||||
Int3();
|
||||
}
|
||||
add_data(item.text, type);
|
||||
Int3();
|
||||
}
|
||||
} else {
|
||||
|
||||
char node_text[2*TOKEN_LENGTH + 2];
|
||||
sprintf(node_text, "%s(%s)", item.text, Sexp_variables[sexp_var_index].text);
|
||||
add_variable_data(node_text, type);
|
||||
}
|
||||
// modify-variable data type depends on type of variable being modified
|
||||
// (we know this block is handling the second argument since it's not OPF_VARIABLE_NAME)
|
||||
else if (Operators[op_index].value == OP_MODIFY_VARIABLE) {
|
||||
// the the variable name
|
||||
char buf2[256];
|
||||
Assert(argnum == 1);
|
||||
sexp_list_item temp_item;
|
||||
get_default_value(&temp_item, buf2, op_index, 0);
|
||||
int sexp_var_index = get_index_sexp_variable_name(temp_item.text);
|
||||
Assert(sexp_var_index != -1);
|
||||
|
||||
// from name get type
|
||||
int temp_type = Sexp_variables[sexp_var_index].type;
|
||||
int type = 0;
|
||||
if (temp_type & SEXP_VARIABLE_NUMBER) {
|
||||
type = SEXPT_VALID | SEXPT_NUMBER;
|
||||
} else if (temp_type & SEXP_VARIABLE_STRING) {
|
||||
type = SEXPT_VALID | SEXPT_STRING;
|
||||
} else {
|
||||
Int3();
|
||||
}
|
||||
add_data(item.text, type);
|
||||
}
|
||||
// all other sexps and parameters
|
||||
else {
|
||||
add_data(item.text, item.type);
|
||||
}
|
||||
}
|
||||
@@ -3233,7 +3224,7 @@ int sexp_tree::get_modify_variable_type(int parent)
|
||||
|
||||
void sexp_tree::verify_and_fix_arguments(int node)
|
||||
{
|
||||
int op, arg_num, type, tmp;
|
||||
int op_index, arg_num, type, tmp;
|
||||
sexp_list_item *list, *ptr;
|
||||
bool is_variable_arg = false;
|
||||
|
||||
@@ -3242,8 +3233,8 @@ void sexp_tree::verify_and_fix_arguments(int node)
|
||||
return;
|
||||
|
||||
was_here = true;
|
||||
op = get_operator_index(tree_nodes[node].text);
|
||||
if (op < 0)
|
||||
op_index = get_operator_index(tree_nodes[node].text);
|
||||
if (op_index < 0)
|
||||
return;
|
||||
|
||||
tmp = item_index;
|
||||
@@ -3252,7 +3243,7 @@ void sexp_tree::verify_and_fix_arguments(int node)
|
||||
item_index = tree_nodes[node].child;
|
||||
while (item_index >= 0) {
|
||||
// get listing of valid argument values for node item_index
|
||||
type = query_operator_argument_type(op, arg_num);
|
||||
type = query_operator_argument_type(op_index, arg_num);
|
||||
// special case for modify-variable
|
||||
if (type == OPF_AMBIGUOUS) {
|
||||
is_variable_arg = true;
|
||||
@@ -3260,7 +3251,7 @@ void sexp_tree::verify_and_fix_arguments(int node)
|
||||
}
|
||||
if (query_restricted_opf_range(type)) {
|
||||
list = get_listing_opf(type, node, arg_num);
|
||||
if (!list && (arg_num >= Operators[op].min)) {
|
||||
if (!list && (arg_num >= Operators[op_index].min)) {
|
||||
free_node(item_index, 1);
|
||||
item_index = tmp;
|
||||
flag--;
|
||||
@@ -3274,15 +3265,7 @@ void sexp_tree::verify_and_fix_arguments(int node)
|
||||
char default_variable_text[TOKEN_LENGTH];
|
||||
if (tree_nodes[item_index].type & SEXPT_VARIABLE) {
|
||||
// special case for SEXPs which can modify a variable
|
||||
if ((arg_num == 0 && Operators[op].value == OP_MODIFY_VARIABLE) ||
|
||||
(arg_num == 8 && Operators[op].value == OP_ADD_BACKGROUND_BITMAP) ||
|
||||
(arg_num == 5 && Operators[op].value == OP_ADD_SUN_BITMAP) ||
|
||||
(arg_num == 2 && Operators[op].value == OP_STRING_CONCATENATE) ||
|
||||
(arg_num == 1 && Operators[op].value == OP_INT_TO_STRING) ||
|
||||
(arg_num == 3 && Operators[op].value == OP_STRING_GET_SUBSTRING) ||
|
||||
(arg_num == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING) ||
|
||||
(arg_num == 1 && Operators[op].value == OP_COPY_VARIABLE_FROM_INDEX))
|
||||
{
|
||||
if (type == OPF_VARIABLE_NAME) {
|
||||
// make text_ptr to start - before '('
|
||||
get_variable_name_from_sexp_tree_node_text(tree_nodes[item_index].text, default_variable_text);
|
||||
text_ptr = default_variable_text;
|
||||
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
|
||||
set(PREBUILT_VERSION_NAME "7775d50e9b162b9668160c4c0e7c8b9b4abeeb3c")
|
||||
set(PREBUILT_VERSION_NAME "d08440c3a886e1cd24357ee42cfbc7d25f035336")
|
||||
|
||||
set(FSO_PREBUILT_OVERRIDE "" CACHE PATH "Path to the prebuilt binaries, if empty the binaries will be downloaded.")
|
||||
set(PREBUILT_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/prebuilt")
|
||||
@@ -20,20 +20,20 @@ function(get_prebuilt_path OUT_VAR)
|
||||
endif()
|
||||
|
||||
set(PREBUILT_PATH)
|
||||
set(FILENAME "bin-${PREBUILT_VERSION_NAME}")
|
||||
set(TAG_NAME "bin-${PREBUILT_VERSION_NAME}")
|
||||
if(PLATFORM_WINDOWS)
|
||||
if (IS_64BIT)
|
||||
set(FILENAME "${FILENAME}-win64.zip")
|
||||
set(FILENAME "bin-win64.zip")
|
||||
else()
|
||||
set(FILENAME "${FILENAME}-win32.zip")
|
||||
set(FILENAME "bin-win32.zip")
|
||||
endif()
|
||||
elseif(PLATFORM_MAC)
|
||||
set(FILENAME "${FILENAME}-mac.tar.gz")
|
||||
set(FILENAME "bin-mac.tar.gz")
|
||||
else()
|
||||
# Use Linux binaries...
|
||||
set(FILENAME "${FILENAME}-linux.tar.gz")
|
||||
set(FILENAME "bin-linux.tar.gz")
|
||||
endif()
|
||||
set(DOWNLOAD_URL "https://bintray.com/scp-fs2open/FSO/download_file?file_path=${FILENAME}")
|
||||
set(DOWNLOAD_URL "https://github.com/scp-fs2open/scp-prebuilt/releases/download/${TAG_NAME}/${FILENAME}")
|
||||
set(DOWNLOAD_FILE "${CURRENT_ROOT}/${FILENAME}")
|
||||
|
||||
message(STATUS "Downloading prebuilt libraries from \"${DOWNLOAD_URL}\"")
|
||||
|
||||
@@ -53,3 +53,15 @@ TEST(FlagsetTests, three_flags) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(FlagsetTests, numeric_conversion) {
|
||||
{
|
||||
flagset<TestFlags> base{ TestFlags::First, TestFlags::Second, TestFlags::Another };
|
||||
|
||||
flagset<TestFlags> converted;
|
||||
|
||||
converted.from_u64(base.to_u64());
|
||||
|
||||
ASSERT_TRUE(base == converted);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
set(FSO_VERSION_MAJOR 3)
|
||||
set(FSO_VERSION_MINOR 8)
|
||||
set(FSO_VERSION_BUILD 0)
|
||||
set(FSO_VERSION_REVISION 0)
|
||||
set(FSO_VERSION_REVISION_STR )
|
||||
Reference in new issue
Block a user