mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 17:48:46 -10:00
Compare commits
165
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c5a72a5d3 | ||
|
|
e1591a7be1 | ||
|
|
e64299e533 | ||
|
|
fa3506f5a5 | ||
|
|
bd200d631d | ||
|
|
225c5ccd90 | ||
|
|
2958cb7ece | ||
|
|
affd2a40c6 | ||
|
|
591026084d | ||
|
|
acf1f160d9 | ||
|
|
7ec3d3f1ad | ||
|
|
6ea9d8d1f0 | ||
|
|
758514af77 | ||
|
|
d178d36ad2 | ||
|
|
4e0cb1f5f5 | ||
|
|
4b06b9730c | ||
|
|
6858371ebc | ||
|
|
f28082d241 | ||
|
|
1c500458fa | ||
|
|
876360c5fb | ||
|
|
489867c0dd | ||
|
|
32dee2889a | ||
|
|
52c537d7b8 | ||
|
|
90c868b8f5 | ||
|
|
9b590d6f2c | ||
|
|
e69e050412 | ||
|
|
880a2cbf26 | ||
|
|
8b55964a5c | ||
|
|
10b6640afd | ||
|
|
ba057dc137 | ||
|
|
eaafbabdaf | ||
|
|
3a3ca4e206 | ||
|
|
07a7ad3461 | ||
|
|
da166f35ba | ||
|
|
f73b142071 | ||
|
|
ce5bd90a7f | ||
|
|
1f7203ec0f | ||
|
|
c6fe99a1cc | ||
|
|
60d8ded285 | ||
|
|
5f6089df4f | ||
|
|
c2ab1f4edb | ||
|
|
3681add767 | ||
|
|
32d1af2c71 | ||
|
|
66fb035b2c | ||
|
|
a667d1f635 | ||
|
|
8f3cc556b7 | ||
|
|
b8b652874c | ||
|
|
87ed7e8d87 | ||
|
|
6f262613af | ||
|
|
245c32285d | ||
|
|
998c530ed0 | ||
|
|
ab44765c0d | ||
|
|
707ce957ef | ||
|
|
58185d11f4 | ||
|
|
7dfc7bef68 | ||
|
|
835e05c771 | ||
|
|
dbde386299 | ||
|
|
ee6e5aabd7 | ||
|
|
542f20bec1 | ||
|
|
8b68aa537b | ||
|
|
6c4ad6aac9 | ||
|
|
3e66436edf | ||
|
|
a8fe0f5b61 | ||
|
|
eca8d4f2cb | ||
|
|
0a69cc3cf2 | ||
|
|
55f1ed93d2 | ||
|
|
ed365d1349 | ||
|
|
be2f628ac3 | ||
|
|
4d0274b196 | ||
|
|
16e32a0d45 | ||
|
|
c85ef1f429 | ||
|
|
312a601ac6 | ||
|
|
70d5c7998c | ||
|
|
bec99b27f1 | ||
|
|
d3d8d82e31 | ||
|
|
f1495861b9 | ||
|
|
987abad6db | ||
|
|
869c021453 | ||
|
|
df5746b329 | ||
|
|
8209273f8c | ||
|
|
c14a37a826 | ||
|
|
308acbe7aa | ||
|
|
614d83ff4e | ||
|
|
9de34836d0 | ||
|
|
1b224c1361 | ||
|
|
6cccc502a1 | ||
|
|
83a191828a | ||
|
|
67026a1066 | ||
|
|
b24b08d168 | ||
|
|
54b21407f9 | ||
|
|
3225f25150 | ||
|
|
55aca9510d | ||
|
|
1374b52ef4 | ||
|
|
ecf99de11b | ||
|
|
af5b6a8c66 | ||
|
|
356cddb4ea | ||
|
|
14380d293e | ||
|
|
2ef033dcdd | ||
|
|
8255871336 | ||
|
|
671f73e9c4 | ||
|
|
0425f704fa | ||
|
|
a734cd64cf | ||
|
|
7645062496 | ||
|
|
9a1b674fce | ||
|
|
47b7077520 | ||
|
|
0a64aee4a5 | ||
|
|
b5447a8c1f | ||
|
|
ecceae93ae | ||
|
|
0cfe277247 | ||
|
|
eaa5fd636b | ||
|
|
693cd4f529 | ||
|
|
7b699aa196 | ||
|
|
1e351eeaf5 | ||
|
|
c555ae6dd7 | ||
|
|
45e81ae0a2 | ||
|
|
3336072f1c | ||
|
|
af8a5f6de2 | ||
|
|
2e219e9966 | ||
|
|
8992977832 | ||
|
|
134d7d311d | ||
|
|
eeb2cf35c9 | ||
|
|
1e3d2a91dc | ||
|
|
dfc6435268 | ||
|
|
d5d8ad17f7 | ||
|
|
e95554f27a | ||
|
|
b8defa5eec | ||
|
|
536e3866ef | ||
|
|
41872f2648 | ||
|
|
1e26052d19 | ||
|
|
6a41b039fc | ||
|
|
f4eb09eb21 | ||
|
|
948e778975 | ||
|
|
5060c02d95 | ||
|
|
cd5a95a88e | ||
|
|
ccab33c02a | ||
|
|
7c731f03fe | ||
|
|
922f8e7630 | ||
|
|
d528508ebf | ||
|
|
8c021f0503 | ||
|
|
a463d9a58d | ||
|
|
3daa7f58d4 | ||
|
|
d6f3811cf7 | ||
|
|
797dadc1d7 | ||
|
|
1262cc08c7 | ||
|
|
8b42ed0824 | ||
|
|
f69f70def8 | ||
|
|
5317c13304 | ||
|
|
7ca10c9b5e | ||
|
|
139f60e0d4 | ||
|
|
c71da021ce | ||
|
|
ceea0202b3 | ||
|
|
53b8bd1797 | ||
|
|
faef780270 | ||
|
|
58a04d32f5 | ||
|
|
356d18246e | ||
|
|
8f5b27873f | ||
|
|
6717395b54 | ||
|
|
32157fbe57 | ||
|
|
561e50e860 | ||
|
|
9f22090ce9 | ||
|
|
858dc8dedd | ||
|
|
4a7f059119 | ||
|
|
393a5ae1a2 | ||
|
|
0cc3dc9c13 | ||
|
|
1993f8bed7 |
No files matched your search
@@ -1,4 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*.{h,cpp}]
|
||||
indent_style = tab
|
||||
+3
-9
@@ -137,7 +137,7 @@ packages/
|
||||
*.swp
|
||||
|
||||
# *.lock - this is used and abused by many editors for many different things.
|
||||
# For the main ones I use (e.g. Eclipse), it should be excluded
|
||||
# For the main ones I use (e.g. Eclipse), it should be excluded
|
||||
# from source-control, but YMMV
|
||||
|
||||
*.lock
|
||||
@@ -149,7 +149,7 @@ packages/
|
||||
|
||||
####
|
||||
# Xcode temporary files that should never be committed
|
||||
#
|
||||
#
|
||||
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...
|
||||
|
||||
*~.nib
|
||||
@@ -263,12 +263,6 @@ xcuserdata
|
||||
# .xccheckout
|
||||
#
|
||||
# Per http://stackoverflow.com/questions/18340453/should-xccheckout-files-in-xcode5-be-ignored-under-vcs
|
||||
#
|
||||
#
|
||||
|
||||
*.xccheckout
|
||||
|
||||
####
|
||||
# Documentation
|
||||
#
|
||||
documentation/doxygen/*
|
||||
!documentation/doxygen/.gitkeep
|
||||
-75
@@ -1,75 +0,0 @@
|
||||
language: cpp
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libopenal-dev
|
||||
- libogg-dev
|
||||
- libvorbis-dev
|
||||
- build-essential
|
||||
- automake
|
||||
- autoconf
|
||||
- libsdl1.2-dev
|
||||
- libtheora-dev
|
||||
- libreadline6-dev
|
||||
- libpng12-dev
|
||||
- libjpeg62-dev
|
||||
- liblua5.1-0-dev
|
||||
- libjansson-dev
|
||||
- libtool
|
||||
coverity_scan:
|
||||
project:
|
||||
name: "scp-fs2open/fs2open.github.com"
|
||||
description: "Coverity via Travis CI"
|
||||
notification_email: [email protected]
|
||||
build_command_prepend: "./autogen.sh --enable-debug"
|
||||
build_command: "make -j2"
|
||||
# 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
|
||||
- secure: "C3wF967ZeliwwP1vC12EMIBOaC568n26Z/cPnwzn317ve59DWH3YSfPZVgvt08GzmaXITGGsJvPB+qxfGoKvQzYE4O1B73q81RpUe5pB3IhF+ThQ91VfQZIRJR5xEGJaLINUlHTTZGX5jxlkVO9wAcauVj/s3b8sQ3dvUZauPvk="
|
||||
matrix:
|
||||
include:
|
||||
# note that gcc Debug MUST be 1st for Coverity
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CONFIGURATION="Debug"
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: CONFIGURATION="Debug"
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CONFIGURATION="Debug" MACOSX_ARCH=i386
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CONFIGURATION="Debug" MACOSX_ARCH=x86_64
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CONFIGURATION="Release"
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: CONFIGURATION="Release"
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CONFIGURATION="Release" MACOSX_ARCH=i386
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CONFIGURATION="Release" MACOSX_ARCH=x86_64
|
||||
before_install:
|
||||
# ugly hack; if running a coverity scan abort all except the 1st build
|
||||
# see note re gcc compiler above needing to be 1st
|
||||
# also note that branch_pattern & the TRAVIS_BRANCH check must match
|
||||
# unfortunately COVERITY_SCAN_BRANCH isn't defined until later in the
|
||||
# build process
|
||||
- if ([[ "${TRAVIS_JOB_NUMBER##*.}" != "1" ]] && [[ "${TRAVIS_BRANCH}" == "coverity_scan" ]]); then false ; fi
|
||||
- ./ci/travis/before_install.sh
|
||||
install:
|
||||
- ./ci/travis/install.sh
|
||||
before_script:
|
||||
- ./ci/travis/before_script.sh
|
||||
script:
|
||||
- ./ci/travis/script.sh
|
||||
@@ -41,8 +41,6 @@ EXTRA_PROGRAMS = cfilearchiver cfileextractor
|
||||
## Begin utilitites
|
||||
##
|
||||
|
||||
CPPSOURCES=$(wildcard code/*/*.cpp code/*/*.h)
|
||||
|
||||
# cfilearchiver -- to create VPs
|
||||
cfilearchiver_SOURCES = \
|
||||
code/cfilearchiver/cfilearchiver.cpp
|
||||
@@ -58,11 +56,6 @@ tools: cfilearchiver cfileextractor
|
||||
clean-tools:
|
||||
-test -z "$(EXTRA_PROGRAMS)" || rm -f $(EXTRA_PROGRAMS)
|
||||
|
||||
## cppcheck : check for many code issues
|
||||
cppcheck: ${CPPSOURCES}
|
||||
cppcheck ${CPPSOURCES} --enable=all --platform=unix64 \
|
||||
--std=c99 --inline-suppr --quiet
|
||||
|
||||
##
|
||||
## End utilitites
|
||||
##
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
[](https://scan.coverity.com/projects/870)
|
||||
[](https://travis-ci.org/scp-fs2open/fs2open.github.com)
|
||||
|
||||
Welcome to Freespace Open!
|
||||
|
||||
In 2002 Volition released the source code for Freespace2. In the years since dedicated individuals have added countless new features to create a flexible and powerful space combat simulation engine. More info can be found on our [wiki](http://www.hard-light.net/wiki/index.php/Source_Code_Project)
|
||||
|
||||
People interested in contributing are encouraged to read [this thread](http://www.hard-light.net/forums/index.php?topic=82688.0)
|
||||
|
||||
The "projects" directory contains ready projects for:
|
||||
* Microsoft Visual C++ 6, 2005, 2008, 2010, 2011, 2013, 2015
|
||||
* Apple Xcode
|
||||
* Code::Blocks
|
||||
* Eclipse
|
||||
|
||||
|
||||
Review the commit logs to see what's new.
|
||||
|
||||
See the INSTALL file for instructions on how to build fs2_open, or open the relevant MSVC project
|
||||
@@ -1,16 +0,0 @@
|
||||
version: 3.7.3.{build}
|
||||
shallow_clone: true
|
||||
environment:
|
||||
matrix:
|
||||
- VisualStudioVersion: 10.0
|
||||
PlatformToolset: v100
|
||||
ProjectPath: projects/MSVC_2010/Freespace2.vcxproj
|
||||
- VisualStudioVersion: 11.0
|
||||
PlatformToolset: v110
|
||||
ProjectPath: projects/MSVC_2012/Freespace2.vcxproj
|
||||
- VisualStudioVersion: 12.0
|
||||
PlatformToolset: v120
|
||||
ProjectPath: projects/MSVC_2013/Freespace2.vcxproj
|
||||
build_script:
|
||||
- msbuild "%ProjectPath%" /p:Configuration="Debug SSE2" /m /p:PlatformToolset="%PlatformToolset%" /verbosity:minimal
|
||||
test: off
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
# Nothing to do here
|
||||
:
|
||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
# Nothing to do here
|
||||
:
|
||||
fi
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
# Due to a bug in gcc the array bounds check isn't working correctly
|
||||
# This can be removed when gcc is updated
|
||||
AUTOGEN_CONFIG="CXXFLAGS=-Wno-array-bounds --enable-fatal-warnings"
|
||||
|
||||
if [ "$CONFIGURATION" = "Debug" ]; then
|
||||
AUTOGEN_CONFIG="$AUTOGEN_CONFIG --enable-debug"
|
||||
fi
|
||||
|
||||
./autogen.sh $AUTOGEN_CONFIG
|
||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
cd projects/Xcode4
|
||||
tar -xvzf Frameworks.tgz
|
||||
fi
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
# Nothing to do here
|
||||
:
|
||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
gem install xcpretty
|
||||
fi
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
make -j 4
|
||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
cd projects/Xcode4
|
||||
xcodebuild ARCHS=$MACOSX_ARCH ONLY_ACTIVE_ARCH=NO -configuration "$CONFIGURATION" | xcpretty -c
|
||||
fi
|
||||
+8
-3
@@ -199,7 +199,7 @@ bin_PROGRAMS = @FS2_BINARY@
|
||||
EXTRA_PROGRAMS = fs2_open_@PACKAGE_VERSION@ \
|
||||
fs2_open_@PACKAGE_VERSION@_DEBUG \
|
||||
wxFRED2_@PACKAGE_VERSION@ \
|
||||
wxFRED2_@PACKAGE_VERSION@_DEBUG
|
||||
wxFRED2_@PACKAGE_VERSION@_DEBUG
|
||||
|
||||
###############################################################################
|
||||
##
|
||||
@@ -215,6 +215,7 @@ FS2_SOURCES = \
|
||||
ai/aigoals.cpp \
|
||||
ai/aigoals.h \
|
||||
ai/aiinternal.h \
|
||||
ai/ailocal.h \
|
||||
ai/aiturret.cpp \
|
||||
ai/ai_profiles.cpp \
|
||||
ai/ai_profiles.h \
|
||||
@@ -266,6 +267,8 @@ FS2_SOURCES = \
|
||||
debugconsole/consolecmds.cpp \
|
||||
debugconsole/consoleparse.cpp \
|
||||
debugconsole/consoleparse.h \
|
||||
debugconsole/timerbar.cpp \
|
||||
debugconsole/timerbar.h \
|
||||
exceptionhandler/exceptionhandler.cpp \
|
||||
exceptionhandler/exceptionhandler.h \
|
||||
external_dll/externalcode.h \
|
||||
@@ -340,7 +343,6 @@ FS2_SOURCES = \
|
||||
graphics/grstub.cpp \
|
||||
graphics/grstub.h \
|
||||
graphics/line.h \
|
||||
graphics/shadows.cpp \
|
||||
graphics/tmapper.h \
|
||||
hud/hud.cpp \
|
||||
hud/hud.h \
|
||||
@@ -477,10 +479,14 @@ FS2_SOURCES = \
|
||||
missionui/missionloopbrief.h \
|
||||
missionui/missionpause.cpp \
|
||||
missionui/missionpause.h \
|
||||
missionui/missionrecommend.cpp \
|
||||
missionui/missionrecommend.h \
|
||||
missionui/missionscreencommon.cpp \
|
||||
missionui/missionscreencommon.h \
|
||||
missionui/missionshipchoice.cpp \
|
||||
missionui/missionshipchoice.h \
|
||||
missionui/missionstats.cpp \
|
||||
missionui/missionstats.h \
|
||||
missionui/missionweaponchoice.cpp \
|
||||
missionui/missionweaponchoice.h \
|
||||
missionui/redalert.cpp \
|
||||
@@ -495,7 +501,6 @@ FS2_SOURCES = \
|
||||
model/modelsinc.h \
|
||||
model/modeloctant.cpp \
|
||||
model/modelread.cpp \
|
||||
model/modelrender.cpp \
|
||||
nebula/neb.cpp \
|
||||
nebula/neb.h \
|
||||
nebula/neblightning.cpp \
|
||||
|
||||
+6
-5
@@ -12,12 +12,12 @@
|
||||
#ifndef _AI_H
|
||||
#define _AI_H
|
||||
|
||||
#include "ai/ai_profiles.h"
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "object/waypoint.h"
|
||||
#include "ai/ai_profiles.h"
|
||||
#include "physics/physics.h"
|
||||
#include "object/waypoint.h"
|
||||
|
||||
struct ship_weapon;
|
||||
class ship_subsys;
|
||||
@@ -622,7 +622,7 @@ extern void init_ai_system(void);
|
||||
extern void ai_attack_object(object *attacker, object *attacked, ship_subsys *ssp);
|
||||
extern void ai_evade_object(object *evader, object *evaded);
|
||||
extern void ai_ignore_object(object *ignorer, object *ignored, int ignore_new);
|
||||
extern void ai_ignore_wing(object *ignorer, int wingnum);
|
||||
extern void ai_ignore_wing(object *ignorer, int wingnum, int priority);
|
||||
extern void ai_dock_with_object(object *docker, int docker_index, object *dockee, int dockee_index, int dock_type);
|
||||
extern void ai_stay_still(object *still_objp, vec3d *view_pos);
|
||||
extern void ai_do_default_behavior(object *obj);
|
||||
@@ -726,7 +726,8 @@ void process_subobjects(int objnum);
|
||||
//SUSHI: Setting ai_info stuff from both ai class and ai profile
|
||||
void init_aip_from_class_and_profile(ai_info *aip, ai_class *aicp, ai_profile_t *profile);
|
||||
|
||||
void ai_update_aim(ai_info *aip);
|
||||
//SUSHI: Updating AI aim
|
||||
void ai_update_aim(ai_info *aip, object* En_Objp);
|
||||
|
||||
//SUSHI: Random evasive sidethrust
|
||||
void do_random_sidethrust(ai_info *aip, ship_info *sip);
|
||||
|
||||
+435
-442
@@ -7,13 +7,13 @@
|
||||
|
||||
|
||||
|
||||
#include "ai/ai_profiles.h"
|
||||
#include "globalincs/def_files.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "localization/localize.h"
|
||||
#include "globalincs/def_files.h"
|
||||
#include "ai/ai_profiles.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "ship/ship.h"
|
||||
#include "localization/localize.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "ship/ship.h"
|
||||
|
||||
|
||||
// global stuff
|
||||
@@ -69,461 +69,454 @@ int ai_path_type_match(char *p)
|
||||
|
||||
void parse_ai_profiles_tbl(const char *filename)
|
||||
{
|
||||
int i;
|
||||
int i, rval;
|
||||
char profile_name[NAME_LENGTH];
|
||||
ai_profile_t dummy_profile;
|
||||
char *saved_Mp = NULL;
|
||||
char buf[NAME_LENGTH];
|
||||
|
||||
try
|
||||
if ((rval = setjmp(parse_abort)) != 0)
|
||||
{
|
||||
if (filename == NULL)
|
||||
read_file_text_from_array(defaults_get_file("ai_profiles.tbl"));
|
||||
else
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", (filename) ? filename : "<default ai_profiles.tbl>", rval));
|
||||
return;
|
||||
}
|
||||
|
||||
reset_parse();
|
||||
if (filename == NULL)
|
||||
read_file_text_from_array(defaults_get_file("ai_profiles.tbl"));
|
||||
else
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
|
||||
reset_parse();
|
||||
|
||||
|
||||
// start parsing
|
||||
required_string("#AI Profiles");
|
||||
// start parsing
|
||||
required_string("#AI Profiles");
|
||||
|
||||
// new default?
|
||||
if (optional_string("$Default Profile:"))
|
||||
stuff_string(Default_profile_name, F_NAME, NAME_LENGTH);
|
||||
// new default?
|
||||
if (optional_string("$Default Profile:"))
|
||||
stuff_string(Default_profile_name, F_NAME, NAME_LENGTH);
|
||||
|
||||
// begin reading data
|
||||
while (required_string_either("#End", "$Profile Name:"))
|
||||
// begin reading data
|
||||
while (required_string_either("#End","$Profile Name:"))
|
||||
{
|
||||
ai_profile_t *profile = &dummy_profile;
|
||||
ai_profile_t *previous_profile = NULL;
|
||||
bool no_create = false;
|
||||
|
||||
// get the name
|
||||
required_string("$Profile Name:");
|
||||
stuff_string(profile_name, F_NAME, NAME_LENGTH);
|
||||
|
||||
// see if it exists
|
||||
for (i = 0; i < Num_ai_profiles; i++)
|
||||
{
|
||||
ai_profile_t *profile = &dummy_profile;
|
||||
ai_profile_t *previous_profile = NULL;
|
||||
bool no_create = false;
|
||||
|
||||
// get the name
|
||||
required_string("$Profile Name:");
|
||||
stuff_string(profile_name, F_NAME, NAME_LENGTH);
|
||||
|
||||
// see if it exists
|
||||
for (i = 0; i < Num_ai_profiles; i++)
|
||||
if (!stricmp(Ai_profiles[i].profile_name, profile_name))
|
||||
{
|
||||
if (!stricmp(Ai_profiles[i].profile_name, profile_name))
|
||||
{
|
||||
previous_profile = &Ai_profiles[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// modular table stuff
|
||||
if (optional_string("+nocreate"))
|
||||
{
|
||||
no_create = true;
|
||||
|
||||
// use the previous one if possible,
|
||||
// otherwise continue to use the dummy one
|
||||
if (previous_profile != NULL)
|
||||
profile = previous_profile;
|
||||
}
|
||||
else
|
||||
{
|
||||
// don't create multiple profiles with the same name
|
||||
if (previous_profile != NULL)
|
||||
{
|
||||
Warning(LOCATION, "An ai profile named '%s' already exists! The new one will not be created.\n", profile_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make sure we're under the limit
|
||||
if (Num_ai_profiles >= MAX_AI_PROFILES)
|
||||
{
|
||||
Warning(LOCATION, "Too many profiles in ai_profiles.tbl! Max is %d.\n", MAX_AI_PROFILES - 1); // -1 because one is built-in
|
||||
skip_to_string("#End", NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
profile = &Ai_profiles[Num_ai_profiles];
|
||||
Num_ai_profiles++;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize profile if we're not building from a previously parsed one
|
||||
if (!no_create)
|
||||
{
|
||||
// base profile, so zero it out
|
||||
if (profile == &Ai_profiles[0])
|
||||
{
|
||||
memset(profile, 0, sizeof(ai_profile_t));
|
||||
}
|
||||
// brand new profile, so set it to the base defaults
|
||||
else
|
||||
{
|
||||
memcpy(profile, &Ai_profiles[0], sizeof(ai_profile_t));
|
||||
}
|
||||
}
|
||||
|
||||
// set the name
|
||||
strcpy_s(profile->profile_name, profile_name);
|
||||
|
||||
|
||||
// fill in any and all settings; they're all optional and can be in any order
|
||||
while (!check_for_string("$Profile Name:") && !check_for_string("#End"))
|
||||
{
|
||||
if (optional_string("$Player Afterburner Recharge Scale:"))
|
||||
parse_float_list(profile->afterburner_recharge_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Beam Friendly Fire Damage:"))
|
||||
parse_float_list(profile->beam_friendly_damage_cap, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Countermeasure Life Scale:"))
|
||||
parse_float_list(profile->cmeasure_life_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Countermeasure Firing Chance:"))
|
||||
parse_float_list(profile->cmeasure_fire_chance, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI In Range Time:"))
|
||||
parse_float_list(profile->in_range_time, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Always Links Ammo Weapons:"))
|
||||
parse_float_list(profile->link_ammo_levels_always, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Maybe Links Ammo Weapons:"))
|
||||
parse_float_list(profile->link_ammo_levels_maybe, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Primary Ammo Burst Multiplier:"))
|
||||
parse_float_list(profile->primary_ammo_burst_mult, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Always Links Energy Weapons:"))
|
||||
parse_float_list(profile->link_energy_levels_always, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Maybe Links Energy Weapons:"))
|
||||
parse_float_list(profile->link_energy_levels_maybe, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Missles Locked on Player:") || optional_string("$Max Missiles Locked on Player:"))
|
||||
parse_int_list(profile->max_allowed_player_homers, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Player Attackers:"))
|
||||
parse_int_list(profile->max_attackers, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Incoming Asteroids:"))
|
||||
parse_int_list(profile->max_incoming_asteroids, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Damage Factor:") || optional_string("$AI Damage Reduction to Player Hull:"))
|
||||
parse_float_list(profile->player_damage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
|
||||
parse_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
// represented in fractions of F1_0
|
||||
if (optional_string("$Predict Position Delay:"))
|
||||
{
|
||||
int iLoop;
|
||||
float temp_list[NUM_SKILL_LEVELS];
|
||||
|
||||
parse_float_list(temp_list, NUM_SKILL_LEVELS);
|
||||
|
||||
for (iLoop = 0; iLoop < NUM_SKILL_LEVELS; iLoop++)
|
||||
profile->predict_position_delay[iLoop] = fl2f(temp_list[iLoop]);
|
||||
}
|
||||
|
||||
if (optional_string("$AI Shield Manage Delay:") || optional_string("$AI Shield Manage Delays:"))
|
||||
parse_float_list(profile->shield_manage_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Friendly AI Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_delay_scale_friendly, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Hostile AI Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Friendly AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_friendly, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Hostile AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Turn Time Scale:"))
|
||||
parse_float_list(profile->turn_time_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Glide Attack Percent:")) {
|
||||
parse_float_list(profile->glide_attack_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->glide_attack_percent[i] < 0.0f || profile->glide_attack_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Glide Attack Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_attack_percent[i]);
|
||||
profile->glide_attack_percent[i] = 0.0f;
|
||||
}
|
||||
profile->glide_attack_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Circle Strafe Percent:")) {
|
||||
parse_float_list(profile->circle_strafe_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->circle_strafe_percent[i] < 0.0f || profile->circle_strafe_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Circle Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->circle_strafe_percent[i]);
|
||||
profile->circle_strafe_percent[i] = 0.0f;
|
||||
}
|
||||
profile->circle_strafe_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Glide Strafe Percent:")) {
|
||||
parse_float_list(profile->glide_strafe_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->glide_strafe_percent[i] < 0.0f || profile->glide_strafe_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Glide Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_strafe_percent[i]);
|
||||
profile->glide_strafe_percent[i] = 0.0f;
|
||||
}
|
||||
profile->glide_strafe_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Random Sidethrust Percent:")) {
|
||||
parse_float_list(profile->random_sidethrust_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->random_sidethrust_percent[i] < 0.0f || profile->random_sidethrust_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Random Sidethrust Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->random_sidethrust_percent[i]);
|
||||
profile->random_sidethrust_percent[i] = 0.0f;
|
||||
}
|
||||
profile->random_sidethrust_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Stalemate Time Threshold:"))
|
||||
parse_float_list(profile->stalemate_time_thresh, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Stalemate Distance Threshold:"))
|
||||
parse_float_list(profile->stalemate_dist_thresh, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Shield Recharge Scale:"))
|
||||
parse_float_list(profile->shield_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Weapon Recharge Scale:"))
|
||||
parse_float_list(profile->weapon_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Turret Target Ownage:"))
|
||||
parse_int_list(profile->max_turret_ownage_target, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Turret Player Ownage:"))
|
||||
parse_int_list(profile->max_turret_ownage_player, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Required For Kill Scale:"))
|
||||
parse_float_list(profile->kill_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Required For Assist Scale:"))
|
||||
parse_float_list(profile->assist_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Awarded For Capship Assist:"))
|
||||
parse_float_list(profile->assist_award_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Repair Penalty:"))
|
||||
parse_int_list(profile->repair_penalty, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Delay Before Allowing Bombs to Be Shot Down:"))
|
||||
parse_float_list(profile->delay_bomb_arm_timer, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Chance AI Has to Fire Missiles at Player:"))
|
||||
parse_int_list(profile->chance_to_use_missiles_on_plr, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Aim Update Delay:"))
|
||||
parse_float_list(profile->max_aim_update_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Turret Max Aim Update Delay:"))
|
||||
parse_float_list(profile->turret_max_aim_update_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Autoaim FOV:"))
|
||||
{
|
||||
float fov_list[NUM_SKILL_LEVELS];
|
||||
parse_float_list(fov_list, NUM_SKILL_LEVELS);
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++)
|
||||
{
|
||||
//Enforce range
|
||||
if (fov_list[i] < 0.0f || fov_list[i] >= 360.0f)
|
||||
{
|
||||
Warning(LOCATION, "$Player Autoaim FOV should be >= 0 and < 360.0 (read %f). Setting to 0.", fov_list[i]);
|
||||
fov_list[i] = 0.0f;
|
||||
}
|
||||
|
||||
//Convert units
|
||||
profile->player_autoaim_fov[i] = fov_list[i] * PI / 180.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Detail Distance Multiplier:"))
|
||||
parse_float_list(profile->detail_distance_mult, NUM_SKILL_LEVELS);
|
||||
|
||||
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart secondary weapon selection:", AIPF_SMART_SECONDARY_WEAPON_SELECTION, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$don't insert random turret fire delay:", AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$hack improve non-homing swarm turret fire accuracy:", AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$shockwaves damage small ship subsystems:", AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$navigation subsystem governs warpout capability:", AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$ignore lower bound for minimum speed of docked ship:", AIPF_NO_MIN_DOCK_SPEED_CAP, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$disable linked fire penalty:", AIPF_DISABLE_LINKED_FIRE_PENALTY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$disable weapon damage scaling:", AIPF_DISABLE_WEAPON_DAMAGE_SCALING, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$use additive weapon velocity:", AIPF_USE_ADDITIVE_WEAPON_VELOCITY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$use newtonian dampening:", AIPF_USE_NEWTONIAN_DAMPENING, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$include beams for kills and assists:", AIPF_INCLUDE_BEAMS_IN_STAT_CALCS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$score kills based on damage caused:", AIPF_KILL_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$score assists based on damage caused:", AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow event and goal scoring in multiplayer:", AIPF_ALLOW_MULTI_EVENT_SCORING, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$fix linked primary weapon decision bug:", AIPF_FIX_LINKED_PRIMARY_BUG, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$fix heat seekers homing on stealth ships bug:", AIPF_FIX_HEAT_SEEKER_STEALTH_BUG, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$multi allow empty primaries:", AIPF_MULTI_ALLOW_EMPTY_PRIMARIES, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$multi allow empty secondaries:", AIPF_MULTI_ALLOW_EMPTY_SECONDARIES, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow turrets target weapons freely:", AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$use only single fov for turrets:", AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow vertical dodge:", AIPF_ALLOW_VERTICAL_DODGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$force beam turrets to use normal fov:", AIPF_FORCE_BEAM_TURRET_FOV, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$fix ai class bug:", AIPF_FIX_AI_CLASS_BUG, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$turrets ignore targets radius in range checks:", AIPF2_TURRETS_IGNORE_TARGET_RADIUS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$no extra collision avoidance vs player:", AIPF2_NO_SPECIAL_PLAYER_AVOID, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$perform fewer checks for death screams:", AIPF2_PERFORM_FEWER_SCREAM_CHECKS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$advanced turret fov edge checks:", AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$require turrets to have target in fov:", AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$all ships manage shields:", AIPF2_ALL_SHIPS_MANAGE_SHIELDS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$ai aims from ship center:", AIPF2_AI_AIMS_FROM_SHIP_CENTER, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$allow primary link at mission start:", AIPF2_ALLOW_PRIMARY_LINK_AT_START, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$allow beams to damage bombs:", AIPF2_BEAMS_DAMAGE_WEAPONS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$disable weapon damage scaling for player:", AIPF2_PLAYER_WEAPON_SCALE_FIX, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$countermeasures affect aspect seekers:", AIPF2_ASPECT_LOCK_COUNTERMEASURE, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$ai guards specific ship in wing:", AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING, AIP_FLAG2);
|
||||
|
||||
profile->ai_path_mode = AI_PATH_MODE_NORMAL;
|
||||
if (optional_string("$ai path mode:"))
|
||||
{
|
||||
stuff_string(buf, F_NAME, NAME_LENGTH);
|
||||
int j = ai_path_type_match(buf);
|
||||
if (j >= 0) {
|
||||
profile->ai_path_mode = j;
|
||||
}
|
||||
else {
|
||||
Warning(LOCATION, "Invalid ai path mode '%s' specified", buf);
|
||||
}
|
||||
}
|
||||
|
||||
set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$fix ai path order bug:", AIPF2_FIX_AI_PATH_ORDER_BUG, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$strict turret-tagged-only targeting:", AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$aspect bomb invulnerability fix:", AIPF2_ASPECT_INVULNERABILITY_FIX, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$glide decay requires thrust:", AIPF2_GLIDE_DECAY_REQUIRES_THRUST, AIP_FLAG2);
|
||||
|
||||
profile->bay_arrive_speed_mult = 1.0f;
|
||||
profile->bay_depart_speed_mult = 1.0f;
|
||||
if (optional_string("$bay arrive speed multiplier:")) {
|
||||
stuff_float(&profile->bay_arrive_speed_mult);
|
||||
}
|
||||
if (optional_string("$bay depart speed multiplier:")) {
|
||||
stuff_float(&profile->bay_depart_speed_mult);
|
||||
}
|
||||
|
||||
// ----------
|
||||
|
||||
// compatibility
|
||||
if (optional_string("$perform less checks for death screams:"))
|
||||
{
|
||||
mprintf(("Warning: \"$perform less checks for death screams\" flag is deprecated in favor of \"$perform fewer checks for death screams\"\n"));
|
||||
bool temp;
|
||||
stuff_boolean(&temp);
|
||||
if (temp)
|
||||
profile->flags2 |= AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
|
||||
else
|
||||
profile->flags2 &= ~AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
|
||||
}
|
||||
if (optional_string("$allow primary link delay:"))
|
||||
{
|
||||
mprintf(("Warning: \"$allow primary link delay\" flag is deprecated in favor of \"$allow primary link at mission start\"\n"));
|
||||
bool temp;
|
||||
stuff_boolean(&temp);
|
||||
if (temp)
|
||||
profile->flags2 &= ~AIPF2_ALLOW_PRIMARY_LINK_AT_START;
|
||||
else
|
||||
profile->flags2 |= AIPF2_ALLOW_PRIMARY_LINK_AT_START;
|
||||
}
|
||||
|
||||
|
||||
// if we've been through once already and are at the same place, force a move
|
||||
if (saved_Mp && (saved_Mp == Mp))
|
||||
{
|
||||
char tmp[60];
|
||||
memset(tmp, 0, 60);
|
||||
strncpy(tmp, Mp, 59);
|
||||
mprintf(("WARNING: Unrecognized parameter in ai_profiles: %s\n", tmp));
|
||||
|
||||
Mp++;
|
||||
}
|
||||
|
||||
// find next valid option
|
||||
skip_to_start_of_string_either("$", "#");
|
||||
saved_Mp = Mp;
|
||||
previous_profile = &Ai_profiles[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", (filename) ? filename : "<default ai_profiles.tbl>", e.what()));
|
||||
return;
|
||||
// modular table stuff
|
||||
if (optional_string("+nocreate"))
|
||||
{
|
||||
no_create = true;
|
||||
|
||||
// use the previous one if possible,
|
||||
// otherwise continue to use the dummy one
|
||||
if (previous_profile != NULL)
|
||||
profile = previous_profile;
|
||||
}
|
||||
else
|
||||
{
|
||||
// don't create multiple profiles with the same name
|
||||
if (previous_profile != NULL)
|
||||
{
|
||||
Warning(LOCATION, "An ai profile named '%s' already exists! The new one will not be created.\n", profile_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make sure we're under the limit
|
||||
if (Num_ai_profiles >= MAX_AI_PROFILES)
|
||||
{
|
||||
Warning(LOCATION, "Too many profiles in ai_profiles.tbl! Max is %d.\n", MAX_AI_PROFILES-1); // -1 because one is built-in
|
||||
skip_to_string("#End", NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
profile = &Ai_profiles[Num_ai_profiles];
|
||||
Num_ai_profiles++;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize profile if we're not building from a previously parsed one
|
||||
if (!no_create)
|
||||
{
|
||||
// base profile, so zero it out
|
||||
if (profile == &Ai_profiles[0])
|
||||
{
|
||||
memset(profile, 0, sizeof(ai_profile_t));
|
||||
}
|
||||
// brand new profile, so set it to the base defaults
|
||||
else
|
||||
{
|
||||
memcpy(profile, &Ai_profiles[0], sizeof(ai_profile_t));
|
||||
}
|
||||
}
|
||||
|
||||
// set the name
|
||||
strcpy_s(profile->profile_name, profile_name);
|
||||
|
||||
|
||||
// fill in any and all settings; they're all optional and can be in any order
|
||||
while (!check_for_string("$Profile Name:") && !check_for_string("#End"))
|
||||
{
|
||||
if (optional_string("$Player Afterburner Recharge Scale:"))
|
||||
parse_float_list(profile->afterburner_recharge_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Beam Friendly Fire Damage:"))
|
||||
parse_float_list(profile->beam_friendly_damage_cap, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Countermeasure Life Scale:"))
|
||||
parse_float_list(profile->cmeasure_life_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Countermeasure Firing Chance:"))
|
||||
parse_float_list(profile->cmeasure_fire_chance, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI In Range Time:"))
|
||||
parse_float_list(profile->in_range_time, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Always Links Ammo Weapons:"))
|
||||
parse_float_list(profile->link_ammo_levels_always, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Maybe Links Ammo Weapons:"))
|
||||
parse_float_list(profile->link_ammo_levels_maybe, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Primary Ammo Burst Multiplier:"))
|
||||
parse_float_list(profile->primary_ammo_burst_mult, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Always Links Energy Weapons:"))
|
||||
parse_float_list(profile->link_energy_levels_always, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Maybe Links Energy Weapons:"))
|
||||
parse_float_list(profile->link_energy_levels_maybe, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Missles Locked on Player:") || optional_string("$Max Missiles Locked on Player:"))
|
||||
parse_int_list(profile->max_allowed_player_homers, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Player Attackers:"))
|
||||
parse_int_list(profile->max_attackers, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Incoming Asteroids:"))
|
||||
parse_int_list(profile->max_incoming_asteroids, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Damage Factor:") || optional_string("$AI Damage Reduction to Player Hull:"))
|
||||
parse_float_list(profile->player_damage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
|
||||
parse_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
// represented in fractions of F1_0
|
||||
if (optional_string("$Predict Position Delay:"))
|
||||
{
|
||||
int iLoop;
|
||||
float temp_list[NUM_SKILL_LEVELS];
|
||||
|
||||
parse_float_list(temp_list, NUM_SKILL_LEVELS);
|
||||
|
||||
for (iLoop = 0; iLoop < NUM_SKILL_LEVELS; iLoop++)
|
||||
profile->predict_position_delay[iLoop] = fl2f(temp_list[iLoop]);
|
||||
}
|
||||
|
||||
if (optional_string("$AI Shield Manage Delay:") || optional_string("$AI Shield Manage Delays:"))
|
||||
parse_float_list(profile->shield_manage_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Friendly AI Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_delay_scale_friendly, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Hostile AI Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Friendly AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_friendly, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Hostile AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Turn Time Scale:"))
|
||||
parse_float_list(profile->turn_time_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Glide Attack Percent:")) {
|
||||
parse_float_list(profile->glide_attack_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->glide_attack_percent[i] < 0.0f || profile->glide_attack_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Glide Attack Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_attack_percent[i]);
|
||||
profile->glide_attack_percent[i] = 0.0f;
|
||||
}
|
||||
profile->glide_attack_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Circle Strafe Percent:")) {
|
||||
parse_float_list(profile->circle_strafe_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->circle_strafe_percent[i] < 0.0f || profile->circle_strafe_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Circle Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->circle_strafe_percent[i]);
|
||||
profile->circle_strafe_percent[i] = 0.0f;
|
||||
}
|
||||
profile->circle_strafe_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Glide Strafe Percent:")) {
|
||||
parse_float_list(profile->glide_strafe_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->glide_strafe_percent[i] < 0.0f || profile->glide_strafe_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Glide Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_strafe_percent[i]);
|
||||
profile->glide_strafe_percent[i] = 0.0f;
|
||||
}
|
||||
profile->glide_strafe_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Random Sidethrust Percent:")) {
|
||||
parse_float_list(profile->random_sidethrust_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->random_sidethrust_percent[i] < 0.0f || profile->random_sidethrust_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Random Sidethrust Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->random_sidethrust_percent[i]);
|
||||
profile->random_sidethrust_percent[i] = 0.0f;
|
||||
}
|
||||
profile->random_sidethrust_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Stalemate Time Threshold:"))
|
||||
parse_float_list(profile->stalemate_time_thresh, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Stalemate Distance Threshold:"))
|
||||
parse_float_list(profile->stalemate_dist_thresh, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Shield Recharge Scale:"))
|
||||
parse_float_list(profile->shield_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Weapon Recharge Scale:"))
|
||||
parse_float_list(profile->weapon_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Turret Target Ownage:"))
|
||||
parse_int_list(profile->max_turret_ownage_target, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Turret Player Ownage:"))
|
||||
parse_int_list(profile->max_turret_ownage_player, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Required For Kill Scale:"))
|
||||
parse_float_list(profile->kill_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Required For Assist Scale:"))
|
||||
parse_float_list(profile->assist_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Awarded For Capship Assist:"))
|
||||
parse_float_list(profile->assist_award_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Repair Penalty:"))
|
||||
parse_int_list(profile->repair_penalty, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Delay Before Allowing Bombs to Be Shot Down:"))
|
||||
parse_float_list(profile->delay_bomb_arm_timer, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Chance AI Has to Fire Missiles at Player:"))
|
||||
parse_int_list(profile->chance_to_use_missiles_on_plr, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Aim Update Delay:"))
|
||||
parse_float_list(profile->max_aim_update_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Turret Max Aim Update Delay:"))
|
||||
parse_float_list(profile->turret_max_aim_update_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Autoaim FOV:"))
|
||||
{
|
||||
float fov_list[NUM_SKILL_LEVELS];
|
||||
parse_float_list(fov_list, NUM_SKILL_LEVELS);
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++)
|
||||
{
|
||||
//Enforce range
|
||||
if (fov_list[i] < 0.0f || fov_list[i] >= 360.0f)
|
||||
{
|
||||
Warning(LOCATION, "$Player Autoaim FOV should be >= 0 and < 360.0 (read %f). Setting to 0.", fov_list[i]);
|
||||
fov_list[i] = 0.0f;
|
||||
}
|
||||
|
||||
//Convert units
|
||||
profile->player_autoaim_fov[i] = fov_list[i] * PI / 180.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Detail Distance Multiplier:"))
|
||||
parse_float_list(profile->detail_distance_mult, NUM_SKILL_LEVELS);
|
||||
|
||||
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart secondary weapon selection:", AIPF_SMART_SECONDARY_WEAPON_SELECTION, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$don't insert random turret fire delay:", AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$hack improve non-homing swarm turret fire accuracy:", AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$shockwaves damage small ship subsystems:", AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$navigation subsystem governs warpout capability:", AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$ignore lower bound for minimum speed of docked ship:", AIPF_NO_MIN_DOCK_SPEED_CAP, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$disable linked fire penalty:", AIPF_DISABLE_LINKED_FIRE_PENALTY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$disable weapon damage scaling:", AIPF_DISABLE_WEAPON_DAMAGE_SCALING, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$use additive weapon velocity:", AIPF_USE_ADDITIVE_WEAPON_VELOCITY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$use newtonian dampening:", AIPF_USE_NEWTONIAN_DAMPENING, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$include beams for kills and assists:", AIPF_INCLUDE_BEAMS_IN_STAT_CALCS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$score kills based on damage caused:", AIPF_KILL_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$score assists based on damage caused:", AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow event and goal scoring in multiplayer:", AIPF_ALLOW_MULTI_EVENT_SCORING, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$fix linked primary weapon decision bug:", AIPF_FIX_LINKED_PRIMARY_BUG, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$fix heat seekers homing on stealth ships bug:", AIPF_FIX_HEAT_SEEKER_STEALTH_BUG, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$multi allow empty primaries:", AIPF_MULTI_ALLOW_EMPTY_PRIMARIES, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$multi allow empty secondaries:", AIPF_MULTI_ALLOW_EMPTY_SECONDARIES, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow turrets target weapons freely:", AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$use only single fov for turrets:", AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow vertical dodge:", AIPF_ALLOW_VERTICAL_DODGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$force beam turrets to use normal fov:", AIPF_FORCE_BEAM_TURRET_FOV, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$fix ai class bug:", AIPF_FIX_AI_CLASS_BUG, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$turrets ignore targets radius in range checks:", AIPF2_TURRETS_IGNORE_TARGET_RADIUS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$no extra collision avoidance vs player:", AIPF2_NO_SPECIAL_PLAYER_AVOID, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$perform fewer checks for death screams:", AIPF2_PERFORM_FEWER_SCREAM_CHECKS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$advanced turret fov edge checks:", AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$require turrets to have target in fov:", AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$all ships manage shields:", AIPF2_ALL_SHIPS_MANAGE_SHIELDS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$ai aims from ship center:", AIPF2_AI_AIMS_FROM_SHIP_CENTER, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$allow primary link at mission start:", AIPF2_ALLOW_PRIMARY_LINK_AT_START, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$allow beams to damage bombs:", AIPF2_BEAMS_DAMAGE_WEAPONS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$disable weapon damage scaling for player:", AIPF2_PLAYER_WEAPON_SCALE_FIX, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$countermeasures affect aspect seekers:", AIPF2_ASPECT_LOCK_COUNTERMEASURE, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$ai guards specific ship in wing:", AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING, AIP_FLAG2);
|
||||
|
||||
profile->ai_path_mode = AI_PATH_MODE_NORMAL;
|
||||
if(optional_string("$ai path mode:"))
|
||||
{
|
||||
stuff_string(buf, F_NAME, NAME_LENGTH);
|
||||
int j = ai_path_type_match(buf);
|
||||
if(j >= 0) {
|
||||
profile->ai_path_mode = j;
|
||||
} else {
|
||||
Warning(LOCATION, "Invalid ai path mode '%s' specified", buf);
|
||||
}
|
||||
}
|
||||
|
||||
set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$fix ai path order bug:", AIPF2_FIX_AI_PATH_ORDER_BUG, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$strict turret-tagged-only targeting:", AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING, AIP_FLAG2);
|
||||
|
||||
profile->bay_arrive_speed_mult = 1.0f;
|
||||
profile->bay_depart_speed_mult = 1.0f;
|
||||
if (optional_string("$bay arrive start speed multiplier:")) {
|
||||
stuff_float(&profile->bay_arrive_speed_mult);
|
||||
}
|
||||
if (optional_string("$bay depart end speed multiplier:")) {
|
||||
stuff_float(&profile->bay_depart_speed_mult);
|
||||
}
|
||||
|
||||
// ----------
|
||||
|
||||
// compatibility
|
||||
if (optional_string("$perform less checks for death screams:"))
|
||||
{
|
||||
mprintf(("Warning: \"$perform less checks for death screams\" flag is deprecated in favor of \"$perform fewer checks for death screams\"\n"));
|
||||
bool temp;
|
||||
stuff_boolean(&temp);
|
||||
if (temp)
|
||||
profile->flags2 |= AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
|
||||
else
|
||||
profile->flags2 &= ~AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
|
||||
}
|
||||
if (optional_string("$allow primary link delay:"))
|
||||
{
|
||||
mprintf(("Warning: \"$allow primary link delay\" flag is deprecated in favor of \"$allow primary link at mission start\"\n"));
|
||||
bool temp;
|
||||
stuff_boolean(&temp);
|
||||
if (temp)
|
||||
profile->flags2 &= ~AIPF2_ALLOW_PRIMARY_LINK_AT_START;
|
||||
else
|
||||
profile->flags2 |= AIPF2_ALLOW_PRIMARY_LINK_AT_START;
|
||||
}
|
||||
|
||||
|
||||
// if we've been through once already and are at the same place, force a move
|
||||
if ( saved_Mp && (saved_Mp == Mp) )
|
||||
{
|
||||
char tmp[60];
|
||||
memset(tmp, 0, 60);
|
||||
strncpy(tmp, Mp, 59);
|
||||
mprintf(("WARNING: Unrecognized parameter in ai_profiles: %s\n", tmp));
|
||||
|
||||
Mp++;
|
||||
}
|
||||
|
||||
// find next valid option
|
||||
skip_to_start_of_string_either("$", "#");
|
||||
saved_Mp = Mp;
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
|
||||
// add tbl/tbm to multiplayer validation list
|
||||
extern void fs2netd_add_table_validation(const char *tblname);
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#ifndef _AI_PROFILES_H_
|
||||
#define _AI_PROFILES_H_
|
||||
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
|
||||
// flag int defines
|
||||
@@ -66,8 +66,6 @@
|
||||
#define AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING (1 << 12)
|
||||
#define AIPF2_FIX_AI_PATH_ORDER_BUG (1 << 13)
|
||||
#define AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING (1 << 14)
|
||||
#define AIPF2_ASPECT_INVULNERABILITY_FIX (1 << 15)
|
||||
#define AIPF2_GLIDE_DECAY_REQUIRES_THRUST (1 << 16)
|
||||
|
||||
// AI Path types
|
||||
#define AI_PATH_MODE_NORMAL 0
|
||||
|
||||
+10
-10
@@ -10,23 +10,22 @@
|
||||
|
||||
|
||||
#include "ai/aibig.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "io/timer.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "object/object.h"
|
||||
#include "ship/afterburner.h"
|
||||
#include "ship/ship.h"
|
||||
#include "ship/afterburner.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "io/timer.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "ai/aigoals.h"
|
||||
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma optimize("", off)
|
||||
#pragma auto_inline(off)
|
||||
#endif
|
||||
|
||||
#define SCAN_FIGHTERS_INTERVAL 2000 // how often an AI fighter/bomber should scan for enemy fighter/bombers
|
||||
// if sitting still and pounding on a big ship. If enemy fighters are
|
||||
@@ -1264,9 +1263,10 @@ int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos)
|
||||
aip->submode = AIS_STRAFE_RETREAT1;
|
||||
aip->submode_start_time = Missiontime;
|
||||
|
||||
float box_dist;
|
||||
int is_inside;
|
||||
vec3d goal_point;
|
||||
get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST);
|
||||
box_dist = get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST);
|
||||
|
||||
// set goal point
|
||||
aip->goal_point = goal_point;
|
||||
|
||||
+158
-137
@@ -18,63 +18,61 @@
|
||||
|
||||
|
||||
#include "ai/ai.h"
|
||||
#include "ai/ai_profiles.h"
|
||||
#include "ai/aibig.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "ai/aiinternal.h"
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "autopilot/autopilot.h"
|
||||
#include "cmeasure/cmeasure.h"
|
||||
#include "debugconsole/console.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "hud/hud.h"
|
||||
#include "hud/hudets.h"
|
||||
#include "hud/hudlock.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "io/joy_ff.h"
|
||||
#include "io/timer.h"
|
||||
#include "localization/localize.h"
|
||||
#include "math/fvi.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "object/object.h"
|
||||
#include "physics/physics.h"
|
||||
#include "ship/ship.h"
|
||||
#include "model/model.h"
|
||||
#include "render/3d.h"
|
||||
#include "playerman/player.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "mission/missiongoals.h"
|
||||
#include "mission/missionlog.h"
|
||||
#include "io/timer.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "mission/missionmessage.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "mission/missiontraining.h"
|
||||
#include "model/model.h"
|
||||
#include "network/multi.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "object/deadobjectdock.h"
|
||||
#include "object/objcollide.h"
|
||||
#include "object/object.h"
|
||||
#include "object/objectdock.h"
|
||||
#include "object/objectshield.h"
|
||||
#include "object/waypoint.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "physics/physics.h"
|
||||
#include "playerman/player.h"
|
||||
#include "render/3d.h"
|
||||
#include "cmeasure/cmeasure.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "ship/afterburner.h"
|
||||
#include "ship/awacs.h"
|
||||
#include "ship/ship.h"
|
||||
#include "ship/shipfx.h"
|
||||
#include "ship/shiphit.h"
|
||||
#include "weapon/beam.h"
|
||||
#include "weapon/flak.h"
|
||||
#include "weapon/swarm.h"
|
||||
#include "ai/aibig.h"
|
||||
#include "hud/hud.h"
|
||||
#include "hud/hudets.h"
|
||||
#include "object/objcollide.h"
|
||||
#include "object/objectshield.h"
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "hud/hudlock.h"
|
||||
#include "mission/missiontraining.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
#include "io/joy_ff.h"
|
||||
#include "localization/localize.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "weapon/flak.h"
|
||||
#include "weapon/beam.h"
|
||||
#include "weapon/swarm.h"
|
||||
#include "ship/awacs.h"
|
||||
#include "math/fvi.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "object/objectdock.h"
|
||||
#include "object/deadobjectdock.h"
|
||||
#include "object/waypoint.h"
|
||||
#include "ai/aiinternal.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "network/multi.h"
|
||||
#include "ai/ai_profiles.h"
|
||||
#include "autopilot/autopilot.h"
|
||||
#include <map>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma optimize("", off)
|
||||
#pragma auto_inline(off)
|
||||
#endif
|
||||
|
||||
#define UNINITIALIZED_VALUE -99999.9f
|
||||
|
||||
@@ -828,14 +826,13 @@ LOCAL int ai_inited = 0;
|
||||
void ai_init()
|
||||
{
|
||||
if ( !ai_inited ) {
|
||||
// Do the first time initialization stuff here
|
||||
try
|
||||
{
|
||||
parse_aitbl();
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "ai.tbl", e.what()));
|
||||
// Do the first time initialization stuff here
|
||||
int rval;
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "ai.tbl", rval));
|
||||
} else {
|
||||
parse_aitbl();
|
||||
}
|
||||
|
||||
ai_inited = 1;
|
||||
@@ -2001,6 +1998,11 @@ void evaluate_object_as_nearest_objnum(eval_nearest_objnum *eno)
|
||||
}
|
||||
|
||||
if (eno->trial_objp->flags & OF_PLAYER_SHIP){
|
||||
// Goober5000: oh dear, it looks like this was originally meant to scale
|
||||
// the distance according to skill, but as it is, the effect appears negligible.
|
||||
// I could fix it with parentheses, but we all know how quickly AI pilots
|
||||
// die usually, so the overall effect would probably be worse. So I left
|
||||
// this unchanged.
|
||||
dist *= 1.0f + (NUM_SKILL_LEVELS - Game_skill_level - 1)/NUM_SKILL_LEVELS; // Favor attacking non-players based on skill level.
|
||||
}
|
||||
|
||||
@@ -2482,7 +2484,7 @@ void ai_ignore_object(object *ignorer, object *ignored, int ignore_new)
|
||||
/**
|
||||
* Ignore some object without changing mode.
|
||||
*/
|
||||
void ai_ignore_wing(object *ignorer, int wingnum)
|
||||
void ai_ignore_wing(object *ignorer, int wingnum, int priority)
|
||||
{
|
||||
ai_info *aip;
|
||||
|
||||
@@ -3408,7 +3410,7 @@ float compute_collision_time(vec3d *targpos, vec3d *targvel, vec3d *attackpos, f
|
||||
// This function doesn't account for the fact that by the time the player
|
||||
// (or his laser) gets to the current enemy position, the enemy will have moved.
|
||||
// This is dealt with in polish_predicted_enemy_pos.
|
||||
float compute_time_to_enemy(float dist_to_enemy, object *pobjp)
|
||||
float compute_time_to_enemy(float dist_to_enemy, object *pobjp, object *eobjp)
|
||||
{
|
||||
float time_to_enemy;
|
||||
float pl_speed = pobjp->phys_info.speed;
|
||||
@@ -3490,12 +3492,8 @@ void ai_set_positions(object *pl_objp, object *en_objp, ai_info *aip, vec3d *pla
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates AI aim automatically based on targetted enemy.
|
||||
*
|
||||
* @param aip Pointer to AI info
|
||||
*/
|
||||
void ai_update_aim(ai_info *aip)
|
||||
// --------------------------------------------------------------------------
|
||||
void ai_update_aim(ai_info *aip, object* En_Objp)
|
||||
{
|
||||
if (Missiontime >= aip->next_aim_pos_time)
|
||||
{
|
||||
@@ -3648,7 +3646,7 @@ float maybe_recreate_path(object *objp, ai_info *aip, int force_recreate_flag, i
|
||||
/**
|
||||
* Set acceleration for ai_dock().
|
||||
*/
|
||||
void set_accel_for_docking(object *objp, ai_info *aip, float dot, float dot_to_next, float dist_to_next, float dist_to_goal, ship_info *sip, float max_allowed_speed, object *gobjp)
|
||||
void set_accel_for_docking(object *objp, ai_info *aip, float dot, float dot_to_next, float dist_to_next, float dist_to_goal, ship_info *sip, float max_allowed_speed)
|
||||
{
|
||||
float prev_dot_to_goal = aip->prev_dot_to_goal;
|
||||
|
||||
@@ -3663,55 +3661,9 @@ void set_accel_for_docking(object *objp, ai_info *aip, float dot, float dot_to_n
|
||||
change_acceleration(aip, -1.0f); // -1.0f means subtract off flFrametime from acceleration value in 0.0..1.0
|
||||
}
|
||||
} else {
|
||||
float max_bay_speed = sip->max_speed;
|
||||
|
||||
// Maybe gradually ramp up/down the speed of a ship flying a fighterbay path
|
||||
if (aip->mode == AIM_BAY_EMERGE || (aip->mode == AIM_BAY_DEPART && aip->path_cur != aip->path_start)) {
|
||||
ship_info *gsip = &Ship_info[Ships[gobjp->instance].ship_info_index];
|
||||
polymodel *pm = model_get(gsip->model_num);
|
||||
SCP_string pathName(pm->paths[Path_points[aip->path_start].path_num].name);
|
||||
float speed_mult = FLT_MIN;
|
||||
|
||||
if (aip->mode == AIM_BAY_EMERGE) { // Arriving
|
||||
if (gsip->pathMetadata.find(pathName) != gsip->pathMetadata.end()) {
|
||||
speed_mult = gsip->pathMetadata[pathName].arrive_speed_mult;
|
||||
}
|
||||
|
||||
if (speed_mult == FLT_MIN) {
|
||||
speed_mult = The_mission.ai_profile->bay_arrive_speed_mult;
|
||||
}
|
||||
} else { // Departing
|
||||
if (gsip->pathMetadata.find(pathName) != gsip->pathMetadata.end()) {
|
||||
speed_mult = gsip->pathMetadata[pathName].depart_speed_mult;
|
||||
}
|
||||
|
||||
if (speed_mult == FLT_MIN) {
|
||||
speed_mult = The_mission.ai_profile->bay_depart_speed_mult;
|
||||
}
|
||||
}
|
||||
|
||||
if (speed_mult != FLT_MIN && speed_mult != 1.0f) {
|
||||
// We use the distance between the first and last point on the path here; it's not accurate
|
||||
// if the path is not straight, but should be good enough usually; can be changed if necessary.
|
||||
float total_path_length = vm_vec_dist_quick(&Path_points[aip->path_start].pos, &Path_points[aip->path_start + aip->path_length - 1].pos);
|
||||
float dist_to_end;
|
||||
|
||||
if (aip->mode == AIM_BAY_EMERGE) { // Arriving
|
||||
dist_to_end = vm_vec_dist_quick(&Pl_objp->pos, &Path_points[aip->path_start].pos);
|
||||
} else { // Departing
|
||||
dist_to_end = vm_vec_dist_quick(&Pl_objp->pos, &Path_points[aip->path_start + aip->path_length - 1].pos);
|
||||
}
|
||||
|
||||
// Calculate max speed, but respect the waypoint speed cap if it's lower
|
||||
max_bay_speed = sip->max_speed * (speed_mult + (1.0f - speed_mult) * (dist_to_end / total_path_length));
|
||||
}
|
||||
}
|
||||
|
||||
// Cap speed to max_allowed_speed, if it's set
|
||||
// If max_allowed_speed isn't set, use the ship max speed
|
||||
if (max_allowed_speed <= 0)
|
||||
max_allowed_speed = max_bay_speed;
|
||||
else
|
||||
max_allowed_speed = MIN(max_allowed_speed, max_bay_speed);
|
||||
max_allowed_speed = sip->max_speed;
|
||||
|
||||
if ((aip->mode == AIM_DOCK) && (dist_to_next < 150.0f) && (aip->path_start + aip->path_length - 2 == aip->path_cur)) {
|
||||
set_accel_for_target_speed(objp, max_allowed_speed * MAX(dist_to_next/500.0f, 1.0f));
|
||||
@@ -3787,7 +3739,8 @@ void set_accel_for_docking(object *objp, ai_info *aip, float dot, float dot_to_n
|
||||
// Returns distance to goal point.
|
||||
float ai_path_0()
|
||||
{
|
||||
int num_points;
|
||||
polymodel *pm;
|
||||
int num_paths, num_points;
|
||||
float dot, dist_to_goal, dist_to_next, dot_to_next;
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
@@ -3796,6 +3749,7 @@ float ai_path_0()
|
||||
float mag;
|
||||
vec3d temp_vec, *slop_vec;
|
||||
object *gobjp;
|
||||
ship *gshipp;
|
||||
vec3d *cvp, *nvp, next_vec, gcvp, gnvp; // current and next vertices in global coordinates.
|
||||
|
||||
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
|
||||
@@ -3804,6 +3758,11 @@ float ai_path_0()
|
||||
Assert(Objects[aip->goal_objnum].type == OBJ_SHIP);
|
||||
|
||||
gobjp = &Objects[aip->goal_objnum];
|
||||
gshipp = &Ships[gobjp->instance];
|
||||
|
||||
pm = model_get(Ship_info[gshipp->ship_info_index].model_num);
|
||||
num_paths = pm->n_paths;
|
||||
Assert(num_paths > 0);
|
||||
|
||||
if (aip->path_start == -1) {
|
||||
Assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS);
|
||||
@@ -3895,7 +3854,7 @@ float ai_path_0()
|
||||
dot = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gcvp);
|
||||
dot_to_next = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gnvp);
|
||||
|
||||
set_accel_for_docking(Pl_objp, aip, dot, dot_to_next, dist_to_next, dist_to_goal, sip, 0, gobjp);
|
||||
set_accel_for_docking(Pl_objp, aip, dot, dot_to_next, dist_to_next, dist_to_goal, sip, 0);
|
||||
aip->prev_dot_to_goal = dot;
|
||||
|
||||
// If moving at a non-tiny velocity, detect attaining path point by its being close to
|
||||
@@ -3931,7 +3890,8 @@ float ai_path_0()
|
||||
// 1.
|
||||
float ai_path_1()
|
||||
{
|
||||
int num_points;
|
||||
polymodel *pm;
|
||||
int num_paths, num_points;
|
||||
float dot, dist_to_goal, dist_to_next, dot_to_next;
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
@@ -3939,6 +3899,7 @@ float ai_path_1()
|
||||
vec3d nvel_vec;
|
||||
float mag;
|
||||
object *gobjp;
|
||||
ship *gshipp;
|
||||
vec3d *pvp, *cvp, *nvp, next_vec, gpvp, gcvp, gnvp; // previous, current and next vertices in global coordinates.
|
||||
|
||||
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
|
||||
@@ -3947,6 +3908,12 @@ float ai_path_1()
|
||||
Assert(Objects[aip->goal_objnum].type == OBJ_SHIP);
|
||||
|
||||
gobjp = &Objects[aip->goal_objnum];
|
||||
gshipp = &Ships[gobjp->instance];
|
||||
|
||||
// Get path data
|
||||
pm = model_get(Ship_info[gshipp->ship_info_index].model_num);
|
||||
num_paths = pm->n_paths;
|
||||
Assert(num_paths > 0);
|
||||
|
||||
if (aip->path_start == -1) {
|
||||
Assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS);
|
||||
@@ -4048,7 +4015,53 @@ float ai_path_1()
|
||||
max_allowed_speed = (float) aip->waypoint_speed_cap;
|
||||
}
|
||||
|
||||
set_accel_for_docking(Pl_objp, aip, dot, dot_to_next, dist_to_next, dist_to_goal, sip, max_allowed_speed, gobjp);
|
||||
// Maybe gradually ramp up/down the speed of a ship flying a fighterbay path
|
||||
if (aip->mode == AIM_BAY_EMERGE || (aip->mode == AIM_BAY_DEPART && aip->path_cur != aip->path_start)) {
|
||||
SCP_string pathName(pm->paths[Path_points[aip->path_start].path_num].name);
|
||||
ship_info *gsip = &Ship_info[gshipp->ship_info_index];
|
||||
float speed_mult = 1.0f;
|
||||
|
||||
if (aip->mode == AIM_BAY_EMERGE) { // Arriving
|
||||
if (gsip->pathMetadata.find(pathName) != gsip->pathMetadata.end()) {
|
||||
speed_mult = gsip->pathMetadata[pathName].arrive_speed_mult;
|
||||
}
|
||||
|
||||
if (speed_mult == FLT_MIN) {
|
||||
speed_mult = The_mission.ai_profile->bay_arrive_speed_mult;
|
||||
}
|
||||
} else { // Departing
|
||||
if (gsip->pathMetadata.find(pathName) != gsip->pathMetadata.end()) {
|
||||
speed_mult = gsip->pathMetadata[pathName].depart_speed_mult;
|
||||
}
|
||||
|
||||
if (speed_mult == FLT_MIN) {
|
||||
speed_mult = The_mission.ai_profile->bay_depart_speed_mult;
|
||||
}
|
||||
}
|
||||
|
||||
if (speed_mult != 1.0f) {
|
||||
// We use the distance between the first and last point on the path here; it's not accurate
|
||||
// if the path is not straight, but should be good enough usually; can be changed if necessary.
|
||||
float total_path_length = vm_vec_dist_quick(&Path_points[aip->path_start].pos, &Path_points[aip->path_start + num_points - 1].pos);
|
||||
float dist_to_end;
|
||||
|
||||
if (aip->mode == AIM_BAY_EMERGE) { // Arriving
|
||||
dist_to_end = vm_vec_dist_quick(&Pl_objp->pos, &Path_points[aip->path_start].pos);
|
||||
} else { // Departing
|
||||
dist_to_end = vm_vec_dist_quick(&Pl_objp->pos, &Path_points[aip->path_start + num_points - 1].pos);
|
||||
}
|
||||
|
||||
// Calculate max speed, but respect the waypoint speed cap if it's lower
|
||||
float max_bay_speed = sip->max_speed * (speed_mult + (1.0f - speed_mult) * (dist_to_end / total_path_length));
|
||||
if (max_allowed_speed == 0.0f) {
|
||||
max_allowed_speed = max_bay_speed;
|
||||
} else {
|
||||
max_allowed_speed = MIN(max_allowed_speed, max_bay_speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_accel_for_docking(Pl_objp, aip, dot, dot_to_next, dist_to_next, dist_to_goal, sip, max_allowed_speed);
|
||||
aip->prev_dot_to_goal = dot;
|
||||
|
||||
// If moving at a non-tiny velocity, detect attaining path point by its being close to
|
||||
@@ -5233,7 +5246,7 @@ int ai_select_primary_weapon_OLD(object *objp, object *other_objp, int flags)
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
ship_weapon *swp = &shipp->weapons;
|
||||
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
|
||||
|
||||
if (flags & WIF_PUNCTURE) {
|
||||
if (swp->current_primary_bank >= 0) {
|
||||
@@ -5322,7 +5335,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
return ai_select_primary_weapon_OLD(objp, other_objp, flags);
|
||||
}
|
||||
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
|
||||
|
||||
//made it so it only selects puncture weapons if the active goal is to disable something -Bobboau
|
||||
if ((flags & WIF_PUNCTURE) && (Ai_info[shipp->ai_index].goals[0].ai_mode & (AI_GOAL_DISARM_SHIP | AI_GOAL_DISABLE_SHIP)))
|
||||
@@ -5639,7 +5652,7 @@ int ai_fire_primary_weapon(object *objp)
|
||||
ai_info *aip;
|
||||
object *enemy_objp;
|
||||
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
|
||||
|
||||
aip = &Ai_info[shipp->ai_index];
|
||||
|
||||
@@ -6072,7 +6085,7 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2)
|
||||
shipp = &Ships[objp->instance];
|
||||
swp = &shipp->weapons;
|
||||
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
|
||||
|
||||
// Select secondary weapon.
|
||||
current_bank = swp->current_secondary_bank; //ai_select_secondary_weapon(objp, swp, priority1, priority2);
|
||||
@@ -6152,7 +6165,7 @@ int might_hit_teammate(object *firing_objp)
|
||||
|
||||
void render_all_ship_bay_paths(object *objp)
|
||||
{
|
||||
int i,j,clr;
|
||||
int i,j,color;
|
||||
polymodel *pm;
|
||||
model_path *mp;
|
||||
|
||||
@@ -6165,17 +6178,17 @@ void render_all_ship_bay_paths(object *objp)
|
||||
|
||||
memset(&v, 0, sizeof(v));
|
||||
|
||||
for ( i = 0; i < pm->ship_bay->num_paths; i++ ) {
|
||||
for ( i = 0; i < pm->ship_bay->num_paths; i++ ) {
|
||||
mp = &pm->paths[pm->ship_bay->path_indexes[i]];
|
||||
|
||||
for ( j = 0; j < mp->nverts; j++ ) {
|
||||
vm_vec_unrotate(&global_path_point, &mp->verts[j].pos, &objp->orient);
|
||||
vm_vec_add2(&global_path_point, &objp->pos);
|
||||
g3_rotate_vertex(&v, &global_path_point);
|
||||
clr = 255 - j*50;
|
||||
if ( clr < 50 )
|
||||
clr = 100;
|
||||
gr_set_color(0, clr, 0);
|
||||
color = 255 - j*50;
|
||||
if ( color < 50 )
|
||||
color = 100;
|
||||
gr_set_color(0, color, 0);
|
||||
|
||||
if ( j == mp->nverts-1 ) {
|
||||
gr_set_color(255, 0, 0);
|
||||
@@ -6197,7 +6210,7 @@ void render_all_ship_bay_paths(object *objp)
|
||||
*/
|
||||
void render_all_subsys_paths(object *objp)
|
||||
{
|
||||
int i,j,clr;
|
||||
int i,j,color;
|
||||
polymodel *pm;
|
||||
model_path *mp;
|
||||
|
||||
@@ -6208,7 +6221,7 @@ void render_all_subsys_paths(object *objp)
|
||||
if ( pm->ship_bay == NULL )
|
||||
return;
|
||||
|
||||
memset(&v, 0, sizeof(v));
|
||||
memset(&v, 0, sizeof(v));
|
||||
|
||||
for ( i = 0; i < pm->n_paths; i++ ) {
|
||||
mp = &pm->paths[i];
|
||||
@@ -6216,10 +6229,10 @@ void render_all_subsys_paths(object *objp)
|
||||
vm_vec_unrotate(&global_path_point, &mp->verts[j].pos, &objp->orient);
|
||||
vm_vec_add2(&global_path_point, &objp->pos);
|
||||
g3_rotate_vertex(&v, &global_path_point);
|
||||
clr = 255 - j*50;
|
||||
if ( clr < 50 )
|
||||
clr = 100;
|
||||
gr_set_color(0, clr, 0);
|
||||
color = 255 - j*50;
|
||||
if ( color < 50 )
|
||||
color = 100;
|
||||
gr_set_color(0, color, 0);
|
||||
|
||||
if ( j == mp->nverts-1 ) {
|
||||
gr_set_color(255, 0, 0);
|
||||
@@ -6763,10 +6776,11 @@ void attack_set_accel(ai_info *aip, ship_info *sip, float dist_to_enemy, float d
|
||||
void get_behind_ship(ai_info *aip, ship_info *sip, float dist_to_enemy)
|
||||
{
|
||||
vec3d new_pos;
|
||||
float dot;
|
||||
float dot;
|
||||
vec3d vec_from_enemy;
|
||||
float dist;
|
||||
|
||||
vm_vec_normalized_dir(&vec_from_enemy, &Pl_objp->pos, &En_objp->pos);
|
||||
dist = vm_vec_normalized_dir(&vec_from_enemy, &Pl_objp->pos, &En_objp->pos);
|
||||
|
||||
vm_vec_scale_add(&new_pos, &En_objp->pos, &En_objp->orient.vec.fvec, -100.0f); // Pick point 100 units behind.
|
||||
ai_turn_towards_vector(&new_pos, Pl_objp, flFrametime, sip->srotation_time, NULL, NULL, 0.0f, 0);
|
||||
@@ -8010,6 +8024,10 @@ void ai_cruiser_chase()
|
||||
return;
|
||||
}
|
||||
|
||||
ship *eshipp;
|
||||
|
||||
eshipp = &Ships[En_objp->instance];
|
||||
|
||||
vec3d goal_pos;
|
||||
float turn_time = Ship_info[Ships[Pl_objp->instance].ship_info_index].srotation_time;
|
||||
|
||||
@@ -8158,7 +8176,7 @@ void ai_cruiser_chase()
|
||||
*/
|
||||
void ai_chase()
|
||||
{
|
||||
float dist_to_enemy;
|
||||
float dist_to_enemy, time_to_enemy;
|
||||
float dot_to_enemy, dot_from_enemy, real_dot_to_enemy;
|
||||
vec3d player_pos, enemy_pos, predicted_enemy_pos, real_vec_to_enemy, predicted_vec_to_enemy;
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
@@ -8239,10 +8257,11 @@ void ai_chase()
|
||||
|
||||
ai_set_positions(Pl_objp, En_objp, aip, &player_pos, &enemy_pos);
|
||||
dist_to_enemy = vm_vec_dist_quick(&player_pos, &enemy_pos);
|
||||
time_to_enemy = compute_time_to_enemy(dist_to_enemy, Pl_objp, En_objp);
|
||||
vm_vec_sub(&real_vec_to_enemy, &enemy_pos, &player_pos);
|
||||
|
||||
//Enemy position for the purpose of aiming is already calculated differently, do it explicitly here
|
||||
ai_update_aim(aip);
|
||||
ai_update_aim(aip, En_objp);
|
||||
|
||||
vm_vec_normalize(&real_vec_to_enemy);
|
||||
|
||||
@@ -10708,6 +10727,7 @@ void ai_dock()
|
||||
// This mode means to follow the path until just before the end.
|
||||
case AIS_DOCK_1:
|
||||
{
|
||||
float dist;
|
||||
int r;
|
||||
|
||||
if ((r = maybe_dock_obstructed(Pl_objp, goal_objp, 1)) != -1) {
|
||||
@@ -10718,7 +10738,7 @@ void ai_dock()
|
||||
}
|
||||
} //else {
|
||||
{
|
||||
ai_path();
|
||||
dist = ai_path();
|
||||
|
||||
if (aip->path_cur-aip->path_start >= aip->path_length-1) { // If got this far, advance no matter what.
|
||||
aip->submode = AIS_DOCK_2;
|
||||
@@ -11849,8 +11869,9 @@ int ai_formation()
|
||||
} else {
|
||||
vec3d v2f2;
|
||||
float dot_to_f2;
|
||||
float dist_to_f2;
|
||||
|
||||
vm_vec_normalized_dir(&v2f2, &future_goal_point_2, &Pl_objp->pos);
|
||||
dist_to_f2 = vm_vec_normalized_dir(&v2f2, &future_goal_point_2, &Pl_objp->pos);
|
||||
dot_to_f2 = vm_vec_dot(&v2f2, &Pl_objp->orient.vec.fvec);
|
||||
|
||||
// Leader flying like a maniac. Don't try hard to form on wing.
|
||||
@@ -14109,7 +14130,7 @@ void ai_frame(int objnum)
|
||||
}
|
||||
|
||||
if ((En_objp != NULL) && (En_objp->pos.xyz.x == Pl_objp->pos.xyz.x) && (En_objp->pos.xyz.y == Pl_objp->pos.xyz.y) && (En_objp->pos.xyz.z == Pl_objp->pos.xyz.z)) {
|
||||
mprintf(("Warning: Object and its enemy have same position. Object #" PTRDIFF_T_ARG "\n", OBJ_INDEX(Pl_objp)));
|
||||
mprintf(("Warning: Object and its enemy have same position. Object #%i\n", OBJ_INDEX(Pl_objp)));
|
||||
En_objp = NULL;
|
||||
}
|
||||
|
||||
@@ -14888,7 +14909,7 @@ void big_ship_collide_recover_start(object *objp, object *big_objp, vec3d *colli
|
||||
|
||||
float max_lethality = 0.0f;
|
||||
|
||||
void ai_update_lethality(object *pship_obj, object *other_obj, float damage)
|
||||
void ai_update_lethality(object *ship_obj, object *other_obj, float damage)
|
||||
{
|
||||
// Goober5000 - stop any trickle-down errors from ship_do_damage
|
||||
Assert(other_obj);
|
||||
@@ -14897,8 +14918,8 @@ void ai_update_lethality(object *pship_obj, object *other_obj, float damage)
|
||||
return;
|
||||
}
|
||||
|
||||
Assert(pship_obj); // Goober5000
|
||||
Assert(pship_obj->type == OBJ_SHIP);
|
||||
Assert(ship_obj); // Goober5000
|
||||
Assert(ship_obj->type == OBJ_SHIP);
|
||||
Assert(other_obj->type == OBJ_WEAPON || other_obj->type == OBJ_SHOCKWAVE);
|
||||
int dont_count = FALSE;
|
||||
|
||||
@@ -14907,7 +14928,7 @@ void ai_update_lethality(object *pship_obj, object *other_obj, float damage)
|
||||
if (Objects[parent].signature == other_obj->parent_sig) {
|
||||
|
||||
// check damage done to enemy team
|
||||
if (iff_x_attacks_y(Ships[pship_obj->instance].team, Ships[Objects[parent].instance].team)) {
|
||||
if (iff_x_attacks_y(Ships[ship_obj->instance].team, Ships[Objects[parent].instance].team)) {
|
||||
|
||||
// other is weapon
|
||||
if (other_obj->type == OBJ_WEAPON) {
|
||||
|
||||
+15
-20
@@ -11,18 +11,18 @@
|
||||
|
||||
|
||||
#include "ai/aigoals.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "mission/missionlog.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "network/multi.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "object/object.h"
|
||||
#include "object/objectdock.h"
|
||||
#include "object/waypoint.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "playerman/player.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multi.h"
|
||||
#include "ship/ship.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "object/objectdock.h"
|
||||
#include "object/waypoint.h"
|
||||
|
||||
|
||||
// all ai goals dealt with in this code are goals that are specified through
|
||||
@@ -171,7 +171,7 @@ void ai_post_process_mission()
|
||||
// Goober5000 - MK originally iterated on only the first wing; now we iterate on only the player wing
|
||||
// because the player wing may not be first
|
||||
for ( i = 0; i < MAX_STARTING_WINGS; i++ ) {
|
||||
if (Starting_wings[i] >= 0 && Starting_wings[i] == Player_ship->wingnum) {
|
||||
if ( Starting_wings[i] == Player_ship->wingnum ) {
|
||||
wing *wingp;
|
||||
|
||||
wingp = &Wings[Starting_wings[i]];
|
||||
@@ -199,17 +199,12 @@ void ai_post_process_mission()
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a goal is valid for a particular type of ship
|
||||
*
|
||||
* @param ship Ship type to test
|
||||
* @param ai_goal_type Goal type to test
|
||||
*/
|
||||
int ai_query_goal_valid( int ship, int ai_goal_type )
|
||||
// function which determines is a goal is valid for a particular type of ship
|
||||
int ai_query_goal_valid( int ship, int ai_goal )
|
||||
{
|
||||
int accepted;
|
||||
|
||||
if (ai_goal_type == AI_GOAL_NONE)
|
||||
if (ai_goal == AI_GOAL_NONE)
|
||||
return 1; // anything can have no orders.
|
||||
|
||||
accepted = 0;
|
||||
@@ -219,7 +214,7 @@ int ai_query_goal_valid( int ship, int ai_goal_type )
|
||||
int ship_type = Ship_info[Ships[ship].ship_info_index].class_type;
|
||||
if(ship_type > -1)
|
||||
{
|
||||
if(ai_goal_type & Ship_types[ship_type].ai_valid_goals) {
|
||||
if(ai_goal & Ship_types[ship_type].ai_valid_goals) {
|
||||
accepted = 1;
|
||||
}
|
||||
}
|
||||
@@ -533,7 +528,7 @@ int ai_goal_find_dockpoint(int shipnum, int dock_type)
|
||||
}
|
||||
|
||||
// function to fix up dock point references for objects.
|
||||
// passed are the pointer to goal we are working with. aip is the ai_info pointer
|
||||
// passed are the pointer to goal we are working with. aip if the ai_info pointer
|
||||
// of the ship with the order. aigp is a pointer to the goal (of aip) of which we are
|
||||
// fixing up the docking points
|
||||
void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
|
||||
@@ -542,7 +537,6 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
|
||||
|
||||
Assert ( aip->shipnum != -1 );
|
||||
shipnum = ship_name_lookup( aigp->target_name );
|
||||
Assertion ( shipnum != -1, "Couldn't find ai goal's target_name (%s); get a coder!\n", aigp->target_name );
|
||||
docker_index = -1;
|
||||
dockee_index = -1;
|
||||
|
||||
@@ -1888,8 +1882,9 @@ int ai_goal_priority_compare(const void *a, const void *b)
|
||||
// Prioritize goal list.
|
||||
// First sort on priority.
|
||||
// Then sort on time for goals of equivalent priority.
|
||||
// objnum The object number to act upon. Redundant with *aip.
|
||||
// *aip The AI info to act upon. Goals are stored at aip->goals
|
||||
void prioritize_goals(ai_info *aip)
|
||||
void prioritize_goals(int objnum, ai_info *aip)
|
||||
{
|
||||
// First sort based on priority field.
|
||||
insertion_sort(aip->goals, MAX_AI_GOALS, sizeof(ai_goal), ai_goal_priority_compare);
|
||||
@@ -2005,7 +2000,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
validate_mission_goals(objnum, aip);
|
||||
|
||||
// Sort the goal array by priority and other factors.
|
||||
prioritize_goals(aip);
|
||||
prioritize_goals(objnum, aip);
|
||||
|
||||
// Make sure there's a goal to pursue, else return.
|
||||
if (aip->goals[0].signature == -1) {
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ extern void ai_update_goal_references(ai_goal *goals, int type, const char *old_
|
||||
extern int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name);
|
||||
extern char *ai_add_dock_name(const char *str);
|
||||
|
||||
extern int ai_query_goal_valid( int ship, int ai_goal_type );
|
||||
extern int ai_query_goal_valid( int ship, int ai_goal );
|
||||
|
||||
extern void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate = 1 );
|
||||
extern void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate = 1 );
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
#ifndef _AIINTERNAL_H
|
||||
#define _AIINTERNAL_H
|
||||
|
||||
#include "ship/ship.h"
|
||||
#include "weapon/weapon.h"
|
||||
|
||||
//Returns true if the specified object is a stealth ship, false if not
|
||||
bool is_object_stealth_ship(object* objp);
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
||||
*
|
||||
* All source code herein is the property of Volition, Inc. You may not sell
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _AILOCAL_H
|
||||
#define _AILOCAL_H
|
||||
|
||||
// -- Don't put anything in here --
|
||||
// Put it in ai.h!
|
||||
|
||||
#endif
|
||||
+23
-139
@@ -1,28 +1,28 @@
|
||||
|
||||
|
||||
#include "ai/aibig.h"
|
||||
#include "ai/aiinternal.h"
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "debugconsole/console.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "ship/ship.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "weapon/beam.h"
|
||||
#include "weapon/swarm.h"
|
||||
#include "io/timer.h"
|
||||
#include "render/3d.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "ship/shipfx.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "weapon/flak.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "network/multi.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "ai/aibig.h"
|
||||
#include "object/objectdock.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "render/3d.h"
|
||||
#include "ship/ship.h"
|
||||
#include "ship/shipfx.h"
|
||||
#include "weapon/beam.h"
|
||||
#include "weapon/flak.h"
|
||||
#include "ai/aiinternal.h" //Included last, so less includes are needed
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "weapon/muzzleflash.h"
|
||||
#include "weapon/swarm.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
@@ -1377,7 +1377,7 @@ void turret_ai_update_aim(ai_info *aip, object *En_Objp, ship_subsys *ss)
|
||||
*/
|
||||
int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object *objp, object *lep, vec3d *predicted_enemy_pos, vec3d *gvec)
|
||||
{
|
||||
int ret_val __UNUSED = 0; // to be used in future, see comment @ end of function
|
||||
int ret_val __attribute__((__unused__)) = 0; // to be used in future, see comment @ end of function
|
||||
|
||||
if (ss->turret_enemy_objnum != -1) {
|
||||
model_subsystem *tp = ss->system_info;
|
||||
@@ -1870,129 +1870,21 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
fire_info.turret = turret;
|
||||
|
||||
// fire a beam weapon
|
||||
weapon_objnum = beam_fire(&fire_info);
|
||||
|
||||
if (weapon_objnum != -1) {
|
||||
objp = &Objects[weapon_objnum];
|
||||
|
||||
parent_ship->last_fired_turret = turret;
|
||||
turret->last_fired_weapon_info_index = turret_weapon_class;
|
||||
|
||||
Script_system.SetHookObjects(4, "Ship", &Objects[parent_objnum], "Weapon", nullptr, "Beam", objp, "Target", &Objects[turret->turret_enemy_objnum]);
|
||||
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[parent_objnum]);
|
||||
Script_system.RemHookVars(4, "Ship", "Weapon", "Beam", "Target");
|
||||
}
|
||||
beam_fire(&fire_info);
|
||||
|
||||
turret->flags |= SSF_HAS_FIRED; //set fired flag for scripting -nike
|
||||
return true;
|
||||
}
|
||||
// don't fire swam, but set up swarm info instead
|
||||
else if ((wip->wi_flags & WIF_SWARM) || (wip->wi_flags & WIF_CORKSCREW)) {
|
||||
ship_weapon *swp = &turret->weapons;
|
||||
if (swp->current_secondary_bank < 0) {
|
||||
swp->current_secondary_bank = 0;
|
||||
}
|
||||
int bank_to_fire = swp->current_secondary_bank;
|
||||
if ((turret->system_info->flags2 & MSS_FLAG2_TURRET_USE_AMMO) && (swp->secondary_bank_ammo[bank_to_fire] < 0)) {
|
||||
if (!(turret->system_info->flags & MSS_FLAG_USE_MULTIPLE_GUNS)) {
|
||||
swp->current_secondary_bank++;
|
||||
if (swp->current_secondary_bank >= swp->num_secondary_banks) {
|
||||
swp->current_secondary_bank = 0;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
turret_swarm_set_up_info(parent_objnum, turret, wip, turret->turret_next_fire_pos);
|
||||
turret_swarm_set_up_info(parent_objnum, turret, wip, turret->turret_next_fire_pos);
|
||||
|
||||
turret->flags |= SSF_HAS_FIRED; //set fired flag for scripting -nike
|
||||
return true;
|
||||
}
|
||||
turret->flags |= SSF_HAS_FIRED; //set fired flag for scripting -nike
|
||||
return true;
|
||||
}
|
||||
// now do anything else
|
||||
else {
|
||||
for (int i = 0; i < wip->shots; i++) {
|
||||
if (turret->system_info->flags2 & MSS_FLAG2_TURRET_USE_AMMO) {
|
||||
ship_weapon *swp;
|
||||
swp = &turret->weapons;
|
||||
int bank_to_fire, num_slots = turret->system_info->turret_num_firing_points;
|
||||
if (wip->subtype == WP_LASER) {
|
||||
int points;
|
||||
if (swp->num_primary_banks <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (swp->current_primary_bank < 0){
|
||||
swp->current_primary_bank = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
int num_primary_banks = swp->num_primary_banks;
|
||||
|
||||
Assert(num_primary_banks > 0);
|
||||
if (num_primary_banks < 1){
|
||||
return false;
|
||||
}
|
||||
|
||||
bank_to_fire = swp->current_primary_bank;
|
||||
|
||||
if (turret->system_info->flags & MSS_FLAG_TURRET_SALVO) {
|
||||
points = num_slots;
|
||||
} else {
|
||||
points = 1;
|
||||
}
|
||||
|
||||
if (swp->primary_bank_ammo[bank_to_fire] >= 0) {
|
||||
swp->primary_bank_ammo[bank_to_fire] -= points;
|
||||
} else if (!(turret->system_info->flags & MSS_FLAG_USE_MULTIPLE_GUNS) && (swp->primary_bank_ammo[bank_to_fire] < 0)) {
|
||||
swp->current_primary_bank++;
|
||||
if (swp->current_primary_bank >= swp->num_primary_banks) {
|
||||
swp->current_primary_bank = 0;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (wip->subtype == WP_MISSILE) {
|
||||
if (swp->num_secondary_banks <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (swp->current_secondary_bank < 0){
|
||||
swp->current_secondary_bank = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
bank_to_fire = swp->current_secondary_bank;
|
||||
|
||||
int start_slot, end_slot;
|
||||
|
||||
start_slot = swp->secondary_next_slot[bank_to_fire];
|
||||
end_slot = start_slot;
|
||||
|
||||
for (int j = start_slot; j <= end_slot; j++) {
|
||||
swp->secondary_next_slot[bank_to_fire]++;
|
||||
|
||||
if (swp->secondary_next_slot[bank_to_fire] > (num_slots - 1)){
|
||||
swp->secondary_next_slot[bank_to_fire] = 0;
|
||||
}
|
||||
|
||||
if (swp->secondary_bank_ammo[bank_to_fire] >= 0) {
|
||||
swp->secondary_bank_ammo[bank_to_fire]--;
|
||||
} else if (!(turret->system_info->flags & MSS_FLAG_USE_MULTIPLE_GUNS) && (swp->secondary_bank_ammo[bank_to_fire] < 0)) {
|
||||
swp->current_secondary_bank++;
|
||||
if (swp->current_secondary_bank >= swp->num_secondary_banks) {
|
||||
swp->current_secondary_bank = 0;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// zookeeper - Firepoints should cycle normally between shots,
|
||||
// so we need to get the position info separately for each shot
|
||||
ship_get_global_turret_gun_info(&Objects[parent_objnum], turret, turret_pos, turret_fvec, 1, NULL);
|
||||
@@ -2013,9 +1905,8 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
// AL 1-6-97: Store pointer to turret subsystem
|
||||
wp->turret_subsys = turret;
|
||||
|
||||
Script_system.SetHookObjects(4, "Ship", &Objects[parent_objnum], "Weapon", objp, "Beam", nullptr, "Target", &Objects[turret->turret_enemy_objnum]);
|
||||
Script_system.SetHookObjects(3, "Ship", &Objects[parent_objnum], "Weapon", objp, "Target", &Objects[turret->turret_enemy_objnum]);
|
||||
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[parent_objnum]);
|
||||
Script_system.RemHookVars(4, "Ship", "Weapon", "Beam", "Target");
|
||||
|
||||
// if the gun is a flak gun
|
||||
if (wip->wi_flags & WIF_FLAK) {
|
||||
@@ -2127,13 +2018,6 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
Weapons[Objects[weapon_objnum].instance].turret_subsys = tsi->turret;
|
||||
Weapons[Objects[weapon_objnum].instance].target_num = tsi->turret->turret_enemy_objnum;
|
||||
|
||||
Ships[Objects[tsi->parent_objnum].instance].last_fired_turret = tsi->turret;
|
||||
tsi->turret->last_fired_weapon_info_index = tsi->weapon_class;
|
||||
|
||||
Script_system.SetHookObjects(4, "Ship", &Objects[tsi->parent_objnum], "Weapon", &Objects[weapon_objnum], "Beam", nullptr, "Target", &Objects[tsi->turret->turret_enemy_objnum]);
|
||||
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[tsi->parent_objnum]);
|
||||
Script_system.RemHookVars(4, "Ship", "Weapon", "Beam", "Target");
|
||||
|
||||
// muzzle flash?
|
||||
if (Weapon_info[tsi->weapon_class].muzzle_flash >= 0) {
|
||||
mflash_create(&turret_pos, &turret_fvec, &Objects[tsi->parent_objnum].phys_info, Weapon_info[tsi->weapon_class].muzzle_flash);
|
||||
|
||||
+10
-7
@@ -10,15 +10,15 @@
|
||||
|
||||
|
||||
#include "anim/animplay.h"
|
||||
#include "anim/packunpack.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "io/timer.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "render/3d.h"
|
||||
#include "pcxutils/pcxutils.h"
|
||||
#include "anim/packunpack.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "io/timer.h"
|
||||
#include "pcxutils/pcxutils.h"
|
||||
#include "render/3d.h"
|
||||
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ anim_instance *anim_play(anim_play_struct *aps)
|
||||
int anim_show_next_frame(anim_instance *instance, float frametime)
|
||||
{
|
||||
int bitmap_id, bitmap_flags=0, new_frame_num, frame_diff=0, i, n_frames=0,frame_save;
|
||||
float percent_through, time;
|
||||
float percent_through, decompress_time, render_time, time;
|
||||
vertex image_vertex;
|
||||
int aabitmap = 0;
|
||||
int bpp = 16;
|
||||
@@ -461,6 +461,8 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
|
||||
instance->file_offset = instance->parent->file_offset;
|
||||
instance->loop_count++;
|
||||
}
|
||||
|
||||
decompress_time = f2fl(t2-t1);
|
||||
|
||||
t1 = timer_get_fixed_seconds();
|
||||
if ( frame_diff == 0 && instance->last_bitmap != -1 ) {
|
||||
@@ -512,6 +514,7 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
|
||||
}
|
||||
|
||||
t2 = timer_get_fixed_seconds();
|
||||
render_time = f2fl(t2-t1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#ifndef __ANIMPLAY_H__
|
||||
#define __ANIMPLAY_H__
|
||||
|
||||
#include "cfile/cfile.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
struct anim;
|
||||
struct anim_info;
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
|
||||
|
||||
#include "anim/animplay.h"
|
||||
#include "anim/packunpack.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "anim/animplay.h"
|
||||
|
||||
|
||||
const int packer_code = PACKER_CODE;
|
||||
|
||||
+214
-247
@@ -10,39 +10,39 @@
|
||||
|
||||
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "debugconsole/console.h"
|
||||
#include "fireball/fireballs.h"
|
||||
#include "object/object.h"
|
||||
#include "object/objcollide.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "io/timer.h"
|
||||
#include "render/3d.h"
|
||||
#include "fireball/fireballs.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/compatibility.h"
|
||||
#include "particle/particle.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "hud/hud.h"
|
||||
#include "hud/hudescort.h"
|
||||
#include "hud/hudgauges.h"
|
||||
#include "hud/hudtarget.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "io/timer.h"
|
||||
#include "localization/localize.h"
|
||||
#include "ship/shiphit.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "localization/localize.h"
|
||||
#include "stats/scoring.h"
|
||||
#include "hud/hudtarget.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "ship/ship.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "math/vecmat.h"
|
||||
#include "model/model.h"
|
||||
#include "network/multi.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "object/objcollide.h"
|
||||
#include "object/object.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "particle/particle.h"
|
||||
#include "render/3d.h"
|
||||
#include "ship/ship.h"
|
||||
#include "ship/shiphit.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "stats/scoring.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multi.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "globalincs/compatibility.h"
|
||||
|
||||
#define ASTEROID_OBJ_USED (1<<0) // flag used in asteroid_obj struct
|
||||
#define MAX_ASTEROID_OBJS MAX_ASTEROIDS // max number of asteroids tracked in asteroid list
|
||||
@@ -898,7 +898,7 @@ void lerp(float *goal, float f1, float f2, float scale)
|
||||
*goal = (f2 - f1) * scale + f1;
|
||||
}
|
||||
|
||||
void asteroid_process_pre( object *objp )
|
||||
void asteroid_process_pre( object *objp, float frame_time)
|
||||
{
|
||||
if (Asteroids_enabled) {
|
||||
// Make vel chase desired_vel
|
||||
@@ -946,18 +946,18 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
}
|
||||
|
||||
// asteroid ship collision -- use asteroid_hit_info to calculate physics
|
||||
object *pship_obj = other_obj;
|
||||
Assert( pship_obj->type == OBJ_SHIP );
|
||||
object *ship_obj = other_obj;
|
||||
Assert( ship_obj->type == OBJ_SHIP );
|
||||
|
||||
object* heavy = asteroid_hit_info->heavy;
|
||||
object* lighter = asteroid_hit_info->light;
|
||||
object* light = asteroid_hit_info->light;
|
||||
object *heavy_obj = heavy;
|
||||
object *light_obj = lighter;
|
||||
object *light_obj = light;
|
||||
|
||||
vec3d zero, p0, p1;
|
||||
vm_vec_zero( &zero );
|
||||
vm_vec_sub( &p0, &lighter->last_pos, &heavy->last_pos );
|
||||
vm_vec_sub( &p1, &lighter->pos, &heavy->pos );
|
||||
vm_vec_sub( &p0, &light->last_pos, &heavy->last_pos );
|
||||
vm_vec_sub( &p1, &light->pos, &heavy->pos );
|
||||
|
||||
mc.pos = &zero; // The object's position
|
||||
mc.p0 = &p0; // Point 1 of ray to check
|
||||
@@ -979,19 +979,19 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
// HACK - this applies to big ships warping in/out of asteroid fields - not sure what it does
|
||||
if (vm_vec_mag(&asteroid_hit_info->light_rel_vel) > 300) {
|
||||
asteroid_hit_info->collide_rotate = 0;
|
||||
vm_vec_sub( &asteroid_hit_info->light_rel_vel, &lighter->phys_info.vel, &heavy->phys_info.vel );
|
||||
vm_vec_sub( &asteroid_hit_info->light_rel_vel, &light->phys_info.vel, &heavy->phys_info.vel );
|
||||
}
|
||||
} else {
|
||||
asteroid_hit_info->collide_rotate = 0;
|
||||
vm_vec_sub( &asteroid_hit_info->light_rel_vel, &lighter->phys_info.vel, &heavy->phys_info.vel );
|
||||
vm_vec_sub( &asteroid_hit_info->light_rel_vel, &light->phys_info.vel, &heavy->phys_info.vel );
|
||||
}
|
||||
|
||||
int mc_ret_val = 0;
|
||||
|
||||
if ( asteroid_hit_info->heavy == pship_obj ) { // ship is heavier, so asteroid is sphere. Check sphere collision against ship poly model
|
||||
mc.model_instance_num = Ships[pship_obj->instance].model_instance_num;
|
||||
mc.model_num = Ship_info[Ships[pship_obj->instance].ship_info_index].model_num; // Fill in the model to check
|
||||
mc.orient = &pship_obj->orient; // The object's orient
|
||||
if ( asteroid_hit_info->heavy == ship_obj ) { // ship is heavier, so asteroid is sphere. Check sphere collision against ship poly model
|
||||
mc.model_instance_num = Ships[ship_obj->instance].model_instance_num;
|
||||
mc.model_num = Ship_info[Ships[ship_obj->instance].ship_info_index].model_num; // Fill in the model to check
|
||||
mc.orient = &ship_obj->orient; // The object's orient
|
||||
mc.radius = pasteroid->radius;
|
||||
mc.flags = (MC_CHECK_MODEL | MC_CHECK_SPHERELINE);
|
||||
|
||||
@@ -1020,7 +1020,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
|
||||
// Get polymodel and turn off all rotating submodels, collide against only 1 at a time.
|
||||
pm = model_get(Ship_info[Ships[heavy_obj->instance].ship_info_index].model_num);
|
||||
pmi = model_get_instance(Ships[pship_obj->instance].model_instance_num);
|
||||
pmi = model_get_instance(Ships[ship_obj->instance].model_instance_num);
|
||||
|
||||
// turn off all rotating submodels and test for collision
|
||||
for (size_t j=0; j<submodel_vector.size(); j++) {
|
||||
@@ -1111,7 +1111,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
mc.model_num = Asteroid_info[Asteroids[num].asteroid_type].model_num[asteroid_subtype]; // Fill in the model to check
|
||||
model_clear_instance( mc.model_num );
|
||||
mc.orient = &pasteroid->orient; // The object's orient
|
||||
mc.radius = model_get_core_radius(Ship_info[Ships[pship_obj->instance].ship_info_index].model_num);
|
||||
mc.radius = model_get_core_radius(Ship_info[Ships[ship_obj->instance].ship_info_index].model_num);
|
||||
|
||||
// check for collision between asteroid model and ship sphere
|
||||
mc.flags = (MC_CHECK_MODEL | MC_CHECK_SPHERELINE);
|
||||
@@ -1162,7 +1162,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
}
|
||||
}
|
||||
|
||||
void asteroid_render_DEPRECATED(object * obj)
|
||||
void asteroid_render(object * obj)
|
||||
{
|
||||
if (Asteroids_enabled) {
|
||||
int num;
|
||||
@@ -1176,32 +1176,7 @@ void asteroid_render_DEPRECATED(object * obj)
|
||||
Assert( asp->flags & AF_USED );
|
||||
|
||||
model_clear_instance( Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype]);
|
||||
|
||||
model_render_DEPRECATED(Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype], &obj->orient, &obj->pos, MR_DEPRECATED_NORMAL|MR_DEPRECATED_IS_ASTEROID, OBJ_INDEX(obj) ); // Replace MR_NORMAL with 0x07 for big yellow blobs
|
||||
}
|
||||
}
|
||||
|
||||
void asteroid_render(object * obj, draw_list *scene)
|
||||
{
|
||||
if (Asteroids_enabled) {
|
||||
int num;
|
||||
asteroid *asp;
|
||||
|
||||
num = obj->instance;
|
||||
|
||||
Assert((num >= 0) && (num < MAX_ASTEROIDS));
|
||||
asp = &Asteroids[num];
|
||||
|
||||
Assert( asp->flags & AF_USED );
|
||||
|
||||
model_clear_instance( Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype]);
|
||||
|
||||
model_render_params render_info;
|
||||
|
||||
render_info.set_object_number( OBJ_INDEX(obj) );
|
||||
render_info.set_flags(MR_IS_ASTEROID);
|
||||
|
||||
model_render_queue(&render_info, scene, Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype], &obj->orient, &obj->pos); // Replace MR_NORMAL with 0x07 for big yellow blobs
|
||||
model_render(Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype], &obj->orient, &obj->pos, MR_NORMAL|MR_IS_ASTEROID, OBJ_INDEX(obj) ); // Replace MR_NORMAL with 0x07 for big yellow blobs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1355,42 +1330,42 @@ void asteroid_do_area_effect(object *asteroid_objp)
|
||||
/**
|
||||
* Upon asteroid asteroid_obj being hit. Apply damage and maybe make it break into smaller asteroids.
|
||||
*
|
||||
* @param pasteroid_obj pointer to asteroid object getting hit
|
||||
* @param asteroid_obj pointer to asteroid object getting hit
|
||||
* @param other_obj object that hit asteroid, can be NULL if asteroid hit by area effect
|
||||
* @param hitpos world position asteroid was hit, can be NULL if hit by area effect
|
||||
* @param damage amount of damage to apply to asteroid
|
||||
*/
|
||||
void asteroid_hit( object * pasteroid_obj, object * other_obj, vec3d * hitpos, float damage )
|
||||
void asteroid_hit( object * asteroid_obj, object * other_obj, vec3d * hitpos, float damage )
|
||||
{
|
||||
float explosion_life;
|
||||
asteroid *asp;
|
||||
|
||||
asp = &Asteroids[pasteroid_obj->instance];
|
||||
asp = &Asteroids[asteroid_obj->instance];
|
||||
|
||||
if (pasteroid_obj->flags & OF_SHOULD_BE_DEAD){
|
||||
if (asteroid_obj->flags & OF_SHOULD_BE_DEAD){
|
||||
return;
|
||||
}
|
||||
|
||||
if ( MULTIPLAYER_MASTER ){
|
||||
send_asteroid_hit( pasteroid_obj, other_obj, hitpos, damage );
|
||||
send_asteroid_hit( asteroid_obj, other_obj, hitpos, damage );
|
||||
}
|
||||
|
||||
pasteroid_obj->hull_strength -= damage;
|
||||
asteroid_obj->hull_strength -= damage;
|
||||
|
||||
if (pasteroid_obj->hull_strength < 0.0f) {
|
||||
if (asteroid_obj->hull_strength < 0.0f) {
|
||||
if ( asp->final_death_time <= 0 ) {
|
||||
int play_loud_collision = 0;
|
||||
|
||||
explosion_life = asteroid_create_explosion(pasteroid_obj);
|
||||
explosion_life = asteroid_create_explosion(asteroid_obj);
|
||||
|
||||
asteriod_explode_sound(pasteroid_obj, asp->asteroid_type, play_loud_collision);
|
||||
asteroid_do_area_effect(pasteroid_obj);
|
||||
asteriod_explode_sound(asteroid_obj, asp->asteroid_type, play_loud_collision);
|
||||
asteroid_do_area_effect(asteroid_obj);
|
||||
|
||||
asp->final_death_time = timestamp( fl2i(explosion_life*1000.0f)/5 ); // Wait till 30% of vclip time before breaking the asteroid up.
|
||||
if ( hitpos ) {
|
||||
asp->death_hit_pos = *hitpos;
|
||||
} else {
|
||||
asp->death_hit_pos = pasteroid_obj->pos;
|
||||
asp->death_hit_pos = asteroid_obj->pos;
|
||||
// randomize hit pos a bit, otherwise we will get a NULL vector when trying to find direction to toss child asteroids
|
||||
vec3d rand_vec;
|
||||
vm_vec_rand_vec_quick(&rand_vec);
|
||||
@@ -1409,7 +1384,7 @@ void asteroid_hit( object * pasteroid_obj, object * other_obj, vec3d * hitpos, f
|
||||
}
|
||||
|
||||
// evaluate any relevant player scoring implications
|
||||
scoring_eval_hit(pasteroid_obj,other_obj);
|
||||
scoring_eval_hit(asteroid_obj,other_obj);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1474,21 +1449,21 @@ int asteroid_count()
|
||||
* See if asteroid should split up.
|
||||
* We delay splitting up to allow the explosion animation to play for a bit.
|
||||
*/
|
||||
void asteroid_maybe_break_up(object *pasteroid_obj)
|
||||
void asteroid_maybe_break_up(object *asteroid_obj)
|
||||
{
|
||||
asteroid *asp;
|
||||
asteroid_info *asip;
|
||||
|
||||
asp = &Asteroids[pasteroid_obj->instance];
|
||||
asp = &Asteroids[asteroid_obj->instance];
|
||||
asip = &Asteroid_info[asp->asteroid_type];
|
||||
|
||||
if ( timestamp_elapsed(asp->final_death_time) ) {
|
||||
vec3d relvec, vfh, tvec;
|
||||
|
||||
Script_system.SetHookObject("Self", pasteroid_obj);
|
||||
if(!Script_system.IsConditionOverride(CHA_DEATH, pasteroid_obj))
|
||||
Script_system.SetHookObject("Self", asteroid_obj);
|
||||
if(!Script_system.IsConditionOverride(CHA_DEATH, asteroid_obj))
|
||||
{
|
||||
pasteroid_obj->flags |= OF_SHOULD_BE_DEAD;
|
||||
asteroid_obj->flags |= OF_SHOULD_BE_DEAD;
|
||||
|
||||
// multiplayer clients won't go through the following code. asteroid_sub_create will send
|
||||
// a create packet to the client in the above named function
|
||||
@@ -1499,29 +1474,29 @@ void asteroid_maybe_break_up(object *pasteroid_obj)
|
||||
case ASTEROID_TYPE_SMALL:
|
||||
break;
|
||||
case ASTEROID_TYPE_MEDIUM:
|
||||
asc_get_relvec(&relvec, pasteroid_obj, &asp->death_hit_pos);
|
||||
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_SMALL, &relvec);
|
||||
asc_get_relvec(&relvec, asteroid_obj, &asp->death_hit_pos);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &relvec);
|
||||
|
||||
vm_vec_normalized_dir(&vfh, &pasteroid_obj->pos, &asp->death_hit_pos);
|
||||
vm_vec_normalized_dir(&vfh, &asteroid_obj->pos, &asp->death_hit_pos);
|
||||
vm_vec_copy_scale(&tvec, &vfh, 2.0f);
|
||||
vm_vec_sub2(&tvec, &relvec);
|
||||
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_SMALL, &tvec);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec);
|
||||
|
||||
break;
|
||||
case ASTEROID_TYPE_LARGE:
|
||||
asc_get_relvec(&relvec, pasteroid_obj, &asp->death_hit_pos);
|
||||
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_MEDIUM, &relvec);
|
||||
asc_get_relvec(&relvec, asteroid_obj, &asp->death_hit_pos);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &relvec);
|
||||
|
||||
vm_vec_normalized_dir(&vfh, &pasteroid_obj->pos, &asp->death_hit_pos);
|
||||
vm_vec_normalized_dir(&vfh, &asteroid_obj->pos, &asp->death_hit_pos);
|
||||
vm_vec_copy_scale(&tvec, &vfh, 2.0f);
|
||||
vm_vec_sub2(&tvec, &relvec);
|
||||
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_MEDIUM, &tvec);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &tvec);
|
||||
|
||||
while (frand() > 0.6f) {
|
||||
vec3d rvec, tvec2;
|
||||
vm_vec_rand_vec_quick(&rvec);
|
||||
vm_vec_scale_add(&tvec2, &vfh, &rvec, 0.75f);
|
||||
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_SMALL, &tvec2);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec2);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1570,24 +1545,24 @@ void asteroid_maybe_break_up(object *pasteroid_obj)
|
||||
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);
|
||||
vm_vec_copy_normalize(&parent_vel, &asteroid_obj->phys_info.vel);
|
||||
vm_vec_scale(&parent_vel, 0.5f);
|
||||
|
||||
// Make the hit position affect the direction, but only a little
|
||||
vm_vec_sub(&hit_rel_vec, &pasteroid_obj->pos, &asp->death_hit_pos);
|
||||
vm_vec_sub(&hit_rel_vec, &asteroid_obj->pos, &asp->death_hit_pos);
|
||||
vm_vec_normalize(&hit_rel_vec);
|
||||
vm_vec_scale(&hit_rel_vec, 0.25f);
|
||||
|
||||
vm_vec_avg3(&final_vec, &parent_vel, &hit_rel_vec, &dir_vec);
|
||||
vm_vec_normalize(&final_vec);
|
||||
|
||||
asteroid_sub_create(pasteroid_obj, roids_to_create[i], &final_vec);
|
||||
asteroid_sub_create(asteroid_obj, roids_to_create[i], &final_vec);
|
||||
}
|
||||
}
|
||||
}
|
||||
asp->final_death_time = timestamp(-1);
|
||||
}
|
||||
Script_system.RunCondition(CHA_DEATH, '\0', NULL, pasteroid_obj);
|
||||
Script_system.RunCondition(CHA_DEATH, '\0', NULL, asteroid_obj);
|
||||
Script_system.RemHookVar("Self");
|
||||
}
|
||||
}
|
||||
@@ -1611,36 +1586,36 @@ int asteroid_get_random_in_cone(vec3d *pos, vec3d *dir, float ang, int danger)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void asteroid_test_collide(object *pasteroid_obj, object *pship_obj, mc_info *mc, bool lazy = false)
|
||||
void asteroid_test_collide(object *asteroid_obj, object *ship_obj, mc_info *mc, bool lazy = false)
|
||||
{
|
||||
float asteroid_ray_dist;
|
||||
vec3d asteroid_fvec, terminus;
|
||||
|
||||
// See if ray from asteroid intersects bounding box of escort ship
|
||||
asteroid_ray_dist = vm_vec_mag_quick(&pasteroid_obj->phys_info.desired_vel) * ASTEROID_MIN_COLLIDE_TIME;
|
||||
asteroid_fvec = pasteroid_obj->phys_info.desired_vel;
|
||||
asteroid_ray_dist = vm_vec_mag_quick(&asteroid_obj->phys_info.desired_vel) * ASTEROID_MIN_COLLIDE_TIME;
|
||||
asteroid_fvec = asteroid_obj->phys_info.desired_vel;
|
||||
|
||||
if(IS_VEC_NULL_SQ_SAFE(&asteroid_fvec)){
|
||||
terminus = pasteroid_obj->pos;
|
||||
terminus = asteroid_obj->pos;
|
||||
} else {
|
||||
vm_vec_normalize(&asteroid_fvec);
|
||||
vm_vec_scale_add(&terminus, &pasteroid_obj->pos, &asteroid_fvec, asteroid_ray_dist);
|
||||
vm_vec_scale_add(&terminus, &asteroid_obj->pos, &asteroid_fvec, asteroid_ray_dist);
|
||||
}
|
||||
|
||||
Assert(pship_obj->type == OBJ_SHIP);
|
||||
Assert(ship_obj->type == OBJ_SHIP);
|
||||
|
||||
mc->model_instance_num = Ships[pship_obj->instance].model_instance_num;
|
||||
mc->model_num = Ship_info[Ships[pship_obj->instance].ship_info_index].model_num; // Fill in the model to check
|
||||
mc->orient = &pship_obj->orient; // The object's orientation
|
||||
mc->pos = &pship_obj->pos; // The object's position
|
||||
mc->p0 = &pasteroid_obj->pos; // Point 1 of ray to check
|
||||
mc->model_instance_num = Ships[ship_obj->instance].model_instance_num;
|
||||
mc->model_num = Ship_info[Ships[ship_obj->instance].ship_info_index].model_num; // Fill in the model to check
|
||||
mc->orient = &ship_obj->orient; // The object's orientation
|
||||
mc->pos = &ship_obj->pos; // The object's position
|
||||
mc->p0 = &asteroid_obj->pos; // Point 1 of ray to check
|
||||
mc->p1 = &terminus; // Point 2 of ray to check
|
||||
if (lazy) {
|
||||
mc->flags = MC_CHECK_MODEL | MC_ONLY_BOUND_BOX;
|
||||
} else {
|
||||
mc->flags = MC_CHECK_MODEL | MC_CHECK_SPHERELINE;
|
||||
}
|
||||
mc->radius = pasteroid_obj->radius;
|
||||
mc->radius = asteroid_obj->radius;
|
||||
|
||||
model_collide(mc);
|
||||
|
||||
@@ -1648,17 +1623,14 @@ void asteroid_test_collide(object *pasteroid_obj, object *pship_obj, mc_info *mc
|
||||
mc->p1 = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if asteroid will collide with escort ship within ASTEROID_MIN_COLLIDE_TIME seconds
|
||||
*
|
||||
* @return !0 if the asteroid will collide with the escort
|
||||
*/
|
||||
int asteroid_will_collide(object *pasteroid_obj, object *escort_objp)
|
||||
// Return !0 is the asteroid will collide with the escort ship within ASTEROID_MIN_COLLIDE_TIME
|
||||
// seconds
|
||||
int asteroid_will_collide(object *asteroid_obj, object *escort_objp)
|
||||
{
|
||||
mc_info mc;
|
||||
mc_info_init(&mc);
|
||||
|
||||
asteroid_test_collide(pasteroid_obj, escort_objp, &mc);
|
||||
asteroid_test_collide(asteroid_obj, escort_objp, &mc);
|
||||
|
||||
if ( !mc.num_hits ) {
|
||||
return 0;
|
||||
@@ -1742,7 +1714,7 @@ void asteroid_verify_collide_objnum(asteroid *asp)
|
||||
}
|
||||
}
|
||||
|
||||
void asteroid_process_post(object * obj)
|
||||
void asteroid_process_post(object * obj, float frame_time)
|
||||
{
|
||||
if (Asteroids_enabled) {
|
||||
int num;
|
||||
@@ -1915,149 +1887,144 @@ that is being protected.
|
||||
void asteroid_parse_tbl()
|
||||
{
|
||||
char impact_ani_file[MAX_FILENAME_LEN];
|
||||
int rval;
|
||||
|
||||
// How did we get here without having any species defined?
|
||||
Assertion(Species_info.size() > 0,
|
||||
"Cannot parse asteroids/debris if there "
|
||||
"are no species for them to belong to."
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
read_file_text("asteroid.tbl", CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
required_string("#Asteroid Types");
|
||||
|
||||
int tally = 0;
|
||||
int max_asteroids =
|
||||
NUM_DEBRIS_SIZES + Species_info.size() * NUM_DEBRIS_SIZES;
|
||||
|
||||
#ifndef NDEBUG
|
||||
SCP_vector<SCP_string> parsed_asteroids;
|
||||
#endif
|
||||
|
||||
// parse and tally each asteroid
|
||||
while (required_string_either("#End", "$Name:"))
|
||||
{
|
||||
asteroid_info new_asteroid;
|
||||
|
||||
asteroid_parse_section(&new_asteroid);
|
||||
|
||||
int species = tally / NUM_DEBRIS_SIZES;
|
||||
if (tally >= max_asteroids)
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
// Bump the warning count in release so they get something
|
||||
// even if the message never gets displayed.
|
||||
Warning(LOCATION, "Ignoring extra asteroid/debris");
|
||||
#else
|
||||
SCP_string msg("Ignoring extra asteroid/debris '");
|
||||
msg.append(new_asteroid.name);
|
||||
msg.append("'\n");
|
||||
Warning(LOCATION, "%s", msg.c_str());
|
||||
parsed_asteroids.push_back(msg);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
SCP_string msg;
|
||||
msg.append("Parsing asteroid: '");
|
||||
msg.append(new_asteroid.name);
|
||||
msg.append("' as a '");
|
||||
msg.append((species == 0) ? "generic" : Species_info[species - 1].species_name);
|
||||
msg.append("'");
|
||||
switch (tally % NUM_DEBRIS_SIZES) {
|
||||
case ASTEROID_TYPE_SMALL:
|
||||
msg.append(" small\n");
|
||||
break;
|
||||
case ASTEROID_TYPE_MEDIUM:
|
||||
msg.append(" medium\n");
|
||||
break;
|
||||
case ASTEROID_TYPE_LARGE:
|
||||
msg.append(" large\n");
|
||||
break;
|
||||
default:
|
||||
Error(LOCATION, "Get a coder! Math has broken!\n"
|
||||
"Important numbers:\n"
|
||||
"\ttally: %d\n"
|
||||
"\tNUM_DEBRIS_SIZES: %d\n",
|
||||
tally, NUM_DEBRIS_SIZES
|
||||
);
|
||||
msg.append(" unknown\n");
|
||||
}
|
||||
parsed_asteroids.push_back(msg);
|
||||
#endif
|
||||
Asteroid_info.push_back(new_asteroid);
|
||||
}
|
||||
tally++;
|
||||
}
|
||||
required_string("#End");
|
||||
|
||||
if (tally != max_asteroids)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
for (SCP_vector<SCP_string>::iterator iter = parsed_asteroids.begin();
|
||||
iter != parsed_asteroids.end(); ++iter)
|
||||
{
|
||||
mprintf(("Asteroid.tbl as parsed:\n"));
|
||||
mprintf(("%s", iter->c_str()));
|
||||
}
|
||||
#endif
|
||||
Error(LOCATION,
|
||||
"Found %d asteroids/debris when %d expected\n\n"
|
||||
"<Number expected> = <Number of species> * %d + %d generic asteroids\n"
|
||||
"%d = " SIZE_T_ARG "*%d + %d\n\n"
|
||||
#ifdef NDEBUG
|
||||
"Run a debug build to see a list of all parsed asteroids\n",
|
||||
#else
|
||||
"See the debug.log for a listing of all parsed asteroids\n",
|
||||
#endif
|
||||
tally, max_asteroids,
|
||||
NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES,
|
||||
max_asteroids, Species_info.size(), NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES
|
||||
);
|
||||
}
|
||||
|
||||
Asteroid_impact_explosion_ani = -1;
|
||||
required_string("$Impact Explosion:");
|
||||
stuff_string(impact_ani_file, F_NAME, MAX_FILENAME_LEN);
|
||||
|
||||
if (VALID_FNAME(impact_ani_file)) {
|
||||
int num_frames;
|
||||
Asteroid_impact_explosion_ani = bm_load_animation(impact_ani_file, &num_frames, NULL, NULL, 1);
|
||||
}
|
||||
|
||||
required_string("$Impact Explosion Radius:");
|
||||
stuff_float(&Asteroid_impact_explosion_radius);
|
||||
|
||||
if (optional_string("$Briefing Icon Closeup Model:")) {
|
||||
stuff_string(Asteroid_icon_closeup_model, F_NAME, NAME_LENGTH);
|
||||
}
|
||||
else {
|
||||
strcpy_s(Asteroid_icon_closeup_model, Asteroid_info[ASTEROID_TYPE_LARGE].pof_files[0]); // magic file from retail
|
||||
}
|
||||
|
||||
if (optional_string("$Briefing Icon Closeup Position:")) {
|
||||
stuff_vec3d(&Asteroid_icon_closeup_position);
|
||||
}
|
||||
else {
|
||||
vm_vec_make(&Asteroid_icon_closeup_position, 0.0f, 0.0f, -334.0f); // magic numbers from retail
|
||||
}
|
||||
|
||||
if (optional_string("$Briefing Icon Closeup Zoom:")) {
|
||||
stuff_float(&Asteroid_icon_closeup_zoom);
|
||||
}
|
||||
else {
|
||||
Asteroid_icon_closeup_zoom = 0.5f; // magic number from retail
|
||||
}
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "asteroid.tbl", e.what()));
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "asteroid.tbl", rval));
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text("asteroid.tbl", CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
required_string("#Asteroid Types");
|
||||
|
||||
int tally = 0;
|
||||
int max_asteroids =
|
||||
NUM_DEBRIS_SIZES + Species_info.size() * NUM_DEBRIS_SIZES;
|
||||
|
||||
#ifndef NDEBUG
|
||||
SCP_vector<SCP_string> parsed_asteroids;
|
||||
#endif
|
||||
|
||||
// parse and tally each asteroid
|
||||
while (required_string_either("#End","$Name:"))
|
||||
{
|
||||
asteroid_info new_asteroid;
|
||||
|
||||
asteroid_parse_section( &new_asteroid );
|
||||
|
||||
int species = tally / NUM_DEBRIS_SIZES;
|
||||
if (tally >= max_asteroids)
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
// Bump the warning count in release so they get something
|
||||
// even if the message never gets displayed.
|
||||
Warning(LOCATION, "Ignoring extra asteroid/debris");
|
||||
#else
|
||||
SCP_string msg("Ignoring extra asteroid/debris '");
|
||||
msg.append(new_asteroid.name);
|
||||
msg.append("'\n");
|
||||
Warning(LOCATION,msg.c_str());
|
||||
parsed_asteroids.push_back(msg);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
SCP_string msg;
|
||||
msg.append("Parsing asteroid: '");
|
||||
msg.append(new_asteroid.name);
|
||||
msg.append("' as a '");
|
||||
msg.append((species == 0)?"generic":Species_info[species-1].species_name);
|
||||
msg.append("'");
|
||||
switch(tally % NUM_DEBRIS_SIZES) {
|
||||
case ASTEROID_TYPE_SMALL:
|
||||
msg.append(" small\n");
|
||||
break;
|
||||
case ASTEROID_TYPE_MEDIUM:
|
||||
msg.append(" medium\n");
|
||||
break;
|
||||
case ASTEROID_TYPE_LARGE:
|
||||
msg.append(" large\n");
|
||||
break;
|
||||
default:
|
||||
Error(LOCATION, "Get a coder! Math has broken!\n"
|
||||
"Important numbers:\n"
|
||||
"\ttally: %d\n"
|
||||
"\tNUM_DEBRIS_SIZES: %d\n",
|
||||
tally, NUM_DEBRIS_SIZES
|
||||
);
|
||||
msg.append(" unknown\n");
|
||||
}
|
||||
parsed_asteroids.push_back(msg);
|
||||
#endif
|
||||
Asteroid_info.push_back(new_asteroid);
|
||||
}
|
||||
tally++;
|
||||
}
|
||||
required_string("#End");
|
||||
|
||||
if (tally != max_asteroids)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
for(SCP_vector<SCP_string>::iterator iter = parsed_asteroids.begin();
|
||||
iter != parsed_asteroids.end(); ++iter)
|
||||
{
|
||||
mprintf(("Asteroid.tbl as parsed:\n"));
|
||||
mprintf((iter->c_str()));
|
||||
}
|
||||
#endif
|
||||
Error(LOCATION,
|
||||
"Found %d asteroids/debris when %d expected\n\n"
|
||||
"<Number expected> = <Number of species> * %d + %d generic asteroids\n"
|
||||
"%d = %d*%d + %d\n\n"
|
||||
#ifdef NDEBUG
|
||||
"Run a debug build to see a list of all parsed asteroids\n",
|
||||
#else
|
||||
"See the debug.log for a listing of all parsed asteroids\n",
|
||||
#endif
|
||||
tally, max_asteroids,
|
||||
NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES,
|
||||
max_asteroids, Species_info.size(), NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES
|
||||
);
|
||||
}
|
||||
|
||||
Asteroid_impact_explosion_ani = -1;
|
||||
required_string("$Impact Explosion:");
|
||||
stuff_string(impact_ani_file, F_NAME, MAX_FILENAME_LEN);
|
||||
|
||||
if ( VALID_FNAME(impact_ani_file) ) {
|
||||
int num_frames;
|
||||
Asteroid_impact_explosion_ani = bm_load_animation( impact_ani_file, &num_frames, NULL, NULL, 1);
|
||||
}
|
||||
|
||||
required_string("$Impact Explosion Radius:");
|
||||
stuff_float(&Asteroid_impact_explosion_radius);
|
||||
|
||||
if (optional_string("$Briefing Icon Closeup Model:")) {
|
||||
stuff_string(Asteroid_icon_closeup_model, F_NAME, NAME_LENGTH);
|
||||
} else {
|
||||
strcpy_s(Asteroid_icon_closeup_model, Asteroid_info[ASTEROID_TYPE_LARGE].pof_files[0]); // magic file from retail
|
||||
}
|
||||
|
||||
if (optional_string("$Briefing Icon Closeup Position:")) {
|
||||
stuff_vec3d(&Asteroid_icon_closeup_position);
|
||||
} else {
|
||||
vm_vec_make(&Asteroid_icon_closeup_position, 0.0f, 0.0f, -334.0f); // magic numbers from retail
|
||||
}
|
||||
|
||||
if (optional_string("$Briefing Icon Closeup Zoom:")) {
|
||||
stuff_float(&Asteroid_icon_closeup_zoom);
|
||||
} else {
|
||||
Asteroid_icon_closeup_zoom = 0.5f; // magic number from retail
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,14 +12,13 @@
|
||||
#ifndef __ASTEROID_H__
|
||||
#define __ASTEROID_H__
|
||||
|
||||
#include "globalincs/globals.h" // for NAME_LENGTH
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h" // for NAME_LENGTH
|
||||
|
||||
|
||||
class object;
|
||||
class polymodel;
|
||||
struct collision_info_struct;
|
||||
class draw_list;
|
||||
|
||||
#define MAX_ASTEROIDS 512
|
||||
|
||||
@@ -151,13 +150,12 @@ void asteroid_init();
|
||||
void asteroid_level_init();
|
||||
void asteroid_level_close();
|
||||
void asteroid_create_all();
|
||||
void asteroid_render_DEPRECATED( object *asteroid_objp );
|
||||
void asteroid_render(object * obj, draw_list *scene);
|
||||
void asteroid_render( object *asteroid_objp );
|
||||
void asteroid_delete( object *asteroid_objp );
|
||||
void asteroid_process_pre( object *asteroid_objp );
|
||||
void asteroid_process_post( object *asteroid_objp);
|
||||
void asteroid_process_pre( object *asteroid_objp, float frame_time);
|
||||
void asteroid_process_post( object *asteroid_objp, float frame_time);
|
||||
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vec3d * hitpos, collision_info_struct *asteroid_hit_info=NULL );
|
||||
void asteroid_hit( object *pasteroid_objp, object *other_objp, vec3d *hitpos, float damage );
|
||||
void asteroid_hit( object *asteroid_objp, object *other_objp, vec3d *hitpos, float damage );
|
||||
int asteroid_count();
|
||||
int asteroid_collide_objnum(object *asteroid_objp);
|
||||
float asteroid_time_to_impact(object *asteroid_objp);
|
||||
|
||||
@@ -5,28 +5,28 @@
|
||||
|
||||
|
||||
|
||||
#include "autopilot/autopilot.h"
|
||||
#include "ai/ai.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "autopilot/autopilot.h"
|
||||
#include "camera/camera.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "gamesnd/eventmusic.h"
|
||||
#include "globalincs/def_files.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "io/timer.h"
|
||||
#include "localization/localize.h"
|
||||
#include "mission/missionmessage.h"
|
||||
#include "mission/missiontraining.h"
|
||||
#include "ship/ship.h"
|
||||
#include "object/object.h"
|
||||
#include "object/objcollide.h"
|
||||
#include "object/waypoint.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "ship/ship.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "sound/audiostr.h"
|
||||
|
||||
#include "mission/missiontraining.h"
|
||||
#include "mission/missionmessage.h"
|
||||
#include "io/timer.h"
|
||||
#include "gamesnd/eventmusic.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "globalincs/def_files.h"
|
||||
#include "localization/localize.h"
|
||||
#include "camera/camera.h"
|
||||
#include "asteroid/asteroid.h"
|
||||
#include <map>
|
||||
|
||||
// Extern functions/variables
|
||||
@@ -243,9 +243,9 @@ bool StartAutopilot()
|
||||
if (shipp->team != Player_ship->team)
|
||||
continue;
|
||||
|
||||
Assertion((shipp->ship_info_index >= 0) && (shipp->ship_info_index < static_cast<int>(Ship_info.size())),
|
||||
Assertion((shipp->ship_info_index >= 0) && (shipp->ship_info_index < MAX_SHIP_CLASSES),
|
||||
"Ship '%s' does not have a valid pointer to a ship class. Pointer is %d, which is smaller than 0 or bigger than %d",
|
||||
shipp->ship_name, shipp->ship_info_index, static_cast<int>(Ship_info.size()));
|
||||
shipp->ship_name, shipp->ship_info_index, MAX_SHIP_CLASSES);
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
if ( !(sip->flags & SIF_SUPPORT) )
|
||||
@@ -1271,69 +1271,68 @@ void NavSystem_Init()
|
||||
|
||||
void parse_autopilot_table(char *filename)
|
||||
{
|
||||
int rval;
|
||||
SCP_vector<SCP_string> lines;
|
||||
|
||||
try
|
||||
if ((rval = setjmp(parse_abort)) != 0)
|
||||
{
|
||||
if (filename == NULL)
|
||||
read_file_text_from_array(defaults_get_file("autopilot.tbl"));
|
||||
else
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
|
||||
reset_parse();
|
||||
|
||||
|
||||
required_string("#Autopilot");
|
||||
|
||||
// autopilot link distance
|
||||
required_string("$Link Distance:");
|
||||
stuff_int(&NavLinkDistance);
|
||||
|
||||
if (optional_string("$Interrupt autopilot if enemy within distance:"))
|
||||
stuff_int(&AutopilotMinEnemyDistance);
|
||||
else
|
||||
AutopilotMinEnemyDistance = 5000;
|
||||
|
||||
if (optional_string("$Interrupt autopilot if asteroid within distance:"))
|
||||
stuff_int(&AutopilotMinAsteroidDistance);
|
||||
else
|
||||
AutopilotMinAsteroidDistance = 1000;
|
||||
|
||||
if (optional_string("$Lock Weapons During Autopilot:"))
|
||||
stuff_boolean(&LockWeaponsDuringAutopilot);
|
||||
else
|
||||
LockWeaponsDuringAutopilot = false;
|
||||
|
||||
// optional no cutscene bars
|
||||
if (optional_string("+No_Cutscene_Bars"))
|
||||
UseCutsceneBars = false;
|
||||
// optional no cutscene bars
|
||||
if (optional_string("+No_Autopilot_Interrupt"))
|
||||
Cmdline_autopilot_interruptable = 0;
|
||||
|
||||
// No Nav selected message
|
||||
char *msg_tags[] = { "$No Nav Selected:", "$Gliding:",
|
||||
"$Too Close:", "$Hostiles:", "$Linked:", "$Hazard:",
|
||||
"$Support Present:", "$Support Working:" };
|
||||
for (int i = 0; i < NP_NUM_MESSAGES; i++)
|
||||
{
|
||||
required_string(msg_tags[i]);
|
||||
|
||||
required_string("+Msg:");
|
||||
stuff_string(NavMsgs[i].message, F_MESSAGE, 256);
|
||||
|
||||
required_string("+Snd File:");
|
||||
stuff_string(NavMsgs[i].filename, F_NAME, 256);
|
||||
}
|
||||
|
||||
|
||||
required_string("#END");
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", (filename) ? filename : "<default autopilot.tbl>", e.what()));
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", (filename) ? filename : "<default autopilot.tbl>", rval));
|
||||
return;
|
||||
}
|
||||
|
||||
if (filename == NULL)
|
||||
read_file_text_from_array(defaults_get_file("autopilot.tbl"));
|
||||
else
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
|
||||
reset_parse();
|
||||
|
||||
|
||||
required_string("#Autopilot");
|
||||
|
||||
// autopilot link distance
|
||||
required_string("$Link Distance:");
|
||||
stuff_int(&NavLinkDistance);
|
||||
|
||||
if (optional_string("$Interrupt autopilot if enemy within distance:"))
|
||||
stuff_int(&AutopilotMinEnemyDistance);
|
||||
else
|
||||
AutopilotMinEnemyDistance = 5000;
|
||||
|
||||
if (optional_string("$Interrupt autopilot if asteroid within distance:"))
|
||||
stuff_int(&AutopilotMinAsteroidDistance);
|
||||
else
|
||||
AutopilotMinAsteroidDistance = 1000;
|
||||
|
||||
if (optional_string("$Lock Weapons During Autopilot:"))
|
||||
stuff_boolean(&LockWeaponsDuringAutopilot);
|
||||
else
|
||||
LockWeaponsDuringAutopilot = false;
|
||||
|
||||
// optional no cutscene bars
|
||||
if (optional_string("+No_Cutscene_Bars"))
|
||||
UseCutsceneBars = false;
|
||||
// optional no cutscene bars
|
||||
if (optional_string("+No_Autopilot_Interrupt"))
|
||||
Cmdline_autopilot_interruptable = 0;
|
||||
|
||||
// No Nav selected message
|
||||
char *msg_tags[] = { "$No Nav Selected:", "$Gliding:",
|
||||
"$Too Close:", "$Hostiles:", "$Linked:", "$Hazard:",
|
||||
"$Support Present:", "$Support Working:" };
|
||||
for (int i = 0; i < NP_NUM_MESSAGES; i++)
|
||||
{
|
||||
required_string(msg_tags[i]);
|
||||
|
||||
required_string("+Msg:");
|
||||
stuff_string(NavMsgs[i].message, F_MESSAGE, 256);
|
||||
|
||||
required_string("+Snd File:");
|
||||
stuff_string(NavMsgs[i].filename, F_NAME, 256);
|
||||
}
|
||||
|
||||
|
||||
required_string("#END");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "object/object.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
// milliseconds between updates
|
||||
|
||||
@@ -22,6 +22,34 @@
|
||||
#endif
|
||||
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
// Bitmap types
|
||||
enum BM_TYPE
|
||||
{
|
||||
BM_TYPE_NONE = 0, //!< No type
|
||||
BM_TYPE_USER, //!< in-memory
|
||||
BM_TYPE_PCX, //!< PCX
|
||||
BM_TYPE_TGA, //!< 16 or 32 bit targa
|
||||
BM_TYPE_DDS, //!< generic identifier for DDS
|
||||
BM_TYPE_PNG, //!< PNG
|
||||
BM_TYPE_JPG, //!< 32 bit jpeg
|
||||
BM_TYPE_ANI, //!< in-house ANI format
|
||||
BM_TYPE_EFF, //!< specifies any type of animated image, the EFF itself is just text
|
||||
|
||||
// special types
|
||||
BM_TYPE_RENDER_TARGET_STATIC, //!< 24/32 bit setup internally as a static render target
|
||||
BM_TYPE_RENDER_TARGET_DYNAMIC, //!< 24/32 bit setup internally as a dynamic render target
|
||||
|
||||
// Compressed types (bitmap.c_type)
|
||||
BM_TYPE_DXT1, //!< 24 bit with switchable alpha
|
||||
BM_TYPE_DXT3, //!< 32 bit with 4 bit alpha
|
||||
BM_TYPE_DXT5, //!< 32 bit with 8 bit alpha
|
||||
BM_TYPE_CUBEMAP_DDS, //!< generic DDS cubemap (uncompressed cubemap surface)
|
||||
BM_TYPE_CUBEMAP_DXT1, //!< 24-bit cubemap (compressed cubemap surface)
|
||||
BM_TYPE_CUBEMAP_DXT3, //!< 32-bit cubemap (compressed cubemap surface)
|
||||
BM_TYPE_CUBEMAP_DXT5 //!< 32-bit cubemap (compressed cubemap surface)
|
||||
};
|
||||
|
||||
union bm_extra_info {
|
||||
struct {
|
||||
@@ -33,8 +61,9 @@ union bm_extra_info {
|
||||
|
||||
struct {
|
||||
// stuff for static animations
|
||||
BM_TYPE type; //!< type for individual images
|
||||
ubyte type; //!< type for individual images
|
||||
char filename[MAX_FILENAME_LEN]; //!< filename for individual images
|
||||
bool in_subdir; // Whether frames are in their own subdirectory
|
||||
} eff;
|
||||
} ani;
|
||||
|
||||
@@ -55,14 +84,14 @@ struct bitmap_entry {
|
||||
int handle; //!< Handle = id*MAX_BITMAPS + bitmapnum
|
||||
int last_used; //!< When this bitmap was last used
|
||||
|
||||
BM_TYPE type; //!< PCX, USER, ANI, etc
|
||||
BM_TYPE comp_type; //!< What sort of compressed type, BM_TYPE_NONE if not compressed
|
||||
ubyte type; //!< PCX, USER, ANI, etc
|
||||
ubyte comp_type; //!< What sort of compressed type, BM_TYPE_NONE if not compressed
|
||||
signed char ref_count; //!< Number of locks on bitmap. Can't unload unless ref_count is 0.
|
||||
|
||||
int dir_type; //!< which directory this was loaded from (to skip other locations with same name)
|
||||
|
||||
// compressed bitmap stuff (.dds) - RT please take a look at this and tell me if we really need it
|
||||
size_t mem_taken; //!< How much memory does this bitmap use? - UnknownPlayer
|
||||
int mem_taken; //!< How much memory does this bitmap use? - UnknownPlayer
|
||||
int num_mipmaps; //!< number of mipmap levels, we need to read all of them
|
||||
|
||||
// Stuff to keep track of usage
|
||||
|
||||
+264
-208
@@ -12,17 +12,16 @@
|
||||
|
||||
#define BMPMAN_INTERNAL
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "bmpman/bm_internal.h"
|
||||
|
||||
#include "anim/animplay.h"
|
||||
#include "anim/packunpack.h"
|
||||
#include "bmpman/bm_internal.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "ddsutils/ddsutils.h"
|
||||
#include "debugconsole/console.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "graphics/grinternal.h"
|
||||
#include "io/key.h"
|
||||
@@ -35,6 +34,11 @@
|
||||
#include "pngutils/pngutils.h"
|
||||
#include "ship/ship.h"
|
||||
#include "tgautils/tgautils.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
@@ -45,7 +49,20 @@
|
||||
/**
|
||||
* @todo upgrade this to an inline funciton, taking bitmap_entry and const char* as arguments
|
||||
*/
|
||||
#define EFF_FILENAME_CHECK { if ( be->type == BM_TYPE_EFF ) strcpy_s( filename, be->info.ani.eff.filename ); else strcpy_s( filename, be->filename ); }
|
||||
#define EFF_FILENAME_CHECK \
|
||||
{ \
|
||||
if ( be->type == BM_TYPE_EFF ) { \
|
||||
strcpy_s( filename, be->info.ani.eff.filename ); \
|
||||
if (be->info.ani.eff.in_subdir) { \
|
||||
if (!set_temp_subdir_pathtype(bm_bitmaps[be->info.ani.first_frame].filename)) { \
|
||||
mprintf(("BMPMAN: Failed to set temporary pathtype for %s: EFF_FILENAME_CHECK failed!\n", be->filename)); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
strcpy_s( filename, be->filename ); \
|
||||
} \
|
||||
}
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Monitor variables
|
||||
MONITOR(NumBitmapPage)
|
||||
@@ -64,17 +81,19 @@ int bm_texture_ram = 0;
|
||||
int Bm_paging = 0;
|
||||
|
||||
// Extension type lists
|
||||
const BM_TYPE bm_type_list[] = { BM_TYPE_DDS, BM_TYPE_TGA, BM_TYPE_PNG, BM_TYPE_JPG, BM_TYPE_PCX };
|
||||
const ubyte bm_type_list[] = { BM_TYPE_DDS, BM_TYPE_TGA, BM_TYPE_PNG, BM_TYPE_JPG, BM_TYPE_PCX };
|
||||
const char *bm_ext_list[] = { ".dds", ".tga", ".png", ".jpg", ".pcx" };
|
||||
const int BM_NUM_TYPES = sizeof(bm_type_list) / sizeof(bm_type_list[0]);
|
||||
const int BM_NUM_TYPES = sizeof(bm_type_list) / sizeof(ubyte);
|
||||
|
||||
const BM_TYPE bm_ani_type_list[] = { BM_TYPE_EFF, BM_TYPE_ANI };
|
||||
const ubyte bm_ani_type_list[] = { BM_TYPE_EFF, BM_TYPE_ANI };
|
||||
const char *bm_ani_ext_list[] = { ".eff", ".ani" };
|
||||
const int BM_ANI_NUM_TYPES = sizeof(bm_ani_type_list) / sizeof(bm_ani_type_list[0]);
|
||||
const int BM_ANI_NUM_TYPES = sizeof(bm_ani_type_list) / sizeof(ubyte);
|
||||
|
||||
void(*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a) = NULL;
|
||||
void(*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a) = NULL;
|
||||
|
||||
extern cf_pathtype Pathtypes[CF_MAX_PATH_TYPES];
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Declaration of protected variables (defined in cmdline.cpp).
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
@@ -105,98 +124,22 @@ static int Bm_ignore_load_count = 0;
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Declaration of private functions and templates(declared as static type func(type param);)
|
||||
|
||||
bitmap_lookup::bitmap_lookup(int bitmap_num):
|
||||
Bitmap_data(NULL)
|
||||
{
|
||||
if ( !bm_is_valid(bitmap_num) ) return;
|
||||
|
||||
Num_channels = 3;
|
||||
|
||||
if ( bm_has_alpha_channel(bitmap_num) ) {
|
||||
Num_channels = 4;
|
||||
}
|
||||
|
||||
int n = bitmap_num % MAX_BITMAPS;
|
||||
|
||||
bitmap_entry *be = &bm_bitmaps[n];
|
||||
|
||||
Width = be->bm.w;
|
||||
Height = be->bm.h;
|
||||
|
||||
Bitmap_data = (float*)vm_malloc(Width * Height * Num_channels * sizeof(float));
|
||||
|
||||
gr_get_bitmap_from_texture((void*)Bitmap_data, bitmap_num);
|
||||
}
|
||||
|
||||
bitmap_lookup::~bitmap_lookup()
|
||||
{
|
||||
if ( Bitmap_data != NULL ) {
|
||||
vm_free(Bitmap_data);
|
||||
}
|
||||
}
|
||||
|
||||
bool bitmap_lookup::valid()
|
||||
{
|
||||
return Bitmap_data != NULL;
|
||||
}
|
||||
|
||||
float bitmap_lookup::map_texture_address(float address)
|
||||
{
|
||||
// assume we're just wrapping
|
||||
return address - floorf(address);
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_red(float u, float v)
|
||||
{
|
||||
Assert( Bitmap_data != NULL );
|
||||
|
||||
CLAMP(u, 0.0, 1.0f);
|
||||
CLAMP(v, 0.0, 1.0f);
|
||||
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return Bitmap_data[(y*Width + x)*Num_channels];
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_green(float u, float v)
|
||||
{
|
||||
Assert( Bitmap_data != NULL );
|
||||
|
||||
CLAMP(u, 0.0, 1.0f);
|
||||
CLAMP(v, 0.0, 1.0f);
|
||||
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return Bitmap_data[(y*Width + x)*Num_channels + 1];
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_blue(float u, float v)
|
||||
{
|
||||
Assert( Bitmap_data != NULL );
|
||||
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return Bitmap_data[(y*Width + x)*Num_channels + 2];
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_alpha(float u, float v)
|
||||
{
|
||||
Assert( Bitmap_data != NULL );
|
||||
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return Bitmap_data[(y*Width + x)*Num_channels + 3];
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the bitmap referenced by bmp to the type specified by flags
|
||||
*/
|
||||
static void bm_convert_format(bitmap *bmp, ubyte flags);
|
||||
|
||||
/**
|
||||
* Converts an 8-bit image to a 24-bit BGR image sending new bitmap data to "out_data"
|
||||
*
|
||||
* @returns 0 If successful, or
|
||||
* @returns 1 If not successful
|
||||
*
|
||||
* @todo upgrade retval to bool
|
||||
* @todo Doesn't seem to be called by anyone. Remove?
|
||||
*/
|
||||
static int bm_convert_color_index_to_BGR(int num, ubyte **out_data);
|
||||
|
||||
/**
|
||||
* Frees a bitmap's data if it can
|
||||
*/
|
||||
@@ -244,7 +187,7 @@ DCF(bm_frag, "Shows BmpMan fragmentation") {
|
||||
dc_printf("Displays a graphic showing the BmpMan fragmentation. Color key:\n");
|
||||
dc_printf("\tGray : NONE\n");
|
||||
dc_printf("\tRed : PCXn");
|
||||
dc_printf("\tGreen : USER, TGA, PNG, DDS, other\n");
|
||||
dc_printf("\tGreen : USER, TGA, PNG, DDS\n");
|
||||
dc_printf("\tBlue : ANI, EFF\n\n");
|
||||
|
||||
dc_printf("Once done reviewing the graphic, press any key to return to the console\n");
|
||||
@@ -275,9 +218,6 @@ DCF(bm_frag, "Shows BmpMan fragmentation") {
|
||||
case BM_TYPE_EFF:
|
||||
gr_set_color(0, 0, 255);
|
||||
break;
|
||||
default:
|
||||
gr_set_color(0, 255, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
gr_rect(x + xs, y + ys, w, h);
|
||||
@@ -342,15 +282,6 @@ DCF(bmpman, "Shows/changes bitmap caching parameters and usage") {
|
||||
}
|
||||
}
|
||||
|
||||
DCF(bmpslots, "Writes bitmap slot info to fs2_open.log") {
|
||||
if (dc_optional_string_either("help", "--help")) {
|
||||
dc_printf("Usage: bmpslots\n");
|
||||
dc_printf("\tWrites bitmap slot info to fs2_open.log\n");
|
||||
return;
|
||||
}
|
||||
bm_print_bitmaps();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Definition of all functions, in alphabetical order
|
||||
void bm_clean_slot(int n) {
|
||||
@@ -424,13 +355,94 @@ int bm_create(int bpp, int w, int h, void *data, int flags) {
|
||||
|
||||
bm_bitmaps[n].load_count++;
|
||||
|
||||
bm_update_memory_used(n, (int)bm_bitmaps[n].mem_taken);
|
||||
bm_update_memory_used(n, bm_bitmaps[n].mem_taken);
|
||||
|
||||
gr_bm_create(n);
|
||||
|
||||
return bm_bitmaps[n].handle;
|
||||
}
|
||||
|
||||
int bm_convert_color_index_to_BGR(int num, ubyte **out_data) {
|
||||
int n = num % MAX_BITMAPS;
|
||||
bitmap_entry *be;
|
||||
bitmap *bmp;
|
||||
ubyte *datap, *bgr_data = NULL, *palette = NULL;
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
int i, j, bpp = 0, size = 0;
|
||||
int index = 0, mult = 3;
|
||||
|
||||
Assert(out_data != NULL);
|
||||
Assert(n >= 0);
|
||||
Assert(num == bm_bitmaps[n].handle);
|
||||
|
||||
if (num != bm_bitmaps[n].handle)
|
||||
return 1;
|
||||
|
||||
be = &bm_bitmaps[n];
|
||||
bmp = &be->bm;
|
||||
|
||||
if ((bmp->bpp != 8) || !(bmp->data) || ((be->type != BM_TYPE_DDS) && (be->type != BM_TYPE_PCX))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// it's up to the calling function to free() this but not to malloc() it!!
|
||||
bgr_data = (ubyte*)vm_malloc_q(bmp->w * bmp->h * 3);
|
||||
|
||||
ubyte *in_data = (ubyte*)bmp->data;
|
||||
|
||||
if (bgr_data == NULL)
|
||||
return 1;
|
||||
|
||||
memset(bgr_data, 0, bmp->w * bmp->h * 3);
|
||||
|
||||
palette = new ubyte[1024]; // 256*4, largest size we should have to process
|
||||
Assert(palette != NULL);
|
||||
|
||||
// make sure we are using the correct filename in the case of an EFF.
|
||||
// this will populate filename[] whether it's EFF or not
|
||||
EFF_FILENAME_CHECK;
|
||||
|
||||
if (be->type == BM_TYPE_PCX) {
|
||||
pcx_read_header(filename, NULL, NULL, NULL, &bpp, palette);
|
||||
mult = 3; // PCX has RGB for 256 entries
|
||||
} else if (be->type == BM_TYPE_DDS) {
|
||||
dds_read_header(filename, NULL, NULL, NULL, &bpp, NULL, NULL, &size, palette);
|
||||
mult = 4; // DDS has RGBX for 256 entries, 'X' being an alpha setting that we don't need
|
||||
} else {
|
||||
// we really shouldn't be here at this point but give it another check anyway
|
||||
delete[] palette;
|
||||
vm_free(bgr_data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Assert(bpp == 8);
|
||||
|
||||
// we can only accept 8bits obviously, but this is actually a read error check
|
||||
if (bpp != 8) {
|
||||
delete[] palette;
|
||||
vm_free(bgr_data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
datap = bgr_data;
|
||||
|
||||
for (i = 0; i < bmp->h; i++) {
|
||||
for (j = 0; j < bmp->w; j++) {
|
||||
index = *in_data++;
|
||||
*datap++ = palette[index * mult + 2];
|
||||
*datap++ = palette[index * mult + 1];
|
||||
*datap++ = palette[index * mult];
|
||||
}
|
||||
}
|
||||
|
||||
*out_data = bgr_data;
|
||||
|
||||
delete[] palette;
|
||||
|
||||
// no errors
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bm_convert_format(bitmap *bmp, ubyte flags) {
|
||||
int idx;
|
||||
|
||||
@@ -657,9 +669,9 @@ void bm_get_frame_usage(int *ntotal, int *nnew) {
|
||||
for (i = 0; i<MAX_BITMAPS; i++) {
|
||||
if ((bm_bitmaps[i].type != BM_TYPE_NONE) && (bm_bitmaps[i].used_this_frame)) {
|
||||
if (!bm_bitmaps[i].used_last_frame) {
|
||||
*nnew += (int)bm_bitmaps[i].mem_taken;
|
||||
*nnew += bm_bitmaps[i].mem_taken;
|
||||
}
|
||||
*ntotal += (int)bm_bitmaps[i].mem_taken;
|
||||
*ntotal += bm_bitmaps[i].mem_taken;
|
||||
}
|
||||
bm_bitmaps[i].used_last_frame = bm_bitmaps[i].used_this_frame;
|
||||
bm_bitmaps[i].used_this_frame = 0;
|
||||
@@ -728,10 +740,8 @@ int bm_get_next_handle() {
|
||||
|
||||
//Due to the way bm_next_handle is used to generate the /actual/ bitmap handles ( (bm_next_handle * MAX_BITMAPS) + free slot index in bm_bitmaps[]),
|
||||
//this check is necessary to ensure we don't start giving out negative handles all of a sudden.
|
||||
if ((bm_next_handle + 1) > INT_MAX / MAX_BITMAPS) {
|
||||
if (((bm_next_handle + 1) * MAX_BITMAPS) > INT_MAX)
|
||||
bm_next_handle = 1;
|
||||
mprintf(("BMPMAN: bitmap handles wrapped back to 1\n"));
|
||||
}
|
||||
|
||||
return bm_next_handle;
|
||||
}
|
||||
@@ -776,11 +786,11 @@ uint bm_get_signature(int handle) {
|
||||
return bm_bitmaps[bitmapnum].signature;
|
||||
}
|
||||
|
||||
size_t bm_get_size(int handle) {
|
||||
int n = handle % MAX_BITMAPS;
|
||||
int bm_get_size(int num) {
|
||||
int n = num % MAX_BITMAPS;
|
||||
|
||||
Assert(n >= 0);
|
||||
Assert(handle == bm_bitmaps[n].handle);
|
||||
Assert(num == bm_bitmaps[n].handle);
|
||||
|
||||
return bm_bitmaps[n].mem_taken;
|
||||
}
|
||||
@@ -792,7 +802,7 @@ int bm_get_tcache_type(int num) {
|
||||
return TCACHE_TYPE_NORMAL;
|
||||
}
|
||||
|
||||
BM_TYPE bm_get_type(int handle) {
|
||||
ubyte bm_get_type(int handle) {
|
||||
if (!bm_inited) bm_init();
|
||||
|
||||
int bitmapnum = handle % MAX_BITMAPS;
|
||||
@@ -801,7 +811,7 @@ BM_TYPE bm_get_type(int handle) {
|
||||
return bm_bitmaps[bitmapnum].type;
|
||||
}
|
||||
|
||||
bool bm_has_alpha_channel(int handle) {
|
||||
int bm_has_alpha_channel(int handle) {
|
||||
int n = handle % MAX_BITMAPS;
|
||||
|
||||
Assert(n >= 0);
|
||||
@@ -817,8 +827,8 @@ bool bm_has_alpha_channel(int handle) {
|
||||
void bm_init() {
|
||||
int i;
|
||||
|
||||
mprintf(("Size of bitmap info = " SIZE_T_ARG " KB\n", sizeof(bm_bitmaps) / 1024));
|
||||
mprintf(("Size of bitmap extra info = " SIZE_T_ARG " bytes\n", sizeof(bm_extra_info)));
|
||||
mprintf(("Size of bitmap info = %d KB\n", sizeof(bm_bitmaps) / 1024));
|
||||
mprintf(("Size of bitmap extra info = %d bytes\n", sizeof(bm_extra_info)));
|
||||
|
||||
if (!bm_inited) {
|
||||
bm_inited = 1;
|
||||
@@ -852,7 +862,7 @@ void bm_init() {
|
||||
|
||||
int bm_is_compressed(int num) {
|
||||
int n = num % MAX_BITMAPS;
|
||||
BM_TYPE type = BM_TYPE_NONE;
|
||||
ubyte type = BM_TYPE_NONE;
|
||||
|
||||
//duh
|
||||
if (!Use_compressed_textures)
|
||||
@@ -885,10 +895,9 @@ int bm_is_compressed(int num) {
|
||||
|
||||
case BM_TYPE_CUBEMAP_DXT5:
|
||||
return DDS_CUBEMAP_DXT5;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bm_is_render_target(int bitmap_id) {
|
||||
@@ -919,8 +928,8 @@ int bm_load(const char *real_filename) {
|
||||
int rc = 0;
|
||||
int bm_size = 0, mm_lvl = 0;
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
BM_TYPE type = BM_TYPE_NONE;
|
||||
BM_TYPE c_type = BM_TYPE_NONE;
|
||||
ubyte type = BM_TYPE_NONE;
|
||||
ubyte c_type = BM_TYPE_NONE;
|
||||
CFILE *img_cfp = NULL;
|
||||
int handle = -1;
|
||||
|
||||
@@ -1014,7 +1023,7 @@ int bm_load(const char *real_filename) {
|
||||
bm_bitmaps[free_slot].bm.data = 0;
|
||||
bm_bitmaps[free_slot].bm.palette = NULL;
|
||||
bm_bitmaps[free_slot].num_mipmaps = mm_lvl;
|
||||
bm_bitmaps[free_slot].mem_taken = (size_t)bm_size;
|
||||
bm_bitmaps[free_slot].mem_taken = bm_size;
|
||||
bm_bitmaps[free_slot].dir_type = CF_TYPE_ANY;
|
||||
bm_bitmaps[free_slot].palette_checksum = 0;
|
||||
bm_bitmaps[free_slot].handle = handle;
|
||||
@@ -1033,10 +1042,11 @@ int bm_load(const SCP_string& filename) {
|
||||
return bm_load(filename.c_str());
|
||||
}
|
||||
|
||||
bool bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, BM_TYPE *type) {
|
||||
int frames = 0, fps = 30, keyframe = 0;
|
||||
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type, bool *in_subdir) {
|
||||
int frames = 0, fps = 30, keyframe = 0, rval;
|
||||
bool subdir = false;
|
||||
char ext[8];
|
||||
BM_TYPE c_type = BM_TYPE_NONE;
|
||||
ubyte c_type = BM_TYPE_NONE;
|
||||
char file_text[1024];
|
||||
char file_text_raw[1024];
|
||||
|
||||
@@ -1047,31 +1057,32 @@ bool bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int
|
||||
// pause anything that may happen to be parsing right now
|
||||
pause_parse();
|
||||
|
||||
try
|
||||
{
|
||||
// now start parsing the EFF
|
||||
read_file_text(filename, dir_type, file_text, file_text_raw);
|
||||
reset_parse(file_text);
|
||||
|
||||
required_string("$Type:");
|
||||
stuff_string(ext, F_NAME, sizeof(ext));
|
||||
|
||||
required_string("$Frames:");
|
||||
stuff_int(&frames);
|
||||
|
||||
if (optional_string("$FPS:"))
|
||||
stuff_int(&fps);
|
||||
|
||||
if (optional_string("$Keyframe:"))
|
||||
stuff_int(&keyframe);
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("BMPMAN: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("BMPMAN: Unable to parse '%s'! Error code = %i.\n", filename, rval));
|
||||
unpause_parse();
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// now start parsing the EFF
|
||||
read_file_text(filename, dir_type, file_text, file_text_raw);
|
||||
reset_parse(file_text);
|
||||
|
||||
required_string("$Type:");
|
||||
stuff_string(ext, F_NAME, sizeof(ext));
|
||||
|
||||
required_string("$Frames:");
|
||||
stuff_int(&frames);
|
||||
|
||||
if (optional_string("$FPS:"))
|
||||
stuff_int(&fps);
|
||||
|
||||
if (optional_string("$Keyframe:"))
|
||||
stuff_int(&keyframe);
|
||||
|
||||
if (optional_string( "$Subdir:" )) {
|
||||
stuff_boolean(&subdir);}
|
||||
|
||||
|
||||
// done with EFF so unpause parsing so whatever can continue
|
||||
unpause_parse();
|
||||
|
||||
@@ -1087,13 +1098,13 @@ bool bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int
|
||||
c_type = BM_TYPE_PCX;
|
||||
} else {
|
||||
mprintf(("BMPMAN: Unknown file type in EFF parse!\n"));
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// did we do anything?
|
||||
if (c_type == BM_TYPE_NONE || frames == 0) {
|
||||
mprintf(("BMPMAN: EFF parse ERROR!\n"));
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (type)
|
||||
@@ -1108,7 +1119,9 @@ bool bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int
|
||||
if (key)
|
||||
*key = keyframe;
|
||||
|
||||
return true;
|
||||
*in_subdir = subdir;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type) {
|
||||
@@ -1118,8 +1131,9 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
int reduced = 0;
|
||||
int anim_fps = 0, anim_frames = 0, key = 0;
|
||||
bool in_subdir = false;
|
||||
int anim_width = 0, anim_height = 0;
|
||||
BM_TYPE type = BM_TYPE_NONE, eff_type = BM_TYPE_NONE, c_type = BM_TYPE_NONE;
|
||||
ubyte type = BM_TYPE_NONE, eff_type = BM_TYPE_NONE, c_type = BM_TYPE_NONE;
|
||||
int bpp = 0, mm_lvl = 0, img_size = 0;
|
||||
char clean_name[MAX_FILENAME_LEN];
|
||||
|
||||
@@ -1204,7 +1218,7 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
|
||||
// it's an effect file, any readable image type with eff being txt
|
||||
if (type == BM_TYPE_EFF) {
|
||||
if (!bm_load_and_parse_eff(filename, dir_type, &anim_frames, &anim_fps, &key, &eff_type)) {
|
||||
if (bm_load_and_parse_eff(filename, dir_type, &anim_frames, &anim_fps, &key, &eff_type, &in_subdir) != 0 ) {
|
||||
mprintf(("BMPMAN: Error reading EFF\n"));
|
||||
return -1;
|
||||
} else {
|
||||
@@ -1241,9 +1255,6 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
}
|
||||
//some retail anis have their keyframes reversed
|
||||
key = MAX(the_anim.keys[0].frame_num, the_anim.keys[1].frame_num);
|
||||
|
||||
vm_free(the_anim.keys);
|
||||
the_anim.keys = nullptr;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
@@ -1269,8 +1280,13 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (in_subdir) {
|
||||
set_temp_subdir_pathtype(filename);
|
||||
}
|
||||
|
||||
int first_handle = bm_get_next_handle();
|
||||
|
||||
Assert(strlen(filename) < MAX_FILENAME_LEN);
|
||||
for (i = 0; i < anim_frames; i++) {
|
||||
memset(&bm_bitmaps[n + i], 0, sizeof(bitmap_entry));
|
||||
|
||||
@@ -1331,8 +1347,13 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
bm_bitmaps[n + i].handle = first_handle*MAX_BITMAPS + n + i;
|
||||
bm_bitmaps[n + i].last_used = -1;
|
||||
bm_bitmaps[n + i].num_mipmaps = mm_lvl;
|
||||
bm_bitmaps[n + i].mem_taken = (size_t)img_size;
|
||||
bm_bitmaps[n + i].mem_taken = img_size;
|
||||
bm_bitmaps[n + i].dir_type = dir_type;
|
||||
bm_bitmaps[n + i].info.ani.eff.in_subdir = in_subdir;
|
||||
if (in_subdir)
|
||||
bm_bitmaps[n + i].dir_type = CF_TYPE_TEMP_SUBDIR_LOOKUP;
|
||||
else
|
||||
bm_bitmaps[n + i].dir_type = dir_type;
|
||||
|
||||
bm_bitmaps[n + i].load_count++;
|
||||
|
||||
@@ -1573,7 +1594,7 @@ void bm_lock_ani(int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte
|
||||
|
||||
bm = &bm_bitmaps[first_frame].bm;
|
||||
size = bm->w * bm->h * (bpp >> 3);
|
||||
be->mem_taken = (size_t)size;
|
||||
be->mem_taken = size;
|
||||
|
||||
Assert(size > 0);
|
||||
|
||||
@@ -1691,19 +1712,19 @@ void bm_lock_dds(int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
// same as with TGA, we need to byte swap 16 & 32-bit, uncompressed, DDS images
|
||||
if ((be->comp_type == BM_TYPE_DDS) || (be->comp_type == BM_TYPE_CUBEMAP_DDS)) {
|
||||
size_t i = 0;
|
||||
unsigned int i = 0;
|
||||
|
||||
if (dds_bpp == 32) {
|
||||
unsigned int *swap_tmp;
|
||||
|
||||
for (i = 0; i < be->mem_taken; i += 4) {
|
||||
for (i = 0; i < (unsigned int)be->mem_taken; i += 4) {
|
||||
swap_tmp = (unsigned int *)(data + i);
|
||||
*swap_tmp = INTEL_INT(*swap_tmp);
|
||||
}
|
||||
} else if (dds_bpp == 16) {
|
||||
unsigned short *swap_tmp;
|
||||
|
||||
for (i = 0; i < be->mem_taken; i += 2) {
|
||||
for (i = 0; i < (unsigned int)be->mem_taken; i += 2) {
|
||||
swap_tmp = (unsigned short *)(data + i);
|
||||
*swap_tmp = INTEL_SHORT(*swap_tmp);
|
||||
}
|
||||
@@ -2008,7 +2029,7 @@ int bm_make_render_target(int width, int height, int flags) {
|
||||
bm_bitmaps[n].bm.data = 0;
|
||||
bm_bitmaps[n].bm.palette = NULL;
|
||||
bm_bitmaps[n].num_mipmaps = mm_lvl;
|
||||
bm_bitmaps[n].mem_taken = (size_t)size;
|
||||
bm_bitmaps[n].mem_taken = size;
|
||||
bm_bitmaps[n].dir_type = CF_TYPE_ANY;
|
||||
|
||||
bm_bitmaps[n].palette_checksum = 0;
|
||||
@@ -2076,6 +2097,61 @@ void bm_page_in_start() {
|
||||
gr_bm_page_in_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stuffs Pathtypes with an additional path leading to a subdir of the same name as the given file (minus file extension).
|
||||
* Used for allowing frames of .eff animations to be found in their own subdirectories.
|
||||
*
|
||||
* Example: if called with "debris.eff" and that file is in data/maps, then Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path
|
||||
* will be stuffed with data/maps/debris, allowing data/maps/debris/debris_0000.dds (etc) to be found
|
||||
*/
|
||||
bool set_temp_subdir_pathtype(const char *filename) {
|
||||
// Gets the absolute path of the file, removes the part that is identical with the
|
||||
// absolute root path and appends the filename to it (without extension), giving us
|
||||
// a relative path that can be temporarily stuffed into Pathtypes so the frames can be found
|
||||
|
||||
char fullpath[MAX_PATH]; // Absolute path to the given file
|
||||
char fullrootpath[MAX_PATH]; // Absolute root path
|
||||
int size, offset; // Needed for cf_find_file_location, but not used
|
||||
|
||||
cf_create_default_path_string(fullrootpath, sizeof(fullrootpath) - 1, CF_TYPE_ROOT, NULL);
|
||||
if (!cf_find_file_location(filename, CF_TYPE_ANY, sizeof(fullpath)-1, fullpath, &size, &offset)) {
|
||||
mprintf(("BMPMAN: Failed to set temporary pathtype for %s: file not found!\n", filename));
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (strlen(fullpath) < strlen(fullrootpath)) {
|
||||
mprintf(("BMPMAN: Path to %s was shorter than the root path, programmer thought it could never happen!\n%s\n%s\n", filename, fullpath, fullrootpath));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
mprintf(("BMPMAN: Setting temporary pathtype for %s... ", filename));
|
||||
|
||||
char *trimmed_path; // The differing portion of fullpath and fullrootpath
|
||||
trimmed_path = &fullpath[strlen(fullrootpath)];
|
||||
|
||||
char *extpos = strstr(trimmed_path, "."); // Where the file extension begins
|
||||
char basepath[MAX_PATH]; // This will hold the final, relative path
|
||||
|
||||
// Copy the relative path of the given file to basepath, excluding the extension
|
||||
strncpy(basepath, trimmed_path, extpos-trimmed_path);
|
||||
|
||||
// Make sure it's null-terminated right
|
||||
basepath[(int)(extpos-trimmed_path)] = '\0';
|
||||
|
||||
// Free the old string first, if it's not the const initial empty string
|
||||
if (Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path[0] != '\0') {
|
||||
vm_free(Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path);
|
||||
}
|
||||
|
||||
Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path = vm_strdup(basepath);
|
||||
|
||||
mprintf(("OK. Temporary pathtype is now %s.\n", Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void bm_page_in_stop() {
|
||||
int i;
|
||||
|
||||
@@ -2094,6 +2170,10 @@ void bm_page_in_stop() {
|
||||
if ((bm_bitmaps[i].type != BM_TYPE_NONE) && (bm_bitmaps[i].type != BM_TYPE_RENDER_TARGET_DYNAMIC) && (bm_bitmaps[i].type != BM_TYPE_RENDER_TARGET_STATIC)) {
|
||||
if (bm_bitmaps[i].preloaded) {
|
||||
if (bm_preloading) {
|
||||
if (bm_bitmaps[i].type == BM_TYPE_EFF && bm_bitmaps[i].info.ani.eff.in_subdir) {
|
||||
set_temp_subdir_pathtype(bm_bitmaps[i].filename);
|
||||
}
|
||||
|
||||
if (!gr_preload(bm_bitmaps[i].handle, (bm_bitmaps[i].preloaded == 2))) {
|
||||
mprintf(("Out of VRAM. Done preloading.\n"));
|
||||
bm_preloading = 0;
|
||||
@@ -2190,9 +2270,6 @@ void bm_page_in_texture(int bitmapnum, int nframes) {
|
||||
case BM_TYPE_CUBEMAP_DXT5:
|
||||
bm_bitmaps[n + i].used_flags = BMP_TEX_CUBEMAP;
|
||||
continue;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2235,30 +2312,25 @@ void bm_page_in_xparent_texture(int bitmapnum, int nframes) {
|
||||
case BM_TYPE_CUBEMAP_DXT5:
|
||||
bm_bitmaps[n + i].used_flags = BMP_TEX_CUBEMAP;
|
||||
continue;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool bm_page_out(int handle) {
|
||||
int n = handle % MAX_BITMAPS;
|
||||
int bm_page_out(int bitmap_id) {
|
||||
int n = bitmap_id % MAX_BITMAPS;
|
||||
|
||||
Assert(n >= 0);
|
||||
Assert(handle == bm_bitmaps[n].handle);
|
||||
Assert(n >= 0 && n < MAX_BITMAPS);
|
||||
|
||||
// in case it's already been released
|
||||
if (bm_bitmaps[n].type == BM_TYPE_NONE)
|
||||
return 0;
|
||||
|
||||
// it's possible to hit < 0 here when model_page_out_textures() is
|
||||
// called from anywhere other than in a mission
|
||||
Assert(bm_bitmaps[n].handle == bitmap_id); // INVALID BITMAP HANDLE
|
||||
|
||||
// it's possible to hit < 0 here when model_page_out_textures() is called from
|
||||
// anywhere other than in a mission
|
||||
if (bm_bitmaps[n].preload_count > 0) {
|
||||
nprintf(("BmpMan",
|
||||
"PAGE-OUT: %s - preload_count remaining: %d\n",
|
||||
bm_bitmaps[n].filename,
|
||||
bm_bitmaps[n].preload_count));
|
||||
nprintf(("BmpMan", "PAGE-OUT: %s - preload_count remaining: %d\n", bm_bitmaps[n].filename, bm_bitmaps[n].preload_count));
|
||||
|
||||
// lets decrease it for next time around
|
||||
bm_bitmaps[n].preload_count--;
|
||||
@@ -2266,7 +2338,7 @@ bool bm_page_out(int handle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (bm_unload(handle) == 1);
|
||||
return (bm_unload(bitmap_id) == 1);
|
||||
}
|
||||
|
||||
void bm_print_bitmaps() {
|
||||
@@ -2493,7 +2565,7 @@ void bm_set_low_mem(int mode) {
|
||||
Bm_low_mem = mode;
|
||||
}
|
||||
|
||||
bool bm_set_render_target(int handle, int face) {
|
||||
int bm_set_render_target(int handle, int face) {
|
||||
int n = handle % MAX_BITMAPS;
|
||||
|
||||
if (n >= 0) {
|
||||
@@ -2502,7 +2574,7 @@ bool bm_set_render_target(int handle, int face) {
|
||||
if ((bm_bitmaps[n].type != BM_TYPE_RENDER_TARGET_STATIC) && (bm_bitmaps[n].type != BM_TYPE_RENDER_TARGET_DYNAMIC)) {
|
||||
// odds are that someone passed a normal texture created with bm_load()
|
||||
mprintf(("Trying to set invalid bitmap (slot: %i, handle: %i) as render target!\n", n, handle));
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2517,12 +2589,6 @@ bool bm_set_render_target(int handle, int face) {
|
||||
|
||||
gr_screen.save_max_w_unscaled_zoomed = gr_screen.max_w_unscaled_zoomed;
|
||||
gr_screen.save_max_h_unscaled_zoomed = gr_screen.max_h_unscaled_zoomed;
|
||||
|
||||
gr_screen.save_center_w = gr_screen.center_w;
|
||||
gr_screen.save_center_h = gr_screen.center_h;
|
||||
|
||||
gr_screen.save_center_offset_x = gr_screen.center_offset_x;
|
||||
gr_screen.save_center_offset_y = gr_screen.center_offset_y;
|
||||
}
|
||||
|
||||
if (n < 0) {
|
||||
@@ -2534,12 +2600,6 @@ bool bm_set_render_target(int handle, int face) {
|
||||
|
||||
gr_screen.max_w_unscaled_zoomed = gr_screen.save_max_w_unscaled_zoomed;
|
||||
gr_screen.max_h_unscaled_zoomed = gr_screen.save_max_h_unscaled_zoomed;
|
||||
|
||||
gr_screen.center_w = gr_screen.save_center_w;
|
||||
gr_screen.center_h = gr_screen.save_center_h;
|
||||
|
||||
gr_screen.center_offset_x = gr_screen.save_center_offset_x;
|
||||
gr_screen.center_offset_y = gr_screen.save_center_offset_y;
|
||||
} else {
|
||||
gr_screen.max_w = bm_bitmaps[n].bm.w;
|
||||
gr_screen.max_h = bm_bitmaps[n].bm.h;
|
||||
@@ -2549,12 +2609,6 @@ bool bm_set_render_target(int handle, int face) {
|
||||
|
||||
gr_screen.max_w_unscaled_zoomed = bm_bitmaps[n].bm.w;
|
||||
gr_screen.max_h_unscaled_zoomed = bm_bitmaps[n].bm.h;
|
||||
|
||||
gr_screen.center_w = bm_bitmaps[n].bm.w;
|
||||
gr_screen.center_h = bm_bitmaps[n].bm.h;
|
||||
|
||||
gr_screen.center_offset_x = 0;
|
||||
gr_screen.center_offset_y = 0;
|
||||
}
|
||||
|
||||
gr_screen.rendering_to_face = face;
|
||||
@@ -2567,10 +2621,10 @@ bool bm_set_render_target(int handle, int face) {
|
||||
opengl_setup_viewport();
|
||||
}
|
||||
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bm_unload(int handle, int clear_render_targets, bool nodebug) {
|
||||
@@ -2690,6 +2744,7 @@ int bm_unload_fast(int handle, int clear_render_targets) {
|
||||
|
||||
void bm_unlock(int handle) {
|
||||
bitmap_entry *be;
|
||||
bitmap *bmp;
|
||||
|
||||
if (!bm_inited) bm_init();
|
||||
|
||||
@@ -2706,6 +2761,7 @@ void bm_unlock(int handle) {
|
||||
Assert((bitmapnum >= 0) && (bitmapnum < MAX_BITMAPS));
|
||||
|
||||
be = &bm_bitmaps[bitmapnum];
|
||||
bmp = &be->bm;
|
||||
|
||||
be->ref_count--;
|
||||
Assert(be->ref_count >= 0); // Trying to unlock data more times than lock was called!!!
|
||||
|
||||
+33
-64
@@ -67,33 +67,6 @@
|
||||
#define BMP_FLAG_RENDER_TARGET_DYNAMIC (1<<1) //!< Texture is a dynamic type (animation)
|
||||
#define BMP_FLAG_CUBEMAP (1<<2) //!< Texture is a cubemap
|
||||
|
||||
// Bitmap types
|
||||
enum BM_TYPE
|
||||
{
|
||||
BM_TYPE_NONE = 0, //!< No type
|
||||
BM_TYPE_USER, //!< in-memory
|
||||
BM_TYPE_PCX, //!< PCX
|
||||
BM_TYPE_TGA, //!< 16 or 32 bit targa
|
||||
BM_TYPE_DDS, //!< generic identifier for DDS
|
||||
BM_TYPE_PNG, //!< PNG
|
||||
BM_TYPE_JPG, //!< 32 bit jpeg
|
||||
BM_TYPE_ANI, //!< in-house ANI format
|
||||
BM_TYPE_EFF, //!< specifies any type of animated image, the EFF itself is just text
|
||||
|
||||
// special types
|
||||
BM_TYPE_RENDER_TARGET_STATIC, //!< 24/32 bit setup internally as a static render target
|
||||
BM_TYPE_RENDER_TARGET_DYNAMIC, //!< 24/32 bit setup internally as a dynamic render target
|
||||
|
||||
// Compressed types (bitmap.c_type)
|
||||
BM_TYPE_DXT1, //!< 24 bit with switchable alpha
|
||||
BM_TYPE_DXT3, //!< 32 bit with 4 bit alpha
|
||||
BM_TYPE_DXT5, //!< 32 bit with 8 bit alpha
|
||||
BM_TYPE_CUBEMAP_DDS, //!< generic DDS cubemap (uncompressed cubemap surface)
|
||||
BM_TYPE_CUBEMAP_DXT1, //!< 24-bit cubemap (compressed cubemap surface)
|
||||
BM_TYPE_CUBEMAP_DXT3, //!< 32-bit cubemap (compressed cubemap surface)
|
||||
BM_TYPE_CUBEMAP_DXT5 //!< 32-bit cubemap (compressed cubemap surface)
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -116,10 +89,10 @@ extern int bm_texture_ram; //!< how many bytes of textures are used.
|
||||
|
||||
extern int Bm_paging; //!< Bool type that indicates if BMPMAN is currently paging.
|
||||
|
||||
extern const BM_TYPE bm_type_list[]; //!< List of valid bitmap types
|
||||
extern const ubyte bm_type_list[]; //!< List of valid bitmap types
|
||||
extern const char *bm_ext_list[]; //!< List of extensions for those types
|
||||
extern const int BM_NUM_TYPES; //!< Calculated number of bitmap types
|
||||
extern const BM_TYPE bm_ani_type_list[]; //!< List of valid bitmap animation types
|
||||
extern const ubyte bm_ani_type_list[]; //!< List of valid bitmap animation types
|
||||
extern const char *bm_ani_ext_list[]; //!< List of extensions for those types
|
||||
extern const int BM_ANI_NUM_TYPES; //!< Calculated number of bitmap animation types
|
||||
|
||||
@@ -174,26 +147,6 @@ void *bm_malloc(int handle, int size);
|
||||
*/
|
||||
void bm_update_memory_used(int n, int size);
|
||||
|
||||
class bitmap_lookup {
|
||||
float *Bitmap_data;
|
||||
|
||||
int Width;
|
||||
int Height;
|
||||
int Num_channels;
|
||||
|
||||
float map_texture_address(float address);
|
||||
public:
|
||||
bitmap_lookup(int bitmap_num);
|
||||
~bitmap_lookup();
|
||||
|
||||
bool valid();
|
||||
|
||||
float get_channel_red(float u, float v);
|
||||
float get_channel_green(float u, float v);
|
||||
float get_channel_blue(float u, float v);
|
||||
float get_channel_alpha(float u, float v);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Loads a bitmap so we can draw with it later.
|
||||
*
|
||||
@@ -322,7 +275,7 @@ int bm_load_either(const char *filename, int *nframes = NULL, int *fps = NULL, i
|
||||
* @details Also converts the bitmap to the appropriate format specified by bpp and flags. Only lock a bitmap when you
|
||||
* need it!
|
||||
*
|
||||
* @param handle The number indexing the desired bitmap
|
||||
* @param bitmapnum The number indexing the desired bitmap
|
||||
* @param bpp The desired bpp of the bitmep
|
||||
* @param flags The desired bitmap format
|
||||
* @param nodebug
|
||||
@@ -342,7 +295,7 @@ uint bm_get_signature(int handle);
|
||||
/**
|
||||
* @brief Returns the image type of the given bitmap handle
|
||||
*/
|
||||
BM_TYPE bm_get_type(int handle);
|
||||
ubyte bm_get_type(int handle);
|
||||
|
||||
/**
|
||||
* @brief Unlocks a bitmap
|
||||
@@ -462,6 +415,11 @@ void bm_get_frame_usage(int *ntotal, int *nnew);
|
||||
*/
|
||||
int bm_reload(int bitmap_handle, const char* filename);
|
||||
|
||||
/**
|
||||
* @brief Stuffs Pathtypes with an additional path leading to a subdir of the same name as the given file (minus file extension)
|
||||
*/
|
||||
bool set_temp_subdir_pathtype(const char *filename);
|
||||
|
||||
/**
|
||||
* @brief Tells bmpman to start keeping track of what bitmaps are used where
|
||||
*/
|
||||
@@ -502,8 +460,10 @@ void bm_page_in_aabitmap(int bitmapnum, int num_frames = 1);
|
||||
* @returns 0 If the bitmap had already been released, or
|
||||
* @returns 0 If the handle is invalid, or
|
||||
* @returns 1 If successful
|
||||
*
|
||||
* @todo The return type should be a bool
|
||||
*/
|
||||
bool bm_page_out(int handle);
|
||||
int bm_page_out(int handle);
|
||||
|
||||
/**
|
||||
* @brief Sets BMPMAN's memory mode
|
||||
@@ -610,8 +570,10 @@ int bm_get_tcache_type(int handle);
|
||||
|
||||
/**
|
||||
* @brief Gets the size, in bytes, taken up by the bitmap indexed by handle
|
||||
*
|
||||
* @todo retval should be a size_t
|
||||
*/
|
||||
size_t bm_get_size(int handle);
|
||||
int bm_get_size(int handle);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of mipmaps of the indexed texture
|
||||
@@ -622,8 +584,10 @@ int bm_get_num_mipmaps(int handle);
|
||||
* @brief Checks to see if the indexed bitmap has an alpha channel
|
||||
*
|
||||
* @note Currently just checks if the bitmap is 32bpp and is not a .PCX
|
||||
*
|
||||
* @todo retval should be a bool
|
||||
*/
|
||||
bool bm_has_alpha_channel(int handle);
|
||||
int bm_has_alpha_channel(int handle);
|
||||
|
||||
/**
|
||||
* @brief (DEBUG) Prints all loaded bitmaps to an outwindow
|
||||
@@ -651,24 +615,29 @@ int bm_is_render_target(int handle);
|
||||
/**
|
||||
* @brief (GR function) Calls gr_bm_set_render target for the given bitmap indexed by handle
|
||||
*
|
||||
* @returns true if successful, or
|
||||
* @returns false if unsuccessful
|
||||
* @returns 1 if successful, or
|
||||
* @returns 0 if unsuccessful
|
||||
*
|
||||
* @todo retval should be a bool
|
||||
*/
|
||||
bool bm_set_render_target(int handle, int face = -1);
|
||||
int bm_set_render_target(int handle, int face = -1);
|
||||
|
||||
/**
|
||||
* @brief Loads and parses an .EFF
|
||||
*
|
||||
* @param[in] filename The filename of the .EFF
|
||||
* @param[in] dir_type
|
||||
* @param[out] nframes (optional) If given, is set to the number of frames this .EFF has
|
||||
* @param[out] nfps (optional) If given, is set to the fps of this .EFF
|
||||
* @param[out] key (optional) If given, is set to the keyframe index of this .EFF
|
||||
* @param[out] type (optional) If given, is set to the BM_TYPE of the .EFF
|
||||
* @param[out] nframes (optional) If given, is set to the number of frames this .EFF has
|
||||
* @param[out] nfps (optional) If given, is set to the fps of this .EFF
|
||||
* @param[out] key (optional) If given, is set to the keyframe index of this .EFF
|
||||
* @param[out] type (optional) If given, is set to the BM_TYPE of the .EFF
|
||||
* @param[out] in_subdir (optional) If given, is set to true if the frames of this .EFF are in a subdir
|
||||
*
|
||||
* @returns true If successful
|
||||
* @returns false If not successful
|
||||
* @returns 0 If successful,
|
||||
* @returns -1 if not successful
|
||||
*
|
||||
* @todo retval should be a bool
|
||||
*/
|
||||
bool bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, BM_TYPE *type);
|
||||
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type, bool *in_subdir);
|
||||
|
||||
#endif
|
||||
+18
-26
@@ -1,15 +1,17 @@
|
||||
#include "camera/camera.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "globalincs/systemvars.h" //VM_FREECAMERA etc
|
||||
#include "graphics/font.h"
|
||||
#include "hud/hud.h" //hud_get_draw
|
||||
#include "math/vecmat.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
#include "model/model.h" //polymodel, model_get
|
||||
#include "graphics/2d.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "physics/physics.h" //apply_physics
|
||||
#include "globalincs/systemvars.h" //VM_FREECAMERA etc
|
||||
#include "hud/hud.h" //hud_get_draw
|
||||
#include "model/model.h" //polymodel, model_get
|
||||
#include "playerman/player.h" //player_get_padlock_orient
|
||||
#include "ship/ship.h" //compute_slew_matrix
|
||||
#include "graphics/font.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
#include "globalincs/linklist.h"
|
||||
|
||||
//*************************IMPORTANT GLOBALS*************************
|
||||
float VIEWER_ZOOM_DEFAULT = 0.75f; // Default viewer zoom, 0.625 as per multi-lateral agreement on 3/24/97
|
||||
@@ -80,7 +82,7 @@ void camera::reset()
|
||||
|
||||
void camera::set_name(char *in_name)
|
||||
{
|
||||
if(in_name != NULL)
|
||||
if(name != NULL)
|
||||
strncpy(name, in_name, NAME_LENGTH-1);
|
||||
}
|
||||
|
||||
@@ -538,15 +540,8 @@ void warp_camera::get_info(vec3d *position, matrix *orientation)
|
||||
//*************************subtitle*************************
|
||||
|
||||
#define MAX_SUBTITLE_LINES 64
|
||||
subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char* in_imageanim, float in_display_time,
|
||||
float in_fade_time, const color *in_text_color, int in_text_fontnum, bool center_x, bool center_y, int in_width,
|
||||
int in_height, bool in_post_shaded)
|
||||
:display_time(-1.0f), fade_time(-1.0f), text_fontnum(-1), time_displayed(-1.0f), time_displayed_end(-1.0f),
|
||||
post_shaded(false)
|
||||
subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char* in_imageanim, float in_display_time, float in_fade_time, const color *in_text_color, int in_text_fontnum, bool center_x, bool center_y, int in_width, int in_height, bool in_post_shaded)
|
||||
{
|
||||
// Initialize color
|
||||
gr_init_color(&text_color, 0, 0, 0);
|
||||
|
||||
SCP_string text_buf;
|
||||
|
||||
// basic init, this always has to be done
|
||||
@@ -651,20 +646,20 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char*
|
||||
|
||||
//Center it?
|
||||
if(center_x)
|
||||
image_pos.x = (gr_screen.center_w - tw)/2 + gr_screen.center_offset_x;
|
||||
image_pos.x = (gr_screen.max_w - tw)/2;
|
||||
if(center_y)
|
||||
image_pos.y = (gr_screen.center_h - th)/2 + gr_screen.center_offset_y;
|
||||
image_pos.y = (gr_screen.max_h - th)/2;
|
||||
}
|
||||
|
||||
if(in_x_pos < 0 && !center_x)
|
||||
image_pos.x += gr_screen.center_offset_x + gr_screen.center_w + in_x_pos;
|
||||
image_pos.x += gr_screen.max_w + in_x_pos;
|
||||
else if(!center_x)
|
||||
image_pos.x += gr_screen.center_offset_x + in_x_pos;
|
||||
image_pos.x += in_x_pos;
|
||||
|
||||
if(in_y_pos < 0 && !center_y)
|
||||
image_pos.y += gr_screen.center_offset_y + gr_screen.center_h + in_y_pos;
|
||||
image_pos.y += gr_screen.max_h + in_y_pos;
|
||||
else if(!center_y)
|
||||
image_pos.y += gr_screen.center_offset_y + in_y_pos;
|
||||
image_pos.y += in_y_pos;
|
||||
|
||||
image_pos.w = in_width;
|
||||
image_pos.h = in_height;
|
||||
@@ -871,9 +866,6 @@ void cam_close()
|
||||
{
|
||||
//Set Current_camera to nothing
|
||||
Current_camera = camid();
|
||||
for (auto ii = Cameras.begin(); ii != Cameras.end(); ++ii) {
|
||||
delete * ii;
|
||||
}
|
||||
Cameras.clear();
|
||||
}
|
||||
|
||||
@@ -1086,4 +1078,4 @@ eye* get_submodel_eye(polymodel *pm, int submodel_num)
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@
|
||||
#ifndef _CAMERA_H
|
||||
#define _CAMERA_H
|
||||
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "object/object.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h"
|
||||
#include "physics/physics.h" //for avd
|
||||
#include "object/object.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
+10
-13
@@ -29,10 +29,10 @@
|
||||
#endif
|
||||
|
||||
#include "cfile/cfile.h"
|
||||
#include "cfile/cfilearchive.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "osapi/osapi.h"
|
||||
#include "parse/encrypt.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "cfile/cfilearchive.h"
|
||||
#include "osapi/osapi.h"
|
||||
|
||||
|
||||
char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
@@ -86,6 +86,7 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
|
||||
{ CF_TYPE_INTEL_ANIMS, "data" DIR_SEPARATOR_STR "intelanims", ".pcx .ani .eff .tga .jpg .png .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_SCRIPTS, "data" DIR_SEPARATOR_STR "scripts", ".lua .lc", CF_TYPE_DATA },
|
||||
{ CF_TYPE_FICTION, "data" DIR_SEPARATOR_STR "fiction", ".txt", CF_TYPE_DATA },
|
||||
{ CF_TYPE_TEMP_SUBDIR_LOOKUP, "", ".eff", CF_TYPE_DATA },
|
||||
};
|
||||
|
||||
|
||||
@@ -161,15 +162,11 @@ int cfile_in_root_dir(const char *exe_path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the cfile system. Called once at application start.
|
||||
*
|
||||
* @param exe_dir Path to a file (not a directory)
|
||||
* @param cdrom_dir Path to a CD drive mount point (may be NULL)
|
||||
*
|
||||
* @return 0 On success
|
||||
* @return 1 On error
|
||||
*/
|
||||
// cfile_init() initializes the cfile system. Called once at application start.
|
||||
//
|
||||
// returns: success ==> 0
|
||||
// error ==> non-zero
|
||||
//
|
||||
int cfile_init(const char *exe_dir, const char *cdrom_dir)
|
||||
{
|
||||
int i;
|
||||
@@ -505,7 +502,7 @@ int cf_exists(const char *filename, int dir_type)
|
||||
if ( (filename == NULL) || !strlen(filename) )
|
||||
return 0;
|
||||
|
||||
return (cf_find_file_location(filename, dir_type, 0, NULL, NULL, &offset) && !offset);
|
||||
return (cf_find_file_location(filename, dir_type, 0, NULL, &offset, NULL) && !offset);
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
|
||||
+3
-1
@@ -78,8 +78,9 @@ typedef struct {
|
||||
#define CF_TYPE_INTEL_ANIMS 34
|
||||
#define CF_TYPE_SCRIPTS 35
|
||||
#define CF_TYPE_FICTION 36
|
||||
#define CF_TYPE_TEMP_SUBDIR_LOOKUP 37
|
||||
|
||||
#define CF_MAX_PATH_TYPES 37 // Can be as high as you'd like //DTP; yeah but beware alot of things uses CF_MAX_PATH_TYPES
|
||||
#define CF_MAX_PATH_TYPES 38 // Can be as high as you'd like //DTP; yeah but beware alot of things uses CF_MAX_PATH_TYPES
|
||||
|
||||
|
||||
// TRUE if type is specified and valid
|
||||
@@ -114,6 +115,7 @@ extern char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN];
|
||||
#endif
|
||||
|
||||
//================= LOW-LEVEL FUNCTIONS ==================
|
||||
// Call this once at the beginning of the program
|
||||
int cfile_init(const char *exe_dir, const char *cdrom_dir=NULL);
|
||||
|
||||
// Call this if pack files got added or removed or the
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <winbase.h> /* needed for memory mapping of file functions */
|
||||
#endif
|
||||
|
||||
#include "cfile/cfile.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
|
||||
void cf_sort_filenames( SCP_vector<SCP_string> &list, int sort, SCP_vector<file_list_info> *info )
|
||||
|
||||
+16
-17
@@ -9,12 +9,13 @@
|
||||
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
@@ -32,13 +33,13 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "localization/localize.h"
|
||||
|
||||
|
||||
|
||||
#define CF_ROOTTYPE_PATH 0
|
||||
#define CF_ROOTTYPE_PACK 1
|
||||
|
||||
@@ -219,15 +220,19 @@ int cf_get_packfile_count(cf_root *root)
|
||||
}
|
||||
|
||||
// packfile sort function
|
||||
bool cf_packfile_sort_func(const cf_root_sort &r1, const cf_root_sort &r2)
|
||||
int cf_packfile_sort_func(const void *elem1, const void *elem2)
|
||||
{
|
||||
cf_root_sort *r1, *r2;
|
||||
r1 = (cf_root_sort*)elem1;
|
||||
r2 = (cf_root_sort*)elem2;
|
||||
|
||||
// if the 2 directory types are the same, do a string compare
|
||||
if (r1.cf_type == r2.cf_type) {
|
||||
return (stricmp(r1.path, r2.path) < 0);
|
||||
if(r1->cf_type == r2->cf_type){
|
||||
return stricmp(r1->path, r2->path);
|
||||
}
|
||||
|
||||
// otherwise return them in order of CF_TYPE_* precedence
|
||||
return (r1.cf_type < r2.cf_type);
|
||||
return (r1->cf_type < r2->cf_type) ? -1 : 1;
|
||||
}
|
||||
|
||||
// Go through a root and look for pack files
|
||||
@@ -336,7 +341,7 @@ void cf_build_pack_list( cf_root *root )
|
||||
Assert(root_index == temp_root_count);
|
||||
|
||||
// sort the roots
|
||||
std::sort(temp_roots_sort, temp_roots_sort + temp_root_count, cf_packfile_sort_func);
|
||||
qsort(temp_roots_sort, temp_root_count, sizeof(cf_root_sort), cf_packfile_sort_func);
|
||||
|
||||
// now insert them all into the real root list properly
|
||||
cf_root *new_root;
|
||||
@@ -665,11 +670,7 @@ void cf_search_root_pack(int root_index)
|
||||
VP_FILE_HEADER VP_header;
|
||||
|
||||
Assert( sizeof(VP_header) == 16 );
|
||||
if (fread(&VP_header, sizeof(VP_header), 1, fp) != 1) {
|
||||
mprintf(("Skipping VP file ('%s') because the header could not be read...\n", root->path));
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
fread(&VP_header, 1, sizeof(VP_header), fp);
|
||||
|
||||
VP_header.version = INTEL_INT( VP_header.version ); //-V570
|
||||
VP_header.index_offset = INTEL_INT( VP_header.index_offset ); //-V570
|
||||
@@ -689,10 +690,7 @@ void cf_search_root_pack(int root_index)
|
||||
for (i=0; i<VP_header.num_files; i++ ) {
|
||||
VP_FILE find;
|
||||
|
||||
if (fread( &find, sizeof(VP_FILE), 1, fp ) != 1) {
|
||||
mprintf(("Failed to read file entry (currently in directory %s)!\n", search_path));
|
||||
break;
|
||||
}
|
||||
fread( &find, sizeof(VP_FILE), 1, fp );
|
||||
|
||||
find.offset = INTEL_INT( find.offset ); //-V570
|
||||
find.size = INTEL_INT( find.size ); //-V570
|
||||
@@ -903,6 +901,7 @@ int cf_find_file_location( const char *filespec, int pathtype, int max_out, char
|
||||
case CF_TYPE_MULTI_CACHE:
|
||||
case CF_TYPE_MISSIONS:
|
||||
case CF_TYPE_CACHE:
|
||||
case CF_TYPE_TEMP_SUBDIR_LOOKUP:
|
||||
cfs_slow_search = 1;
|
||||
break;
|
||||
|
||||
|
||||
+73
-181
@@ -12,13 +12,13 @@
|
||||
#include "camera/camera.h" //VIEWER_ZOOM_DEFAULT
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "globalincs/version.h"
|
||||
#include "hud/hudconfig.h"
|
||||
#include "network/multi.h"
|
||||
#include "hud/hudconfig.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "globalincs/version.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
@@ -141,11 +141,10 @@ Flag exe_params[] =
|
||||
{ "-3dshockwave", "Enable 3D shockwaves", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dshockwave" },
|
||||
{ "-post_process", "Enable post processing", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-post_process" },
|
||||
{ "-soft_particles", "Enable soft particles", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-soft_particles" },
|
||||
{ "-fxaa", "Enable FXAA anti-aliasing", true, EASY_MEM_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fxaa" },
|
||||
{ "-nolightshafts", "Disable lightshafts", true, EASY_DEFAULT, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
|
||||
{ "-fxaa", "Enable FXAA anti-aliasing", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fxaa" },
|
||||
{ "-nolightshafts", "Disable lightshafts", true, EASY_DEFAULT, EASY_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
|
||||
{ "-fb_explosions", "Enable Framebuffer Shockwaves", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fb_explosions", },
|
||||
{ "-no_deferred", "Disable Deferred Lighting", true, EASY_DEFAULT_MEM, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_deferred"},
|
||||
{ "-enable_shadows", "Enable Shadows", true, EASY_MEM_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_shadows"},
|
||||
|
||||
{ "-img2dds", "Compress non-compressed images", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-img2dds", },
|
||||
{ "-no_vsync", "Disable vertical sync", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_vsync", },
|
||||
{ "-no_fps_capping", "Don't limit frames-per-second", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_fps_capping", },
|
||||
@@ -167,7 +166,6 @@ Flag exe_params[] =
|
||||
{ "-snd_preload", "Preload mission game sounds", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-snd_preload", },
|
||||
{ "-nosound", "Disable all sound", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nosound", },
|
||||
{ "-nomusic", "Disable music", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomusic", },
|
||||
{ "-no_enhanced_sound", "Disable enhanced sound", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_enhanced_sound", },
|
||||
|
||||
{ "-standalone", "Run as standalone server", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-standalone", },
|
||||
{ "-startgame", "Skip mainhall and start hosting", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-startgame", },
|
||||
@@ -183,6 +181,7 @@ Flag exe_params[] =
|
||||
{ "-noparseerrors", "Disable parsing errors", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noparseerrors", },
|
||||
{ "-query_speech", "Check if this build has speech", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-query_speech", },
|
||||
{ "-novbo", "Disable OpenGL VBO", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-novbo", },
|
||||
{ "-noibx", "Don't use cached index buffers (IBX)", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noibx", },
|
||||
{ "-loadallweps", "Load all weapons, even those not used", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-loadallweps", },
|
||||
{ "-disable_fbo", "Disable OpenGL RenderTargets", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_fbo", },
|
||||
{ "-disable_pbo", "Disable OpenGL Pixel Buffer Objects", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_pbo", },
|
||||
@@ -197,9 +196,6 @@ Flag exe_params[] =
|
||||
{ "-use_gldrawelements","Don't use glDrawRangeElements", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-use_gldrawelements", },
|
||||
{ "-old_collision", "Use old collision detection system", true, EASY_DEFAULT, EASY_ALL_ON, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-old_collision", },
|
||||
{ "-gl_finish", "Fix input lag on some ATI+Linux systems", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-gl_finish", },
|
||||
{ "-no_batching", "Disable batched model rendering", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-no_geo_effects", "Disable geometry shader for effects", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-set_cpu_affinity", "Sets processor affinity to config value", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
|
||||
{ "-ingame_join", "Allow in-game joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
|
||||
{ "-voicer", "Enable voice recognition", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-voicer", },
|
||||
@@ -247,7 +243,6 @@ cmdline_parm allowbelow_arg("-allowbelow", "Ranks below this can join multi", AT
|
||||
cmdline_parm standalone_arg("-standalone", NULL, AT_NONE);
|
||||
cmdline_parm nosound_arg("-nosound", NULL, AT_NONE); // Cmdline_freespace_no_sound
|
||||
cmdline_parm nomusic_arg("-nomusic", NULL, AT_NONE); // Cmdline_freespace_no_music
|
||||
cmdline_parm noenhancedsound_arg("-no_enhanced_sound", NULL, AT_NONE); // Cmdline_no_enhanced_sound
|
||||
cmdline_parm startgame_arg("-startgame", NULL, AT_NONE); // Cmdline_start_netgame
|
||||
cmdline_parm gameclosed_arg("-closed", NULL, AT_NONE); // Cmdline_closed_game
|
||||
cmdline_parm gamerestricted_arg("-restricted", NULL, AT_NONE); // Cmdline_restricted_game
|
||||
@@ -310,10 +305,6 @@ cmdline_parm fxaa_preset_arg("-fxaa_preset", "FXAA quality (0-9), requires -post
|
||||
cmdline_parm fb_explosions_arg("-fb_explosions", NULL, AT_NONE);
|
||||
cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL, AT_NONE);
|
||||
cmdline_parm brieflighting_arg("-brief_lighting", NULL, AT_NONE);
|
||||
cmdline_parm no_batching("-no_batching", NULL, AT_NONE);
|
||||
cmdline_parm shadow_quality_arg("-shadow_quality", NULL, AT_INT);
|
||||
cmdline_parm enable_shadows_arg("-enable_shadows", NULL, AT_NONE);
|
||||
cmdline_parm no_deferred_lighting_arg("-no_deferred", NULL, AT_NONE); // Cmdline_no_deferred
|
||||
|
||||
float Cmdline_clip_dist = Default_min_draw_distance;
|
||||
float Cmdline_fov = 0.75f;
|
||||
@@ -337,11 +328,8 @@ bool Cmdline_fxaa = false;
|
||||
int Cmdline_fxaa_preset = 6;
|
||||
extern int Fxaa_preset_last_frame;
|
||||
bool Cmdline_fb_explosions = 0;
|
||||
bool Cmdline_no_batching = false;
|
||||
extern bool ls_force_off;
|
||||
bool Cmdline_brief_lighting = 0;
|
||||
int Cmdline_shadow_quality = 0;
|
||||
int Cmdline_no_deferred_lighting = 0;
|
||||
|
||||
// Game Speed related
|
||||
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL, AT_NONE); // Cmdline_cache_bitmaps
|
||||
@@ -390,7 +378,6 @@ cmdline_parm voice_recognition_arg("-voicer", NULL, AT_NONE); // Cmdline_voice_r
|
||||
int Cmdline_query_speech = 0;
|
||||
int Cmdline_snd_preload = 0; // preload game sounds during mission load
|
||||
int Cmdline_voice_recognition = 0;
|
||||
int Cmdline_no_enhanced_sound = 0;
|
||||
|
||||
// MOD related
|
||||
cmdline_parm mod_arg("-mod", "List of folders to overwrite/add-to the default data", AT_STRING, true); // Cmdline_mod -- DTP modsupport
|
||||
@@ -415,6 +402,7 @@ int Cmdline_objupd = 3; // client object updates on LAN by default
|
||||
// Troubleshooting
|
||||
cmdline_parm loadallweapons_arg("-loadallweps", NULL, AT_NONE); // Cmdline_load_all_weapons
|
||||
cmdline_parm htl_arg("-nohtl", NULL, AT_NONE); // Cmdline_nohtl -- don't use HT&L
|
||||
cmdline_parm noibx_arg("-noibx", NULL, AT_NONE); // Cmdline_noibx
|
||||
cmdline_parm nomovies_arg("-nomovies", NULL, AT_NONE); // Cmdline_nomovies -- Allows video streaming
|
||||
cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL, AT_NONE); // Cmdline_no_set_gamma
|
||||
cmdline_parm no_vbo_arg("-novbo", NULL, AT_NONE); // Cmdline_novbo
|
||||
@@ -430,11 +418,10 @@ cmdline_parm no_drawrangeelements("-use_gldrawelements", NULL, AT_NONE); // Cmdl
|
||||
cmdline_parm keyboard_layout("-keyboard_layout", "Specify keyboard layout (qwertz or azerty)", AT_STRING);
|
||||
cmdline_parm old_collision_system("-old_collision", NULL, AT_NONE); // Cmdline_old_collision_sys
|
||||
cmdline_parm gl_finish ("-gl_finish", NULL, AT_NONE);
|
||||
cmdline_parm no_geo_sdr_effects("-no_geo_effects", NULL, AT_NONE);
|
||||
cmdline_parm set_cpu_affinity("-set_cpu_affinity", NULL, AT_NONE);
|
||||
|
||||
int Cmdline_load_all_weapons = 0;
|
||||
int Cmdline_nohtl = 0;
|
||||
int Cmdline_noibx = 0;
|
||||
int Cmdline_nomovies = 0;
|
||||
int Cmdline_no_set_gamma = 0;
|
||||
int Cmdline_novbo = 0; // turn off OGL VBO support, troubleshooting
|
||||
@@ -448,8 +435,6 @@ int Cmdline_no_di_mouse = 0;
|
||||
int Cmdline_drawelements = 0;
|
||||
char* Cmdline_keyboard_layout = NULL;
|
||||
bool Cmdline_gl_finish = false;
|
||||
bool Cmdline_no_geo_sdr_effects = false;
|
||||
bool Cmdline_set_cpu_affinity = false;
|
||||
|
||||
// Developer/Testing related
|
||||
cmdline_parm start_mission_arg("-start_mission", "Skip mainhall and run this mission", AT_STRING); // Cmdline_start_mission
|
||||
@@ -469,7 +454,6 @@ cmdline_parm debug_window_arg("-debug_window", NULL, AT_NONE); // Cmdline_debug_
|
||||
cmdline_parm window_arg("-window", NULL, AT_NONE); // Cmdline_window
|
||||
cmdline_parm fullscreen_window_arg("-fullscreen_window", "Fullscreen/borderless window (Windows only)", AT_NONE);
|
||||
cmdline_parm res_arg("-res", "Resolution, formatted like 1600x900", AT_STRING);
|
||||
cmdline_parm center_res_arg("-center_res", "Resolution of center monitor, formatted like 1600x900", AT_STRING);
|
||||
cmdline_parm verify_vps_arg("-verify_vps", NULL, AT_NONE); // Cmdline_verify_vps -- spew VP crcs to vp_crcs.txt
|
||||
cmdline_parm parse_cmdline_only(PARSE_COMMAND_LINE_STRING, "Ignore any cmdline_fso.cfg files", AT_NONE);
|
||||
#ifdef SCP_UNIX
|
||||
@@ -497,7 +481,6 @@ int Cmdline_debug_window = 0;
|
||||
int Cmdline_window = 0;
|
||||
int Cmdline_fullscreen_window = 0;
|
||||
char *Cmdline_res = 0;
|
||||
char *Cmdline_center_res = 0;
|
||||
int Cmdline_verify_vps = 0;
|
||||
#ifdef SCP_UNIX
|
||||
int Cmdline_no_grab = 0;
|
||||
@@ -849,21 +832,20 @@ void os_init_cmdline(char *cmdline)
|
||||
size_t len = 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';
|
||||
}
|
||||
fgets(buf, len-1, fp);
|
||||
|
||||
// replace the newline character with a NULL
|
||||
if ( (p = strrchr(buf, '\n')) != NULL ) {
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
// append a space for the os_parse_parms() check
|
||||
strcat_s(buf, len, " ");
|
||||
// append a space for the os_parse_parms() check
|
||||
strcat_s(buf, len, " ");
|
||||
#endif
|
||||
|
||||
os_parse_parms(buf);
|
||||
os_validate_parms(buf);
|
||||
}
|
||||
os_parse_parms(buf);
|
||||
os_validate_parms(buf);
|
||||
delete [] buf;
|
||||
fclose(fp);
|
||||
}
|
||||
@@ -888,20 +870,18 @@ void os_init_cmdline(char *cmdline)
|
||||
size_t len = 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';
|
||||
}
|
||||
fgets(buf, len-1, fp);
|
||||
|
||||
// append a space for the os_parse_parms() check
|
||||
strcat_s(buf, len, " ");
|
||||
|
||||
os_parse_parms(buf);
|
||||
os_validate_parms(buf);
|
||||
// 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_parse_parms(buf);
|
||||
os_validate_parms(buf);
|
||||
delete [] buf;
|
||||
fclose(fp);
|
||||
}
|
||||
@@ -1036,100 +1016,6 @@ char *cmdline_parm::str()
|
||||
return args;
|
||||
}
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
// Return a vector with all filesystem names of "parent/dir" relative to parent.
|
||||
// dir must not contain a slash.
|
||||
static SCP_vector<SCP_string> unix_get_single_dir_names(SCP_string parent, SCP_string dir)
|
||||
{
|
||||
SCP_vector<SCP_string> ret;
|
||||
|
||||
DIR *dp;
|
||||
if ((dp = opendir(parent.c_str())) == NULL) {
|
||||
Warning(LOCATION, "Can't open directory '%s' when searching mod paths. Ignoring. errno=%d", parent.c_str(), errno);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dirent *dirp;
|
||||
while ((dirp = readdir(dp)) != NULL) {
|
||||
if (!stricmp(dirp->d_name, dir.c_str())) {
|
||||
ret.push_back(dirp->d_name);
|
||||
}
|
||||
}
|
||||
(void)closedir(dp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Return a vector with all filesystem names of "parent/dir" relative to parent.
|
||||
// Recurses to deal with slashes in dir.
|
||||
static SCP_vector<SCP_string> unix_get_dir_names(SCP_string parent, SCP_string dir)
|
||||
{
|
||||
size_t slash = dir.find_first_of("/\\");
|
||||
|
||||
// no subdirectories, no need to recurse
|
||||
if (slash == std::string::npos) {
|
||||
return unix_get_single_dir_names(parent, dir);
|
||||
}
|
||||
|
||||
// get the names of the first component of dir
|
||||
SCP_vector<SCP_string> this_dir_names = unix_get_single_dir_names(parent, dir.substr(0, slash));
|
||||
|
||||
SCP_string rest = dir.substr(slash + 1);
|
||||
|
||||
SCP_vector<SCP_string> ret;
|
||||
|
||||
// search for the rest of dir in each of these
|
||||
SCP_vector<SCP_string>::iterator ii, end = this_dir_names.end();
|
||||
for (ii = this_dir_names.begin(); ii != end; ++ii) {
|
||||
SCP_string this_dir_path = parent + "/" + *ii;
|
||||
SCP_vector<SCP_string> mod_path = unix_get_dir_names(this_dir_path, rest);
|
||||
|
||||
// add all found paths relative to parent
|
||||
SCP_vector<SCP_string>::iterator ii2, end2 = mod_path.end();
|
||||
for (ii2 = mod_path.begin(); ii2 != end2; ++ii2) {
|
||||
ret.push_back(*ii + "/" + *ii2);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// For case sensitive filesystems (e.g. Linux/BSD) perform case-insensitive dir matches.
|
||||
static void handle_unix_modlist(char **modlist, int *len)
|
||||
{
|
||||
// search filesystem for given paths
|
||||
SCP_vector<SCP_string> mod_paths;
|
||||
for (char *cur_mod = strtok(*modlist, ","); cur_mod != NULL; cur_mod = strtok(NULL, ","))
|
||||
{
|
||||
SCP_vector<SCP_string> this_mod_paths = unix_get_dir_names(".", cur_mod);
|
||||
if (this_mod_paths.empty()) {
|
||||
ReleaseWarning(LOCATION, "Can't find mod '%s'. Ignoring.", cur_mod);
|
||||
}
|
||||
mod_paths.insert(mod_paths.end(), this_mod_paths.begin(), this_mod_paths.end());
|
||||
}
|
||||
|
||||
// create new char[] to replace modlist
|
||||
size_t total_len = 0;
|
||||
SCP_vector<SCP_string>::iterator ii, end = mod_paths.end();
|
||||
for (ii = mod_paths.begin(); ii != end; ++ii) {
|
||||
total_len += ii->length() + 1;
|
||||
}
|
||||
|
||||
char *new_modlist = new char[total_len + 1];
|
||||
memset(new_modlist, 0, total_len + 1);
|
||||
end = mod_paths.end();
|
||||
for (ii = mod_paths.begin(); ii != end; ++ii) {
|
||||
strcat_s(new_modlist, total_len + 1, ii->c_str());
|
||||
strcat_s(new_modlist, total_len + 1, ","); // replace later with NUL
|
||||
}
|
||||
|
||||
// make the rest of the modlist manipulation unaware that anything happened here
|
||||
delete [] *modlist;
|
||||
*modlist = new_modlist;
|
||||
*len = total_len;
|
||||
}
|
||||
#endif /* SCP_UNIX */
|
||||
|
||||
// external entry point into this modules
|
||||
|
||||
bool SetCmdlineParams()
|
||||
@@ -1264,11 +1150,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_freespace_no_music = 1;
|
||||
}
|
||||
|
||||
// Disable enhanced sound
|
||||
if (noenhancedsound_arg.found()) {
|
||||
Cmdline_no_enhanced_sound = 1;
|
||||
}
|
||||
|
||||
// should we start a network game
|
||||
if ( startgame_arg.found() ) {
|
||||
Cmdline_use_last_pilot = 1;
|
||||
@@ -1366,9 +1247,6 @@ bool SetCmdlineParams()
|
||||
if(res_arg.found()){
|
||||
Cmdline_res = res_arg.str();
|
||||
}
|
||||
if(center_res_arg.found()){
|
||||
Cmdline_center_res = center_res_arg.str();
|
||||
}
|
||||
if(almission_arg.found()){//DTP for autoload mission // developer oritentated
|
||||
Cmdline_almission = almission_arg.str();
|
||||
Cmdline_use_last_pilot = 1;
|
||||
@@ -1412,8 +1290,47 @@ bool SetCmdlineParams()
|
||||
strcpy_s(modlist, len+2, Cmdline_mod);
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
// handle case-insensitive searching
|
||||
handle_unix_modlist(&modlist, &len);
|
||||
// for case sensitive filesystems (e.g. Linux/BSD) perform case-insensitive dir matches
|
||||
DIR *dp;
|
||||
dirent *dirp;
|
||||
char *cur_pos, *temp;
|
||||
char cur_dir[CF_MAX_PATHNAME_LENGTH], delim[] = ",";
|
||||
SCP_vector<SCP_string> temp_modlist;
|
||||
size_t total_len = 0;
|
||||
|
||||
if ( !_getcwd(cur_dir, CF_MAX_PATHNAME_LENGTH ) ) {
|
||||
Error(LOCATION, "Can't get current working directory -- %d", errno );
|
||||
}
|
||||
|
||||
for (cur_pos = strtok(modlist, delim); cur_pos != NULL; cur_pos = strtok(NULL, delim))
|
||||
{
|
||||
if ((dp = opendir(cur_dir)) == NULL) {
|
||||
Error(LOCATION, "Can't open directory '%s' -- %d", cur_dir, errno );
|
||||
}
|
||||
|
||||
while ((dirp = readdir(dp)) != NULL) {
|
||||
if (!stricmp(dirp->d_name, cur_pos)) {
|
||||
temp_modlist.push_back(dirp->d_name);
|
||||
total_len += (strlen(dirp->d_name) + 1);
|
||||
}
|
||||
}
|
||||
(void)closedir(dp);
|
||||
}
|
||||
|
||||
// create new char[] to replace modlist
|
||||
char *new_modlist = new char[total_len+1];
|
||||
memset( new_modlist, 0, total_len + 1 );
|
||||
SCP_vector<SCP_string>::iterator ii, end = temp_modlist.end();
|
||||
for (ii = temp_modlist.begin(); ii != end; ++ii) {
|
||||
strcat_s(new_modlist, total_len+1, ii->c_str());
|
||||
strcat_s(new_modlist, total_len+1, ","); // replace later with NUL
|
||||
}
|
||||
|
||||
// make the rest of the function unaware that anything happened here
|
||||
temp = modlist;
|
||||
modlist = new_modlist;
|
||||
delete [] temp;
|
||||
len = total_len;
|
||||
#endif
|
||||
|
||||
// null terminate each individual
|
||||
@@ -1617,16 +1534,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_gl_finish = true;
|
||||
}
|
||||
|
||||
if ( no_geo_sdr_effects.found() )
|
||||
{
|
||||
Cmdline_no_geo_sdr_effects = true;
|
||||
}
|
||||
|
||||
if (set_cpu_affinity.found())
|
||||
{
|
||||
Cmdline_set_cpu_affinity = true;
|
||||
}
|
||||
|
||||
if ( snd_preload_arg.found() )
|
||||
{
|
||||
Cmdline_snd_preload = 1;
|
||||
@@ -1653,6 +1560,10 @@ bool SetCmdlineParams()
|
||||
if(dis_weapons.found())
|
||||
Cmdline_dis_weapons = 1;
|
||||
|
||||
if ( noibx_arg.found() ) {
|
||||
Cmdline_noibx = 1;
|
||||
}
|
||||
|
||||
if ( no_fbo_arg.found() ) {
|
||||
Cmdline_no_fbo = 1;
|
||||
}
|
||||
@@ -1705,11 +1616,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_fb_explosions = 1;
|
||||
}
|
||||
|
||||
if ( no_batching.found() )
|
||||
{
|
||||
Cmdline_no_batching = true;
|
||||
}
|
||||
|
||||
if ( brieflighting_arg.found() )
|
||||
{
|
||||
Cmdline_brief_lighting = 1;
|
||||
@@ -1735,20 +1641,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_reparse_mainhall = 1;
|
||||
}
|
||||
|
||||
if( enable_shadows_arg.found() )
|
||||
{
|
||||
Cmdline_shadow_quality = 2;
|
||||
if( shadow_quality_arg.found() )
|
||||
{
|
||||
Cmdline_shadow_quality = shadow_quality_arg.get_int();
|
||||
}
|
||||
}
|
||||
|
||||
if( no_deferred_lighting_arg.found() )
|
||||
{
|
||||
Cmdline_no_deferred_lighting = 1;
|
||||
}
|
||||
|
||||
if (frame_profile_arg.found() )
|
||||
{
|
||||
Cmdline_frame_profile = true;
|
||||
|
||||
@@ -48,7 +48,6 @@ extern int Cmdline_use_last_pilot;
|
||||
extern int Cmdline_window;
|
||||
extern int Cmdline_fullscreen_window;
|
||||
extern char *Cmdline_res;
|
||||
extern char *Cmdline_center_res;
|
||||
|
||||
|
||||
// FSO OPTIONS -------------------------------------------------
|
||||
@@ -77,9 +76,6 @@ extern int Cmdline_bloom_intensity;
|
||||
extern bool Cmdline_fxaa;
|
||||
extern int Cmdline_fxaa_preset;
|
||||
extern bool Cmdline_fb_explosions;
|
||||
extern bool Cmdline_no_batching;
|
||||
extern int Cmdline_shadow_quality;
|
||||
extern int Cmdline_no_deferred_lighting;
|
||||
|
||||
// Game Speed related
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
@@ -106,7 +102,6 @@ extern int Cmdline_stretch_menu;
|
||||
extern int Cmdline_query_speech;
|
||||
extern int Cmdline_snd_preload;
|
||||
extern int Cmdline_voice_recognition;
|
||||
extern int Cmdline_no_enhanced_sound;
|
||||
|
||||
// MOD related
|
||||
extern char *Cmdline_mod; // DTP for mod support
|
||||
@@ -121,6 +116,7 @@ extern int Cmdline_objupd;
|
||||
// Troubleshooting
|
||||
extern int Cmdline_load_all_weapons;
|
||||
extern int Cmdline_nohtl;
|
||||
extern int Cmdline_noibx;
|
||||
extern int Cmdline_nomovies; // WMC Toggles movie playing support
|
||||
extern int Cmdline_no_set_gamma;
|
||||
extern int Cmdline_novbo;
|
||||
@@ -135,8 +131,6 @@ extern int Cmdline_no_di_mouse;
|
||||
extern int Cmdline_drawelements;
|
||||
extern char* Cmdline_keyboard_layout;
|
||||
extern bool Cmdline_gl_finish;
|
||||
extern bool Cmdline_no_geo_sdr_effects;
|
||||
extern bool Cmdline_set_cpu_affinity;
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
|
||||
@@ -10,18 +10,17 @@
|
||||
|
||||
|
||||
#include "cmeasure/cmeasure.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "hud/hud.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "object/object.h"
|
||||
#include "ship/ship.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "object/object.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "hud/hud.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "mission/missionparse.h"
|
||||
|
||||
int Cmeasures_homing_check = 0;
|
||||
int Countermeasures_enabled = 1; // Debug, set to 0 means no one can fire countermeasures.
|
||||
const float CMEASURE_DETONATE_DISTANCE = 40.0f;
|
||||
|
||||
//Used to set a countermeasure velocity after being launched from a ship as a countermeasure
|
||||
//ie not as a primary or secondary.
|
||||
|
||||
@@ -22,7 +22,6 @@ class object;
|
||||
// Maximum distance at which a countermeasure can be tracked
|
||||
// If this value is too large, missiles will always be tracking countermeasures.
|
||||
#define MAX_CMEASURE_TRACK_DIST 300.0f
|
||||
extern const float CMEASURE_DETONATE_DISTANCE;
|
||||
|
||||
extern int Cmeasures_homing_check;
|
||||
extern int Countermeasures_enabled;
|
||||
|
||||
@@ -10,26 +10,26 @@
|
||||
|
||||
|
||||
|
||||
#include "controlconfig/controlsconfig.h"
|
||||
#include "debugconsole/console.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "gamehelp/contexthelp.h"
|
||||
#include "controlconfig/controlsconfig.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "graphics/font.h"
|
||||
#include "hud/hudsquadmsg.h"
|
||||
#include "io/joy.h"
|
||||
#include "io/key.h"
|
||||
#include "io/timer.h"
|
||||
#include "ui/ui.h"
|
||||
#include "io/joy.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "missionui/missionscreencommon.h"
|
||||
#include "graphics/font.h"
|
||||
#include "pilotfile/pilotfile.h"
|
||||
#include "gamehelp/contexthelp.h"
|
||||
#include "popup/popup.h"
|
||||
#include "ui/uidefs.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "network/multi_pmsg.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "pilotfile/pilotfile.h"
|
||||
#include "popup/popup.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/uidefs.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -393,10 +393,21 @@ int control_config_detect_axis()
|
||||
|
||||
void control_config_conflict_check()
|
||||
{
|
||||
int i, j;
|
||||
|
||||
int i, j, shift = -1, alt = -1;
|
||||
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
Conflicts[i].key = Conflicts[i].joy = -1;
|
||||
switch (Control_config[i].key_id) {
|
||||
case KEY_LSHIFT:
|
||||
case KEY_RSHIFT:
|
||||
shift = i;
|
||||
break;
|
||||
|
||||
case KEY_LALT:
|
||||
case KEY_RALT:
|
||||
alt = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<NUM_TABS; i++) {
|
||||
@@ -457,12 +468,15 @@ void control_config_conflict_check()
|
||||
// do list setup required prior to rendering and checking for the controls listing. Called when list changes
|
||||
void control_config_list_prepare()
|
||||
{
|
||||
int j, y, z;
|
||||
int j, k, y, z;
|
||||
int font_height = gr_get_font_height();
|
||||
|
||||
Num_cc_lines = y = z = 0;
|
||||
while (z < CCFG_MAX) {
|
||||
if (Control_config[z].tab == Tab && !Control_config[z].disabled) {
|
||||
k = Control_config[z].key_id;
|
||||
j = Control_config[z].joy_id;
|
||||
|
||||
if (Control_config[z].hasXSTR) {
|
||||
Cc_lines[Num_cc_lines].label = XSTR(Control_config[z].text, CONTROL_CONFIG_XSTR + z);
|
||||
} else {
|
||||
@@ -652,7 +666,7 @@ void control_config_bind_axis(int i, int axis)
|
||||
|
||||
int control_config_remove_binding()
|
||||
{
|
||||
int z;
|
||||
int z, j, k;
|
||||
config_item_undo *ptr;
|
||||
|
||||
if (Selected_line < 0) {
|
||||
@@ -682,6 +696,7 @@ int control_config_remove_binding()
|
||||
return -1;
|
||||
}
|
||||
|
||||
j = k = -1;
|
||||
ptr = get_undo_block(1);
|
||||
ptr->index[0] = z;
|
||||
ptr->list[0] = Control_config[z];
|
||||
@@ -941,9 +956,9 @@ void control_config_reset_defaults(int presetnum)
|
||||
|
||||
// Reset keyboard defaults
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
// Note that key_default and joy_default are NOT overwritten here;
|
||||
// they should retain the values of the first preset because
|
||||
// for example the key-pressed SEXP works off the defaults of the first preset
|
||||
// Note that key_default, joy_default and text_default are NOT
|
||||
// overwritten here; they should retain the values of the first preset
|
||||
Control_config[i].text = preset[i].text;
|
||||
Control_config[i].key_id = preset[i].key_default;
|
||||
Control_config[i].joy_id = preset[i].joy_default;
|
||||
Control_config[i].tab = preset[i].tab;
|
||||
@@ -1424,8 +1439,8 @@ void control_config_close()
|
||||
void control_config_do_frame(float frametime)
|
||||
{
|
||||
const char *str;
|
||||
char buf[256];
|
||||
int i, j, k, w, x, y, z, line, conflict;
|
||||
char buf[256], *jptr;
|
||||
int i, j, k, w, x, y, z, len, line, conflict;
|
||||
int font_height = gr_get_font_height();
|
||||
int select_tease_line = -1; // line mouse is down on, but won't be selected until button released
|
||||
static float timer = 0.0f;
|
||||
@@ -1984,6 +1999,7 @@ void control_config_do_frame(float frametime)
|
||||
k = Control_config[z].key_id;
|
||||
j = Control_config[z].joy_id;
|
||||
x = Control_list_key_x[gr_screen.res];
|
||||
jptr = NULL;
|
||||
*buf = 0;
|
||||
|
||||
if ((k < 0) && (j < 0)) {
|
||||
@@ -2010,6 +2026,7 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
gr_printf_menu(x, y, buf);
|
||||
|
||||
len = strlen(buf);
|
||||
Cc_lines[line].kx = x - Control_list_coords[gr_screen.res][CONTROL_X_COORD];
|
||||
gr_get_string_size(&w, NULL, buf);
|
||||
Cc_lines[line].kw = w;
|
||||
@@ -2099,7 +2116,7 @@ void control_config_do_frame(float frametime)
|
||||
bool this_preset_matches = true;
|
||||
config_item *this_preset = Control_config_presets[i];
|
||||
|
||||
for (j=0; j<CCFG_MAX; j++) {
|
||||
for (int j=0; j<CCFG_MAX; j++) {
|
||||
if (!Control_config[j].disabled && Control_config[j].key_id != this_preset[j].key_default) {
|
||||
this_preset_matches = false;
|
||||
break;
|
||||
@@ -2187,7 +2204,7 @@ void control_check_indicate()
|
||||
#ifndef NDEBUG
|
||||
if (Show_controls_info) {
|
||||
gr_set_color_fast(&HUD_color_debug);
|
||||
gr_printf_no_resize(gr_screen.center_offset_x + gr_screen.center_w - 154, gr_screen.center_offset_y + 5, NOX("Ctrls checked: %d"), Control_check_count);
|
||||
gr_printf_no_resize(gr_screen.max_w - 154, 5, NOX("Ctrls checked: %d"), Control_check_count);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2229,11 +2246,11 @@ int check_control_used(int id, int key)
|
||||
|
||||
// check what current modifiers are pressed
|
||||
mask = 0;
|
||||
if (keyd_pressed[KEY_LSHIFT] || key_down_count(KEY_LSHIFT) || keyd_pressed[KEY_RSHIFT] || key_down_count(KEY_RSHIFT)) {
|
||||
if (keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT]) {
|
||||
mask |= KEY_SHIFTED;
|
||||
}
|
||||
|
||||
if (keyd_pressed[KEY_LALT] || key_down_count(KEY_LALT) || keyd_pressed[KEY_RALT] || key_down_count(KEY_RALT)) {
|
||||
if (keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT]) {
|
||||
mask |= KEY_ALTED;
|
||||
}
|
||||
|
||||
@@ -2248,7 +2265,7 @@ int check_control_used(int id, int key)
|
||||
|
||||
z &= KEY_MASK;
|
||||
|
||||
if (keyd_pressed[z] || key_down_count(z)) {
|
||||
if (keyd_pressed[z]) {
|
||||
control_used(id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#ifndef CONTROLS_CONFIG_H
|
||||
#define CONTROLS_CONFIG_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#define CONTROL_CONFIG_XSTR 507
|
||||
|
||||
/*!
|
||||
@@ -63,13 +63,14 @@ typedef struct config_item {
|
||||
short joy_default; //!< default joystick button bound to action
|
||||
char tab; //!< what tab (category) it belongs in
|
||||
bool hasXSTR; //!< whether we should translate this with an XSTR
|
||||
char *text; //!< describes the action in the config screen
|
||||
char *default_text; //!< default description of the action
|
||||
char type; //!< manner control should be checked in
|
||||
short key_id; //!< actual key bound to action
|
||||
short joy_id; //!< joystick button bound to action
|
||||
int used; //!< has control been used yet in mission? If so, this is the timestamp
|
||||
bool disabled; //!< whether this action should be available at all
|
||||
bool continuous_ongoing;//!< whether this action is a continuous one and is currently ongoing
|
||||
char *text; //!< overridable description of the action
|
||||
} config_item;
|
||||
|
||||
/*!
|
||||
@@ -297,7 +298,6 @@ extern char **Scan_code_text;
|
||||
extern char **Joy_button_text;
|
||||
|
||||
void control_config_common_init(); //!< initialize common control config stuff - call at game startup after localization has been initialized
|
||||
void control_config_common_close(); //!< close common control config stuff - call at game shutdown
|
||||
|
||||
void control_config_init();
|
||||
void control_config_do_frame(float frametime);
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
|
||||
#include "cfile/cfile.h"
|
||||
#include "controlconfig/controlsconfig.h"
|
||||
#include "globalincs/def_files.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "io/joy.h"
|
||||
#include "io/key.h"
|
||||
#include "io/joy.h"
|
||||
#include "localization/localize.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "globalincs/def_files.h"
|
||||
|
||||
// z64: These enumerations MUST equal to those in controlsconfig.cpp...
|
||||
// z64: Really need a better way than this.
|
||||
@@ -45,153 +45,153 @@ int Invert_axis_defaults[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
|
||||
//XSTR:OFF
|
||||
config_item Control_config[CCFG_MAX + 1] = {
|
||||
// targeting a ship
|
||||
{ KEY_T, -1, TARGET_TAB, true, "Target Next Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, true, "Target Previous Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_H, 2, TARGET_TAB, true, "Target Next Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, true, "Target Previous Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, true, "Toggle Auto Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_F, -1, TARGET_TAB, true, "Target Next Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, true, "Target Previous Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_Y, 4, TARGET_TAB, true, "Target Ship in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_G, -1, TARGET_TAB, true, "Target Target's Nearest Attacker", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, true, "Target Last Ship to Send Transmission", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, true, "Turn Off Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_T, -1, TARGET_TAB, true, "Target Next Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, true, "Target Previous Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_H, 2, TARGET_TAB, true, "Target Next Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, true, "Target Previous Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, true, "Toggle Auto Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_F, -1, TARGET_TAB, true, "Target Next Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, true, "Target Previous Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_Y, 4, TARGET_TAB, true, "Target Ship in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_G, -1, TARGET_TAB, true, "Target Target's Nearest Attacker", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, true, "Target Last Ship to Send Transmission", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, true, "Turn Off Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
// targeting a ship's subsystem
|
||||
{ KEY_V, -1, TARGET_TAB, true, "Target Subsystem in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_S, -1, TARGET_TAB, true, "Target Next Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, true, "Target Previous Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, true, "Turn Off Targeting of Subsystems", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_V, -1, TARGET_TAB, true, "Target Subsystem in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_S, -1, TARGET_TAB, true, "Target Next Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, true, "Target Previous Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, true, "Turn Off Targeting of Subsystems", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
// matching speed
|
||||
{ KEY_M, -1, COMPUTER_TAB, true, "Match Target Speed", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, true, "Toggle Auto Speed Matching", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_M, -1, COMPUTER_TAB, true, "Match Target Speed", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, true, "Toggle Auto Speed Matching", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
// weapons
|
||||
{ KEY_LCTRL, 0, WEAPON_TAB, true, "Fire Primary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_SPACEBAR, 1, WEAPON_TAB, true, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PERIOD, -1, WEAPON_TAB, true, "Cycle Forward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_COMMA, -1, WEAPON_TAB, true, "Cycle Backward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Bank", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_X, 3, WEAPON_TAB, true, "Launch Countermeasure", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_LCTRL, 0, WEAPON_TAB, true, "Fire Primary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SPACEBAR, 1, WEAPON_TAB, true, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PERIOD, -1, WEAPON_TAB, true, "Cycle Forward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_COMMA, -1, WEAPON_TAB, true, "Cycle Backward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Bank", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_X, 3, WEAPON_TAB, true, "Launch Countermeasure", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
// controls
|
||||
{ KEY_A, -1, SHIP_TAB, true, "Forward Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_Z, -1, SHIP_TAB, true, "Reverse Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD7, -1, SHIP_TAB, true, "Bank Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD9, -1, SHIP_TAB, true, "Bank Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD8, -1, SHIP_TAB, true, "Pitch Forward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD2, -1, SHIP_TAB, true, "Pitch Backward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD4, -1, SHIP_TAB, true, "Turn Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD6, -1, SHIP_TAB, true, "Turn Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_A, -1, SHIP_TAB, true, "Forward Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_Z, -1, SHIP_TAB, true, "Reverse Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD7, -1, SHIP_TAB, true, "Bank Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD9, -1, SHIP_TAB, true, "Bank Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD8, -1, SHIP_TAB, true, "Pitch Forward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD2, -1, SHIP_TAB, true, "Pitch Backward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD4, -1, SHIP_TAB, true, "Turn Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD6, -1, SHIP_TAB, true, "Turn Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
|
||||
// throttle controls
|
||||
{ KEY_BACKSP, -1, SHIP_TAB, true, "Set Throttle to Zero", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SLASH, -1, SHIP_TAB, true, "Set Throttle to Max", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_LBRACKET, -1, SHIP_TAB, true, "Set Throttle to One-Third", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_RBRACKET, -1, SHIP_TAB, true, "Set Throttle to Two-Thirds", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_EQUAL, -1, SHIP_TAB, true, "Increase Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_MINUS, -1, SHIP_TAB, true, "Decrease Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_BACKSP, -1, SHIP_TAB, true, "Set Throttle to Zero", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SLASH, -1, SHIP_TAB, true, "Set Throttle to Max", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_LBRACKET, -1, SHIP_TAB, true, "Set Throttle to One-Third", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_RBRACKET, -1, SHIP_TAB, true, "Set Throttle to Two-Thirds", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_EQUAL, -1, SHIP_TAB, true, "Increase Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_MINUS, -1, SHIP_TAB, true, "Decrease Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
// squadmate messaging
|
||||
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, true, "Attack My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, true, "Disarm My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, true, "Disable My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, true, "Attack My Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, true, "Capture My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Engage Enemy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, true, "Form on My Wing", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, true, "Ignore My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, true, "Protect My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, true, "Cover Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, true, "Return to Base", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, true, "Rearm Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, true, "Attack My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, true, "Disarm My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, true, "Disable My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, true, "Attack My Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, true, "Capture My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Engage Enemy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, true, "Form on My Wing", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, true, "Ignore My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, true, "Protect My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, true, "Cover Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, true, "Return to Base", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, true, "Rearm Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
{ KEY_R, 6, TARGET_TAB, true, "Target Closest Attacking Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_R, 6, TARGET_TAB, true, "Target Closest Attacking Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
// Views
|
||||
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, true, "Chase View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PADPERIOD, -1, COMPUTER_TAB, true, "External View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PADENTER, -1, COMPUTER_TAB, true, "Toggle External Camera Lock", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PAD0, -1, COMPUTER_TAB, true, "Free Look View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false }, // Not in use anymore (Swifty)
|
||||
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, true, "Current Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PADPLUS, -1, COMPUTER_TAB, true, "Increase View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PADMINUS, -1, COMPUTER_TAB, true, "Decrease View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD5, -1, COMPUTER_TAB, true, "Center View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, 33, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, 32, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, 34, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, 35, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, true, "Chase View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PADPERIOD, -1, COMPUTER_TAB, true, "External View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PADENTER, -1, COMPUTER_TAB, true, "Toggle External Camera Lock", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD0, -1, COMPUTER_TAB, true, "Free Look View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL }, // Not in use anymore (Swifty)
|
||||
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, true, "Current Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PADPLUS, -1, COMPUTER_TAB, true, "Increase View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PADMINUS, -1, COMPUTER_TAB, true, "Decrease View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD5, -1, COMPUTER_TAB, true, "Center View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, 33, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, 32, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, 34, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, 35, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
|
||||
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, true, "Cycle Radar Range", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_C, -1, COMPUTER_TAB, true, "Communications Menu", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ -1, -1, -1, true, "Show Objectives", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, true, "Enter Subspace (End Mission)", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_J, -1, TARGET_TAB, true, "Target Target's Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_TAB, 5, SHIP_TAB, true, "Afterburner", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, true, "Cycle Radar Range", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_C, -1, COMPUTER_TAB, true, "Communications Menu", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, -1, true, "Show Objectives", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, true, "Enter Subspace (End Mission)", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_J, -1, TARGET_TAB, true, "Target Target's Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_TAB, 5, SHIP_TAB, true, "Afterburner", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
|
||||
{ KEY_INSERT, -1, COMPUTER_TAB, true, "Increase Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_DELETE, -1, COMPUTER_TAB, true, "Decrease Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_HOME, -1, COMPUTER_TAB, true, "Increase Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_END, -1, COMPUTER_TAB, true, "Decrease Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PAGEUP, -1, COMPUTER_TAB, true, "Increase Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, true, "Decrease Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, true, "Equalize Energy Settings", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_INSERT, -1, COMPUTER_TAB, true, "Increase Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_DELETE, -1, COMPUTER_TAB, true, "Decrease Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_HOME, -1, COMPUTER_TAB, true, "Increase Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_END, -1, COMPUTER_TAB, true, "Decrease Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAGEUP, -1, COMPUTER_TAB, true, "Increase Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, true, "Decrease Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, true, "Equalize Energy Settings", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
{ KEY_Q, 7, COMPUTER_TAB, true, "Equalize Shields", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_UP, -1, COMPUTER_TAB, true, "Augment Forward Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_DOWN, -1, COMPUTER_TAB, true, "Augment Rear Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_LEFT, -1, COMPUTER_TAB, true, "Augment Left Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_RIGHT, -1, COMPUTER_TAB, true, "Augment Right Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Laser->Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Shield->Laser", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_Q, 7, COMPUTER_TAB, true, "Equalize Shields", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_UP, -1, COMPUTER_TAB, true, "Augment Forward Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_DOWN, -1, COMPUTER_TAB, true, "Augment Rear Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_LEFT, -1, COMPUTER_TAB, true, "Augment Left Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_RIGHT, -1, COMPUTER_TAB, true, "Augment Right Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Laser->Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Shield->Laser", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
// { -1, -1, -1, true, "Show Damage Popup Window" },
|
||||
|
||||
{ -1, -1, SHIP_TAB, false, "Glide When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, -1, SHIP_TAB, false, "Glide When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
//Backslash -- this was a convenient place for Glide When Pressed, as Show Damage Popup isn't used
|
||||
{ -1, -1, SHIP_TAB, true, "Bank When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, -1, -1, true, "Show Nav Map", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, true, "Add or Remove Escort", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Clear Escort List", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_E, -1, TARGET_TAB, true, "Target Next Escort Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, true, "Target Closest Repair Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ -1, -1, SHIP_TAB, true, "Bank When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, -1, true, "Show Nav Map", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, true, "Add or Remove Escort", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Clear Escort List", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_E, -1, TARGET_TAB, true, "Target Next Escort Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, true, "Target Closest Repair Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
{ KEY_U, -1, TARGET_TAB, true, "Target Next Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, true, "Target Previous Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_N, -1, TARGET_TAB, true, "Target Newest Ship in Area", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_K, -1, TARGET_TAB, true, "Target Next Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, true, "Target Previous Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_U, -1, TARGET_TAB, true, "Target Next Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, true, "Target Previous Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_N, -1, TARGET_TAB, true, "Target Newest Ship in Area", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_K, -1, TARGET_TAB, true, "Target Next Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, true, "Target Previous Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
{ KEY_B, -1, TARGET_TAB, true, "Target Next Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_B, -1, TARGET_TAB, true, "Target Next Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
// multiplayer messaging keys
|
||||
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, true, "(Multiplayer) Observer Zoom to Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, true, "Increase Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, true, "Decrease Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_L, -1, COMPUTER_TAB, true, "Toggle High HUD Contrast", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, true, "(Multiplayer) Toggle Network Info", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, true, "(Multiplayer) Self Destruct", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, true, "(Multiplayer) Observer Zoom to Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, true, "Increase Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, true, "Decrease Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_L, -1, COMPUTER_TAB, true, "Toggle High HUD Contrast", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, true, "(Multiplayer) Toggle Network Info", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, true, "(Multiplayer) Self Destruct", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
|
||||
// Misc
|
||||
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, true, "Toggle HUD", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, true, "Right Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, true, "Left Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, true, "Up Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, true, "Down Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, true, "Toggle HUD Wireframe Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ -1, -1, COMPUTER_TAB, false, "Top-Down View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ -1, -1, COMPUTER_TAB, false, "Target Padlock View", CC_TYPE_TRIGGER, -1, -1, 0, false, false }, // (Swifty) Toggle for VM_TRACK
|
||||
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, true, "Toggle HUD", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, true, "Right Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, true, "Left Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, true, "Up Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, true, "Down Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, true, "Toggle HUD Wireframe Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, COMPUTER_TAB, false, "Top-Down View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, COMPUTER_TAB, false, "Target Padlock View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL }, // (Swifty) Toggle for VM_TRACK
|
||||
// Auto Navigation Systen
|
||||
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, false, "Toggle Auto Pilot", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, false, "Cycle Nav Points", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_G, -1, SHIP_TAB, false, "Toggle Gliding", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_O, -1, WEAPON_TAB, false, "Cycle Primary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, false, "Toggle Auto Pilot", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, false, "Cycle Nav Points", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_G, -1, SHIP_TAB, false, "Toggle Gliding", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_O, -1, WEAPON_TAB, false, "Cycle Primary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, -1, false, "", CC_TYPE_TRIGGER, -1, -1, 0, false, false }
|
||||
};
|
||||
|
||||
@@ -592,6 +592,9 @@ void control_config_common_init()
|
||||
for (int i=0; i<CCFG_MAX; i++) {
|
||||
Control_config[i].disabled = false;
|
||||
Control_config[i].continuous_ongoing = false;
|
||||
|
||||
// init the overridable description with a copy of the default
|
||||
Control_config[i].text = strdup(Control_config[i].default_text);
|
||||
}
|
||||
|
||||
control_config_common_load_overrides();
|
||||
@@ -610,16 +613,6 @@ void control_config_common_init()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief close any common control config stuff, called at game_shutdown()
|
||||
*/
|
||||
void control_config_common_close()
|
||||
{
|
||||
// only need to worry control presets for now
|
||||
for (auto ii = Control_config_presets.cbegin(); ii != Control_config_presets.cend(); ++ii) {
|
||||
delete * ii;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include <map>
|
||||
@@ -841,7 +834,7 @@ void control_config_common_load_overrides()
|
||||
for (size_t i = 0; i < cCntrlAryLength; ++i) {
|
||||
config_item& r_ccConfig = cfg_preset[i];
|
||||
|
||||
if (!strcmp(szTempBuffer, r_ccConfig.text)) {
|
||||
if (!strcmp(szTempBuffer, r_ccConfig.default_text)) {
|
||||
/**
|
||||
* short key_default;
|
||||
* short joy_default;
|
||||
@@ -852,6 +845,11 @@ void control_config_common_load_overrides()
|
||||
|
||||
int iTemp;
|
||||
|
||||
if (optional_string("$New Name:")) {
|
||||
stuff_string(szTempBuffer, F_NAME, iBufferLength);
|
||||
r_ccConfig.text = strdup(szTempBuffer);
|
||||
}
|
||||
|
||||
if (optional_string("$Key Default:")) {
|
||||
if (optional_string("NONE")) {
|
||||
r_ccConfig.key_default = (short)-1;
|
||||
@@ -899,9 +897,6 @@ void control_config_common_load_overrides()
|
||||
if (optional_string("+Disable")) {
|
||||
r_ccConfig.disabled = true;
|
||||
}
|
||||
if (optional_string("$Disable:")) {
|
||||
stuff_boolean(&r_ccConfig.disabled);
|
||||
}
|
||||
|
||||
// Nerf the buffer now.
|
||||
szTempBuffer[0] = '\0';
|
||||
|
||||
+60
-62
@@ -10,17 +10,17 @@
|
||||
|
||||
|
||||
#include "cutscene/cutscenes.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "io/key.h"
|
||||
#include "localization/localize.h"
|
||||
#include "menuui/mainhallmenu.h"
|
||||
#include "movie.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "popup/popup.h"
|
||||
#include "ui/ui.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "io/key.h"
|
||||
#include "movie.h"
|
||||
#include "popup/popup.h"
|
||||
#include "menuui/mainhallmenu.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "localization/localize.h"
|
||||
#include "parse/parselo.h"
|
||||
|
||||
|
||||
extern int Cmdline_nomovies;
|
||||
@@ -52,61 +52,59 @@ void cutscene_init()
|
||||
{
|
||||
atexit(cutscene_close);
|
||||
char buf[MULTITEXT_LENGTH];
|
||||
cutscene_info cutinfo;
|
||||
int rval;
|
||||
cutscene_info cutinfo;
|
||||
|
||||
try
|
||||
{
|
||||
read_file_text("cutscenes.tbl", CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// parse in all the cutscenes
|
||||
Cutscenes.clear();
|
||||
skip_to_string("#Cutscenes");
|
||||
ignore_white_space();
|
||||
|
||||
bool isFirstCutscene = true;
|
||||
|
||||
while (required_string_either("#End", "$Filename:"))
|
||||
{
|
||||
required_string("$Filename:");
|
||||
stuff_string(cutinfo.filename, F_PATHNAME, MAX_FILENAME_LEN);
|
||||
|
||||
required_string("$Name:");
|
||||
stuff_string(cutinfo.name, F_NAME, NAME_LENGTH);
|
||||
|
||||
required_string("$Description:");
|
||||
stuff_string(buf, F_MULTITEXT, sizeof(buf));
|
||||
drop_white_space(buf);
|
||||
compact_multitext_string(buf);
|
||||
cutinfo.description = vm_strdup(buf);
|
||||
|
||||
if (optional_string("$cd:"))
|
||||
stuff_int(&cutinfo.cd);
|
||||
else
|
||||
cutinfo.cd = 0;
|
||||
|
||||
cutinfo.viewable = false;
|
||||
|
||||
if (isFirstCutscene) {
|
||||
isFirstCutscene = false;
|
||||
// The original code assumes the first movie is the intro, so always viewable
|
||||
cutinfo.viewable = true;
|
||||
}
|
||||
|
||||
if (optional_string("$Always Viewable:")) {
|
||||
stuff_boolean(&cutinfo.viewable);
|
||||
}
|
||||
|
||||
Cutscenes.push_back(cutinfo);
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "cutscenes.tbl", e.what()));
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "cutscenes.tbl", rval));
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text("cutscenes.tbl", CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// parse in all the cutscenes
|
||||
Cutscenes.clear();
|
||||
skip_to_string("#Cutscenes");
|
||||
ignore_white_space();
|
||||
|
||||
bool isFirstCutscene = true;
|
||||
|
||||
while ( required_string_either("#End", "$Filename:") )
|
||||
{
|
||||
required_string("$Filename:");
|
||||
stuff_string( cutinfo.filename, F_PATHNAME, MAX_FILENAME_LEN );
|
||||
|
||||
required_string("$Name:");
|
||||
stuff_string( cutinfo.name, F_NAME, NAME_LENGTH );
|
||||
|
||||
required_string("$Description:");
|
||||
stuff_string(buf, F_MULTITEXT, sizeof(buf));
|
||||
drop_white_space(buf);
|
||||
compact_multitext_string(buf);
|
||||
cutinfo.description = vm_strdup(buf);
|
||||
|
||||
if (optional_string("$cd:"))
|
||||
stuff_int( &cutinfo.cd );
|
||||
else
|
||||
cutinfo.cd = 0;
|
||||
|
||||
cutinfo.viewable = false;
|
||||
|
||||
if (isFirstCutscene) {
|
||||
isFirstCutscene = false;
|
||||
// The original code assumes the first movie is the intro, so always viewable
|
||||
cutinfo.viewable = true;
|
||||
}
|
||||
|
||||
if (optional_string("$Always Viewable:")) {
|
||||
stuff_boolean(&cutinfo.viewable);
|
||||
}
|
||||
|
||||
Cutscenes.push_back(cutinfo);
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
}
|
||||
|
||||
// function to return 0 based index of which CD a particular movie is on
|
||||
|
||||
@@ -15,7 +15,7 @@ static void genLoopkupTable();
|
||||
|
||||
void decodeFrame16(ubyte *pFrame, ubyte *pMap, int mapRemain, unsigned char *pData, int dataRemain)
|
||||
{
|
||||
ubyte *pOrig, *pOffData, op;
|
||||
ubyte *pOrig, *pOffData, *pEnd, op;
|
||||
ushort offset;
|
||||
int length = 0, i, j, xb, yb;
|
||||
|
||||
@@ -32,6 +32,7 @@ void decodeFrame16(ubyte *pFrame, ubyte *pMap, int mapRemain, unsigned char *pDa
|
||||
offset = pData[0]|(pData[1]<<8);
|
||||
|
||||
pOffData = pData + offset;
|
||||
pEnd = pData + offset;
|
||||
|
||||
pData += 2;
|
||||
|
||||
@@ -54,8 +55,7 @@ void decodeFrame16(ubyte *pFrame, ubyte *pMap, int mapRemain, unsigned char *pDa
|
||||
}
|
||||
|
||||
if ((length-(pData-pOrig)) != 0) {
|
||||
nprintf(("MVE", "DEBUG: junk left over: " PTRDIFF_T_ARG ",%d," PTRDIFF_T_ARG "\n",
|
||||
(pData-pOrig), length, (length-(pData-pOrig))));
|
||||
nprintf(("MVE", "DEBUG: junk left over: %d,%d,%d\n", (pData-pOrig), length, (length-(pData-pOrig))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,15 +13,15 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "cfile/cfile.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "cutscene/cutscenes.h" // cutscene_mark_viewable()
|
||||
#include "graphics/2d.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "cutscene/movie.h"
|
||||
#include "osapi/osapi.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "cutscene/cutscenes.h" // cutscene_mark_viewable()
|
||||
#include "cutscene/mvelib.h"
|
||||
#include "cutscene/oggplayer.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "osapi/osapi.h"
|
||||
|
||||
extern int Game_mode;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
|
||||
#include "cfile/cfile.h"
|
||||
#include "cutscene/mvelib.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cutscene/mvelib.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
|
||||
static const char MVE_HEADER[] = "Interplay MVE File\x1A";
|
||||
|
||||
+42
-23
@@ -6,21 +6,21 @@
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "cutscene/movie.h"
|
||||
#include "cutscene/mvelib.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropengldraw.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropenglstate.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cutscene/mvelib.h"
|
||||
#include "cutscene/movie.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "io/key.h"
|
||||
#include "io/timer.h"
|
||||
#include "osapi/osapi.h"
|
||||
#include "sound/openal.h"
|
||||
#include "io/timer.h"
|
||||
#include "sound/sound.h"
|
||||
#include "sound/openal.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
|
||||
|
||||
extern int Cmdline_noscalevid;
|
||||
@@ -228,7 +228,7 @@ void mve_audio_createbuf(ubyte minor, ubyte *data)
|
||||
return;
|
||||
}
|
||||
|
||||
int flags, sample_rate;
|
||||
int flags, desired_buffer, sample_rate;
|
||||
|
||||
mas = (mve_audio_t *) vm_malloc ( sizeof(mve_audio_t) );
|
||||
memset(mas, 0, sizeof(mve_audio_t));
|
||||
@@ -237,6 +237,7 @@ void mve_audio_createbuf(ubyte minor, ubyte *data)
|
||||
|
||||
flags = mve_get_ushort(data + 2);
|
||||
sample_rate = mve_get_ushort(data + 4);
|
||||
desired_buffer = mve_get_int(data + 6);
|
||||
|
||||
mas->channels = (flags & 0x0001) ? 2 : 1;
|
||||
mas->bitsize = (flags & 0x0002) ? 16 : 8;
|
||||
@@ -418,10 +419,16 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
}
|
||||
|
||||
short w, h;
|
||||
short truecolor;
|
||||
short count, truecolor;
|
||||
w = mve_get_short(data);
|
||||
h = mve_get_short(data+2);
|
||||
|
||||
if (minor > 0) {
|
||||
count = mve_get_short(data+4);
|
||||
} else {
|
||||
count = 1;
|
||||
}
|
||||
|
||||
if (minor > 1) {
|
||||
truecolor = mve_get_short(data+6);
|
||||
} else {
|
||||
@@ -452,13 +459,13 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
GLfloat scale_by = 1.0f;
|
||||
|
||||
float screen_ratio = (float)gr_screen.center_w / (float)gr_screen.center_h;
|
||||
float screen_ratio = (float)gr_screen.max_w / (float)gr_screen.max_h;
|
||||
float movie_ratio = (float)g_width / (float)g_height;
|
||||
|
||||
if (screen_ratio > movie_ratio) {
|
||||
scale_by = (float)gr_screen.center_h / (float)g_height;
|
||||
scale_by = (float)gr_screen.max_h / (float)g_height;
|
||||
} else {
|
||||
scale_by = (float)gr_screen.center_w / (float)g_width;
|
||||
scale_by = (float)gr_screen.max_w / (float)g_width;
|
||||
}
|
||||
|
||||
// don't bother setting anything if we aren't going to need it
|
||||
@@ -472,12 +479,12 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
}
|
||||
|
||||
if (mve_scale_video) {
|
||||
g_screenX = ((ceil((gr_screen.center_w / scale_by) - 0.5f) - g_width) / 2) + ceil((gr_screen.center_offset_x / scale_by) - 0.5f);
|
||||
g_screenY = ((ceil((gr_screen.center_h / scale_by) - 0.5f) - g_height) / 2) + ceil((gr_screen.center_offset_y / scale_by) - 0.5f);
|
||||
g_screenX = ((ceil((gr_screen.max_w / scale_by) - 0.5f) - g_width) / 2);
|
||||
g_screenY = ((ceil((gr_screen.max_h / scale_by) - 0.5f) - g_height) / 2);
|
||||
} else {
|
||||
// centers on 1024x768, fills on 640x480
|
||||
g_screenX = ((float)(gr_screen.center_w - g_width) / 2.0f) + gr_screen.center_offset_x;
|
||||
g_screenY = ((float)(gr_screen.center_h - g_height) / 2.0f) + gr_screen.center_offset_y;
|
||||
g_screenX = ((float)(gr_screen.max_w - g_width) / 2.0f);
|
||||
g_screenY = ((float)(gr_screen.max_h - g_height) / 2.0f);
|
||||
}
|
||||
|
||||
// set additional values for screen width/height and UV coords
|
||||
@@ -511,12 +518,12 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
|
||||
GL_state.Array.BindArrayBuffer(0);
|
||||
|
||||
vertex_layout vertex_def;
|
||||
GL_state.Array.EnableClientVertex();
|
||||
GL_state.Array.VertexPointer(2, GL_FLOAT, sizeof(glVertices[0]), glVertices);
|
||||
|
||||
vertex_def.add_vertex_component(vertex_format_data::POSITION2, sizeof(glVertices[0]), glVertices);
|
||||
vertex_def.add_vertex_component(vertex_format_data::TEX_COORD, sizeof(glVertices[0]), &(glVertices[0][2]));
|
||||
|
||||
opengl_bind_vertex_layout(vertex_def);
|
||||
GL_state.Array.SetActiveClientUnit(0);
|
||||
GL_state.Array.EnableClientTexture();
|
||||
GL_state.Array.TexPointer(2, GL_FLOAT, sizeof(glVertices[0]), &(glVertices[0][2]));
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -718,9 +725,18 @@ void mve_video_codemap(ubyte *data, int len)
|
||||
|
||||
void mve_video_data(ubyte *data, int len)
|
||||
{
|
||||
short nFrameHot, nFrameCold;
|
||||
short nXoffset, nYoffset;
|
||||
short nXsize, nYsize;
|
||||
ushort nFlags;
|
||||
ubyte *temp;
|
||||
|
||||
nFrameHot = mve_get_short(data);
|
||||
nFrameCold = mve_get_short(data+2);
|
||||
nXoffset = mve_get_short(data+4);
|
||||
nYoffset = mve_get_short(data+6);
|
||||
nXsize = mve_get_short(data+8);
|
||||
nYsize = mve_get_short(data+10);
|
||||
nFlags = mve_get_ushort(data+12);
|
||||
|
||||
if (nFlags & 1) {
|
||||
@@ -781,6 +797,9 @@ void mve_play(MVESTREAM *mve)
|
||||
void mve_shutdown()
|
||||
{
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
GL_state.Array.DisableClientVertex();
|
||||
GL_state.Array.DisableClientTexture();
|
||||
|
||||
if (mve_scale_video) {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
+74
-29
@@ -9,23 +9,22 @@
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "cutscene/oggplayer.h"
|
||||
#include "globalincs/def_files.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "globalincs/def_files.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropengldraw.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropenglshader.h"
|
||||
#include "graphics/gropenglstate.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "io/key.h"
|
||||
#include "io/timer.h"
|
||||
#include "osapi/osapi.h"
|
||||
#include "sound/openal.h"
|
||||
#include "sound/sound.h"
|
||||
#include "sound/openal.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "cutscene/oggplayer.h"
|
||||
#include "io/timer.h"
|
||||
|
||||
#include "theora/theora.h"
|
||||
#include "vorbis/codec.h"
|
||||
@@ -332,6 +331,8 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
{
|
||||
float scale_by = 0.0f;
|
||||
|
||||
GLhandleARB shader_id = 0;
|
||||
|
||||
if (video_inited)
|
||||
return;
|
||||
|
||||
@@ -364,11 +365,52 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
return;
|
||||
}
|
||||
|
||||
int sdr_handle = gr_maybe_create_shader(SDR_TYPE_VIDEO_PROCESS, 0);
|
||||
char *vert = NULL, *frag = NULL;
|
||||
opengl_shader_t new_shader;
|
||||
|
||||
// choose appropriate files
|
||||
char *vert_name = "video-v.sdr";
|
||||
char *frag_name = "video-f.sdr";
|
||||
|
||||
if ( sdr_handle >= 0)
|
||||
opengl_shader_set_current(sdr_handle);
|
||||
else
|
||||
mprintf(("Compiling video-processing shader ... \n"));
|
||||
|
||||
// read vertex shader
|
||||
CFILE *cf_shader = cfopen(vert_name, "rt", CFILE_NORMAL, CF_TYPE_EFFECTS);
|
||||
|
||||
if (cf_shader != NULL) {
|
||||
int len = cfilelength(cf_shader);
|
||||
vert = (char*) vm_malloc(len + 1);
|
||||
cfread(vert, len + 1, 1, cf_shader);
|
||||
cfclose(cf_shader);
|
||||
} else {
|
||||
mprintf((" Loading built-in default shader for: %s\n", vert_name));
|
||||
vert = defaults_get_file(vert_name);
|
||||
}
|
||||
|
||||
if(!vert)
|
||||
use_shaders = false;
|
||||
|
||||
// read fragment shader
|
||||
cf_shader = cfopen(frag_name, "rt", CFILE_NORMAL, CF_TYPE_EFFECTS);
|
||||
|
||||
if (cf_shader != NULL) {
|
||||
int len = cfilelength(cf_shader);
|
||||
frag = (char*) vm_malloc(len + 1);
|
||||
cfread(frag, len + 1, 1, cf_shader);
|
||||
cfclose(cf_shader);
|
||||
} else {
|
||||
mprintf((" Loading built-in default shader for: %s\n", frag_name));
|
||||
frag = defaults_get_file(frag_name);
|
||||
}
|
||||
|
||||
if(!vert)
|
||||
use_shaders = false;
|
||||
Verify( vert != NULL );
|
||||
Verify( frag != NULL );
|
||||
|
||||
shader_id = opengl_shader_create(vert, frag);
|
||||
vglUseProgramObjectARB(shader_id);
|
||||
if (!shader_id)
|
||||
use_shaders = false;
|
||||
}
|
||||
|
||||
@@ -435,13 +477,13 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
|
||||
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_LUMINANCE8, 1024, 1024, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
float screen_ratio = (float)gr_screen.center_w / (float)gr_screen.center_h;
|
||||
float screen_ratio = (float)gr_screen.max_w / (float)gr_screen.max_h;
|
||||
float movie_ratio = (float)g_screenWidth / (float)g_screenHeight;
|
||||
|
||||
if (screen_ratio > movie_ratio)
|
||||
scale_by = (float)gr_screen.center_h / (float)g_screenHeight;
|
||||
scale_by = (float)gr_screen.max_h / (float)g_screenHeight;
|
||||
else
|
||||
scale_by = (float)gr_screen.center_w / (float)g_screenWidth;
|
||||
scale_by = (float)gr_screen.max_w / (float)g_screenWidth;
|
||||
|
||||
// don't bother setting anything if we aren't going to need it
|
||||
if (!Cmdline_noscalevid && (scale_by != 1.0f)) {
|
||||
@@ -470,12 +512,12 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
|
||||
|
||||
if (scale_video) {
|
||||
g_screenX = ((fl2i(gr_screen.center_w / scale_by + 0.5f) - g_screenWidth) / 2) + fl2i(gr_screen.center_offset_x / scale_by + 0.5f);
|
||||
g_screenY = ((fl2i(gr_screen.center_h / scale_by + 0.5f) - g_screenHeight) / 2) + fl2i(gr_screen.center_offset_y / scale_by + 0.5f);
|
||||
g_screenX = ((fl2i(gr_screen.max_w / scale_by + 0.5f) - g_screenWidth) / 2);
|
||||
g_screenY = ((fl2i(gr_screen.max_h / scale_by + 0.5f) - g_screenHeight) / 2);
|
||||
} else {
|
||||
// centers on 1024x768, fills on 640x480
|
||||
g_screenX = ((gr_screen.center_w - g_screenWidth) / 2) + gr_screen.center_offset_x;
|
||||
g_screenY = ((gr_screen.center_h - g_screenHeight) / 2) + gr_screen.center_offset_y;
|
||||
g_screenX = ((gr_screen.max_w - g_screenWidth) / 2);
|
||||
g_screenY = ((gr_screen.max_h - g_screenHeight) / 2);
|
||||
}
|
||||
|
||||
// set additional values for screen width/height and UV coords
|
||||
@@ -490,9 +532,9 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
gl_screenU = i2fl(tinfo->frame_width-1) / i2fl(2048) ;
|
||||
gl_screenV = i2fl(tinfo->frame_height-1) / i2fl(2048);
|
||||
GL_state.Texture.SetShaderMode(GL_TRUE);
|
||||
GL_state.Uniform.setUniformi("ytex", 0);
|
||||
GL_state.Uniform.setUniformi("utex", 1);
|
||||
GL_state.Uniform.setUniformi("vtex", 2);
|
||||
vglUniform1iARB( vglGetUniformLocationARB(shader_id, "ytex"), 0 );
|
||||
vglUniform1iARB( vglGetUniformLocationARB(shader_id, "utex"), 1 );
|
||||
vglUniform1iARB( vglGetUniformLocationARB(shader_id, "vtex"), 2 );
|
||||
}
|
||||
|
||||
glVertices[0][0] = (GLfloat)g_screenX;
|
||||
@@ -517,12 +559,12 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
|
||||
GL_state.Array.BindArrayBuffer(0);
|
||||
|
||||
vertex_layout vert_def;
|
||||
GL_state.Array.EnableClientVertex();
|
||||
GL_state.Array.VertexPointer(2, GL_FLOAT, sizeof(glVertices[0]), glVertices);
|
||||
|
||||
vert_def.add_vertex_component(vertex_format_data::POSITION2, sizeof(glVertices[0]), glVertices);
|
||||
vert_def.add_vertex_component(vertex_format_data::TEX_COORD, sizeof(glVertices[0]), &(glVertices[0][2]));
|
||||
|
||||
opengl_bind_vertex_layout(vert_def);
|
||||
GL_state.Array.SetActiveClientUnit(0);
|
||||
GL_state.Array.EnableClientTexture();
|
||||
GL_state.Array.TexPointer(2, GL_FLOAT, sizeof(glVertices[0]), &(glVertices[0][2]));
|
||||
}
|
||||
if(!use_shaders && tinfo->frame_height > 450) {
|
||||
mprintf(("VIDEO: No shader support and hd video is beeing played this can get choppy."));
|
||||
@@ -537,6 +579,9 @@ static void OGG_video_close()
|
||||
}
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
GL_state.Array.DisableClientVertex();
|
||||
GL_state.Array.DisableClientTexture();
|
||||
|
||||
if (scale_video) {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
@@ -559,7 +604,7 @@ static void OGG_video_close()
|
||||
ytex = utex = vtex = 0;
|
||||
GLtex = 0;
|
||||
GL_state.Texture.SetShaderMode(GL_FALSE);
|
||||
opengl_shader_set_current();
|
||||
opengl_shader_set_current( 0 );
|
||||
}
|
||||
|
||||
if (pixelbuf != NULL) {
|
||||
|
||||
@@ -36,7 +36,7 @@ int dds_read_header(const char *filename, CFILE *img_cfp, int *width, int *heigh
|
||||
int retval = DDS_ERROR_NONE;
|
||||
int ct = DDS_UNCOMPRESSED;
|
||||
int bits = 0;
|
||||
int i, is_cubemap = 0;
|
||||
int i, trash, is_cubemap = 0;
|
||||
int d_width = 0, d_height = 0, d_depth = 0, d_size = 0;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ int dds_read_header(const char *filename, CFILE *img_cfp, int *width, int *heigh
|
||||
|
||||
// skip over the crap we don't care about
|
||||
for (i = 0; i < 11; i++)
|
||||
cfread_uint(ddsfile);
|
||||
trash = cfread_uint(ddsfile);
|
||||
|
||||
dds_header.ddpfPixelFormat.dwSize = cfread_uint(ddsfile);
|
||||
dds_header.ddpfPixelFormat.dwFlags = cfread_uint(ddsfile);
|
||||
|
||||
+29
-85
@@ -9,26 +9,26 @@
|
||||
|
||||
|
||||
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "debris/debris.h"
|
||||
#include "render/3d.h"
|
||||
#include "fireball/fireballs.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "radar/radar.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "object/objectsnd.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "particle/particle.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "object/objcollide.h"
|
||||
#include "io/timer.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "ship/ship.h"
|
||||
#include "ship/shipfx.h"
|
||||
#include "radar/radarsetup.h"
|
||||
#include "network/multi.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "object/objcollide.h"
|
||||
#include "object/objectsnd.h"
|
||||
#include "particle/particle.h"
|
||||
#include "radar/radar.h"
|
||||
#include "radar/radarsetup.h"
|
||||
#include "render/3d.h"
|
||||
#include "ship/ship.h"
|
||||
#include "ship/shipfx.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
#define MAX_LIFE 10.0f
|
||||
#define MIN_RADIUS_FOR_PERSISTANT_DEBRIS 50 // ship radius at which debris from it becomes persistant
|
||||
@@ -147,7 +147,7 @@ MONITOR(NumHullDebrisRend)
|
||||
/**
|
||||
* Render debris
|
||||
*/
|
||||
void debris_render_DEPRECATED(object * obj)
|
||||
void debris_render(object * obj)
|
||||
{
|
||||
int i, num, swapped;
|
||||
polymodel *pm;
|
||||
@@ -191,10 +191,10 @@ void debris_render_DEPRECATED(object * obj)
|
||||
|
||||
if ( db->is_hull ) {
|
||||
MONITOR_INC(NumHullDebrisRend,1);
|
||||
submodel_render_DEPRECATED( db->model_num, db->submodel_num, &obj->orient, &obj->pos );
|
||||
submodel_render( db->model_num, db->submodel_num, &obj->orient, &obj->pos );
|
||||
} else {
|
||||
MONITOR_INC(NumSmallDebrisRend,1);
|
||||
submodel_render_DEPRECATED( db->model_num, db->submodel_num, &obj->orient, &obj->pos, MR_NO_LIGHTING );
|
||||
submodel_render( db->model_num, db->submodel_num, &obj->orient, &obj->pos, MR_NO_LIGHTING );
|
||||
}
|
||||
|
||||
if (tbase != NULL && (swapped!=-1) && pm) {
|
||||
@@ -843,18 +843,18 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
}
|
||||
|
||||
// debris ship collision -- use debris_hit_info to calculate physics
|
||||
object *pship_obj = other_obj;
|
||||
Assert( pship_obj->type == OBJ_SHIP );
|
||||
object *ship_obj = other_obj;
|
||||
Assert( ship_obj->type == OBJ_SHIP );
|
||||
|
||||
object *heavy = debris_hit_info->heavy;
|
||||
object *lighter = debris_hit_info->light;
|
||||
object *light = debris_hit_info->light;
|
||||
object *heavy_obj = heavy;
|
||||
object *light_obj = lighter;
|
||||
object *light_obj = light;
|
||||
|
||||
vec3d zero, p0, p1;
|
||||
vm_vec_zero(&zero);
|
||||
vm_vec_sub(&p0, &lighter->last_pos, &heavy->last_pos);
|
||||
vm_vec_sub(&p1, &lighter->pos, &heavy->pos);
|
||||
vm_vec_sub(&p0, &light->last_pos, &heavy->last_pos);
|
||||
vm_vec_sub(&p1, &light->pos, &heavy->pos);
|
||||
|
||||
mc.pos = &zero; // The object's position
|
||||
mc.p0 = &p0; // Point 1 of ray to check
|
||||
@@ -875,15 +875,15 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
vm_vec_scale(&debris_hit_info->light_rel_vel, 1/flFrametime);
|
||||
} else {
|
||||
debris_hit_info->collide_rotate = 0;
|
||||
vm_vec_sub(&debris_hit_info->light_rel_vel, &lighter->phys_info.vel, &heavy->phys_info.vel);
|
||||
vm_vec_sub(&debris_hit_info->light_rel_vel, &light->phys_info.vel, &heavy->phys_info.vel);
|
||||
}
|
||||
|
||||
int mc_ret_val = 0;
|
||||
|
||||
if ( debris_hit_info->heavy == pship_obj ) { // ship is heavier, so debris is sphere. Check sphere collision against ship poly model
|
||||
mc.model_instance_num = Ships[pship_obj->instance].model_instance_num;
|
||||
mc.model_num = Ship_info[Ships[pship_obj->instance].ship_info_index].model_num; // Fill in the model to check
|
||||
mc.orient = &pship_obj->orient; // The object's orient
|
||||
if ( debris_hit_info->heavy == ship_obj ) { // ship is heavier, so debris is sphere. Check sphere collision against ship poly model
|
||||
mc.model_instance_num = Ships[ship_obj->instance].model_instance_num;
|
||||
mc.model_num = Ship_info[Ships[ship_obj->instance].ship_info_index].model_num; // Fill in the model to check
|
||||
mc.orient = &ship_obj->orient; // The object's orient
|
||||
mc.radius = pdebris->radius;
|
||||
mc.flags = (MC_CHECK_MODEL | MC_CHECK_SPHERELINE);
|
||||
|
||||
@@ -900,7 +900,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
polymodel *pm;
|
||||
polymodel_instance *pmi;
|
||||
|
||||
ship_model_start(pship_obj);
|
||||
ship_model_start(ship_obj);
|
||||
|
||||
if (model_collide(&mc)) {
|
||||
|
||||
@@ -926,8 +926,8 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
// reset flags to check MC_CHECK_MODEL | MC_CHECK_SPHERELINE and maybe MC_CHECK_INVISIBLE_FACES and MC_SUBMODEL_INSTANCE
|
||||
mc.flags = copy_flags | MC_SUBMODEL_INSTANCE;
|
||||
|
||||
if (Ship_info[Ships[pship_obj->instance].ship_info_index].collision_lod > -1) {
|
||||
mc.lod = Ship_info[Ships[pship_obj->instance].ship_info_index].collision_lod;
|
||||
if (Ship_info[Ships[ship_obj->instance].ship_info_index].collision_lod > -1) {
|
||||
mc.lod = Ship_info[Ships[ship_obj->instance].ship_info_index].collision_lod;
|
||||
}
|
||||
|
||||
// check each submodel in turn
|
||||
@@ -1011,7 +1011,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
mc.submodel_num = Debris[num].submodel_num;
|
||||
model_clear_instance( mc.model_num );
|
||||
mc.orient = &pdebris->orient; // The object's orient
|
||||
mc.radius = model_get_core_radius(Ship_info[Ships[pship_obj->instance].ship_info_index].model_num);
|
||||
mc.radius = model_get_core_radius(Ship_info[Ships[ship_obj->instance].ship_info_index].model_num);
|
||||
|
||||
// check for collision between debris model and ship sphere
|
||||
mc.flags = (MC_CHECK_MODEL | MC_SUBMODEL | MC_CHECK_SPHERELINE);
|
||||
@@ -1098,59 +1098,3 @@ void calc_debris_physics_properties( physics_info *pi, vec3d *mins, vec3d *maxs
|
||||
pi->I_body_inv.vec.fvec.xyz.y = 0.0f;
|
||||
pi->I_body_inv.vec.fvec.xyz.z = 12.0f / (pi->mass * (dx*dx + dy*dy));
|
||||
}
|
||||
|
||||
void debris_render(object * obj, draw_list *scene)
|
||||
{
|
||||
int i, num, swapped;
|
||||
polymodel *pm;
|
||||
debris *db;
|
||||
|
||||
|
||||
swapped = -1;
|
||||
pm = NULL;
|
||||
num = obj->instance;
|
||||
|
||||
Assert(num >= 0 && num < MAX_DEBRIS_PIECES);
|
||||
db = &Debris[num];
|
||||
|
||||
Assert(db->flags & DEBRIS_USED);
|
||||
|
||||
texture_info *tbase = NULL;
|
||||
|
||||
model_clear_instance( db->model_num );
|
||||
|
||||
// Swap in a different texture depending on the species
|
||||
if (db->species >= 0)
|
||||
{
|
||||
pm = model_get( db->model_num );
|
||||
|
||||
//WMC - Someday, we should have glowing debris.
|
||||
if ( pm != NULL && (pm->n_textures == 1) ) {
|
||||
tbase = &pm->maps[0].textures[TM_BASE_TYPE];
|
||||
swapped = tbase->GetTexture();
|
||||
tbase->SetTexture(Species_info[db->species].debris_texture.bitmap_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Only render electrical arcs if within 500m of the eye (for a 10m piece)
|
||||
if ( vm_vec_dist_quick( &obj->pos, &Eye_position ) < obj->radius*50.0f ) {
|
||||
for (i=0; i<MAX_DEBRIS_ARCS; i++ ) {
|
||||
if ( timestamp_valid( db->arc_timestamp[i] ) ) {
|
||||
model_add_arc( db->model_num, db->submodel_num, &db->arc_pts[i][0], &db->arc_pts[i][1], MARC_TYPE_NORMAL );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model_render_params render_info;
|
||||
|
||||
if ( !db->is_hull ) {
|
||||
render_info.set_flags(MR_NO_LIGHTING);
|
||||
}
|
||||
|
||||
MONITOR_INC(NumHullDebrisRend,1);
|
||||
submodel_render_queue( &render_info, scene, db->model_num, db->submodel_num, &obj->orient, &obj->pos );
|
||||
|
||||
if (tbase != NULL && (swapped!=-1) && pm) {
|
||||
tbase->SetTexture(swapped);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
class object;
|
||||
struct CFILE;
|
||||
class draw_list;
|
||||
|
||||
#define MAX_DEBRIS_ARCS 8 // Must be less than MAX_ARC_EFFECTS in model.h
|
||||
|
||||
@@ -62,8 +61,7 @@ extern int Num_debris_pieces;
|
||||
struct collision_info_struct;
|
||||
|
||||
void debris_init();
|
||||
void debris_render_DEPRECATED( object * obj );
|
||||
void debris_render(object * obj, draw_list *scene);
|
||||
void debris_render( object * obj );
|
||||
void debris_delete( object * obj );
|
||||
void debris_process_post( object * obj, float frame_time);
|
||||
object *debris_create( object * source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force );
|
||||
|
||||
@@ -9,12 +9,15 @@
|
||||
|
||||
|
||||
#include "debugconsole/console.h"
|
||||
#include "debugconsole/consoleparse.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/version.h"
|
||||
#include "globalincs/vmallocator.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "graphics/font.h"
|
||||
#include "io/key.h"
|
||||
#include "io/timer.h"
|
||||
#include "io/key.h"
|
||||
#include "osapi/osapi.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -101,8 +104,7 @@ void dc_draw(bool show_prompt);
|
||||
/**
|
||||
* Draws the cursor
|
||||
* @param [in] cmd_string The formatted command string displayed by dc_draw_window
|
||||
* @param [in] x The x screen position of the command string
|
||||
* @param [in] y The y screen position of the command string
|
||||
* @param [in] x y The x and y screen position of the command string
|
||||
*/
|
||||
void dc_draw_cursor( SCP_string &cmd_string, int x, int y );
|
||||
|
||||
@@ -187,7 +189,7 @@ void dc_draw(bool show_prompt = FALSE)
|
||||
gr_clear();
|
||||
gr_set_font(dc_font);
|
||||
gr_set_color_fast( &Color_bright );
|
||||
gr_string( 0x8000, gr_screen.center_offset_y + 3, dc_title.c_str(), GR_RESIZE_NONE );
|
||||
gr_string( 0x8000, 3, dc_title.c_str(), GR_RESIZE_NONE );
|
||||
|
||||
gr_set_color_fast( &Color_normal );
|
||||
|
||||
@@ -207,7 +209,7 @@ void dc_draw_cursor( SCP_string &cmd_string, int x, int y )
|
||||
|
||||
w %= (DCOLS * Current_font->w);
|
||||
//gr_string( w, debug_y*16, "_" );
|
||||
gr_rect(gr_screen.center_offset_x + (x + (w + 1)), gr_screen.center_offset_y + (y + (h + 1)), 2, Current_font->h, GR_RESIZE_NONE);
|
||||
gr_rect((x + (w + 1)), (y + (h + 1)), 2, Current_font->h, GR_RESIZE_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +245,7 @@ void dc_draw_window(bool show_prompt)
|
||||
// Draw the buffer strings
|
||||
for (i = 0; i < buffer_lines; ++i) {
|
||||
if ((i + dc_scroll_y) < dc_buffer.size()) {
|
||||
gr_string(gr_screen.center_offset_x, gr_screen.center_offset_y + ((i * row_height) + row_height), dc_buffer[i + dc_scroll_y].substr(dc_scroll_x).c_str(), GR_RESIZE_NONE);
|
||||
gr_string(0, ((i * row_height) + row_height), dc_buffer[i + dc_scroll_y].substr(dc_scroll_x).c_str(), GR_RESIZE_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +263,7 @@ void dc_draw_window(bool show_prompt)
|
||||
++j;
|
||||
}
|
||||
}
|
||||
gr_string(gr_screen.center_offset_x, gr_screen.center_offset_y + ((i * row_height) + row_height), out_str.c_str(), GR_RESIZE_NONE);
|
||||
gr_string(0, ((i * row_height) + row_height), out_str.c_str(), GR_RESIZE_NONE);
|
||||
|
||||
dc_draw_cursor(out_str, 0, ((i * row_height)));
|
||||
gr_set_color_fast(&Color_normal);
|
||||
@@ -282,8 +284,8 @@ void dc_init(void)
|
||||
col_width = Current_font->w; // Col/Character width, in pixels
|
||||
dc_scroll_x = 0;
|
||||
dc_scroll_y = 0;
|
||||
DCOLS = (gr_screen.center_w / col_width) - 1; // Subtract as needed. Windowed mode has some quirks with the resolution
|
||||
DROWS = (gr_screen.center_h / row_height) - 2;
|
||||
DCOLS = (gr_screen.max_w / col_width) - 1; // Subtract as needed. Windowed mode has some quirks with the resolution
|
||||
DROWS = (gr_screen.max_h / row_height) - 2;
|
||||
DBCOLS = DCOLS;
|
||||
DBROWS = 2 * DROWS;
|
||||
|
||||
@@ -389,7 +391,7 @@ void dc_putc(char c)
|
||||
temp_str.push_back(c);
|
||||
gr_get_string_size(&w, NULL, temp_str.c_str());
|
||||
|
||||
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.center_w)) {
|
||||
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.max_w)) {
|
||||
c = '\n';
|
||||
|
||||
} else {
|
||||
@@ -413,7 +415,7 @@ void dc_putc(char c)
|
||||
temp_str.append(i, ' ');
|
||||
gr_get_string_size(&w, NULL, temp_str.c_str());
|
||||
|
||||
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.center_w)) {
|
||||
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.max_w)) {
|
||||
c = '\n';
|
||||
|
||||
} else {
|
||||
@@ -456,7 +458,7 @@ void dc_putc(char c)
|
||||
temp_str.push_back(c);
|
||||
gr_get_string_size(&w, NULL, temp_str.c_str());
|
||||
|
||||
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.center_w)) {
|
||||
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.max_w)) {
|
||||
/**
|
||||
* Word wrapping
|
||||
* Save the word, clear the line of the word, push new line with the word on it
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "debugconsole/console.h"
|
||||
#include "debugconsole/consoleparse.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/vmallocator.h"
|
||||
#include "io/key.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -12,8 +12,10 @@
|
||||
// @todo Make a fast version of the parse_long, parse_ulong, etc. That just checks the first 1-3 characters. The fast version will be used in retail builds while the slow/safe version will be in debug's
|
||||
// @todo Maybe make parser functions case-insensitive
|
||||
////////////////
|
||||
|
||||
#include "debugconsole/consoleparse.h"
|
||||
|
||||
#include "debugconsole/console.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "parse/parselo.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -88,7 +90,7 @@ void dc_get_token_no_advance(SCP_string &out_str);
|
||||
* @param[in] ch Points to the start of the string to parse
|
||||
* @param[in] type The expected type. is thrown along with ch when an unexpected/malformed float is found
|
||||
*
|
||||
* @return The value of the parsed token
|
||||
* @ret The value of the parsed token
|
||||
* @details
|
||||
* The returned double may be cast to a single-precision float, but be sure to check it before doing so!
|
||||
*/
|
||||
@@ -1065,7 +1067,7 @@ void dc_stuff_float(float *f)
|
||||
value_d = dc_parse_double(token.c_str(), DCT_FLOAT); // Parse and convert
|
||||
|
||||
// Stuff value if within bounds
|
||||
if ((std::abs(value_d) < FLT_MAX) && (std::abs(value_d) > FLT_MIN)) {
|
||||
if ((abs(value_d) < FLT_MAX) && (abs(value_d) > FLT_MIN)) {
|
||||
*f = static_cast<float>(value_d);
|
||||
} else {
|
||||
throw errParse(token.c_str(), DCT_FLOAT);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* @details A lot of functions here are blatently copied from parselo.h :D
|
||||
*/
|
||||
|
||||
#include "debugconsole/console.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Code created by Thomas Whittaker (RT) for a FreeSpace 2 source code project
|
||||
*
|
||||
* You may not sell or otherwise commercially exploit the source or things you
|
||||
* created based on the source.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* This module is intended as a debug tool to measure the speed of blocks of code and display
|
||||
* that information as coloured bars across the top of the screen.
|
||||
*
|
||||
* This allows interactive measuring of components of the code, very useful for optimisztion.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
|
||||
#include "timerbar.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
|
||||
// Internal structure for handling frame data
|
||||
typedef struct
|
||||
{
|
||||
LARGE_INTEGER start_value;
|
||||
LARGE_INTEGER total_value;
|
||||
|
||||
LARGE_INTEGER average;
|
||||
LARGE_INTEGER frame_total;
|
||||
|
||||
} timerbar_profile;
|
||||
|
||||
timerbar_profile profiles[MAX_NUM_TIMERBARS];
|
||||
int timerbar_current_profile = 0;
|
||||
|
||||
LARGE_INTEGER timerbar_ultimate_start_value;
|
||||
LARGE_INTEGER timerbar_last_start_value;
|
||||
|
||||
// Data needed for push and pop functionality
|
||||
const int MAX_TB_STACK_SIZE = 100;
|
||||
|
||||
int timerbar_stack[MAX_TB_STACK_SIZE];
|
||||
int timerbar_current_stack_layer = 0;
|
||||
|
||||
/**
|
||||
* Pssst, hey, you. Ya wanna timerbar? Real cheap.
|
||||
*
|
||||
* @param value Index count value (?)
|
||||
*/
|
||||
void timerbar_push(int value)
|
||||
{
|
||||
if(timerbar_current_stack_layer >= MAX_TB_STACK_SIZE)
|
||||
{
|
||||
// To many pushs, this must be a bug
|
||||
// Someone is letting code miss the pops, check for early retuns
|
||||
Assert(!(timerbar_current_stack_layer >= MAX_TB_STACK_SIZE));
|
||||
return;
|
||||
}
|
||||
|
||||
timerbar_stack[timerbar_current_stack_layer] = timerbar_current_profile;
|
||||
timerbar_current_stack_layer++;
|
||||
|
||||
timerbar_switch_type(value);
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void timerbar_pop()
|
||||
{
|
||||
timerbar_current_stack_layer--;
|
||||
if(timerbar_current_stack_layer < 0)
|
||||
{
|
||||
Assert(!(timerbar_current_stack_layer < 0));
|
||||
timerbar_current_stack_layer = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
timerbar_switch_type(timerbar_stack[timerbar_current_stack_layer]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This pointer holds the draw function to use or NULL
|
||||
*
|
||||
* @param colour Colour index (>=0)
|
||||
* @param x Coordinate position
|
||||
* @param y Coordinate position
|
||||
* @param w element width
|
||||
* @param h element height
|
||||
*/
|
||||
void (*draw_func_ptr)(int colour, float x, float y, float w, float h) = NULL;
|
||||
|
||||
/*
|
||||
*/
|
||||
void timerbar_start_frame()
|
||||
{
|
||||
timerbar_current_stack_layer = 0;
|
||||
timerbar_current_profile = 0;
|
||||
|
||||
if(QueryPerformanceCounter(&timerbar_ultimate_start_value) == FALSE)
|
||||
{
|
||||
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
draw_func_ptr = NULL;
|
||||
}
|
||||
|
||||
timerbar_last_start_value = timerbar_ultimate_start_value;
|
||||
|
||||
}
|
||||
|
||||
// Constants need for timerbar_conv_and_draw calculations
|
||||
const int WIDTH = 480;
|
||||
const float WIDTHF = ((float) WIDTH) * 1.01f;
|
||||
|
||||
/**
|
||||
* Internal conversion function to convert draw data into bars for the screen
|
||||
*
|
||||
* @param colour Colour index (>=0)
|
||||
* @param xpos X position to start bar on
|
||||
* @param xwidth Width of bar
|
||||
* @param yrow Index of row bar belongs to
|
||||
*/
|
||||
void timerbar_conv_and_draw(int colour, int xpos, int xwidth, int yrow)
|
||||
{
|
||||
float fxpos = (float) xpos;
|
||||
float fxwidth = (float) xwidth;
|
||||
|
||||
draw_func_ptr(colour,
|
||||
fxpos / WIDTHF,
|
||||
yrow * 0.01f,
|
||||
fxwidth / WIDTHF,
|
||||
0.005f);
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void timerbar_end_frame()
|
||||
{
|
||||
// Now we want to draw the bars
|
||||
if(draw_func_ptr == NULL)
|
||||
{
|
||||
// we have not been given a draw function so we are going to have to quit
|
||||
return;
|
||||
}
|
||||
|
||||
timerbar_switch_type(-1);
|
||||
|
||||
int last_xpos = 0;
|
||||
int y_pos = 0;
|
||||
|
||||
|
||||
for(int i = 0; i < MAX_NUM_TIMERBARS; i++)
|
||||
{
|
||||
// Nothing to render this frame
|
||||
if(profiles[i].frame_total.QuadPart == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int xsize = (int) profiles[i].frame_total.QuadPart / 90;
|
||||
|
||||
// break condition in else
|
||||
while(1)
|
||||
{
|
||||
// if bar runs over
|
||||
if(last_xpos + xsize > WIDTH)
|
||||
{
|
||||
int rem_len = WIDTH - last_xpos;
|
||||
|
||||
// Draw from current position to the end of the bar
|
||||
timerbar_conv_and_draw(i, last_xpos, rem_len, y_pos);
|
||||
|
||||
xsize -= rem_len;
|
||||
last_xpos = 0;
|
||||
y_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw whats left and break for the next bar
|
||||
timerbar_conv_and_draw(i,last_xpos, xsize, y_pos);
|
||||
|
||||
last_xpos += xsize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// reset for next frame
|
||||
profiles[i].frame_total.QuadPart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Not entirely sure what this does.
|
||||
*
|
||||
* @param num Probably a pretend boolean
|
||||
*/
|
||||
void timerbar_switch_type(int num)
|
||||
{
|
||||
if(num >= MAX_NUM_TIMERBARS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate old profile's total
|
||||
LARGE_INTEGER now;
|
||||
if(QueryPerformanceCounter(&now) == FALSE)
|
||||
{
|
||||
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
}
|
||||
|
||||
profiles[timerbar_current_profile].frame_total.QuadPart +=
|
||||
(now.QuadPart - timerbar_last_start_value.QuadPart);
|
||||
|
||||
if(num != -1)
|
||||
{
|
||||
// Switch to new profile
|
||||
timerbar_current_profile = num;
|
||||
}
|
||||
|
||||
// Update time to count from
|
||||
if(QueryPerformanceCounter(&timerbar_last_start_value) == FALSE)
|
||||
{
|
||||
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the instance of the timer bar
|
||||
*
|
||||
* Look at the parameters for "void (*draw_func_ptr)"
|
||||
* They directly equate the new_draw_func_ptr, but we can't
|
||||
* place params for a double stuffed function like this.
|
||||
*/
|
||||
void timerbar_set_draw_func(void (*new_draw_func_ptr)(int colour, float x, float y, float w, float h))
|
||||
{
|
||||
draw_func_ptr = new_draw_func_ptr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Code created by Thomas Whittaker (RT) for a FreeSpace 2 source code project
|
||||
*
|
||||
* You may not sell or otherwise commercially exploit the source or things you
|
||||
* created based on the source.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _TIMERBAR_HEADER_
|
||||
#define _TIMERBAR_HEADER_
|
||||
|
||||
const int MAX_NUM_TIMERBARS = 20;
|
||||
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
// These functions should never be used directly, always use macros below
|
||||
void timerbar_start_frame();
|
||||
void timerbar_end_frame();
|
||||
void timerbar_set_draw_func(void (*new_draw_func_ptr)(int colour, float x, float y, float w, float h));
|
||||
|
||||
void timerbar_push(int value);
|
||||
void timerbar_pop();
|
||||
|
||||
// This function shouldnt not be used any more or it will break push and pop calls
|
||||
void timerbar_switch_type(int num);
|
||||
|
||||
#endif
|
||||
|
||||
+82
-161
@@ -9,17 +9,18 @@
|
||||
|
||||
|
||||
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "fireball/fireballs.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "graphics/tmapper.h"
|
||||
#include "localization/localize.h"
|
||||
#include "render/3d.h"
|
||||
#include "model/model.h"
|
||||
#include "object/object.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "render/3d.h"
|
||||
#include "ship/ship.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "localization/localize.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "asteroid/asteroid.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -75,7 +76,7 @@ void fireball_play_warphole_open_sound(int ship_class, fireball *fb)
|
||||
|
||||
if(fb->warp_open_sound_index > -1) {
|
||||
sound_index = fb->warp_open_sound_index;
|
||||
} else if ((ship_class >= 0) && (ship_class < static_cast<int>(Ship_info.size()))) {
|
||||
} else if((ship_class >= 0) && (ship_class < Num_ship_classes)){
|
||||
if ( Ship_info[ship_class].flags & SIF_HUGE_SHIP ) {
|
||||
sound_index = SND_CAPITAL_WARP_IN;
|
||||
fb->flags |= FBF_WARP_CAPITAL_SIZE;
|
||||
@@ -158,93 +159,84 @@ static void fireball_set_default_color(int idx)
|
||||
*/
|
||||
void parse_fireball_tbl(const char *filename)
|
||||
{
|
||||
int rval;
|
||||
lod_checker lod_check;
|
||||
color fb_color;
|
||||
|
||||
try
|
||||
{
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
required_string("#Start");
|
||||
|
||||
while (required_string_either("#End", "$Name:")) {
|
||||
memset(&lod_check, 0, sizeof(lod_checker));
|
||||
|
||||
// base filename
|
||||
required_string("$Name:");
|
||||
stuff_string(lod_check.filename, F_NAME, MAX_FILENAME_LEN);
|
||||
|
||||
lod_check.override = -1;
|
||||
|
||||
// these entries should only be in TBMs, and it has to include at least one
|
||||
if (Parsing_modular_table) {
|
||||
if (optional_string("+Explosion_Medium")) {
|
||||
lod_check.override = FIREBALL_EXPLOSION_MEDIUM;
|
||||
}
|
||||
else if (optional_string("+Warp_Effect")) {
|
||||
lod_check.override = FIREBALL_WARP;
|
||||
}
|
||||
else if (optional_string("+Knossos_Effect")) {
|
||||
lod_check.override = FIREBALL_KNOSSOS;
|
||||
}
|
||||
else if (optional_string("+Asteroid")) {
|
||||
lod_check.override = FIREBALL_ASTEROID;
|
||||
}
|
||||
else if (optional_string("+Explosion_Large1")) {
|
||||
lod_check.override = FIREBALL_EXPLOSION_LARGE1;
|
||||
}
|
||||
else if (optional_string("+Explosion_Large2")){
|
||||
lod_check.override = FIREBALL_EXPLOSION_LARGE2;
|
||||
}
|
||||
else {
|
||||
required_string("+Custom_Fireball");
|
||||
stuff_int(&lod_check.override);
|
||||
}
|
||||
}
|
||||
|
||||
lod_check.num_lods = 1;
|
||||
|
||||
// Do we have an LOD num
|
||||
if (optional_string("$LOD:")) {
|
||||
stuff_int(&lod_check.num_lods);
|
||||
}
|
||||
|
||||
if (lod_check.num_lods > MAX_FIREBALL_LOD) {
|
||||
lod_check.num_lods = MAX_FIREBALL_LOD;
|
||||
}
|
||||
|
||||
// check for particular lighting color
|
||||
if (optional_string("$Light color:")) {
|
||||
int r, g, b;
|
||||
|
||||
stuff_int(&r);
|
||||
stuff_int(&g);
|
||||
stuff_int(&b);
|
||||
|
||||
CLAMP(r, 0, 255);
|
||||
CLAMP(g, 0, 255);
|
||||
CLAMP(b, 0, 255);
|
||||
|
||||
gr_init_color(&fb_color, r, g, b);
|
||||
}
|
||||
else {
|
||||
// to keep things simple, we just use 0 alpha to indicate that a default value should be used
|
||||
memset(&fb_color, 0, sizeof(color));
|
||||
}
|
||||
|
||||
// we may use one filename for multiple entries so we'll have to handle dupes post parse
|
||||
LOD_checker.push_back(lod_check);
|
||||
LOD_color.push_back(fb_color);
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
required_string("#Start");
|
||||
|
||||
while (required_string_either("#End", "$Name:")) {
|
||||
memset( &lod_check, 0, sizeof(lod_checker) );
|
||||
|
||||
// base filename
|
||||
required_string("$Name:");
|
||||
stuff_string(lod_check.filename, F_NAME, MAX_FILENAME_LEN);
|
||||
|
||||
lod_check.override = -1;
|
||||
|
||||
// these entries should only be in TBMs, and it has to include at least one
|
||||
if ( Parsing_modular_table ) {
|
||||
if (optional_string("+Explosion_Medium")) {
|
||||
lod_check.override = FIREBALL_EXPLOSION_MEDIUM;
|
||||
} else if (optional_string("+Warp_Effect")) {
|
||||
lod_check.override = FIREBALL_WARP;
|
||||
} else if (optional_string("+Knossos_Effect")) {
|
||||
lod_check.override = FIREBALL_KNOSSOS;
|
||||
} else if (optional_string("+Asteroid")) {
|
||||
lod_check.override = FIREBALL_ASTEROID;
|
||||
} else if (optional_string("+Explosion_Large1")) {
|
||||
lod_check.override = FIREBALL_EXPLOSION_LARGE1;
|
||||
} else if (optional_string("+Explosion_Large2")){
|
||||
lod_check.override = FIREBALL_EXPLOSION_LARGE2;
|
||||
} else {
|
||||
required_string("+Custom_Fireball");
|
||||
stuff_int(&lod_check.override);
|
||||
}
|
||||
}
|
||||
|
||||
lod_check.num_lods = 1;
|
||||
|
||||
// Do we have an LOD num
|
||||
if (optional_string("$LOD:")) {
|
||||
stuff_int(&lod_check.num_lods);
|
||||
}
|
||||
|
||||
if (lod_check.num_lods > MAX_FIREBALL_LOD) {
|
||||
lod_check.num_lods = MAX_FIREBALL_LOD;
|
||||
}
|
||||
|
||||
// check for particular lighting color
|
||||
if ( optional_string("$Light color:") ) {
|
||||
int r, g, b;
|
||||
|
||||
stuff_int(&r);
|
||||
stuff_int(&g);
|
||||
stuff_int(&b);
|
||||
|
||||
CLAMP(r, 0, 255);
|
||||
CLAMP(g, 0, 255);
|
||||
CLAMP(b, 0, 255);
|
||||
|
||||
gr_init_color(&fb_color, r, g, b);
|
||||
} else {
|
||||
// to keep things simple, we just use 0 alpha to indicate that a default value should be used
|
||||
memset( &fb_color, 0, sizeof(color) );
|
||||
}
|
||||
|
||||
// we may use one filename for multiple entries so we'll have to handle dupes post parse
|
||||
LOD_checker.push_back(lod_check);
|
||||
LOD_color.push_back(fb_color);
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
}
|
||||
|
||||
void fireball_parse_tbl()
|
||||
@@ -374,7 +366,7 @@ void fireball_init()
|
||||
|
||||
MONITOR( NumFireballsRend )
|
||||
|
||||
void fireball_render_DEPRECATED(object * obj)
|
||||
void fireball_render(object * obj)
|
||||
{
|
||||
int num;
|
||||
vertex p;
|
||||
@@ -1051,74 +1043,3 @@ float fireball_wormhole_intensity( object *obj )
|
||||
}
|
||||
return rad;
|
||||
}
|
||||
|
||||
void fireball_render(object* obj, draw_list *scene)
|
||||
{
|
||||
int num;
|
||||
vertex p;
|
||||
fireball *fb;
|
||||
|
||||
MONITOR_INC( NumFireballsRend, 1 );
|
||||
|
||||
num = obj->instance;
|
||||
fb = &Fireballs[num];
|
||||
|
||||
if ( Fireballs[num].current_bitmap < 0 )
|
||||
return;
|
||||
|
||||
if ( Cmdline_nohtl ) {
|
||||
g3_rotate_vertex(&p, &obj->pos );
|
||||
} else {
|
||||
g3_transfer_vertex(&p, &obj->pos);
|
||||
}
|
||||
|
||||
switch ( fb->fireball_render_type ) {
|
||||
|
||||
case FIREBALL_MEDIUM_EXPLOSION: {
|
||||
batch_add_bitmap (
|
||||
Fireballs[num].current_bitmap,
|
||||
TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_SOFT_QUAD,
|
||||
&p,
|
||||
fb->orient,
|
||||
obj->radius
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case FIREBALL_LARGE_EXPLOSION: {
|
||||
// Make the big explosions rotate with the viewer.
|
||||
batch_add_bitmap_rotated (
|
||||
Fireballs[num].current_bitmap,
|
||||
TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_SOFT_QUAD,
|
||||
&p,
|
||||
(i2fl(fb->orient)*PI)/180.0f,
|
||||
obj->radius
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case FIREBALL_WARP_EFFECT: {
|
||||
float percent_life = fb->time_elapsed / fb->total_time;
|
||||
|
||||
float rad;
|
||||
|
||||
// Code to make effect grow/shrink.
|
||||
float t = fb->time_elapsed;
|
||||
|
||||
if ( t < WARPHOLE_GROW_TIME ) {
|
||||
rad = (float)pow(t/WARPHOLE_GROW_TIME,0.4f)*obj->radius;
|
||||
} else if ( t < fb->total_time - WARPHOLE_GROW_TIME ) {
|
||||
rad = obj->radius;
|
||||
} else {
|
||||
rad = (float)pow((fb->total_time - t)/WARPHOLE_GROW_TIME,0.4f)*obj->radius;
|
||||
}
|
||||
|
||||
warpin_queue_render(scene, obj, &obj->orient, &obj->pos, Fireballs[num].current_bitmap, rad, percent_life, obj->radius, (Fireballs[num].flags & FBF_WARP_3D) );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Int3();
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
#define _FIREBALLS_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "model/modelrender.h"
|
||||
|
||||
class object;
|
||||
class ship_info;
|
||||
@@ -77,8 +76,7 @@ typedef struct fireball {
|
||||
// end move
|
||||
|
||||
void fireball_init();
|
||||
void fireball_render_DEPRECATED(object * obj);
|
||||
void fireball_render(object* obj, draw_list *scene);
|
||||
void fireball_render(object * obj);
|
||||
void fireball_delete( object * obj );
|
||||
void fireball_process_post(object * obj, float frame_time);
|
||||
|
||||
@@ -116,8 +114,6 @@ float fireball_wormhole_intensity( object *obj );
|
||||
// internal function to draw warp grid.
|
||||
extern void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d = 0 );
|
||||
|
||||
extern void warpin_queue_render(draw_list *scene, object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d);
|
||||
|
||||
extern int Warp_model;
|
||||
|
||||
// Goober5000
|
||||
|
||||
+13
-177
@@ -10,15 +10,17 @@
|
||||
|
||||
|
||||
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/tmapper.h"
|
||||
#include "math/vecmat.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "model/model.h"
|
||||
#include "nebula/neb.h"
|
||||
#include "graphics/tmapper.h"
|
||||
#include "render/3d.h"
|
||||
#include "fireball/fireballs.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "nebula/neb.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "model/model.h"
|
||||
#include "ship/ship.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
|
||||
extern int Warp_model;
|
||||
extern int Warp_glow_bitmap;
|
||||
@@ -45,25 +47,6 @@ void draw_face( vertex *v1, vertex *v2, vertex *v3 )
|
||||
|
||||
}
|
||||
|
||||
void warpin_batch_draw_face( int texture, vertex *v1, vertex *v2, vertex *v3 )
|
||||
{
|
||||
vec3d norm;
|
||||
vertex vertlist[3];
|
||||
|
||||
vm_vec_perp(&norm,&v1->world, &v2->world, &v3->world);
|
||||
if ( vm_vec_dot(&norm, &v1->world ) >= 0.0 ) {
|
||||
vertlist[0] = *v3;
|
||||
vertlist[1] = *v2;
|
||||
vertlist[2] = *v1;
|
||||
} else {
|
||||
vertlist[0] = *v1;
|
||||
vertlist[1] = *v2;
|
||||
vertlist[2] = *v3;
|
||||
}
|
||||
|
||||
batch_add_tri(texture, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT, vertlist, 1.0f);
|
||||
}
|
||||
|
||||
void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d)
|
||||
{
|
||||
vec3d center;
|
||||
@@ -126,18 +109,15 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
}
|
||||
|
||||
if ( (Warp_model >= 0) && (warp_3d || Cmdline_3dwarp) ) {
|
||||
model_render_params render_info;
|
||||
|
||||
vec3d scale;
|
||||
scale.xyz.z = scale.xyz.y = scale.xyz.x = radius / 25.0f;
|
||||
render_info.set_warp_params(texture_bitmap_num, radius/max_radius, scale);
|
||||
float scale = radius / 25.0f;
|
||||
model_set_warp_globals(scale, scale, scale, texture_bitmap_num, (radius/max_radius) );
|
||||
|
||||
float dist = vm_vec_dist_quick( pos, &Eye_position );
|
||||
render_info.set_detail_level_lock((int)(dist / (radius * 10.0f)));
|
||||
model_set_detail_level((int)(dist / (radius * 10.0f)));
|
||||
|
||||
render_info.set_flags(MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING | MR_NO_CULL | MR_NO_BATCH);
|
||||
model_render( Warp_model, orient, pos, MR_LOCK_DETAIL | MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING | MR_NO_CULL );
|
||||
|
||||
model_render_immediate( &render_info, Warp_model, orient, pos );
|
||||
model_set_warp_globals();
|
||||
} else {
|
||||
float Grid_depth = radius/2.5f;
|
||||
|
||||
@@ -217,147 +197,3 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
|
||||
gr_zbuffer_set( saved_gr_zbuffering );
|
||||
}
|
||||
|
||||
void warpin_queue_render(draw_list *scene, object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d)
|
||||
{
|
||||
vec3d center;
|
||||
vec3d vecs[5];
|
||||
vertex verts[5];
|
||||
|
||||
vm_vec_scale_add( ¢er, pos, &orient->vec.fvec, -(max_radius/2.5f)/3.0f );
|
||||
|
||||
|
||||
if (Warp_glow_bitmap >= 0) {
|
||||
float r = radius;
|
||||
bool render_it = true;
|
||||
|
||||
#define OUT_PERCENT1 0.80f
|
||||
#define OUT_PERCENT2 0.90f
|
||||
|
||||
#define IN_PERCENT1 0.10f
|
||||
#define IN_PERCENT2 0.20f
|
||||
|
||||
if (Cmdline_warp_flash)
|
||||
{
|
||||
if ( (life_percent >= IN_PERCENT1) && (life_percent < IN_PERCENT2) ) {
|
||||
r *= (life_percent - IN_PERCENT1) / (IN_PERCENT2 - IN_PERCENT1);
|
||||
//render_it = true;
|
||||
} else if ( (life_percent >= OUT_PERCENT1) && (life_percent < OUT_PERCENT2) ) {
|
||||
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2 - OUT_PERCENT1);
|
||||
//render_it = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (render_it) {
|
||||
// Add in noise
|
||||
int noise_frame = fl2i(Missiontime/15.0f) % NOISE_NUM_FRAMES;
|
||||
|
||||
r *= (0.40f + Noise[noise_frame] * 0.30f);
|
||||
|
||||
// Bobboau's warp thingie, toggled by cmdline
|
||||
if (Cmdline_warp_flash) {
|
||||
r += powf((2.0f * life_percent) - 1.0f, 24.0f) * max_radius * 1.5f;
|
||||
}
|
||||
|
||||
vecs[4] = center;
|
||||
verts[4].texture_position.u = 0.5f; verts[4].texture_position.v = 0.5f;
|
||||
|
||||
if (Cmdline_nohtl) {
|
||||
g3_rotate_vertex( &verts[4], &vecs[4] );
|
||||
} else {
|
||||
g3_transfer_vertex( &verts[4], &vecs[4] );
|
||||
}
|
||||
|
||||
float alpha = (The_mission.flags & MISSION_FLAG_FULLNEB) ? (1.0f - neb2_get_fog_intensity(obj)) : 1.0f;
|
||||
|
||||
batch_add_bitmap(Warp_glow_bitmap, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT, &verts[4], 0, r, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
if ( (Warp_model >= 0) && (warp_3d || Cmdline_3dwarp) ) {
|
||||
model_render_params render_info;
|
||||
|
||||
float scale = radius / 25.0f;
|
||||
|
||||
vec3d warp_scale;
|
||||
|
||||
warp_scale.xyz.x = warp_scale.xyz.y = warp_scale.xyz.z = scale;
|
||||
|
||||
float dist = vm_vec_dist_quick( pos, &Eye_position );
|
||||
|
||||
render_info.set_warp_params(texture_bitmap_num, radius/max_radius, warp_scale);
|
||||
render_info.set_detail_level_lock((int)(dist / (radius * 10.0f)));
|
||||
render_info.set_flags(MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING | MR_NO_CULL | MR_NO_BATCH);
|
||||
|
||||
model_render_queue( &render_info, scene, Warp_model, orient, pos);
|
||||
} else {
|
||||
float Grid_depth = radius/2.5f;
|
||||
|
||||
// gr_set_bitmap( texture_bitmap_num, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
|
||||
|
||||
vm_vec_scale_add( &vecs[0], ¢er, &orient->vec.uvec, radius );
|
||||
vm_vec_scale_add2( &vecs[0], &orient->vec.rvec, -radius );
|
||||
vm_vec_scale_add2( &vecs[0], &orient->vec.fvec, Grid_depth );
|
||||
|
||||
vm_vec_scale_add( &vecs[1], ¢er, &orient->vec.uvec, radius );
|
||||
vm_vec_scale_add2( &vecs[1], &orient->vec.rvec, radius );
|
||||
vm_vec_scale_add2( &vecs[1], &orient->vec.fvec, Grid_depth );
|
||||
|
||||
vm_vec_scale_add( &vecs[2], ¢er, &orient->vec.uvec, -radius );
|
||||
vm_vec_scale_add2( &vecs[2], &orient->vec.rvec, radius );
|
||||
vm_vec_scale_add2( &vecs[2], &orient->vec.fvec, Grid_depth );
|
||||
|
||||
vm_vec_scale_add( &vecs[3], ¢er, &orient->vec.uvec, -radius );
|
||||
vm_vec_scale_add2( &vecs[3], &orient->vec.rvec, -radius );
|
||||
vm_vec_scale_add2( &vecs[3], &orient->vec.fvec, Grid_depth );
|
||||
|
||||
// vm_vec_scale_add( &vecs[4], ¢er, &orient->vec.fvec, -Grid_depth );
|
||||
vecs[4] = center;
|
||||
|
||||
verts[0].texture_position.u = 0.01f;
|
||||
verts[0].texture_position.v = 0.01f;
|
||||
|
||||
verts[1].texture_position.u = 0.99f;
|
||||
verts[1].texture_position.v = 0.01f;
|
||||
|
||||
verts[2].texture_position.u = 0.99f;
|
||||
verts[2].texture_position.v = 0.99f;
|
||||
|
||||
verts[3].texture_position.u = 0.01f;
|
||||
verts[3].texture_position.v = 0.99f;
|
||||
|
||||
verts[4].texture_position.u = 0.5f;
|
||||
verts[4].texture_position.v = 0.5f;
|
||||
|
||||
if (Cmdline_nohtl) {
|
||||
g3_rotate_vertex( &verts[0], &vecs[0] );
|
||||
g3_rotate_vertex( &verts[1], &vecs[1] );
|
||||
g3_rotate_vertex( &verts[2], &vecs[2] );
|
||||
g3_rotate_vertex( &verts[3], &vecs[3] );
|
||||
g3_rotate_vertex( &verts[4], &vecs[4] );
|
||||
} else {
|
||||
g3_transfer_vertex( &verts[0], &vecs[0] );
|
||||
g3_transfer_vertex( &verts[1], &vecs[1] );
|
||||
g3_transfer_vertex( &verts[2], &vecs[2] );
|
||||
g3_transfer_vertex( &verts[3], &vecs[3] );
|
||||
g3_transfer_vertex( &verts[4], &vecs[4] );
|
||||
}
|
||||
|
||||
warpin_batch_draw_face( texture_bitmap_num, &verts[0], &verts[4], &verts[1] );
|
||||
warpin_batch_draw_face( texture_bitmap_num, &verts[1], &verts[4], &verts[2] );
|
||||
warpin_batch_draw_face( texture_bitmap_num, &verts[4], &verts[3], &verts[2] );
|
||||
warpin_batch_draw_face( texture_bitmap_num, &verts[0], &verts[3], &verts[4] );
|
||||
}
|
||||
|
||||
if (Warp_ball_bitmap > -1 && Cmdline_warp_flash == 1) {
|
||||
//flash_ball warp_ball(20, .1f,.25f, &vmd_z_vector, &vmd_zero_vector, 4.0f, 0.5f);
|
||||
flash_ball warp_ball(20, .1f,.25f, &orient->vec.fvec, pos, 4.0f, 0.5f);
|
||||
|
||||
float adg = (2.0f * life_percent) - 1.0f;
|
||||
float pct = (powf(adg, 4.0f) - powf(adg, 128.0f)) * 4.0f;
|
||||
|
||||
if (pct > 0.00001f) {
|
||||
warp_ball.render(Warp_ball_bitmap, max_radius * pct * 0.5f, adg * adg, adg * adg * 6.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,14 +124,14 @@ BOOL AltShipClassDlg::OnInitDialog()
|
||||
m_set_from_ship_class.AddString("Set From Variable");
|
||||
}
|
||||
count = 0;
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
|
||||
for (i=0; i<Num_ship_classes; i++)
|
||||
{
|
||||
if (player_ships_only && !(it->flags & SIF_PLAYER_SHIP)) {
|
||||
if (player_ships_only && !(Ship_info[i].flags & SIF_PLAYER_SHIP)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ship_class_indices[count++] = std::distance(Ship_info.cbegin(), it);
|
||||
m_set_from_ship_class.AddString(it->name);
|
||||
ship_class_indices[count++] = i;
|
||||
m_set_from_ship_class.AddString(Ship_info[i].name);
|
||||
}
|
||||
m_set_from_ship_class.SetCurSel(num_string_variables?1:0); // Set to the first ship class
|
||||
|
||||
|
||||
@@ -59,27 +59,10 @@ BOOL FictionViewerDlg::OnInitDialog()
|
||||
box->AddString(Spooled_music[i].name);
|
||||
}
|
||||
|
||||
// make sure we have at least one stage
|
||||
if (Fiction_viewer_stages.empty())
|
||||
{
|
||||
fiction_viewer_stage stage;
|
||||
memset(&stage, 0, sizeof(fiction_viewer_stage));
|
||||
stage.formula = Locked_sexp_true;
|
||||
|
||||
Fiction_viewer_stages.push_back(stage);
|
||||
}
|
||||
else if (Fiction_viewer_stages.size() > 1)
|
||||
{
|
||||
MessageBox("You have multiple fiction viewer stages defined for this mission. At present, FRED will only allow you to edit the first stage.");
|
||||
}
|
||||
|
||||
// init fields based on first fiction viewer stage
|
||||
fiction_viewer_stage *stagep = &Fiction_viewer_stages.at(0);
|
||||
m_story_file = _T(stagep->story_filename);
|
||||
m_font_file = _T(stagep->font_filename);
|
||||
m_voice_file = _T(stagep->voice_filename);
|
||||
|
||||
// music is managed through the mission
|
||||
// init variables
|
||||
m_story_file = _T(fiction_file());
|
||||
m_font_file = _T(fiction_font());
|
||||
m_voice_file = _T(fiction_voice());
|
||||
m_fiction_music = Mission_music[SCORE_FICTION_VIEWER] + 1;
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
@@ -91,15 +74,9 @@ void FictionViewerDlg::OnOK()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
|
||||
// store the fields in the data structure
|
||||
fiction_viewer_stage *stagep = &Fiction_viewer_stages.at(0);
|
||||
strcpy_s(stagep->story_filename, (LPCSTR)m_story_file);
|
||||
strcpy_s(stagep->font_filename, (LPCSTR)m_font_file);
|
||||
strcpy_s(stagep->voice_filename, (LPCSTR)m_voice_file);
|
||||
|
||||
// if we don't have a story file, remove this stage (stage 0)
|
||||
if (strlen(stagep->story_filename) == 0)
|
||||
Fiction_viewer_stages.erase(Fiction_viewer_stages.begin());
|
||||
// load it up
|
||||
fiction_viewer_reset();
|
||||
fiction_viewer_load((const char *)(LPCSTR)m_story_file, (const char *)(LPCSTR)m_font_file, (const char *)(LPCSTR)m_voice_file);
|
||||
|
||||
// set music
|
||||
Mission_music[SCORE_FICTION_VIEWER] = m_fiction_music - 1;
|
||||
@@ -137,8 +114,6 @@ void FictionViewerDlg::OnClose()
|
||||
|
||||
int FictionViewerDlg::query_modified()
|
||||
{
|
||||
fiction_viewer_stage *stagep = &Fiction_viewer_stages.at(0);
|
||||
|
||||
return strcmp(m_story_file, stagep->story_filename) || strcmp(m_font_file, stagep->font_filename) ||
|
||||
strcmp(m_voice_file, stagep->voice_filename) || m_fiction_music != (Mission_music[SCORE_FICTION_VIEWER] + 1);
|
||||
return strcmp(m_story_file, fiction_file()) || strcmp(m_font_file, fiction_font()) ||
|
||||
strcmp(m_voice_file, fiction_voice()) || m_fiction_music != (Mission_music[SCORE_FICTION_VIEWER] + 1);
|
||||
}
|
||||
@@ -22,9 +22,6 @@ public:
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(FictionViewerDlg)
|
||||
enum { IDD = IDD_FICTION_VIEWER };
|
||||
CString m_fiction_background_640;
|
||||
CString m_fiction_background_1024;
|
||||
int m_fiction_ui;
|
||||
CString m_story_file;
|
||||
CString m_font_file;
|
||||
CString m_voice_file;
|
||||
|
||||
@@ -440,7 +440,7 @@ void asteroid_editor::update_init()
|
||||
for (k = 0; k < MAX_ACTIVE_DEBRIS_TYPES; k++)
|
||||
{
|
||||
box_index = ((CComboBox*)GetDlgItem(Dlg_id[k]))->AddString("None");
|
||||
((CComboBox*)GetDlgItem(Dlg_id[k]))->SetItemData(box_index, static_cast<DWORD_PTR>(-1));
|
||||
((CComboBox*)GetDlgItem(Dlg_id[k]))->SetItemData(box_index, -1);
|
||||
}
|
||||
|
||||
// now add each kind of debris to each box
|
||||
|
||||
+63
-66
@@ -229,17 +229,17 @@ void bg_bitmap_dlg::create()
|
||||
|
||||
angles skybox_angles;
|
||||
vm_extract_angles_matrix(&skybox_angles, &The_mission.skybox_orientation);
|
||||
m_skybox_pitch = fl2ir(fl_degrees(skybox_angles.p));
|
||||
m_skybox_bank = fl2ir(fl_degrees(skybox_angles.b));
|
||||
m_skybox_heading = fl2ir(fl_degrees(skybox_angles.h));
|
||||
m_skybox_pitch = (int) fl_degrees(skybox_angles.p);
|
||||
m_skybox_bank = (int) fl_degrees(skybox_angles.b);
|
||||
m_skybox_heading = (int) fl_degrees(skybox_angles.h);
|
||||
|
||||
//make sure angle values are in the 0-359 degree range
|
||||
if (m_skybox_pitch < 0)
|
||||
m_skybox_pitch = m_skybox_pitch + 360;
|
||||
m_skybox_pitch = m_skybox_pitch + 359;
|
||||
if (m_skybox_bank < 0)
|
||||
m_skybox_bank = m_skybox_bank + 360;
|
||||
m_skybox_bank = m_skybox_bank + 359;
|
||||
if (m_skybox_heading < 0)
|
||||
m_skybox_heading = m_skybox_heading + 360;
|
||||
m_skybox_heading = m_skybox_heading + 359;
|
||||
|
||||
|
||||
for(i=0; i<MAX_NEB2_BITMAPS; i++){
|
||||
@@ -730,9 +730,9 @@ void bg_bitmap_dlg::OnSunChange()
|
||||
starfield_list_entry *sle = &background->suns[s_index];
|
||||
|
||||
s_name = CString(sle->filename);
|
||||
s_pitch = fl2ir(fl_degrees(sle->ang.p) + delta);
|
||||
s_bank = fl2ir(fl_degrees(sle->ang.b) + delta);
|
||||
s_heading = fl2ir(fl_degrees(sle->ang.h) + delta);
|
||||
s_pitch = (int) (fl_degrees(sle->ang.p) + delta);
|
||||
s_bank = (int) (fl_degrees(sle->ang.b) + delta);
|
||||
s_heading = (int) (fl_degrees(sle->ang.h) + delta);
|
||||
s_scale = sle->scale_x;
|
||||
|
||||
// stuff back into the controls
|
||||
@@ -894,9 +894,9 @@ void bg_bitmap_dlg::OnBitmapChange()
|
||||
starfield_list_entry *sle = &background->bitmaps[b_index];
|
||||
|
||||
b_name = CString(sle->filename);
|
||||
b_pitch = fl2ir(fl_degrees(sle->ang.p) + delta);
|
||||
b_bank = fl2ir(fl_degrees(sle->ang.b) + delta);
|
||||
b_heading = fl2ir(fl_degrees(sle->ang.h) + delta);
|
||||
b_pitch = (int) (fl_degrees(sle->ang.p) + delta);
|
||||
b_bank = (int) (fl_degrees(sle->ang.b) + delta);
|
||||
b_heading = (int) (fl_degrees(sle->ang.h) + delta);
|
||||
b_scale_x = sle->scale_x;
|
||||
b_scale_y = sle->scale_y;
|
||||
b_div_x = sle->div_x;
|
||||
@@ -1267,7 +1267,7 @@ void bg_bitmap_dlg::OnImportBackground()
|
||||
{
|
||||
CFileDialog cfd(TRUE, ".fs2", NULL, 0, "FreeSpace2 Missions (*.fs2)|*.fs2||\0");
|
||||
char filename[256], error_str[1024];
|
||||
int temp, count;
|
||||
int rval, temp, count;
|
||||
char *saved_mp;
|
||||
|
||||
//warn on pressing the button
|
||||
@@ -1280,62 +1280,59 @@ void bg_bitmap_dlg::OnImportBackground()
|
||||
|
||||
strcpy_s(filename, cfd.GetPathName());
|
||||
|
||||
try
|
||||
{
|
||||
// parse in the new file
|
||||
read_file_text(filename);
|
||||
reset_parse();
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("BGBITMAPDLG: Unable to parse '%s'! Error code = %i.\n", filename, rval));
|
||||
sprintf(error_str, "Could not parse file: %s", filename);
|
||||
|
||||
if (!skip_to_start_of_string("#Background bitmaps"))
|
||||
return;
|
||||
|
||||
// skip beginning stuff
|
||||
required_string("#Background bitmaps");
|
||||
required_string("$Num stars:");
|
||||
stuff_int(&temp);
|
||||
required_string("$Ambient light level:");
|
||||
stuff_int(&temp);
|
||||
|
||||
saved_mp = Mp;
|
||||
|
||||
// see if we have more than one background in this mission
|
||||
count = 0;
|
||||
while (skip_to_string("$Bitmap List:"))
|
||||
count++;
|
||||
|
||||
Mp = saved_mp;
|
||||
|
||||
// pick one (if count is 0, it's retail with just one background)
|
||||
if (count > 0)
|
||||
{
|
||||
int i, which = 0;
|
||||
|
||||
if (count > 1)
|
||||
{
|
||||
BackgroundChooser dlg(count);
|
||||
if (dlg.DoModal() == IDCANCEL)
|
||||
return;
|
||||
|
||||
which = dlg.GetChosenBackground();
|
||||
}
|
||||
|
||||
for (i = 0; i < which + 1; i++)
|
||||
skip_to_string("$Bitmap List:");
|
||||
}
|
||||
|
||||
// now parse the background we've selected
|
||||
parse_one_background(&Backgrounds[get_active_background()]);
|
||||
|
||||
reinitialize_lists();
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("BGBITMAPDLG: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
|
||||
sprintf(error_str, "Could not parse file: %s\n\nError message: %s", filename, e.what());
|
||||
|
||||
MessageBox((LPCTSTR)error_str, (LPCTSTR) "Unable to import mission background!", MB_ICONERROR | MB_OK);
|
||||
MessageBox((LPCTSTR) error_str, (LPCTSTR) "Unable to import mission background!", MB_ICONERROR | MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
// parse in the new file
|
||||
read_file_text(filename);
|
||||
reset_parse();
|
||||
|
||||
if (!skip_to_start_of_string("#Background bitmaps"))
|
||||
return;
|
||||
|
||||
// skip beginning stuff
|
||||
required_string("#Background bitmaps");
|
||||
required_string("$Num stars:");
|
||||
stuff_int(&temp);
|
||||
required_string("$Ambient light level:");
|
||||
stuff_int(&temp);
|
||||
|
||||
saved_mp = Mp;
|
||||
|
||||
// see if we have more than one background in this mission
|
||||
count = 0;
|
||||
while(skip_to_string("$Bitmap List:"))
|
||||
count++;
|
||||
|
||||
Mp = saved_mp;
|
||||
|
||||
// pick one (if count is 0, it's retail with just one background)
|
||||
if (count > 0)
|
||||
{
|
||||
int i, which = 0;
|
||||
|
||||
if (count > 1)
|
||||
{
|
||||
BackgroundChooser dlg(count);
|
||||
if (dlg.DoModal() == IDCANCEL)
|
||||
return;
|
||||
|
||||
which = dlg.GetChosenBackground();
|
||||
}
|
||||
|
||||
for (i = 0; i < which + 1; i++)
|
||||
skip_to_string("$Bitmap List:");
|
||||
}
|
||||
|
||||
// now parse the background we've selected
|
||||
parse_one_background(&Backgrounds[get_active_background()]);
|
||||
|
||||
reinitialize_lists();
|
||||
}
|
||||
|
||||
void bg_bitmap_dlg::reinitialize_lists()
|
||||
|
||||
@@ -196,8 +196,8 @@ void briefing_editor_dlg::create()
|
||||
box->AddString(Iff_info[i].iff_name);
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_SHIP_TYPE);
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
|
||||
box->AddString(it->name);
|
||||
for (i=0; i<Num_ship_classes; i++)
|
||||
box->AddString(Ship_info[i].name);
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_BRIEFING_MUSIC);
|
||||
box->AddString("None");
|
||||
@@ -1127,11 +1127,11 @@ void briefing_editor_dlg::OnMakeIcon()
|
||||
else if(jnp != Jump_nodes.end()){
|
||||
// find the first navbuoy
|
||||
iconp->ship_class = -1;
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
|
||||
for (int i = 0; i < Num_ship_classes; i++)
|
||||
{
|
||||
if (it->flags & SIF_NAVBUOY)
|
||||
if (Ship_info[i].flags & SIF_NAVBUOY)
|
||||
{
|
||||
iconp->ship_class = std::distance(Ship_info.cbegin(), it);
|
||||
iconp->ship_class = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1141,11 +1141,11 @@ void briefing_editor_dlg::OnMakeIcon()
|
||||
else {
|
||||
// find the first navbuoy
|
||||
iconp->ship_class = -1;
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
|
||||
for (int i = 0; i < Num_ship_classes; i++)
|
||||
{
|
||||
if (it->flags & SIF_NAVBUOY)
|
||||
if (Ship_info[i].flags & SIF_NAVBUOY)
|
||||
{
|
||||
iconp->ship_class = std::distance(Ship_info.cbegin(), it);
|
||||
iconp->ship_class = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1299,7 +1299,7 @@ void event_editor::OnDeleteMsg()
|
||||
char buf[256];
|
||||
|
||||
// handle this case somewhat gracefully
|
||||
Assertion((m_cur_msg >= -1) && (m_cur_msg < m_num_messages), "Unexpected m_cur_msg value (%d); expected either -1, or between 0-%d. Get a coder!\n", m_cur_msg, m_num_messages - 1);
|
||||
Assert((m_cur_msg >= 0) && (m_cur_msg < m_num_messages));
|
||||
if((m_cur_msg < 0) || (m_cur_msg >= m_num_messages)){
|
||||
return;
|
||||
}
|
||||
|
||||
+220
-220
File diff suppressed because it is too large.
Load diff
@@ -25,6 +25,7 @@
|
||||
#include "object/object.h"
|
||||
#include "editor.h"
|
||||
#include "ai/ai.h"
|
||||
#include "ai/ailocal.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
#include "cfile/cfilesystem.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#ifndef _FREDDOC_H
|
||||
#define _FREDDOC_H
|
||||
|
||||
#include "ai/ailocal.h"
|
||||
#include "MissionSave.h"
|
||||
|
||||
#define MISSION_BACKUP_NAME "Backup"
|
||||
|
||||
+23
-29
@@ -34,6 +34,7 @@
|
||||
#include "model/model.h"
|
||||
#include "palman/palman.h"
|
||||
#include "editor.h"
|
||||
#include "ai/ailocal.h"
|
||||
#include "ship/ship.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "mission/missionparse.h"
|
||||
@@ -140,7 +141,8 @@ color colour_yellow;
|
||||
|
||||
void fred_enable_htl()
|
||||
{
|
||||
gr_set_proj_matrix((4.0f/9.0f) * PI * (Briefing_dialog ? Briefing_window_FOV : FRED_DEFAULT_HTL_FOV), gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
|
||||
if (!Briefing_dialog) gr_set_proj_matrix( (4.0f/9.0f) * PI * FRED_DEFAULT_HTL_FOV, gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
|
||||
if (Briefing_dialog) gr_set_proj_matrix( Briefing_window_FOV, gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
|
||||
gr_set_view_matrix(&Eye_position, &Eye_matrix);
|
||||
}
|
||||
|
||||
@@ -700,7 +702,6 @@ void render_one_model_briefing_screen(object *objp)
|
||||
void render_one_model_nohtl(object *objp)
|
||||
{
|
||||
int j, z;
|
||||
uint debug_flags = 0;
|
||||
object *o2;
|
||||
|
||||
Assert(objp->type != OBJ_NONE);
|
||||
@@ -754,11 +755,11 @@ void render_one_model_nohtl(object *objp)
|
||||
}
|
||||
|
||||
if(Show_dock_points){
|
||||
debug_flags |= MR_DEBUG_BAY_PATHS;
|
||||
j |= MR_BAY_PATHS;
|
||||
}
|
||||
|
||||
if(Show_paths_fred){
|
||||
debug_flags |= MR_DEBUG_PATHS;
|
||||
j |= MR_SHOW_PATHS;
|
||||
}
|
||||
|
||||
z = objp->instance;
|
||||
@@ -767,19 +768,12 @@ void render_one_model_nohtl(object *objp)
|
||||
|
||||
// if (!viewpoint || OBJ_INDEX(objp) != cur_object_index)
|
||||
{
|
||||
model_render_params render_info;
|
||||
|
||||
if (Fred_outline) {
|
||||
render_info.set_flags(j | MR_SHOW_OUTLINE | MR_NO_TEXTURING | MR_NO_LIGHTING);
|
||||
render_info.set_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
|
||||
model_set_outline_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j | MR_SHOW_OUTLINE, -1, -1, Ships[z].ship_replacement_textures);
|
||||
} else {
|
||||
render_info.set_flags(j);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].ship_replacement_textures);
|
||||
}
|
||||
|
||||
render_info.set_debug_flags(debug_flags);
|
||||
render_info.set_replacement_textures(Ships[z].ship_replacement_textures);
|
||||
|
||||
model_render_immediate(&render_info, Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -837,7 +831,6 @@ void render_one_model_nohtl(object *objp)
|
||||
void render_one_model_htl(object *objp)
|
||||
{
|
||||
int j, z;
|
||||
uint debug_flags = 0;
|
||||
object *o2;
|
||||
|
||||
Assert(objp->type != OBJ_NONE);
|
||||
@@ -885,7 +878,6 @@ void render_one_model_htl(object *objp)
|
||||
// build flags
|
||||
if ((Show_ship_models || Show_outlines) && ((objp->type == OBJ_SHIP) || (objp->type == OBJ_START))){
|
||||
g3_start_instance_matrix(&Eye_position, &Eye_matrix, 0);
|
||||
|
||||
if (Show_ship_models){
|
||||
j = MR_NORMAL;
|
||||
} else {
|
||||
@@ -893,11 +885,11 @@ void render_one_model_htl(object *objp)
|
||||
}
|
||||
|
||||
if(Show_dock_points){
|
||||
debug_flags |= MR_DEBUG_BAY_PATHS;
|
||||
j |= MR_BAY_PATHS;
|
||||
}
|
||||
|
||||
if(Show_paths_fred){
|
||||
debug_flags |= MR_DEBUG_PATHS;
|
||||
j |= MR_SHOW_PATHS;
|
||||
}
|
||||
|
||||
z = objp->instance;
|
||||
@@ -913,19 +905,13 @@ void render_one_model_htl(object *objp)
|
||||
j |= MR_FULL_DETAIL;
|
||||
}
|
||||
|
||||
model_render_params render_info;
|
||||
|
||||
if (Fred_outline) {
|
||||
render_info.set_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
|
||||
j |= MR_SHOW_OUTLINE_HTL | MR_NO_LIGHTING | MR_NO_POLYS | MR_NO_TEXTURING;
|
||||
model_set_outline_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
|
||||
j |= MR_SHOW_OUTLINE_HTL;
|
||||
}
|
||||
|
||||
render_info.set_flags(j);
|
||||
render_info.set_debug_flags(debug_flags);
|
||||
render_info.set_replacement_textures(Ships[z].ship_replacement_textures);
|
||||
|
||||
g3_done_instance(0);
|
||||
model_render_immediate(&render_info, Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].ship_replacement_textures);
|
||||
} else {
|
||||
int r = 0, g = 0, b = 0;
|
||||
|
||||
@@ -1503,7 +1489,11 @@ void render_frame()
|
||||
gr_set_font(FONT1);
|
||||
light_reset();
|
||||
|
||||
g3_set_view_matrix(&eye_pos, &eye_orient, (Briefing_dialog ? Briefing_window_FOV : FRED_DEFAULT_HTL_FOV));
|
||||
if (Briefing_dialog) {
|
||||
g3_set_view_matrix(&eye_pos, &eye_orient, Briefing_window_FOV);
|
||||
} else {
|
||||
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
|
||||
}
|
||||
Viewer_pos = eye_pos; // for starfield code
|
||||
|
||||
fred_enable_htl();
|
||||
@@ -1608,7 +1598,11 @@ void render_frame()
|
||||
gr_set_clip(0, 0, True_rw, True_rh);
|
||||
|
||||
g3_start_frame(0); // ** Accounted for
|
||||
g3_set_view_matrix(&eye_pos, &eye_orient, (Briefing_dialog ? Briefing_window_FOV : FRED_DEFAULT_HTL_FOV));
|
||||
if (Briefing_dialog) {
|
||||
g3_set_view_matrix(&eye_pos, &eye_orient, Briefing_window_FOV);
|
||||
} else {
|
||||
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
void game_do_frame()
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "math/fvi.h" // For find_plane_line_intersection
|
||||
#include "math/vecmat.h"
|
||||
#include "io/key.h"
|
||||
#include "ai/ailocal.h"
|
||||
#include "ai/ai.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "ship/ship.h" // for ship names
|
||||
@@ -1467,9 +1468,9 @@ void CFREDView::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
|
||||
(UINT) species_submenu[i].m_hMenu, Species_info[i].species_name);
|
||||
}
|
||||
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
|
||||
species_submenu[it->species].AppendMenu(MF_STRING |
|
||||
MF_ENABLED, SHIP_TYPES + i, it->name);
|
||||
for (i=0; i<Num_ship_classes; i++)
|
||||
species_submenu[Ship_info[i].species].AppendMenu(MF_STRING |
|
||||
MF_ENABLED, SHIP_TYPES + i, Ship_info[i].name);
|
||||
|
||||
pPopup->AppendMenu(MF_STRING | MF_POPUP | MF_ENABLED,
|
||||
(UINT) shipPopup.m_hMenu, "New Object Type");
|
||||
@@ -1619,7 +1620,7 @@ BOOL CFREDView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO*
|
||||
int id = (int) nID;
|
||||
|
||||
if (!pHandlerInfo) {
|
||||
if ((id >= SHIP_TYPES) && (id < SHIP_TYPES + static_cast<int>(Ship_info.size()) + 3)) {
|
||||
if ((id >= SHIP_TYPES) && (id < SHIP_TYPES + Num_ship_classes + 3)) {
|
||||
if (nCode == CN_COMMAND) {
|
||||
cur_model_index = id - SHIP_TYPES;
|
||||
m_new_ship_type_combo_box.SetCurSelNEW(cur_model_index);
|
||||
@@ -2453,7 +2454,7 @@ int CFREDView::global_error_check()
|
||||
}
|
||||
|
||||
z = Ships[i].ship_info_index;
|
||||
if ((z < 0) || (z >= static_cast<int>(Ship_info.size()))){
|
||||
if ((z < 0) || (z >= Num_ship_classes)){
|
||||
return internal_error("A ship has an illegal class");
|
||||
}
|
||||
|
||||
|
||||
+10
-11
@@ -55,7 +55,7 @@ END_MESSAGE_MAP()
|
||||
|
||||
BOOL InitialShips::OnInitDialog()
|
||||
{
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
@@ -63,13 +63,12 @@ BOOL InitialShips::OnInitDialog()
|
||||
// change the window text, get the index into the array, and check the box for either the ships
|
||||
// or weapons
|
||||
if ( m_initial_items == INITIAL_SHIPS ) {
|
||||
for ( auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it ) {
|
||||
if ( it->flags & SIF_PLAYER_SHIP ) {
|
||||
i = std::distance(Ship_info.cbegin(), it);
|
||||
m_initial_list.AddString( it->name );
|
||||
for ( i = 0; i < Num_ship_classes; i++ ) {
|
||||
if ( Ship_info[i].flags & SIF_PLAYER_SHIP ) {
|
||||
m_initial_list.AddString( Ship_info[i].name );
|
||||
if ( Campaign.ships_allowed[i] ) {
|
||||
m_initial_list.SetCheck(m_list_count, 1);
|
||||
} else if ( (strlen(Campaign.filename) == 0) && strstr(it->name, "Myrmidon") ) { //-V805
|
||||
} else if ( (strlen(Campaign.filename) == 0) && strstr(Ship_info[i].name, "Myrmidon") ) { //-V805
|
||||
m_initial_list.SetCheck(m_list_count, 1);
|
||||
} else {
|
||||
m_initial_list.SetCheck(m_list_count, 0);
|
||||
@@ -87,11 +86,11 @@ BOOL InitialShips::OnInitDialog()
|
||||
int allowed_weapons[MAX_WEAPON_TYPES];
|
||||
|
||||
memset( allowed_weapons, 0, sizeof(allowed_weapons) );
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
|
||||
if ( it->flags & SIF_PLAYER_SHIP ) {
|
||||
for ( i = 0; i < MAX_WEAPON_TYPES; i++ ) {
|
||||
if ( it->allowed_weapons[i] )
|
||||
allowed_weapons[i] = 1;
|
||||
for (i = 0; i < Num_ship_classes; i++ ) {
|
||||
if ( Ship_info[i].flags & SIF_PLAYER_SHIP ) {
|
||||
for ( j = 0; j < MAX_WEAPON_TYPES; j++ ) {
|
||||
if ( Ship_info[i].allowed_weapons[j] )
|
||||
allowed_weapons[j] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,7 +848,7 @@ void initial_status::list_dockees(int dock_types)
|
||||
|
||||
// add "nothing"
|
||||
z = cboDockees->AddString("Nothing");
|
||||
cboDockees->SetItemData(z, static_cast<DWORD_PTR>(-1));
|
||||
cboDockees->SetItemData(z, -1);
|
||||
|
||||
// add ships
|
||||
for (object *objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp))
|
||||
|
||||
+10
-9
@@ -344,6 +344,7 @@ void CMainFrame::OnClose()
|
||||
|
||||
void CMainFrame::init_tools()
|
||||
{
|
||||
int i;
|
||||
//int highest_terran_index;
|
||||
//char ship_name[256];
|
||||
//int ship_index;
|
||||
@@ -358,14 +359,14 @@ void CMainFrame::init_tools()
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it){
|
||||
for (i=0; i<Num_ship_classes; i++){
|
||||
// don't add the pirate ship
|
||||
if(it->flags & SIF_NO_FRED){
|
||||
if(Ship_info[i].flags & SIF_NO_FRED){
|
||||
m_new_ship_type_combo_box.AddString("");
|
||||
continue;
|
||||
}
|
||||
|
||||
m_new_ship_type_combo_box.AddString(it->name);
|
||||
m_new_ship_type_combo_box.AddString(Ship_info[i].name);
|
||||
}
|
||||
|
||||
// m_new_ship_type_combo_box.AddString("Player Start");
|
||||
@@ -406,7 +407,7 @@ void color_combo_box::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||
|
||||
// I think we need to do a lookup by ship name here
|
||||
if(lpDrawItemStruct->itemID >= Ship_info.size()){
|
||||
if(lpDrawItemStruct->itemID >= (uint)Num_ship_classes){
|
||||
z = lpDrawItemStruct->itemID;
|
||||
} else {
|
||||
memset(ship_name, 0, 256);
|
||||
@@ -422,7 +423,7 @@ void color_combo_box::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||
COLORREF newTextColor = RGB(0x80, 0x80, 0x80); // light gray
|
||||
if (!fDisabled)
|
||||
{
|
||||
if (z >= static_cast<int>(Ship_info.size()))
|
||||
if (z >= Num_ship_classes)
|
||||
newTextColor = RGB(0, 0, 0);
|
||||
else
|
||||
{
|
||||
@@ -497,7 +498,7 @@ void color_combo_box::MeasureItem(LPMEASUREITEMSTRUCT)
|
||||
|
||||
int color_combo_box::SetCurSelNEW(int model_index)
|
||||
{
|
||||
if((model_index < 0) || (model_index >= static_cast<int>(Ship_info.size()))){
|
||||
if((model_index < 0) || (model_index >= Num_ship_classes)){
|
||||
return SetCurSel(model_index);
|
||||
}
|
||||
|
||||
@@ -512,9 +513,9 @@ int color_combo_box::GetCurSelNEW()
|
||||
char ship_name[256];
|
||||
char *hmmm = ship_name;
|
||||
|
||||
// see if we have a special item (>= Ship_info.size())
|
||||
// see if we have a special item (>= Num_ship_classes)
|
||||
cur_sel = GetCurSel();
|
||||
if(cur_sel >= static_cast<int>(Ship_info.size())){
|
||||
if(cur_sel >= Num_ship_classes){
|
||||
return cur_sel;
|
||||
}
|
||||
|
||||
@@ -524,7 +525,7 @@ int color_combo_box::GetCurSelNEW()
|
||||
return CB_ERR;
|
||||
}
|
||||
ship_info = ship_info_lookup(ship_name);
|
||||
if((ship_info < 0) || (ship_info >= static_cast<int>(Ship_info.size()))){
|
||||
if((ship_info < 0) || (ship_info >= Num_ship_classes)){
|
||||
return CB_ERR;
|
||||
}
|
||||
return ship_info;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "FREDDoc.h"
|
||||
#include "FREDView.h"
|
||||
#include "FredRender.h"
|
||||
#include "ai/ailocal.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "ship/ship.h"
|
||||
#include "globalincs/linklist.h"
|
||||
@@ -409,7 +410,6 @@ bool fred_init()
|
||||
armor_init();
|
||||
weapon_init();
|
||||
parse_medal_tbl(); // get medal names for sexpression usage
|
||||
glowpoint_init();
|
||||
ship_init();
|
||||
parse_init();
|
||||
techroom_intel_init();
|
||||
@@ -443,9 +443,9 @@ bool fred_init()
|
||||
// Get the default player ship
|
||||
Default_player_model = cur_model_index = get_default_player_ship_index();
|
||||
|
||||
Id_select_type_start = Ship_info.size() + 2;
|
||||
Id_select_type_jump_node = Ship_info.size() + 1;
|
||||
Id_select_type_waypoint = Ship_info.size();
|
||||
Id_select_type_start = Num_ship_classes + 2;
|
||||
Id_select_type_jump_node = Num_ship_classes + 1;
|
||||
Id_select_type_waypoint = Num_ship_classes;
|
||||
Fred_main_wnd -> init_tools();
|
||||
return true;
|
||||
}
|
||||
@@ -718,9 +718,9 @@ int create_object(vec3d *pos, int waypoint_instance)
|
||||
obj = create_player(Player_starts, pos, NULL, Default_player_model);
|
||||
|
||||
} else if (cur_model_index == Id_select_type_jump_node) {
|
||||
CJumpNode jnp(pos);
|
||||
obj = jnp.GetSCPObjectNumber();
|
||||
Jump_nodes.push_back(std::move(jnp));
|
||||
CJumpNode* jnp = new CJumpNode(pos);
|
||||
obj = jnp->GetSCPObjectNumber();
|
||||
Jump_nodes.push_back(*jnp);
|
||||
} else if(Ship_info[cur_model_index].flags & SIF_NO_FRED){
|
||||
obj = -1;
|
||||
} else { // creating a ship
|
||||
@@ -885,7 +885,7 @@ void clear_mission()
|
||||
// of ships for all teams
|
||||
for (i=0; i<MAX_TVT_TEAMS; i++) {
|
||||
count = 0;
|
||||
for ( j = 0; j < static_cast<int>(Ship_info.size()); j++ ) {
|
||||
for ( j = 0; j < MAX_SHIP_CLASSES; j++ ) {
|
||||
if (Ship_info[j].flags & SIF_DEFAULT_PLAYER_SHIP) {
|
||||
Team_data[i].ship_list[count] = j;
|
||||
strcpy_s(Team_data[i].ship_list_variables[count], "");
|
||||
|
||||
@@ -297,8 +297,6 @@ int CMessageEditorDlg::find_event()
|
||||
|
||||
for (i=0; i<Num_mission_events; i++) {
|
||||
node = Mission_events[i].formula;
|
||||
Assertion(node >= 0, "Can't have a formula point to sexp node -1!");
|
||||
|
||||
if ( get_operator_const(CTEXT(node)) == OP_WHEN || get_operator_const(CTEXT(node)) == OP_EVERY_TIME
|
||||
|| get_operator_const(CTEXT(node)) == OP_WHEN_ARGUMENT || get_operator_const(CTEXT(node)) == OP_EVERY_TIME_ARGUMENT
|
||||
|| get_operator_const(CTEXT(node)) == OP_IF_THEN_ELSE || get_operator_const(CTEXT(node)) == OP_PERFORM_ACTIONS )
|
||||
|
||||
+130
-125
@@ -96,20 +96,30 @@ void CFred_mission_save::convert_special_tags_to_retail()
|
||||
}
|
||||
}
|
||||
|
||||
void CFred_mission_save::save_mission_internal(const char *pathname)
|
||||
int CFred_mission_save::save_mission_file(char *pathname)
|
||||
{
|
||||
char backup_name[256], savepath[MAX_PATH_LEN], *p;
|
||||
CTime t;
|
||||
|
||||
t = CTime::GetCurrentTime();
|
||||
strcpy_s(The_mission.modified, t.Format("%x at %X"));
|
||||
|
||||
strcpy_s(savepath, "");
|
||||
p = strrchr(pathname, '\\');
|
||||
if ( p ) {
|
||||
*p = '\0';
|
||||
strcpy_s(savepath, pathname);
|
||||
*p = '\\';
|
||||
strcat_s(savepath, "\\");
|
||||
}
|
||||
strcat_s(savepath, "saving.xxx");
|
||||
|
||||
reset_parse();
|
||||
fred_parse_flag = 0;
|
||||
fp = cfopen(pathname, "wt", CFILE_NORMAL, CF_TYPE_MISSIONS);
|
||||
fp = cfopen(savepath, "wt", CFILE_NORMAL);
|
||||
if (!fp) {
|
||||
nprintf(("Error", "Can't open mission file to save.\n"));
|
||||
err = -1;
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
@@ -164,27 +174,10 @@ void CFred_mission_save::save_mission_internal(const char *pathname)
|
||||
}
|
||||
|
||||
cfclose(fp);
|
||||
if (err)
|
||||
if (err) {
|
||||
mprintf(("Mission saving error code #%d\n", err));
|
||||
}
|
||||
|
||||
int CFred_mission_save::save_mission_file(char *pathname)
|
||||
{
|
||||
char backup_name[256], savepath[MAX_PATH_LEN], *p;
|
||||
|
||||
strcpy_s(savepath, "");
|
||||
p = strrchr(pathname, '\\');
|
||||
if ( p ) {
|
||||
*p = '\0';
|
||||
strcpy_s(savepath, pathname);
|
||||
*p = '\\';
|
||||
strcat_s(savepath, "\\");
|
||||
}
|
||||
strcat_s(savepath, "saving.xxx");
|
||||
|
||||
save_mission_internal(savepath);
|
||||
|
||||
if (!err) {
|
||||
} else {
|
||||
strcpy_s(backup_name, pathname);
|
||||
if (backup_name[strlen(backup_name) - 4] == '.')
|
||||
backup_name[strlen(backup_name) - 4] = 0;
|
||||
@@ -203,6 +196,10 @@ int CFred_mission_save::autosave_mission_file(char *pathname)
|
||||
{
|
||||
char backup_name[256], name2[256];
|
||||
int i, len;
|
||||
CTime t;
|
||||
|
||||
t = CTime::GetCurrentTime();
|
||||
strcpy_s(The_mission.modified, t.Format("%x at %X"));
|
||||
|
||||
len = strlen(pathname);
|
||||
strcpy_s(backup_name, pathname);
|
||||
@@ -216,8 +213,68 @@ int CFred_mission_save::autosave_mission_file(char *pathname)
|
||||
}
|
||||
|
||||
strcpy(backup_name + len, ".001");
|
||||
reset_parse();
|
||||
fred_parse_flag = 0;
|
||||
fp = cfopen(backup_name, "wt", CFILE_NORMAL, CF_TYPE_MISSIONS);
|
||||
if (!fp) {
|
||||
nprintf(("Error", "Can't open mission file to save.\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
save_mission_internal(backup_name);
|
||||
// Goober5000
|
||||
convert_special_tags_to_retail();
|
||||
|
||||
if (save_mission_info())
|
||||
err = -2;
|
||||
else if (save_plot_info())
|
||||
err = -3;
|
||||
else if (save_variables())
|
||||
err = -3;
|
||||
// else if (save_briefing_info())
|
||||
// err = -4;
|
||||
else if (save_fiction())
|
||||
err = -3;
|
||||
else if (save_cutscenes())
|
||||
err = -4;
|
||||
else if (save_cmd_briefs())
|
||||
err = -4;
|
||||
else if (save_briefing())
|
||||
err = -4;
|
||||
else if (save_debriefing())
|
||||
err = -5;
|
||||
else if (save_players())
|
||||
err = -6;
|
||||
else if (save_objects())
|
||||
err = -7;
|
||||
else if (save_wings())
|
||||
err = -8;
|
||||
else if (save_events())
|
||||
err = -9;
|
||||
else if (save_goals())
|
||||
err = -10;
|
||||
else if (save_waypoints())
|
||||
err = -11;
|
||||
else if (save_messages())
|
||||
err = -12;
|
||||
else if (save_reinforcements())
|
||||
err = -13;
|
||||
else if (save_bitmaps())
|
||||
err = -14;
|
||||
else if (save_asteroid_fields())
|
||||
err = -15;
|
||||
else if (save_music())
|
||||
err = -16;
|
||||
else {
|
||||
required_string_fred("#End");
|
||||
parse_comments(2);
|
||||
token_found = NULL;
|
||||
parse_comments();
|
||||
fout("\n");
|
||||
}
|
||||
|
||||
cfclose(fp);
|
||||
if (err)
|
||||
mprintf(("Mission saving error code #%d\n", err));
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -478,7 +535,19 @@ int CFred_mission_save::save_mission_info()
|
||||
}
|
||||
}
|
||||
|
||||
save_custom_bitmap("$Load Screen 640:", "$Load Screen 1024:", The_mission.loading_screen[GR_640], The_mission.loading_screen[GR_1024], 1);
|
||||
// Phreak's loading screen stuff
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL) //-V581
|
||||
{
|
||||
if (strlen(The_mission.loading_screen[GR_640]) > 0) //-V805
|
||||
{
|
||||
fout("\n\n$Load Screen 640:\t%s",The_mission.loading_screen[GR_640]);
|
||||
}
|
||||
|
||||
if (strlen(The_mission.loading_screen[GR_1024]) > 0) //-V805
|
||||
{
|
||||
fout("\n$Load Screen 1024:\t%s",The_mission.loading_screen[GR_1024]);
|
||||
}
|
||||
}
|
||||
|
||||
// Phreak's skybox stuff
|
||||
if (strlen(The_mission.skybox_model) > 0) //-V805
|
||||
@@ -704,74 +773,40 @@ int CFred_mission_save::save_fiction()
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL)
|
||||
{
|
||||
if (optional_string_fred("#Fiction Viewer"))
|
||||
parse_comments(2);
|
||||
parse_comments();
|
||||
else
|
||||
fout("\n\n#Fiction Viewer");
|
||||
|
||||
// we have multiple stages now, so save them all
|
||||
for (SCP_vector<fiction_viewer_stage>::iterator stage = Fiction_viewer_stages.begin(); stage != Fiction_viewer_stages.end(); ++stage)
|
||||
fout("\n");
|
||||
|
||||
// save file
|
||||
required_string_fred("$File:");
|
||||
parse_comments();
|
||||
fout(" %s", fiction_file());
|
||||
|
||||
// save font
|
||||
if (strlen(fiction_font()) > 0) //-V805
|
||||
{
|
||||
fout("\n");
|
||||
|
||||
// save file
|
||||
required_string_fred("$File:");
|
||||
parse_comments();
|
||||
fout(" %s", stage->story_filename);
|
||||
|
||||
// save font
|
||||
if (strlen(stage->font_filename) > 0) //-V805
|
||||
{
|
||||
if (optional_string_fred("$Font:"))
|
||||
parse_comments();
|
||||
else
|
||||
fout("\n$Font:");
|
||||
fout(" %s", stage->font_filename);
|
||||
}
|
||||
if (optional_string_fred("$Font:"))
|
||||
parse_comments();
|
||||
else
|
||||
optional_string_fred("$Font:");
|
||||
|
||||
// save voice
|
||||
if (strlen(stage->voice_filename) > 0) //-V805
|
||||
{
|
||||
if (optional_string_fred("$Voice:"))
|
||||
parse_comments();
|
||||
else
|
||||
fout("\n$Voice:");
|
||||
fout(" %s", stage->voice_filename);
|
||||
}
|
||||
else
|
||||
optional_string_fred("$Voice:");
|
||||
|
||||
// save UI
|
||||
if (strlen(stage->ui_name) > 0)
|
||||
{
|
||||
if (optional_string_fred("$UI:"))
|
||||
parse_comments();
|
||||
else
|
||||
fout("\n$UI:");
|
||||
fout(" %s", stage->ui_name);
|
||||
}
|
||||
else
|
||||
optional_string_fred("$UI:");
|
||||
|
||||
// save background
|
||||
save_custom_bitmap("$Background 640:", "$Background 1024:", stage->background[GR_640], stage->background[GR_1024]);
|
||||
|
||||
// save sexp formula if we have one
|
||||
if (stage->formula >= 0 && stage->formula != Locked_sexp_true)
|
||||
{
|
||||
SCP_string sexp_out;
|
||||
convert_sexp_to_string(sexp_out, stage->formula, SEXP_SAVE_MODE);
|
||||
|
||||
if (optional_string_fred("$Formula:"))
|
||||
parse_comments();
|
||||
else
|
||||
fout("\n$Formula:");
|
||||
fout(" %s", sexp_out.c_str());
|
||||
}
|
||||
else
|
||||
optional_string_fred("$Formula:");
|
||||
fout("\n$Font:");
|
||||
fout(" %s", fiction_font());
|
||||
}
|
||||
else
|
||||
optional_string_fred("$Font:");
|
||||
|
||||
// save voice
|
||||
if (strlen(fiction_voice()) > 0) //-V805
|
||||
{
|
||||
if (optional_string_fred("$Voice:"))
|
||||
parse_comments();
|
||||
else
|
||||
fout("\n$Voice:");
|
||||
fout(" %s", fiction_voice());
|
||||
}
|
||||
else
|
||||
optional_string_fred("$Voice:");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -795,8 +830,6 @@ int CFred_mission_save::save_cmd_brief()
|
||||
if (The_mission.game_type & MISSION_TYPE_MULTI)
|
||||
return err; // no command briefings allowed in multiplayer missions.
|
||||
|
||||
save_custom_bitmap("$Background 640:", "$Background 1024:", Cur_cmd_brief->background[GR_640], Cur_cmd_brief->background[GR_1024], 1);
|
||||
|
||||
for (stage=0; stage<Cur_cmd_brief->num_stages; stage++) {
|
||||
required_string_fred("$Stage Text:");
|
||||
parse_comments(2);
|
||||
@@ -850,10 +883,6 @@ int CFred_mission_save::save_briefing()
|
||||
required_string_fred("$start_briefing");
|
||||
parse_comments();
|
||||
|
||||
save_custom_bitmap("$briefing_background_640:", "$briefing_background_1024:", Briefings[nb].background[GR_640], Briefings[nb].background[GR_1024]);
|
||||
save_custom_bitmap("$ship_select_background_640:", "$ship_select_background_1024:", Briefings[nb].ship_select_background[GR_640], Briefings[nb].ship_select_background[GR_1024]);
|
||||
save_custom_bitmap("$weapon_select_background_640:", "$weapon_select_background_1024:", Briefings[nb].weapon_select_background[GR_640], Briefings[nb].weapon_select_background[GR_1024]);
|
||||
|
||||
Assert(Briefings[nb].num_stages <= MAX_BRIEF_STAGES);
|
||||
required_string_fred("$num_stages:");
|
||||
parse_comments();
|
||||
@@ -1026,8 +1055,6 @@ int CFred_mission_save::save_debriefing()
|
||||
required_string_fred("#Debriefing_info");
|
||||
parse_comments(2);
|
||||
|
||||
save_custom_bitmap("$Background 640:", "$Background 1024:", Debriefing->background[GR_640], Debriefing->background[GR_1024], 1);
|
||||
|
||||
required_string_fred("$Num stages:");
|
||||
parse_comments(2);
|
||||
fout(" %d", Debriefing->num_stages);
|
||||
@@ -2975,7 +3002,7 @@ int CFred_mission_save::fout_version(char *format, ...)
|
||||
str_scp.append(fso_ver_comment.back().c_str());
|
||||
str_scp.append(" ");
|
||||
|
||||
cfputs(str_scp.c_str(), fp);
|
||||
cfputs(const_cast<char*>(str_scp.c_str()), fp);
|
||||
|
||||
str_scp = "";
|
||||
}
|
||||
@@ -3002,7 +3029,7 @@ int CFred_mission_save::fout_version(char *format, ...)
|
||||
if (first_line) {
|
||||
first_line = false;
|
||||
} else {
|
||||
cfputs(fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs(" ", fp);
|
||||
}
|
||||
|
||||
@@ -3014,7 +3041,7 @@ int CFred_mission_save::fout_version(char *format, ...)
|
||||
if (first_line) {
|
||||
first_line = false;
|
||||
} else {
|
||||
cfputs(fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs(" ", fp);
|
||||
}
|
||||
|
||||
@@ -3028,7 +3055,7 @@ int CFred_mission_save::fout_version(char *format, ...)
|
||||
|
||||
// be sure to account for any ending elements too
|
||||
if ( strlen(str_p) ) {
|
||||
cfputs(fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs(" ", fp);
|
||||
cfputs(str_p, fp);
|
||||
}
|
||||
@@ -3057,7 +3084,7 @@ int CFred_mission_save::fout(char *format, ...)
|
||||
vsprintf(str, format, args);
|
||||
va_end(args);
|
||||
|
||||
cfputs(str.c_str(), fp);
|
||||
cfputs(const_cast<char*>(str.c_str()), fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3122,7 +3149,7 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
|
||||
if (first_line) {
|
||||
first_line = false;
|
||||
} else {
|
||||
cfputs(fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs(" ", fp);
|
||||
}
|
||||
|
||||
@@ -3134,7 +3161,7 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
|
||||
if (first_line) {
|
||||
first_line = false;
|
||||
} else {
|
||||
cfputs(fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs(" ", fp);
|
||||
}
|
||||
|
||||
@@ -3148,7 +3175,7 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
|
||||
|
||||
// be sure to account for any ending elements too
|
||||
if ( strlen(str_p) ) {
|
||||
cfputs(fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs(" ", fp);
|
||||
cfputs(str_p, fp);
|
||||
}
|
||||
@@ -3856,28 +3883,6 @@ int CFred_mission_save::save_music()
|
||||
return err;
|
||||
}
|
||||
|
||||
void CFred_mission_save::save_custom_bitmap(const char *expected_string_640, const char *expected_string_1024, const char *string_field_640, const char *string_field_1024, int blank_lines)
|
||||
{
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL)
|
||||
{
|
||||
if ((*string_field_640 != '\0') || (*string_field_1024 != '\0'))
|
||||
{
|
||||
while (blank_lines-- > 0)
|
||||
fout("\n");
|
||||
}
|
||||
|
||||
if (*string_field_640 != '\0')
|
||||
{
|
||||
fout("\n%s %s", expected_string_640, string_field_640);
|
||||
}
|
||||
|
||||
if (*string_field_1024 != '\0')
|
||||
{
|
||||
fout("\n%s %s", expected_string_1024, string_field_1024);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFred_mission_save::save_turret_info(ship_subsys *ptr, int ship)
|
||||
{
|
||||
int i, z;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <stdio.h>
|
||||
#include "mission/missionparse.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "ai/ailocal.h"
|
||||
#include "ai/ai.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "ship/ship.h"
|
||||
@@ -56,15 +57,11 @@ private:
|
||||
int save_music();
|
||||
void save_campaign_sexp(int node, int link);
|
||||
void save_single_dock_instance(ship *shipp, dock_instance *dock_ptr);
|
||||
|
||||
void save_custom_bitmap(const char *expected_string_640, const char *expected_string_1024, const char *string_field_640, const char *string_field_1024, int blank_lines = 0);
|
||||
|
||||
void convert_special_tags_to_retail(char *text, int max_len);
|
||||
void convert_special_tags_to_retail(SCP_string &text);
|
||||
void convert_special_tags_to_retail();
|
||||
|
||||
void save_mission_internal(const char *pathname);
|
||||
|
||||
public:
|
||||
void save_turret_info(ship_subsys *ptr, int ship);
|
||||
int save_bitmaps();
|
||||
|
||||
@@ -283,10 +283,9 @@ void player_start_editor::reset_controls()
|
||||
// create a checklistbox for each "player" ship type
|
||||
m_ship_list.ResetContent();
|
||||
ct = 0;
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
|
||||
if (it->flags & SIF_PLAYER_SHIP) {
|
||||
i = std::distance(Ship_info.cbegin(), it);
|
||||
m_ship_list.AddString(it->name);
|
||||
for (i=0; i<Num_ship_classes; i++) {
|
||||
if (Ship_info[i].flags & SIF_PLAYER_SHIP) {
|
||||
m_ship_list.AddString(Ship_info[i].name);
|
||||
|
||||
// if the ship currently has pool entries or was set by a variable, check it
|
||||
if((static_ship_pool[selected_team][i] > 0) || (static_ship_variable_pool[selected_team][i] != -1)) {
|
||||
@@ -809,7 +808,7 @@ void player_start_editor::OnOK()
|
||||
|
||||
// Now we deal with the loadout ships that are statically assigned by class
|
||||
|
||||
for (idx = 0; idx < static_cast<int>(Ship_info.size()); idx++) {
|
||||
for(idx=0; idx<Num_ship_classes; idx++) {
|
||||
// if we have ships here
|
||||
if(static_ship_pool[i][idx] > 0 || static_ship_variable_pool[i][idx] > -1) {
|
||||
Team_data[i].ship_list[num_choices] = idx;
|
||||
|
||||
Executable → Regular
+11
-8
@@ -2797,7 +2797,7 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
return (sexp_variable_count() > 0) ? 1 : 0;
|
||||
|
||||
case OPF_SSM_CLASS:
|
||||
return (Ssm_info.size() > 0) ? 1 : 0;
|
||||
return (Ssm_info_count > 0) ? 1 : 0;
|
||||
|
||||
case OPF_MISSION_MOOD:
|
||||
return Builtin_moods.empty() ? 0 : 1;
|
||||
@@ -5040,15 +5040,16 @@ sexp_list_item *sexp_tree::get_listing_opf_ai_class()
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_support_ship_class()
|
||||
{
|
||||
int i;
|
||||
sexp_list_item head;
|
||||
|
||||
head.add_data("<species support ship class>");
|
||||
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
|
||||
for (i=0; i<Num_ship_classes; i++)
|
||||
{
|
||||
if (it->flags & SIF_SUPPORT)
|
||||
if (Ship_info[i].flags & SIF_SUPPORT)
|
||||
{
|
||||
head.add_data(it->name);
|
||||
head.add_data(Ship_info[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5057,11 +5058,12 @@ sexp_list_item *sexp_tree::get_listing_opf_support_ship_class()
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_ssm_class()
|
||||
{
|
||||
int i;
|
||||
sexp_list_item head;
|
||||
|
||||
for (auto it = Ssm_info.cbegin(); it != Ssm_info.cend(); ++it)
|
||||
for (i=0; i<Ssm_info_count; i++)
|
||||
{
|
||||
head.add_data(it->name);
|
||||
head.add_data(Ssm_info[i].name);
|
||||
}
|
||||
|
||||
return head.next;
|
||||
@@ -5696,10 +5698,11 @@ sexp_list_item *sexp_tree::get_listing_opf_intel_name()
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_ship_class_name()
|
||||
{
|
||||
int i;
|
||||
sexp_list_item head;
|
||||
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
|
||||
head.add_data(it->name);
|
||||
for (i=0; i<Num_ship_classes; i++)
|
||||
head.add_data(Ship_info[i].name);
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ BOOL shield_sys_dlg::OnInitDialog()
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_TYPE);
|
||||
box->ResetContent();
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
|
||||
box->AddString(it->name);
|
||||
for (i=0; i<Num_ship_classes; i++)
|
||||
box->AddString(Ship_info[i].name);
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_TEAM);
|
||||
box->ResetContent();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "render/3d.h"
|
||||
#include "physics/physics.h"
|
||||
#include "editor.h"
|
||||
#include "ai/ailocal.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "Management.h"
|
||||
@@ -263,8 +264,8 @@ BOOL CShipEditorDlg::Create()
|
||||
|
||||
ptr = (CComboBox *) GetDlgItem(IDC_SHIP_CLASS);
|
||||
ptr->ResetContent();
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.end(); ++it){
|
||||
ptr->AddString(it->name);
|
||||
for (i=0; i<Num_ship_classes; i++){
|
||||
ptr->AddString(Ship_info[i].name);
|
||||
}
|
||||
|
||||
ptr = (CComboBox *) GetDlgItem(IDC_AI_CLASS);
|
||||
@@ -586,7 +587,7 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
m_score.init(Ships[i].score);
|
||||
m_assist_score.init((int)(Ships[i].assist_score_pct*100));
|
||||
|
||||
m_persona = Ships[i].persona_index;
|
||||
m_persona = Ships[i].persona_index + 1;
|
||||
|
||||
// we use final_death_time member of ship structure for holding the amount of time before a mission
|
||||
// to destroy this ship
|
||||
@@ -624,8 +625,8 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
m_hotkey = -1;
|
||||
}
|
||||
|
||||
if ( Ships[i].persona_index != m_persona ){
|
||||
m_persona = -2;
|
||||
if ( Ships[i].persona_index != (m_persona-1) ){
|
||||
m_persona = -1;
|
||||
}
|
||||
|
||||
if (Ships[i].wingnum != wing){
|
||||
@@ -677,16 +678,6 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
}
|
||||
}
|
||||
|
||||
m_persona++;
|
||||
if (m_persona > 0) {
|
||||
int persona_index = 0;
|
||||
for (int i = 0; i < m_persona; i++) {
|
||||
if (Personas[i].flags & PERSONA_FLAG_WINGMAN)
|
||||
persona_index++;
|
||||
}
|
||||
m_persona = persona_index;
|
||||
}
|
||||
|
||||
} else { // no ships selected, 0 or more player ships selected
|
||||
if (player_count > 1) { // multiple player ships selected
|
||||
Assert(base_player >= 0);
|
||||
|
||||
@@ -718,7 +718,7 @@ int VoiceActingManager::fout(char *format, ...)
|
||||
vsprintf(str, format, args);
|
||||
va_end(args);
|
||||
|
||||
cfputs(str.c_str(), fp);
|
||||
cfputs(const_cast<char*>(str.c_str()), fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +87,7 @@ void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
|
||||
if (pDX->m_bSaveAndValidate) {
|
||||
GetDlgItem(IDC_AMMO1)->GetWindowText(str);
|
||||
if (save_number((char *) (LPCSTR) str, &m_ammo1)) {
|
||||
if (m_missile1 <= 0) {
|
||||
m_ammo_max1 = 0;
|
||||
} else {
|
||||
m_ammo_max1 = (m_cur_item == 0) ? get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1) : get_max_ammo_count_for_turret_bank(cur_weapon, 0, m_missile1 + First_secondary_index - 1);
|
||||
}
|
||||
m_ammo_max1 = (m_missile1 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
|
||||
if (m_ammo1 < 0)
|
||||
m_ammo1 = 0;
|
||||
if (m_ammo1 > m_ammo_max1)
|
||||
@@ -100,11 +96,7 @@ void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
|
||||
|
||||
GetDlgItem(IDC_AMMO2)->GetWindowText(str);
|
||||
if (save_number((char *) (LPCSTR) str, &m_ammo2)) {
|
||||
if (m_missile2 <= 0) {
|
||||
m_ammo_max2 = 0;
|
||||
} else {
|
||||
m_ammo_max2 = (m_cur_item == 0) ? get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 + First_secondary_index - 1) : get_max_ammo_count_for_turret_bank(cur_weapon, 1, m_missile2 + First_secondary_index - 1);
|
||||
}
|
||||
m_ammo_max2 = (m_missile2 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 + First_secondary_index - 1);
|
||||
if (m_ammo2 < 0)
|
||||
m_ammo2 = 0;
|
||||
if (m_ammo2 > m_ammo_max2)
|
||||
@@ -113,11 +105,7 @@ void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
|
||||
|
||||
GetDlgItem(IDC_AMMO3)->GetWindowText(str);
|
||||
if (save_number((char *) (LPCSTR) str, &m_ammo3)) {
|
||||
if (m_missile3 <= 0) {
|
||||
m_ammo_max3 = 0;
|
||||
} else {
|
||||
m_ammo_max3 = (m_cur_item == 0) ? get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 + First_secondary_index - 1) : get_max_ammo_count_for_turret_bank(cur_weapon, 2, m_missile3 + First_secondary_index - 1);
|
||||
}
|
||||
m_ammo_max3 = (m_missile3 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 + First_secondary_index - 1);
|
||||
if (m_ammo3 < 0)
|
||||
m_ammo3 = 0;
|
||||
if (m_ammo3 > m_ammo_max3)
|
||||
@@ -126,11 +114,7 @@ void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
|
||||
|
||||
GetDlgItem(IDC_AMMO4)->GetWindowText(str);
|
||||
if (save_number((char *) (LPCSTR) str, &m_ammo4)) {
|
||||
if (m_missile4 <= 0) {
|
||||
m_ammo_max4 = 0;
|
||||
} else {
|
||||
m_ammo_max4 = (m_cur_item == 0) ? get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 + First_secondary_index - 1) : get_max_ammo_count_for_turret_bank(cur_weapon, 3, m_missile4 + First_secondary_index - 1);
|
||||
}
|
||||
m_ammo_max4 = (m_missile4 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 + First_secondary_index - 1);
|
||||
if (m_ammo4 < 0)
|
||||
m_ammo4 = 0;
|
||||
if (m_ammo4 > m_ammo_max4)
|
||||
@@ -419,11 +403,7 @@ void WeaponEditorDlg::change_selection()
|
||||
if (cur_weapon->num_secondary_banks > 0) {
|
||||
m_missile1 = cur_weapon->secondary_bank_weapons[0] + 1;
|
||||
if (m_missile1 > 0) {
|
||||
if (m_cur_item == 0) {
|
||||
m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 - 1);
|
||||
} else {
|
||||
m_ammo_max1 = get_max_ammo_count_for_turret_bank(cur_weapon, 0, m_missile1 - 1);
|
||||
}
|
||||
m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 - 1);
|
||||
if (cur_weapon->secondary_bank_ammo[0] != BLANK_FIELD)
|
||||
m_ammo1 = cur_weapon->secondary_bank_ammo[0] * m_ammo_max1 / 100;
|
||||
m_missile1 -= First_secondary_index;
|
||||
@@ -442,11 +422,7 @@ void WeaponEditorDlg::change_selection()
|
||||
if (cur_weapon->num_secondary_banks > 1) {
|
||||
m_missile2 = cur_weapon->secondary_bank_weapons[1] + 1;
|
||||
if (m_missile2 > 0) {
|
||||
if (m_cur_item == 0) {
|
||||
m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 - 1);
|
||||
} else {
|
||||
m_ammo_max2 = get_max_ammo_count_for_turret_bank(cur_weapon, 1, m_missile2 - 1);
|
||||
}
|
||||
m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 - 1);
|
||||
if (cur_weapon->secondary_bank_ammo[1] != BLANK_FIELD)
|
||||
m_ammo2 = cur_weapon->secondary_bank_ammo[1] * m_ammo_max2 / 100;
|
||||
m_missile2 -= First_secondary_index;
|
||||
@@ -465,11 +441,7 @@ void WeaponEditorDlg::change_selection()
|
||||
if (cur_weapon->num_secondary_banks > 2) {
|
||||
m_missile3 = cur_weapon->secondary_bank_weapons[2] + 1;
|
||||
if (m_missile3 > 0) {
|
||||
if (m_cur_item == 0) {
|
||||
m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 - 1);
|
||||
} else {
|
||||
m_ammo_max3 = get_max_ammo_count_for_turret_bank(cur_weapon, 2, m_missile3 - 1);
|
||||
}
|
||||
m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 - 1);
|
||||
if (cur_weapon->secondary_bank_ammo[2] != BLANK_FIELD)
|
||||
m_ammo3 = cur_weapon->secondary_bank_ammo[2] * m_ammo_max3 / 100;
|
||||
m_missile3 -= First_secondary_index;
|
||||
@@ -488,11 +460,7 @@ void WeaponEditorDlg::change_selection()
|
||||
if (cur_weapon->num_secondary_banks > 3) {
|
||||
m_missile4 = cur_weapon->secondary_bank_weapons[3] + 1;
|
||||
if (m_missile4 > 0) {
|
||||
if (m_cur_item == 0) {
|
||||
m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 - 1);
|
||||
} else {
|
||||
m_ammo_max4 = get_max_ammo_count_for_turret_bank(cur_weapon, 3, m_missile4 - 1);
|
||||
}
|
||||
m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 - 1);
|
||||
if (cur_weapon->secondary_bank_ammo[3] != BLANK_FIELD)
|
||||
m_ammo4 = cur_weapon->secondary_bank_ammo[3] * m_ammo_max4 / 100;
|
||||
m_missile4 -= First_secondary_index;
|
||||
@@ -585,11 +553,7 @@ void WeaponEditorDlg::OnSelchangeMissile1()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
UpdateData(TRUE);
|
||||
if (m_cur_item == 0) {
|
||||
m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
|
||||
} else {
|
||||
m_ammo_max1 = get_max_ammo_count_for_turret_bank(cur_weapon, 0, m_missile1 + First_secondary_index - 1);
|
||||
}
|
||||
m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
|
||||
m_ammo1 = m_ammo_max1 ? (m_ammo_max1) : 0;
|
||||
change_selection();
|
||||
}
|
||||
@@ -598,11 +562,7 @@ void WeaponEditorDlg::OnSelchangeMissile2()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
UpdateData(TRUE);
|
||||
if (m_cur_item == 0) {
|
||||
m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 + First_secondary_index - 1);
|
||||
} else {
|
||||
m_ammo_max2 = get_max_ammo_count_for_turret_bank(cur_weapon, 1, m_missile2 + First_secondary_index - 1);
|
||||
}
|
||||
m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile2 + First_secondary_index - 1);
|
||||
m_ammo2 = m_ammo_max2 ? (m_ammo_max2) : 0;
|
||||
change_selection();
|
||||
}
|
||||
@@ -611,11 +571,7 @@ void WeaponEditorDlg::OnSelchangeMissile3()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
UpdateData(TRUE);
|
||||
if (m_cur_item == 0) {
|
||||
m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 + First_secondary_index - 1);
|
||||
} else {
|
||||
m_ammo_max3 = get_max_ammo_count_for_turret_bank(cur_weapon, 2, m_missile3 + First_secondary_index - 1);
|
||||
}
|
||||
m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile3 + First_secondary_index - 1);
|
||||
m_ammo3 = m_ammo_max3 ? (m_ammo_max3) : 0;
|
||||
change_selection();
|
||||
}
|
||||
@@ -624,11 +580,7 @@ void WeaponEditorDlg::OnSelchangeMissile4()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
UpdateData(TRUE);
|
||||
if (m_cur_item == 0) {
|
||||
m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 + First_secondary_index - 1);
|
||||
} else {
|
||||
m_ammo_max4 = get_max_ammo_count_for_turret_bank(cur_weapon, 3, m_missile4 + First_secondary_index - 1);
|
||||
}
|
||||
m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile4 + First_secondary_index - 1);
|
||||
m_ammo4 = m_ammo_max4 ? (m_ammo_max4) : 0;
|
||||
change_selection();
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "physics/physics.h"
|
||||
#include "object/object.h"
|
||||
#include "editor.h"
|
||||
#include "ai/ailocal.h"
|
||||
#include "ship/ship.h"
|
||||
#include "math/vecmat.h"
|
||||
#include "Management.h"
|
||||
|
||||
+88
-112
@@ -26,6 +26,7 @@
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "autopilot/autopilot.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "camera/camera.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "cmeasure/cmeasure.h"
|
||||
@@ -39,26 +40,24 @@
|
||||
#include "freespace2/freespace.h"
|
||||
#include "freespace2/freespaceresource.h"
|
||||
#include "freespace2/levelpaging.h"
|
||||
#include "fs2netd/fs2netd_client.h"
|
||||
#include "gamehelp/contexthelp.h"
|
||||
#include "gamehelp/gameplayhelp.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
#include "gamesnd/eventmusic.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "globalincs/mspdb_callstack.h"
|
||||
#include "globalincs/version.h"
|
||||
#include "globalincs/mspdb_callstack.h"
|
||||
#include "graphics/font.h"
|
||||
#include "graphics/shadows.h"
|
||||
#include "hud/hud.h"
|
||||
#include "hud/hudconfig.h"
|
||||
#include "hud/hudescort.h"
|
||||
#include "hud/hudlock.h"
|
||||
#include "hud/hudmessage.h"
|
||||
#include "hud/hudparse.h"
|
||||
#include "hud/hudshield.h"
|
||||
#include "hud/hudsquadmsg.h"
|
||||
#include "hud/hudtargetbox.h"
|
||||
#include "hud/hudparse.h"
|
||||
#include "hud/hudsquadmsg.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "io/joy.h"
|
||||
#include "io/joy_ff.h"
|
||||
@@ -130,7 +129,6 @@
|
||||
#include "parse/scripting.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "particle/particle.h"
|
||||
#include "pilotfile/pilotfile.h"
|
||||
#include "playerman/managepilot.h"
|
||||
#include "playerman/player.h"
|
||||
#include "popup/popup.h"
|
||||
@@ -159,18 +157,16 @@
|
||||
#include "weapon/muzzleflash.h"
|
||||
#include "weapon/shockwave.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "fs2netd/fs2netd_client.h"
|
||||
#include "pilotfile/pilotfile.h"
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
extern int Om_tracker_flag; // needed for FS2OpenPXO config
|
||||
|
||||
#ifdef WIN32
|
||||
// According to AMD and NV, these _should_ force their drivers into high-performance mode
|
||||
extern "C" {
|
||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NDEBUG
|
||||
#ifdef FRED
|
||||
@@ -462,7 +458,7 @@ fs_builtin_mission Game_builtin_mission_list[MAX_BUILTIN_MISSIONS] = {
|
||||
// Internal function prototypes
|
||||
void game_maybe_draw_mouse(float frametime);
|
||||
void init_animating_pointer();
|
||||
void load_animating_pointer(char *filename);
|
||||
void load_animating_pointer(char *filename, int dx, int dy);
|
||||
void unload_animating_pointer();
|
||||
void game_do_training_checks();
|
||||
void game_shutdown(void);
|
||||
@@ -578,7 +574,7 @@ void game_framerate_check_init()
|
||||
extern float Framerate;
|
||||
void game_framerate_check()
|
||||
{
|
||||
int y_start = gr_screen.center_offset_y + 100;
|
||||
int y_start = 100;
|
||||
|
||||
// if the current framerate is above the critical level, add frametime
|
||||
if(Framerate >= Gf_critical){
|
||||
@@ -592,7 +588,7 @@ void game_framerate_check()
|
||||
// display if we're above the critical framerate
|
||||
if(Framerate < Gf_critical){
|
||||
gr_set_color_fast(&Color_bright_red);
|
||||
gr_string(gr_screen.center_offset_x + 200, y_start, "Framerate warning", GR_RESIZE_NONE);
|
||||
gr_string(200, y_start, "Framerate warning", GR_RESIZE_NONE);
|
||||
|
||||
y_start += 10;
|
||||
}
|
||||
@@ -607,7 +603,7 @@ void game_framerate_check()
|
||||
gr_set_color_fast(&Color_bright_red);
|
||||
}
|
||||
|
||||
gr_printf_no_resize(gr_screen.center_offset_x + 200, y_start, "%d%%", (int)pct);
|
||||
gr_printf_no_resize(200, y_start, "%d%%", (int)pct);
|
||||
|
||||
y_start += 10;
|
||||
}
|
||||
@@ -752,9 +748,7 @@ void game_sunspot_process(float frametime)
|
||||
|
||||
// check
|
||||
for(idx=0; idx<n_lights; idx++) {
|
||||
bool in_shadow = shipfx_eye_in_shadow(&Eye_position, Viewer_obj, idx);
|
||||
|
||||
if ( (ls_on && !ls_force_off) || !in_shadow ) {
|
||||
if ( (ls_on && !ls_force_off) || !shipfx_eye_in_shadow( &Eye_position, Viewer_obj, idx ) ) {
|
||||
vec3d light_dir;
|
||||
light_get_global_dir(&light_dir, idx);
|
||||
|
||||
@@ -764,10 +758,10 @@ void game_sunspot_process(float frametime)
|
||||
Sun_spot_goal += (float)pow(dot,85.0f);
|
||||
}
|
||||
}
|
||||
if ( !in_shadow ) {
|
||||
// draw the glow for this sun
|
||||
stars_draw_sun_glow(idx);
|
||||
}
|
||||
if (!shipfx_eye_in_shadow( &Eye_position, Viewer_obj, idx ) ) {
|
||||
// draw the glow for this sun
|
||||
stars_draw_sun_glow(idx);
|
||||
}
|
||||
}
|
||||
|
||||
Sun_drew = 0;
|
||||
@@ -1265,7 +1259,7 @@ void game_loading_callback_close()
|
||||
// Make sure bar shows all the way over.
|
||||
game_loading_callback(COUNT_ESTIMATE);
|
||||
|
||||
int real_count __UNUSED = game_busy_callback( NULL );
|
||||
int real_count = game_busy_callback( NULL );
|
||||
Mouse_hidden = 0;
|
||||
|
||||
Game_loading_callback_inited = 0;
|
||||
@@ -1429,7 +1423,7 @@ int game_start_mission()
|
||||
{
|
||||
mprintf(( "=================== STARTING LEVEL LOAD ==================\n" ));
|
||||
|
||||
int s1 __UNUSED = timer_get_milliseconds();
|
||||
int s1 = timer_get_milliseconds();
|
||||
|
||||
// clear post processing settings
|
||||
gr_post_process_set_defaults();
|
||||
@@ -1486,7 +1480,7 @@ int game_start_mission()
|
||||
|
||||
bm_print_bitmaps();
|
||||
|
||||
int e1 __UNUSED = timer_get_milliseconds();
|
||||
int e1 = timer_get_milliseconds();
|
||||
|
||||
mprintf(("Level load took %f seconds.\n", (e1 - s1) / 1000.0f ));
|
||||
|
||||
@@ -1745,7 +1739,7 @@ char full_path[1024];
|
||||
*/
|
||||
void game_init()
|
||||
{
|
||||
int s1 __UNUSED, e1 __UNUSED;
|
||||
int s1, e1;
|
||||
const char *ptr;
|
||||
char whee[MAX_PATH_LEN];
|
||||
|
||||
@@ -2026,8 +2020,7 @@ void game_init()
|
||||
armor_init();
|
||||
ai_init();
|
||||
ai_profiles_init(); // Goober5000
|
||||
weapon_init();
|
||||
glowpoint_init();
|
||||
weapon_init();
|
||||
ship_init(); // read in ships.tbl
|
||||
|
||||
player_init();
|
||||
@@ -2055,7 +2048,7 @@ void game_init()
|
||||
pilot_load_pic_list();
|
||||
pilot_load_squad_pic_list();
|
||||
|
||||
load_animating_pointer(NOX("cursor"));
|
||||
load_animating_pointer(NOX("cursor"), 0, 0);
|
||||
|
||||
if(!Cmdline_reparse_mainhall)
|
||||
{
|
||||
@@ -2165,11 +2158,11 @@ void game_show_framerate()
|
||||
for ( pss = GET_FIRST(&shipp->subsys_list); pss !=END_OF_LIST(&shipp->subsys_list); pss = GET_NEXT(pss) ) {
|
||||
if (pss->system_info->type == SUBSYSTEM_TURRET) {
|
||||
if(pss->turret_enemy_objnum == -1)
|
||||
gr_printf_no_resize(gr_screen.center_offset_x + 10, gr_screen.center_offset_y + (t*line_height), "Turret %d: <None>", t);
|
||||
gr_printf_no_resize(10, t*line_height, "Turret %d: <None>", t);
|
||||
else if (Objects[pss->turret_enemy_objnum].type == OBJ_SHIP)
|
||||
gr_printf_no_resize(gr_screen.center_offset_x + 10, gr_screen.center_offset_y + (t*line_height), "Turret %d: %s", t, Ships[Objects[pss->turret_enemy_objnum].instance].ship_name);
|
||||
gr_printf_no_resize(10, t*line_height, "Turret %d: %s", t, Ships[Objects[pss->turret_enemy_objnum].instance].ship_name);
|
||||
else
|
||||
gr_printf_no_resize(gr_screen.center_offset_x + 10, gr_screen.center_offset_y + (t*line_height), "Turret %d: <Object %d>", t, pss->turret_enemy_objnum);
|
||||
gr_printf_no_resize(10, t*line_height, "Turret %d: <Object %d>", t, pss->turret_enemy_objnum);
|
||||
|
||||
t++;
|
||||
}
|
||||
@@ -2182,14 +2175,14 @@ void game_show_framerate()
|
||||
gr_set_color_fast(&HUD_color_debug);
|
||||
|
||||
if (Cmdline_frame_profile) {
|
||||
gr_string(gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 + line_height, profile_output.c_str(), GR_RESIZE_NONE);
|
||||
gr_string(20, 100 + line_height, profile_output, GR_RESIZE_NONE);
|
||||
}
|
||||
|
||||
if (Show_framerate) {
|
||||
if (frametotal != 0.0f)
|
||||
gr_printf_no_resize( gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100, "FPS: %0.1f", Framerate );
|
||||
gr_printf_no_resize( 20, 100, "FPS: %0.1f", Framerate );
|
||||
else
|
||||
gr_string( gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100, "FPS: ?", GR_RESIZE_NONE );
|
||||
gr_string( 20, 100, "FPS: ?", GR_RESIZE_NONE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2203,10 +2196,6 @@ void game_show_framerate()
|
||||
|
||||
#ifdef _WIN32
|
||||
if (Cmdline_show_stats && HUD_draw) {
|
||||
int sx,sy;
|
||||
sx = gr_screen.center_offset_x + 20;
|
||||
sy = gr_screen.center_offset_y + 100 + (line_height * 2);
|
||||
|
||||
char mem_buffer[50];
|
||||
|
||||
MEMORYSTATUS mem_stats;
|
||||
@@ -2218,27 +2207,22 @@ void game_show_framerate()
|
||||
else
|
||||
sprintf(mem_buffer,"Using Physical: %d Meg",(Mem_starttime_phys - mem_stats.dwAvailPhys)/1024/1024);
|
||||
|
||||
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
|
||||
sy += line_height;
|
||||
gr_string( 20, 100 + (line_height * 2), mem_buffer, GR_RESIZE_NONE);
|
||||
sprintf(mem_buffer,"Using Pagefile: %d Meg",(Mem_starttime_pagefile - mem_stats.dwAvailPageFile)/1024/1024);
|
||||
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
|
||||
sy += line_height;
|
||||
gr_string( 20, 100 + (line_height * 3), mem_buffer, GR_RESIZE_NONE);
|
||||
sprintf(mem_buffer,"Using Virtual: %d Meg",(Mem_starttime_virtual - mem_stats.dwAvailVirtual)/1024/1024);
|
||||
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
|
||||
sy += line_height * 2;
|
||||
gr_string( 20, 100 + (line_height * 4), mem_buffer, GR_RESIZE_NONE);
|
||||
|
||||
if ( ((int)mem_stats.dwAvailPhys == -1) || ((int)mem_stats.dwTotalPhys == -1) )
|
||||
sprintf(mem_buffer, "Physical Free: *** / *** (>4G)");
|
||||
else
|
||||
sprintf(mem_buffer,"Physical Free: %d / %d Meg",mem_stats.dwAvailPhys/1024/1024, mem_stats.dwTotalPhys/1024/1024);
|
||||
|
||||
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
|
||||
sy += line_height;
|
||||
gr_string( 20, 100 + (line_height * 6), mem_buffer, GR_RESIZE_NONE);
|
||||
sprintf(mem_buffer,"Pagefile Free: %d / %d Meg",mem_stats.dwAvailPageFile/1024/1024, mem_stats.dwTotalPageFile/1024/1024);
|
||||
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
|
||||
sy += line_height;
|
||||
gr_string( 20, 100 + (line_height * 7), mem_buffer, GR_RESIZE_NONE);
|
||||
sprintf(mem_buffer,"Virtual Free: %d / %d Meg",mem_stats.dwAvailVirtual/1024/1024, mem_stats.dwTotalVirtual/1024/1024);
|
||||
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
|
||||
gr_string( 20, 100 + (line_height * 8), mem_buffer, GR_RESIZE_NONE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2246,8 +2230,8 @@ void game_show_framerate()
|
||||
if ( Show_cpu == 1 ) {
|
||||
|
||||
int sx,sy;
|
||||
sx = gr_screen.center_offset_x + gr_screen.center_w - 154;
|
||||
sy = gr_screen.center_offset_y + 15;
|
||||
sx = gr_screen.max_w - 154;
|
||||
sy = 15;
|
||||
|
||||
gr_set_color_fast(&HUD_color_debug);
|
||||
|
||||
@@ -2293,8 +2277,8 @@ void game_show_framerate()
|
||||
if ( Show_mem ) {
|
||||
|
||||
int sx,sy;
|
||||
sx = gr_screen.center_offset_x + gr_screen.center_w - 154;
|
||||
sy = gr_screen.center_offset_y + 15;
|
||||
sx = gr_screen.max_w - 154;
|
||||
sy = 15;
|
||||
|
||||
gr_set_color_fast(&HUD_color_debug);
|
||||
|
||||
@@ -2327,8 +2311,8 @@ void game_show_framerate()
|
||||
|
||||
if ( Show_player_pos ) {
|
||||
int sx, sy;
|
||||
sx = gr_screen.center_offset_x + 320;
|
||||
sy = gr_screen.center_offset_y + 100;
|
||||
sx = 320;
|
||||
sy = 100;
|
||||
gr_printf_no_resize(sx, sy, NOX("Player Pos: (%d,%d,%d)"), fl2i(Player_obj->pos.xyz.x), fl2i(Player_obj->pos.xyz.y), fl2i(Player_obj->pos.xyz.z));
|
||||
}
|
||||
|
||||
@@ -2360,11 +2344,11 @@ void game_show_framerate()
|
||||
short_name++;
|
||||
|
||||
sprintf(mem_buffer,"%s:\t%d K", short_name, size);
|
||||
gr_string( gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 + (line_height * 12) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
|
||||
gr_string( 20, 100 + (line_height * 12) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
|
||||
}
|
||||
|
||||
sprintf(mem_buffer,"Total RAM:\t%d K", TotalRam / 1024);
|
||||
gr_string( gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 + (line_height * 13) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
|
||||
gr_string( 20, 100 + (line_height * 13) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2399,7 +2383,7 @@ void game_show_eye_pos(camid cid)
|
||||
gr_set_color_fast(&HUD_color_debug);
|
||||
|
||||
//Position
|
||||
gr_printf_no_resize(gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 - font_height, "X:%f Y:%f Z:%f", cam_pos.xyz.x, cam_pos.xyz.y, cam_pos.xyz.z);
|
||||
gr_printf_no_resize(20, 100 - font_height, "X:%f Y:%f Z:%f", cam_pos.xyz.x, cam_pos.xyz.y, cam_pos.xyz.z);
|
||||
font_height -= font_height/2;
|
||||
|
||||
//Orientation
|
||||
@@ -2407,7 +2391,7 @@ void game_show_eye_pos(camid cid)
|
||||
rot_angles.p *= (180/PI);
|
||||
rot_angles.b *= (180/PI);
|
||||
rot_angles.h *= (180/PI);
|
||||
gr_printf_no_resize(gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 - font_height, "Xr:%f Yr:%f Zr:%f", rot_angles.p, rot_angles.b, rot_angles.h);
|
||||
gr_printf_no_resize(20, 100 - font_height, "Xr:%f Yr:%f Zr:%f", rot_angles.p, rot_angles.b, rot_angles.h);
|
||||
}
|
||||
|
||||
void game_show_standalone_framerate()
|
||||
@@ -2457,7 +2441,7 @@ void game_show_time_left()
|
||||
diff = 0;
|
||||
|
||||
hud_set_default_color();
|
||||
gr_printf_no_resize( gr_screen.center_offset_x + 5, gr_screen.center_offset_y + 40, XSTR( "Mission time remaining: %d seconds", 179), diff );
|
||||
gr_printf_no_resize( 5, 40, XSTR( "Mission time remaining: %d seconds", 179), diff );
|
||||
}
|
||||
|
||||
//========================================================================================
|
||||
@@ -2825,7 +2809,7 @@ void game_tst_mark(object *objp, ship *shipp)
|
||||
}
|
||||
|
||||
// bogus
|
||||
if((objp == NULL) || (shipp == NULL) || (shipp->ship_info_index < 0) || (shipp->ship_info_index >= static_cast<int>(Ship_info.size()))){
|
||||
if((objp == NULL) || (shipp == NULL) || (shipp->ship_info_index < 0) || (shipp->ship_info_index >= Num_ship_classes)){
|
||||
return;
|
||||
}
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
@@ -3277,16 +3261,16 @@ void setup_environment_mapping(camid cid)
|
||||
|
||||
// face 3 (py / up)
|
||||
memset( &new_orient, 0, sizeof(matrix) );
|
||||
new_orient.vec.fvec.xyz.y = (gr_screen.mode == GR_OPENGL) ? 1.0f : -1.0f;
|
||||
new_orient.vec.uvec.xyz.z = (gr_screen.mode == GR_OPENGL) ? -1.0f : 1.0f;
|
||||
new_orient.vec.fvec.xyz.y = (gr_screen.mode == GR_OPENGL) ? -1.0f : 1.0f;
|
||||
new_orient.vec.uvec.xyz.z = (gr_screen.mode == GR_OPENGL) ? 1.0f : -1.0f;
|
||||
new_orient.vec.rvec.xyz.x = 1.0f;
|
||||
render_environment(i, &cam_pos, &new_orient, new_zoom);
|
||||
i++; // bump!
|
||||
|
||||
// face 4 (ny / down)
|
||||
memset( &new_orient, 0, sizeof(matrix) );
|
||||
new_orient.vec.fvec.xyz.y = (gr_screen.mode == GR_OPENGL) ? -1.0f : 1.0f;
|
||||
new_orient.vec.uvec.xyz.z = (gr_screen.mode == GR_OPENGL) ? 1.0f : -1.0f;
|
||||
new_orient.vec.fvec.xyz.y = (gr_screen.mode == GR_OPENGL) ? 1.0f : -1.0f;
|
||||
new_orient.vec.uvec.xyz.z = (gr_screen.mode == GR_OPENGL) ? -1.0f : 1.0f;
|
||||
new_orient.vec.rvec.xyz.x = 1.0f;
|
||||
render_environment(i, &cam_pos, &new_orient, new_zoom);
|
||||
i++; // bump!
|
||||
@@ -3682,8 +3666,7 @@ DCF_BOOL( subspace, Game_subspace_effect )
|
||||
void clip_frame_view();
|
||||
|
||||
// Does everything needed to render a frame
|
||||
extern SCP_vector<object*> effect_ships;
|
||||
extern SCP_vector<object*> transparent_objects;
|
||||
extern SCP_vector<object*> effect_ships;
|
||||
void game_render_frame( camid cid )
|
||||
{
|
||||
|
||||
@@ -3732,7 +3715,7 @@ void game_render_frame( camid cid )
|
||||
// Note: environment mapping gets disabled when rendering to texture; if you change
|
||||
// this, make sure that the current render target gets restored right afterwards!
|
||||
if ( Cmdline_env && !Env_cubemap_drawn && gr_screen.rendering_to_texture == -1 ) {
|
||||
PROFILE("Environment Mapping", setup_environment_mapping(cid));
|
||||
setup_environment_mapping(cid);
|
||||
|
||||
if ( !Dynamic_environment ) {
|
||||
Env_cubemap_drawn = true;
|
||||
@@ -3757,13 +3740,15 @@ void game_render_frame( camid cid )
|
||||
stars_draw(1,1,1,0,0);
|
||||
}
|
||||
|
||||
PROFILE("Build Shadow Map", shadows_render_all(Proj_fov, &Eye_matrix, &Eye_position));
|
||||
PROFILE("Render Scene", obj_render_queue_all());
|
||||
|
||||
bool draw_viewer_last = false;
|
||||
obj_render_all(obj_render, &draw_viewer_last);
|
||||
|
||||
// Why do we not show the shield effect in these modes? Seems ok.
|
||||
//if (!(Viewer_mode & (VM_EXTERNAL | VM_SLEWED | VM_CHASE | VM_DEAD_VIEW))) {
|
||||
render_shields();
|
||||
//}
|
||||
|
||||
PROFILE("Trails", trail_render_all()); // render missilie trails after everything else.
|
||||
PROFILE("Particles", particle_render_all()); // render particles after everything else.
|
||||
PROFILE("Particles", particle_render_all()); // render particles after everything else.
|
||||
|
||||
#ifdef DYN_CLIP_DIST
|
||||
if(!Cmdline_nohtl)
|
||||
@@ -3776,6 +3761,8 @@ void game_render_frame( camid cid )
|
||||
#endif
|
||||
|
||||
beam_render_all(); // render all beam weapons
|
||||
|
||||
PROFILE("Trails", trail_render_all()); // render missilie trails after everything else.
|
||||
|
||||
// render nebula lightning
|
||||
nebl_render_all();
|
||||
@@ -3783,25 +3770,14 @@ void game_render_frame( camid cid )
|
||||
// render local player nebula
|
||||
neb2_render_player();
|
||||
|
||||
gr_copy_effect_texture();
|
||||
|
||||
// render all ships with shader effects on them
|
||||
SCP_vector<object*>::iterator obji = effect_ships.begin();
|
||||
for(;obji != effect_ships.end();++obji)
|
||||
{
|
||||
obj_render(*obji);
|
||||
}
|
||||
ship_render(*obji);
|
||||
effect_ships.clear();
|
||||
|
||||
batch_render_distortion_map_bitmaps();
|
||||
|
||||
Shadow_override = true;
|
||||
//Draw the viewer 'cause we didn't before.
|
||||
//This is so we can change the minimum clipping distance without messing everything up.
|
||||
if ( Viewer_obj
|
||||
&& (Viewer_obj->type == OBJ_SHIP)
|
||||
&& (Ship_info[Ships[Viewer_obj->instance].ship_info_index].flags2 & SIF2_SHOW_SHIP_MODEL)
|
||||
&& (!Viewer_mode || (Viewer_mode & VM_PADLOCK_ANY) || (Viewer_mode & VM_OTHER_SHIP) || (Viewer_mode & VM_TRACK)) )
|
||||
if(draw_viewer_last && Viewer_obj)
|
||||
{
|
||||
gr_post_process_save_zbuffer();
|
||||
ship_render_show_ship_cockpit(Viewer_obj);
|
||||
@@ -3837,10 +3813,10 @@ void game_render_frame( camid cid )
|
||||
gr_end_proj_matrix();
|
||||
gr_end_view_matrix();
|
||||
}
|
||||
Shadow_override = false;
|
||||
|
||||
//================ END OF 3D RENDERING STUFF ====================
|
||||
|
||||
PROFILE("Post Process", gr_scene_texture_end());
|
||||
gr_scene_texture_end();
|
||||
|
||||
extern int Multi_display_netinfo;
|
||||
if(Multi_display_netinfo){
|
||||
@@ -3854,7 +3830,7 @@ void game_render_frame( camid cid )
|
||||
do_timing_test(flFrametime);
|
||||
|
||||
extern int OO_update_index;
|
||||
multi_rate_display(OO_update_index, gr_screen.center_offset_x + 375, gr_screen.center_offset_y);
|
||||
multi_rate_display(OO_update_index, 375, 0);
|
||||
|
||||
// test
|
||||
extern void oo_display();
|
||||
@@ -4028,7 +4004,7 @@ void game_simulation_frame()
|
||||
ship_info *sip;
|
||||
while((moveup != END_OF_LIST(&Ship_obj_list)) && (moveup != NULL)){
|
||||
// bogus
|
||||
if((moveup->objnum < 0) || (moveup->objnum >= MAX_OBJECTS) || (Objects[moveup->objnum].type != OBJ_SHIP) || (Objects[moveup->objnum].instance < 0) || (Objects[moveup->objnum].instance >= MAX_SHIPS) || (Ships[Objects[moveup->objnum].instance].ship_info_index < 0) || (Ships[Objects[moveup->objnum].instance].ship_info_index >= static_cast<int>(Ship_info.size()))){
|
||||
if((moveup->objnum < 0) || (moveup->objnum >= MAX_OBJECTS) || (Objects[moveup->objnum].type != OBJ_SHIP) || (Objects[moveup->objnum].instance < 0) || (Objects[moveup->objnum].instance >= MAX_SHIPS) || (Ships[Objects[moveup->objnum].instance].ship_info_index < 0) || (Ships[Objects[moveup->objnum].instance].ship_info_index >= Num_ship_classes)){
|
||||
moveup = GET_NEXT(moveup);
|
||||
continue;
|
||||
}
|
||||
@@ -4797,7 +4773,7 @@ void game_set_frametime(int state)
|
||||
fix frame_speed = F1_0 / Debug_dump_frames;
|
||||
|
||||
if (Frametime > frame_speed ){
|
||||
nprintf(("warning","slow frame: %x\n",(int)Frametime));
|
||||
nprintf(("warning","slow frame: %x\n",Frametime));
|
||||
} else {
|
||||
do {
|
||||
thistime = timer_get_fixed_seconds();
|
||||
@@ -5966,10 +5942,6 @@ void game_leave_state( int old_state, int new_state )
|
||||
|
||||
case GS_STATE_FICTION_VIEWER:
|
||||
fiction_viewer_close();
|
||||
common_select_close();
|
||||
if (new_state == GS_STATE_MAIN_MENU) {
|
||||
freespace_stop_mission();
|
||||
}
|
||||
break;
|
||||
|
||||
case GS_STATE_LAB:
|
||||
@@ -7053,7 +7025,7 @@ int game_main(char *cmdline)
|
||||
|
||||
// check if networking should be disabled, this could probably be done later but the sooner the better
|
||||
// TODO: remove this when multi is fixed to handle more than MAX_SHIP_CLASSES_MULTI
|
||||
if ( Ship_info.size() > MAX_SHIP_CLASSES_MULTI ) {
|
||||
if ( Num_ship_classes > MAX_SHIP_CLASSES_MULTI ) {
|
||||
Networking_disabled = 1;
|
||||
}
|
||||
|
||||
@@ -7441,7 +7413,6 @@ void game_shutdown(void)
|
||||
// free left over memory from table parsing
|
||||
player_tips_close();
|
||||
|
||||
control_config_common_close();
|
||||
joy_close();
|
||||
|
||||
audiostream_close();
|
||||
@@ -7534,15 +7505,17 @@ void init_animating_pointer()
|
||||
//
|
||||
// input: filename => filename of animation file that holds the animation
|
||||
//
|
||||
void load_animating_pointer(char *filename)
|
||||
void load_animating_pointer(char *filename, int dx, int dy)
|
||||
{
|
||||
int fps;
|
||||
animating_obj *am;
|
||||
|
||||
init_animating_pointer();
|
||||
|
||||
//TEMP
|
||||
mprintf(("loading animated cursor \"%s\"\n", filename));
|
||||
|
||||
|
||||
am = &Animating_mouse;
|
||||
am->first_frame = bm_load_animation(filename, &am->num_frames, &fps);
|
||||
if ( am->first_frame == -1 )
|
||||
@@ -7781,13 +7754,13 @@ void game_show_event_debug(float frametime)
|
||||
gr_clear();
|
||||
gr_set_color_fast(&Color_bright);
|
||||
gr_set_font(FONT1);
|
||||
gr_printf_no_resize(0x8000, gr_screen.center_offset_y + 15, NOX("EVENT DEBUG VIEW"));
|
||||
gr_printf_no_resize(0x8000, 15, NOX("EVENT DEBUG VIEW"));
|
||||
|
||||
gr_set_color_fast(&Color_normal);
|
||||
gr_set_font(FONT1);
|
||||
gr_get_string_size(&font_width, &font_height, NOX("test"));
|
||||
y_max = gr_screen.center_offset_y + gr_screen.center_h - font_height - 5;
|
||||
y_index = gr_screen.center_offset_y + 45;
|
||||
y_max = gr_screen.max_h - font_height - 5;
|
||||
y_index = 45;
|
||||
|
||||
k = scroll_offset;
|
||||
while (k < ED_count) {
|
||||
@@ -7837,7 +7810,7 @@ void game_show_event_debug(float frametime)
|
||||
}
|
||||
}
|
||||
|
||||
gr_printf_no_resize(gr_screen.center_offset_x + 10, y_index, buf);
|
||||
gr_printf_no_resize(10, y_index, buf);
|
||||
y_index += font_height;
|
||||
k++;
|
||||
}
|
||||
@@ -7946,11 +7919,8 @@ void Time_model( int modelnum )
|
||||
g3_set_view_matrix( &eye_pos, &eye_orient, VIEWER_ZOOM_DEFAULT );
|
||||
|
||||
model_clear_instance( modelnum );
|
||||
|
||||
model_render_params render_info;
|
||||
render_info.set_detail_level_lock(0);
|
||||
model_set_detail_level(0); // use highest detail level
|
||||
model_render_immediate( &render_info, modelnum, &model_orient, &model_pos ); //|MR_NO_POLYS );
|
||||
model_render( modelnum, &model_orient, &model_pos, MR_LOCK_DETAIL); //|MR_NO_POLYS );
|
||||
|
||||
g3_end_frame();
|
||||
// gr_flip();
|
||||
@@ -7998,7 +7968,9 @@ void Do_model_timings_test()
|
||||
}
|
||||
|
||||
// Load them all
|
||||
for (auto sip = Ship_info.begin(); sip != Ship_info.end(); ++sip ) {
|
||||
for (i=0; i<Num_ship_classes; i++ ) {
|
||||
ship_info *sip = &Ship_info[i];
|
||||
|
||||
sip->model_num = model_load(sip->pof_file, 0, NULL);
|
||||
|
||||
model_used[sip->model_num % MAX_POLYGON_MODELS]++;
|
||||
@@ -8564,8 +8536,8 @@ int detect_lang()
|
||||
detect = NULL;
|
||||
|
||||
// now compare the checksum/filesize against known #'s
|
||||
for (idx=0; idx < NUM_BUILTIN_LANGUAGES; idx++) {
|
||||
if (Lcl_builtin_languages[idx].checksum == (int)file_checksum) {
|
||||
for (idx=0; idx < (int)Lcl_languages.size(); idx++) {
|
||||
if (Lcl_languages[idx].checksum == (int)file_checksum) {
|
||||
mprintf(( "AutoLang: Language auto-detection successful...\n" ));
|
||||
return idx;
|
||||
}
|
||||
@@ -8795,6 +8767,8 @@ void game_title_screen_display()
|
||||
}
|
||||
*/
|
||||
|
||||
//Script_system.SetHookVar("SplashScreenImage", 's', Game_title_screen_fname[gr_screen.res]);
|
||||
//Script_system.SetHookVar("SplashScreenLogo", 's', Game_logo_screen_fname[gr_screen.res]);
|
||||
bool globalhook_override = Script_system.IsOverride(Script_splashhook);
|
||||
bool condhook_override = Script_system.IsConditionOverride(CHA_SPLASHSCREEN);
|
||||
mprintf(("SCRIPTING: Splash screen overrides checked\n"));
|
||||
@@ -8839,6 +8813,8 @@ void game_title_screen_display()
|
||||
Script_system.RunCondition(CHA_SPLASHSCREEN);
|
||||
|
||||
mprintf(("SCRIPTING: Splash screen conditional hook has been run\n"));
|
||||
|
||||
Script_system.RemHookVars(2, "SplashScreenImage", "SplashScreenLogo");
|
||||
|
||||
// flip
|
||||
gr_flip();
|
||||
|
||||
@@ -448,5 +448,5 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
//
|
||||
|
||||
#ifdef FS2_VOICER
|
||||
IDR_CMD_CFG SRGRAMMAR DISCARDABLE "phrases.cfg"
|
||||
IDR_CMD_CFG SRGRAMMAR DISCARDABLE "..\..\code\sound\phrases.cfg"
|
||||
#endif
|
||||
@@ -9,30 +9,30 @@
|
||||
|
||||
|
||||
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "fs2netd/fs2netd_client.h"
|
||||
#include "fs2netd/tcp_client.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "network/multi_log.h"
|
||||
#include "osapi/osregistry.h"
|
||||
#include "popup/popup.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "network/multi.h"
|
||||
#include "playerman/player.h"
|
||||
#include "io/timer.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "network/multiui.h"
|
||||
#include "network/stand_gui.h"
|
||||
#include "network/multi_pxo.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "graphics/font.h"
|
||||
#include "io/timer.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
#include "network/multi.h"
|
||||
#include "network/multi_log.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "network/multi_options.h"
|
||||
#include "network/multi_pxo.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multiui.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "network/stand_gui.h"
|
||||
#include "osapi/osregistry.h"
|
||||
#include "playerman/player.h"
|
||||
#include "popup/popup.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <cstdio>
|
||||
@@ -737,7 +737,7 @@ static void fs2netd_handle_messages()
|
||||
|
||||
case PCKT_SLIST_REPLY: {
|
||||
int numServers = 0;
|
||||
int svr_flags __UNUSED; // gcc [-Wunused-but-set-variable] doesn't like MACROs
|
||||
int svr_flags __attribute__((__unused__)); // gcc [-Wunused-but-set-variable] doesn't like MACROs
|
||||
ushort svr_port;
|
||||
char svr_ip[16];
|
||||
active_game ag;
|
||||
@@ -1207,7 +1207,7 @@ void fs2netd_update_ban_list()
|
||||
|
||||
if (banlist_cfg != NULL) {
|
||||
for (SCP_vector<SCP_string>::iterator bl = FS2NetD_ban_list.begin(); bl != FS2NetD_ban_list.end(); ++bl) {
|
||||
cfputs( bl->c_str(), banlist_cfg );
|
||||
cfputs( const_cast<char*>(bl->c_str()), banlist_cfg );
|
||||
}
|
||||
|
||||
cfclose(banlist_cfg);
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#define __pxo_protocol_h_
|
||||
|
||||
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h"
|
||||
|
||||
|
||||
#define PXO_PROTO_VER "2.0"
|
||||
|
||||
@@ -13,17 +13,17 @@
|
||||
|
||||
|
||||
|
||||
#include "fs2netd/fs2netd_client.h"
|
||||
#include "fs2netd/protocol.h"
|
||||
#include "fs2netd/tcp_client.h"
|
||||
#include "fs2netd/protocol.h"
|
||||
#include "fs2netd/tcp_socket.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "io/timer.h"
|
||||
#include "network/multi.h"
|
||||
#include "fs2netd/fs2netd_client.h"
|
||||
#include "network/multi_log.h"
|
||||
#include "network/multi.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "playerman/player.h"
|
||||
#include "ship/ship.h"
|
||||
#include "io/timer.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -218,8 +218,7 @@ int FS2NetD_GetPlayerData(const char *player_name, player *pl, bool can_create,
|
||||
uint rc_total = 0;
|
||||
ubyte reply_type = 0;
|
||||
int si_index = 0;
|
||||
ushort bogus __UNUSED;
|
||||
ushort num_type_kills = 0, num_medals = 0;
|
||||
ushort bogus, num_type_kills = 0, num_medals = 0;
|
||||
char ship_name[NAME_LENGTH];
|
||||
int idx;
|
||||
|
||||
@@ -489,8 +488,8 @@ int FS2NetD_Login(const char *username, const char *password, bool do_send)
|
||||
int rc;
|
||||
uint rc_total = 0;
|
||||
ubyte login_status = 0;
|
||||
int sid __UNUSED;
|
||||
short pilots __UNUSED;
|
||||
int sid;
|
||||
short pilots;
|
||||
|
||||
do {
|
||||
rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer)-rc_total);
|
||||
@@ -833,3 +832,4 @@ void FS2NetD_CheckDuplicateLogin()
|
||||
|
||||
delete [] ids;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
#define __pxo_client_h_
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#include "fs2netd/protocol.h"
|
||||
#include "fs2netd/tcp_socket.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
+166
-172
@@ -11,26 +11,26 @@
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "controlconfig/controlsconfig.h"
|
||||
#include "debugconsole/console.h"
|
||||
#include "gamehelp/contexthelp.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "localization/localize.h"
|
||||
#include "menuui/barracks.h"
|
||||
#include "menuui/mainhallmenu.h"
|
||||
#include "menuui/readyroom.h"
|
||||
#include "menuui/techmenu.h"
|
||||
#include "mission/missionhotkey.h"
|
||||
#include "missionui/missionbrief.h"
|
||||
#include "missionui/missioncmdbrief.h"
|
||||
#include "missionui/missiondebrief.h"
|
||||
#include "missionui/missionshipchoice.h"
|
||||
#include "missionui/missionweaponchoice.h"
|
||||
#include "menuui/barracks.h"
|
||||
#include "controlconfig/controlsconfig.h"
|
||||
#include "missionui/missiondebrief.h"
|
||||
#include "network/multiui.h"
|
||||
#include "mission/missionhotkey.h"
|
||||
#include "menuui/readyroom.h"
|
||||
#include "menuui/techmenu.h"
|
||||
#include "missionui/missioncmdbrief.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "localization/localize.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ void parse_helptbl(const char *filename)
|
||||
int overlay_id, currcount, vtxcount;
|
||||
char name[HELP_MAX_NAME_LENGTH];
|
||||
char buf[HELP_MAX_STRING_LENGTH + 1];
|
||||
int i, j;
|
||||
int i, j, rval;
|
||||
|
||||
SCP_vector<help_pline> pline_temp;
|
||||
help_pline pline_temp2;
|
||||
@@ -335,166 +335,160 @@ void parse_helptbl(const char *filename)
|
||||
help_left_bracket lbracket_temp2;
|
||||
vec3d vec3d_temp;
|
||||
|
||||
try
|
||||
{
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// for each overlay...
|
||||
while (optional_string("$")) {
|
||||
|
||||
stuff_string(name, F_NAME, HELP_MAX_NAME_LENGTH);
|
||||
|
||||
overlay_id = help_overlay_get_index(name);
|
||||
|
||||
if (overlay_id < 0) {
|
||||
if (num_help_overlays >= MAX_HELP_OVERLAYS) {
|
||||
Warning(LOCATION, "Could not load help overlay '%s' as maximum number of help overlays was reached (Max is %d)", name, MAX_HELP_OVERLAYS);
|
||||
|
||||
if (!skip_to_string("$end")) {
|
||||
Error(LOCATION, "Couldn't find $end. Help.tbl or -hlp.tbm is invalid.\n");
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
overlay_id = num_help_overlays;
|
||||
strcpy_s(help_overlaylist[overlay_id].name, name);
|
||||
num_help_overlays++;
|
||||
}
|
||||
}
|
||||
|
||||
// clear out counters in the overlay struct
|
||||
help_overlaylist[overlay_id].plinecount = 0;
|
||||
help_overlaylist[overlay_id].textcount = 0;
|
||||
help_overlaylist[overlay_id].rbracketcount = 0;
|
||||
help_overlaylist[overlay_id].lbracketcount = 0;
|
||||
|
||||
help_overlaylist[overlay_id].fontlist.clear();
|
||||
help_overlaylist[overlay_id].plinelist.clear();
|
||||
help_overlaylist[overlay_id].textlist.clear();
|
||||
help_overlaylist[overlay_id].rbracketlist.clear();
|
||||
help_overlaylist[overlay_id].lbracketlist.clear();
|
||||
|
||||
if (optional_string("+resolutions")) {
|
||||
stuff_int(&help_overlaylist[overlay_id].num_resolutions);
|
||||
}
|
||||
else {
|
||||
help_overlaylist[overlay_id].num_resolutions = 2;
|
||||
}
|
||||
|
||||
if (help_overlaylist[overlay_id].num_resolutions < 1) {
|
||||
Error(LOCATION, "+resolutions in %s is %d. (Must be 1 or greater)", filename, help_overlaylist[overlay_id].num_resolutions);
|
||||
}
|
||||
|
||||
if (optional_string("+font")) {
|
||||
int font_index;
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
stuff_int(&font_index);
|
||||
help_overlaylist[overlay_id].fontlist.push_back(font_index);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].fontlist.push_back(FONT1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].plinelist.push_back(pline_temp);
|
||||
help_overlaylist[overlay_id].textlist.push_back(text_temp);
|
||||
help_overlaylist[overlay_id].rbracketlist.push_back(rbracket_temp);
|
||||
help_overlaylist[overlay_id].lbracketlist.push_back(lbracket_temp);
|
||||
}
|
||||
|
||||
int type;
|
||||
// read in all elements for this overlay
|
||||
while ((type = required_string_one_of(5, "+pline", "+text", "+right_bracket", "+left_bracket", "$end")) != 4) { // Doing it this way means an error lists "$end" at the end, which seems appropriate. -MageKing17
|
||||
|
||||
switch (type) {
|
||||
case 0: // +pline
|
||||
required_string("+pline");
|
||||
currcount = help_overlaylist[overlay_id].plinecount;
|
||||
int a, b; // temp vars to read in int before cast to float;
|
||||
|
||||
// read number of pline vertices
|
||||
stuff_int(&vtxcount);
|
||||
// get vertex coordinates for each resolution
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].plinelist.at(i).push_back(pline_temp2);
|
||||
for (j = 0; j < vtxcount; j++) {
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.push_back(vec3d_temp);
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtxcount = vtxcount;
|
||||
stuff_int(&a);
|
||||
stuff_int(&b);
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.x = (float)a;
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.y = (float)b;
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.z = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
help_overlaylist[overlay_id].plinecount++;
|
||||
break;
|
||||
case 1: // +text
|
||||
required_string("+text");
|
||||
currcount = help_overlaylist[overlay_id].textcount;
|
||||
|
||||
// get coordinates for each resolution
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].textlist.at(i).push_back(text_temp2);
|
||||
stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).x_coord));
|
||||
stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).y_coord));
|
||||
}
|
||||
|
||||
// get string (always use the first resolution)
|
||||
stuff_string(buf, F_MESSAGE, sizeof(buf));
|
||||
help_overlaylist[overlay_id].textlist.at(0).at(currcount).string = vm_strdup(buf);
|
||||
|
||||
help_overlaylist[overlay_id].textcount++;
|
||||
break;
|
||||
case 2: // +right_bracket
|
||||
required_string("+right_bracket");
|
||||
currcount = help_overlaylist[overlay_id].rbracketcount;
|
||||
|
||||
// get coordinates for each resolution
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].rbracketlist.at(i).push_back(rbracket_temp2);
|
||||
stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).x_coord));
|
||||
stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).y_coord));
|
||||
}
|
||||
|
||||
help_overlaylist[overlay_id].rbracketcount++;
|
||||
break;
|
||||
case 3: // +left_bracket
|
||||
required_string("+left_bracket");
|
||||
currcount = help_overlaylist[overlay_id].lbracketcount;
|
||||
|
||||
// get coordinates for each resolution
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].lbracketlist.at(i).push_back(lbracket_temp2);
|
||||
stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).x_coord));
|
||||
stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).y_coord));
|
||||
}
|
||||
|
||||
help_overlaylist[overlay_id].lbracketcount++;
|
||||
break;
|
||||
case -1:
|
||||
// -noparseerrors is set
|
||||
break;
|
||||
case 4: // $end
|
||||
default:
|
||||
Assertion(false, "This should never happen.\n");
|
||||
break;
|
||||
}
|
||||
} // end while
|
||||
required_string("$end");
|
||||
} // end while
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// for each overlay...
|
||||
while (optional_string("$")) {
|
||||
|
||||
stuff_string(name, F_NAME, HELP_MAX_NAME_LENGTH);
|
||||
|
||||
overlay_id = help_overlay_get_index(name);
|
||||
|
||||
if (overlay_id < 0) {
|
||||
if (num_help_overlays >= MAX_HELP_OVERLAYS) {
|
||||
Warning(LOCATION, "Could not load help overlay after '%s' as maximum number of help overlays was reached (Max is %d)", help_overlaylist[overlay_id - 1].name, MAX_HELP_OVERLAYS);
|
||||
|
||||
if (!skip_to_string("$end")) {
|
||||
Error(LOCATION, "Couldn't find $end. Help.tbl or -hlp.tbm is invalid.\n");
|
||||
}
|
||||
|
||||
continue;
|
||||
} else {
|
||||
overlay_id = num_help_overlays;
|
||||
strcpy_s(help_overlaylist[overlay_id].name, name);
|
||||
num_help_overlays++;
|
||||
}
|
||||
}
|
||||
|
||||
// clear out counters in the overlay struct
|
||||
help_overlaylist[overlay_id].plinecount = 0;
|
||||
help_overlaylist[overlay_id].textcount = 0;
|
||||
help_overlaylist[overlay_id].rbracketcount = 0;
|
||||
help_overlaylist[overlay_id].lbracketcount = 0;
|
||||
|
||||
help_overlaylist[overlay_id].fontlist.clear();
|
||||
help_overlaylist[overlay_id].plinelist.clear();
|
||||
help_overlaylist[overlay_id].textlist.clear();
|
||||
help_overlaylist[overlay_id].rbracketlist.clear();
|
||||
help_overlaylist[overlay_id].lbracketlist.clear();
|
||||
|
||||
if (optional_string("+resolutions")) {
|
||||
stuff_int(&help_overlaylist[overlay_id].num_resolutions);
|
||||
} else {
|
||||
help_overlaylist[overlay_id].num_resolutions = 2;
|
||||
}
|
||||
|
||||
if (help_overlaylist[overlay_id].num_resolutions < 1) {
|
||||
Error(LOCATION, "+resolutions in %s is %d. (Must be 1 or greater)", filename, help_overlaylist[overlay_id].num_resolutions);
|
||||
}
|
||||
|
||||
if (optional_string("+font")) {
|
||||
int font;
|
||||
for (i=0; i<help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
stuff_int(&font);
|
||||
help_overlaylist[overlay_id].fontlist.push_back(font);
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].fontlist.push_back(FONT1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].plinelist.push_back(pline_temp);
|
||||
help_overlaylist[overlay_id].textlist.push_back(text_temp);
|
||||
help_overlaylist[overlay_id].rbracketlist.push_back(rbracket_temp);
|
||||
help_overlaylist[overlay_id].lbracketlist.push_back(lbracket_temp);
|
||||
}
|
||||
|
||||
int type;
|
||||
// read in all elements for this overlay
|
||||
while ((type = required_string_one_of(5, "+pline", "+text", "+right_bracket", "+left_bracket", "$end")) != 4) { // Doing it this way means an error lists "$end" at the end, which seems appropriate. -MageKing17
|
||||
|
||||
switch (type) {
|
||||
case 0: // +pline
|
||||
required_string("+pline");
|
||||
currcount = help_overlaylist[overlay_id].plinecount;
|
||||
int a, b; // temp vars to read in int before cast to float;
|
||||
|
||||
// read number of pline vertices
|
||||
stuff_int(&vtxcount);
|
||||
// get vertex coordinates for each resolution
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].plinelist.at(i).push_back(pline_temp2);
|
||||
for (j = 0; j < vtxcount; j++) {
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.push_back(vec3d_temp);
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtxcount = vtxcount;
|
||||
stuff_int(&a);
|
||||
stuff_int(&b);
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.x = (float)a;
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.y = (float)b;
|
||||
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.z = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
help_overlaylist[overlay_id].plinecount++;
|
||||
break;
|
||||
case 1: // +text
|
||||
required_string("+text");
|
||||
currcount = help_overlaylist[overlay_id].textcount;
|
||||
|
||||
// get coordinates for each resolution
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].textlist.at(i).push_back(text_temp2);
|
||||
stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).x_coord));
|
||||
stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).y_coord));
|
||||
}
|
||||
|
||||
// get string (always use the first resolution)
|
||||
stuff_string(buf, F_MESSAGE, sizeof(buf));
|
||||
help_overlaylist[overlay_id].textlist.at(0).at(currcount).string = vm_strdup(buf);
|
||||
|
||||
help_overlaylist[overlay_id].textcount++;
|
||||
break;
|
||||
case 2: // +right_bracket
|
||||
required_string("+right_bracket");
|
||||
currcount = help_overlaylist[overlay_id].rbracketcount;
|
||||
|
||||
// get coordinates for each resolution
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].rbracketlist.at(i).push_back(rbracket_temp2);
|
||||
stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).x_coord));
|
||||
stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).y_coord));
|
||||
}
|
||||
|
||||
help_overlaylist[overlay_id].rbracketcount++;
|
||||
break;
|
||||
case 3: // +left_bracket
|
||||
required_string("+left_bracket");
|
||||
currcount = help_overlaylist[overlay_id].lbracketcount;
|
||||
|
||||
// get coordinates for each resolution
|
||||
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
|
||||
help_overlaylist[overlay_id].lbracketlist.at(i).push_back(lbracket_temp2);
|
||||
stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).x_coord));
|
||||
stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).y_coord));
|
||||
}
|
||||
|
||||
help_overlaylist[overlay_id].lbracketcount++;
|
||||
break;
|
||||
case -1:
|
||||
// -noparseerrors is set
|
||||
break;
|
||||
case 4: // $end
|
||||
default:
|
||||
Assertion(false, "This should never happen.\n");
|
||||
break;
|
||||
}
|
||||
} // end while
|
||||
required_string("$end");
|
||||
} // end while
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
|
||||
|
||||
|
||||
#include "controlconfig/controlsconfig.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "io/key.h"
|
||||
#include "missionui/missionscreencommon.h"
|
||||
#include "sound/audiostr.h"
|
||||
#include "controlconfig/controlsconfig.h"
|
||||
#include "ui/ui.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "missionui/missionscreencommon.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "sound/audiostr.h"
|
||||
|
||||
|
||||
|
||||
|
||||
+20
-23
@@ -10,26 +10,23 @@
|
||||
|
||||
|
||||
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "gamesnd/eventmusic.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "io/timer.h"
|
||||
#include "localization/localize.h"
|
||||
#include "mission/missiongoals.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "object/object.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "ship/ship.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "io/timer.h"
|
||||
#include "sound/audiostr.h"
|
||||
#include "sound/sound.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "mission/missiongoals.h"
|
||||
#include "localization/localize.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_MASTER_EVENT_MUSIC_VOLUME 0.5f
|
||||
|
||||
#define HULL_VALUE_TO_PLAY_INTENSE_BATTLE_MUSIC 0.75f
|
||||
|
||||
@@ -37,7 +34,8 @@
|
||||
// Globals
|
||||
////////////////////////////
|
||||
int Event_Music_battle_started = 0;
|
||||
float Master_event_music_volume = DEFAULT_MASTER_EVENT_MUSIC_VOLUME; // range is 0->1
|
||||
float Default_music_volume = 0.5f; // range is 0->1
|
||||
float Master_event_music_volume = Default_music_volume;
|
||||
|
||||
typedef struct tagSNDPATTERN {
|
||||
int default_next_pattern; // Needed so the next_pattern member can be reset
|
||||
@@ -595,7 +593,7 @@ void event_music_level_init(int force_soundtrack)
|
||||
{
|
||||
if (!strnicmp(strack->pattern_fnames[i], NOX("none.wav"), 4))
|
||||
{
|
||||
Patterns[i].handle = -1;
|
||||
Patterns[i].handle = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1375,10 +1373,14 @@ void parse_menumusic()
|
||||
//
|
||||
void event_music_parse_musictbl(const char *filename)
|
||||
{
|
||||
try
|
||||
{
|
||||
int rval;
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
|
||||
|
||||
} else {
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
reset_parse();
|
||||
|
||||
while ( skip_to_start_of_string_either("#Soundtrack Start", "#Menu Music Start", NULL ) )
|
||||
{
|
||||
@@ -1396,10 +1398,6 @@ void event_music_parse_musictbl(const char *filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
@@ -1812,6 +1810,5 @@ void event_music_hostile_ship_destroyed()
|
||||
Battle_over_timestamp = timestamp(BATTLE_CHECK_INTERVAL);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
@@ -41,7 +41,8 @@
|
||||
|
||||
extern int Event_Music_battle_started; // flag that will tell us if we've started a battle in the current mission
|
||||
extern int Event_music_enabled;
|
||||
extern float Master_event_music_volume; // range is 0->1
|
||||
extern float Default_music_volume; // range is 0->1
|
||||
extern float Master_event_music_volume; // range is 0->1
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+119
-457
@@ -1,262 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
||||
*
|
||||
* All source code herein is the property of Volition, Inc. You may not sell
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* All source code herein is the property of Volition, Inc. You may not sell
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
#include <limits.h>
|
||||
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "localization/localize.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "sound/ds.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include <limits.h>
|
||||
|
||||
SCP_vector<game_snd> Snds;
|
||||
SCP_vector<game_snd> Snds_iface;
|
||||
SCP_vector<int> Snds_iface_handle;
|
||||
|
||||
// jg18 - default priorities and limits for retail gameplay sounds
|
||||
static const int NUM_RETAIL_GAMEPLAY_SOUNDS = 192; // indices 0-191, from retail sounds.tbl
|
||||
static EnhancedSoundData Default_sound_priorities[NUM_RETAIL_GAMEPLAY_SOUNDS] =
|
||||
{
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_MISSILE_TRACKING = 0, //!< Missle tracking to acquire a lock (looped)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_MISSILE_LOCK = 1, //!< Missle lock (non-looping)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_PRIMARY_CYCLE = 2, //!< cycle primary weapon
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_SECONDARY_CYCLE = 3, //!< cycle secondary weapon
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_ENGINE = 4, //!< engine sound (as heard in cockpit)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_CARGO_REVEAL = 5, //!< cargo revealed
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 3), // SND_DEATH_ROLL = 6, //!< ship death roll
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 2), // SND_SHIP_EXPLODE_1 = 7, //!< ship explosion 1
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_TARGET_ACQUIRE = 8, //!< target acquried
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_ENERGY_ADJUST = 9, //!< energy level change success
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_ENERGY_ADJUST_FAIL = 10, //!< energy level change fail
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_ENERGY_TRANS = 11, //!< energy transfer success
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_ENERGY_TRANS_FAIL = 12, //!< energy transfer fail
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_FULL_THROTTLE = 13, //!< set full throttle
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_ZERO_THROTTLE = 14, //!< set zero throttle
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_THROTTLE_UP = 15, //!< set 1/3 or 2/3 throttle (up)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_THROTTLE_DOWN = 16, //!< set 1/3 or 2/3 throttle (down)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_DOCK_APPROACH = 17, //!< dock approach retros
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_DOCK_ATTACH = 18, //!< dock attach
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_DOCK_DETACH = 19, //!< dock detach
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_DOCK_DEPART = 20, //!< dock depart retros
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_ABURN_ENGAGE = 21, //!< afterburner engage
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_ABURN_LOOP = 22, //!< afterburner burn sound (looped)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 3), // SND_VAPORIZED = 23, //!< Destroyed by a beam (vaporized)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 2), // SND_ABURN_FAIL = 24, //!< afterburner fail (no fuel when aburn pressed)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_HEATLOCK_WARN = 25, //!< heat-seeker launch warning
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_OUT_OF_MISSLES = 26, //!< tried to fire a missle when none are left
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_OUT_OF_WEAPON_ENERGY = 27, //!< tried to fire lasers when not enough energy left
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_TARGET_FAIL = 28, //!< target fail sound (i.e. press targeting key, but nothing happens)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_SQUADMSGING_ON = 29, //!< squadmate message menu appears
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_SQUADMSGING_OFF = 30, //!< squadmate message menu disappears
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 5), // SND_DEBRIS = 31, //!< debris sound (persistant, looping)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 2), // SND_SUBSYS_DIE_1 = 32, //!< subsystem gets destroyed on player ship
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_MISSILE_START_LOAD = 33, //!< missle start load (during rearm/repair)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_MISSILE_LOAD = 34, //!< missle load (during rearm/repair)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_SHIP_REPAIR = 35, //!< ship is being repaired (during rearm/repair)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 3), // SND_PLAYER_HIT_LASER = 36, //!< player ship is hit by laser fire
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 3), // SND_PLAYER_HIT_MISSILE = 37, //!< player ship is hit by missile
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_CMEASURE_CYCLE = 38, //!< countermeasure cycle
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 2), // SND_SHIELD_HIT = 39, //!< shield hit
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 2), // SND_SHIELD_HIT_YOU = 40, //!< player shield is hit
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_GAME_MOUSE_CLICK = 41, //!< mouse click
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 2), // SND_ASPECTLOCK_WARN = 42, //!< aspect launch warning
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_SHIELD_XFER_OK = 43, //!< shield quadrant transfer successful
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 5), // SND_ENGINE_WASH = 44, //!< Engine wash (looped)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 2), // SND_WARP_IN = 45, //!< warp hole opening up for arriving
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 2), // SND_WARP_OUT = 46, //!< warp hole opening up for departing (Same as warp in for now)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_PLAYER_WARP_FAIL = 47, //!< player warp has failed
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_STATIC = 48, //!< hud gauge static
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 3), // SND_SHIP_EXPLODE_2 = 49, //!< ship explosion 2
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_PLAYER_WARP_OUT = 50, //!< ship is warping out in 3rd person
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 5), // SND_SHIP_SHIP_HEAVY = 51, //!< heavy ship-ship collide sound
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 5), // SND_SHIP_SHIP_LIGHT = 52, //!< light ship-ship collide sound
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 5), // SND_SHIP_SHIP_SHIELD = 53, //!< shield ship-ship collide overlay sound
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_THREAT_FLASH = 54, //!< missile threat indicator flashes
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 3), // SND_PROXIMITY_WARNING = 55, //!< proximity warning (heat seeker)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 3), // SND_PROXIMITY_ASPECT_WARNING = 56, //!< proximity warning (aspect)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 2), // SND_DIRECTIVE_COMPLETE = 57, //!< directive complete
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 3), // SND_SUBSYS_EXPLODE = 58, //!< other ship subsystem destroyed
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 2), // SND_CAPSHIP_EXPLODE = 59, //!< captial ship explosion
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_CAPSHIP_SUBSYS_EXPLODE = 60, //!< captial ship subsystem destroyed
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 2), // SND_LARGESHIP_WARPOUT = 61, //!< large ship warps out
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 5), // SND_ASTEROID_EXPLODE_LARGE = 62, //!< large asteroid blows up
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 5), // SND_ASTEROID_EXPLODE_SMALL = 63, //!< small asteroid blows up
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 2), // SND_CUE_VOICE = 64, //!< sound to indicate voice is about to start
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 2), // SND_END_VOICE = 65, //!< sound to indicate voice has ended
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 2), // SND_CARGO_SCAN = 66, //!< cargo scanning (looped)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 5), // SND_WEAPON_FLYBY = 67, //!< weapon flyby sound
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 5), // SND_ASTEROID = 68, //!< asteroid sound (persistant, looped)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 2), // SND_CAPITAL_WARP_IN = 69, //!< capital warp hole opening
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 2), // SND_CAPITAL_WARP_OUT = 70, //!< capital warp hole closing
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 5), // SND_ENGINE_LOOP_LARGE = 71, //!< LARGE engine ambient
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_SUBSPACE_LEFT_CHANNEL = 72, //!< subspace ambient sound (left channel) (looped)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_SUBSPACE_RIGHT_CHANNEL = 73, //!< subspace ambient sound (right channel) (looped)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 4), // SND_MISSILE_EVADED_POPUP = 74, //!< "evaded" HUD popup
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_ENGINE_LOOP_HUGE = 75, //!< HUGE engine ambient
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_LIGHT_LASER_FIRE = 76, //!< SD-4 Sidearm laser fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_LIGHT_LASER_IMPACT = 77, //!< DR-2 Scalpel fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_HVY_LASER_FIRE = 78, //!< Flail II fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_HVY_LASER_IMPACT = 79, //!< Prometheus R laser fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_MASSDRV_FIRED = 80, //!< Prometheus S laser fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_MASSDRV_IMPACT = 81, //!< GTW-66 Newton Cannon fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_FLAIL_FIRED = 82, //!< UD-8 Kayser Laser fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_FLAIL_IMPACT = 83, //!< GTW-19 Circe laser fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_NEUTRON_FLUX_FIRED = 84, //!< GTW-83 Lich laser fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_NEUTRON_FLUX_IMPACT = 85, //!< Laser impact
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_DEBUG_LASER_FIRED = 86, //!< Subach-HLV Vasudan laser
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_ROCKEYE_FIRED = 87, //!< rockeye missile launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_MISSILE_IMPACT1 = 88, //!< missile impact 1
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_MAG_MISSILE_LAUNCH = 89, //!< mag pulse missile launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_FURY_MISSILE_LAUNCH = 90, //!< fury missile launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_SHRIKE_MISSILE_LAUNCH = 91, //!< shrike missile launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_ANGEL_MISSILE_LAUNCH = 92, //!< angel fire missile launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_CLUSTER_MISSILE_LAUNCH = 93, //!< cluster bomb launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_CLUSTERB_MISSILE_LAUNCH = 94, //!< cluster baby bomb launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_STILETTO_MISSILE_LAUNCH = 95, //!< stiletto bomb launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_TSUNAMI_MISSILE_LAUNCH = 96, //!< tsunami bomb launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_HARBINGER_MISSILE_LAUNCH = 97, //!< harbinger bomb launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_MEGAWOKKA_MISSILE_LAUNCH = 98, //!< mega wokka launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_CMEASURE1_LAUNCH = 99, //!< countermeasure 1 launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_SHIVAN_LIGHT_LASER_FIRE = 100,//!< Shivan light laser
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_SHOCKWAVE_EXPLODE = 101,//!< shockwave ignition
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_SWARM_MISSILE_LAUNCH = 102,//!< swarm missile sound
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_UNDEFINED_103 = 103,//!< Shivan heavy laser
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_UNDEFINED_104 = 104,//!< Vasudan SuperCap engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 5), // SND_UNDEFINED_105 = 105,//!< Shivan SuperCap engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 5), // SND_UNDEFINED_106 = 106,//!< Terran SuperCap engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_UNDEFINED_107 = 107,//!< Vasudan light laser fired
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_UNDEFINED_108 = 108,//!< Shivan heavy laser
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 2), // SND_SHOCKWAVE_IMPACT = 109,//!< shockwave impact
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_UNDEFINED_110 = 110,//!< TERRAN TURRET 1
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_UNDEFINED_111 = 111,//!< TERRAN TURRET 2
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_UNDEFINED_112 = 112,//!< VASUDAN TURRET 1
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_UNDEFINED_113 = 113,//!< VASUDAN TURRET 2
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_UNDEFINED_114 = 114,//!< SHIVAN TURRET 1
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_TARG_LASER_LOOP = 115,//!< targeting laser loop sound
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 8), // SND_FLAK_FIRE = 116,//!< Flak Gun Launch
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_SHIELD_BREAKER = 117,//!< Flak Gun Impact
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM_LOW, 8), // SND_EMP_MISSILE = 118,//!< EMP Missle
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 5), // SND_AUTOCANNON_LOOP = 119,//!< Escape Pod Drone
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 5), // SND_AUTOCANNON_SHOT = 120,//!< Beam Hit 1
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_BEAM_LOOP = 121,//!< beam loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_BEAM_UP = 122,//!< beam power up
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_BEAM_DOWN = 123,//!< beam power down
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_BEAM_SHOT = 124,//!< Beam shot 1
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_BEAM_VAPORIZE = 125,//!< Beam shot 2
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_TERRAN_FIGHTER_ENG = 126,//!< Terran fighter engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_TERRAN_BOMBER_ENG = 127,//!< Terran bomber engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_TERRAN_CAPITAL_ENG = 128,//!< Terran cruiser engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_SPECIESB_FIGHTER_ENG = 129,//!< Vasudan fighter engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_SPECIESB_BOMBER_ENG = 130,//!< Vasudan bomber engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_SPECIESB_CAPITAL_ENG = 131,//!< Vasudan cruiser engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_SHIVAN_FIGHTER_ENG = 132,//!< Shivan fighter engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_SHIVAN_BOMBER_ENG = 133,//!< Shivan bomber engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_SHIVAN_CAPITAL_ENG = 134,//!< Shivan cruiser engine
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 3), // SND_REPAIR_SHIP_ENG = 135,//!< Repair ship beacon/engine sound
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_UNDEFINED_136 = 136,//!< Terran capital engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_UNDEFINED_137 = 137,//!< Vasudan capital engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 4), // SND_UNDEFINED_138 = 138,//!< Shivan capital engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_DEBRIS_ARC_01 = 139,//!< 0.10 second spark sound effect
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_DEBRIS_ARC_02 = 140,//!< 0.25 second spark sound effect
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_DEBRIS_ARC_03 = 141,//!< 0.50 second spark sound effect
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_DEBRIS_ARC_04 = 142,//!< 0.75 second spark sound effect
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_DEBRIS_ARC_05 = 143,//!< 1.00 second spark sound effect
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_144 = 144,//!< LTerSlash beam loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_145 = 145,//!< TerSlash beam loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_146 = 146,//!< SGreen beam loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_147 = 147,//!< BGreen beem loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_148 = 148,//!< BFGreen been loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_149 = 149,//!< Antifighter beam loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_150 = 150,//!< 1 sec warm up
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_151 = 151,//!< 1.5 sec warm up
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_152 = 152,//!< 2.5 sec warm up
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_153 = 153,//!< 3 sec warm up
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_154 = 154,//!< 3.5 sec warm up
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_155 = 155,//!< 5 sec warm up
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_156 = 156,//!< LTerSlash warm down
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_157 = 157,//!< TerSlash warm down
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_158 = 158,//!< SGreen warm down
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_159 = 159,//!< BGreen warm down
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_160 = 160,//!< BFGreen warm down
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_161 = 161,//!< T_AntiFtr warm down
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_COPILOT = 162,//!< copilot (SCP)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_163 = 163,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_164 = 164,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_165 = 165,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_166 = 166,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_167 = 167,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_168 = 168,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_169 = 169,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_170 = 170,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_171 = 171,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_172 = 172,//!< (Empty in Retail)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_SUPERNOVA_1 = 173,//!< SuperNova (distant)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MUST_PLAY, 1), // SND_SUPERNOVA_2 = 174,//!< SuperNova (shockwave)
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_UNDEFINED_175 = 175,//!< Shivan large engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_MEDIUM, 3), // SND_UNDEFINED_176 = 176,//!< Shivan large engine
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_177 = 177,//!< SRed beam loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_178 = 178,//!< LRed beam loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 3), // SND_UNDEFINED_179 = 179,//!< Antifighter beam loop
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_LIGHTNING_1 = 180,//!< Thunder 1 sound in neblua
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 4), // SND_LIGHTNING_2 = 181,//!< Thunder 2 sound in neblua
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 3), // SND_UNDEFINED_182 = 182,//!< 1 sec warm up
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 3), // SND_UNDEFINED_183 = 183,//!< 1.5 sec warm up
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 3), // SND_UNDEFINED_184 = 184,//!< 3 sec warm up
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 2), // SND_UNDEFINED_185 = 185,//!< Shivan Commnode
|
||||
EnhancedSoundData( SND_ENHANCED_PRIORITY_HIGH, 1), // SND_UNDEFINED_186 = 186,//!< Volition PirateShip
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 3), // SND_UNDEFINED_187 = 187,//!< SRed warm down
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 3), // SND_UNDEFINED_188 = 188,//!< LRed warm down
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 3), // SND_UNDEFINED_189 = 189,//!< AntiFtr warm down
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 2), // SND_UNDEFINED_190 = 190,//!< Instellation 1
|
||||
EnhancedSoundData(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 2) // SND_UNDEFINED_191 = 191,//!< Instellation 2
|
||||
};
|
||||
|
||||
static const EnhancedSoundData default_enhanced_sound_data(SND_ENHANCED_PRIORITY_MEDIUM_HIGH, 1);
|
||||
|
||||
|
||||
/*
|
||||
* Update any uninitialized EnhancedSoundData in Snds
|
||||
* with hardcoded defaults for retail.
|
||||
*/
|
||||
void gamesnd_add_retail_default_enhanced_sound_data()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (SCP_vector<game_snd>::iterator it = Snds.begin(), end = Snds.end(); it != end; ++it, ++i)
|
||||
{
|
||||
if (it->enhanced_sound_data.priority== SND_ENHANCED_PRIORITY_INVALID)
|
||||
{
|
||||
if (i < NUM_RETAIL_GAMEPLAY_SOUNDS)
|
||||
{
|
||||
it->enhanced_sound_data.priority= Default_sound_priorities[i].priority;
|
||||
}
|
||||
else
|
||||
{
|
||||
it->enhanced_sound_data.priority= default_enhanced_sound_data.priority;
|
||||
}
|
||||
}
|
||||
|
||||
if (it->enhanced_sound_data.limit < 1)
|
||||
{
|
||||
if (i < NUM_RETAIL_GAMEPLAY_SOUNDS)
|
||||
{
|
||||
it->enhanced_sound_data.limit = Default_sound_priorities[i].limit;
|
||||
}
|
||||
else
|
||||
{
|
||||
it->enhanced_sound_data.limit= default_enhanced_sound_data.limit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gamesnd_play_iface(int n)
|
||||
{
|
||||
if (Snds_iface_handle[n] >= 0)
|
||||
@@ -268,7 +31,7 @@ void gamesnd_play_iface(int n)
|
||||
/**
|
||||
* Function to search for a given game_snd with the specified name
|
||||
* in the passed vector
|
||||
*
|
||||
*
|
||||
* @param name Name to search for
|
||||
* @param sounds Vector to seach in
|
||||
*
|
||||
@@ -301,7 +64,7 @@ int gamesnd_lookup_name(const char* name, const SCP_vector<game_snd>& sounds)
|
||||
int gamesnd_get_by_name(const char* name)
|
||||
{
|
||||
Assert( Snds.size() <= INT_MAX );
|
||||
|
||||
|
||||
int index = gamesnd_lookup_name(name, Snds);
|
||||
|
||||
if (index < 0)
|
||||
@@ -335,7 +98,7 @@ int gamesnd_get_by_iface_name(const char* name)
|
||||
{
|
||||
Assert( Snds_iface.size() <= INT_MAX );
|
||||
Assert( Snds_iface.size() == Snds_iface_handle.size() );
|
||||
|
||||
|
||||
int index = gamesnd_lookup_name(name, Snds_iface);
|
||||
|
||||
if (index < 0)
|
||||
@@ -385,8 +148,8 @@ int gamesnd_get_by_iface_tbl_index(int index)
|
||||
|
||||
/**
|
||||
* Helper function for parse_sound and parse_sound_list. Do not use directly.
|
||||
*
|
||||
* @param tag Tag
|
||||
*
|
||||
* @param tag Tag
|
||||
* @param idx_dest Sound index destination
|
||||
* @param object_name Object name being parsed
|
||||
* @param buf Buffer holding string to be parsed
|
||||
@@ -408,7 +171,7 @@ void parse_sound_core(const char* tag, int *idx_dest, const char* object_name, c
|
||||
}
|
||||
|
||||
size_t size_to_check = 0;
|
||||
|
||||
|
||||
if(flags & PARSE_SOUND_INTERFACE_SOUND)
|
||||
{
|
||||
size_to_check = Snds_iface.size();
|
||||
@@ -425,18 +188,17 @@ void parse_sound_core(const char* tag, int *idx_dest, const char* object_name, c
|
||||
if((*idx_dest) < -1 || (*idx_dest) >= (int)size_to_check)
|
||||
{
|
||||
(*idx_dest) = -1;
|
||||
Warning(LOCATION, "%s sound index out of range on '%s'. Must be between 0 and " SIZE_T_ARG ". Forcing to -1 (Nonexistent sound).\n",
|
||||
tag, object_name, size_to_check);
|
||||
Warning(LOCATION, "%s sound index out of range on '%s'. Must be between 0 and %d. Forcing to -1 (Nonexistent sound).\n", tag, object_name, size_to_check);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a sound. When using this function for a table entry,
|
||||
* required_string and optional_string aren't needed, as this function deals with
|
||||
* that as its tag parameter, just make sure that the destination sound index can
|
||||
* Parse a sound. When using this function for a table entry,
|
||||
* required_string and optional_string aren't needed, as this function deals with
|
||||
* that as its tag parameter, just make sure that the destination sound index can
|
||||
* handle -1 if things don't work out.
|
||||
*
|
||||
* @param tag Tag
|
||||
* @param tag Tag
|
||||
* @param idx_dest Sound index destination
|
||||
* @param object_name Object name being parsed
|
||||
* @param flags See the parse_sound_flags enum
|
||||
@@ -454,13 +216,13 @@ void parse_sound(const char* tag, int *idx_dest, const char* object_name, parse_
|
||||
}
|
||||
|
||||
/**
|
||||
* CommanderDJ - Parse a list of sounds. When using this function for a table entry,
|
||||
* required_string and optional_string aren't needed, as this function deals with
|
||||
* that as its tag parameter, just make sure that the destination sound index(es) can
|
||||
* CommanderDJ - Parse a list of sounds. When using this function for a table entry,
|
||||
* required_string and optional_string aren't needed, as this function deals with
|
||||
* that as its tag parameter, just make sure that the destination sound index(es) can
|
||||
* handle -1 if things don't work out.
|
||||
*
|
||||
* @param destination Vector where sound indexes are to be stored
|
||||
* @param tag Tag
|
||||
* @param tag Tag
|
||||
* @param object_name Name of object being parsed
|
||||
* @param flags See the parse_sound_flags enum
|
||||
*
|
||||
@@ -495,7 +257,7 @@ void parse_sound_list(const char* tag, SCP_vector<int>& destination, const char*
|
||||
//if we're using the old format, double check the size)
|
||||
if(!(flags & PARSE_SOUND_SCP_SOUND_LIST) && (destination.size() != (unsigned)check))
|
||||
{
|
||||
mprintf(("%s in '%s' has " SIZE_T_ARG " entries. This does not match entered size of %i.", tag, object_name, destination.size(), check));
|
||||
mprintf(("%s in '%s' has %i entries. This does not match entered size of %i.", tag, object_name, destination.size(), check));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -553,7 +315,7 @@ void gamesnd_unload_gameplay_sounds()
|
||||
snd_unload( gs->id );
|
||||
gs->id = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -621,29 +383,20 @@ void parse_gamesnd_old(game_snd* gs)
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->min = 0;
|
||||
gs->max = 0;
|
||||
|
||||
// silly retail, not abiding by its own format...
|
||||
if (!stricmp(gs->filename, "l_hit.wav") || !stricmp(gs->filename, "m_hit.wav"))
|
||||
{
|
||||
int temp_min, temp_max;
|
||||
|
||||
ignore_gray_space();
|
||||
if (stuff_int_optional(&temp_min, true) == 2)
|
||||
if (stuff_int_optional(&temp, true) == 2)
|
||||
{
|
||||
mprintf(("Dutifully ignoring the extra sound values for retail sound %s, '%s'...\n", gs->name.c_str(), gs->filename));
|
||||
ignore_gray_space();
|
||||
if (stuff_int_optional(&temp_max, true) == 2)
|
||||
{
|
||||
mprintf(("Dutifully converting retail sound %s, '%s' to a 3D sound...\n", gs->name.c_str(), gs->filename));
|
||||
is_3d = 1;
|
||||
|
||||
gs->flags |= GAME_SND_USE_DS3D;
|
||||
gs->min = temp_min;
|
||||
gs->max = temp_max;
|
||||
}
|
||||
stuff_int_optional(&temp, true);
|
||||
}
|
||||
}
|
||||
|
||||
gs->min = 0;
|
||||
gs->max = 0;
|
||||
}
|
||||
|
||||
// check for extra values per Mantis #2408
|
||||
@@ -656,93 +409,32 @@ void parse_gamesnd_old(game_snd* gs)
|
||||
advance_to_eoln(NULL);
|
||||
}
|
||||
|
||||
EnhancedSoundPriority convert_to_enhanced_priority(const char * priority_str)
|
||||
void parse_gamesnd_new(game_snd* gs)
|
||||
{
|
||||
Assertion(priority_str != NULL, "convert_to_enhanced_priority given null priority_str!");
|
||||
|
||||
if (!stricmp(priority_str, "Must Play"))
|
||||
{
|
||||
return SND_ENHANCED_PRIORITY_MUST_PLAY;
|
||||
}
|
||||
else if (!stricmp(priority_str, "High"))
|
||||
{
|
||||
return SND_ENHANCED_PRIORITY_HIGH;
|
||||
}
|
||||
else if (!stricmp(priority_str, "Medium-High"))
|
||||
{
|
||||
return SND_ENHANCED_PRIORITY_MEDIUM_HIGH;
|
||||
}
|
||||
else if (!stricmp(priority_str, "Medium"))
|
||||
{
|
||||
return SND_ENHANCED_PRIORITY_MEDIUM;
|
||||
}
|
||||
else if (!stricmp(priority_str, "Medium-Low"))
|
||||
{
|
||||
return SND_ENHANCED_PRIORITY_MEDIUM_LOW;
|
||||
}
|
||||
else if (!stricmp(priority_str, "Low"))
|
||||
{
|
||||
return SND_ENHANCED_PRIORITY_LOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
error_display(1, "Unknown enhanced sound priority: %s\n", priority_str);
|
||||
return SND_ENHANCED_PRIORITY_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
bool required_string_no_create(const char* token, bool no_create)
|
||||
{
|
||||
if (no_create)
|
||||
{
|
||||
return optional_string(token) == 1;
|
||||
}
|
||||
|
||||
required_string(token);
|
||||
return true;
|
||||
}
|
||||
|
||||
void parse_gamesnd_new(game_snd* gs, bool no_create)
|
||||
{
|
||||
char name[MAX_FILENAME_LEN];
|
||||
// New extended format found
|
||||
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
|
||||
|
||||
if (!stricmp(name, NOX("empty")))
|
||||
stuff_string(gs->filename, F_NAME, MAX_FILENAME_LEN);
|
||||
|
||||
if (!stricmp(gs->filename, NOX("empty")))
|
||||
{
|
||||
gs->filename[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// If the name _doesn't_ match <same> put it into gs->filename;
|
||||
if (stricmp(name, "<same>"))
|
||||
{
|
||||
strcpy_s(gs->filename, name);
|
||||
}
|
||||
else if (!no_create)
|
||||
{
|
||||
// Throw an error if <same> was specified but we are creating a new entry
|
||||
error_display(1, "'<same>' is only allowed if +nocreate was specified!");
|
||||
return;
|
||||
}
|
||||
required_string("+Preload:");
|
||||
|
||||
if (required_string_no_create("+Preload:", no_create))
|
||||
{
|
||||
stuff_boolean(&gs->preload);
|
||||
}
|
||||
stuff_boolean(&gs->preload);
|
||||
|
||||
if (required_string_no_create("+Volume:", no_create))
|
||||
{
|
||||
stuff_float(&gs->default_volume);
|
||||
}
|
||||
required_string("+Volume:");
|
||||
|
||||
stuff_float(&gs->default_volume);
|
||||
|
||||
if (optional_string("+3D Sound:"))
|
||||
{
|
||||
gs->flags |= GAME_SND_USE_DS3D;
|
||||
required_string("+Attenuation start:");
|
||||
|
||||
|
||||
stuff_int(&gs->min);
|
||||
|
||||
|
||||
required_string("+Attenuation end:");
|
||||
|
||||
stuff_int(&gs->max);
|
||||
@@ -752,34 +444,6 @@ void parse_gamesnd_new(game_snd* gs, bool no_create)
|
||||
gs->min = 0;
|
||||
gs->max = 0;
|
||||
}
|
||||
|
||||
// jg18 - enhanced sound parameters
|
||||
if (optional_string("+Priority:"))
|
||||
{
|
||||
SCP_string priority_string;
|
||||
stuff_string(priority_string, F_NAME);
|
||||
EnhancedSoundPriority priority = convert_to_enhanced_priority(priority_string.c_str());
|
||||
if (priority != SND_ENHANCED_PRIORITY_INVALID)
|
||||
{
|
||||
gs->enhanced_sound_data.priority= priority;
|
||||
}
|
||||
// else case not needed since conversion function displays message on error
|
||||
}
|
||||
|
||||
if (optional_string("+Limit:"))
|
||||
{
|
||||
int temp_limit;
|
||||
stuff_int(&temp_limit);
|
||||
|
||||
if ((temp_limit > 0) && (static_cast<uint>(temp_limit) <= SND_ENHANCED_MAX_LIMIT))
|
||||
{
|
||||
gs->enhanced_sound_data.limit = (unsigned int)temp_limit;
|
||||
}
|
||||
else
|
||||
{
|
||||
error_display(1, "Invalid enhanced sound limit: %d\n", temp_limit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gamesnd_parse_entry(game_snd *gs, bool no_create, SCP_vector<game_snd> *lookupVector)
|
||||
@@ -818,7 +482,7 @@ void gamesnd_parse_entry(game_snd *gs, bool no_create, SCP_vector<game_snd> *loo
|
||||
|
||||
if (optional_string("+Filename:"))
|
||||
{
|
||||
parse_gamesnd_new(gs, no_create);
|
||||
parse_gamesnd_new(gs);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -828,19 +492,19 @@ void gamesnd_parse_entry(game_snd *gs, bool no_create, SCP_vector<game_snd> *loo
|
||||
|
||||
/**
|
||||
* Parse a sound effect entry by requiring the given tag at the beginning.
|
||||
*
|
||||
*
|
||||
* @param gs The game_snd instance to fill in
|
||||
* @param tag The tag that's required before an entry
|
||||
* @param lookupVector If non-NULL used to look up @c +nocreate entries
|
||||
*
|
||||
*
|
||||
* @return @c true when a new entry has been parsed and should be added to the list of known
|
||||
* entries. @c false otherwise, for example in case of @c +nocreate
|
||||
*/
|
||||
bool gamesnd_parse_line(game_snd *gs, const char *tag, SCP_vector<game_snd> *lookupVector = NULL)
|
||||
{
|
||||
Assertion(gs != NULL, "Invalid game_snd pointer passed to gamesnd_parse_line!");
|
||||
|
||||
required_string(tag);
|
||||
|
||||
required_string(const_cast<char*>(tag));
|
||||
|
||||
bool no_create = false;
|
||||
|
||||
@@ -1029,85 +693,83 @@ static SCP_vector<species_info> missingFlybySounds;
|
||||
|
||||
void parse_sound_table(const char* filename)
|
||||
{
|
||||
try
|
||||
int rval;
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0)
|
||||
{
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// Parse the gameplay sounds section
|
||||
if (optional_string("#Game Sounds Start"))
|
||||
{
|
||||
while (!check_for_string("#Game Sounds End"))
|
||||
{
|
||||
game_snd tempSound;
|
||||
if (gamesnd_parse_line(&tempSound, "$Name:", &Snds))
|
||||
{
|
||||
Snds.push_back(game_snd(tempSound));
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Game Sounds End");
|
||||
}
|
||||
|
||||
// Parse the interface sounds section
|
||||
if (optional_string("#Interface Sounds Start"))
|
||||
{
|
||||
while (!check_for_string("#Interface Sounds End"))
|
||||
{
|
||||
game_snd tempSound;
|
||||
if (gamesnd_parse_line(&tempSound, "$Name:", &Snds_iface))
|
||||
{
|
||||
Snds_iface.push_back(game_snd(tempSound));
|
||||
Snds_iface_handle.push_back(-1);
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Interface Sounds End");
|
||||
}
|
||||
|
||||
// parse flyby sound section
|
||||
if (optional_string("#Flyby Sounds Start"))
|
||||
{
|
||||
char species_name_tag[NAME_LENGTH + 2];
|
||||
int sanity_check = 0;
|
||||
size_t i;
|
||||
|
||||
while (!check_for_string("#Flyby Sounds End") && (sanity_check <= (int)Species_info.size()))
|
||||
{
|
||||
for (i = 0; i < Species_info.size(); i++)
|
||||
{
|
||||
species_info *species = &Species_info[i];
|
||||
|
||||
sprintf(species_name_tag, "$%s:", species->species_name);
|
||||
|
||||
if (check_for_string(species_name_tag))
|
||||
{
|
||||
gamesnd_parse_line(&species->snd_flyby_fighter, species_name_tag);
|
||||
gamesnd_parse_line(&species->snd_flyby_bomber, species_name_tag);
|
||||
sanity_check--;
|
||||
}
|
||||
else
|
||||
{
|
||||
sanity_check++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Flyby Sounds End");
|
||||
}
|
||||
|
||||
if (optional_string("#Sound Environments Start"))
|
||||
{
|
||||
parse_sound_environments();
|
||||
}
|
||||
}
|
||||
catch (const parse::ParseException& e)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
|
||||
return;
|
||||
}
|
||||
|
||||
gamesnd_add_retail_default_enhanced_sound_data();
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// Parse the gameplay sounds section
|
||||
if (optional_string("#Game Sounds Start"))
|
||||
{
|
||||
while (!check_for_string("#Game Sounds End"))
|
||||
{
|
||||
game_snd tempSound;
|
||||
if (gamesnd_parse_line(&tempSound, "$Name:", &Snds))
|
||||
{
|
||||
Snds.push_back(game_snd(tempSound));
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Game Sounds End");
|
||||
}
|
||||
|
||||
// Parse the interface sounds section
|
||||
if (optional_string("#Interface Sounds Start"))
|
||||
{
|
||||
while (!check_for_string("#Interface Sounds End"))
|
||||
{
|
||||
game_snd tempSound;
|
||||
if (gamesnd_parse_line( &tempSound, "$Name:", &Snds_iface))
|
||||
{
|
||||
Snds_iface.push_back(game_snd(tempSound));
|
||||
Snds_iface_handle.push_back(-1);
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Interface Sounds End");
|
||||
}
|
||||
|
||||
// parse flyby sound section
|
||||
if (optional_string("#Flyby Sounds Start"))
|
||||
{
|
||||
char species_name_tag[NAME_LENGTH + 2];
|
||||
int sanity_check = 0;
|
||||
size_t i;
|
||||
|
||||
while (!check_for_string("#Flyby Sounds End") && (sanity_check <= (int)Species_info.size()))
|
||||
{
|
||||
for (i = 0; i < Species_info.size(); i++)
|
||||
{
|
||||
species_info *species = &Species_info[i];
|
||||
|
||||
sprintf(species_name_tag, "$%s:", species->species_name);
|
||||
|
||||
if (check_for_string(species_name_tag))
|
||||
{
|
||||
gamesnd_parse_line(&species->snd_flyby_fighter, species_name_tag);
|
||||
gamesnd_parse_line(&species->snd_flyby_bomber, species_name_tag);
|
||||
sanity_check--;
|
||||
}
|
||||
else
|
||||
{
|
||||
sanity_check++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Flyby Sounds End");
|
||||
}
|
||||
|
||||
if (optional_string("#Sound Environments Start"))
|
||||
{
|
||||
parse_sound_environments();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1119,7 +781,7 @@ void gamesnd_parse_soundstbl()
|
||||
|
||||
parse_modular_table("*-snd.tbm", parse_sound_table);
|
||||
|
||||
// if we are missing any species then report
|
||||
// if we are missing any species then report
|
||||
if (missingFlybySounds.size() > 0)
|
||||
{
|
||||
SCP_string errorString;
|
||||
@@ -1128,7 +790,7 @@ void gamesnd_parse_soundstbl()
|
||||
errorString.append(missingFlybySounds[i].species_name);
|
||||
errorString.append("\n");
|
||||
}
|
||||
|
||||
|
||||
Error(LOCATION, "The following species are missing flyby sounds in sounds.tbl:\n%s", errorString.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#ifndef __GAMESND_H__
|
||||
#define __GAMESND_H__
|
||||
|
||||
#include "mission/missionparse.h"
|
||||
#include "sound/sound.h"
|
||||
#include "mission/missionparse.h"
|
||||
|
||||
|
||||
void gamesnd_parse_soundstbl(); // Loads in general game sounds from sounds.tbl
|
||||
|
||||
Loaded 100 of 459 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user