mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 17:48:46 -10:00
Compare commits
226
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 | ||
|
|
90a6702ede | ||
|
|
54875d1de8 | ||
|
|
4e2ee8bece | ||
|
|
693448eb99 | ||
|
|
773ada0084 | ||
|
|
b7cd4e3c67 | ||
|
|
f860e040b2 | ||
|
|
46796a59c8 | ||
|
|
049b3205ef | ||
|
|
658c6c5aa8 | ||
|
|
5708875eda | ||
|
|
856c593a2c | ||
|
|
d1ec691f62 | ||
|
|
99948813c1 | ||
|
|
d04130c453 | ||
|
|
194300dc94 | ||
|
|
14aa992f6c | ||
|
|
c5bdbe268e | ||
|
|
793cd89ad3 | ||
|
|
4cbe3903d7 | ||
|
|
b9d06a1e58 | ||
|
|
af5928aa70 | ||
|
|
3d2c85f623 | ||
|
|
9d85779875 | ||
|
|
ca90ec8e75 | ||
|
|
23faeda404 | ||
|
|
46a3f5483a | ||
|
|
b2e1f1d211 | ||
|
|
c49d1a1e6a | ||
|
|
b991499620 | ||
|
|
9c5fd447fc | ||
|
|
504fb153db | ||
|
|
97d228947a | ||
|
|
d2cc75561d | ||
|
|
cb1f812cef | ||
|
|
316308cc40 | ||
|
|
e67daf2afc | ||
|
|
78cb7cc039 | ||
|
|
90151d3e0a | ||
|
|
74b89d9fc5 | ||
|
|
aa463ca772 | ||
|
|
fc555177fd | ||
|
|
b8c625d589 | ||
|
|
20abba69dc | ||
|
|
0457fcc9ad | ||
|
|
0a7fcfc0a5 | ||
|
|
51c14de891 | ||
|
|
e0ed2fa45f | ||
|
|
83bb931baf | ||
|
|
7d76471b03 | ||
|
|
690460df8e | ||
|
|
b1191f53d5 | ||
|
|
f865ab85b5 | ||
|
|
381f54663b | ||
|
|
8926a4de06 | ||
|
|
f5903f771d | ||
|
|
51abff326d | ||
|
|
34b7dbe233 | ||
|
|
be86442006 | ||
|
|
e773a0a94e | ||
|
|
709f914867 |
No files matched your search
+268
@@ -0,0 +1,268 @@
|
||||
*.o
|
||||
*.a
|
||||
.dirstamp
|
||||
libtool
|
||||
ltmain.sh
|
||||
m4/libtool.m4
|
||||
m4/ltoptions.m4
|
||||
m4/ltsugar.m4
|
||||
m4/ltversion.m4
|
||||
m4/lt~obsolete.m4
|
||||
compile
|
||||
.deps/
|
||||
code/.deps/
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
config.*
|
||||
code/fs2_open_*
|
||||
code/wxFRED2_*
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
missing
|
||||
.svn
|
||||
*.layout
|
||||
projects/Xcode4/Frameworks/
|
||||
projects/Xcode/Frameworks/
|
||||
|
||||
#========
|
||||
|
||||
#OS junk files
|
||||
[Tt]humbs.db
|
||||
*.DS_Store
|
||||
|
||||
#Visual Studio files
|
||||
*.[Oo]bj
|
||||
*.user
|
||||
*.aps
|
||||
*.pch
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ncb
|
||||
*.suo
|
||||
*.tlb
|
||||
*.tlh
|
||||
*.bak
|
||||
*.[Cc]ache
|
||||
*.ilk
|
||||
*.log
|
||||
*.lib
|
||||
*.sbr
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.unsuccessfulbuild
|
||||
ipch/
|
||||
[Oo]bj/
|
||||
[Bb]in
|
||||
[Dd]ebug*/
|
||||
[Rr]elease*/
|
||||
Ankh.NoLoad
|
||||
|
||||
#MonoDevelop
|
||||
*.pidb
|
||||
*.userprefs
|
||||
|
||||
#Tooling
|
||||
_ReSharper*/
|
||||
*.resharper
|
||||
[Tt]est[Rr]esult*
|
||||
*.sass-cache
|
||||
|
||||
#Project files
|
||||
[Bb]uild/
|
||||
|
||||
#Subversion files
|
||||
.svn
|
||||
|
||||
# Office Temp Files
|
||||
~$*
|
||||
|
||||
# vim Temp Files
|
||||
*~
|
||||
|
||||
#NuGet
|
||||
packages/
|
||||
*.nupkg
|
||||
|
||||
#ncrunch
|
||||
*ncrunch*
|
||||
*crunch*.local.xml
|
||||
|
||||
# visual studio database projects
|
||||
*.dbmdl
|
||||
|
||||
#Test files
|
||||
*.testsettings
|
||||
|
||||
#===========
|
||||
|
||||
#########################
|
||||
# .gitignore file for Xcode4 and Xcode5 Source projects
|
||||
#
|
||||
# Apple bugs, waiting for Apple to fix/respond:
|
||||
#
|
||||
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
|
||||
#
|
||||
# Version 2.1
|
||||
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
|
||||
#
|
||||
# 2013 updates:
|
||||
# - fixed the broken "save personal Schemes"
|
||||
# - added line-by-line explanations for EVERYTHING (some were missing)
|
||||
#
|
||||
# NB: if you are storing "built" products, this WILL NOT WORK,
|
||||
# and you should use a different .gitignore (or none at all)
|
||||
# This file is for SOURCE projects, where there are many extra
|
||||
# files that we want to exclude
|
||||
#
|
||||
#########################
|
||||
|
||||
#####
|
||||
# OS X temporary files that should never be committed
|
||||
#
|
||||
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
||||
|
||||
.DS_Store
|
||||
|
||||
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
||||
|
||||
.Trashes
|
||||
|
||||
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
||||
|
||||
*.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
|
||||
# from source-control, but YMMV
|
||||
|
||||
*.lock
|
||||
|
||||
#
|
||||
# profile - REMOVED temporarily (on double-checking, this seems incorrect; I can't find it in OS X docs?)
|
||||
#profile
|
||||
|
||||
|
||||
####
|
||||
# Xcode temporary files that should never be committed
|
||||
#
|
||||
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...
|
||||
|
||||
*~.nib
|
||||
|
||||
|
||||
####
|
||||
# Xcode build files -
|
||||
#
|
||||
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"
|
||||
|
||||
DerivedData/
|
||||
|
||||
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"
|
||||
|
||||
build/
|
||||
|
||||
|
||||
#####
|
||||
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
|
||||
#
|
||||
# This is complicated:
|
||||
#
|
||||
# SOMETIMES you need to put this file in version control.
|
||||
# Apple designed it poorly - if you use "custom executables", they are
|
||||
# saved in this file.
|
||||
# 99% of projects do NOT use those, so they do NOT want to version control this file.
|
||||
# ..but if you're in the 1%, comment out the line "*.pbxuser"
|
||||
|
||||
# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html
|
||||
|
||||
*.pbxuser
|
||||
|
||||
# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
|
||||
|
||||
*.mode1v3
|
||||
|
||||
# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
|
||||
|
||||
*.mode2v3
|
||||
|
||||
# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file
|
||||
|
||||
*.perspectivev3
|
||||
|
||||
# NB: also, whitelist the default ones, some projects need to use these
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
|
||||
|
||||
####
|
||||
# Xcode 4 - semi-personal settings
|
||||
#
|
||||
#
|
||||
# OPTION 1: ---------------------------------
|
||||
# throw away ALL personal settings (including custom schemes!
|
||||
# - unless they are "shared")
|
||||
#
|
||||
# NB: this is exclusive with OPTION 2 below
|
||||
xcuserdata
|
||||
|
||||
# OPTION 2: ---------------------------------
|
||||
# get rid of ALL personal settings, but KEEP SOME OF THEM
|
||||
# - NB: you must manually uncomment the bits you want to keep
|
||||
#
|
||||
# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X,
|
||||
# or manually install git over the top of the OS X version
|
||||
# NB: this is exclusive with OPTION 1 above
|
||||
#
|
||||
#xcuserdata/**/*
|
||||
|
||||
# (requires option 2 above): Personal Schemes
|
||||
#
|
||||
#!xcuserdata/**/xcschemes/*
|
||||
|
||||
####
|
||||
# XCode 4 workspaces - more detailed
|
||||
#
|
||||
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
|
||||
#
|
||||
# Workspace layout is quite spammy. For reference:
|
||||
#
|
||||
# /(root)/
|
||||
# /(project-name).xcodeproj/
|
||||
# project.pbxproj
|
||||
# /project.xcworkspace/
|
||||
# contents.xcworkspacedata
|
||||
# /xcuserdata/
|
||||
# /(your name)/xcuserdatad/
|
||||
# UserInterfaceState.xcuserstate
|
||||
# /xcsshareddata/
|
||||
# /xcschemes/
|
||||
# (shared scheme name).xcscheme
|
||||
# /xcuserdata/
|
||||
# /(your name)/xcuserdatad/
|
||||
# (private scheme).xcscheme
|
||||
# xcschememanagement.plist
|
||||
#
|
||||
#
|
||||
|
||||
####
|
||||
# Xcode 4 - Deprecated classes
|
||||
#
|
||||
# Allegedly, if you manually "deprecate" your classes, they get moved here.
|
||||
#
|
||||
# We're using source-control, so this is a "feature" that we do not want!
|
||||
|
||||
*.moved-aside
|
||||
|
||||
# .xccheckout
|
||||
#
|
||||
# Per http://stackoverflow.com/questions/18340453/should-xccheckout-files-in-xcode5-be-ignored-under-vcs
|
||||
#
|
||||
|
||||
*.xccheckout
|
||||
@@ -1,6 +1,26 @@
|
||||
ChangeLog for fs2_open. All times are UTC.
|
||||
Updated 2002-10-31 03:46
|
||||
|
||||
Features: September 2013
|
||||
http://www.hard-light.net/forums/index.php?topic=85700.0
|
||||
|
||||
- show-subtitle-text can now display messages as well as raw text - Goober5000
|
||||
- toggle subsytem scanning, scannable, cargo revealed, hidden from sensors, stealth and friendly stealth added to the alter-ship-flag sexp - karajorma
|
||||
- Support added to add more languages besides English, French, German and Polish, leading the way to better localization! - karajorma
|
||||
- event.log can now snapshot events checked in a frame and record the status of an event the previous time it was checked as well as the current state - karajorma
|
||||
- added a player-is-cheating sexp - The E
|
||||
- allow a user-specified number of credit images - Goober5000
|
||||
- allow the specification of the positions of medals, callsigns and labels on the medal screen. - Goober5000
|
||||
- lua function to check if a ship is warp capable, and access to a ship's auto-aim FOV - zookeeper
|
||||
- is-facing now works for things that aren't ships (like waypoints!) - zookeeper
|
||||
- experimental configurations to make AVX builds (see this post for more explainations) - The E
|
||||
- new ship flag to enable smarter AI use of afterburners. Now it can use them while flying waypoints or attacking capital ships (use the free-afterburner-use flag with alter-ship-flag) - Admiral MS
|
||||
- the number of medals is now dynamic! - Goober5000
|
||||
- frame profiling code, see what exactly is slowing down FreeSpace. (Mostly for devs or coders) - Swifty + The E
|
||||
- allowing fade-in and fade-out sexps to use any color, not just black, white and red. - Goober5000
|
||||
|
||||
==================================================================
|
||||
( massive gap in updates, maybe this will be filled in someday...)
|
||||
==================================================================
|
||||
|
||||
2002-10-30 22:57 randomtiger
|
||||
|
||||
|
||||
+3
-1
@@ -2,7 +2,9 @@
|
||||
#
|
||||
# This file uses GNU Automake to generate makefiles
|
||||
|
||||
SUBDIRS = code
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = mongoose code
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
||||
+7
-7
@@ -110,19 +110,19 @@ do
|
||||
( cd $dr
|
||||
aclocalinclude="$ACLOCAL_FLAGS"
|
||||
for k in $macrodirs; do
|
||||
if test -d $k; then
|
||||
if test -d $k; then
|
||||
aclocalinclude="$aclocalinclude -I $k"
|
||||
##else
|
||||
## echo "**Warning**: No such directory \`$k'. Ignored."
|
||||
fi
|
||||
done
|
||||
echo "Running $ACLOCAL $aclocalinclude ..."
|
||||
"$ACLOCAL" $aclocalinclude
|
||||
echo "Running $AUTOMAKE --add-missing --copy --foreign $am_opt ..."
|
||||
"$AUTOMAKE" --add-missing --copy --foreign $am_opt
|
||||
echo "Running autoconf..."
|
||||
autoconf
|
||||
echo "Running autoreconf..."
|
||||
autoreconf --install
|
||||
)
|
||||
# DIE if the subshell failed
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
+87
-14
@@ -185,10 +185,15 @@ EXTRA_DIST = \
|
||||
|
||||
# D_ variants are defaults and should always be used
|
||||
# FS2_ variants are for game building and wxFRED
|
||||
AM_CXXFLAGS = @D_CFLAGS@ @FS2_CXXFLAGS@
|
||||
AM_CXXFLAGS = @D_CFLAGS@ @FS2_CXXFLAGS@ -I../mongoose
|
||||
AM_LDFLAGS = @D_LDFLAGS@ @FS2_LDFLAGS@
|
||||
|
||||
noinst_LIBRARIES = libcode.a
|
||||
if BUILD_WXFRED
|
||||
LIBCODE=
|
||||
else
|
||||
LIBCODE=libcode.a
|
||||
endif
|
||||
noinst_LIBRARIES = $(LIBCODE)
|
||||
bin_PROGRAMS = @FS2_BINARY@
|
||||
|
||||
EXTRA_PROGRAMS = fs2_open_@PACKAGE_VERSION@ \
|
||||
@@ -258,7 +263,10 @@ FS2_SOURCES = \
|
||||
debris/debris.cpp \
|
||||
debris/debris.h \
|
||||
debugconsole/console.cpp \
|
||||
debugconsole/dbugfile.h \
|
||||
debugconsole/console.h \
|
||||
debugconsole/consolecmds.cpp \
|
||||
debugconsole/consoleparse.cpp \
|
||||
debugconsole/consoleparse.h \
|
||||
debugconsole/timerbar.cpp \
|
||||
debugconsole/timerbar.h \
|
||||
exceptionhandler/exceptionhandler.cpp \
|
||||
@@ -294,6 +302,7 @@ FS2_SOURCES = \
|
||||
globalincs/fsmemory.h \
|
||||
globalincs/globals.h \
|
||||
globalincs/linklist.h \
|
||||
globalincs/profiling.cpp \
|
||||
globalincs/pstypes.h \
|
||||
globalincs/safe_strings.cpp \
|
||||
globalincs/safe_strings.h \
|
||||
@@ -812,8 +821,8 @@ fs2_open_@PACKAGE_VERSION@_DEBUG_SOURCES = \
|
||||
fs2_open_@PACKAGE_VERSION@_SOURCES = \
|
||||
${FS2OPEN_SOURCES}
|
||||
|
||||
fs2_open_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a
|
||||
fs2_open_@PACKAGE_VERSION@_LDADD = libcode.a
|
||||
fs2_open_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a ../mongoose/libmongoose.a
|
||||
fs2_open_@PACKAGE_VERSION@_LDADD = libcode.a ../mongoose/libmongoose.a
|
||||
|
||||
##
|
||||
## End MAIN binary
|
||||
@@ -826,12 +835,79 @@ fs2_open_@PACKAGE_VERSION@_LDADD = libcode.a
|
||||
##
|
||||
|
||||
wxFRED_SOURCES = \
|
||||
wxfred2/wxfred2.cpp \
|
||||
wxfred2/wxfred2.h \
|
||||
wxfred2/fredframe.cpp \
|
||||
wxfred2/fredframe.h \
|
||||
wxfred2/wxfred_xrc.cpp \
|
||||
wxfred2/wxfred_xrc.h
|
||||
wxfred2/res/select.png.h \
|
||||
wxfred2/res/constz.png.h \
|
||||
wxfred2/res/constx.png.h \
|
||||
wxfred2/res/selectrot.png.h \
|
||||
wxfred2/res/constyz.png.h \
|
||||
wxfred2/res/constxy.png.h \
|
||||
wxfred2/res/wingform.png.h \
|
||||
wxfred2/res/zoomsel.png.h \
|
||||
wxfred2/res/constxz.png.h \
|
||||
wxfred2/res/consty.png.h \
|
||||
wxfred2/res/wingdisband.png.h \
|
||||
wxfred2/res/showdist.png.h \
|
||||
wxfred2/res/orbitsel.png.h \
|
||||
wxfred2/res/zoomext.png.h \
|
||||
wxfred2/res/rotlocal.png.h \
|
||||
wxfred2/res/selectmove.png.h \
|
||||
wxfred2/res/selectlock.png.h \
|
||||
wxfred2/res/selectlist.png.h \
|
||||
wxfred2/base/wxfred_base.h \
|
||||
wxfred2/base/wxfred_base.cpp \
|
||||
wxfred2/editors/dlgobjecteditor.h \
|
||||
wxfred2/editors/dlgobjecteditor.cpp \
|
||||
wxfred2/editors/dlgvoiceactingmanager.h \
|
||||
wxfred2/editors/frmdebriefingeditor.h \
|
||||
wxfred2/editors/dlgbackgroundeditor.cpp \
|
||||
wxfred2/editors/dlgmissionobjectiveseditor.cpp \
|
||||
wxfred2/editors/frmbriefingeditor.cpp \
|
||||
wxfred2/editors/frmteamloadouteditor.h \
|
||||
wxfred2/editors/dlgmissionobjectiveseditor.h \
|
||||
wxfred2/editors/dlgmissionspecseditor.h \
|
||||
wxfred2/editors/frmdebriefingeditor.cpp \
|
||||
wxfred2/editors/dlgfictionviewer.cpp \
|
||||
wxfred2/editors/dlgvoiceactingmanager.cpp \
|
||||
wxfred2/editors/dlgsoundenvironment.cpp \
|
||||
wxfred2/editors/frmcommandbriefingeditor.cpp \
|
||||
wxfred2/editors/frmbriefingeditor.h \
|
||||
wxfred2/editors/dlgshieldsystemeditor.h \
|
||||
wxfred2/editors/dlgreinforcementseditor.h \
|
||||
wxfred2/editors/dlgeventseditor.h \
|
||||
wxfred2/editors/frmteamloadouteditor.cpp \
|
||||
wxfred2/editors/frmcommandbriefingeditor.h \
|
||||
wxfred2/editors/frmwaypointeditor.h \
|
||||
wxfred2/editors/dlgasteroidfieldeditor.h \
|
||||
wxfred2/editors/dlgsetglobalshipflagseditor.cpp \
|
||||
wxfred2/editors/dlgshieldsystemeditor.cpp \
|
||||
wxfred2/editors/frmshipseditor.h \
|
||||
wxfred2/editors/dlgfictionviewer.h \
|
||||
wxfred2/editors/dlgreinforcementspicker.cpp \
|
||||
wxfred2/editors/frmcampaigneditor.cpp \
|
||||
wxfred2/editors/dlgasteroidfieldeditor.cpp \
|
||||
wxfred2/editors/dlgreinforcementspicker.h \
|
||||
wxfred2/editors/dlgreinforcementseditor.cpp \
|
||||
wxfred2/editors/frmcampaigneditor.h \
|
||||
wxfred2/editors/dlgbackgroundeditor.h \
|
||||
wxfred2/editors/frmshipseditor.cpp \
|
||||
wxfred2/editors/dlgeventseditor.cpp \
|
||||
wxfred2/editors/dlgsetglobalshipflagseditor.h \
|
||||
wxfred2/editors/frmwingeditor.h \
|
||||
wxfred2/editors/frmwingeditor.cpp \
|
||||
wxfred2/editors/frmwaypointeditor.cpp \
|
||||
wxfred2/editors/dlgsoundenvironment.h \
|
||||
wxfred2/editors/dlgmissionspecseditor.cpp \
|
||||
wxfred2/glcviewport.h \
|
||||
wxfred2/misc/dlgmissionstats.h \
|
||||
wxfred2/misc/dlgmissionstats.cpp \
|
||||
wxfred2/wxfred2.cpp \
|
||||
wxfred2/wxfred2.h \
|
||||
wxfred2/help/dlgsexphelp.h \
|
||||
wxfred2/help/dlgsexphelp.cpp \
|
||||
wxfred2/help/dlgaboutbox.h \
|
||||
wxfred2/help/dlgaboutbox.cpp \
|
||||
wxfred2/frmfred2.h \
|
||||
wxfred2/frmfred2.cpp
|
||||
|
||||
wxFRED2_@PACKAGE_VERSION@_DEBUG_SOURCES = \
|
||||
${wxFRED_SOURCES}
|
||||
@@ -839,9 +915,6 @@ wxFRED2_@PACKAGE_VERSION@_DEBUG_SOURCES = \
|
||||
wxFRED2_@PACKAGE_VERSION@_SOURCES = \
|
||||
${wxFRED_SOURCES}
|
||||
|
||||
wxFRED2_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a
|
||||
wxFRED2_@PACKAGE_VERSION@_LDADD = libcode.a
|
||||
|
||||
##
|
||||
## End wxFRED2 binary
|
||||
##
|
||||
|
||||
+11
-9
@@ -20,9 +20,9 @@
|
||||
#include "object/waypoint.h"
|
||||
|
||||
struct ship_weapon;
|
||||
struct ship_subsys;
|
||||
struct object;
|
||||
struct ship_info;
|
||||
class ship_subsys;
|
||||
class object;
|
||||
class ship_info;
|
||||
|
||||
#define AI_DEFAULT_CLASS 3 // default AI class for new ships (Fred)
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef struct ai_flag_name {
|
||||
int flag_list;
|
||||
} ai_flag_name;
|
||||
|
||||
#define MAX_AI_FLAG_NAMES 1
|
||||
#define MAX_AI_FLAG_NAMES 2
|
||||
extern ai_flag_name Ai_flag_names[];
|
||||
|
||||
#define AIF_FORMATION_WING (1 << 0) // Fly in formation as part of wing.
|
||||
@@ -64,6 +64,8 @@ extern ai_flag_name Ai_flag_names[];
|
||||
#define AIF_UNLOAD_PRIMARIES (1 << 24) // Fire primaries as fast as possible!
|
||||
#define AIF_TRYING_UNSUCCESSFULLY_TO_WARP (1 << 25) // Trying to warp, but can't warp at the moment
|
||||
|
||||
#define AIF_FREE_AFTERBURNER_USE (1 << 26) // Use afterburners while following waypoints or flying towards objects
|
||||
|
||||
#define AIF_AVOID_SHOCKWAVE (AIF_AVOID_SHOCKWAVE_SHIP | AIF_AVOID_SHOCKWAVE_WEAPON)
|
||||
#define AIF_FORMATION (AIF_FORMATION_WING | AIF_FORMATION_OBJECT)
|
||||
|
||||
@@ -107,6 +109,7 @@ extern ai_flag_name Ai_flag_names[];
|
||||
#define AIGF_PURGE (1<<5) // purge this goal next time we process
|
||||
#define AIGF_GOALS_PURGED (1<<6) // this goal has already caused other goals to get purged
|
||||
#define AIGF_DEPART_SOUND_PLAYED (1<<7) // Goober5000 - replacement for AL's hack ;)
|
||||
#define AIGF_TARGET_OWN_TEAM (1<<8) // Goober5000 - removes standard precautions against AI ships taking traitorous actions
|
||||
|
||||
#define AIGF_DOCK_INDEXES_VALID (AIGF_DOCKER_INDEX_VALID|AIGF_DOCKEE_INDEX_VALID)
|
||||
|
||||
@@ -366,10 +369,10 @@ typedef struct ai_info {
|
||||
int ai_class; // Class. Might be override of default.
|
||||
|
||||
// Probably become obsolete, to be replaced by path_start, path_cur, etc.
|
||||
waypoint_list *wp_list; // waypoint list being followed
|
||||
SCP_list<waypoint>::iterator wp_index; // waypoint index in list
|
||||
waypoint_list *wp_list; // waypoint list being followed
|
||||
size_t wp_index; // waypoint index in list
|
||||
int wp_flags; // waypoint flags, see WPF_xxxx
|
||||
int waypoint_speed_cap; // -1 no cap, otherwise cap - changed to int by Goober5000
|
||||
int waypoint_speed_cap; // -1 no cap, otherwise cap - changed to int by Goober5000
|
||||
|
||||
// Path following information
|
||||
int path_start; // Index into global array, start of path.
|
||||
@@ -587,7 +590,7 @@ extern char** Ai_class_names;
|
||||
extern int Num_ai_classes;
|
||||
extern int Ai_firing_enabled;
|
||||
|
||||
extern char *Skill_level_names(int skill_level, int translate = 1);
|
||||
extern const char *Skill_level_names(int skill_level, int translate = 1);
|
||||
extern int Ai_goal_signature;
|
||||
|
||||
// need access to following data in AiBig.cpp
|
||||
@@ -622,7 +625,6 @@ extern void ai_ignore_object(object *ignorer, object *ignored, int ignore_new);
|
||||
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_set_default_behavior(object *obj, int classnum);
|
||||
extern void ai_do_default_behavior(object *obj);
|
||||
extern void ai_start_waypoints(object *objp, waypoint_list *wp_list, int wp_flags);
|
||||
extern void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_quadrant, vec3d *hit_normal);
|
||||
|
||||
+13
-9
@@ -67,7 +67,7 @@ int ai_path_type_match(char *p)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void parse_ai_profiles_tbl(char *filename)
|
||||
void parse_ai_profiles_tbl(const char *filename)
|
||||
{
|
||||
int i, rval;
|
||||
char profile_name[NAME_LENGTH];
|
||||
@@ -75,13 +75,9 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
char *saved_Mp = NULL;
|
||||
char buf[NAME_LENGTH];
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", (filename) ? filename : "<default ai_profiles.tbl>", rval));
|
||||
lcl_ext_close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -467,6 +463,17 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
|
||||
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
|
||||
@@ -512,11 +519,8 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
required_string("#End");
|
||||
|
||||
// add tbl/tbm to multiplayer validation list
|
||||
extern void fs2netd_add_table_validation(char *tblname);
|
||||
extern void fs2netd_add_table_validation(const char *tblname);
|
||||
fs2netd_add_table_validation(filename);
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
void ai_profiles_init()
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#define AIPF2_ASPECT_LOCK_COUNTERMEASURE (1 << 11)
|
||||
#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)
|
||||
|
||||
// AI Path types
|
||||
#define AI_PATH_MODE_NORMAL 0
|
||||
@@ -150,6 +151,11 @@ typedef struct ai_profile_t {
|
||||
|
||||
int ai_path_mode;
|
||||
|
||||
// Ships flying bay paths will gradually accelerate/decelerate instead of
|
||||
// flying the whole path at max speed
|
||||
float bay_arrive_speed_mult;
|
||||
float bay_depart_speed_mult;
|
||||
|
||||
} ai_profile_t;
|
||||
|
||||
|
||||
|
||||
+109
-70
@@ -171,6 +171,8 @@ done_1:
|
||||
}
|
||||
|
||||
mc_info mc;
|
||||
mc_info_init(&mc);
|
||||
|
||||
mc.model_instance_num = Ships[objp->instance].model_instance_num;
|
||||
mc.model_num = sip->model_num;
|
||||
mc.orient = &objp->orient;
|
||||
@@ -367,9 +369,13 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
|
||||
object *target_objp;
|
||||
|
||||
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
|
||||
|
||||
if ( aip->target_objnum < 0 )
|
||||
return 0;
|
||||
|
||||
target_objp = &Objects[aip->target_objnum];
|
||||
|
||||
if ( (aip->targeted_subsys != NULL) && (aip->target_objnum >= 0) && (aip->targeted_subsys->system_info->path_num >= 0) ) {
|
||||
if ( (aip->targeted_subsys != NULL) && (aip->targeted_subsys->system_info->path_num >= 0) ) {
|
||||
int subsys_path_num, subsys_in_sight, checked_sight;
|
||||
float dist;
|
||||
|
||||
@@ -597,11 +603,15 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
|
||||
|
||||
// see if Pl_objp needs to reposition to get a good shot at subsystem which is being attacked
|
||||
if ( ai_big_maybe_follow_subsys_path() ) {
|
||||
if ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags & AIF_KAMIKAZE)) {
|
||||
afterburners_stop(Pl_objp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
vec3d *rel_pos, vec_to_enemy;
|
||||
float weapon_travel_dist;
|
||||
vec3d *rel_pos;
|
||||
vec3d vec_to_enemy;
|
||||
float weapon_travel_dist;
|
||||
|
||||
start_bank = Ships[aip->shipnum].weapons.current_primary_bank;
|
||||
|
||||
@@ -626,11 +636,25 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
|
||||
weapon_travel_dist = ai_get_weapon_dist(&Ships[Pl_objp->instance].weapons);
|
||||
|
||||
if ( aip->targeted_subsys != NULL ) {
|
||||
if (dist_to_enemy > (weapon_travel_dist-20))
|
||||
if (dist_to_enemy > (weapon_travel_dist-20)) {
|
||||
accelerate_ship(aip, 1.0f);
|
||||
else {
|
||||
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags2 & SF2_AFTERBURNER_LOCKED) && (dot_to_enemy > 0.75f)) {
|
||||
if (ai_maybe_fire_afterburner(Pl_objp, aip)) {
|
||||
afterburners_start(Pl_objp);
|
||||
aip->afterburner_stop_time = Missiontime + 3*F1_0;
|
||||
}
|
||||
} else if ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags & AIF_KAMIKAZE)) {
|
||||
afterburners_stop(Pl_objp);
|
||||
}
|
||||
} else {
|
||||
// AL 12-31-97: Move at least as quickly as your target is moving...
|
||||
accelerate_ship(aip, MAX(1.0f - dot_to_enemy, Objects[aip->target_objnum].phys_info.fspeed/sip->max_speed));
|
||||
|
||||
if ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags & AIF_KAMIKAZE)) {
|
||||
afterburners_stop(Pl_objp);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -651,10 +675,22 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
|
||||
if (dist_to_enemy < ATTACK_STOP_DISTANCE) {
|
||||
// accelerate_ship(aip, accel * 0.5f);
|
||||
accelerate_ship(aip, -1.0f);
|
||||
if ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags & AIF_KAMIKAZE)) {
|
||||
afterburners_stop(Pl_objp);
|
||||
}
|
||||
} else {
|
||||
accelerate_ship(aip, accel);
|
||||
}
|
||||
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags2 & SF2_AFTERBURNER_LOCKED) && (accel > 0.95f)) {
|
||||
if (ai_maybe_fire_afterburner(Pl_objp, aip)) {
|
||||
afterburners_start(Pl_objp);
|
||||
aip->afterburner_stop_time = Missiontime + 3*F1_0;
|
||||
}
|
||||
} else if ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags & AIF_KAMIKAZE)) {
|
||||
afterburners_stop(Pl_objp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -711,86 +747,75 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
|
||||
}
|
||||
|
||||
if (tswp->num_secondary_banks > 0) {
|
||||
|
||||
int priority1, priority2;
|
||||
|
||||
priority1 = -1;
|
||||
priority2 = -1;
|
||||
|
||||
// Maybe favor selecting a bomb.
|
||||
// Note, if you're firing a bomb, if it's aspect seeking, the firing conditions can be looser.
|
||||
if (Ship_info[Ships[En_objp->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))
|
||||
if (En_objp->phys_info.speed * dist_to_enemy < 5000.0f) // Don't select a bomb if enemy moving fast relative to distance
|
||||
priority1 = WIF_BOMB;
|
||||
|
||||
if (!(En_objp->flags & OF_PROTECTED) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
|
||||
//ai_select_secondary_weapon(Pl_objp, tswp, priority1, priority2); // Note, need to select to get weapon speed and lifetime
|
||||
if(aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) {
|
||||
priority1 = WIF_PUNCTURE;
|
||||
}
|
||||
ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
|
||||
int current_bank = tswp->current_secondary_bank;
|
||||
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
|
||||
if (current_bank > -1) {
|
||||
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
|
||||
|
||||
if(!(En_objp->flags & OF_PROTECTED) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
|
||||
// If ship is protected and very low on hits, don't fire missiles.
|
||||
if ((current_bank > -1) && (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage))) {
|
||||
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
|
||||
if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
|
||||
}
|
||||
}
|
||||
|
||||
if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
|
||||
float firing_range;
|
||||
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
firing_range=swip->lssm_lock_range;
|
||||
else
|
||||
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
|
||||
// reduce firing range of secondaries in nebula
|
||||
extern int Nebula_sec_range;
|
||||
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
|
||||
firing_range *= 0.8f;
|
||||
if(!(En_objp->flags & OF_PROTECTED) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
|
||||
// If ship is protected and very low on hits, don't fire missiles.
|
||||
if (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage)) {
|
||||
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
|
||||
if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
|
||||
}
|
||||
}
|
||||
|
||||
float t = 0.25f; // default delay in seconds until next fire.
|
||||
if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
|
||||
float firing_range;
|
||||
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
firing_range=swip->lssm_lock_range;
|
||||
else
|
||||
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
|
||||
// reduce firing range of secondaries in nebula
|
||||
extern int Nebula_sec_range;
|
||||
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
|
||||
firing_range *= 0.8f;
|
||||
}
|
||||
|
||||
if (dist_to_enemy < firing_range*1.0f) {
|
||||
float t = 0.25f; // default delay in seconds until next fire.
|
||||
|
||||
if (dist_to_enemy < firing_range*1.0f) {
|
||||
|
||||
|
||||
//vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed);
|
||||
//if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) {
|
||||
if (ai_fire_secondary_weapon(Pl_objp)) {
|
||||
if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) {
|
||||
if (swip->burst_shots > swp->burst_counter[current_bank]) {
|
||||
t = swip->burst_delay;
|
||||
swp->burst_counter[current_bank]++;
|
||||
} else {
|
||||
t = swip->fire_wait;
|
||||
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
|
||||
swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
|
||||
//vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed);
|
||||
//if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) {
|
||||
if (ai_fire_secondary_weapon(Pl_objp)) {
|
||||
|
||||
int current_bank_adjusted = MAX_SHIP_PRIMARY_BANKS + current_bank;
|
||||
|
||||
if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) {
|
||||
if (swip->burst_shots > swp->burst_counter[current_bank_adjusted]) {
|
||||
t = swip->burst_delay;
|
||||
swp->burst_counter[current_bank_adjusted]++;
|
||||
} else {
|
||||
swp->burst_counter[current_bank] = 0;
|
||||
t = swip->fire_wait;
|
||||
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
|
||||
swp->burst_counter[current_bank_adjusted] = myrand() % swip->burst_shots;
|
||||
} else {
|
||||
swp->burst_counter[current_bank_adjusted] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (swip->burst_shots > swp->burst_counter[current_bank]) {
|
||||
t = set_secondary_fire_delay(aip, temp_shipp, swip, true);
|
||||
swp->burst_counter[current_bank]++;
|
||||
} else {
|
||||
t = set_secondary_fire_delay(aip, temp_shipp, swip, false);
|
||||
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
|
||||
swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
|
||||
if (swip->burst_shots > swp->burst_counter[current_bank_adjusted]) {
|
||||
t = set_secondary_fire_delay(aip, temp_shipp, swip, true);
|
||||
swp->burst_counter[current_bank_adjusted]++;
|
||||
} else {
|
||||
swp->burst_counter[current_bank] = 0;
|
||||
t = set_secondary_fire_delay(aip, temp_shipp, swip, false);
|
||||
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
|
||||
swp->burst_counter[current_bank_adjusted] = myrand() % swip->burst_shots;
|
||||
} else {
|
||||
swp->burst_counter[current_bank_adjusted] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
|
||||
}
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
|
||||
}
|
||||
//}
|
||||
//}
|
||||
}
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
|
||||
}
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -861,6 +886,9 @@ void ai_big_chase()
|
||||
aip->submode_parm0 = Missiontime; // use parm0 as time strafe mode entered (i.e. MODE start time)
|
||||
aip->submode = AIS_STRAFE_AVOID;
|
||||
aip->submode_start_time = Missiontime;
|
||||
if (Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) {
|
||||
afterburners_stop(Pl_objp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -901,8 +929,12 @@ void ai_big_chase()
|
||||
case SM_ATTACK:
|
||||
case SM_SUPER_ATTACK:
|
||||
if (vm_vec_dist_quick(&Pl_objp->pos, &predicted_enemy_pos) > 100.0f + En_objp->radius * 2.0f) {
|
||||
if (maybe_avoid_big_ship(Pl_objp, En_objp, aip, &predicted_enemy_pos, 10.0f))
|
||||
if (maybe_avoid_big_ship(Pl_objp, En_objp, aip, &predicted_enemy_pos, 10.0f)) {
|
||||
if ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags & AIF_KAMIKAZE)) {
|
||||
afterburners_stop(Pl_objp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (aip->target_time < 2.0f)
|
||||
@@ -918,6 +950,13 @@ void ai_big_chase()
|
||||
//
|
||||
// Set turn and acceleration based on submode.
|
||||
//
|
||||
|
||||
if (((aip->submode != SM_ATTACK) && (aip->submode != SM_SUPER_ATTACK) && (aip->submode != SM_ATTACK_FOREVER) && (aip->submode != SM_EVADE_WEAPON)) || (aip->mode == AIM_STRAFE)){
|
||||
if ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags & AIF_KAMIKAZE)) {
|
||||
afterburners_stop(Pl_objp);
|
||||
}
|
||||
}
|
||||
|
||||
switch (aip->submode) {
|
||||
case SM_CONTINUOUS_TURN:
|
||||
ai_big_chase_ct();
|
||||
|
||||
+2
-2
@@ -12,10 +12,10 @@
|
||||
#ifndef __AIBIG_H__
|
||||
#define __AIBIG_H__
|
||||
|
||||
struct object;
|
||||
class object;
|
||||
struct ai_info;
|
||||
struct vec3d;
|
||||
struct ship_subsys;
|
||||
class ship_subsys;
|
||||
|
||||
void ai_big_ship(object *objp);
|
||||
void ai_big_chase();
|
||||
|
||||
+585
-182
File diff suppressed because it is too large.
Load diff
+23
-9
@@ -93,7 +93,7 @@ int Num_ai_goals = sizeof(Ai_goal_names) / sizeof(ai_goal_list);
|
||||
// HUD what a ship's current orders are. If the AI goal doesn't correspond to something that
|
||||
// ought to be printable, then NULL is used.
|
||||
// JAS: Converted to a function in order to externalize the strings
|
||||
char *Ai_goal_text(int goal)
|
||||
const char *Ai_goal_text(int goal)
|
||||
{
|
||||
switch(goal) {
|
||||
case 1:
|
||||
@@ -979,6 +979,16 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
|
||||
aigp->priority = MAX_GOAL_PRIORITY;
|
||||
}
|
||||
|
||||
// Goober5000 - we now have an extra optional chase argument to allow chasing our own team
|
||||
if ( op == OP_AI_CHASE || op == OP_AI_CHASE_WING || op == OP_AI_DISABLE_SHIP || op == OP_AI_DISARM_SHIP ) {
|
||||
if ((CDDDR(node) != -1) && is_sexp_true(CDDDR(node)))
|
||||
aigp->flags |= AIGF_TARGET_OWN_TEAM;
|
||||
}
|
||||
if ( op == OP_AI_DESTROY_SUBSYS ) {
|
||||
if ((CDDDDR(node) != -1) && is_sexp_true(CDDDDR(node)))
|
||||
aigp->flags |= AIGF_TARGET_OWN_TEAM;
|
||||
}
|
||||
|
||||
// Goober5000 - since none of the goals act on the actor,
|
||||
// don't assign the goal if the actor's goal target is itself
|
||||
if (aigp->target_name != NULL && !strcmp(aigp->target_name, actor_name))
|
||||
@@ -1374,13 +1384,17 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
if (!(shipp->flags2 & SF2_NO_SUBSPACE_DRIVE))
|
||||
return AI_GOAL_ACHIEVABLE;
|
||||
|
||||
// if no subspace drive, only valid if there's somewhere to depart to
|
||||
// if no subspace drive, only valid if our mothership is present
|
||||
|
||||
// locate a capital ship on the same team:
|
||||
if (ship_get_ship_with_dock_bay(shipp->team) >= 0)
|
||||
return AI_GOAL_ACHIEVABLE;
|
||||
else
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
// check that we have a mothership and that we can depart to it
|
||||
if (shipp->departure_location == DEPART_AT_DOCK_BAY)
|
||||
{
|
||||
int anchor_shipnum = ship_name_lookup(Parse_names[shipp->departure_anchor]);
|
||||
if (anchor_shipnum >= 0 && ship_useful_for_departure(anchor_shipnum, shipp->departure_path_mask))
|
||||
return AI_GOAL_ACHIEVABLE;
|
||||
}
|
||||
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
}
|
||||
|
||||
|
||||
@@ -2340,7 +2354,7 @@ void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, c
|
||||
}
|
||||
}
|
||||
|
||||
int query_referenced_in_ai_goals(ai_goal *goals, int type, char *name)
|
||||
int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name)
|
||||
{
|
||||
int i, mode, flag;
|
||||
|
||||
@@ -2405,7 +2419,7 @@ int query_referenced_in_ai_goals(ai_goal *goals, int type, char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *ai_add_dock_name(char *str)
|
||||
char *ai_add_dock_name(const char *str)
|
||||
{
|
||||
char *ptr;
|
||||
int i;
|
||||
|
||||
+3
-3
@@ -86,7 +86,7 @@ extern int Num_ai_goals;
|
||||
extern int Num_ai_dock_names;
|
||||
extern char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH];
|
||||
|
||||
extern char *Ai_goal_text(int goal);
|
||||
extern const char *Ai_goal_text(int goal);
|
||||
|
||||
// extern function definitions
|
||||
extern void ai_post_process_mission();
|
||||
@@ -118,8 +118,8 @@ extern void ai_mission_goal_complete( ai_info *aip );
|
||||
extern void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp );
|
||||
|
||||
extern void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, const char *new_name);
|
||||
extern int query_referenced_in_ai_goals(ai_goal *goals, int type, char *name);
|
||||
extern char *ai_add_dock_name(char *str);
|
||||
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 );
|
||||
|
||||
|
||||
+104
-32
@@ -22,6 +22,7 @@
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "weapon/muzzleflash.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
@@ -38,8 +39,7 @@
|
||||
float Lethality_range_const = 2.0f;
|
||||
DCF(lethality_range, "N for modifying range: 1 / (1+N) at 100")
|
||||
{
|
||||
dc_get_arg(ARG_FLOAT);
|
||||
Lethality_range_const = Dc_arg_float;
|
||||
dc_stuff_float(&Lethality_range_const);
|
||||
}
|
||||
|
||||
float Player_lethality_bump[NUM_SKILL_LEVELS] = {
|
||||
@@ -354,6 +354,54 @@ bool turret_weapon_has_flags2(ship_weapon *swp, int flags)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Just gloms all the flags from all the weapons into one variable. More efficient if all you need to do is test for the existence of a flag.
|
||||
*/
|
||||
int turret_weapon_aggregate_flags(ship_weapon *swp)
|
||||
{
|
||||
Assert(swp != NULL);
|
||||
|
||||
int i = 0, flags = 0;
|
||||
for (i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
if (swp->primary_bank_weapons[i] >= 0) {
|
||||
flags |= Weapon_info[swp->primary_bank_weapons[i]].wi_flags;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if (swp->secondary_bank_weapons[i] >= 0) {
|
||||
flags |= Weapon_info[swp->secondary_bank_weapons[i]].wi_flags;
|
||||
}
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Just gloms all the flags from all the weapons into one variable. More efficient if all you need to do is test for the existence of a flag.
|
||||
*/
|
||||
int turret_weapon_aggregate_flags2(ship_weapon *swp)
|
||||
{
|
||||
Assert(swp != NULL);
|
||||
|
||||
int i = 0, flags2 = 0;
|
||||
for (i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
if (swp->primary_bank_weapons[i] >= 0) {
|
||||
flags2 |= Weapon_info[swp->primary_bank_weapons[i]].wi_flags2;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if (swp->secondary_bank_weapons[i] >= 0) {
|
||||
flags2 |= Weapon_info[swp->secondary_bank_weapons[i]].wi_flags2;
|
||||
}
|
||||
}
|
||||
|
||||
return flags2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any of the weapons in swp have the subtype specified
|
||||
*
|
||||
@@ -479,7 +527,7 @@ int valid_turret_enemy(object *objp, object *turret_parent)
|
||||
}
|
||||
|
||||
// don't shoot at ships without collision check
|
||||
if (sip->flags & SIF_NO_COLLIDE) {
|
||||
if (!(objp->flags & OF_COLLIDES)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -501,7 +549,11 @@ int valid_turret_enemy(object *objp, object *turret_parent)
|
||||
weapon *wp = &Weapons[objp->instance];
|
||||
weapon_info *wip = &Weapon_info[wp->weapon_info_index];
|
||||
|
||||
if ( (!(wip->wi_flags & WIF_BOMB) && !(Ai_info[Ships[turret_parent->instance].ai_index].ai_profile_flags & AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY) ) ) {
|
||||
if (wip->subtype == WP_LASER && !(wip->wi_flags3 & WIF3_TURRET_INTERCEPTABLE)) { // If the thing can't be shot down, don't try. -MageKing17
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (!((wip->wi_flags & WIF_BOMB) || (wip->wi_flags3 & WIF3_TURRET_INTERCEPTABLE)) && !(Ai_info[Ships[turret_parent->instance].ai_index].ai_profile_flags & AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY) ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -598,9 +650,15 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
}
|
||||
}
|
||||
|
||||
// check if turret flagged to only target tagged ships
|
||||
// check if turret flagged to only target tagged ships
|
||||
// Note: retail behaviour was turrets with tagged-only could fire at bombs
|
||||
// and could fire their spawn weapons
|
||||
// this check is almost redundant; see the almost identical check in ai_fire_from_turret
|
||||
// however if this is removed turrets still track targets but don't fire at them (which looks silly)
|
||||
if (eeo->eeo_flags & EEOF_TAGGED_ONLY) {
|
||||
if (!ship_is_tagged(objp)) {
|
||||
if (!ship_is_tagged(objp) &&
|
||||
( (The_mission.ai_profile->flags2 & AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING) ||
|
||||
( !(objp->type == OBJ_WEAPON) && !(turret_weapon_has_flags(&eeo->turret_subsys->weapons, WIF_SPAWN))) )) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1049,7 +1107,7 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
objp = &Objects[mo->objnum];
|
||||
|
||||
Assert(objp->type == OBJ_WEAPON);
|
||||
if (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB)
|
||||
if ((Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB) || (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags3 & WIF3_TURRET_INTERCEPTABLE))
|
||||
{
|
||||
evaluate_obj_as_target(objp, &eeo);
|
||||
}
|
||||
@@ -1319,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 = 0;
|
||||
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;
|
||||
@@ -1365,7 +1423,7 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
|
||||
|
||||
//Try to guess where the enemy will be, and store that spot in predicted_enemy_pos
|
||||
if (The_mission.ai_profile->flags & AIPF_USE_ADDITIVE_WEAPON_VELOCITY) {
|
||||
vm_vec_sub2(&target_moving_direction, &objp->phys_info.vel);
|
||||
vm_vec_scale_sub2(&target_moving_direction, &objp->phys_info.vel, wip->vel_inherit_amount);
|
||||
}
|
||||
|
||||
set_predicted_enemy_pos_turret(predicted_enemy_pos, &gun_pos, objp, &enemy_point, &target_moving_direction, wip->max_speed, ss->turret_time_enemy_in_range * (weapon_system_strength + 1.0f)/2.0f);
|
||||
@@ -1466,10 +1524,16 @@ ship_subsys *aifft_list[MAX_AIFFT_TURRETS];
|
||||
float aifft_rank[MAX_AIFFT_TURRETS];
|
||||
int aifft_list_size = 0;
|
||||
int aifft_max_checks = 5;
|
||||
DCF(mf, "")
|
||||
DCF(mf, "Adjusts the maximum number of tries an AI may do when trying to pick a subsystem to attack (Default is 5)")
|
||||
{
|
||||
dc_get_arg(ARG_INT);
|
||||
aifft_max_checks = Dc_arg_int;
|
||||
dc_stuff_int(&aifft_max_checks);
|
||||
|
||||
if (aifft_max_checks <= 0) {
|
||||
dc_printf("Value must be a non-negative, non-zero integer\n");
|
||||
dc_printf("aifft_max_checks set to default value of 5\n");
|
||||
|
||||
aifft_max_checks = 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1820,8 +1884,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
}
|
||||
// now do anything else
|
||||
else {
|
||||
for (int i=0; i < wip->shots; i++)
|
||||
{
|
||||
for (int i = 0; i < wip->shots; i++) {
|
||||
// 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);
|
||||
@@ -1829,13 +1892,12 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
weapon_objnum = weapon_create( turret_pos, &turret_orient, turret_weapon_class, parent_objnum, -1, 1, 0,0.0f, turret);
|
||||
weapon_set_tracking_info(weapon_objnum, parent_objnum, turret->turret_enemy_objnum, 1, turret->targeted_subsys);
|
||||
|
||||
|
||||
objp=&Objects[weapon_objnum];
|
||||
wp=&Weapons[objp->instance];
|
||||
wip=&Weapon_info[wp->weapon_info_index];
|
||||
|
||||
//nprintf(("AI", "Turret_time_enemy_in_range = %7.3f\n", ss->turret_time_enemy_in_range));
|
||||
if (weapon_objnum != -1) {
|
||||
objp = &Objects[weapon_objnum];
|
||||
wp = &Weapons[objp->instance];
|
||||
wip = &Weapon_info[wp->weapon_info_index];
|
||||
|
||||
parent_ship->last_fired_turret = turret;
|
||||
turret->last_fired_weapon_info_index = wp->weapon_info_index;
|
||||
|
||||
@@ -1847,7 +1909,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[parent_objnum]);
|
||||
|
||||
// if the gun is a flak gun
|
||||
if(wip->wi_flags & WIF_FLAK){
|
||||
if (wip->wi_flags & WIF_FLAK) {
|
||||
// show a muzzle flash
|
||||
flak_muzzle_flash(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, turret_weapon_class);
|
||||
|
||||
@@ -1863,8 +1925,10 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
{
|
||||
flak_set_range(objp, flak_range_override);
|
||||
}
|
||||
} else if(wip->muzzle_flash > -1) {
|
||||
mflash_create(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, Weapon_info[turret_weapon_class].muzzle_flash);
|
||||
}
|
||||
// otherwise just do mflash if the weapon has it
|
||||
else if (wip->muzzle_flash >= 0) {
|
||||
mflash_create(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, wip->muzzle_flash);
|
||||
}
|
||||
|
||||
// in multiplayer (and the master), then send a turret fired packet.
|
||||
@@ -1954,6 +2018,11 @@ 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;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// maybe sound
|
||||
if ( Weapon_info[tsi->weapon_class].launch_snd != -1 ) {
|
||||
// Don't play turret firing sound if turret sits on player ship... it gets annoying.
|
||||
@@ -1961,8 +2030,7 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
snd_play_3d( &Snds[Weapon_info[tsi->weapon_class].launch_snd], &turret_pos, &View_position );
|
||||
}
|
||||
}
|
||||
if(Weapon_info[tsi->weapon_class].muzzle_flash > -1)
|
||||
mflash_create(&turret_pos, &turret_fvec, &Objects[tsi->parent_objnum].phys_info, Weapon_info[tsi->weapon_class].muzzle_flash);
|
||||
|
||||
// in multiplayer (and the master), then send a turret fired packet.
|
||||
if ( MULTIPLAYER_MASTER && (weapon_objnum != -1) ) {
|
||||
int subsys_index;
|
||||
@@ -2049,7 +2117,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
// (NOTE: this will probably get changed by other parts of the code (swarming, beams, etc) to be
|
||||
// a more accurate time, but we need to give it a long enough time for the other parts of the code
|
||||
// to change the timestamp before it gets acted upon - taylor)
|
||||
ss->turret_animation_done_time = timestamp(1000);
|
||||
ss->turret_animation_done_time = timestamp(200);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@@ -2219,6 +2287,8 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
}
|
||||
}
|
||||
|
||||
bool tagged_only = ((wip->wi_flags2 & WIF2_TAGGED_ONLY) || (ss->weapons.flags & SW_FLAG_TAGGED_ONLY));
|
||||
|
||||
if (lep->type == OBJ_SHIP) {
|
||||
// Check if we're targeting a protected ship
|
||||
if (lep->flags & OF_PROTECTED) {
|
||||
@@ -2251,14 +2321,16 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
ss->turret_time_enemy_in_range = 0.0f;
|
||||
continue;
|
||||
}
|
||||
// Check if weapon or turret is set to tagged-only
|
||||
// must check here in case turret has multiple weapons and not all are tagged-only
|
||||
else if (!ship_is_tagged(lep) && tagged_only) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//can't tag anything else, other than asteroids
|
||||
//but we don't want to waste this type of
|
||||
//weaponary on asteroids now do we?
|
||||
if ((wip->wi_flags2 & WIF2_TAGGED_ONLY) || (ss->weapons.flags & SW_FLAG_TAGGED_ONLY))
|
||||
{
|
||||
// check tagged-only for non-ship targets
|
||||
if (tagged_only && (!(lep->type == OBJ_WEAPON) || (The_mission.ai_profile->flags2 & AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2484,11 +2556,11 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
|
||||
if ( ok_to_fire && (tp->flags & MSS_FLAG_TURRET_HULL_CHECK) ) {
|
||||
int model_num = Ship_info[shipp->ship_info_index].model_num;
|
||||
mc_info hull_check;
|
||||
vec3d end;
|
||||
|
||||
vm_vec_scale_add(&end, &gpos, &gvec, model_get_radius(model_num));
|
||||
|
||||
mc_info hull_check;
|
||||
mc_info_init(&hull_check);
|
||||
hull_check.model_instance_num = shipp->model_instance_num;
|
||||
hull_check.model_num = model_num;
|
||||
hull_check.orient = &objp->orient;
|
||||
|
||||
+10
-6
@@ -196,8 +196,8 @@ anim_instance *anim_play(anim_play_struct *aps)
|
||||
}
|
||||
|
||||
if(aps->base_w < 0 || aps->base_h < 0) {
|
||||
instance->base_w = gr_screen.max_w_unscaled;
|
||||
instance->base_h = gr_screen.max_h_unscaled;
|
||||
instance->base_w = gr_screen.max_w_unscaled_zoomed;
|
||||
instance->base_h = gr_screen.max_h_unscaled_zoomed;
|
||||
} else {
|
||||
instance->base_w = aps->base_w;
|
||||
instance->base_h = aps->base_h;
|
||||
@@ -488,16 +488,20 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
|
||||
|
||||
// determine x,y to display the bitmap at
|
||||
if ( instance->world_pos == NULL ) {
|
||||
int old_max_w_unscaled = gr_screen.max_w_unscaled;
|
||||
int old_max_h_unscaled = gr_screen.max_h_unscaled;
|
||||
int old_max_w_unscaled_zoomed = gr_screen.max_w_unscaled_zoomed;
|
||||
int old_max_h_unscaled_zoomed = gr_screen.max_h_unscaled_zoomed;
|
||||
gr_set_screen_scale(instance->base_w, instance->base_h);
|
||||
gr_set_clip(0, 0, instance->base_w, instance->base_h, false);
|
||||
gr_set_clip(0, 0, instance->base_w, instance->base_h, GR_RESIZE_MENU);
|
||||
if ( instance->aa_color == NULL ) {
|
||||
gr_bitmap(instance->x, instance->y);
|
||||
gr_bitmap(instance->x, instance->y, GR_RESIZE_MENU_NO_OFFSET);
|
||||
}
|
||||
else {
|
||||
gr_set_color_fast( (color*)instance->aa_color );
|
||||
gr_aabitmap(instance->x, instance->y);
|
||||
gr_aabitmap(instance->x, instance->y, GR_RESIZE_MENU_NO_OFFSET);
|
||||
}
|
||||
gr_reset_screen_scale();
|
||||
gr_set_screen_scale(old_max_w_unscaled, old_max_h_unscaled, old_max_w_unscaled_zoomed, old_max_h_unscaled_zoomed);
|
||||
gr_reset_clip();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -301,7 +301,6 @@ int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_
|
||||
|
||||
Assert(packed_size == (save-dest_start) );
|
||||
return packed_size;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
@@ -467,7 +466,6 @@ int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, in
|
||||
|
||||
Assert(packed_size == (save-dest_start) );
|
||||
return packed_size;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
+11
-29
@@ -39,6 +39,8 @@
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multi.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "globalincs/compatibility.h"
|
||||
|
||||
@@ -859,7 +861,7 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
|
||||
dist = vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
|
||||
dot = vm_vec_dot(&Eye_matrix.vec.fvec, &vec_to_asteroid);
|
||||
|
||||
if ((dot < 0.7f) || (dist > 3000.0f)) {
|
||||
if ( (dot < 0.7f) || (dist > asfieldp->bound_rad) ) {
|
||||
if (Num_asteroids > MAX_ASTEROIDS-10) {
|
||||
objp->flags |= OF_SHOULD_BE_DEAD;
|
||||
} else {
|
||||
@@ -867,12 +869,11 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
|
||||
asteroid_wrap_pos(objp, asfieldp);
|
||||
Asteroids[objp->instance].target_objnum = -1;
|
||||
|
||||
vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
|
||||
dist = vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
|
||||
dot = vm_vec_dot(&Eye_matrix.vec.fvec, &vec_to_asteroid);
|
||||
dist = vm_vec_dist_quick(&objp->pos, &Eye_position);
|
||||
|
||||
if (( dot > 0.7f) && (dist < 3000.0f)) {
|
||||
// player would see asteroid pop out other side, so reverse velocity instead of wrapping
|
||||
if ( (dot > 0.7f) && (dist < (asfieldp->bound_rad * 1.3f)) ) {
|
||||
// player would see asteroid pop out other side, so reverse velocity instead of wrapping
|
||||
objp->pos = old_asteroid_pos;
|
||||
vm_vec_copy_scale(&objp->phys_info.vel, &old_vel, -1.0f);
|
||||
objp->phys_info.desired_vel = objp->phys_info.vel;
|
||||
@@ -914,6 +915,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
}
|
||||
|
||||
mc_info mc;
|
||||
mc_info_init(&mc);
|
||||
int num, asteroid_subtype;
|
||||
|
||||
Assert( pasteroid->type == OBJ_ASTEROID );
|
||||
@@ -1403,23 +1405,8 @@ void asteroid_level_close()
|
||||
Asteroid_field.num_initial_asteroids=0;
|
||||
}
|
||||
|
||||
DCF(asteroids,"Turns asteroids on/off")
|
||||
{
|
||||
if ( Dc_command ) {
|
||||
dc_get_arg(ARG_TRUE|ARG_FALSE|ARG_NONE);
|
||||
if ( Dc_arg_type & ARG_TRUE )
|
||||
Asteroids_enabled = 1;
|
||||
else if ( Dc_arg_type & ARG_FALSE )
|
||||
Asteroids_enabled = 0;
|
||||
else if ( Dc_arg_type & ARG_NONE )
|
||||
Asteroids_enabled ^= 1;
|
||||
}
|
||||
if ( Dc_help )
|
||||
dc_printf( "Usage: asteroids [bool]\nTurns asteroid system on/off. If nothing passed, then toggles it.\n" );
|
||||
|
||||
if ( Dc_status )
|
||||
dc_printf( "asteroids are %s\n", (Asteroids_enabled?"ON":"OFF") );
|
||||
}
|
||||
DCF_BOOL2(asteroids, Asteroids_enabled, "enables or disables asteroids", "Usage: asteroids [bool]\nTurns asteroid system on/off. If nothing passed, then toggles it.\n");
|
||||
|
||||
|
||||
void hud_target_asteroid()
|
||||
{
|
||||
@@ -1641,6 +1628,7 @@ void asteroid_test_collide(object *asteroid_obj, object *ship_obj, mc_info *mc,
|
||||
int asteroid_will_collide(object *asteroid_obj, object *escort_objp)
|
||||
{
|
||||
mc_info mc;
|
||||
mc_info_init(&mc);
|
||||
|
||||
asteroid_test_collide(asteroid_obj, escort_objp, &mc);
|
||||
|
||||
@@ -1771,6 +1759,7 @@ float asteroid_time_to_impact(object *asteroid_objp)
|
||||
float time=-1.0f, total_dist, speed;
|
||||
asteroid *asp;
|
||||
mc_info mc;
|
||||
mc_info_init(&mc);
|
||||
|
||||
asp = &Asteroids[asteroid_objp->instance];
|
||||
|
||||
@@ -1906,12 +1895,8 @@ void asteroid_parse_tbl()
|
||||
"are no species for them to belong to."
|
||||
);
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "asteroid.tbl", rval));
|
||||
lcl_ext_close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2040,9 +2025,6 @@ void asteroid_parse_tbl()
|
||||
} else {
|
||||
Asteroid_icon_closeup_zoom = 0.5f; // magic number from retail
|
||||
}
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
#include "globalincs/globals.h" // for NAME_LENGTH
|
||||
|
||||
|
||||
struct object;
|
||||
struct polymodel;
|
||||
class object;
|
||||
class polymodel;
|
||||
struct collision_info_struct;
|
||||
|
||||
#define MAX_ASTEROIDS 512
|
||||
@@ -52,7 +52,8 @@ typedef struct asteroid_split_info {
|
||||
int max;
|
||||
} asteroid_split_info;
|
||||
|
||||
class asteroid_info {
|
||||
class asteroid_info
|
||||
{
|
||||
public:
|
||||
char name[NAME_LENGTH]; // name for the asteroid
|
||||
char pof_files[NUM_DEBRIS_POFS][MAX_FILENAME_LEN]; // POF files to load/associate with ship
|
||||
@@ -79,10 +80,14 @@ public:
|
||||
fireball_radius_multiplier( -1 )
|
||||
{
|
||||
name[ 0 ] = 0;
|
||||
memset( pof_files, 0, sizeof( pof_files ) );
|
||||
memset( detail_distance, 0, sizeof( detail_distance ) );
|
||||
memset( modelp, 0, sizeof( modelp ) );
|
||||
memset( model_num, -1, sizeof( model_num ) );
|
||||
|
||||
for (int i = 0; i < NUM_DEBRIS_POFS; i++)
|
||||
{
|
||||
modelp[i] = NULL;
|
||||
model_num[i] = -1;
|
||||
pof_files[i][0] = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -119,6 +124,7 @@ typedef enum {
|
||||
typedef struct asteroid_field {
|
||||
vec3d min_bound; // Minimum range of field.
|
||||
vec3d max_bound; // Maximum range of field.
|
||||
float bound_rad;
|
||||
int has_inner_bound;
|
||||
vec3d inner_min_bound;
|
||||
vec3d inner_max_bound;
|
||||
|
||||
@@ -209,7 +209,7 @@ bool CanAutopilot(vec3d targetPos, bool send_msg)
|
||||
|
||||
// check for support ships
|
||||
// cannot autopilot if support ship present
|
||||
if ( ship_find_repair_ship(Player_obj) != NULL ) {
|
||||
if ( ship_find_repair_ship(Player_obj) != 0 ) {
|
||||
if (send_msg)
|
||||
send_autopilot_msgID(NP_MSG_FAIL_SUPPORT_PRESENT);
|
||||
return false;
|
||||
@@ -231,32 +231,43 @@ bool StartAutopilot()
|
||||
{
|
||||
// Check for support ship and dismiss it if it is not doing anything.
|
||||
// If the support ship is doing something then tell the user such.
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
object* support_ship_op = ship_find_repair_ship(Player_obj);
|
||||
if ( support_ship_op == NULL ) {
|
||||
// no more
|
||||
done = true;
|
||||
break;
|
||||
for ( object *objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) )
|
||||
{
|
||||
if ((objp->type == OBJ_SHIP) && !(objp->flags & OF_SHOULD_BE_DEAD))
|
||||
{
|
||||
Assertion((objp->instance >= 0) && (objp->instance < MAX_SHIPS),
|
||||
"objp does not have a valid pointer to a ship. Pointer is %d, which is smaller than 0 or bigger than %d",
|
||||
objp->instance, MAX_SHIPS);
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
|
||||
if (shipp->team != Player_ship->team)
|
||||
continue;
|
||||
|
||||
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, MAX_SHIP_CLASSES);
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
if ( !(sip->flags & SIF_SUPPORT) )
|
||||
continue;
|
||||
|
||||
// don't deal with dying or departing support ships
|
||||
if ( shipp->flags & (SF_DYING | SF_DEPARTING) )
|
||||
continue;
|
||||
|
||||
Assert(shipp->ai_index != -1);
|
||||
ai_info* support_ship_aip = &(Ai_info[Ships[objp->instance].ai_index]);
|
||||
|
||||
// is support ship trying to rearm-repair
|
||||
if ( ai_find_goal_index( support_ship_aip->goals, AI_GOAL_REARM_REPAIR ) == -1 ) {
|
||||
// no, so tell it to depart
|
||||
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_WARP, -1, NULL, support_ship_aip );
|
||||
} else {
|
||||
// yes
|
||||
send_autopilot_msgID(NP_MSG_FAIL_SUPPORT_WORKING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Assert( support_ship_op->type == OBJ_SHIP );
|
||||
Assert( support_ship_op->instance >= 0 );
|
||||
Assert( support_ship_op->instance < MAX_SHIPS );
|
||||
Assert( Ships[support_ship_op->instance].ai_index != -1 );
|
||||
|
||||
ai_info* support_ship_aip = &(Ai_info[Ships[support_ship_op->instance].ai_index]);
|
||||
|
||||
// is support ship trying to rearm-repair
|
||||
if ( ai_find_goal_index( support_ship_aip->goals, AI_GOAL_REARM_REPAIR ) == -1 ) {
|
||||
// no, so tell it to depart
|
||||
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_WARP, -1, NULL, support_ship_aip );
|
||||
} else {
|
||||
// yes
|
||||
send_autopilot_msgID(NP_MSG_FAIL_SUPPORT_WORKING);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
if (!CanAutopilot())
|
||||
return false;
|
||||
@@ -1201,7 +1212,7 @@ void NavSystem_Do()
|
||||
|
||||
void send_autopilot_msgID(int msgid)
|
||||
{
|
||||
if (msgid < 0 || msgid > NP_NUM_MESSAGES)
|
||||
if (msgid < 0 || msgid >= NP_NUM_MESSAGES)
|
||||
return;
|
||||
|
||||
send_autopilot_msg(NavMsgs[msgid].message, NavMsgs[msgid].filename);
|
||||
@@ -1240,7 +1251,9 @@ void send_autopilot_msg(char *msg, char *snd)
|
||||
// Inits the Nav System
|
||||
void NavSystem_Init()
|
||||
{
|
||||
memset((char *)&Navs, 0, sizeof(Navs));
|
||||
for (int i = 0; i < MAX_NAVPOINTS; i++)
|
||||
Navs[i].clear();
|
||||
|
||||
AutoPilotEngaged = false;
|
||||
CurrentNav = -1;
|
||||
audio_handle = -1;
|
||||
@@ -1261,13 +1274,9 @@ void parse_autopilot_table(char *filename)
|
||||
int rval;
|
||||
SCP_vector<SCP_string> lines;
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", (filename) ? filename : "<default autopilot.tbl>", rval));
|
||||
lcl_ext_close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1324,9 +1333,6 @@ void parse_autopilot_table(char *filename)
|
||||
|
||||
|
||||
required_string("#END");
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
|
||||
@@ -1343,13 +1349,6 @@ int FindNav(char *Nav)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Set A Nav point to "ZERO"
|
||||
void ZeroNav(int i)
|
||||
{
|
||||
memset((char *)&Navs[i], 0, sizeof(NavPoint));
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Removes a Nav
|
||||
bool DelNavPoint(char *Nav)
|
||||
@@ -1360,7 +1359,6 @@ bool DelNavPoint(char *Nav)
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool DelNavPoint(int nav)
|
||||
{
|
||||
if (nav != -1)
|
||||
@@ -1373,7 +1371,7 @@ bool DelNavPoint(int nav)
|
||||
}
|
||||
|
||||
}
|
||||
ZeroNav(MAX_NAVPOINTS-1);
|
||||
Navs[MAX_NAVPOINTS-1].clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1401,7 +1399,7 @@ bool AddNav_Ship(char *Nav, char *TargetName, int flags)
|
||||
// Create the NavPoint struct
|
||||
NavPoint tnav;
|
||||
|
||||
strncpy(tnav.m_NavName, Nav, 32);
|
||||
strcpy_s(tnav.m_NavName, Nav);
|
||||
tnav.flags = NP_SHIP | flags;
|
||||
|
||||
Assert(!(tnav.flags & NP_WAYPOINT));
|
||||
@@ -1447,7 +1445,7 @@ bool AddNav_Waypoint(char *Nav, char *WP_Path, int node, int flags)
|
||||
// Create the NavPoint struct
|
||||
NavPoint tnav;
|
||||
|
||||
strncpy(tnav.m_NavName, Nav, TOKEN_LENGTH);
|
||||
strcpy_s(tnav.m_NavName, Nav);
|
||||
tnav.flags = NP_WAYPOINT | flags;
|
||||
|
||||
Assert(!(tnav.flags & NP_SHIP));
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
#define NP_NOSELECT ( NP_HIDDEN | NP_NOACCESS )
|
||||
#define NP_VALIDTYPE ( NP_WAYPOINT | NP_SHIP )
|
||||
|
||||
struct NavPoint
|
||||
class NavPoint
|
||||
{
|
||||
public:
|
||||
char m_NavName[32];
|
||||
int flags;
|
||||
|
||||
@@ -35,6 +36,15 @@ struct NavPoint
|
||||
|
||||
vec3d *GetPosition();
|
||||
char* GetInternalName();
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_NavName[0] = 0;
|
||||
flags = 0;
|
||||
|
||||
target_obj = NULL;
|
||||
waypoint_num = -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bm_examples.cpp
|
||||
* This file contains example code for using bmpman.
|
||||
*/
|
||||
|
||||
#include "bmpman/bmpman.h"
|
||||
#include "graphics/2d.h"
|
||||
|
||||
void bm_create_example() {
|
||||
static int test_inited = 0;
|
||||
static int test_bmp;
|
||||
static uint test_bmp_data[128 * 64];
|
||||
|
||||
if (!test_inited) {
|
||||
test_inited = 1;
|
||||
// Create the new bitmap and fill in its data.
|
||||
// When you're done with it completely, call
|
||||
// bm_release to free up the bitmap handle
|
||||
test_bmp = bm_create(32, 128, 64, test_bmp_data);
|
||||
int i, j;
|
||||
for (i = 0; i < 64; i++) {
|
||||
for (j = 0; j < 64; j++) {
|
||||
uint r = i * 4;
|
||||
test_bmp_data[j + i * 128] = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// page out the data, so that the next bm_lock will convert the new data to
|
||||
// the correct bpp
|
||||
bm_unload(test_bmp);
|
||||
|
||||
// put in new data
|
||||
int x, y;
|
||||
gr_reset_clip();
|
||||
for (y = 0; y < 64; y++) {
|
||||
for (x = 0; x < 128; x++) {
|
||||
test_bmp_data[y * 128 + x] = 15;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the bitmap, the upper left corner is the origin (0, 0)
|
||||
gr_set_bitmap(test_bmp);
|
||||
gr_bitmap(0, 0);
|
||||
}
|
||||
+78
-81
@@ -1,121 +1,120 @@
|
||||
/*
|
||||
* 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 __BM_INTERNAL_H__
|
||||
#define __BM_INTERNAL_H__
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bm_internal.h
|
||||
* These are functions and types used by bmpman and a few others.
|
||||
*
|
||||
* @details It is a "protected" header that requires BMPMAN_INTERNAL to be defined before it can be included. This is to
|
||||
* provide a small measure of safety since this functions can cause problems if not used correctly
|
||||
*/
|
||||
|
||||
// extra check to make sure this stuff doesn't end up in normal files
|
||||
// don't use any of this unless BMPMAN_INTERNAL is defined
|
||||
#ifdef BMPMAN_INTERNAL
|
||||
#ifndef BMPMAN_INTERNAL
|
||||
#error The file header "bmpman/bm_internal.h" is protected. Make sure you know what you are doing!
|
||||
#endif
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#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
|
||||
|
||||
// no-type ( used in: bm_bitmaps[i].type )
|
||||
#define BM_TYPE_NONE 0
|
||||
// in-memory type ( used in: bm_bitmaps[i].type )
|
||||
#define BM_TYPE_USER 1
|
||||
// file-type types ( used in: bm_bitmaps[i].type )
|
||||
#define BM_TYPE_PCX 2
|
||||
#define BM_TYPE_TGA 3 // 16 or 32 bit targa
|
||||
#define BM_TYPE_DDS 4 // generic identifier for DDS
|
||||
#define BM_TYPE_PNG 5 // PNG
|
||||
#define BM_TYPE_JPG 6 // 32 bit jpeg
|
||||
#define BM_TYPE_ANI 7 // in-house ANI format
|
||||
#define BM_TYPE_EFF 8 // specifies any type of animated image, the EFF itself is just text
|
||||
// c-type types ( used in: bm_bitmaps[i].c_type )
|
||||
#define BM_TYPE_DXT1 9 // 24 bit with switchable alpha (compressed)
|
||||
#define BM_TYPE_DXT3 10 // 32 bit with 4 bit alpha (compressed)
|
||||
#define BM_TYPE_DXT5 11 // 32 bit with 8 bit alpha (compressed)
|
||||
#define BM_TYPE_CUBEMAP_DDS 12 // generic DDS cubemap (uncompressed cubemap surface)
|
||||
#define BM_TYPE_CUBEMAP_DXT1 13 // 24-bit cubemap (compressed cubemap surface)
|
||||
#define BM_TYPE_CUBEMAP_DXT3 14 // 32-bit cubemap (compressed cubemap surface)
|
||||
#define BM_TYPE_CUBEMAP_DXT5 15 // 32-bit cubemap (compressed cubemap surface)
|
||||
// special types ( used in: bm_bitmaps[i].type )
|
||||
#define BM_TYPE_RENDER_TARGET_STATIC 16 // 24/32 bit setup internally as a static render target
|
||||
#define BM_TYPE_RENDER_TARGET_DYNAMIC 17 // 24/32 bit setup internally as a dynamic render target
|
||||
// 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)
|
||||
};
|
||||
|
||||
/// Moved from cpp file ///////////////////
|
||||
// Consider these 'protected' structures and functions that should only be used by special bitmap functions
|
||||
typedef union bm_extra_info {
|
||||
union bm_extra_info {
|
||||
struct {
|
||||
// Stuff needed for animations
|
||||
int first_frame; // used for animations -- points to index of first frame
|
||||
int num_frames; // used for animation -- number of frames in the animation
|
||||
int keyframe; // used for animation -- keyframe info
|
||||
ubyte fps; // used for animation -- frames per second
|
||||
int first_frame; //!< used for animations -- points to index of first frame
|
||||
int num_frames; //!< used for animations -- number of frames in the animation
|
||||
int keyframe; //!< used for animations -- keyframe info
|
||||
ubyte fps; //!< used for animations -- frames per second
|
||||
|
||||
struct {
|
||||
// stuff for static animations
|
||||
ubyte type; // type for individual images
|
||||
char filename[MAX_FILENAME_LEN]; // filename 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;
|
||||
|
||||
struct {
|
||||
// Stuff needed for user bitmaps
|
||||
void *data; // For user bitmaps, this is where the data comes from
|
||||
ubyte bpp; // For user bitmaps, this is what format the data is
|
||||
ubyte flags; // Flags passed to bm_create
|
||||
void* data; //!< For user bitmaps, this is where the data comes from
|
||||
ubyte bpp; //!< For user bitmaps, this is what format the data is
|
||||
ubyte flags; //!< For user bitmaps, Flags passed to bm_create
|
||||
} user;
|
||||
} bm_extra_info;
|
||||
};
|
||||
|
||||
|
||||
typedef struct bitmap_entry {
|
||||
struct bitmap_entry {
|
||||
// identification
|
||||
char filename[MAX_FILENAME_LEN]; // filename for this bitmap
|
||||
char filename[MAX_FILENAME_LEN]; //!< filename for this bitmap
|
||||
|
||||
uint signature; // a unique signature identifying the data
|
||||
uint palette_checksum; // checksum used to be sure bitmap is in current palette
|
||||
int handle; // Handle = id*MAX_BITMAPS + bitmapnum
|
||||
int last_used; // When this bitmap was last used
|
||||
uint signature; //!< a unique signature identifying the data
|
||||
uint palette_checksum; //!< checksum used to be sure bitmap is in current palette
|
||||
int handle; //!< Handle = id*MAX_BITMAPS + bitmapnum
|
||||
int last_used; //!< When this bitmap was last used
|
||||
|
||||
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.
|
||||
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)
|
||||
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
|
||||
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
|
||||
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
|
||||
ubyte preloaded; // If set, then this was loaded from the lst file
|
||||
int preload_count; // how many times this gets used in game, for unlocking
|
||||
ubyte used_flags; // What flags it was accessed thru
|
||||
int load_count;
|
||||
ubyte preloaded; //!< If set, then this was loaded from the lst file
|
||||
int preload_count; //!< how many times this gets used in game, for unlocking
|
||||
ubyte used_flags; //!< What flags it was accessed thru
|
||||
int load_count;
|
||||
|
||||
// Bitmap info
|
||||
bitmap bm;
|
||||
bitmap bm; //!< Bitmap info
|
||||
|
||||
// Data for animations and user bitmaps
|
||||
bm_extra_info info;
|
||||
bm_extra_info info; //!< Data for animations and user bitmaps
|
||||
|
||||
#ifdef BMPMAN_NDEBUG
|
||||
// bookeeping
|
||||
ubyte used_last_frame; // If set, then it was used last frame
|
||||
ubyte used_this_frame; // If set, then it was used this frame
|
||||
int data_size; // How much data this bitmap uses
|
||||
int used_count; // How many times it was accessed
|
||||
ubyte used_last_frame; // If set, then it was used last frame
|
||||
ubyte used_this_frame; // If set, then it was used this frame
|
||||
int data_size; // How much data this bitmap uses
|
||||
int used_count; // How many times it was accessed
|
||||
#endif
|
||||
} bitmap_entry;
|
||||
};
|
||||
|
||||
extern bitmap_entry bm_bitmaps[MAX_BITMAPS];
|
||||
|
||||
|
||||
// image specific lock functions
|
||||
void bm_lock_ani( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
|
||||
void bm_lock_dds( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
|
||||
@@ -126,6 +125,4 @@ void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
|
||||
void bm_lock_user( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
|
||||
|
||||
|
||||
#endif // BMPMAN_INTERNAL
|
||||
|
||||
#endif // __BM_INTERNAL_H__
|
||||
+1858
-1941
File diff suppressed because it is too large.
Load diff
+557
-202
@@ -1,288 +1,643 @@
|
||||
#ifndef _BMPMAN_H
|
||||
#define _BMPMAN_H
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bmpman.h
|
||||
* Header file for the bitmap manager (bmpman)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @example bm_examples.cpp
|
||||
* @brief This containes examples of bmpman usage
|
||||
*/
|
||||
|
||||
#ifndef _BMPMAN_H
|
||||
#define _BMPMAN_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define BMPMAN_NDEBUG
|
||||
#define BMPMAN_NDEBUG //!< Enables BMPMAN debugging code
|
||||
#endif
|
||||
|
||||
#define MAX_BITMAPS 4750 // How many bitmaps the game can handle
|
||||
// NOTE: MAX_BITMAPS shouldn't need to be bumped again. With the fixed bm_release() and it's
|
||||
// proper use even the largest missions should stay under this number. With the largest retail
|
||||
// missions and wasteful content we should still have about 20% of the slots free. If it still
|
||||
// goes over then it's something the artists need to fix. For instance the Terran Mara fighter,
|
||||
// with -spec and -glow and using the Shinepack, needs 117 bitmap slots alone. 111 of those is
|
||||
// just for the glowmaps. This number can be greatly reduced if the number of ani frames for
|
||||
// another LOD than LOD0 has fewer or no ani frames. A 37 frame glow ani for LOD2 is little
|
||||
// more than a waste of resources. Future reports of texture corruption should be initially
|
||||
// approached with content as the cause and not code. If anything we could/should reduce
|
||||
// MAX_BITMAPS in the future. Where it's at now should accomidate even the largest mods.
|
||||
// -- Taylor
|
||||
/**
|
||||
* @defgroup BMPMAN_CONSTANTS Macro constants used in/with bmpman.h
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief How many bitmaps the game can handle
|
||||
*
|
||||
* @attention MAX_BITMAPS shouldn't need to be bumped again. With the fixed bm_release() and it's proper use even the
|
||||
* largest missions should stay under this number. With the largest retail missions and wasteful content we should
|
||||
* still have about 20% of the slots free. If it still goes over then it's something the artists need to fix.
|
||||
* For instance the Terran Mara fighter, with -spec and -glow and using the Shinepack, needs 117 bitmap slots alone.
|
||||
* 111 of those is just for the glowmaps. This number can be greatly reduced if the number of ani frames for another
|
||||
* LOD than LOD0 has fewer or no ani frames. A 37 frame glow ani for LOD2 is little more than a waste of resources.
|
||||
* Future reports of texture corruption should be initially approached with content as the cause and not code.
|
||||
* If anything we could/should reduce MAX_BITMAPS in the future. Where it's at now should accomidate even the
|
||||
* largest mods. -- Taylor
|
||||
*/
|
||||
#define MAX_BITMAPS 4750
|
||||
|
||||
#define BMP_AABITMAP (1<<0) // antialiased bitmap
|
||||
#define BMP_TEX_XPARENT (1<<1) // transparent texture
|
||||
#define BMP_TEX_OTHER (1<<2) // so we can identify all "normal" textures
|
||||
#define BMP_TEX_DXT1 (1<<3) // dxt1 compressed 8r8g8b1a (24bit)
|
||||
#define BMP_TEX_DXT3 (1<<4) // dxt3 compressed 8r8g8b4a (32bit)
|
||||
#define BMP_TEX_DXT5 (1<<5) // dxt5 compressed 8r8g8b8a (32bit)
|
||||
#define BMP_TEX_CUBEMAP (1<<6) // a texture made for cubic environment map
|
||||
// Flag positions for bitmap.flags
|
||||
// ***** NOTE: bitmap.flags is an 8-bit value, no more BMP_TEX_* flags can be added unless the type is changed!! ******
|
||||
#define BMP_AABITMAP (1<<0) //!< antialiased bitmap
|
||||
#define BMP_TEX_XPARENT (1<<1) //!< transparent texture
|
||||
#define BMP_TEX_OTHER (1<<2) //!< so we can identify all "normal" textures
|
||||
#define BMP_TEX_DXT1 (1<<3) //!< dxt1 compressed 8r8g8b1a (24bit)
|
||||
#define BMP_TEX_DXT3 (1<<4) //!< dxt3 compressed 8r8g8b4a (32bit)
|
||||
#define BMP_TEX_DXT5 (1<<5) //!< dxt5 compressed 8r8g8b8a (32bit)
|
||||
#define BMP_TEX_CUBEMAP (1<<6) //!< a texture made for cubic environment map
|
||||
|
||||
//compressed texture types
|
||||
#define BMP_TEX_COMP ( BMP_TEX_DXT1 | BMP_TEX_DXT3 | BMP_TEX_DXT5 )
|
||||
// Combined flags
|
||||
#define BMP_TEX_COMP ( BMP_TEX_DXT1 | BMP_TEX_DXT3 | BMP_TEX_DXT5 ) //!< Compressed textures
|
||||
#define BMP_TEX_NONCOMP ( BMP_TEX_XPARENT | BMP_TEX_OTHER ) //!< Non-compressed textures
|
||||
#define BMP_TEX_ANY ( BMP_TEX_COMP | BMP_TEX_NONCOMP ) //!< Any texture
|
||||
|
||||
//non compressed textures
|
||||
#define BMP_TEX_NONCOMP ( BMP_TEX_XPARENT | BMP_TEX_OTHER )
|
||||
// Flag positions for bitmap.type
|
||||
#define BMP_FLAG_RENDER_TARGET_STATIC (1<<0) //!< Texture is a static type
|
||||
#define BMP_FLAG_RENDER_TARGET_DYNAMIC (1<<1) //!< Texture is a dynamic type (animation)
|
||||
#define BMP_FLAG_CUBEMAP (1<<2) //!< Texture is a cubemap
|
||||
|
||||
// any texture type
|
||||
#define BMP_TEX_ANY ( BMP_TEX_COMP | BMP_TEX_NONCOMP )
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define BMP_FLAG_RENDER_TARGET_STATIC (1<<0)
|
||||
#define BMP_FLAG_RENDER_TARGET_DYNAMIC (1<<1)
|
||||
#define BMP_FLAG_CUBEMAP (1<<2)
|
||||
struct bitmap
|
||||
{
|
||||
short w; //!< Width, in number of pixels
|
||||
short h; //!< Height, in number of pixels
|
||||
short rowsize; //!< What you need to add to go to next row
|
||||
ubyte bpp; //!< Requested bitdepth of each pixel. ( 7, 8, 15, 16, 24, 32)
|
||||
ubyte true_bpp; //!< The image's actual bitdepth
|
||||
ubyte flags; //!< Various texture type flags. @see BMPMAN_CONSTANTS
|
||||
ptr_u data; //!< Pointer to data, or maybe offset into VRAM.
|
||||
ubyte *palette; /**< @brief Pointer to this bitmap's palette (if it has one).
|
||||
* @details If BMP_NO_PALETTE_MAP flag is cleared, this palette just points to the screen palette. (gr_palette)
|
||||
*/
|
||||
};
|
||||
|
||||
typedef struct bitmap {
|
||||
short w, h; // Width and height
|
||||
short rowsize; // What you need to add to go to next row
|
||||
ubyte bpp; // How many bits per pixel it is. (7,8,15,16,24,32) (what is requested)
|
||||
ubyte true_bpp; // How many bits per pixel the image actually is.
|
||||
ubyte flags; // See the BMP_???? defines for values (this isn't for the BMP_FLAG_* stuff)
|
||||
ptr_u data; // Pointer to data, or maybe offset into VRAM.
|
||||
ubyte *palette; // If bpp==8, this is pointer to palette. If the BMP_NO_PALETTE_MAP flag
|
||||
// is not set, this palette just points to the screen palette. (gr_palette)
|
||||
} bitmap;
|
||||
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 int Bm_paging;
|
||||
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 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
|
||||
|
||||
extern int GLOWMAP; //!< References a map that is a fully lit version of its index -Bobboau
|
||||
extern int SPECMAP; //!< References a map that is for specular mapping -Bobboau
|
||||
extern int ENVMAP; //!< References a map that is for environment mapping -Bobboau
|
||||
extern int NORMMAP; //!< Normal mapping
|
||||
extern int HEIGHTMAP; //!< Height map for normal mapping
|
||||
extern int MISCMAP; //!< Utility map, to be utilized for various things shader authors can come up with
|
||||
|
||||
/**
|
||||
* @brief Initilizes the bitmap manager
|
||||
*/
|
||||
void bm_init();
|
||||
|
||||
/**
|
||||
* @brief Closes the bitmap manager, freeing any allocated memory used by bitmaps. Is called at program close.
|
||||
*/
|
||||
void bm_close();
|
||||
|
||||
int bm_get_cache_slot( int bitmap_id, int separate_ani_frames );
|
||||
/**
|
||||
* Gets the cache slot of the bitmap indexed by handle.
|
||||
*
|
||||
* @details if the bitmap is an ani, gets the first frame
|
||||
*
|
||||
* @returns The cache slot index of the bitmap if handle is valid
|
||||
*
|
||||
* @note If the handle is invalid, an Assert() fails
|
||||
*/
|
||||
int bm_get_cache_slot(int bitmap_id, int separate_ani_frames);
|
||||
|
||||
/**
|
||||
* @brief Gets the next available bitmap slot.
|
||||
*/
|
||||
int bm_get_next_handle();
|
||||
|
||||
void *bm_malloc(int n, int size);
|
||||
/**
|
||||
* @brief Allocates memory for the given handle.
|
||||
*
|
||||
* @returns A pointer to the allocated vm if successful,
|
||||
* @returns Null, if unsuccessful
|
||||
*
|
||||
* @note z64 - This function looks fishy. Not only is handle not used in release builds, but bm_bitmaps[handle].size
|
||||
* and bm_texture_size aren't modified unless this is a debug build
|
||||
*/
|
||||
void *bm_malloc(int handle, int size);
|
||||
|
||||
/**
|
||||
* @brief (DEBUG) Similar to bm_malloc, but only updates how much memory is used
|
||||
*
|
||||
* @note z64 - Also fishy (see bm_malloc)
|
||||
*/
|
||||
void bm_update_memory_used(int n, int size);
|
||||
|
||||
// how many bytes of textures are used.
|
||||
extern int bm_texture_ram;
|
||||
/**
|
||||
* @brief Loads a bitmap so we can draw with it later.
|
||||
*
|
||||
* @param filename
|
||||
*
|
||||
* @returns The bitmap number if successful, else
|
||||
* @returns a negative value if not
|
||||
*/
|
||||
int bm_load(const char* filename);
|
||||
|
||||
// This loads a bitmap so we can draw with it later.
|
||||
// It returns a negative number if it couldn't load
|
||||
// the bitmap. On success, it returns the bitmap
|
||||
// number.
|
||||
int bm_load(char * filename);
|
||||
/**
|
||||
* @brief Loads a bitmap so we can draw with it later. (Preferred version)
|
||||
*
|
||||
* @param filename
|
||||
*
|
||||
* @returns The bitmap number if successful, else
|
||||
* @returns a negative value if not
|
||||
*/
|
||||
int bm_load(const SCP_string& filename);
|
||||
|
||||
// special load function. basically allows you to load a bitmap which already exists (by filename).
|
||||
// this is useful because in some cases we need to have a bitmap which is locked in screen format
|
||||
// _and_ texture format, such as pilot pics and squad logos
|
||||
int bm_load_duplicate(char *filename);
|
||||
/**
|
||||
* @brief Reloads a bitmap as a duplicate.
|
||||
*
|
||||
* @details This function basically allows you to load a bitmap which already exists (by filename). This is useful
|
||||
* because in some cases we need to have a bitmap which is locked in screen format _and_ texture format, such as
|
||||
* the pilot pics and squad logos
|
||||
*
|
||||
* @param filename
|
||||
*
|
||||
* @returns The bitmap number if successful, else
|
||||
* @returns a negative value if not
|
||||
*/
|
||||
int bm_load_duplicate(const char *filename);
|
||||
|
||||
// Creates a bitmap that exists in RAM somewhere, instead
|
||||
// of coming from a disk file. You pass in a pointer to a
|
||||
// block of data. The data can be in the following formats:
|
||||
// 8 bpp (mapped into game palette)
|
||||
// 32 bpp
|
||||
// On success, it returns the bitmap number. You cannot
|
||||
// free that RAM until bm_release is called on that bitmap.
|
||||
// See example at bottom of this file
|
||||
int bm_create( int bpp, int w, int h, void *data = NULL, int flags = 0);
|
||||
/**
|
||||
* Loads a bitmap which exists somewhere in the RAM.
|
||||
*
|
||||
* @param bpp The bitdepth of the bitmap
|
||||
* @param w The width of the bitmap
|
||||
* @param h The height of the bitmap
|
||||
* @param[in] data The bitmap's data glob
|
||||
* @param flags
|
||||
*
|
||||
* @note The used RAM cannot be freed until bm_release is called on the created bitmap
|
||||
*/
|
||||
int bm_create(int bpp, int w, int h, void *data = NULL, int flags = 0);
|
||||
|
||||
// Frees up a bitmap's data, but bitmap number 'n' can
|
||||
// still be used, it will just have to be paged in next
|
||||
// time it is locked.
|
||||
int bm_unload( int n, int clear_render_targets = 0, bool nodebug = false);
|
||||
/**
|
||||
* @brief Unloads a bitmap's data, but not the bitmap info
|
||||
*
|
||||
* @details The bm number (n) may be reused once this function has been called on it. However, it will have to be paged
|
||||
* in the next time it is locked.
|
||||
|
||||
// like bm_unload() except that it's safe to use to free data without worrying about
|
||||
// load_count so it's safe to use in relation to bm_release() and in gr_*_texture functions
|
||||
int bm_unload_fast( int n, int clear_render_targets = 0 );
|
||||
* @param handle The index number of the bitmap to free
|
||||
* @param clear_render_targets If true, release a render target
|
||||
* @param nodebug If true, exclude certain debug messages
|
||||
*
|
||||
* @returns 0 if not successful,
|
||||
* @returns 1 if successful
|
||||
*/
|
||||
int bm_unload(int handle, int clear_render_targets = 0, bool nodebug = false);
|
||||
|
||||
// Frees up a bitmap's data, and it's slot, so bitmap
|
||||
// number 'n' cannot be used anymore, and bm_load or
|
||||
// bm_create might reuse the slot.
|
||||
int bm_release( int n, int clear_render_targets = 0 );
|
||||
/**
|
||||
* @brief Quickly unloads a bitmap's data, ignoring the load_count
|
||||
*
|
||||
* @details Similar to bm_unload(), except that it can be safely used to free data without worrying about load_count.
|
||||
* It's safe to use in relation to bm_release() and in gr_*_texture functions
|
||||
*
|
||||
* @param handle The bm number of the bitmap to free
|
||||
* @param clear_render_targets If true, release a render target
|
||||
*
|
||||
* @note bm_free_data_fast() is used here and NOT bm_free_data()
|
||||
*/
|
||||
int bm_unload_fast(int handle, int clear_render_targets = 0);
|
||||
|
||||
// This loads a bitmap sequence so we can draw with it later.
|
||||
// It returns a negative number if it couldn't load
|
||||
// the bitmap. On success, it returns the bitmap
|
||||
// number of the first frame and nframes is set.
|
||||
extern int bm_load_animation( char * filename, int * nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY );
|
||||
/**
|
||||
* @brief Frees both a bitmap's data and it's associated slot.
|
||||
*
|
||||
* @details Once called, the bm number 'n' cannot be used until bm_load or bm_create is re-inits the slot.
|
||||
*
|
||||
* @param handle The index number of the bitmap to release
|
||||
* @param clear_render_targets If nonzero, also release render targets
|
||||
*
|
||||
* @returns 1 on success,
|
||||
* @returns 0 otherwise
|
||||
*
|
||||
* @note If the passed handle is that of an ANI, it frees EVERY frame. Be sure to only pass the handle of the first frame!
|
||||
*
|
||||
* @todo upgrade return type and clear_render_targets type to bools
|
||||
*/
|
||||
int bm_release(int handle, int clear_render_targets = 0);
|
||||
|
||||
//Loads either animation (bm_load_animation) or still image (bm_load)
|
||||
extern int bm_load_either(char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY);
|
||||
/**
|
||||
* @brief Loads a bitmap sequance so we can draw with it.
|
||||
*
|
||||
* @param[in] filename
|
||||
* @param[out] nframes If non-null, set to the number of frames the animation has
|
||||
* @param[out] fps If non-null, set to the fps of this animation
|
||||
* @param[out] keyframe if non null, set to the keyframe index of this animation
|
||||
* @param[in] can_drop_frames If set, allows dropped frames
|
||||
* @param[in] dir_type Directory type
|
||||
*
|
||||
* @returns The bm number of the first bitmap in the sequence if successful, or
|
||||
* @returns A negative value if unsuccessful
|
||||
*/
|
||||
int bm_load_animation(const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY);
|
||||
|
||||
// This locks down a bitmap and returns a pointer to a bitmap
|
||||
// that can be accessed until you call bm_unlock. Only lock
|
||||
// a bitmap when you need it! This will convert it into the
|
||||
// appropriate format also.
|
||||
extern bitmap * bm_lock( int bitmapnum, ubyte bpp, ubyte flags, bool nodebug = false);
|
||||
/**
|
||||
* @brief Loads either animation (bm_load_animation) or still image (bm_load)
|
||||
*
|
||||
* @param[in] filename
|
||||
* @param[out] nframes If non-null and loading was successful, set to the number of frames the animation has
|
||||
* @param[out] fps If non-null and loading was successful, set to the fps of this animation
|
||||
* @param[out] keyframe if non null and loading was successful, set to the keyframe index of this animation
|
||||
* @param[in] can_drop_frames
|
||||
* @param[in] dir_type
|
||||
*
|
||||
* @returns The bm number of the first bitmap in the sequence if successful, or
|
||||
* @returns A negative value if unsuccessful
|
||||
*/
|
||||
int bm_load_either(const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY);
|
||||
|
||||
// The signature is a field that gets filled in with
|
||||
// a unique signature for each bitmap. The signature for each bitmap
|
||||
// will also change when the bitmap's data changes.
|
||||
extern uint bm_get_signature( int bitmapnum);
|
||||
/**
|
||||
* @brief Locks down the bitmap indexed by bitmapnum.
|
||||
*
|
||||
* @details Also converts the bitmap to the appropriate format specified by bpp and flags. Only lock a bitmap when you
|
||||
* need it!
|
||||
*
|
||||
* @param bitmapnum The number indexing the desired bitmap
|
||||
* @param bpp The desired bpp of the bitmep
|
||||
* @param flags The desired bitmap format
|
||||
* @param nodebug
|
||||
|
||||
//gets the image type
|
||||
* @returns A pointer to the bitmap that's valid until bm_unlock is called if successful, or
|
||||
* @returns NULL if unsuccessful
|
||||
*/
|
||||
bitmap* bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug = false);
|
||||
|
||||
/**
|
||||
* @brief Returns a unique signiature for the bitmap indexed by handle
|
||||
*
|
||||
* @details A signature will change when the bitmap's data changes
|
||||
*/
|
||||
uint bm_get_signature(int handle);
|
||||
|
||||
/**
|
||||
* @brief Returns the image type of the given bitmap handle
|
||||
*/
|
||||
ubyte bm_get_type(int handle);
|
||||
|
||||
// Unlocks a bitmap
|
||||
extern void bm_unlock( int bitmapnum );
|
||||
/**
|
||||
* @brief Unlocks a bitmap
|
||||
*
|
||||
* @details Decrements the ref_count member of the bitmap_entry struct, A bitmap can only be unloaded when the
|
||||
* ref_count is 0
|
||||
*/
|
||||
void bm_unlock(int handle);
|
||||
|
||||
//WMC - Returns 0 if invalid, nonzero if valid
|
||||
extern int bm_is_valid(int handle);
|
||||
/**
|
||||
* @brief Checks if the bitmap indexed by handle is valid
|
||||
*
|
||||
* @details Some early known false or out of range handles (such as negative) are checked within
|
||||
* an initial routine pass, followed by a more thorough check routine to ensure the
|
||||
* series of bitmaps within the bm_bitmaps[] structure have not become invalid.
|
||||
*
|
||||
* @returns Nonzero if valid, else
|
||||
* @returns Zero otherwise
|
||||
*
|
||||
* @todo z64 - Returned value is essentially a bool type, need to check all caller functions to see if it can safely
|
||||
* be updated to reflect this
|
||||
*/
|
||||
int bm_is_valid(int handle);
|
||||
|
||||
// Gets info. w,h,or flags,nframes or fps can be NULL if you don't care.
|
||||
//WMC - Returns -1 on failure, handle or first frame handle on success.
|
||||
int bm_get_info( int bitmapnum, int *w=NULL, int * h=NULL, ubyte * flags=NULL, int *nframes=NULL, int *fps=NULL );
|
||||
/**
|
||||
* @brief Gets info on the bitmap indexed by handle.
|
||||
*
|
||||
* @param[out] w If non-null, gets the width
|
||||
* @param[out] h If non-null, gets the heigth
|
||||
* @param[out] flags If non-null, gets the flags
|
||||
* @param[out] nframs If non-null, gets the nframes
|
||||
* @param[out] fps If non-null, gets the fps
|
||||
*
|
||||
* @returns The handle on success, or
|
||||
* @returns The handle to the first frame on success, or
|
||||
* @returns -1 on failure
|
||||
*/
|
||||
int bm_get_info(int handle, int *w = NULL, int * h = NULL, ubyte * flags = NULL, int *nframes = NULL, int *fps = NULL);
|
||||
|
||||
// get filename
|
||||
extern void bm_get_filename(int bitmapnum, char *filename);
|
||||
/**
|
||||
* @brief Gets the filename of the bitmap indexed by handle
|
||||
*
|
||||
* @param[out] filename The filename of the bitmap, if successful. Is set to an empty string if unseccessful
|
||||
*
|
||||
* @todo z64 - maybe deprecate this in favor of an SCP_string version
|
||||
*/
|
||||
void bm_get_filename(int bitmapnum, char *filename);
|
||||
|
||||
// call to load all data for all bitmaps that have been requested to be loaded
|
||||
extern void bm_gfx_load_all();
|
||||
extern void bm_unload_all();
|
||||
/**
|
||||
* @brief Gets the filename of the bitmap indexed by handle, which must exist.
|
||||
*
|
||||
* @details If the bitmap does not exist (i.e. the handle is invalid), then an Assertion halts program execution.
|
||||
*
|
||||
* @returns A const char* to the filename of the bitmap
|
||||
*
|
||||
* @todo z64 - maybe deprecate this in favor of an SCP_string version.
|
||||
* @todo z64 - maybe combine this with the other bm_get_filename function like so:
|
||||
* void bm_get_filename(int handle, SCP_string *filename, bool must_exist = false);
|
||||
*/
|
||||
const char *bm_get_filename(int handle);
|
||||
|
||||
// call to get the palette for a bitmap
|
||||
void bm_get_palette(int n, ubyte *pal, char *name);
|
||||
/**
|
||||
* @brief Loads all data for all bitmaps that have been requested to be loaded
|
||||
*
|
||||
* @note This function is not defined.
|
||||
*/
|
||||
void bm_gfx_load_all();
|
||||
|
||||
// Hacked function to get a pixel from a bitmap.
|
||||
// Only works good in 8bpp mode.
|
||||
void bm_gfx_get_pixel( int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *b );
|
||||
/**
|
||||
* @brief Unloads all used bitmaps, should only ever be called by game_shutdown()
|
||||
*
|
||||
* @todo Maybe move this declaration into bmpman.cpp and then extern this function within game_shutdown() to
|
||||
* ensure it only ever gets called there.
|
||||
*/
|
||||
void bm_unload_all();
|
||||
|
||||
// Returns number of bytes of bitmaps locked this frame
|
||||
// ntotal = number of bytes of bitmaps locked this frame
|
||||
// nnew = number of bytes of bitmaps locked this frame that weren't locked last frame
|
||||
/**
|
||||
* @brief Gets the palette for a given bitmap indexed by handle, and optionally the filename
|
||||
*
|
||||
* @param[out] pal Is set to reference the bitmap's palette
|
||||
* @param[out] name (optional) Is set to the bitmap's filename
|
||||
*
|
||||
* @todo Maybe get rid of the optional filename and have the callers call bm_get_filename. Less efficient, however.
|
||||
*/
|
||||
void bm_get_palette(int handle, ubyte *pal, char *name);
|
||||
|
||||
/**
|
||||
* @brief Hack to get a pixel from a bitmap
|
||||
*
|
||||
* @details only works good in 8bpp mode
|
||||
*
|
||||
* @note This function is not defined.
|
||||
*/
|
||||
void bm_gfx_get_pixel(int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *b);
|
||||
|
||||
/**
|
||||
* @brief (DEBUG) Gets memory size, in bytes, of the locked bitmaps
|
||||
*
|
||||
* @details Both params are non-optional, and must be non-null. There's currently no safety checks on either.
|
||||
*
|
||||
* @param ntotal[out] Memory size, in bytes, of the locked bitmaps
|
||||
* @param nnew[out] Memory size, in bytes, of the bitmaps that were locked since the last frame
|
||||
*
|
||||
* @note This is a debug function, and is undefined within release builds
|
||||
*/
|
||||
void bm_get_frame_usage(int *ntotal, int *nnew);
|
||||
|
||||
// Reload a different image into an existing bmpman slot
|
||||
int bm_reload(int bitmap_handle, char* filename);
|
||||
/**
|
||||
* @brief Reloads an existing bmpman slot with different bitmap
|
||||
*
|
||||
* @param[in] filename The filename of the image to load
|
||||
*
|
||||
* @returns The bitmap handle on success, or
|
||||
* @returns A negative value on failure
|
||||
*
|
||||
* @note This should only be used if you are certain the new picture is the same type, has same dimensions, etc.
|
||||
*/
|
||||
int bm_reload(int bitmap_handle, const char* filename);
|
||||
|
||||
/*
|
||||
* Example on using bm_create
|
||||
*
|
||||
{
|
||||
static int test_inited = 0;
|
||||
static int test_bmp;
|
||||
static uint test_bmp_data[128*64];
|
||||
|
||||
if ( !test_inited ) {
|
||||
test_inited = 1;
|
||||
// Create the new bitmap and fill in its data.
|
||||
// When you're done with it completely, call
|
||||
// bm_release to free up the bitmap handle
|
||||
test_bmp = bm_create( 32, 128, 64, test_bmp_data );
|
||||
int i,j;
|
||||
for (i=0; i<64; i++ ) {
|
||||
for (j=0; j<64; j++ ) {
|
||||
uint r=i*4;
|
||||
test_bmp_data[j+i*128] = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bm_unload(test_bmp); // this pages out the data, so that the
|
||||
// next bm_lock will convert the new data to the
|
||||
// correct bpp
|
||||
|
||||
// put in new data
|
||||
int x,y;
|
||||
gr_reset_clip();
|
||||
for (y=0; y<64; y++)
|
||||
for (x=0; x<128; x++ )
|
||||
test_bmp_data[y*128+x] = 15;
|
||||
|
||||
// Draw the bitmap to upper left corner
|
||||
gr_set_bitmap(test_bmp);
|
||||
gr_bitmap( 0,0 );
|
||||
}
|
||||
/**
|
||||
* @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);
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Paging stuff
|
||||
//============================================================================
|
||||
|
||||
/**
|
||||
* @brief Tells bmpman to start keeping track of what bitmaps are used where
|
||||
*/
|
||||
void bm_page_in_start();
|
||||
|
||||
/**
|
||||
* @brief Tells bmpman to stop paging (?)
|
||||
*/
|
||||
void bm_page_in_stop();
|
||||
|
||||
// Paging code in a library should call these functions
|
||||
// in its page in function.
|
||||
|
||||
// Marks a texture as being used for this level
|
||||
// If num_frames is passed, assume this is an animation
|
||||
void bm_page_in_texture( int bitmapnum, int num_frames = 0 );
|
||||
/**
|
||||
* @brief Marks a texture as being used for this level
|
||||
*
|
||||
* @param[in] num_frames If specified, assumes this is an animated texture
|
||||
*/
|
||||
void bm_page_in_texture(int bitmapnum, int num_frames = 0);
|
||||
|
||||
// marks a texture as being a transparent textyre used for this level
|
||||
// Marks a texture as being used for this level
|
||||
// If num_frames is passed, assume this is an animation
|
||||
void bm_page_in_xparent_texture( int bitmapnum, int num_frames=1 );
|
||||
/**
|
||||
* @brief Marks a textures as being used for level and is transparant
|
||||
*
|
||||
* @param[in] num_frames If specified, assumes this is an animated texture
|
||||
*/
|
||||
void bm_page_in_xparent_texture(int bitmapnum, int num_frames = 1);
|
||||
|
||||
// Marks an aabitmap as being used for this level
|
||||
// If num_frames is passed, assume this is an animation
|
||||
void bm_page_in_aabitmap( int bitmapnum, int num_frames=1 );
|
||||
/**
|
||||
* @brief Marks a texture as being used for this level, and is anti-aliased
|
||||
*
|
||||
* @param[in] num_frames If specified, assumes this is an animated texture
|
||||
*/
|
||||
void bm_page_in_aabitmap(int bitmapnum, int num_frames = 1);
|
||||
|
||||
// unload a texture that was paged in
|
||||
int bm_page_out( int handle );
|
||||
/**
|
||||
* @brief Unloads the bitmap indexed by handle that was previously paged-in
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
int bm_page_out(int handle);
|
||||
|
||||
//
|
||||
// Mode: 0 = High memory
|
||||
// 1 = Low memory ( every other frame of ani's)
|
||||
// 2 = Debug low memory ( only use first frame of each ani )
|
||||
void bm_set_low_mem( int mode );
|
||||
|
||||
char *bm_get_filename(int handle);
|
||||
/**
|
||||
* @brief Sets BMPMAN's memory mode
|
||||
*
|
||||
* @details 0 = High memory;
|
||||
* 1 = Low memory (loads every other frame of ani's);
|
||||
* 2 = Debug low memory (only use first frame of each ani)
|
||||
*
|
||||
* @todo This should use an enum, or instead allow an arbitrary number to drop frames (like 1/2, 1/3, etc.)
|
||||
*/
|
||||
void bm_set_low_mem(int mode);
|
||||
|
||||
/**
|
||||
* @brief Sets bm_set_components and bm_get_components to reference screen format functions
|
||||
*/
|
||||
void BM_SELECT_SCREEN_FORMAT();
|
||||
|
||||
/**
|
||||
* @brief Sets bm_set_components and bm_get_components to reference texture format functions
|
||||
*/
|
||||
void BM_SELECT_TEX_FORMAT();
|
||||
|
||||
/**
|
||||
* @brief Sets bm_set_components and bm_get_components to reference texture format functions (with alpha)
|
||||
*/
|
||||
void BM_SELECT_ALPHA_TEX_FORMAT();
|
||||
|
||||
// set the rgba components of a pixel, any of the parameters can be NULL
|
||||
extern void (*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
extern void (*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
void bm_set_components_argb_d3d_16_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
void bm_set_components_argb_d3d_32_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
void bm_set_components_argb_d3d_16_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
void bm_set_components_argb_d3d_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
/**
|
||||
* @brief Functional pointer that references any of the bm_set_components functions.
|
||||
*
|
||||
* @details The bm_set_components functions packs the RGBA values into the ubyte array referenced by pixel, whose
|
||||
* format differs according to its bpp value and presence of an alpha channel. The RGBA values are scaled accordingly.
|
||||
*
|
||||
* @param[out] pixel The pixel to set
|
||||
* @param[in] r Red value (may not be NULL)
|
||||
* @param[in] g Green value (may not be NULL)
|
||||
* @param[in] b Blue value (may not be NULL)
|
||||
* @param[in] a Alpha value (currently ignored)
|
||||
*
|
||||
* @note z64 - These functions were made predating the introduction of C++ classes, and are basically the equivalent
|
||||
* of Pixel::set(ubyte *r, ubyte *b, ubyte *g). The original comment mentions that any of the rgba params may be
|
||||
* NULL, but this is by far _NOT_ the case, as a NULL value will cause undefined behavior (really really bad chroma
|
||||
* corruption)
|
||||
*
|
||||
* @note These functions assume the incoming bitdepth will always be >= to the outgoing bitdepth of the pixel. Should
|
||||
* the incoming bitdepth be lower, the outgoing values will appear darker than they should be
|
||||
*/
|
||||
extern void(*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
// get the rgba components of a pixel, any of the parameters can be NULL
|
||||
/**
|
||||
* @brief Functional pointer that references any of the bm_set_components_32 functions.
|
||||
*
|
||||
* @details The bm_set_components functions packs the RGBA values into the ubyte array referenced by pixel, whose
|
||||
* format differs according to its bpp value and presence of an alpha channel. The RGBA values are scaled accordingly.
|
||||
*
|
||||
* @see bm_set_components
|
||||
*/
|
||||
extern void(*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
/**
|
||||
* @brief Sets the 16bpp screen pixel to the specified RGBA value
|
||||
*
|
||||
* @see bm_set_components
|
||||
*/
|
||||
void bm_set_components_argb_16_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
/**
|
||||
* @brief Sets the 32bpp screen pixel to the specified RGBA value
|
||||
*
|
||||
* @see bm_set_components
|
||||
*/
|
||||
void bm_set_components_argb_32_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
/**
|
||||
* @brief Sets the 16bpp texture pixel to the specified RGBA value
|
||||
*
|
||||
* @see bm_set_components
|
||||
*/
|
||||
void bm_set_components_argb_16_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
/**
|
||||
* @brief Sets the 32bpp texture pixel to the specified RGBA value
|
||||
*
|
||||
* @see bm_set_components
|
||||
*/
|
||||
void bm_set_components_argb_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
/**
|
||||
* @brief Gets the RGBA components of a pixel according to the selected mode
|
||||
*
|
||||
* @see BM_SELECT_SCREEN_FORMAT() BM_SELECT_TEX_FORMAT() BM_SELECT_ALPHA_TEX_FORMAT()
|
||||
*/
|
||||
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
extern int GLOWMAP; //this holds a reference to a map that is a fully lit version of its index -Bobboau
|
||||
extern int SPECMAP; //this holds a reference to a map that is for specular mapping -Bobboau
|
||||
extern int ENVMAP; //this holds a reference to a map that is for environment mapping -Bobboau
|
||||
extern int NORMMAP; // normal mapping
|
||||
extern int HEIGHTMAP; // height map for normal mapping
|
||||
extern int MISCMAP; // Utility map, to be utilized for various things shader authors can come up with
|
||||
/**
|
||||
* @brief Returns the compression type of the bitmap indexed by handle
|
||||
*/
|
||||
int bm_is_compressed(int handle);
|
||||
|
||||
int bm_is_compressed(int num);
|
||||
int bm_get_tcache_type(int num);
|
||||
int bm_get_size(int num);
|
||||
int bm_get_num_mipmaps(int num);
|
||||
/**
|
||||
* @brief Gets the correct TCACHE_TYPE for compressed graphics (uncompressed are assumed TCACHE_TYPE_NORMAL)
|
||||
*/
|
||||
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
|
||||
*/
|
||||
int bm_get_size(int handle);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of mipmaps of the indexed texture
|
||||
*/
|
||||
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
|
||||
*/
|
||||
int bm_has_alpha_channel(int handle);
|
||||
|
||||
/**
|
||||
* @brief (DEBUG) Prints all loaded bitmaps to an outwindow
|
||||
*/
|
||||
void bm_print_bitmaps();
|
||||
|
||||
int bm_make_render_target( int width, int height, int flags );
|
||||
int bm_is_render_target(int bitmap_id);
|
||||
/**
|
||||
* @brief Creates a render target as close to the desired resolution as possible.
|
||||
*
|
||||
* @returns the handle of an avilable render target if successful, or
|
||||
* @returns -1 if not successful
|
||||
*
|
||||
* @note BM_FLAG_RENDER_TARGET_STATIC are drawn once/infrequently, while BM_FLAG_RENDER_TARGET_DYNAMIC are drawn roughly once every frame
|
||||
*/
|
||||
int bm_make_render_target(int width, int height, int flags);
|
||||
|
||||
/**
|
||||
* @brief Checks to see if the given bitmap indexed by handle is a render target
|
||||
*
|
||||
* @returns The render type (BM_TYPE) if it is a render target, or
|
||||
* @returns 0 if it is not
|
||||
*/
|
||||
int bm_is_render_target(int handle);
|
||||
|
||||
/**
|
||||
* @brief (GR function) Calls gr_bm_set_render target for the given bitmap indexed by handle
|
||||
*
|
||||
* @returns 1 if successful, or
|
||||
* @returns 0 if unsuccessful
|
||||
*
|
||||
* @todo retval should be a bool
|
||||
*/
|
||||
int bm_set_render_target(int handle, int face = -1);
|
||||
|
||||
int bm_load_and_parse_eff(char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type);
|
||||
/**
|
||||
* @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] in_subdir (optional) If given, is set to true if the frames of this .EFF are in a subdir
|
||||
*
|
||||
* @returns 0 If successful,
|
||||
* @returns -1 if not successful
|
||||
*
|
||||
* @todo retval should be a bool
|
||||
*/
|
||||
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type, bool *in_subdir);
|
||||
|
||||
#endif
|
||||
+14
-14
@@ -540,8 +540,10 @@ 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, char* in_text, char* in_imageanim, float in_display_time, float in_fade_time, color *in_text_color, int in_text_fontnum, bool center_x, bool center_y, int in_width, int in_height, bool in_post_shaded)
|
||||
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)
|
||||
{
|
||||
SCP_string text_buf;
|
||||
|
||||
// basic init, this always has to be done
|
||||
memset( imageanim, 0, sizeof(imageanim) );
|
||||
memset( &text_pos, 0, 2*sizeof(int) );
|
||||
@@ -551,17 +553,16 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, char* in_imageanim
|
||||
if ( ((in_text != NULL) && (strlen(in_text) <= 0)) && ((in_imageanim != NULL) && (strlen(in_imageanim) <= 0)) )
|
||||
return;
|
||||
|
||||
char text_buf[256];
|
||||
if (in_text != NULL && in_text[0] != '\0')
|
||||
{
|
||||
strcpy_s(text_buf, in_text);
|
||||
sexp_replace_variable_names_with_values(text_buf, 256);
|
||||
in_text = text_buf;
|
||||
text_buf = in_text;
|
||||
sexp_replace_variable_names_with_values(text_buf);
|
||||
in_text = text_buf.c_str();
|
||||
}
|
||||
|
||||
|
||||
int num_text_lines = 0;
|
||||
char *text_line_ptrs[MAX_SUBTITLE_LINES];
|
||||
const char *text_line_ptrs[MAX_SUBTITLE_LINES];
|
||||
int text_line_lens[MAX_SUBTITLE_LINES];
|
||||
|
||||
//Setup text
|
||||
@@ -569,11 +570,10 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, char* in_imageanim
|
||||
int split_width = (in_width > 0) ? in_width : 200;
|
||||
|
||||
num_text_lines = split_str(in_text, split_width, text_line_lens, text_line_ptrs, MAX_SUBTITLE_LINES);
|
||||
SCP_string temp_str;
|
||||
for(int i = 0; i < num_text_lines; i++)
|
||||
{
|
||||
temp_str.assign(text_line_ptrs[i], text_line_lens[i]);
|
||||
text_lines.push_back(temp_str);
|
||||
text_buf.assign(text_line_ptrs[i], text_line_lens[i]);
|
||||
text_lines.push_back(text_buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,7 +718,7 @@ void subtitle::do_frame(float frametime)
|
||||
|
||||
for(SCP_vector<SCP_string>::iterator line = text_lines.begin(); line != text_lines.end(); ++line)
|
||||
{
|
||||
gr_string(x, y, (char*)line->c_str(), false);
|
||||
gr_string(x, y, (char*)line->c_str(), GR_RESIZE_NONE);
|
||||
y += font_height;
|
||||
}
|
||||
|
||||
@@ -739,18 +739,18 @@ void subtitle::do_frame(float frametime)
|
||||
vec3d scale;
|
||||
|
||||
bm_get_info(image_id, &orig_w, &orig_h);
|
||||
scale.xyz.x = image_pos.w / (float) orig_w;
|
||||
scale.xyz.y = image_pos.h / (float) orig_h;
|
||||
scale.xyz.x = (image_pos.w > 0) ? (image_pos.w / (float) orig_w) : 1.0f;
|
||||
scale.xyz.y = (image_pos.h > 0) ? (image_pos.h / (float) orig_h) : 1.0f;
|
||||
scale.xyz.z = 1.0f;
|
||||
|
||||
gr_push_scale_matrix(&scale);
|
||||
gr_bitmap(image_pos.x, image_pos.y, false);
|
||||
gr_bitmap(fl2i(image_pos.x / scale.xyz.x), fl2i(image_pos.y / scale.xyz.y), GR_RESIZE_NONE);
|
||||
gr_pop_scale_matrix();
|
||||
}
|
||||
// no scaling
|
||||
else
|
||||
{
|
||||
gr_bitmap(image_pos.x, image_pos.y, false);
|
||||
gr_bitmap(image_pos.x, image_pos.y, GR_RESIZE_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,8 +137,8 @@ private:
|
||||
|
||||
bool post_shaded;
|
||||
public:
|
||||
subtitle(int in_x_pos, int in_y_pos, char* in_text = NULL, char* in_imageanim = NULL,
|
||||
float in_display_time = 0, float in_fade_time = 0.0f, color *in_text_color = NULL, int in_text_fontnum = -1,
|
||||
subtitle(int in_x_pos, int in_y_pos, const char* in_text = NULL, const char* in_imageanim = NULL,
|
||||
float in_display_time = 0, float in_fade_time = 0.0f, const color *in_text_color = NULL, int in_text_fontnum = -1,
|
||||
bool center_x = false, bool center_y = false, int in_width = 0, int in_height = 0, bool post_shaded=false);
|
||||
~subtitle();
|
||||
|
||||
|
||||
+30
-35
@@ -35,7 +35,6 @@
|
||||
#include "osapi/osapi.h"
|
||||
|
||||
|
||||
|
||||
char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
#ifdef SCP_UNIX
|
||||
char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
@@ -87,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 },
|
||||
};
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ char Cfile_stack[CFILE_STACK_MAX][CFILE_ROOT_DIRECTORY_LEN];
|
||||
Cfile_block Cfile_block_list[MAX_CFILE_BLOCKS];
|
||||
CFILE Cfile_list[MAX_CFILE_BLOCKS];
|
||||
|
||||
char *Cfile_cdrom_dir = NULL;
|
||||
const char *Cfile_cdrom_dir = NULL;
|
||||
|
||||
//
|
||||
// Function prototypes for internally-called functions
|
||||
@@ -123,7 +123,7 @@ void cfile_close()
|
||||
}
|
||||
|
||||
// determine if the given path is in a root directory (c:\ or c:\freespace2.exe or c:\fred2.exe etc)
|
||||
int cfile_in_root_dir(char *exe_path)
|
||||
int cfile_in_root_dir(const char *exe_path)
|
||||
{
|
||||
int token_count = 0;
|
||||
char path_copy[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
@@ -167,7 +167,7 @@ int cfile_in_root_dir(char *exe_path)
|
||||
// returns: success ==> 0
|
||||
// error ==> non-zero
|
||||
//
|
||||
int cfile_init(char *exe_dir, char *cdrom_dir)
|
||||
int cfile_init(const char *exe_dir, const char *cdrom_dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -314,17 +314,17 @@ int cfile_push_chdir(int type)
|
||||
}
|
||||
|
||||
|
||||
int cfile_chdir(char *dir)
|
||||
int cfile_chdir(const char *dir)
|
||||
{
|
||||
int e;
|
||||
char OriginalDirectory[CFILE_ROOT_DIRECTORY_LEN];
|
||||
char *Path = NULL;
|
||||
const char *Path = NULL;
|
||||
char NoDir[] = "\\.";
|
||||
|
||||
_getcwd(OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN-1);
|
||||
|
||||
#ifdef _WIN32
|
||||
char *colon_pos = strchr(dir, ':');
|
||||
const char *colon_pos = strchr(dir, ':');
|
||||
if (colon_pos) {
|
||||
if (!cfile_chdrive( tolower(*(colon_pos - 1)) - 'a' + 1, 1))
|
||||
return 1;
|
||||
@@ -429,7 +429,7 @@ int cfile_flush_dir(int dir_type)
|
||||
// filename = name of filename or filepath to process
|
||||
// ext = extension to add. Must start with the period
|
||||
// Returns: new filename or filepath with extension.
|
||||
char *cf_add_ext(char *filename, char *ext)
|
||||
char *cf_add_ext(const char *filename, const char *ext)
|
||||
{
|
||||
int flen, elen;
|
||||
static char path[MAX_PATH_LEN];
|
||||
@@ -447,7 +447,7 @@ char *cf_add_ext(char *filename, char *ext)
|
||||
}
|
||||
|
||||
// Deletes a file. Returns 0 if an error occurs, 1 on success
|
||||
int cf_delete(char *filename, int dir_type)
|
||||
int cf_delete(const char *filename, int dir_type)
|
||||
{
|
||||
char longname[MAX_PATH_LEN];
|
||||
|
||||
@@ -478,7 +478,7 @@ int cf_delete(char *filename, int dir_type)
|
||||
|
||||
|
||||
// Same as _access function to read a file's access bits
|
||||
int cf_access(char *filename, int dir_type, int mode)
|
||||
int cf_access(const char *filename, int dir_type, int mode)
|
||||
{
|
||||
char longname[MAX_PATH_LEN];
|
||||
|
||||
@@ -492,29 +492,23 @@ int cf_access(char *filename, int dir_type, int mode)
|
||||
|
||||
// Returns 1 if the file exists, 0 if not.
|
||||
// Checks only the file system.
|
||||
int cf_exists(char *filename, int dir_type)
|
||||
// cf_find_file_location checks the filesystem before VPs
|
||||
// If offset is 0, it was found in the filesystem, so offset is boolean false
|
||||
// If offset equates to boolean true, it was found in a VP and the logic will negate the function return
|
||||
int cf_exists(const char *filename, int dir_type)
|
||||
{
|
||||
char longname[MAX_PATH_LEN];
|
||||
int offset = 1;
|
||||
|
||||
Assert(CF_TYPE_SPECIFIED(dir_type));
|
||||
if ( (filename == NULL) || !strlen(filename) )
|
||||
return 0;
|
||||
|
||||
cf_create_default_path_string(longname, sizeof(longname) - 1, dir_type, filename);
|
||||
|
||||
FILE *fp = fopen(longname, "rb");
|
||||
if (fp)
|
||||
{
|
||||
// Goober5000 - these were switched, causing the fclose to be unreachable
|
||||
fclose(fp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (cf_find_file_location(filename, dir_type, 0, NULL, &offset, NULL) && !offset);
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
// Returns !0 if the file exists, 0 if not.
|
||||
// Checks both the file system and the VPs.
|
||||
int cf_exists_full(char *filename, int dir_type)
|
||||
int cf_exists_full(const char *filename, int dir_type)
|
||||
{
|
||||
if ( (filename == NULL) || !strlen(filename) )
|
||||
return 0;
|
||||
@@ -523,7 +517,7 @@ int cf_exists_full(char *filename, int dir_type)
|
||||
}
|
||||
|
||||
// same as the above, but with extension check
|
||||
int cf_exists_full_ext(char *filename, int dir_type, const int num_ext, const char **ext_list)
|
||||
int cf_exists_full_ext(const char *filename, int dir_type, const int num_ext, const char **ext_list)
|
||||
{
|
||||
if ( (filename == NULL) || !strlen(filename) )
|
||||
return 0;
|
||||
@@ -535,7 +529,7 @@ int cf_exists_full_ext(char *filename, int dir_type, const int num_ext, const ch
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void cf_attrib(char *filename, int set, int clear, int dir_type)
|
||||
void cf_attrib(const char *filename, int set, int clear, int dir_type)
|
||||
{
|
||||
char longname[MAX_PATH_LEN];
|
||||
|
||||
@@ -554,7 +548,7 @@ void cf_attrib(char *filename, int set, int clear, int dir_type)
|
||||
}
|
||||
#endif
|
||||
|
||||
int cf_rename(char *old_name, char *name, int dir_type)
|
||||
int cf_rename(const char *old_name, const char *name, int dir_type)
|
||||
{
|
||||
Assert( CF_TYPE_SPECIFIED(dir_type) );
|
||||
|
||||
@@ -634,7 +628,7 @@ extern int game_cd_changed();
|
||||
// error ==> NULL
|
||||
//
|
||||
|
||||
CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize)
|
||||
CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, bool localize)
|
||||
{
|
||||
/* Bobboau, what is this doing here? 31 is way too short... - Goober5000
|
||||
if( strlen(file_path) > 31 )
|
||||
@@ -736,6 +730,7 @@ CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize
|
||||
if ( cf_find_file_location( copy_file_path, dir_type, sizeof(longname) - 1, longname, &size, &offset, localize ) ) {
|
||||
|
||||
// Fount it, now create a cfile out of it
|
||||
nprintf(("CFileDebug", "Requested file %s found at: %s\n", file_path, longname));
|
||||
|
||||
if ( type & CFILE_MEMORY_MAPPED ) {
|
||||
|
||||
@@ -788,7 +783,7 @@ CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize
|
||||
// returns: success ==> address of CFILE structure
|
||||
// error ==> NULL
|
||||
//
|
||||
CFILE *cfopen_special(char *file_path, char *mode, const int size, const int offset, int dir_type)
|
||||
CFILE *cfopen_special(const char *file_path, const char *mode, const int size, const int offset, int dir_type)
|
||||
{
|
||||
if ( !cfile_inited) {
|
||||
Int3();
|
||||
@@ -1337,7 +1332,7 @@ int cfwrite_char(char b, CFILE *file)
|
||||
return cfwrite( &b, sizeof(b), 1, file);
|
||||
}
|
||||
|
||||
int cfwrite_string(char *buf, CFILE *file)
|
||||
int cfwrite_string(const char *buf, CFILE *file)
|
||||
{
|
||||
if ( (!buf) || (buf && !buf[0]) ) {
|
||||
return cfwrite_char(0, file);
|
||||
@@ -1475,7 +1470,7 @@ int cfputc(int c, CFILE *cfile)
|
||||
// returns: success ==> non-negative value
|
||||
// error ==> EOF
|
||||
//
|
||||
int cfputs(char *str, CFILE *cfile)
|
||||
int cfputs(const char *str, CFILE *cfile)
|
||||
{
|
||||
if(!cf_is_valid(cfile))
|
||||
return EOF;
|
||||
@@ -1693,7 +1688,7 @@ int cf_chksum_do(CFILE *cfile, ushort *chk_short, uint *chk_long, int max_size)
|
||||
}
|
||||
|
||||
// get the chksum of a pack file (VP)
|
||||
int cf_chksum_pack(char *filename, uint *chk_long, bool full)
|
||||
int cf_chksum_pack(const char *filename, uint *chk_long, bool full)
|
||||
{
|
||||
const int safe_size = 2097152; // 2 Meg
|
||||
const int header_offset = 32; // skip 32bytes for header (header is currently smaller than this though)
|
||||
@@ -1762,7 +1757,7 @@ int cf_chksum_pack(char *filename, uint *chk_long, bool full)
|
||||
return 1;
|
||||
}
|
||||
// get the 2 byte checksum of the passed filename - return 0 if operation failed, 1 if succeeded
|
||||
int cf_chksum_short(char *filename, ushort *chksum, int max_size, int cf_type)
|
||||
int cf_chksum_short(const char *filename, ushort *chksum, int max_size, int cf_type)
|
||||
{
|
||||
int ret_val;
|
||||
CFILE *cfile = NULL;
|
||||
@@ -1812,7 +1807,7 @@ int cf_chksum_short(CFILE *file, ushort *chksum, int max_size)
|
||||
}
|
||||
|
||||
// get the 32 bit CRC checksum of the passed filename - return 0 if operation failed, 1 if succeeded
|
||||
int cf_chksum_long(char *filename, uint *chksum, int max_size, int cf_type)
|
||||
int cf_chksum_long(const char *filename, uint *chksum, int max_size, int cf_type)
|
||||
{
|
||||
int ret_val;
|
||||
CFILE *cfile = NULL;
|
||||
|
||||
+27
-26
@@ -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
|
||||
@@ -99,7 +100,7 @@ typedef struct {
|
||||
|
||||
// callback function used for get_file_list() to filter files to be added to list. Return 1
|
||||
// to add file to list, or 0 to not add it.
|
||||
extern int (*Get_file_list_filter)(char *filename);
|
||||
extern int (*Get_file_list_filter)(const char *filename);
|
||||
|
||||
// extra check for child directory under CF_TYPE_*
|
||||
// NOTE: if specified cf_get_file_list() will not search pack files!
|
||||
@@ -115,7 +116,7 @@ extern char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN];
|
||||
|
||||
//================= LOW-LEVEL FUNCTIONS ==================
|
||||
// Call this once at the beginning of the program
|
||||
int cfile_init(char *exe_dir,char *cdrom_dir=NULL);
|
||||
int cfile_init(const char *exe_dir, const char *cdrom_dir=NULL);
|
||||
|
||||
// Call this if pack files got added or removed or the
|
||||
// cdrom changed. This will refresh the list of filenames
|
||||
@@ -123,18 +124,18 @@ int cfile_init(char *exe_dir,char *cdrom_dir=NULL);
|
||||
void cfile_refresh();
|
||||
|
||||
// add an extension to a filename if it doesn't already have it
|
||||
char *cf_add_ext(char *filename, char *ext);
|
||||
char *cf_add_ext(const char *filename, const char *ext);
|
||||
|
||||
// return CF_TYPE (directory location type) of a CFILE you called cfopen() successfully on.
|
||||
int cf_get_dir_type(CFILE *cfile);
|
||||
|
||||
// Opens the file. If no path is given, use the extension to look into the
|
||||
// default path. If mode is NULL, delete the file.
|
||||
CFILE *cfopen(char *filename, char *mode, int type = CFILE_NORMAL, int dir_type = CF_TYPE_ANY, bool localize = false);
|
||||
CFILE *cfopen(const char *filename, const char *mode, int type = CFILE_NORMAL, int dir_type = CF_TYPE_ANY, bool localize = false);
|
||||
|
||||
// like cfopen(), but it accepts a fully qualified path only (ie, the result of a cf_find_file_location() call)
|
||||
// NOTE: only supports reading files!!
|
||||
CFILE *cfopen_special(char *file_path, char *mode, const int size, const int offset, int dir_type = CF_TYPE_ANY);
|
||||
CFILE *cfopen_special(const char *file_path, const char *mode, const int size, const int offset, int dir_type = CF_TYPE_ANY);
|
||||
|
||||
// Flush the open file buffer
|
||||
int cflush(CFILE *cfile);
|
||||
@@ -149,21 +150,21 @@ void cf_set_version( CFILE * cfile, int version );
|
||||
void cf_set_max_read_len(CFILE *cfile, size_t len);
|
||||
|
||||
// Deletes a file. Returns 0 on error, 1 if successful
|
||||
int cf_delete(char *filename, int dir_type);
|
||||
int cf_delete(const char *filename, int dir_type);
|
||||
|
||||
// Same as _access function to read a file's access bits
|
||||
int cf_access(char *filename, int dir_type, int mode);
|
||||
int cf_access(const char *filename, int dir_type, int mode);
|
||||
|
||||
// Returns 1 if the file exists, 0 if not.
|
||||
// Checks only the file system.
|
||||
int cf_exists(char *filename, int dir_type);
|
||||
int cf_exists(const char *filename, int dir_type);
|
||||
|
||||
// Goober5000
|
||||
// Returns 1 if the file exists, 0 if not.
|
||||
// Checks both the file system and the VPs.
|
||||
int cf_exists_full(char *filename, int dir_type);
|
||||
int cf_exists_full(const char *filename, int dir_type);
|
||||
// check num_ext worth of ext_list extensions
|
||||
int cf_exists_full_ext(char *filename, int dir_type, const int num_ext, const char **ext_list);
|
||||
int cf_exists_full_ext(const char *filename, int dir_type, const int num_ext, const char **ext_list);
|
||||
|
||||
// ctmpfile() opens a temporary file stream. File is deleted automatically when closed
|
||||
CFILE *ctmpfile();
|
||||
@@ -197,7 +198,7 @@ int cftell(CFILE *fp);
|
||||
int cfputc(int c, CFILE *cfile);
|
||||
|
||||
// cfputs() writes a string to a file
|
||||
int cfputs(char *str, CFILE *cfile);
|
||||
int cfputs(const char *str, CFILE *cfile);
|
||||
|
||||
// cfgetc() reads a character to a file
|
||||
int cfgetc(CFILE *cfile);
|
||||
@@ -212,20 +213,20 @@ int cfeof(CFILE *cfile);
|
||||
void *cf_returndata(CFILE *cfile);
|
||||
|
||||
// get the 2 byte checksum of the passed filename - return 0 if operation failed, 1 if succeeded
|
||||
int cf_chksum_short(char *filename, ushort *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
|
||||
int cf_chksum_short(const char *filename, ushort *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
|
||||
|
||||
// get the 2 byte checksum of the passed file - return 0 if operation failed, 1 if succeeded
|
||||
// NOTE : preserves current file position
|
||||
int cf_chksum_short(CFILE *file, ushort *chksum, int max_size = -1);
|
||||
|
||||
// get the 32 bit CRC checksum of the passed filename - return 0 if operation failed, 1 if succeeded
|
||||
int cf_chksum_long(char *filename, uint *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
|
||||
int cf_chksum_long(const char *filename, uint *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
|
||||
|
||||
// get the 32 bit CRC checksum of the passed file - return 0 if operation failed, 1 if succeeded
|
||||
// NOTE : preserves current file position
|
||||
int cf_chksum_long(CFILE *file, uint *chksum, int max_size = -1);
|
||||
|
||||
int cf_chksum_pack(char *filename, uint *chk_long, bool full = false);
|
||||
int cf_chksum_pack(const char *filename, uint *chk_long, bool full = false);
|
||||
|
||||
// convenient for misc checksumming purposes ------------------------------------------
|
||||
|
||||
@@ -238,16 +239,16 @@ uint cf_add_chksum_long(uint seed, ubyte *buffer, int size);
|
||||
// convenient for misc checksumming purposes ------------------------------------------
|
||||
|
||||
//================= HIGH LEVEL FUNCTIONS ==================
|
||||
int cfexist(char *filename); // Returns true if file exists on disk (1) or in hog (2).
|
||||
int cfexist(const char *filename); // Returns true if file exists on disk (1) or in hog (2).
|
||||
|
||||
// rename a file, utilizing the extension to determine where file is.
|
||||
#define CF_RENAME_SUCCESS 0 // successfully renamed the file
|
||||
#define CF_RENAME_FAIL_ACCESS 1 // new name could not be created
|
||||
#define CF_RENAME_FAIL_EXIST 2 // old name does not exist
|
||||
int cf_rename(char *old_name, char *name, int type = CF_TYPE_ANY );
|
||||
int cf_rename(const char *old_name, const char *name, int type = CF_TYPE_ANY );
|
||||
|
||||
// changes the attributes of a file
|
||||
void cf_attrib(char *name, int set, int clear, int type);
|
||||
void cf_attrib(const char *name, int set, int clear, int type);
|
||||
|
||||
// flush (delete all files in) the passed directory (by type), return the # of files deleted
|
||||
// NOTE : WILL NOT DELETE READ-ONLY FILES
|
||||
@@ -294,7 +295,7 @@ int cfwrite_vector(vec3d *vec, CFILE *file);
|
||||
int cfwrite_angles(angles *ang, CFILE *file);
|
||||
|
||||
// writes variable length, null-termined string.
|
||||
int cfwrite_string(char *buf, CFILE *file);
|
||||
int cfwrite_string(const char *buf, CFILE *file);
|
||||
|
||||
/**
|
||||
* @brief Write a fixed length string (not including its null terminator), with the length stored in file
|
||||
@@ -304,9 +305,9 @@ int cfwrite_string(char *buf, CFILE *file);
|
||||
*/
|
||||
int cfwrite_string_len(const char *buf, CFILE *file);
|
||||
|
||||
int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, char *filter, int sort = CF_SORT_NONE, SCP_vector<file_list_info> *info = NULL );
|
||||
int cf_get_file_list( int max, char **list, int type, char *filter, int sort = CF_SORT_NONE, file_list_info *info = NULL );
|
||||
int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char **list, int type, char *filter, int sort = CF_SORT_NONE, file_list_info *info = NULL );
|
||||
int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, const char *filter, int sort = CF_SORT_NONE, SCP_vector<file_list_info> *info = NULL );
|
||||
int cf_get_file_list( int max, char **list, int type, const char *filter, int sort = CF_SORT_NONE, file_list_info *info = NULL );
|
||||
int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char **list, int type, const char *filter, int sort = CF_SORT_NONE, file_list_info *info = NULL );
|
||||
void cf_sort_filenames( int n, char **list, int sort, file_list_info *info = NULL );
|
||||
void cf_sort_filenames( SCP_vector<SCP_string> &list, int sort, SCP_vector<file_list_info> *info = NULL );
|
||||
|
||||
@@ -319,7 +320,7 @@ void cf_sort_filenames( SCP_vector<SCP_string> &list, int sort, SCP_vector<file_
|
||||
// size - File size
|
||||
// offset - Offset into pack file. 0 if not a packfile.
|
||||
// Returns: If not found returns 0.
|
||||
int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize = false);
|
||||
int cf_find_file_location( const char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize = false);
|
||||
|
||||
// Searches for a file. Follows all rules and precedence and searches
|
||||
// CD's and pack files. Searches all locations in order for first filename using ext filter list.
|
||||
@@ -333,10 +334,10 @@ int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack
|
||||
// offset - Offset into pack file. 0 if not a packfile.
|
||||
// Returns: If not found returns -1, else returns offset into ext_list.
|
||||
// (NOTE: This function is exponentially slow, so don't use it unless truely needed!!)
|
||||
int cf_find_file_location_ext(char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out = 0, char *pack_filename = NULL, int *size = NULL, int *offset = NULL, bool localize = false);
|
||||
int cf_find_file_location_ext(const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out = 0, char *pack_filename = NULL, int *size = NULL, int *offset = NULL, bool localize = false);
|
||||
|
||||
// Functions to change directories
|
||||
int cfile_chdir(char *dir);
|
||||
int cfile_chdir(const char *dir);
|
||||
|
||||
#ifdef _WIN32
|
||||
int cfile_chdrive(int DriveNum, int flag);
|
||||
@@ -387,6 +388,6 @@ namespace cfile
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __CFILE_H__ */
|
||||
+23
-20
@@ -366,7 +366,7 @@ void cf_build_pack_list( cf_root *root )
|
||||
}
|
||||
|
||||
|
||||
void cf_build_root_list(char *cdrom_dir)
|
||||
void cf_build_root_list(const char *cdrom_dir)
|
||||
{
|
||||
Num_roots = 0;
|
||||
Num_path_roots = 0;
|
||||
@@ -388,7 +388,7 @@ void cf_build_root_list(char *cdrom_dir)
|
||||
|
||||
// truncated string check
|
||||
if ( (strlen(Cfile_user_dir) + strlen(str_temp) + 1) >= CF_MAX_PATHNAME_LENGTH ) {
|
||||
Int3();
|
||||
Error(LOCATION, "Home directory plus mod directory exceeds CF_MAX_PATHNAME_LENGTH\n");
|
||||
}
|
||||
|
||||
root = cf_create_root();
|
||||
@@ -444,7 +444,7 @@ void cf_build_root_list(char *cdrom_dir)
|
||||
|
||||
// truncated string check
|
||||
if ( (strlen(root->path) + strlen(str_temp) + 1) >= CF_MAX_PATHNAME_LENGTH ) {
|
||||
Int3();
|
||||
Error(LOCATION, "Installed path plus mod directory exceeds CF_MAX_PATHNAME_LENGTH\n");
|
||||
}
|
||||
|
||||
path_len = strlen(root->path);
|
||||
@@ -503,11 +503,11 @@ void cf_build_root_list(char *cdrom_dir)
|
||||
// Given a lower case list of file extensions
|
||||
// separated by spaces, return zero if ext is
|
||||
// not in the list.
|
||||
int is_ext_in_list( char *ext_list, char *ext )
|
||||
int is_ext_in_list( const char *ext_list, const char *ext )
|
||||
{
|
||||
char tmp_ext[128];
|
||||
|
||||
strncpy( tmp_ext, ext, 127 );
|
||||
strcpy_s( tmp_ext, ext);
|
||||
strlwr(tmp_ext);
|
||||
if ( strstr(ext_list, tmp_ext )) {
|
||||
return 1;
|
||||
@@ -695,6 +695,7 @@ void cf_search_root_pack(int root_index)
|
||||
find.offset = INTEL_INT( find.offset ); //-V570
|
||||
find.size = INTEL_INT( find.size ); //-V570
|
||||
find.write_time = INTEL_INT( find.write_time ); //-V570
|
||||
find.filename[sizeof(find.filename)-1] = '\0';
|
||||
|
||||
if ( find.size == 0 ) {
|
||||
int search_path_len = strlen(search_path);
|
||||
@@ -766,7 +767,7 @@ void cf_build_file_list()
|
||||
}
|
||||
|
||||
|
||||
void cf_build_secondary_filelist(char *cdrom_dir)
|
||||
void cf_build_secondary_filelist(const char *cdrom_dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -833,7 +834,7 @@ void cf_free_secondary_filelist()
|
||||
*
|
||||
* @return If not found returns 0.
|
||||
*/
|
||||
int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
|
||||
int cf_find_file_location( const char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
|
||||
{
|
||||
int i;
|
||||
uint ui;
|
||||
@@ -900,6 +901,7 @@ int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack
|
||||
case CF_TYPE_MULTI_CACHE:
|
||||
case CF_TYPE_MISSIONS:
|
||||
case CF_TYPE_CACHE:
|
||||
case CF_TYPE_TEMP_SUBDIR_LOOKUP:
|
||||
cfs_slow_search = 1;
|
||||
break;
|
||||
|
||||
@@ -1024,7 +1026,7 @@ int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack
|
||||
}
|
||||
|
||||
// -- from parselo.cpp --
|
||||
extern char *stristr(const char *str, const char *substr);
|
||||
extern char *stristr(char *str, const char *substr);
|
||||
|
||||
/**
|
||||
* Searches for a file.
|
||||
@@ -1044,7 +1046,7 @@ extern char *stristr(const char *str, const char *substr);
|
||||
*
|
||||
* @return If not found returns -1, else returns offset into ext_list.
|
||||
*/
|
||||
int cf_find_file_location_ext( char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
|
||||
int cf_find_file_location_ext( const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
|
||||
{
|
||||
int cur_ext, i;
|
||||
uint ui;
|
||||
@@ -1318,9 +1320,10 @@ int cf_find_file_location_ext( char *filename, const int ext_num, const char **e
|
||||
|
||||
|
||||
// Returns true if filename matches filespec, else zero if not
|
||||
int cf_matches_spec(char *filespec, char *filename)
|
||||
int cf_matches_spec(const char *filespec, const char *filename)
|
||||
{
|
||||
char *src_ext, *dst_ext;
|
||||
const char *src_ext;
|
||||
const char *dst_ext;
|
||||
|
||||
src_ext = strrchr(filespec, '*');
|
||||
if(!src_ext)
|
||||
@@ -1353,7 +1356,7 @@ int cf_matches_spec(char *filespec, char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
int (*Get_file_list_filter)(char *filename) = NULL;
|
||||
int (*Get_file_list_filter)(const char *filename) = NULL;
|
||||
const char *Get_file_list_child = NULL;
|
||||
int Skip_packfile_search = 0;
|
||||
|
||||
@@ -1382,7 +1385,7 @@ static bool verify_file_list_child()
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cf_file_already_in_list( SCP_vector<SCP_string> &list, char *filename )
|
||||
static int cf_file_already_in_list( SCP_vector<SCP_string> &list, const char *filename )
|
||||
{
|
||||
char name_no_extension[MAX_PATH_LEN];
|
||||
size_t i, size = list.size();
|
||||
@@ -1410,7 +1413,7 @@ static int cf_file_already_in_list( SCP_vector<SCP_string> &list, char *filename
|
||||
// This one has a 'type', which is a CF_TYPE_* value. Because this specifies the directory
|
||||
// location, 'filter' only needs to be the filter itself, with no path information.
|
||||
// See above descriptions of cf_get_file_list() for more information about how it all works.
|
||||
int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, char *filter, int sort, SCP_vector<file_list_info> *info )
|
||||
int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, const char *filter, int sort, SCP_vector<file_list_info> *info )
|
||||
{
|
||||
char *ptr;
|
||||
uint i;
|
||||
@@ -1587,7 +1590,7 @@ int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, char *filter,
|
||||
return (int)list.size();
|
||||
}
|
||||
|
||||
int cf_file_already_in_list( int num_files, char **list, char *filename )
|
||||
int cf_file_already_in_list( int num_files, char **list, const char *filename )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1611,7 +1614,7 @@ int cf_file_already_in_list( int num_files, char **list, char *filename )
|
||||
// This one has a 'type', which is a CF_TYPE_* value. Because this specifies the directory
|
||||
// location, 'filter' only needs to be the filter itself, with no path information.
|
||||
// See above descriptions of cf_get_file_list() for more information about how it all works.
|
||||
int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort, file_list_info *info )
|
||||
int cf_get_file_list( int max, char **list, int pathtype, const char *filter, int sort, file_list_info *info )
|
||||
{
|
||||
char *ptr;
|
||||
uint i;
|
||||
@@ -1786,7 +1789,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
return num_files;
|
||||
}
|
||||
|
||||
int cf_file_already_in_list_preallocated( int num_files, char arr[][MAX_FILENAME_LEN], char *filename )
|
||||
int cf_file_already_in_list_preallocated( int num_files, char arr[][MAX_FILENAME_LEN], const char *filename )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1810,7 +1813,7 @@ int cf_file_already_in_list_preallocated( int num_files, char arr[][MAX_FILENAME
|
||||
// This one has a 'type', which is a CF_TYPE_* value. Because this specifies the directory
|
||||
// location, 'filter' only needs to be the filter itself, with no path information.
|
||||
// See above descriptions of cf_get_file_list() for more information about how it all works.
|
||||
int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char **list, int pathtype, char *filter, int sort, file_list_info *info )
|
||||
int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char **list, int pathtype, const char *filter, int sort, file_list_info *info )
|
||||
{
|
||||
int num_files = 0, own_flag = 0;
|
||||
|
||||
@@ -1997,7 +2000,7 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
// filename - optional, if set, tacks the filename onto end of path.
|
||||
// Output: path - Fully qualified pathname.
|
||||
//Returns 0 if the result would be too long (invalid result)
|
||||
int cf_create_default_path_string( char *path, uint path_max, int pathtype, char *filename, bool localize )
|
||||
int cf_create_default_path_string(char *path, uint path_max, int pathtype, const char *filename, bool localize )
|
||||
{
|
||||
#ifdef SCP_UNIX
|
||||
if ( filename && strpbrk(filename,"/") ) {
|
||||
@@ -2069,7 +2072,7 @@ int cf_create_default_path_string( char *path, uint path_max, int pathtype, char
|
||||
// filename - optional, if set, tacks the filename onto end of path.
|
||||
// Output: path - Fully qualified pathname.
|
||||
//Returns 0 if the result would be too long (invalid result)
|
||||
int cf_create_default_path_string( SCP_string &path, int pathtype, char *filename, bool localize )
|
||||
int cf_create_default_path_string( SCP_string &path, int pathtype, const char *filename, bool localize )
|
||||
{
|
||||
#ifdef SCP_UNIX
|
||||
if ( filename && strpbrk(filename,"/") ) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
// Builds a list of all the files
|
||||
void cf_build_secondary_filelist( char *cdrom_path );
|
||||
void cf_build_secondary_filelist( const char *cdrom_path );
|
||||
void cf_free_secondary_filelist();
|
||||
|
||||
// Internal stuff
|
||||
@@ -39,7 +39,7 @@ extern cf_pathtype Pathtypes[CF_MAX_PATH_TYPES];
|
||||
// filename - optional, if set, tacks the filename onto end of path.
|
||||
// Output: path - Fully qualified pathname.
|
||||
//Returns 0 if result would be too long (invalid result)
|
||||
int cf_create_default_path_string( char *path, uint path_max, int pathtype, char *filename=NULL, bool localize = false);
|
||||
int cf_create_default_path_string( SCP_string &path, int pathtype, char *filename=NULL, bool localize = false );
|
||||
int cf_create_default_path_string( char *path, uint path_max, int pathtype, const char *filename=NULL, bool localize = false);
|
||||
int cf_create_default_path_string( SCP_string &path, int pathtype, const char *filename=NULL, bool localize = false );
|
||||
|
||||
#endif //_CFILESYSTEM_H
|
||||
+374
-230
@@ -29,22 +29,40 @@
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
#include "osapi/osapi.h"
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum cmdline_arg_type
|
||||
{
|
||||
AT_NONE =0,
|
||||
AT_INT,
|
||||
AT_FLOAT,
|
||||
AT_STRING
|
||||
};
|
||||
// values and order MUST match cmdline_arg_type
|
||||
const char *cmdline_arg_types[] =
|
||||
{
|
||||
"NONE",
|
||||
"INT",
|
||||
"FLOAT",
|
||||
"STRING",
|
||||
};
|
||||
|
||||
// variables
|
||||
class cmdline_parm {
|
||||
public:
|
||||
cmdline_parm *next, *prev;
|
||||
char *name; // name of parameter, must start with '-' char
|
||||
char *help; // help text for this parameter
|
||||
bool stacks; // whether this arg stacks with each use or is replaced by newest use (should only be used for strings!!)
|
||||
char *args; // string value for parameter arguements (NULL if no arguements)
|
||||
const char *name; // name of parameter, must start with '-' char
|
||||
const char *help; // help text for this parameter
|
||||
const bool stacks; // whether this arg stacks with each use or is replaced by newest use (should only be used for strings!!)
|
||||
char *args; // string value for parameter arguments (NULL if no arguments)
|
||||
int name_found; // true if parameter on command line, otherwise false
|
||||
const int arg_type; // from enum cmdline_arg_type; used for help
|
||||
|
||||
cmdline_parm(char *name, char *help, bool stacks = false);
|
||||
cmdline_parm(const char *name, const char *help, const int arg_type, const bool stacks = false);
|
||||
~cmdline_parm();
|
||||
int found();
|
||||
int get_int();
|
||||
@@ -53,12 +71,11 @@ public:
|
||||
bool check_if_args_is_valid();
|
||||
};
|
||||
|
||||
static cmdline_parm Parm_list(NULL, NULL);
|
||||
static cmdline_parm Parm_list(NULL, NULL, AT_NONE);
|
||||
static int Parm_list_inited = 0;
|
||||
|
||||
extern int Show_framerate; // from freespace.cpp
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
// DO NOT CHANGE ANYTHING ABOUT THESE FIRST TWO OR WILL MESS UP THE LAUNCHER
|
||||
@@ -83,7 +100,7 @@ enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// DO NOT CHANGE THE SIZE OF THIS STRING!
|
||||
// DO NOT CHANGE THE SIZE OF THIS AT_STRING!
|
||||
char name[32];
|
||||
|
||||
} EasyFlag;
|
||||
@@ -113,21 +130,24 @@ typedef struct
|
||||
// Please group them by type, ie graphics, gameplay etc, maximum 20 different types
|
||||
Flag exe_params[] =
|
||||
{
|
||||
{ "-nospec", "Disable specular", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-spec", },
|
||||
{ "-noglow", "Disable glow maps", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-glow", },
|
||||
{ "-noenv", "Disable environment maps", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-env", },
|
||||
{ "-nospec", "Disable specular", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-spec", },
|
||||
{ "-noglow", "Disable glow maps", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-glow", },
|
||||
{ "-noenv", "Disable environment maps", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-env", },
|
||||
{ "-nomotiondebris", "Disable motion debris", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomotiondebris",},
|
||||
{ "-noscalevid", "Disable scale-to-window for movies", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noscalevid", },
|
||||
{ "-missile_lighting", "Apply lighting to missiles" , true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missile_lighting", },
|
||||
{ "-nonormal", "Disable normal maps", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-normal" },
|
||||
{ "-nonormal", "Disable normal maps", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-normal" },
|
||||
{ "-noheight", "Disable height/parallax maps", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-height" },
|
||||
{ "-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, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-post_process" },
|
||||
{ "-soft_particles", "Enable soft particles", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-soft_particles" },
|
||||
{ "-fxaa", "Enable FXAA anti-aliasing", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fxaa" },
|
||||
{ "-nolightshafts", "Disable lightshafts", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
|
||||
{ "-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_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", },
|
||||
|
||||
{ "-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", },
|
||||
{ "-cache_bitmaps", "Cache bitmaps between missions", true, 0, EASY_DEFAULT_MEM, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-cache_bitmaps", },
|
||||
|
||||
{ "-dualscanlines", "Add another pair of scanning lines", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dualscanlines", },
|
||||
@@ -141,6 +161,7 @@ Flag exe_params[] =
|
||||
{ "-3dwarp", "Enable 3D warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dwarp", },
|
||||
{ "-warp_flash", "Enable flash upon warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-warp_flash", },
|
||||
{ "-no_ap_interrupt", "Disable interrupting autopilot", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_ap_interrupt", },
|
||||
{ "-stretch_menu", "Stretch interface to fill screen", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stretch_menu", },
|
||||
|
||||
{ "-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", },
|
||||
@@ -163,20 +184,22 @@ Flag exe_params[] =
|
||||
{ "-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", },
|
||||
{ "-no_glsl", "Disable GLSL (shader) support", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_glsl", },
|
||||
{ "-ati_swap", "Fix colour issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://scp.indiegames.us/mantis/view.php?id=1669", },
|
||||
{ "-ati_swap", "Fix colour issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ati_swap", },
|
||||
{ "-no_3d_sound", "Use only 2D/stereo for sound effects", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_3d_sound", },
|
||||
{ "-disable_glsl_model","Don't use shaders for model rendering", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_glsl_model", },
|
||||
{ "-mipmap", "Enable mipmapping", true, 0, EASY_DEFAULT_MEM, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mipmap", },
|
||||
#ifndef SCP_UNIX
|
||||
{ "-disable_di_mouse", "Don't use DirectInput for mouse control", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-disable_di_mouse", "Don't use DirectInput for mouse control", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_di_mouse", },
|
||||
#endif
|
||||
{ "-use_gldrawelements","Don't use glDrawRangeElements", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-old_collision", "Use old collision detection system", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-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", },
|
||||
|
||||
{ "-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", },
|
||||
{ "-fb_explosions", "Enable Framebuffer Shockwaves", true, 0, EASY_DEFAULT, "Experimental", "", },
|
||||
{ "-brief_lighting", "Enable lighting on briefing models", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-brief_lighting", },
|
||||
|
||||
{ "-fps", "Show frames per second on HUD", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fps", },
|
||||
{ "-pos", "Show position of camera", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pos", },
|
||||
@@ -187,9 +210,9 @@ Flag exe_params[] =
|
||||
{ "-stats", "Show statistics", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stats", },
|
||||
{ "-coords", "Show coordinates", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-coords", },
|
||||
{ "-show_mem_usage", "Show memory usage", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-show_mem_usage", },
|
||||
{ "-pofspew", "", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pofspew", },
|
||||
{ "-tablecrcs", "", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-tablecrcs", },
|
||||
{ "-missioncrcs", "", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missioncrcs", },
|
||||
{ "-pofspew", "Generate all ibx files immediately", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pofspew", },
|
||||
{ "-tablecrcs", "Dump table CRCs for multi validation", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-tablecrcs", },
|
||||
{ "-missioncrcs", "Dump mission CRCs for multi validation", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missioncrcs", },
|
||||
{ "-dis_collisions", "Disable collisions", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dis_collisions", },
|
||||
{ "-dis_weapons", "Disable weapon rendering", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dis_weapons", },
|
||||
{ "-output_sexps", "Output SEXPs to sexps.html", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-output_sexps", },
|
||||
@@ -200,30 +223,36 @@ Flag exe_params[] =
|
||||
#ifdef SCP_UNIX
|
||||
{ "-nograb", "Don't grab mouse/keyboard in a window", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nograb", },
|
||||
#endif
|
||||
{ "-reparse_mainhall", "Reparse mainhall.tbl when loading halls", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-reparse_mainhall", },
|
||||
{ "-reparse_mainhall", "Reparse mainhall.tbl when loading halls", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-reparse_mainhall", },
|
||||
{ "-profile_frame_time", "Profile engine subsystems", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_frame_timings", },
|
||||
{ "-profile_write_file", "Write profiling information to file", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_write_file", },
|
||||
{ "-no_unfocused_pause","Don't pause if the window isn't focused", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_unfocused_pause", },
|
||||
};
|
||||
|
||||
// forward declaration
|
||||
const char * get_param_desc(const char *flag_name);
|
||||
|
||||
// here are the command line parameters that we will be using for FreeSpace
|
||||
|
||||
// RETAIL options ----------------------------------------------
|
||||
cmdline_parm connect_arg("-connect", NULL); // Cmdline_connect_addr
|
||||
cmdline_parm gamename_arg("-gamename", NULL); // Cmdline_game_name
|
||||
cmdline_parm gamepassword_arg("-password", NULL); // Cmdline_game_password
|
||||
cmdline_parm allowabove_arg("-allowabove", NULL); // Cmdline_rank_above
|
||||
cmdline_parm allowbelow_arg("-allowbelow", NULL); // Cmdline_rank_below
|
||||
cmdline_parm standalone_arg("-standalone", NULL);
|
||||
cmdline_parm nosound_arg("-nosound", NULL); // Cmdline_freespace_no_sound
|
||||
cmdline_parm nomusic_arg("-nomusic", NULL); // Cmdline_freespace_no_music
|
||||
cmdline_parm startgame_arg("-startgame", NULL); // Cmdline_start_netgame
|
||||
cmdline_parm gameclosed_arg("-closed", NULL); // Cmdline_closed_game
|
||||
cmdline_parm gamerestricted_arg("-restricted", NULL); // Cmdline_restricted_game
|
||||
cmdline_parm port_arg("-port", NULL);
|
||||
cmdline_parm multilog_arg("-multilog", NULL); // Cmdline_multi_log
|
||||
cmdline_parm client_dodamage("-clientdamage", NULL); // Cmdline_client_dodamage
|
||||
cmdline_parm pof_spew("-pofspew", NULL); // Cmdline_spew_pof_info
|
||||
cmdline_parm mouse_coords("-coords", NULL); // Cmdline_mouse_coords
|
||||
cmdline_parm timeout("-timeout", NULL); // Cmdline_timeout
|
||||
cmdline_parm bit32_arg("-32bit", NULL); // (only here for retail compatibility reasons, doesn't actually do anything)
|
||||
cmdline_parm connect_arg("-connect", "Automatically connect to multiplayer IP:PORT", AT_STRING); // Cmdline_connect_addr
|
||||
cmdline_parm gamename_arg("-gamename", "Set multiplayer game name", AT_STRING); // Cmdline_game_name
|
||||
cmdline_parm gamepassword_arg("-password", "Set multiplayer game password", AT_STRING); // Cmdline_game_password
|
||||
cmdline_parm allowabove_arg("-allowabove", "Ranks above this can join multi", AT_STRING); // Cmdline_rank_above
|
||||
cmdline_parm allowbelow_arg("-allowbelow", "Ranks below this can join multi", AT_STRING); // Cmdline_rank_below
|
||||
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 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
|
||||
cmdline_parm port_arg("-port", "Multiplayer network port", AT_INT);
|
||||
cmdline_parm multilog_arg("-multilog", NULL, AT_NONE); // Cmdline_multi_log
|
||||
cmdline_parm client_dodamage("-clientdamage", NULL, AT_NONE); // Cmdline_client_dodamage
|
||||
cmdline_parm pof_spew("-pofspew", NULL, AT_NONE); // Cmdline_spew_pof_info
|
||||
cmdline_parm mouse_coords("-coords", NULL, AT_NONE); // Cmdline_mouse_coords
|
||||
cmdline_parm timeout("-timeout", "Multiplayer network timeout (secs)", AT_INT); // Cmdline_timeout
|
||||
cmdline_parm bit32_arg("-32bit", "Deprecated", AT_NONE); // (only here for retail compatibility reasons, doesn't actually do anything)
|
||||
|
||||
char *Cmdline_connect_addr = NULL;
|
||||
char *Cmdline_game_name = NULL;
|
||||
@@ -250,31 +279,32 @@ int Cmdline_use_last_pilot = 0;
|
||||
// FSO options -------------------------------------------------
|
||||
|
||||
// Graphics related
|
||||
cmdline_parm spec_exp_arg("-spec_exp", NULL); // comand line FOV -Bobboau
|
||||
cmdline_parm clip_dist_arg("-clipdist", NULL); // Cmdline_clip_dist
|
||||
cmdline_parm fov_arg("-fov", NULL); // Cmdline_fov -- comand line FOV -Bobboau
|
||||
cmdline_parm ogl_spec_arg("-ogl_spec", NULL); // Cmdline_ogl_spec
|
||||
cmdline_parm spec_static_arg("-spec_static", NULL);
|
||||
cmdline_parm spec_point_arg("-spec_point", NULL);
|
||||
cmdline_parm spec_tube_arg("-spec_tube", NULL);
|
||||
cmdline_parm ambient_factor_arg("-ambient_factor", NULL); // Cmdline_ambient_factor
|
||||
cmdline_parm env("-noenv", NULL); // Cmdline_env
|
||||
cmdline_parm missile_lighting_arg("-missile_lighting", NULL); // Cmdline_missile_lighting
|
||||
cmdline_parm glow_arg("-noglow", NULL); // Cmdline_glow -- use Bobs glow code
|
||||
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
|
||||
cmdline_parm noscalevid_arg("-noscalevid", NULL); // Cmdline_noscalevid -- disable video scaling that fits to window
|
||||
cmdline_parm spec_arg("-nospec", NULL); // Cmdline_spec --
|
||||
cmdline_parm noemissive_arg("-no_emissive_light", NULL); // Cmdline_no_emissive -- don't use emissive light in OGL
|
||||
cmdline_parm normal_arg("-nonormal", NULL); // Cmdline_normal -- disable normal mapping
|
||||
cmdline_parm height_arg("-noheight", NULL); // Cmdline_height -- enable support for parallax mapping
|
||||
cmdline_parm enable_3d_shockwave_arg("-3dshockwave", NULL);
|
||||
cmdline_parm softparticles_arg("-soft_particles", NULL);
|
||||
cmdline_parm postprocess_arg("-post_process", NULL);
|
||||
cmdline_parm bloom_intensity_arg("-bloom_intensity", NULL);
|
||||
cmdline_parm fxaa_arg("-fxaa", NULL);
|
||||
cmdline_parm fxaa_preset_arg("-fxaa_preset", NULL);
|
||||
cmdline_parm fb_explosions_arg("-fb_explosions", NULL);
|
||||
cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL);
|
||||
cmdline_parm fov_arg("-fov", "Vertical field-of-view factor", AT_FLOAT); // Cmdline_fov -- comand line FOV -Bobboau
|
||||
cmdline_parm clip_dist_arg("-clipdist", "Changes the distance from the viewpoint for the near-clipping plane", AT_FLOAT); // Cmdline_clip_dist
|
||||
cmdline_parm spec_exp_arg("-spec_exp", "Adjusts the size of shiny spots on ships", AT_FLOAT);
|
||||
cmdline_parm ogl_spec_arg("-ogl_spec", "Shininess of specular light", AT_FLOAT); // Cmdline_ogl_spec
|
||||
cmdline_parm spec_static_arg("-spec_static", "Adjusts suns contribution to specular highlights", AT_FLOAT);
|
||||
cmdline_parm spec_point_arg("-spec_point", "Adjusts laser weapons contribution to specular highlights", AT_FLOAT);
|
||||
cmdline_parm spec_tube_arg("-spec_tube", "Adjusts beam weapons contribution to specular highlights", AT_FLOAT);
|
||||
cmdline_parm ambient_factor_arg("-ambient_factor", "Adjusts ambient light applied to all parts of a ship", AT_INT); // Cmdline_ambient_factor
|
||||
cmdline_parm missile_lighting_arg("-missile_lighting", NULL, AT_NONE); // Cmdline_missile_lighting
|
||||
cmdline_parm env("-noenv", NULL, AT_NONE); // Cmdline_env
|
||||
cmdline_parm glow_arg("-noglow", NULL, AT_NONE); // Cmdline_glow -- use Bobs glow code
|
||||
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL, AT_NONE); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
|
||||
cmdline_parm noscalevid_arg("-noscalevid", NULL, AT_NONE); // Cmdline_noscalevid -- disable video scaling that fits to window
|
||||
cmdline_parm spec_arg("-nospec", NULL, AT_NONE); // Cmdline_spec --
|
||||
cmdline_parm noemissive_arg("-no_emissive_light", "Disable emissive light from ships", AT_NONE); // Cmdline_no_emissive -- don't use emissive light in OGL
|
||||
cmdline_parm normal_arg("-nonormal", NULL, AT_NONE); // Cmdline_normal -- disable normal mapping
|
||||
cmdline_parm height_arg("-noheight", NULL, AT_NONE); // Cmdline_height -- enable support for parallax mapping
|
||||
cmdline_parm enable_3d_shockwave_arg("-3dshockwave", NULL, AT_NONE);
|
||||
cmdline_parm softparticles_arg("-soft_particles", NULL, AT_NONE);
|
||||
cmdline_parm postprocess_arg("-post_process", NULL, AT_NONE);
|
||||
cmdline_parm bloom_intensity_arg("-bloom_intensity", "Set bloom intensity, requires -post_process", AT_INT);
|
||||
cmdline_parm fxaa_arg("-fxaa", NULL, AT_NONE);
|
||||
cmdline_parm fxaa_preset_arg("-fxaa_preset", "FXAA quality (0-9), requires -post_process and -fxaa", AT_INT);
|
||||
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);
|
||||
|
||||
float Cmdline_clip_dist = Default_min_draw_distance;
|
||||
float Cmdline_fov = 0.75f;
|
||||
@@ -299,12 +329,13 @@ int Cmdline_fxaa_preset = 6;
|
||||
extern int Fxaa_preset_last_frame;
|
||||
bool Cmdline_fb_explosions = 0;
|
||||
extern bool ls_force_off;
|
||||
bool Cmdline_brief_lighting = 0;
|
||||
|
||||
// Game Speed related
|
||||
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL); // Cmdline_cache_bitmaps
|
||||
cmdline_parm img2dds_arg("-img2dds", NULL); // Cmdline_img2dds
|
||||
cmdline_parm no_fpscap("-no_fps_capping", NULL); // Cmdline_NoFPSCap
|
||||
cmdline_parm no_vsync_arg("-no_vsync", NULL); // Cmdline_no_vsync
|
||||
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL, AT_NONE); // Cmdline_cache_bitmaps
|
||||
cmdline_parm img2dds_arg("-img2dds", NULL, AT_NONE); // Cmdline_img2dds
|
||||
cmdline_parm no_fpscap("-no_fps_capping", "Don't limit frames-per-second", AT_NONE); // Cmdline_NoFPSCap
|
||||
cmdline_parm no_vsync_arg("-no_vsync", NULL, AT_NONE); // Cmdline_no_vsync
|
||||
|
||||
int Cmdline_cache_bitmaps = 0; // caching of bitmaps between missions (faster loads, can hit swap on reload with <512 Meg RAM though) - taylor
|
||||
int Cmdline_img2dds = 0;
|
||||
@@ -312,11 +343,11 @@ int Cmdline_NoFPSCap = 0; // Disable FPS capping - kazan
|
||||
int Cmdline_no_vsync = 0;
|
||||
|
||||
// HUD related
|
||||
cmdline_parm ballistic_gauge("-ballistic_gauge", NULL); // Cmdline_ballistic_gauge
|
||||
cmdline_parm dualscanlines_arg("-dualscanlines", NULL); // Cmdline_dualscanlines -- Change to phreaks options including new targeting code
|
||||
cmdline_parm orb_radar("-orbradar", NULL); // Cmdline_orb_radar
|
||||
cmdline_parm rearm_timer_arg("-rearm_timer", NULL); // Cmdline_rearm_timer
|
||||
cmdline_parm targetinfo_arg("-targetinfo", NULL); // Cmdline_targetinfo -- Adds ship name/class to right of target box -C
|
||||
cmdline_parm ballistic_gauge("-ballistic_gauge", NULL, AT_NONE); // Cmdline_ballistic_gauge
|
||||
cmdline_parm dualscanlines_arg("-dualscanlines", NULL, AT_NONE); // Cmdline_dualscanlines -- Change to phreaks options including new targeting code
|
||||
cmdline_parm orb_radar("-orbradar", NULL, AT_NONE); // Cmdline_orb_radar
|
||||
cmdline_parm rearm_timer_arg("-rearm_timer", NULL, AT_NONE); // Cmdline_rearm_timer
|
||||
cmdline_parm targetinfo_arg("-targetinfo", NULL, AT_NONE); // Cmdline_targetinfo -- Adds ship name/class to right of target box -C
|
||||
|
||||
int Cmdline_ballistic_gauge = 0; // WMCoolmon's gauge thingy
|
||||
int Cmdline_dualscanlines = 0;
|
||||
@@ -325,39 +356,41 @@ int Cmdline_rearm_timer = 0;
|
||||
int Cmdline_targetinfo = 0;
|
||||
|
||||
// Gameplay related
|
||||
cmdline_parm use_3dwarp("-3dwarp", NULL); // Cmdline_3dwarp
|
||||
cmdline_parm ship_choice_3d_arg("-ship_choice_3d", NULL); // Cmdline_ship_choice_3d
|
||||
cmdline_parm weapon_choice_3d_arg("-weapon_choice_3d", NULL); // Cmdline_weapon_choice_3d
|
||||
cmdline_parm use_warp_flash("-warp_flash", NULL); // Cmdline_warp_flash
|
||||
cmdline_parm allow_autpilot_interrupt("-no_ap_interrupt", NULL); // Cmdline_warp_flash
|
||||
cmdline_parm use_3dwarp("-3dwarp", NULL, AT_NONE); // Cmdline_3dwarp
|
||||
cmdline_parm ship_choice_3d_arg("-ship_choice_3d", NULL, AT_NONE); // Cmdline_ship_choice_3d
|
||||
cmdline_parm weapon_choice_3d_arg("-weapon_choice_3d", NULL, AT_NONE); // Cmdline_weapon_choice_3d
|
||||
cmdline_parm use_warp_flash("-warp_flash", NULL, AT_NONE); // Cmdline_warp_flash
|
||||
cmdline_parm allow_autpilot_interrupt("-no_ap_interrupt", NULL, AT_NONE);
|
||||
cmdline_parm stretch_menu("-stretch_menu", NULL, AT_NONE); // Cmdline_stretch_menu
|
||||
|
||||
int Cmdline_3dwarp = 0;
|
||||
int Cmdline_ship_choice_3d = 0;
|
||||
int Cmdline_weapon_choice_3d = 0;
|
||||
int Cmdline_warp_flash = 0;
|
||||
int Cmdline_autopilot_interruptable = 1;
|
||||
int Cmdline_stretch_menu = 0;
|
||||
|
||||
// Audio related
|
||||
cmdline_parm query_speech_arg("-query_speech", NULL); // Cmdline_query_speech
|
||||
cmdline_parm snd_preload_arg("-snd_preload", NULL); // Cmdline_snd_preload
|
||||
cmdline_parm voice_recognition_arg("-voicer", NULL); // Cmdline_voice_recognition
|
||||
cmdline_parm query_speech_arg("-query_speech", NULL, AT_NONE); // Cmdline_query_speech
|
||||
cmdline_parm snd_preload_arg("-snd_preload", NULL, AT_NONE); // Cmdline_snd_preload
|
||||
cmdline_parm voice_recognition_arg("-voicer", NULL, AT_NONE); // Cmdline_voice_recognition
|
||||
|
||||
int Cmdline_query_speech = 0;
|
||||
int Cmdline_snd_preload = 0; // preload game sounds during mission load
|
||||
int Cmdline_voice_recognition = 0;
|
||||
|
||||
// MOD related
|
||||
cmdline_parm mod_arg("-mod", NULL, true); // Cmdline_mod -- DTP modsupport
|
||||
cmdline_parm mod_arg("-mod", "List of folders to overwrite/add-to the default data", AT_STRING, true); // Cmdline_mod -- DTP modsupport
|
||||
|
||||
char *Cmdline_mod = NULL; //DTP for mod arguement
|
||||
char *Cmdline_mod = NULL; //DTP for mod argument
|
||||
|
||||
// Multiplayer/Network related
|
||||
cmdline_parm almission_arg("-almission", NULL); // Cmdline_almission -- DTP for autoload Multi mission
|
||||
cmdline_parm ingamejoin_arg("-ingame_join", NULL); // Cmdline_ingamejoin
|
||||
cmdline_parm mpnoreturn_arg("-mpnoreturn", NULL); // Cmdline_mpnoreturn -- Removes 'Return to Flight Deck' in respawn dialog -C
|
||||
cmdline_parm missioncrcspew_arg("-missioncrcs", NULL); // Cmdline_spew_mission_crcs
|
||||
cmdline_parm tablecrcspew_arg("-tablecrcs", NULL); // Cmdline_spew_table_crcs
|
||||
cmdline_parm objupd_arg("-cap_object_update", NULL);
|
||||
cmdline_parm almission_arg("-almission", "Autoload multiplayer mission", AT_STRING); // Cmdline_almission -- DTP for autoload Multi mission
|
||||
cmdline_parm ingamejoin_arg("-ingame_join", NULL, AT_NONE); // Cmdline_ingamejoin
|
||||
cmdline_parm mpnoreturn_arg("-mpnoreturn", NULL, AT_NONE); // Cmdline_mpnoreturn -- Removes 'Return to Flight Deck' in respawn dialog -C
|
||||
cmdline_parm missioncrcspew_arg("-missioncrcs", NULL, AT_STRING); // Cmdline_spew_mission_crcs
|
||||
cmdline_parm tablecrcspew_arg("-tablecrcs", NULL, AT_STRING); // Cmdline_spew_table_crcs
|
||||
cmdline_parm objupd_arg("-cap_object_update", "Multiplayer object update cap (0-3)", AT_INT);
|
||||
|
||||
char *Cmdline_almission = NULL; //DTP for autoload multi mission.
|
||||
int Cmdline_ingamejoin = 0;
|
||||
@@ -367,21 +400,24 @@ char *Cmdline_spew_table_crcs = NULL;
|
||||
int Cmdline_objupd = 3; // client object updates on LAN by default
|
||||
|
||||
// Troubleshooting
|
||||
cmdline_parm loadallweapons_arg("-loadallweps", NULL); // Cmdline_load_all_weapons
|
||||
cmdline_parm htl_arg("-nohtl", NULL); // Cmdline_nohtl -- don't use HT&L
|
||||
cmdline_parm noibx_arg("-noibx", NULL); // Cmdline_noibx
|
||||
cmdline_parm nomovies_arg("-nomovies", NULL); // Cmdline_nomovies -- Allows video streaming
|
||||
cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL); // Cmdline_no_set_gamma
|
||||
cmdline_parm no_vbo_arg("-novbo", NULL); // Cmdline_novbo
|
||||
cmdline_parm no_fbo_arg("-disable_fbo", NULL); // Cmdline_no_fbo
|
||||
cmdline_parm noglsl_arg("-no_glsl", NULL); // Cmdline_noglsl -- disable GLSL support in OpenGL
|
||||
cmdline_parm mipmap_arg("-mipmap", NULL); // Cmdline_mipmap
|
||||
cmdline_parm atiswap_arg("-ati_swap", NULL); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
|
||||
cmdline_parm no3dsound_arg("-no_3d_sound", NULL); // Cmdline_no_3d_sound - Disable use of full 3D sounds
|
||||
cmdline_parm no_glsl_models_arg("-disable_glsl_model", NULL); // Cmdline_no_glsl_model_rendering -- switches model rendering to fixed pipeline
|
||||
cmdline_parm no_di_mouse_arg("-disable_di_mouse", NULL); // Cmdline_no_di_mouse -- Disables directinput use for mouse control
|
||||
cmdline_parm no_drawrangeelements("-use_gldrawelements", NULL); // Cmdline_drawelements -- Uses glDrawElements instead of glDrawRangeElements
|
||||
cmdline_parm keyboard_layout("-keyboard_layout", NULL);
|
||||
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
|
||||
cmdline_parm no_fbo_arg("-disable_fbo", NULL, AT_NONE); // Cmdline_no_fbo
|
||||
cmdline_parm no_pbo_arg("-disable_pbo", NULL, AT_NONE); // Cmdline_no_pbo
|
||||
cmdline_parm noglsl_arg("-no_glsl", NULL, AT_NONE); // Cmdline_noglsl -- disable GLSL support in OpenGL
|
||||
cmdline_parm mipmap_arg("-mipmap", NULL, AT_NONE); // Cmdline_mipmap
|
||||
cmdline_parm atiswap_arg("-ati_swap", NULL, AT_NONE); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
|
||||
cmdline_parm no3dsound_arg("-no_3d_sound", NULL, AT_NONE); // Cmdline_no_3d_sound - Disable use of full 3D sounds
|
||||
cmdline_parm no_glsl_models_arg("-disable_glsl_model", NULL, AT_NONE); // Cmdline_no_glsl_model_rendering -- switches model rendering to fixed pipeline
|
||||
cmdline_parm no_di_mouse_arg("-disable_di_mouse", "Disable DirectInput mouse code (Windows only)", AT_NONE); // Cmdline_no_di_mouse -- Disables directinput use for mouse control
|
||||
cmdline_parm no_drawrangeelements("-use_gldrawelements", NULL, AT_NONE); // Cmdline_drawelements -- Uses glDrawElements instead of glDrawRangeElements
|
||||
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);
|
||||
|
||||
int Cmdline_load_all_weapons = 0;
|
||||
int Cmdline_nohtl = 0;
|
||||
@@ -390,6 +426,7 @@ int Cmdline_nomovies = 0;
|
||||
int Cmdline_no_set_gamma = 0;
|
||||
int Cmdline_novbo = 0; // turn off OGL VBO support, troubleshooting
|
||||
int Cmdline_no_fbo = 0;
|
||||
int Cmdline_no_pbo = 0;
|
||||
int Cmdline_noglsl = 0;
|
||||
int Cmdline_ati_color_swap = 0;
|
||||
int Cmdline_no_3d_sound = 0;
|
||||
@@ -397,32 +434,35 @@ int Cmdline_no_glsl_model_rendering = 0;
|
||||
int Cmdline_no_di_mouse = 0;
|
||||
int Cmdline_drawelements = 0;
|
||||
char* Cmdline_keyboard_layout = NULL;
|
||||
bool Cmdline_gl_finish = false;
|
||||
|
||||
// Developer/Testing related
|
||||
cmdline_parm start_mission_arg("-start_mission", NULL); // Cmdline_start_mission
|
||||
cmdline_parm old_collision_system("-old_collision", NULL); // Cmdline_new_collision
|
||||
cmdline_parm dis_collisions("-dis_collisions", NULL); // Cmdline_dis_collisions
|
||||
cmdline_parm dis_weapons("-dis_weapons", NULL); // Cmdline_dis_weapons
|
||||
cmdline_parm noparseerrors_arg("-noparseerrors", NULL); // Cmdline_noparseerrors -- turns off parsing errors -C
|
||||
cmdline_parm start_mission_arg("-start_mission", "Skip mainhall and run this mission", AT_STRING); // Cmdline_start_mission
|
||||
cmdline_parm dis_collisions("-dis_collisions", NULL, AT_NONE); // Cmdline_dis_collisions
|
||||
cmdline_parm dis_weapons("-dis_weapons", NULL, AT_NONE); // Cmdline_dis_weapons
|
||||
cmdline_parm noparseerrors_arg("-noparseerrors", NULL, AT_NONE); // Cmdline_noparseerrors -- turns off parsing errors -C
|
||||
#ifdef Allow_NoWarn
|
||||
cmdline_parm nowarn_arg("-no_warn", NULL); // Cmdline_nowarn
|
||||
cmdline_parm nowarn_arg("-no_warn", "Disable warnings (not recommended)", AT_NONE); // Cmdline_nowarn
|
||||
#endif
|
||||
cmdline_parm extra_warn_arg("-extra_warn", NULL); // Cmdline_extra_warn
|
||||
cmdline_parm fps_arg("-fps", NULL); // Cmdline_show_fps
|
||||
cmdline_parm show_mem_usage_arg("-show_mem_usage", NULL); // Cmdline_show_mem_usage
|
||||
cmdline_parm pos_arg("-pos", NULL); // Cmdline_show_pos
|
||||
cmdline_parm stats_arg("-stats", NULL); // Cmdline_show_stats
|
||||
cmdline_parm save_render_targets_arg("-save_render_target", NULL); // Cmdline_save_render_targets
|
||||
cmdline_parm debug_window_arg("-debug_window", NULL); // Cmdline_debug_window
|
||||
cmdline_parm window_arg("-window", NULL); // Cmdline_window
|
||||
cmdline_parm fullscreen_window_arg("-fullscreen_window",NULL);
|
||||
cmdline_parm res_arg("-res", NULL); // Cmdline_lores
|
||||
cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps -- spew VP crcs to vp_crcs.txt
|
||||
cmdline_parm parse_cmdline_only(PARSE_COMMAND_LINE_STRING, NULL);
|
||||
cmdline_parm extra_warn_arg("-extra_warn", "Enable 'extra' warnings", AT_NONE); // Cmdline_extra_warn
|
||||
cmdline_parm fps_arg("-fps", NULL, AT_NONE); // Cmdline_show_fps
|
||||
cmdline_parm show_mem_usage_arg("-show_mem_usage", NULL, AT_NONE); // Cmdline_show_mem_usage
|
||||
cmdline_parm pos_arg("-pos", NULL, AT_NONE); // Cmdline_show_pos
|
||||
cmdline_parm stats_arg("-stats", NULL, AT_NONE); // Cmdline_show_stats
|
||||
cmdline_parm save_render_targets_arg("-save_render_target", NULL, AT_NONE); // Cmdline_save_render_targets
|
||||
cmdline_parm debug_window_arg("-debug_window", NULL, AT_NONE); // Cmdline_debug_window
|
||||
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 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
|
||||
cmdline_parm no_grab("-nograb", NULL); // Cmdline_no_grab
|
||||
cmdline_parm no_grab("-nograb", NULL, AT_NONE); // Cmdline_no_grab
|
||||
#endif
|
||||
cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL); //Cmdline_reparse_mainhall
|
||||
cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL, AT_NONE); //Cmdline_reparse_mainhall
|
||||
cmdline_parm frame_profile_arg("-profile_frame_time", NULL, AT_NONE); //Cmdline_frame_profile
|
||||
cmdline_parm frame_profile_write_file("-profile_write_file", NULL, AT_NONE); // Cmdline_profile_write_file
|
||||
cmdline_parm no_unfocused_pause_arg("-no_unfocused_pause", NULL, AT_NONE); //Cmdline_no_unfocus_pause
|
||||
|
||||
char *Cmdline_start_mission = NULL;
|
||||
int Cmdline_old_collision_sys = 0;
|
||||
@@ -446,19 +486,22 @@ int Cmdline_verify_vps = 0;
|
||||
int Cmdline_no_grab = 0;
|
||||
#endif
|
||||
int Cmdline_reparse_mainhall = 0;
|
||||
bool Cmdline_frame_profile = false;
|
||||
bool Cmdline_profile_write_file = false;
|
||||
bool Cmdline_no_unfocus_pause = false;
|
||||
|
||||
// Other
|
||||
cmdline_parm get_flags_arg("-get_flags", NULL);
|
||||
cmdline_parm output_sexp_arg("-output_sexps", NULL); //WMC - outputs all SEXPs to sexps.html
|
||||
cmdline_parm output_scripting_arg("-output_scripting", NULL); //WMC
|
||||
cmdline_parm get_flags_arg("-get_flags", "Output the launcher flags file", AT_NONE);
|
||||
cmdline_parm output_sexp_arg("-output_sexps", NULL, AT_NONE); //WMC - outputs all SEXPs to sexps.html
|
||||
cmdline_parm output_scripting_arg("-output_scripting", NULL, AT_NONE); //WMC
|
||||
|
||||
// Deprecated flags - CommanderDJ
|
||||
cmdline_parm deprecated_spec_arg("-spec", NULL);
|
||||
cmdline_parm deprecated_glow_arg("-glow", NULL);
|
||||
cmdline_parm deprecated_normal_arg("-normal", NULL);
|
||||
cmdline_parm deprecated_env_arg("-env", NULL);
|
||||
cmdline_parm deprecated_tbp_arg("-tbp", NULL);
|
||||
cmdline_parm deprecated_jpgtga_arg("-jpgtga", NULL);
|
||||
cmdline_parm deprecated_spec_arg("-spec", "Deprecated", AT_NONE);
|
||||
cmdline_parm deprecated_glow_arg("-glow", "Deprecated", AT_NONE);
|
||||
cmdline_parm deprecated_normal_arg("-normal", "Deprecated", AT_NONE);
|
||||
cmdline_parm deprecated_env_arg("-env", "Deprecated", AT_NONE);
|
||||
cmdline_parm deprecated_tbp_arg("-tbp", "Deprecated", AT_NONE);
|
||||
cmdline_parm deprecated_jpgtga_arg("-jpgtga", "Deprecated", AT_NONE);
|
||||
|
||||
int Cmdline_deprecated_spec = 0;
|
||||
int Cmdline_deprecated_glow = 0;
|
||||
@@ -622,7 +665,7 @@ void parm_stuff_args(cmdline_parm *parm, char *cmdline)
|
||||
}
|
||||
|
||||
|
||||
// internal function - parse the command line, extracting parameter arguements if they exist
|
||||
// internal function - parse the command line, extracting parameter arguments if they exist
|
||||
// cmdline - command line string passed to the application
|
||||
void os_parse_parms(char *cmdline)
|
||||
{
|
||||
@@ -692,7 +735,7 @@ void os_validate_parms(char *cmdline)
|
||||
#ifdef _WIN32
|
||||
// Changed this to MessageBox, this is a user error not a developer
|
||||
char buffer[128];
|
||||
sprintf(buffer,"Unrecogzined command line parameter %s, continue?",token);
|
||||
sprintf(buffer,"Unrecognized command line parameter %s, continue?",token);
|
||||
if( MessageBox(NULL, buffer, "Warning", MB_OKCANCEL | MB_ICONQUESTION) == IDCANCEL)
|
||||
exit(0);
|
||||
#elif defined(APPLE_APP)
|
||||
@@ -728,11 +771,19 @@ void os_validate_parms(char *cmdline)
|
||||
|
||||
// not the prettiest thing but the job gets done
|
||||
static const int STR_SIZE = 25; // max len of exe_params.name + 5 spaces
|
||||
int p=0, sp=0;
|
||||
while (exe_params[p].name[0] == '-') {
|
||||
sp = strlen(exe_params[p].name);
|
||||
printf(" [ %s ]%*s- %s\n", exe_params[p].name, (STR_SIZE - sp - 1), NOX(" "), exe_params[p].desc);
|
||||
p++;
|
||||
const int AT_SIZE = 8; // max len of cmdline_arg_types[] + 2 spaces
|
||||
int sp=0, atp=0;
|
||||
for (parmp = GET_FIRST(&Parm_list); parmp !=END_OF_LIST(&Parm_list); parmp = GET_NEXT(parmp) ) {
|
||||
// don't output deprecated flags
|
||||
if (stricmp("deprecated", parmp->help)) {
|
||||
sp = strlen(parmp->name);
|
||||
if (parmp->arg_type != AT_NONE) {
|
||||
atp = strlen(cmdline_arg_types[parmp->arg_type]);
|
||||
printf(" [ %s ]%*s[ %s ]%*s- %s\n", parmp->name, (STR_SIZE - sp -1), NOX(" "), cmdline_arg_types[parmp->arg_type], AT_SIZE-atp, NOX(" "), parmp->help);
|
||||
} else {
|
||||
printf(" [ %s ]%*s- %s\n", parmp->name, (STR_SIZE - sp -1 +AT_SIZE+4), NOX(" "), parmp->help);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
@@ -755,113 +806,119 @@ void os_validate_parms(char *cmdline)
|
||||
void os_init_cmdline(char *cmdline)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
bool parse_config = true;
|
||||
|
||||
if (strstr(cmdline, PARSE_COMMAND_LINE_STRING) != NULL) {
|
||||
parse_config = false;
|
||||
}
|
||||
if (strstr(cmdline, PARSE_COMMAND_LINE_STRING) == NULL) {
|
||||
|
||||
// read the cmdline.cfg file from the data folder, and pass the command line arguments to
|
||||
// the the parse_parms and validate_parms line. Read these first so anything actually on
|
||||
// the command line will take precedence
|
||||
// read the cmdline_fso.cfg file from the data folder, and pass the command line arguments to
|
||||
// the the parse_parms and validate_parms line. Read these first so anything actually on
|
||||
// the command line will take precedence
|
||||
#ifdef _WIN32
|
||||
fp = fopen("data\\cmdline_fso.cfg", "rt");
|
||||
fp = fopen("data\\cmdline_fso.cfg", "rt");
|
||||
#elif defined(APPLE_APP)
|
||||
char resolved_path[MAX_PATH], data_path[MAX_PATH_LEN];
|
||||
char resolved_path[MAX_PATH], data_path[MAX_PATH_LEN];
|
||||
|
||||
GetCurrentDirectory(MAX_PATH_LEN-1, data_path);
|
||||
snprintf(resolved_path, MAX_PATH, "%s/data/cmdline_fso.cfg", data_path);
|
||||
GetCurrentDirectory(MAX_PATH_LEN-1, data_path);
|
||||
snprintf(resolved_path, MAX_PATH, "%s/data/cmdline_fso.cfg", data_path);
|
||||
|
||||
fp = fopen(resolved_path, "rt");
|
||||
fp = fopen(resolved_path, "rt");
|
||||
#else
|
||||
fp = fopen("data/cmdline_fso.cfg", "rt");
|
||||
fp = fopen("data/cmdline_fso.cfg", "rt");
|
||||
#endif
|
||||
|
||||
// if the file exists, get a single line, and deal with it
|
||||
if ( fp && parse_config ) {
|
||||
char *buf, *p;
|
||||
// if the file exists, get a single line, and deal with it
|
||||
if ( fp ) {
|
||||
char *buf, *p;
|
||||
|
||||
size_t len = filelength( fileno(fp) ) + 2;
|
||||
buf = new char [len];
|
||||
size_t len = filelength( fileno(fp) ) + 2;
|
||||
buf = new char [len];
|
||||
|
||||
fgets(buf, len-1, fp);
|
||||
fgets(buf, len-1, fp);
|
||||
|
||||
// replace the newline character with a NULL
|
||||
if ( (p = strrchr(buf, '\n')) != NULL ) {
|
||||
*p = '\0';
|
||||
// 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, " ");
|
||||
#endif
|
||||
|
||||
os_parse_parms(buf);
|
||||
os_validate_parms(buf);
|
||||
delete [] buf;
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
// append a space for the os_parse_parms() check
|
||||
strcat_s(buf, len, " ");
|
||||
#endif
|
||||
// parse user specific cmdline_fso config file (will supersede options in global file)
|
||||
char cmdname[MAX_PATH];
|
||||
|
||||
os_parse_parms(buf);
|
||||
os_validate_parms(buf);
|
||||
delete [] buf;
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
// parse user specific cmdline config file (will supersede options in global file)
|
||||
char cmdname[MAX_PATH];
|
||||
|
||||
snprintf(cmdname, MAX_PATH, "%s/%s/data/cmdline_fso.cfg", detect_home(), Osreg_user_dir);
|
||||
fp = fopen(cmdname, "rt");
|
||||
|
||||
if ( !fp ) {
|
||||
// try for non "_fso", for older code versions
|
||||
snprintf(cmdname, MAX_PATH, "%s/%s/data/cmdline.cfg", detect_home(), Osreg_user_dir);
|
||||
snprintf(cmdname, MAX_PATH, "%s/%s/data/cmdline_fso.cfg", detect_home(), Osreg_user_dir);
|
||||
fp = fopen(cmdname, "rt");
|
||||
}
|
||||
|
||||
// if the file exists, get a single line, and deal with it
|
||||
if ( fp ) {
|
||||
char *buf, *p;
|
||||
|
||||
size_t len = filelength( fileno(fp) ) + 2;
|
||||
buf = new char [len];
|
||||
|
||||
fgets(buf, len-1, fp);
|
||||
|
||||
// replace the newline character with a NULL
|
||||
if ( (p = strrchr(buf, '\n')) != NULL ) {
|
||||
*p = '\0';
|
||||
if ( !fp ) {
|
||||
// try for non "_fso", for older code versions
|
||||
snprintf(cmdname, MAX_PATH, "%s/%s/data/cmdline.cfg", detect_home(), Osreg_user_dir);
|
||||
fp = fopen(cmdname, "rt");
|
||||
}
|
||||
|
||||
// append a space for the os_parse_parms() check
|
||||
strcat_s(buf, len, " ");
|
||||
// if the file exists, get a single line, and deal with it
|
||||
if ( fp ) {
|
||||
char *buf, *p;
|
||||
|
||||
os_parse_parms(buf);
|
||||
os_validate_parms(buf);
|
||||
delete [] buf;
|
||||
fclose(fp);
|
||||
}
|
||||
size_t len = filelength( fileno(fp) ) + 2;
|
||||
buf = new char [len];
|
||||
|
||||
fgets(buf, len-1, fp);
|
||||
|
||||
// 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);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // If cmdline included PARSE_COMMAND_LINE_STRING
|
||||
|
||||
// By parsing cmdline last, anything actually on the command line will take precedence.
|
||||
os_parse_parms(cmdline);
|
||||
os_validate_parms(cmdline);
|
||||
}
|
||||
|
||||
|
||||
// arg constructor
|
||||
// name_ - name of the parameter, must start with '-' character
|
||||
// help_ - help text for this parameter
|
||||
cmdline_parm::cmdline_parm(char *name_, char *help_, bool stacks_)
|
||||
/*
|
||||
* arg constructor
|
||||
*
|
||||
* @param name_ name of the parameter, must start with '-' character
|
||||
* @param help_ help text for this parameter
|
||||
* @param arg_type_ parameters arguement type (if any)
|
||||
* @param stacks_ can the parameter be stacked
|
||||
*/
|
||||
cmdline_parm::cmdline_parm(const char *name_, const char *help_, const int arg_type_, const bool stacks_):
|
||||
name(name_), help(help_), stacks(stacks_), arg_type(arg_type_)
|
||||
{
|
||||
name = name_;
|
||||
help = help_;
|
||||
stacks = stacks_;
|
||||
args = NULL;
|
||||
name_found = 0;
|
||||
|
||||
if (Parm_list_inited == 0) {
|
||||
list_init(&Parm_list);
|
||||
Assertion(&Parm_list == this, "Coding error! 1st initialised cmdline_parm must be static Parm_list\n");
|
||||
list_init(this);
|
||||
Parm_list_inited = 1;
|
||||
}
|
||||
|
||||
if (name != NULL) {
|
||||
} else {
|
||||
Assertion(name, "Coding error! cmdline_parm's must have a non-NULL name\n");
|
||||
Assertion(name[0] == '-', "Coding error! cmdline_parm's must start with a '-'\n");
|
||||
// not in the static Parm_list init, so lookup the NULL help args
|
||||
if (help == NULL) {
|
||||
help = get_param_desc(name);
|
||||
}
|
||||
list_append(&Parm_list, this);
|
||||
}
|
||||
}
|
||||
@@ -900,9 +957,10 @@ int cmdline_parm::found()
|
||||
return name_found;
|
||||
}
|
||||
|
||||
// returns - the interger representation for the parameter arguement
|
||||
// returns - the interger representation for the parameter argument
|
||||
int cmdline_parm::get_int()
|
||||
{
|
||||
Assertion(arg_type == AT_INT, "Coding error! Cmdline arg (%s) called cmdline_parm::get_int() with invalid arg_type (%s)", name, cmdline_arg_types[arg_type]);
|
||||
check_if_args_is_valid();
|
||||
|
||||
int offset = 0;
|
||||
@@ -911,7 +969,7 @@ int cmdline_parm::get_int()
|
||||
// first off, DON'T STACK NON-STRINGS!!
|
||||
Int3();
|
||||
|
||||
// secondly, we still need to get it right for the users sake...
|
||||
// secondly, we still need to get it right for the user's sake...
|
||||
char *moron = strstr(args, ",");
|
||||
|
||||
if ( moron && ((strlen(moron) + 1) < strlen(args)) ) {
|
||||
@@ -924,9 +982,10 @@ int cmdline_parm::get_int()
|
||||
}
|
||||
|
||||
|
||||
// returns - the float representation for the parameter arguement
|
||||
// returns - the float representation for the parameter argument
|
||||
float cmdline_parm::get_float()
|
||||
{
|
||||
Assertion(arg_type == AT_FLOAT, "Coding error! Cmdline arg (%s) called cmdline_parm::get_float() with invalid arg_type (%s)", name, cmdline_arg_types[arg_type]);
|
||||
check_if_args_is_valid();
|
||||
|
||||
int offset = 0;
|
||||
@@ -935,7 +994,7 @@ float cmdline_parm::get_float()
|
||||
// first off, DON'T STACK NON-STRINGS!!
|
||||
Int3();
|
||||
|
||||
// secondly, we still need to get it right for the users sake
|
||||
// secondly, we still need to get it right for the user's sake
|
||||
char *moron = strstr(args, ",");
|
||||
|
||||
if ( moron && ((strlen(moron) + 1) < strlen(args)) ) {
|
||||
@@ -948,9 +1007,10 @@ float cmdline_parm::get_float()
|
||||
}
|
||||
|
||||
|
||||
// returns - the string value for the parameter arguement
|
||||
// returns - the string value for the parameter argument
|
||||
char *cmdline_parm::str()
|
||||
{
|
||||
Assertion(arg_type == AT_STRING, "Coding error! Cmdline arg (%s) called cmdline_parm::str() with invalid arg_type (%s)", name, cmdline_arg_types[arg_type]);
|
||||
check_if_args_is_valid();
|
||||
|
||||
return args;
|
||||
@@ -1218,12 +1278,6 @@ bool SetCmdlineParams()
|
||||
if(mod_arg.found() ) {
|
||||
Cmdline_mod = mod_arg.str();
|
||||
|
||||
// be sure that this string fits in our limits
|
||||
/* This has to be disabled because the max size is going to be mods*MAX_FILENAME_LEN
|
||||
if ( strlen(Cmdline_mod) > MAX_FILENAME_LEN ) {
|
||||
Cmdline_mod[MAX_FILENAME_LEN-1] = '\0';
|
||||
}*/
|
||||
|
||||
// strip off blank space it it's there
|
||||
if ( Cmdline_mod[strlen(Cmdline_mod)-1] == ' ' ) {
|
||||
Cmdline_mod[strlen(Cmdline_mod)-1] = '\0';
|
||||
@@ -1235,7 +1289,49 @@ bool SetCmdlineParams()
|
||||
memset( modlist, 0, len + 2 );
|
||||
strcpy_s(modlist, len+2, Cmdline_mod);
|
||||
|
||||
//modlist[len]= '\0'; // double null termination at the end
|
||||
#ifdef SCP_UNIX
|
||||
// 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
|
||||
for (int i = 0; i < len; i++)
|
||||
@@ -1300,6 +1396,10 @@ bool SetCmdlineParams()
|
||||
if ( allow_autpilot_interrupt.found() ) {
|
||||
Cmdline_autopilot_interruptable = 0;
|
||||
}
|
||||
|
||||
if ( stretch_menu.found() ) {
|
||||
Cmdline_stretch_menu = 1;
|
||||
}
|
||||
// specular comand lines
|
||||
if ( spec_exp_arg.found() ) {
|
||||
specular_exponent_value = spec_exp_arg.get_float();
|
||||
@@ -1414,6 +1514,11 @@ bool SetCmdlineParams()
|
||||
Cmdline_novbo = 1;
|
||||
}
|
||||
|
||||
if ( no_pbo_arg.found() )
|
||||
{
|
||||
Cmdline_no_pbo = 1;
|
||||
}
|
||||
|
||||
if ( no_drawrangeelements.found() )
|
||||
{
|
||||
Cmdline_drawelements = 1;
|
||||
@@ -1424,6 +1529,11 @@ bool SetCmdlineParams()
|
||||
Cmdline_keyboard_layout = keyboard_layout.str();
|
||||
}
|
||||
|
||||
if (gl_finish.found())
|
||||
{
|
||||
Cmdline_gl_finish = true;
|
||||
}
|
||||
|
||||
if ( snd_preload_arg.found() )
|
||||
{
|
||||
Cmdline_snd_preload = 1;
|
||||
@@ -1506,6 +1616,11 @@ bool SetCmdlineParams()
|
||||
Cmdline_fb_explosions = 1;
|
||||
}
|
||||
|
||||
if ( brieflighting_arg.found() )
|
||||
{
|
||||
Cmdline_brief_lighting = 1;
|
||||
}
|
||||
|
||||
if ( postprocess_arg.found() )
|
||||
{
|
||||
Cmdline_postprocess = 1;
|
||||
@@ -1526,6 +1641,22 @@ bool SetCmdlineParams()
|
||||
Cmdline_reparse_mainhall = 1;
|
||||
}
|
||||
|
||||
if (frame_profile_arg.found() )
|
||||
{
|
||||
Cmdline_frame_profile = true;
|
||||
}
|
||||
|
||||
if (frame_profile_write_file.found())
|
||||
{
|
||||
Cmdline_frame_profile = true;
|
||||
Cmdline_profile_write_file = true;
|
||||
}
|
||||
|
||||
if (no_unfocused_pause_arg.found())
|
||||
{
|
||||
Cmdline_no_unfocus_pause = true;
|
||||
}
|
||||
|
||||
//Deprecated flags - CommanderDJ
|
||||
if( deprecated_spec_arg.found() )
|
||||
{
|
||||
@@ -1603,3 +1734,16 @@ int parse_cmdline(char *cmdline)
|
||||
// I did this because of fred2_parse_cmdline()
|
||||
return SetCmdlineParams();
|
||||
}
|
||||
|
||||
const char * get_param_desc(const char *flag_name)
|
||||
{
|
||||
int i;
|
||||
int flag_size = sizeof(Flag);
|
||||
int num_flags = sizeof(exe_params) / flag_size;
|
||||
for (i = 0; i < num_flags; ++i) {
|
||||
if (!strcmp(flag_name, exe_params[i].name)) {
|
||||
return exe_params[i].desc;
|
||||
}
|
||||
}
|
||||
return "UNKNOWN - FIXME!";
|
||||
}
|
||||
@@ -96,6 +96,7 @@ extern int Cmdline_ship_choice_3d;
|
||||
extern int Cmdline_weapon_choice_3d;
|
||||
extern int Cmdline_warp_flash;
|
||||
extern int Cmdline_autopilot_interruptable;
|
||||
extern int Cmdline_stretch_menu;
|
||||
|
||||
// Audio related
|
||||
extern int Cmdline_query_speech;
|
||||
@@ -120,6 +121,7 @@ extern int Cmdline_nomovies; // WMC Toggles movie playing support
|
||||
extern int Cmdline_no_set_gamma;
|
||||
extern int Cmdline_novbo;
|
||||
extern int Cmdline_no_fbo;
|
||||
extern int Cmdline_no_pbo;
|
||||
extern int Cmdline_noglsl;
|
||||
extern int Cmdline_mipmap;
|
||||
extern int Cmdline_ati_color_swap;
|
||||
@@ -128,6 +130,7 @@ extern int Cmdline_no_glsl_model_rendering;
|
||||
extern int Cmdline_no_di_mouse;
|
||||
extern int Cmdline_drawelements;
|
||||
extern char* Cmdline_keyboard_layout;
|
||||
extern bool Cmdline_gl_finish;
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
@@ -149,5 +152,8 @@ extern int Cmdline_verify_vps;
|
||||
extern int Cmdline_no_grab;
|
||||
#endif
|
||||
extern int Cmdline_reparse_mainhall;
|
||||
extern bool Cmdline_frame_profile;
|
||||
extern bool Cmdline_profile_write_file;
|
||||
extern bool Cmdline_no_unfocus_pause;
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
|
||||
struct object;
|
||||
class object;
|
||||
|
||||
#define CMEASURE_WAIT 333 // delay in milliseconds between countermeasure firing.
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "network/multi_pmsg.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -124,7 +126,7 @@ int Conflict_bright = 0;
|
||||
|
||||
static int Num_cc_lines;
|
||||
static struct {
|
||||
char *label;
|
||||
const char *label;
|
||||
int cc_index; // index into Control_config of item
|
||||
int y; // Y coordinate of line
|
||||
int kx, kw, jx, jw; // x start and width of keyboard and joystick bound text
|
||||
@@ -135,6 +137,7 @@ struct config_item_undo {
|
||||
int size;
|
||||
int *index; // array (size) of Control_config indices of replaced elements
|
||||
config_item *list; // array (size) of original elements
|
||||
int reset_to_preset; // if >=0, then we ignore the above list and simply reset to the given preset instead
|
||||
config_item_undo *next;
|
||||
};
|
||||
|
||||
@@ -174,6 +177,9 @@ static int Background_bitmap;
|
||||
static int Conflicts_tabs[NUM_TABS];
|
||||
static UI_BUTTON List_buttons[LIST_BUTTONS_MAX]; // buttons for each line of text in list
|
||||
static UI_WINDOW Ui_window;
|
||||
static unsigned int Defaults_cycle_pos; // the controls preset that was last selected
|
||||
|
||||
int Control_config_overlay_id;
|
||||
|
||||
static struct {
|
||||
int key; // index of other control in conflict with this one
|
||||
@@ -345,7 +351,7 @@ int Config_allowed[] = {
|
||||
#ifndef NDEBUG
|
||||
int Show_controls_info = 0;
|
||||
|
||||
DCF_BOOL(show_controls_info, Show_controls_info)
|
||||
DCF_BOOL(show_controls_info, Show_controls_info);
|
||||
#endif
|
||||
|
||||
static int Axes_origin[JOY_NUM_AXES];
|
||||
@@ -534,6 +540,8 @@ config_item_undo *get_undo_block(int size)
|
||||
ptr->list = NULL;
|
||||
}
|
||||
|
||||
ptr->reset_to_preset = -1;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -566,41 +574,45 @@ int control_config_undo_last()
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Config_item_undo->index[0] & JOY_AXIS) {
|
||||
tab = SHIP_TAB;
|
||||
if (Config_item_undo->reset_to_preset > -1) {
|
||||
control_config_reset_defaults(Config_item_undo->reset_to_preset);
|
||||
} else {
|
||||
tab = Control_config[Config_item_undo->index[0]].tab;
|
||||
}
|
||||
|
||||
for (i=1; i<Config_item_undo->size; i++) {
|
||||
if (Config_item_undo->index[i] & JOY_AXIS) {
|
||||
if (tab != SHIP_TAB) {
|
||||
tab = -1;
|
||||
}
|
||||
|
||||
if (Config_item_undo->index[0] & JOY_AXIS) {
|
||||
tab = SHIP_TAB;
|
||||
} else {
|
||||
if (Control_config[Config_item_undo->index[i]].tab != tab) {
|
||||
tab = -1;
|
||||
tab = Control_config[Config_item_undo->index[0]].tab;
|
||||
}
|
||||
|
||||
for (i=1; i<Config_item_undo->size; i++) {
|
||||
if (Config_item_undo->index[i] & JOY_AXIS) {
|
||||
if (tab != SHIP_TAB) {
|
||||
tab = -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (Control_config[Config_item_undo->index[i]].tab != tab) {
|
||||
tab = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tab >= 0) {
|
||||
Tab = tab;
|
||||
}
|
||||
if (tab >= 0) {
|
||||
Tab = tab;
|
||||
}
|
||||
|
||||
for (i=0; i<Config_item_undo->size; i++) {
|
||||
z = Config_item_undo->index[i];
|
||||
if (z & JOY_AXIS) {
|
||||
config_item *ptr;
|
||||
for (i=0; i<Config_item_undo->size; i++) {
|
||||
z = Config_item_undo->index[i];
|
||||
if (z & JOY_AXIS) {
|
||||
config_item *ptr;
|
||||
|
||||
z &= ~JOY_AXIS;
|
||||
ptr = &Config_item_undo->list[i];
|
||||
Axis_map_to[z] = ptr->joy_id;
|
||||
Invert_axis[z] = ptr->used;
|
||||
z &= ~JOY_AXIS;
|
||||
ptr = &Config_item_undo->list[i];
|
||||
Axis_map_to[z] = ptr->joy_id;
|
||||
Invert_axis[z] = ptr->used;
|
||||
|
||||
} else {
|
||||
Control_config[z] = Config_item_undo->list[i];
|
||||
} else {
|
||||
Control_config[z] = Config_item_undo->list[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,10 +872,25 @@ int control_config_do_reset()
|
||||
int i, j, total = 0;
|
||||
config_item_undo *ptr;
|
||||
config_item item;
|
||||
|
||||
config_item *preset;
|
||||
bool cycling_presets = false;
|
||||
|
||||
// If there are presets, then we'll cycle to the next preset and reset to that
|
||||
if (Control_config_presets.size() >= 1) {
|
||||
cycling_presets = true;
|
||||
|
||||
if (++Defaults_cycle_pos >= Control_config_presets.size())
|
||||
Defaults_cycle_pos = 0;
|
||||
|
||||
preset = Control_config_presets[Defaults_cycle_pos];
|
||||
} else {
|
||||
// If there are no presets, then we'll always reset to the hardcoded defaults
|
||||
preset = Control_config;
|
||||
}
|
||||
|
||||
// first, determine how many bindings need to be changed
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
if ((Control_config[i].key_id != Control_config[i].key_default) || (Control_config[i].joy_id != Control_config[i].joy_default)) {
|
||||
if ((Control_config[i].key_id != preset[i].key_default) || (Control_config[i].joy_id != preset[i].joy_default)) {
|
||||
total++;
|
||||
}
|
||||
}
|
||||
@@ -874,7 +901,7 @@ int control_config_do_reset()
|
||||
}
|
||||
}
|
||||
|
||||
if (!total) {
|
||||
if (!total && !cycling_presets) {
|
||||
gamesnd_play_iface(SND_GENERAL_FAIL);
|
||||
return -1;
|
||||
}
|
||||
@@ -882,7 +909,7 @@ int control_config_do_reset()
|
||||
// now, back up the old bindings so we can undo if we want to
|
||||
ptr = get_undo_block(total);
|
||||
for (i=j=0; i<CCFG_MAX; i++) {
|
||||
if ((Control_config[i].key_id != Control_config[i].key_default) || (Control_config[i].joy_id != Control_config[i].joy_default)) {
|
||||
if ((Control_config[i].key_id != preset[i].key_default) || (Control_config[i].joy_id != preset[i].joy_default)) {
|
||||
ptr->index[j] = i;
|
||||
ptr->list[j] = Control_config[i];
|
||||
j++;
|
||||
@@ -901,23 +928,43 @@ int control_config_do_reset()
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(j == total);
|
||||
control_config_reset_defaults();
|
||||
|
||||
if (cycling_presets)
|
||||
control_config_reset_defaults(Defaults_cycle_pos);
|
||||
else
|
||||
control_config_reset_defaults();
|
||||
|
||||
control_config_conflict_check();
|
||||
control_config_list_prepare();
|
||||
gamesnd_play_iface(SND_RESET_PRESSED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This sets all the controls to their default values
|
||||
void control_config_reset_defaults()
|
||||
// This sets all the controls to the default values in the given preset
|
||||
// If no preset is given, the hardcoded defaults of Control_config are used
|
||||
void control_config_reset_defaults(int presetnum)
|
||||
{
|
||||
int i;
|
||||
config_item *preset;
|
||||
|
||||
if (presetnum >= 0)
|
||||
preset = Control_config_presets[presetnum];
|
||||
else
|
||||
preset = Control_config;
|
||||
|
||||
// Reset keyboard defaults
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
Control_config[i].key_id = Control_config[i].key_default;
|
||||
Control_config[i].joy_id = Control_config[i].joy_default;
|
||||
// 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;
|
||||
Control_config[i].hasXSTR = preset[i].hasXSTR;
|
||||
Control_config[i].type = preset[i].type;
|
||||
Control_config[i].disabled = preset[i].disabled;
|
||||
}
|
||||
|
||||
for (i=0; i<NUM_JOY_AXIS_ACTIONS; i++) {
|
||||
@@ -1216,7 +1263,7 @@ void control_config_button_pressed(int n)
|
||||
}
|
||||
}
|
||||
|
||||
char *control_config_tooltip_handler(char *str)
|
||||
const char *control_config_tooltip_handler(const char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1241,14 +1288,16 @@ void control_config_init()
|
||||
Control_config_backup[i] = Control_config[i];
|
||||
}
|
||||
|
||||
Defaults_cycle_pos = 0;
|
||||
|
||||
common_set_interface_palette(NOX("ControlConfigPalette")); // set the interface palette
|
||||
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
|
||||
Ui_window.set_mask_bmap(Conflict_background_bitmap_mask_fname[gr_screen.res]);
|
||||
Ui_window.tooltip_handler = control_config_tooltip_handler;
|
||||
|
||||
// load in help overlay bitmap
|
||||
help_overlay_load(CONTROL_CONFIG_OVERLAY);
|
||||
help_overlay_set_state(CONTROL_CONFIG_OVERLAY,0);
|
||||
Control_config_overlay_id = help_overlay_get_index(CONTROL_CONFIG_OVERLAY);
|
||||
help_overlay_set_state(Control_config_overlay_id,gr_screen.res,0);
|
||||
|
||||
// reset conflict flashing
|
||||
Conflict_stamp = -1;
|
||||
@@ -1338,9 +1387,6 @@ void control_config_close()
|
||||
while (Config_item_undo){
|
||||
free_undo_block();
|
||||
}
|
||||
|
||||
// unload the overlay bitmap
|
||||
help_overlay_unload(CONTROL_CONFIG_OVERLAY);
|
||||
|
||||
if (Background_bitmap){
|
||||
bm_release(Background_bitmap);
|
||||
@@ -1392,7 +1438,8 @@ void control_config_close()
|
||||
|
||||
void control_config_do_frame(float frametime)
|
||||
{
|
||||
char buf[256], *str, *jptr;
|
||||
const char *str;
|
||||
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
|
||||
@@ -1451,7 +1498,7 @@ void control_config_do_frame(float frametime)
|
||||
}
|
||||
|
||||
} else {
|
||||
if (help_overlay_active(CONTROL_CONFIG_OVERLAY)) {
|
||||
if (help_overlay_active(Control_config_overlay_id)) {
|
||||
CC_Buttons[gr_screen.res][HELP_BUTTON].button.reset_status();
|
||||
Ui_window.set_ignore_gadgets(1);
|
||||
}
|
||||
@@ -1461,14 +1508,14 @@ void control_config_do_frame(float frametime)
|
||||
Ui_window.process(0);
|
||||
|
||||
if ( (k > 0) || B1_JUST_RELEASED ) {
|
||||
if (help_overlay_active(CONTROL_CONFIG_OVERLAY)) {
|
||||
help_overlay_set_state(CONTROL_CONFIG_OVERLAY, 0);
|
||||
if (help_overlay_active(Control_config_overlay_id)) {
|
||||
help_overlay_set_state(Control_config_overlay_id, gr_screen.res, 0);
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
if ( !help_overlay_active(Control_config_overlay_id) ) {
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
}
|
||||
|
||||
@@ -1495,7 +1542,7 @@ void control_config_do_frame(float frametime)
|
||||
}
|
||||
|
||||
if ((k > 0) && !Config_allowed[k & KEY_MASK]) {
|
||||
popup(0, 1, POPUP_OK, XSTR( "That is a non-bindable key. Please try again.", 207));
|
||||
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR( "That is a non-bindable key. Please try again.", 207));
|
||||
k = 0;
|
||||
}
|
||||
|
||||
@@ -1562,7 +1609,7 @@ void control_config_do_frame(float frametime)
|
||||
}
|
||||
|
||||
} else if (Search_mode) {
|
||||
if (help_overlay_active(CONTROL_CONFIG_OVERLAY)) {
|
||||
if (help_overlay_active(Control_config_overlay_id)) {
|
||||
CC_Buttons[gr_screen.res][HELP_BUTTON].button.reset_status();
|
||||
Ui_window.set_ignore_gadgets(1);
|
||||
}
|
||||
@@ -1572,14 +1619,14 @@ void control_config_do_frame(float frametime)
|
||||
Ui_window.process(0);
|
||||
|
||||
if ( (k > 0) || B1_JUST_RELEASED ) {
|
||||
if ( help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
help_overlay_set_state(CONTROL_CONFIG_OVERLAY, 0);
|
||||
if ( help_overlay_active(Control_config_overlay_id) ) {
|
||||
help_overlay_set_state(Control_config_overlay_id, gr_screen.res, 0);
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
if ( !help_overlay_active(Control_config_overlay_id) ) {
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
}
|
||||
|
||||
@@ -1673,7 +1720,7 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
CC_Buttons[gr_screen.res][UNDO_BUTTON].button.enable(Config_item_undo != NULL);
|
||||
|
||||
if ( help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
if ( help_overlay_active(Control_config_overlay_id) ) {
|
||||
CC_Buttons[gr_screen.res][HELP_BUTTON].button.reset_status();
|
||||
Ui_window.set_ignore_gadgets(1);
|
||||
}
|
||||
@@ -1681,14 +1728,14 @@ void control_config_do_frame(float frametime)
|
||||
k = Ui_window.process();
|
||||
|
||||
if ( (k > 0) || B1_JUST_RELEASED ) {
|
||||
if ( help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
help_overlay_set_state(CONTROL_CONFIG_OVERLAY, 0);
|
||||
if ( help_overlay_active(Control_config_overlay_id) ) {
|
||||
help_overlay_set_state(Control_config_overlay_id, gr_screen.res, 0);
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
if ( !help_overlay_active(Control_config_overlay_id) ) {
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
}
|
||||
|
||||
@@ -1794,7 +1841,7 @@ void control_config_do_frame(float frametime)
|
||||
GR_MAYBE_CLEAR_RES(Background_bitmap);
|
||||
if (Background_bitmap >= 0) {
|
||||
gr_set_bitmap(Background_bitmap);
|
||||
gr_bitmap(0, 0);
|
||||
gr_bitmap(0, 0, GR_RESIZE_MENU);
|
||||
}
|
||||
|
||||
// highlight tab with conflict
|
||||
@@ -1828,7 +1875,7 @@ void control_config_do_frame(float frametime)
|
||||
int sw, sh;
|
||||
gr_get_string_size(&sw, &sh, conflict_str);
|
||||
|
||||
gr_string((gr_screen.max_w / 2) - (sw / 2), Conflict_warning_coords[gr_screen.res][1], conflict_str);
|
||||
gr_string((gr_screen.max_w / 2) - (sw / 2), Conflict_warning_coords[gr_screen.res][1], conflict_str, GR_RESIZE_MENU);
|
||||
|
||||
gr_set_font(FONT1);
|
||||
} else {
|
||||
@@ -1884,7 +1931,7 @@ void control_config_do_frame(float frametime)
|
||||
if (t % 2) {
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
gr_get_string_size(&w, NULL, XSTR( "?", 208));
|
||||
gr_printf(x - w / 2, y - font_height / 2, XSTR( "?", 208));
|
||||
gr_printf_menu(x - w / 2, y - font_height / 2, XSTR( "?", 208));
|
||||
}
|
||||
|
||||
} else if (!(z & JOY_AXIS) && ((Conflicts[z].key >= 0) || (Conflicts[z].joy >= 0))) {
|
||||
@@ -1896,7 +1943,7 @@ void control_config_do_frame(float frametime)
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
str = XSTR( "Control conflicts with:", 209);
|
||||
gr_get_string_size(&w, NULL, str);
|
||||
gr_printf(x - w / 2, y - font_height, str);
|
||||
gr_printf_menu(x - w / 2, y - font_height, str);
|
||||
|
||||
if (Control_config[i].hasXSTR) {
|
||||
strcpy_s(buf, XSTR(Control_config[i].text, CONTROL_CONFIG_XSTR + i));
|
||||
@@ -1906,12 +1953,12 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
gr_force_fit_string(buf, 255, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
|
||||
gr_get_string_size(&w, NULL, buf);
|
||||
gr_printf(x - w / 2, y, buf);
|
||||
gr_printf_menu(x - w / 2, y, buf);
|
||||
|
||||
} else if (*bound_string) {
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
gr_get_string_size(&w, NULL, bound_string);
|
||||
gr_printf(x - w / 2, y - font_height / 2, bound_string);
|
||||
gr_printf_menu(x - w / 2, y - font_height / 2, bound_string);
|
||||
if (timestamp_elapsed(bound_timestamp)) {
|
||||
*bound_string = 0;
|
||||
}
|
||||
@@ -1919,7 +1966,7 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
if (Cc_lines[Num_cc_lines - 1].y + font_height > Cc_lines[Scroll_offset].y + Control_list_coords[gr_screen.res][CONTROL_H_COORD]) {
|
||||
gr_set_color_fast(&Color_white);
|
||||
gr_printf(Control_more_coords[gr_screen.res][CONTROL_X_COORD], Control_more_coords[gr_screen.res][CONTROL_Y_COORD], XSTR( "More...", 210));
|
||||
gr_printf_menu(Control_more_coords[gr_screen.res][CONTROL_X_COORD], Control_more_coords[gr_screen.res][CONTROL_Y_COORD], XSTR( "More...", 210));
|
||||
}
|
||||
|
||||
conflict = 0;
|
||||
@@ -1945,7 +1992,7 @@ void control_config_do_frame(float frametime)
|
||||
if (Cc_lines[line].label) {
|
||||
strcpy_s(buf, Cc_lines[line].label);
|
||||
gr_force_fit_string(buf, 255, Control_list_ctrl_w[gr_screen.res]);
|
||||
gr_printf(Control_list_coords[gr_screen.res][CONTROL_X_COORD], y, buf);
|
||||
gr_printf_menu(Control_list_coords[gr_screen.res][CONTROL_X_COORD], y, buf);
|
||||
}
|
||||
|
||||
if (!(z & JOY_AXIS)) {
|
||||
@@ -1957,7 +2004,7 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
if ((k < 0) && (j < 0)) {
|
||||
gr_set_color_fast(&Color_grey);
|
||||
gr_printf(x, y, XSTR( "None", 211));
|
||||
gr_printf_menu(x, y, XSTR( "None", 211));
|
||||
|
||||
} else {
|
||||
if (k >= 0) {
|
||||
@@ -1977,7 +2024,7 @@ void control_config_do_frame(float frametime)
|
||||
gr_set_color_fast(c);
|
||||
}
|
||||
|
||||
gr_printf(x, y, buf);
|
||||
gr_printf_menu(x, y, buf);
|
||||
|
||||
len = strlen(buf);
|
||||
Cc_lines[line].kx = x - Control_list_coords[gr_screen.res][CONTROL_X_COORD];
|
||||
@@ -1987,7 +2034,7 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
if (j >= 0) {
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
gr_printf(x, y, XSTR( ", ", 212));
|
||||
gr_printf_menu(x, y, XSTR( ", ", 212));
|
||||
gr_get_string_size(&w, NULL, XSTR( ", ", 212));
|
||||
x += w;
|
||||
}
|
||||
@@ -2011,7 +2058,7 @@ void control_config_do_frame(float frametime)
|
||||
}
|
||||
|
||||
gr_force_fit_string(buf, 255, Control_list_key_w[gr_screen.res] + Control_list_key_x[gr_screen.res] - x);
|
||||
gr_printf(x, y, buf);
|
||||
gr_printf_menu(x, y, buf);
|
||||
|
||||
Cc_lines[line].jx = x - Control_list_coords[gr_screen.res][CONTROL_X_COORD];
|
||||
gr_get_string_size(&Cc_lines[line].jw, NULL, buf);
|
||||
@@ -2027,7 +2074,7 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
if (j < 0) {
|
||||
gr_set_color_fast(&Color_grey);
|
||||
gr_printf(x, y, XSTR( "None", 211));
|
||||
gr_printf_menu(x, y, XSTR( "None", 211));
|
||||
|
||||
} else {
|
||||
if (Conflicts_axes[z & ~JOY_AXIS] >= 0) {
|
||||
@@ -2046,7 +2093,7 @@ void control_config_do_frame(float frametime)
|
||||
gr_set_color_fast(c);
|
||||
}
|
||||
|
||||
gr_string(x, y, Joy_axis_text[j]);
|
||||
gr_string(x, y, Joy_axis_text[j], GR_RESIZE_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2060,8 +2107,47 @@ void control_config_do_frame(float frametime)
|
||||
List_buttons[i++].disable();
|
||||
}
|
||||
|
||||
// If multiple controls presets are provided, display which one is in use
|
||||
if (Control_config_presets.size() > 1) {
|
||||
SCP_string preset_str;
|
||||
int matching_preset = -1;
|
||||
|
||||
for (i=0; i<(int)Control_config_presets.size(); i++) {
|
||||
bool this_preset_matches = true;
|
||||
config_item *this_preset = Control_config_presets[i];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (this_preset_matches) {
|
||||
matching_preset = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (matching_preset >= 0) {
|
||||
sprintf(preset_str, "Controls: %s", Control_config_preset_names[matching_preset].c_str());
|
||||
} else {
|
||||
sprintf(preset_str, "Controls: custom");
|
||||
|
||||
}
|
||||
|
||||
gr_get_string_size(&w, NULL, preset_str.c_str());
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
|
||||
if (gr_screen.res == GR_640) {
|
||||
gr_string(16, (24 - font_height) / 2, preset_str.c_str(), GR_RESIZE_MENU);
|
||||
} else {
|
||||
gr_string(24, (40 - font_height) / 2, preset_str.c_str(), GR_RESIZE_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
// blit help overlay if active
|
||||
help_overlay_maybe_blit(CONTROL_CONFIG_OVERLAY);
|
||||
help_overlay_maybe_blit(Control_config_overlay_id, gr_screen.res);
|
||||
|
||||
gr_flip();
|
||||
}
|
||||
@@ -2086,6 +2172,8 @@ float check_control_timef(int id)
|
||||
|
||||
// first, see if control actually used (makes sure modifiers match as well)
|
||||
if (!check_control(id)) {
|
||||
Control_config[id].continuous_ongoing = false;
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -2100,6 +2188,11 @@ float check_control_timef(int id)
|
||||
}
|
||||
|
||||
if (t1 + t2) {
|
||||
// We want to set this to true only after visiting control_used() (above)
|
||||
// to allow it to tell the difference between an ongoing continuous action
|
||||
// started before and a continuous action being started right now.
|
||||
Control_config[id].continuous_ongoing = true;
|
||||
|
||||
return t1 + t2;
|
||||
}
|
||||
|
||||
@@ -2111,7 +2204,7 @@ void control_check_indicate()
|
||||
#ifndef NDEBUG
|
||||
if (Show_controls_info) {
|
||||
gr_set_color_fast(&HUD_color_debug);
|
||||
gr_printf(490, 15, 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
|
||||
|
||||
@@ -2153,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;
|
||||
}
|
||||
|
||||
@@ -2172,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;
|
||||
}
|
||||
@@ -2205,6 +2298,17 @@ int check_control(int id, int key)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Control_config[id].continuous_ongoing) {
|
||||
// If we reach this point, then it means this is a continuous control
|
||||
// which has just been released
|
||||
|
||||
Script_system.SetHookVar("Action", 's', Control_config[id].text);
|
||||
Script_system.RunCondition(CHA_ONACTIONSTOPPED, '\0', NULL, NULL, id);
|
||||
Script_system.RemHookVar("Action");
|
||||
|
||||
Control_config[id].continuous_ongoing = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2260,6 +2364,7 @@ void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr)
|
||||
return;
|
||||
}
|
||||
|
||||
int Last_frame_timestamp;
|
||||
void control_used(int id)
|
||||
{
|
||||
// if we have set this key to be ignored, ignore it
|
||||
@@ -2267,7 +2372,20 @@ void control_used(int id)
|
||||
return;
|
||||
}
|
||||
|
||||
Control_config[id].used = timestamp();
|
||||
// This check needs to be done because the control code might call this function more than once per frame,
|
||||
// and we don't want to run the hooks more than once per frame
|
||||
if (Control_config[id].used < Last_frame_timestamp) {
|
||||
if (!Control_config[id].continuous_ongoing) {
|
||||
Script_system.SetHookVar("Action", 's', Control_config[id].text);
|
||||
Script_system.RunCondition(CHA_ONACTION, '\0', NULL, NULL, id);
|
||||
Script_system.RemHookVar("Action");
|
||||
|
||||
if (Control_config[id].type == CC_TYPE_CONTINUOUS)
|
||||
Control_config[id].continuous_ongoing = true;
|
||||
}
|
||||
|
||||
Control_config[id].used = timestamp();
|
||||
}
|
||||
}
|
||||
|
||||
void control_config_clear_used_status()
|
||||
|
||||
+133
-125
@@ -5,9 +5,11 @@
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#ifndef CONTROLS_CONFIG_H
|
||||
#define CONTROLS_CONFIG_H
|
||||
|
||||
@@ -61,12 +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;
|
||||
|
||||
/*!
|
||||
@@ -74,203 +78,203 @@ typedef struct config_item {
|
||||
* This is the value of the id field in config_item
|
||||
* The first group of items are ship targeting.
|
||||
*/
|
||||
enum IoActionId {
|
||||
TARGET_NEXT =0, //!< target next
|
||||
TARGET_PREV =1, //!< target previous
|
||||
TARGET_NEXT_CLOSEST_HOSTILE =2, //!< target the next hostile target
|
||||
TARGET_PREV_CLOSEST_HOSTILE =3, //!< target the previous closest hostile
|
||||
TOGGLE_AUTO_TARGETING =4, //!< toggle auto-targeting
|
||||
TARGET_NEXT_CLOSEST_FRIENDLY =5, //!< target the next friendly ship
|
||||
TARGET_PREV_CLOSEST_FRIENDLY =6, //!< target the closest friendly ship
|
||||
TARGET_SHIP_IN_RETICLE =7, //!< target ship closest to center of reticle
|
||||
TARGET_CLOSEST_SHIP_ATTACKING_TARGET =8, //!< target the closest ship attacking current target
|
||||
TARGET_LAST_TRANMISSION_SENDER =9, //!< TARGET_LAST_TRANMISSION_SENDER
|
||||
STOP_TARGETING_SHIP =10, //!< stop targeting ship
|
||||
enum IoActionId {
|
||||
TARGET_NEXT =0, //!< target next
|
||||
TARGET_PREV =1, //!< target previous
|
||||
TARGET_NEXT_CLOSEST_HOSTILE =2, //!< target the next hostile target
|
||||
TARGET_PREV_CLOSEST_HOSTILE =3, //!< target the previous closest hostile
|
||||
TOGGLE_AUTO_TARGETING =4, //!< toggle auto-targeting
|
||||
TARGET_NEXT_CLOSEST_FRIENDLY =5, //!< target the next friendly ship
|
||||
TARGET_PREV_CLOSEST_FRIENDLY =6, //!< target the closest friendly ship
|
||||
TARGET_SHIP_IN_RETICLE =7, //!< target ship closest to center of reticle
|
||||
TARGET_CLOSEST_SHIP_ATTACKING_TARGET =8, //!< target the closest ship attacking current target
|
||||
TARGET_LAST_TRANMISSION_SENDER =9, //!< TARGET_LAST_TRANMISSION_SENDER
|
||||
STOP_TARGETING_SHIP =10, //!< stop targeting ship
|
||||
|
||||
//!< @n
|
||||
//!< Targeting a Ship's Subsystem
|
||||
//!< ------------------------------
|
||||
TARGET_SUBOBJECT_IN_RETICLE =11, //!< target ships subsystem in reticle
|
||||
TARGET_NEXT_SUBOBJECT =12, //!< target next subsystem on current target
|
||||
TARGET_PREV_SUBOBJECT =13, //!< TARGET_PREV_SUBOBJECT
|
||||
STOP_TARGETING_SUBSYSTEM =14, //!< stop targeting subsystems on ship
|
||||
TARGET_SUBOBJECT_IN_RETICLE =11, //!< target ships subsystem in reticle
|
||||
TARGET_NEXT_SUBOBJECT =12, //!< target next subsystem on current target
|
||||
TARGET_PREV_SUBOBJECT =13, //!< TARGET_PREV_SUBOBJECT
|
||||
STOP_TARGETING_SUBSYSTEM =14, //!< stop targeting subsystems on ship
|
||||
|
||||
//!< @n
|
||||
//!< Speed Matching
|
||||
//!< ----------------
|
||||
MATCH_TARGET_SPEED =15, //!< match target speed
|
||||
TOGGLE_AUTO_MATCH_TARGET_SPEED =16, //!< toggle auto-match target speed
|
||||
MATCH_TARGET_SPEED =15, //!< match target speed
|
||||
TOGGLE_AUTO_MATCH_TARGET_SPEED =16, //!< toggle auto-match target speed
|
||||
|
||||
//!< @n
|
||||
//!< Weapons
|
||||
//!< ---------
|
||||
FIRE_PRIMARY =17, //!< FIRE_PRIMARY
|
||||
FIRE_SECONDARY =18, //!< FIRE_SECONDARY
|
||||
CYCLE_NEXT_PRIMARY =19, //!< cycle to next primary weapon
|
||||
CYCLE_PREV_PRIMARY =20, //!< cycle to previous primary weapon
|
||||
CYCLE_SECONDARY =21, //!< cycle to next secondary weapon
|
||||
CYCLE_NUM_MISSLES =22, //!< cycle number of missiles fired from secondary bank
|
||||
LAUNCH_COUNTERMEASURE =23, //!< LAUNCH_COUNTERMEASURE
|
||||
FIRE_PRIMARY =17, //!< FIRE_PRIMARY
|
||||
FIRE_SECONDARY =18, //!< FIRE_SECONDARY
|
||||
CYCLE_NEXT_PRIMARY =19, //!< cycle to next primary weapon
|
||||
CYCLE_PREV_PRIMARY =20, //!< cycle to previous primary weapon
|
||||
CYCLE_SECONDARY =21, //!< cycle to next secondary weapon
|
||||
CYCLE_NUM_MISSLES =22, //!< cycle number of missiles fired from secondary bank
|
||||
LAUNCH_COUNTERMEASURE =23, //!< LAUNCH_COUNTERMEASURE
|
||||
|
||||
//!< @n
|
||||
//!< Controls
|
||||
//!< ----------
|
||||
FORWARD_THRUST =24, //!< FORWARD_THRUST
|
||||
REVERSE_THRUST =25, //!< REVERSE_THRUST
|
||||
BANK_LEFT =26, //!< BANK_LEFT
|
||||
BANK_RIGHT =27, //!< BANK_RIGHT
|
||||
PITCH_FORWARD =28, //!< PITCH_FORWARD
|
||||
PITCH_BACK =29, //!< PITCH_BACK
|
||||
YAW_LEFT =30, //!< YAW_LEFT
|
||||
YAW_RIGHT =31, //!< YAW_RIGHT
|
||||
FORWARD_THRUST =24, //!< FORWARD_THRUST
|
||||
REVERSE_THRUST =25, //!< REVERSE_THRUST
|
||||
BANK_LEFT =26, //!< BANK_LEFT
|
||||
BANK_RIGHT =27, //!< BANK_RIGHT
|
||||
PITCH_FORWARD =28, //!< PITCH_FORWARD
|
||||
PITCH_BACK =29, //!< PITCH_BACK
|
||||
YAW_LEFT =30, //!< YAW_LEFT
|
||||
YAW_RIGHT =31, //!< YAW_RIGHT
|
||||
|
||||
//!< @n
|
||||
//!< Throttle Control
|
||||
//!< ------------------
|
||||
ZERO_THROTTLE =32, //!< ZERO_THROTTLE
|
||||
MAX_THROTTLE =33, //!< MAX_THROTTLE
|
||||
ONE_THIRD_THROTTLE =34, //!< ONE_THIRD_THROTTLE
|
||||
TWO_THIRDS_THROTTLE =35, //!< TWO_THIRDS_THROTTLE
|
||||
PLUS_5_PERCENT_THROTTLE =36, //!< PLUS_5_PERCENT_THROTTLE
|
||||
MINUS_5_PERCENT_THROTTLE =37, //!< MINUS_5_PERCENT_THROTTLE
|
||||
ZERO_THROTTLE =32, //!< ZERO_THROTTLE
|
||||
MAX_THROTTLE =33, //!< MAX_THROTTLE
|
||||
ONE_THIRD_THROTTLE =34, //!< ONE_THIRD_THROTTLE
|
||||
TWO_THIRDS_THROTTLE =35, //!< TWO_THIRDS_THROTTLE
|
||||
PLUS_5_PERCENT_THROTTLE =36, //!< PLUS_5_PERCENT_THROTTLE
|
||||
MINUS_5_PERCENT_THROTTLE =37, //!< MINUS_5_PERCENT_THROTTLE
|
||||
|
||||
//!< @n
|
||||
//!< Squadmate Messaging Keys
|
||||
//!< --------------------------
|
||||
ATTACK_MESSAGE =38, //!< wingman message: attack current target
|
||||
DISARM_MESSAGE =39, //!< wingman message: disarm current target
|
||||
DISABLE_MESSAGE =40, //!< wingman message: disable current target
|
||||
ATTACK_SUBSYSTEM_MESSAGE =41, //!< wingman message: disable current target
|
||||
CAPTURE_MESSAGE =42, //!< wingman message: capture current target
|
||||
ENGAGE_MESSAGE =43, //!< wingman message: engage enemy
|
||||
FORM_MESSAGE =44, //!< wingman message: form on my wing
|
||||
IGNORE_MESSAGE =45, //!< IGNORE_MESSAGE
|
||||
PROTECT_MESSAGE =46, //!< wingman message: protect current target
|
||||
COVER_MESSAGE =47, //!< wingman message: cover me
|
||||
WARP_MESSAGE =48, //!< wingman message: warp out
|
||||
REARM_MESSAGE =49, //!< REARM_MESSAGE
|
||||
TARGET_CLOSEST_SHIP_ATTACKING_SELF =50, //!< target closest ship that is attacking player
|
||||
ATTACK_MESSAGE =38, //!< wingman message: attack current target
|
||||
DISARM_MESSAGE =39, //!< wingman message: disarm current target
|
||||
DISABLE_MESSAGE =40, //!< wingman message: disable current target
|
||||
ATTACK_SUBSYSTEM_MESSAGE =41, //!< wingman message: disable current target
|
||||
CAPTURE_MESSAGE =42, //!< wingman message: capture current target
|
||||
ENGAGE_MESSAGE =43, //!< wingman message: engage enemy
|
||||
FORM_MESSAGE =44, //!< wingman message: form on my wing
|
||||
IGNORE_MESSAGE =45, //!< IGNORE_MESSAGE
|
||||
PROTECT_MESSAGE =46, //!< wingman message: protect current target
|
||||
COVER_MESSAGE =47, //!< wingman message: cover me
|
||||
WARP_MESSAGE =48, //!< wingman message: warp out
|
||||
REARM_MESSAGE =49, //!< REARM_MESSAGE
|
||||
TARGET_CLOSEST_SHIP_ATTACKING_SELF =50, //!< target closest ship that is attacking player
|
||||
|
||||
//!< @n
|
||||
//!< Views
|
||||
//!< -------
|
||||
VIEW_CHASE =51, //!< VIEW_CHASE
|
||||
VIEW_EXTERNAL =52, //!< VIEW_EXTERNAL
|
||||
VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK =53, //!< VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK
|
||||
VIEW_SLEW =54, //!< VIEW_SLEW
|
||||
VIEW_OTHER_SHIP =55, //!< VIEW_OTHER_SHIP
|
||||
VIEW_DIST_INCREASE =56, //!< VIEW_DIST_INCREASE
|
||||
VIEW_DIST_DECREASE =57, //!< VIEW_DIST_DECREASE
|
||||
VIEW_CENTER =58, //!< VIEW_CENTER
|
||||
PADLOCK_UP =59, //!< PADLOCK_UP
|
||||
PADLOCK_DOWN =60, //!< PADLOCK_DOWN
|
||||
PADLOCK_LEFT =61, //!< PADLOCK_LEFT
|
||||
PADLOCK_RIGHT =62, //!< PADLOCK_RIGHT
|
||||
VIEW_CHASE =51, //!< VIEW_CHASE
|
||||
VIEW_EXTERNAL =52, //!< VIEW_EXTERNAL
|
||||
VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK =53, //!< VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK
|
||||
VIEW_SLEW =54, //!< VIEW_SLEW
|
||||
VIEW_OTHER_SHIP =55, //!< VIEW_OTHER_SHIP
|
||||
VIEW_DIST_INCREASE =56, //!< VIEW_DIST_INCREASE
|
||||
VIEW_DIST_DECREASE =57, //!< VIEW_DIST_DECREASE
|
||||
VIEW_CENTER =58, //!< VIEW_CENTER
|
||||
PADLOCK_UP =59, //!< PADLOCK_UP
|
||||
PADLOCK_DOWN =60, //!< PADLOCK_DOWN
|
||||
PADLOCK_LEFT =61, //!< PADLOCK_LEFT
|
||||
PADLOCK_RIGHT =62, //!< PADLOCK_RIGHT
|
||||
|
||||
//!< @n
|
||||
//!< Misc Controls 1
|
||||
//!< -----------------
|
||||
RADAR_RANGE_CYCLE =63, //!< cycle to next radar range
|
||||
SQUADMSG_MENU =64, //!< toggle the squadmate messaging menu
|
||||
SHOW_GOALS =65, //!< show the mission goals screen
|
||||
END_MISSION =66, //!< end the mission
|
||||
TARGET_TARGETS_TARGET =67, //!< target your target's target
|
||||
AFTERBURNER =68, //!< AFTERBURNER
|
||||
RADAR_RANGE_CYCLE =63, //!< cycle to next radar range
|
||||
SQUADMSG_MENU =64, //!< toggle the squadmate messaging menu
|
||||
SHOW_GOALS =65, //!< show the mission goals screen
|
||||
END_MISSION =66, //!< end the mission
|
||||
TARGET_TARGETS_TARGET =67, //!< target your target's target
|
||||
AFTERBURNER =68, //!< AFTERBURNER
|
||||
|
||||
//!< @n
|
||||
//!< ETS
|
||||
//!< -----
|
||||
INCREASE_WEAPON =69, //!< increase weapon recharge rate
|
||||
DECREASE_WEAPON =70, //!< decrease weapon recharge rate
|
||||
INCREASE_SHIELD =71, //!< increase shield recharge rate
|
||||
DECREASE_SHIELD =72, //!< decrease shield recharge rate
|
||||
INCREASE_ENGINE =73, //!< increase energy to engines
|
||||
DECREASE_ENGINE =74, //!< decrease energy to engines
|
||||
ETS_EQUALIZE =75, //!< equalize recharge rates
|
||||
SHIELD_EQUALIZE =76, //!< equalize shield energy to all quadrants
|
||||
SHIELD_XFER_TOP =77, //!< transfer shield energy to front
|
||||
SHIELD_XFER_BOTTOM =78, //!< transfer shield energy to rear
|
||||
SHIELD_XFER_LEFT =79, //!< transfer shield energy to left
|
||||
SHIELD_XFER_RIGHT =80, //!< transfer shield energy to right
|
||||
XFER_SHIELD =81, //!< transfer energy to shield from weapons
|
||||
XFER_LASER =82, //!< transfer energy to weapons from shield
|
||||
INCREASE_WEAPON =69, //!< increase weapon recharge rate
|
||||
DECREASE_WEAPON =70, //!< decrease weapon recharge rate
|
||||
INCREASE_SHIELD =71, //!< increase shield recharge rate
|
||||
DECREASE_SHIELD =72, //!< decrease shield recharge rate
|
||||
INCREASE_ENGINE =73, //!< increase energy to engines
|
||||
DECREASE_ENGINE =74, //!< decrease energy to engines
|
||||
ETS_EQUALIZE =75, //!< equalize recharge rates
|
||||
SHIELD_EQUALIZE =76, //!< equalize shield energy to all quadrants
|
||||
SHIELD_XFER_TOP =77, //!< transfer shield energy to front
|
||||
SHIELD_XFER_BOTTOM =78, //!< transfer shield energy to rear
|
||||
SHIELD_XFER_LEFT =79, //!< transfer shield energy to left
|
||||
SHIELD_XFER_RIGHT =80, //!< transfer shield energy to right
|
||||
XFER_SHIELD =81, //!< transfer energy to shield from weapons
|
||||
XFER_LASER =82, //!< transfer energy to weapons from shield
|
||||
|
||||
//!< @n
|
||||
//!< Misc Controls 2
|
||||
//!< -----------------
|
||||
GLIDE_WHEN_PRESSED =83, //!< GLIDE_WHEN_PRESSED
|
||||
GLIDE_WHEN_PRESSED =83, //!< GLIDE_WHEN_PRESSED
|
||||
//!< @remark Backslash -- this was a convenient place for Glide When Pressed, since Show Damage Popup isn't used
|
||||
BANK_WHEN_PRESSED =84, //!< BANK_WHEN_PRESSED
|
||||
SHOW_NAVMAP =85, //!< SHOW_NAVMAP
|
||||
ADD_REMOVE_ESCORT =86, //!< ADD_REMOVE_ESCORT
|
||||
ESCORT_CLEAR =87, //!< ESCORT_CLEAR
|
||||
BANK_WHEN_PRESSED =84, //!< BANK_WHEN_PRESSED
|
||||
SHOW_NAVMAP =85, //!< SHOW_NAVMAP
|
||||
ADD_REMOVE_ESCORT =86, //!< ADD_REMOVE_ESCORT
|
||||
ESCORT_CLEAR =87, //!< ESCORT_CLEAR
|
||||
|
||||
TARGET_NEXT_ESCORT_SHIP =88, //!< TARGET_NEXT_ESCORT_SHIP
|
||||
TARGET_CLOSEST_REPAIR_SHIP =89, //!< target the closest repair ship
|
||||
TARGET_NEXT_UNINSPECTED_CARGO =90, //!< TARGET_NEXT_UNINSPECTED_CARGO
|
||||
TARGET_PREV_UNINSPECTED_CARGO =91, //!< TARGET_PREV_UNINSPECTED_CARGO
|
||||
TARGET_NEWEST_SHIP =92, //!< TARGET_NEWEST_SHIP
|
||||
TARGET_NEXT_ESCORT_SHIP =88, //!< TARGET_NEXT_ESCORT_SHIP
|
||||
TARGET_CLOSEST_REPAIR_SHIP =89, //!< target the closest repair ship
|
||||
TARGET_NEXT_UNINSPECTED_CARGO =90, //!< TARGET_NEXT_UNINSPECTED_CARGO
|
||||
TARGET_PREV_UNINSPECTED_CARGO =91, //!< TARGET_PREV_UNINSPECTED_CARGO
|
||||
TARGET_NEWEST_SHIP =92, //!< TARGET_NEWEST_SHIP
|
||||
|
||||
TARGET_NEXT_LIVE_TURRET =93, //!< TARGET_NEXT_LIVE_TURRET
|
||||
TARGET_PREV_LIVE_TURRET =94, //!< TARGET_PREV_LIVE_TURRET
|
||||
TARGET_NEXT_LIVE_TURRET =93, //!< TARGET_NEXT_LIVE_TURRET
|
||||
TARGET_PREV_LIVE_TURRET =94, //!< TARGET_PREV_LIVE_TURRET
|
||||
|
||||
TARGET_NEXT_BOMB =95, //!< TARGET_NEXT_BOMB
|
||||
TARGET_PREV_BOMB =96, //!< TARGET_PREV_BOMB
|
||||
TARGET_NEXT_BOMB =95, //!< TARGET_NEXT_BOMB
|
||||
TARGET_PREV_BOMB =96, //!< TARGET_PREV_BOMB
|
||||
|
||||
//!< @n
|
||||
//!< Multiplayer messaging keys
|
||||
//!< ----------------------------
|
||||
MULTI_MESSAGE_ALL =97, //!< message all netplayers
|
||||
MULTI_MESSAGE_FRIENDLY =98, //!< message all friendlies
|
||||
MULTI_MESSAGE_HOSTILE =99, //!< message all hostiles
|
||||
MULTI_MESSAGE_TARGET =100, //!< message targeted ship (if player)
|
||||
MULTI_MESSAGE_ALL =97, //!< message all netplayers
|
||||
MULTI_MESSAGE_FRIENDLY =98, //!< message all friendlies
|
||||
MULTI_MESSAGE_HOSTILE =99, //!< message all hostiles
|
||||
MULTI_MESSAGE_TARGET =100, //!< message targeted ship (if player)
|
||||
|
||||
//!< @n
|
||||
//!< Multiplayer misc keys
|
||||
//!< -----------------------
|
||||
MULTI_OBSERVER_ZOOM_TO =101, //!< if i'm an observer, zoom to my targeted object
|
||||
MULTI_OBSERVER_ZOOM_TO =101, //!< if i'm an observer, zoom to my targeted object
|
||||
|
||||
TIME_SPEED_UP =102, //!< TIME_SPEED_UP
|
||||
TIME_SLOW_DOWN =103, //!< TIME_SLOW_DOWN
|
||||
TIME_SPEED_UP =102, //!< TIME_SPEED_UP
|
||||
TIME_SLOW_DOWN =103, //!< TIME_SLOW_DOWN
|
||||
|
||||
TOGGLE_HUD_CONTRAST =104, //!< toggle between high and low HUD contrast
|
||||
TOGGLE_HUD_CONTRAST =104, //!< toggle between high and low HUD contrast
|
||||
|
||||
MULTI_TOGGLE_NETINFO =105, //!< toggle network info
|
||||
MULTI_TOGGLE_NETINFO =105, //!< toggle network info
|
||||
|
||||
MULTI_SELF_DESTRUCT =106, //!< self destruct (multiplayer only)
|
||||
MULTI_SELF_DESTRUCT =106, //!< self destruct (multiplayer only)
|
||||
|
||||
//!< @n
|
||||
//!< Misc Controls 3
|
||||
//!< -----------------
|
||||
TOGGLE_HUD =107, //!< TOGGLE_HUD
|
||||
RIGHT_SLIDE_THRUST =108, //!< RIGHT_SLIDE_THRUST
|
||||
LEFT_SLIDE_THRUST =109, //!< LEFT_SLIDE_THRUST
|
||||
UP_SLIDE_THRUST =110, //!< UP_SLIDE_THRUST
|
||||
DOWN_SLIDE_THRUST =111, //!< DOWN_SLIDE_THRUST
|
||||
HUD_TARGETBOX_TOGGLE_WIREFRAME =112, //!< HUD_TARGETBOX_TOGGLE_WIREFRAME
|
||||
VIEW_TOPDOWN =113, //!< VIEW_TOPDOWN
|
||||
VIEW_TRACK_TARGET =114, //!< VIEW_TRACK_TARGET
|
||||
TOGGLE_HUD =107, //!< TOGGLE_HUD
|
||||
RIGHT_SLIDE_THRUST =108, //!< RIGHT_SLIDE_THRUST
|
||||
LEFT_SLIDE_THRUST =109, //!< LEFT_SLIDE_THRUST
|
||||
UP_SLIDE_THRUST =110, //!< UP_SLIDE_THRUST
|
||||
DOWN_SLIDE_THRUST =111, //!< DOWN_SLIDE_THRUST
|
||||
HUD_TARGETBOX_TOGGLE_WIREFRAME =112, //!< HUD_TARGETBOX_TOGGLE_WIREFRAME
|
||||
VIEW_TOPDOWN =113, //!< VIEW_TOPDOWN
|
||||
VIEW_TRACK_TARGET =114, //!< VIEW_TRACK_TARGET
|
||||
|
||||
//!< @n
|
||||
//!< AutoPilot - Kazan
|
||||
//!< -------------------
|
||||
AUTO_PILOT_TOGGLE =115, //!< Autopilot key control
|
||||
NAV_CYCLE =116, //!< NAV_CYCLE
|
||||
AUTO_PILOT_TOGGLE =115, //!< Autopilot key control
|
||||
NAV_CYCLE =116, //!< NAV_CYCLE
|
||||
|
||||
//!< @n
|
||||
//!< Gliding
|
||||
//!< ---------
|
||||
TOGGLE_GLIDING =117, //!< TOGGLE_GLIDING
|
||||
TOGGLE_GLIDING =117, //!< TOGGLE_GLIDING
|
||||
|
||||
//!< @n
|
||||
//!< Additional weapon controls
|
||||
//!< ----------------------------
|
||||
CYCLE_PRIMARY_WEAPON_SEQUENCE =118, //!< cycle num primaries to fire at once
|
||||
CYCLE_PRIMARY_WEAPON_SEQUENCE =118, //!< cycle num primaries to fire at once
|
||||
|
||||
/*!
|
||||
* This must always be below the last defined item
|
||||
*/
|
||||
CCFG_MAX //!< The total number of defined control actions (or last define + 1)
|
||||
CCFG_MAX //!< The total number of defined control actions (or last define + 1)
|
||||
};
|
||||
|
||||
extern int Failed_key_index;
|
||||
@@ -285,7 +289,11 @@ extern int Axis_map_to[];
|
||||
extern int Invert_axis[];
|
||||
extern int Invert_axis_defaults[];
|
||||
|
||||
extern int Control_config_overlay_id;
|
||||
|
||||
extern config_item Control_config[]; //!< Stores the keyboard configuration
|
||||
extern SCP_vector<config_item*> Control_config_presets; // tabled control presets; pointers to config_item arrays
|
||||
extern SCP_vector<SCP_string> Control_config_preset_names; // names for Control_config_presets (identical order of items)
|
||||
extern char **Scan_code_text;
|
||||
extern char **Joy_button_text;
|
||||
|
||||
@@ -297,8 +305,8 @@ void control_config_close();
|
||||
|
||||
void control_config_cancel_exit();
|
||||
|
||||
void control_config_reset_defaults();
|
||||
int translate_key_to_index(char *key);
|
||||
void control_config_reset_defaults(int presetnum=-1);
|
||||
int translate_key_to_index(const char *key, bool find_override=true);
|
||||
char *translate_key(char *key);
|
||||
char *textify_scancode(int code);
|
||||
float check_control_timef(int id);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+15
-19
@@ -55,12 +55,8 @@ void cutscene_init()
|
||||
int rval;
|
||||
cutscene_info cutinfo;
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "cutscenes.tbl", rval));
|
||||
lcl_ext_close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,8 +72,6 @@ void cutscene_init()
|
||||
|
||||
while ( required_string_either("#End", "$Filename:") )
|
||||
{
|
||||
memset(&cutinfo, 0, sizeof(cutscene_info));
|
||||
|
||||
required_string("$Filename:");
|
||||
stuff_string( cutinfo.filename, F_PATHNAME, MAX_FILENAME_LEN );
|
||||
|
||||
@@ -90,8 +84,12 @@ void cutscene_init()
|
||||
compact_multitext_string(buf);
|
||||
cutinfo.description = vm_strdup(buf);
|
||||
|
||||
required_string("$cd:");
|
||||
stuff_int( &cutinfo.cd );
|
||||
if (optional_string("$cd:"))
|
||||
stuff_int( &cutinfo.cd );
|
||||
else
|
||||
cutinfo.cd = 0;
|
||||
|
||||
cutinfo.viewable = false;
|
||||
|
||||
if (isFirstCutscene) {
|
||||
isFirstCutscene = false;
|
||||
@@ -103,14 +101,10 @@ void cutscene_init()
|
||||
stuff_boolean(&cutinfo.viewable);
|
||||
}
|
||||
|
||||
|
||||
Cutscenes.push_back(cutinfo);
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
// function to return 0 based index of which CD a particular movie is on
|
||||
@@ -156,6 +150,8 @@ void cutscene_mark_viewable(char *filename)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
Warning(LOCATION, "Could not find cutscene '%s' in listing; cannot mark it viewable...", filename);
|
||||
}
|
||||
|
||||
#define NUM_BUTTONS 8
|
||||
@@ -254,7 +250,7 @@ int Cutscene_max_text_lines[GR_NUM_RESOLUTIONS] = {
|
||||
static int Text_size;
|
||||
static int Text_offset = 0;
|
||||
static int Text_line_size[MAX_TEXT_LINES];
|
||||
static char *Text_lines[MAX_TEXT_LINES];
|
||||
static const char *Text_lines[MAX_TEXT_LINES];
|
||||
|
||||
|
||||
int cutscenes_validate_cd(char *mve_name, int prompt_for_cd)
|
||||
@@ -262,7 +258,7 @@ int cutscenes_validate_cd(char *mve_name, int prompt_for_cd)
|
||||
int cd_present = 0;
|
||||
int cd_drive_num;
|
||||
int cd_mve_is_on;
|
||||
char volume_name[128];
|
||||
char volume_name[MAX_PATH_LEN];
|
||||
|
||||
int num_attempts = 0;
|
||||
|
||||
@@ -322,7 +318,7 @@ void cutscenes_screen_play()
|
||||
strcpy_s(name, Cutscenes[which_cutscene].filename );
|
||||
// full_name = cf_add_ext(name, NOX(".mve"));
|
||||
|
||||
main_hall_stop_music();
|
||||
main_hall_stop_music(true);
|
||||
main_hall_stop_ambient();
|
||||
int rval = movie_play(name);
|
||||
main_hall_start_music();
|
||||
@@ -335,7 +331,7 @@ void cutscenes_screen_play()
|
||||
else
|
||||
sprintf(str, XSTR("Unable to play movie %s.", 204), Cutscenes[which_cutscene].name);
|
||||
|
||||
popup(0, 1, POPUP_OK, str );
|
||||
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, str );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -582,7 +578,7 @@ void cutscenes_screen_do_frame()
|
||||
GR_MAYBE_CLEAR_RES(Background_bitmap);
|
||||
if (Background_bitmap >= 0) {
|
||||
gr_set_bitmap(Background_bitmap);
|
||||
gr_bitmap(0, 0);
|
||||
gr_bitmap(0, 0, GR_RESIZE_MENU);
|
||||
}
|
||||
|
||||
Ui_window.draw();
|
||||
@@ -612,7 +608,7 @@ void cutscenes_screen_do_frame()
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
}
|
||||
|
||||
gr_printf(Cutscene_list_coords[gr_screen.res][0], Cutscene_list_coords[gr_screen.res][1] + y, Cutscenes[Cutscene_list[z]].name);
|
||||
gr_printf_menu(Cutscene_list_coords[gr_screen.res][0], Cutscene_list_coords[gr_screen.res][1] + y, Cutscenes[Cutscene_list[z]].name);
|
||||
|
||||
y += font_height;
|
||||
z++;
|
||||
@@ -651,7 +647,7 @@ void cutscenes_screen_do_frame()
|
||||
|
||||
strncpy(line, Text_lines[z], len);
|
||||
line[len] = 0;
|
||||
gr_string(Cutscene_desc_coords[gr_screen.res][0], Cutscene_desc_coords[gr_screen.res][1] + y, line);
|
||||
gr_string(Cutscene_desc_coords[gr_screen.res][0], Cutscene_desc_coords[gr_screen.res][1] + y, line, GR_RESIZE_MENU);
|
||||
|
||||
y += font_height;
|
||||
z++;
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
typedef struct cutscene_info {
|
||||
cutscene_info() :
|
||||
viewable(false)
|
||||
{}
|
||||
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
char name[NAME_LENGTH];
|
||||
char *description;
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
extern int Game_mode;
|
||||
|
||||
const char *movie_ext_list[] = { ".ogg", ".mve" };
|
||||
const int NUM_MOVIE_EXT = sizeof(movie_ext_list) / sizeof(char*);
|
||||
|
||||
|
||||
#define MOVIE_NONE -1
|
||||
#define MOVIE_OGG 0
|
||||
@@ -42,8 +45,6 @@ int movie_find(char *filename, char *out_name)
|
||||
char full_path[MAX_PATH];
|
||||
char tmp_name[MAX_PATH];
|
||||
int size, offset = 0;
|
||||
const int NUM_EXT = 2;
|
||||
const char *movie_ext[NUM_EXT] = { ".ogg", ".mve" };
|
||||
|
||||
if (out_name == NULL)
|
||||
return MOVIE_NONE;
|
||||
@@ -57,7 +58,7 @@ int movie_find(char *filename, char *out_name)
|
||||
char *p = strrchr(tmp_name, '.');
|
||||
if ( p ) *p = 0;
|
||||
|
||||
int rc = cf_find_file_location_ext(tmp_name, NUM_EXT, movie_ext, CF_TYPE_ANY, sizeof(full_path) - 1, full_path, &size, &offset, 0);
|
||||
int rc = cf_find_file_location_ext(tmp_name, NUM_MOVIE_EXT, movie_ext_list, CF_TYPE_ANY, sizeof(full_path) - 1, full_path, &size, &offset, 0);
|
||||
|
||||
if (rc == MOVIE_NONE)
|
||||
return MOVIE_NONE;
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#ifndef _MOVIE_HEADER_FILE
|
||||
#define _MOVIE_HEADER_FILE
|
||||
|
||||
extern const char *movie_ext_list[];
|
||||
extern const int NUM_MOVIE_EXT;
|
||||
|
||||
bool movie_play(char *name);
|
||||
void movie_play_two(char *name1, char *name2);
|
||||
|
||||
|
||||
@@ -614,7 +614,7 @@ void mve_video_display()
|
||||
// DDOI - This is probably really fricking slow
|
||||
int bitmap = bm_create (16, g_screenWidth, g_screenHeight, pixelbuf, 0);
|
||||
gr_set_bitmap (bitmap);
|
||||
gr_bitmap ((int)g_screenX, (int)g_screenY, true);
|
||||
gr_bitmap ((int)g_screenX, (int)g_screenY, GR_RESIZE_FULL);
|
||||
bm_release (bitmap);
|
||||
}
|
||||
|
||||
|
||||
@@ -797,7 +797,7 @@ THEORAFILE *theora_open(char *filename)
|
||||
|
||||
// lower case filename for checking
|
||||
memset( lower_name, 0, sizeof(lower_name) );
|
||||
strncpy( lower_name, filename, strlen(filename) );
|
||||
strncpy( lower_name, filename, sizeof(lower_name)-1 );
|
||||
strlwr(lower_name);
|
||||
|
||||
char *p = strchr( lower_name, '.' );
|
||||
|
||||
@@ -27,7 +27,7 @@ static inline int is_power_of_two(int w, int h)
|
||||
}
|
||||
|
||||
|
||||
int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int *bpp, int *compression_type, int *levels, int *size, ubyte *palette)
|
||||
int dds_read_header(const char *filename, CFILE *img_cfp, int *width, int *height, int *bpp, int *compression_type, int *levels, int *size, ubyte *palette)
|
||||
{
|
||||
DDSURFACEDESC2 dds_header;
|
||||
int code = 0;
|
||||
@@ -272,7 +272,7 @@ Done:
|
||||
}
|
||||
|
||||
//reads pixel info from a dds file
|
||||
int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp, int cf_type)
|
||||
int dds_read_bitmap(const char *filename, ubyte *data, ubyte *bpp, int cf_type)
|
||||
{
|
||||
int retval;
|
||||
int w,h,ct,lvl;
|
||||
@@ -321,7 +321,7 @@ int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp, int cf_type)
|
||||
|
||||
// save some image data as a DDS image
|
||||
// NOTE: we only support, uncompressed, 24-bit RGB and 32-bit RGBA images here!!
|
||||
void dds_save_image(int width, int height, int bpp, int num_mipmaps, ubyte *data, int cubemap, char *filename)
|
||||
void dds_save_image(int width, int height, int bpp, int num_mipmaps, ubyte *data, int cubemap, const char *filename)
|
||||
{
|
||||
DDSURFACEDESC2 dds_header;
|
||||
char real_filename[MAX_FILENAME_LEN];
|
||||
|
||||
@@ -138,14 +138,14 @@ typedef struct _DDSURFACEDESC2
|
||||
//reads a dds header
|
||||
//returns one of the error values
|
||||
//'compression_type' comes back as one of the DDS_DXTC* defines
|
||||
int dds_read_header(char *filename, CFILE *img_cfp = NULL, int *width = 0, int *height = 0, int *bpp = 0, int *compression_type = 0, int *levels = 0, int *size = 0, ubyte *palette = NULL);
|
||||
int dds_read_header(const char *filename, CFILE *img_cfp = NULL, int *width = 0, int *height = 0, int *bpp = 0, int *compression_type = 0, int *levels = 0, int *size = 0, ubyte *palette = NULL);
|
||||
|
||||
//reads bitmap
|
||||
//size of the data it stored in size
|
||||
int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp = NULL, int cf_type = CF_TYPE_ANY);
|
||||
int dds_read_bitmap(const char *filename, ubyte *data, ubyte *bpp = NULL, int cf_type = CF_TYPE_ANY);
|
||||
|
||||
// writes a DDS file using given data
|
||||
void dds_save_image(int width, int height, int bpp, int num_mipmaps, ubyte *data = NULL, int cubemap = 0, char *filename = NULL);
|
||||
void dds_save_image(int width, int height, int bpp, int num_mipmaps, ubyte *data = NULL, int cubemap = 0, const char *filename = NULL);
|
||||
|
||||
//returns a string from a DDS error code
|
||||
const char *dds_error_string(int code);
|
||||
|
||||
+10
-3
@@ -101,6 +101,7 @@ void debris_init()
|
||||
for (i=0; i<MAX_DEBRIS_PIECES; i++ ) {
|
||||
Debris[i].flags = 0;
|
||||
Debris[i].sound_delay = 0;
|
||||
Debris[i].objnum = -1;
|
||||
}
|
||||
|
||||
Num_hull_pieces = 0;
|
||||
@@ -237,6 +238,7 @@ void debris_delete( object * obj )
|
||||
}
|
||||
|
||||
db->flags = 0;
|
||||
db->objnum = -1;
|
||||
Num_debris_pieces--;
|
||||
}
|
||||
|
||||
@@ -524,11 +526,11 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
// Create Debris piece n!
|
||||
if ( hull_flag ) {
|
||||
if (rand() < RAND_MAX/6) // Make some pieces blow up shortly after explosion.
|
||||
db->lifeleft = 2.0f * ((float) myrand()/(float) RAND_MAX) + 0.5f;
|
||||
db->lifeleft = 2.0f * (myrand() * RAND_MAX_1f) + 0.5f;
|
||||
else
|
||||
db->lifeleft = -1.0f; // large hull pieces stay around forever
|
||||
} else {
|
||||
db->lifeleft = (i2fl(myrand())/i2fl(RAND_MAX))*2.0f+0.1f;
|
||||
db->lifeleft = (myrand() * RAND_MAX_1f) * 2.0f + 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -805,6 +807,7 @@ void debris_hit(object *debris_obj, object *other_obj, vec3d *hitpos, float dama
|
||||
int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, collision_info_struct *debris_hit_info)
|
||||
{
|
||||
mc_info mc;
|
||||
mc_info_init(&mc);
|
||||
int num;
|
||||
|
||||
Assert( pdebris->type == OBJ_DEBRIS );
|
||||
@@ -834,7 +837,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
|
||||
weapon *wp = &Weapons[other_obj->instance];
|
||||
wp->collisionOccured = true;
|
||||
wp->collisionInfo = mc_info(mc);
|
||||
memcpy(&wp->collisionInfo, &mc, sizeof(mc_info));
|
||||
|
||||
return mc.num_hits;
|
||||
}
|
||||
@@ -923,6 +926,10 @@ 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[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
|
||||
for (smv = submodel_vector.begin(); smv != submodel_vector.end(); ++smv) {
|
||||
// turn on submodel for collision test
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
struct object;
|
||||
class object;
|
||||
struct CFILE;
|
||||
|
||||
#define MAX_DEBRIS_ARCS 8 // Must be less than MAX_ARC_EFFECTS in model.h
|
||||
|
||||
+483
-616
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,279 @@
|
||||
#ifndef _CONSOLE_H
|
||||
#define _CONSOLE_H
|
||||
/*
|
||||
* z64555's debug console, created for the FreeSpace Source Code project
|
||||
*
|
||||
* Portions of this source code are based on works by Volition, Inc. circa 1999. You may not sell or otherwise
|
||||
* commercially exploit the source or things you created based on the source.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file console.h
|
||||
* @brief An overhauled/updated debug console to allow monitoring, testing, and general debugging of new features.
|
||||
*
|
||||
* @details
|
||||
* Of key interest is Volition's DCF macro, which adds the function argument to the available command list in the
|
||||
* debug console. These functions may be defined in the .cpp file that they are related to, but it is recommended
|
||||
* that they be in their own .cpp if they have multiple sub-arguments (ex: Git has its sub-arguments delimited by
|
||||
* a pair of -'s, or --)
|
||||
*/
|
||||
|
||||
#include "debugconsole/consoleparse.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/vmallocator.h"
|
||||
|
||||
#define DC_MAX_COMMANDS 300
|
||||
|
||||
class debug_command;
|
||||
|
||||
/**
|
||||
* @def DCF
|
||||
*
|
||||
* @brief The potent DCF macro, used to define new debug commands for the console.
|
||||
*
|
||||
* @param function_name[in] The name of the function, as shown in the debug console
|
||||
* @param help_txt[in] The short-help text, as shown as listed from the 'help' command
|
||||
*
|
||||
* @details
|
||||
* Each DCF is responsible for getting data from the debug console's command line. The parsing functions for the
|
||||
* command line have been set up to have similar syntax and usage as the parselo commands. (see consoleparse.h)
|
||||
* Most, if not all, argument and subcommand strings should be parsed by the dc_optional_string functions.
|
||||
* Usage example:
|
||||
* DCF(toggle_it, "description")
|
||||
* {
|
||||
* if (dc_optional_string_either("help", "--help")) {
|
||||
* dc_printf("Usage: sample. Toggles This_var on/off\n");
|
||||
*
|
||||
* } else if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
|
||||
* dc_printf("This_var is %s\n", (This_var ? "ON" : "OFF"));
|
||||
*
|
||||
* } else {
|
||||
* This_var = !This_var;
|
||||
*
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* In the console, the command would be listed as 'toggle_it', and dcf_help would display it as:
|
||||
* toggle_it - Usage: sample. Toggles This_var on/off.
|
||||
* Note: The only allowed function type is a void fn( void )
|
||||
*/
|
||||
#define DCF(function_name, help_text) \
|
||||
void dcf_##function_name(); \
|
||||
debug_command dcmd_##function_name(#function_name, help_text, dcf_##function_name); \
|
||||
void dcf_##function_name()
|
||||
|
||||
/**
|
||||
* @def Shortcut for debug commands that toggle a bool, such as Show_lightning
|
||||
*
|
||||
* @param [in] function_name Name of the function, as shown in the debug console
|
||||
* @param [in] bool_variable Name of the variable to allow toggling.
|
||||
*/
|
||||
#define DCF_BOOL(function_name, bool_variable) \
|
||||
void dcf_##function_name(); \
|
||||
debug_command dcmd_##function_name(#function_name, "Sets or toggles the boolean: "#bool_variable, dcf_##function_name ); \
|
||||
void dcf_##function_name() { \
|
||||
bool bool_tmp = bool_variable != 0; \
|
||||
if (dc_optional_string_either("help", "--help")) { \
|
||||
dc_printf( "Usage: %s [bool]\nSets %s to true or false. If nothing passed, then toggles it.\n", #function_name, #bool_variable ); \
|
||||
return; \
|
||||
} \
|
||||
if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
|
||||
dc_printf("%s = %s\n", #bool_variable, (bool_variable ? "TRUE" : "FALSE")); \
|
||||
return; \
|
||||
} \
|
||||
if (!dc_maybe_stuff_boolean(&bool_tmp)) { \
|
||||
if (bool_variable != 0) \
|
||||
bool_variable = 0; \
|
||||
else \
|
||||
bool_variable = 1; \
|
||||
} else { \
|
||||
if (bool_tmp) \
|
||||
bool_variable = 1; \
|
||||
else \
|
||||
bool_variable = 0; \
|
||||
} \
|
||||
dc_printf("%s set to %s\n", #bool_variable, (bool_variable != 0 ? "TRUE" : "FALSE")); \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @def Same as DCF_BOOL, but with custom help strings
|
||||
*
|
||||
* @param [in] function_name Name of the function, as shown in the debug console
|
||||
* @param [in] bool_variable Name of the variable to allow toggling.
|
||||
*/
|
||||
#define DCF_BOOL2(function_name, bool_variable, short_help, long_help) \
|
||||
void dcf_##function_name(); \
|
||||
debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
|
||||
void dcf_##function_name() { \
|
||||
if (dc_optional_string_either("help", "--help")) { \
|
||||
dc_printf( #long_help ); \
|
||||
return; \
|
||||
} \
|
||||
if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
|
||||
dc_printf("%s = %s\n", #function_name, (bool_variable ? "TRUE" : "FALSE")); \
|
||||
return; \
|
||||
} \
|
||||
if (!dc_maybe_stuff_boolean(&bool_variable)) { \
|
||||
bool_variable = !bool_variable; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* @def Shortcut for single-variable setters/monitors
|
||||
*
|
||||
* @param [in] function_name
|
||||
* @param [in] float_variable
|
||||
* @param [in] short_help
|
||||
*/
|
||||
#define DCF_FLOAT(function_name, float_variable, short_help) \
|
||||
void dcf_##function_name(); \
|
||||
debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
|
||||
void dcf_##function_name() { \
|
||||
float value; \
|
||||
if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
|
||||
dc_printf("%s = %f\n", #float_variable, float_variable); \
|
||||
return; \
|
||||
} \
|
||||
dc_stuff_float(&value); \
|
||||
float_variable = value; \
|
||||
dc_printf("%s set to %f\n", #float_variable, float_variable); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @def Shortcut for single-variable setters/monitors with lower/upper bounds clamping
|
||||
*
|
||||
* @param [in] function_name
|
||||
* @param [in] float_variable
|
||||
* @param [in] lower_bounds
|
||||
* @param [in] upper_bounds
|
||||
* @param [in] short_help
|
||||
*/
|
||||
#define DCF_FLOAT2(function_name, float_variable, lower_bounds, upper_bounds, short_help) \
|
||||
void dcf_##function_name(); \
|
||||
debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
|
||||
void dcf_##function_name() { \
|
||||
float value; \
|
||||
if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
|
||||
dc_printf("%s = %f\n", #float_variable, float_variable); \
|
||||
return; \
|
||||
} \
|
||||
dc_stuff_float(&value); \
|
||||
CLAMP(float_variable, lower_bounds, upper_bounds); \
|
||||
float_variable = value; \
|
||||
dc_printf("%s set to %f\n", #float_variable, float_variable); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @def Shortcut for single-variable setters/monitors
|
||||
*
|
||||
* @param [in] function_name
|
||||
* @param [in] int_variable
|
||||
* @param [in] short_help
|
||||
*/
|
||||
#define DCF_INT(function_name, int_variable, short_help) \
|
||||
void dcf_##function_name(); \
|
||||
debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
|
||||
void dcf_##function_name() { \
|
||||
int value; \
|
||||
if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
|
||||
dc_printf("%s = %i\n", #int_variable, int_variable); \
|
||||
return; \
|
||||
} \
|
||||
dc_stuff_int(&value); \
|
||||
int_variable = value; \
|
||||
dc_printf("%s set to %i\n", #int_variable, int_variable); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @def Shortcut for single-variable setters/monitors with lower/upper bounds clamping
|
||||
*
|
||||
* @param [in] function_name
|
||||
* @param [in] int_variable
|
||||
* @param [in] lower_bounds
|
||||
* @param [in] upper_bounds
|
||||
* @param [in] short_help
|
||||
*/
|
||||
#define DCF_INT2(function_name, int_variable, lower_bounds, upper_bounds, short_help) \
|
||||
void dcf_##function_name(); \
|
||||
debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
|
||||
void dcf_##function_name() { \
|
||||
int value; \
|
||||
if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
|
||||
dc_printf("%s = %i\n", #int_variable, int_variable); \
|
||||
return; \
|
||||
} \
|
||||
dc_stuff_int(&value); \
|
||||
CLAMP(int_variable, lower_bounds, upper_bounds); \
|
||||
int_variable = value; \
|
||||
dc_printf("%s set to %i\n", #int_variable, int_variable); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @class debug_command
|
||||
* @brief Class to aggregate a debug command with its name (as shown in the console) and short help.
|
||||
*
|
||||
* @details
|
||||
* Note: Long help, as evoked by '<command> help', should be handled by the function itself. It is recommended
|
||||
* that arguments that have sub-arguments be in their own function, so as to aide in organization and to keep the
|
||||
* size of the command function down.
|
||||
*/
|
||||
class debug_command {
|
||||
public:
|
||||
const char *name; //!< The name of the command, as shown in the debug console
|
||||
const char *help; //!< The short help string, as shown by 'help <command>'
|
||||
void (*func)(); //!< Pointer to the function that to run when this command is evoked
|
||||
|
||||
debug_command();
|
||||
|
||||
/**
|
||||
* @brief Adds a debug command to the debug_commands map, if it isn't in there already.
|
||||
*
|
||||
* @details The DCF macro more or less guarantees that a command won't be duplicated on compile time. But no harm in
|
||||
* some extra caution.
|
||||
*/
|
||||
debug_command(const char *name, const char *help, void (*func)());
|
||||
};
|
||||
|
||||
/**
|
||||
* @class is_dcmd
|
||||
* @brief Predicate class used to search for a dcmd by name
|
||||
*/
|
||||
class is_dcmd {
|
||||
public:
|
||||
const char *name;
|
||||
|
||||
is_dcmd(const char *_name) : name(_name) {}
|
||||
|
||||
bool operator() (debug_command* dcmd)
|
||||
{
|
||||
return (strcmp(name, dcmd->name) == 0);
|
||||
}
|
||||
};
|
||||
|
||||
extern bool Dc_debug_on;
|
||||
extern int dc_commands_size;
|
||||
extern uint lastline;
|
||||
extern SCP_string dc_command_str; // The rest of the command line, from the end of the last processed arg on.
|
||||
|
||||
/**
|
||||
* @brief Pauses the output of a command and allows user to scroll through the output history.
|
||||
*
|
||||
* @details Returns true if user has pressed Esc, returns false otherwise. Use this in your function to (safely?) break
|
||||
* out of the loop it's presumably in.
|
||||
*/
|
||||
bool dc_pause_output(void);
|
||||
|
||||
/**
|
||||
* @brief Prints the given char string to the debug console
|
||||
* @details See the doc for std::printf() for formating and more details
|
||||
*/
|
||||
void dc_printf(const char *format, ...);
|
||||
|
||||
/**
|
||||
* @brief Opens and processes the debug console. (Blocking call)
|
||||
* @details TODO: Make this a non-blocking call so that the game can still run while the debug console is open.
|
||||
*/
|
||||
void debug_console(void (*func)(void) = NULL);
|
||||
|
||||
#endif // _CONSOLE_H
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* z64555's debug console
|
||||
* Created for the FreeSpace Source Code project
|
||||
*
|
||||
* Portions of this source code are based on works by Volition, Inc. circa
|
||||
* 1999. You may not sell or otherwise commercially exploit the source or things you
|
||||
* created based on the source
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file consolecmds.cpp
|
||||
*
|
||||
* @brief This file contains the "built-in" commands for the debug console, and is listed by the 'help' and '?' commands
|
||||
*
|
||||
* @details
|
||||
* All other debug commands should be in their respective files and added to the console with the DCF macro. For
|
||||
* further documentation, please see console.h
|
||||
*/
|
||||
|
||||
#include "debugconsole/console.h"
|
||||
#include "debugconsole/consoleparse.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/vmallocator.h"
|
||||
#include "io/key.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// ========================= GLOBALS =========================
|
||||
debug_command *dc_commands[DC_MAX_COMMANDS];
|
||||
int dc_commands_size = 0;
|
||||
|
||||
// ========================= LOCALS ==========================
|
||||
// dcf_shell commands
|
||||
void dc_shell_font( void );
|
||||
void dc_shell_resize( void );
|
||||
void dc_shell_resize_buf( void );
|
||||
|
||||
// =================== class debug_command ===================
|
||||
debug_command::debug_command()
|
||||
: name(""), help(""), func(NULL) {
|
||||
};
|
||||
|
||||
debug_command::debug_command(const char *_name, const char *_help, void(*_func)())
|
||||
: name(_name), help(_help), func(_func) {
|
||||
int i = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (dc_commands_size >= DC_MAX_COMMANDS) {
|
||||
Error(LOCATION, "Too many debug console commands! Please inform a coder to increase DC_MAX_COMMANDS.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Start the insertion sort by finding where to stick the debug command
|
||||
for (; i < dc_commands_size; ++i) {
|
||||
ret = stricmp(dc_commands[i]->name, _name);
|
||||
|
||||
if (ret == 0) {
|
||||
Error(LOCATION, "Debug Command %s already exists! Please inform a coder immediately.", _name);
|
||||
return;
|
||||
} else if (ret > 0) {
|
||||
// Insert the command here
|
||||
break;
|
||||
} // Else, do nothing
|
||||
}
|
||||
|
||||
// Then, do the insertion
|
||||
if (i < dc_commands_size) {
|
||||
for (int j = dc_commands_size; j > i; --j) {
|
||||
dc_commands[j] = dc_commands[j - 1];
|
||||
}
|
||||
dc_commands[i] = this;
|
||||
dc_commands_size++;
|
||||
} else {
|
||||
dc_commands[dc_commands_size] = this;
|
||||
dc_commands_size++;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================== IMPLEMENTATIONS =============================
|
||||
|
||||
DCF(debug, "Runs a command in debug mode.")
|
||||
{
|
||||
int i;
|
||||
SCP_string command = "";
|
||||
|
||||
Dc_debug_on = true;
|
||||
|
||||
dc_stuff_string_white(command);
|
||||
|
||||
if (command == "") {
|
||||
dc_printf("<debug> No command given\n");
|
||||
return;
|
||||
} // Else, command is present.
|
||||
|
||||
for (i = 0; i < dc_commands_size; ++i) {
|
||||
if (stricmp(dc_commands[i]->name, command.c_str()) == 0) {
|
||||
break;
|
||||
} // Else, continue
|
||||
}
|
||||
|
||||
if (i == dc_commands_size) {
|
||||
dc_printf("<debug> Command not found: '%s'\n", command.c_str());
|
||||
return;
|
||||
} // Else, we found our command
|
||||
|
||||
dc_printf("<debug> Executing command: '%s'\n", command.c_str());
|
||||
// try {
|
||||
dc_commands[i]->func();
|
||||
// } catch {
|
||||
// }
|
||||
|
||||
Dc_debug_on = false;
|
||||
}
|
||||
|
||||
DCF(help, "Displays the help list." )
|
||||
{
|
||||
extern uint DROWS;
|
||||
|
||||
int i;
|
||||
SCP_string command = "";
|
||||
|
||||
dc_maybe_stuff_string_white(command);
|
||||
if ((command == "help") || (command == "man"))
|
||||
{
|
||||
// Moron filter :D
|
||||
dc_printf("GTVA Command: Sorry pilot. You're on your own.\n");
|
||||
return;
|
||||
|
||||
} else if (command != "") {
|
||||
for (i = 0; i < dc_commands_size; ++i) {
|
||||
if (stricmp(dc_commands[i]->name, command.c_str()) == 0) {
|
||||
break;
|
||||
} // Else, continue
|
||||
}
|
||||
|
||||
if (i == dc_commands_size) {
|
||||
dc_printf("Command not found: '%s'\n", command.c_str());
|
||||
return;
|
||||
} // Else, we found our command
|
||||
|
||||
dc_printf("%s\n", dc_commands[i]->help);
|
||||
return;
|
||||
} // Else, command line is empty, print out the help list
|
||||
|
||||
dc_printf("FreeSpace Open Debug Console\n");
|
||||
dc_printf(" These commands are defined internally.\n");
|
||||
dc_printf(" Typing 'help function_name' will give the short help on the function.\n");
|
||||
dc_printf(" Some functions may have detailed help, try passing \"help\" or \"--help\" to them.");
|
||||
dc_printf(" F3 selects last command line. Up and Down arrow keys scroll through the command history\n");
|
||||
dc_printf("\n");
|
||||
|
||||
dc_printf(" Available commands:\n");
|
||||
for (i = 0; i < dc_commands_size; ++i) {
|
||||
if (((lastline % DROWS) == 0) && (lastline != 0)) {
|
||||
dc_pause_output();
|
||||
}
|
||||
|
||||
dc_printf(" %s - %s\n", dc_commands[i]->name, dc_commands[i]->help);
|
||||
}
|
||||
}
|
||||
|
||||
debug_command dc_man("man", "Also displays the help list", dcf_help);
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,459 @@
|
||||
#ifndef _CONSOLEPARSE_H
|
||||
#define _CONSOLEPARSE_H
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Command-line parsing functions for z64555's debug console, created for the FreeSpace Source Code project
|
||||
//
|
||||
// Portions of this source code are based on works by Volition, Inc. circa 1999. You may not sell or otherwise
|
||||
// commercially exploit the source or things you created based on the source.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @file consoleparse.h
|
||||
* @brief Parsing functions for the command line. Previously known as the command line scanner
|
||||
*
|
||||
* @details A lot of functions here are blatently copied from parselo.h :D
|
||||
*/
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
#define MAX_CLI_LEN 512
|
||||
#define MAX_TOKEN_LENGTH 255
|
||||
|
||||
enum dc_token {
|
||||
DCT_NONE = 0, //!< No token
|
||||
DCT_STRING, //!< String
|
||||
DCT_FLOAT, //!< Floating point
|
||||
DCT_INT, //!< Integral
|
||||
DCT_UINT, //!< Unsigned Integral
|
||||
DCT_BYTE, //!< Integral with values between -128 and 127
|
||||
DCT_UBYTE, //!< Integral with values between 0 and 255
|
||||
DCT_BOOL, //!< Integral or string evaluated as a boolean
|
||||
|
||||
DCT_MAX_ITEMS //!< Maximum number of dc_token elements. Primarily used as an end value in loops
|
||||
};
|
||||
|
||||
/**
|
||||
* @class errParse
|
||||
*
|
||||
* @brief Class thrown when a required token is not found
|
||||
*
|
||||
* @details This is a basic parser error, it contains the token (a single word) that was found, and the expected token
|
||||
* type. Some DCT's, such as the DCT_STRING's, have their own specific requirements for error handling, and as
|
||||
* such get their own class derived from errParse. The catching routines should be able to catch the derived error
|
||||
* objects, but if not, they can be caught by a routine looking for the base class and then be casted to their
|
||||
* proper type.
|
||||
*/
|
||||
class errParse {
|
||||
public:
|
||||
SCP_string found_token;
|
||||
dc_token expected_type;
|
||||
|
||||
/**
|
||||
* @brief Invalid/Unexpected token constructor
|
||||
* @param [in] found_str The token that was found
|
||||
* @param [in] expected_dct The token type that was expected
|
||||
*/
|
||||
errParse(const char *found_str, dc_token expected_dct)
|
||||
: found_token(found_str), expected_type(expected_dct)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @class errParseString
|
||||
*
|
||||
* @brief Class thrown when an expected string was not found. Can/should contain all of the expected strings.
|
||||
*/
|
||||
class errParseString : public errParse
|
||||
{
|
||||
public:
|
||||
SCP_vector<SCP_string> expected_tokens;
|
||||
|
||||
/**
|
||||
* @brief Invalid/Unexpected token constructor.
|
||||
*
|
||||
* @param [in] found_str The string that was found
|
||||
* @param [in] str The token that was expected
|
||||
*/
|
||||
errParseString(const char *found_str, char *str)
|
||||
: errParse(found_str, DCT_STRING)
|
||||
{
|
||||
expected_tokens.push_back(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Invalid/Unexpected token constructor.
|
||||
*
|
||||
* @param [in] found_str The string that was found
|
||||
* @param [in] str1 The first token that was expected
|
||||
* @param [in] str2 The second token that was expected
|
||||
*/
|
||||
errParseString(const char *found_str, char *str1, char *str2)
|
||||
: errParse(found_str, DCT_STRING)
|
||||
{
|
||||
expected_tokens.push_back(str1);
|
||||
expected_tokens.push_back(str2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Invalid/Unexpected token constructor.
|
||||
*
|
||||
* @param [in] found_str The string that was found
|
||||
* @param [in] strings The strings that were expected
|
||||
*/
|
||||
errParseString(const char *found_str, SCP_vector<SCP_string> &strings)
|
||||
: errParse(found_str, DCT_STRING), expected_tokens(strings)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @class errParseOverflow
|
||||
*
|
||||
* @brief Class thrown when the parsed string or token could not be stuffed into the smaller destination container
|
||||
*
|
||||
* @var found_str Contains the first 'len' valid characters.
|
||||
*/
|
||||
class errParseOverflow : public errParse
|
||||
{
|
||||
public:
|
||||
size_t len; //!< The size of the destination container
|
||||
|
||||
errParseOverflow(const char *found_str, size_t _len)
|
||||
: errParse(found_str, DCT_STRING), len(_len)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initializes the DC command line parser
|
||||
*/
|
||||
void dc_parse_init(SCP_string &str);
|
||||
|
||||
/**
|
||||
* @brief Advances the parser past whitespace characters
|
||||
*/
|
||||
void dc_ignore_white_space(void);
|
||||
|
||||
/**
|
||||
* @brief Advances the parser past grayspace characters
|
||||
*/
|
||||
void dc_ignore_gray_space(void);
|
||||
|
||||
// Required/Optional Token
|
||||
/**
|
||||
* @brief Searches for a specified required string, throwing an errParse if not found.
|
||||
*
|
||||
* @param[in] pstr The string to search for
|
||||
*
|
||||
* @throws errParseString with the required string
|
||||
*/
|
||||
void dc_required_string(char *pstr);
|
||||
|
||||
/**
|
||||
* @brief Searchs for either of the specified required strings, throwing an errParse if neither are found
|
||||
*
|
||||
* @param[in] str1 The first string to search for
|
||||
* @param[in] str2 The second string to search for
|
||||
*
|
||||
* @retval 0 if str1 was found, or
|
||||
* @retval 1 if str2 was found
|
||||
*
|
||||
* @throws errParseString with the required strings
|
||||
*/
|
||||
int dc_required_string_either(char *str1, char *str2);
|
||||
|
||||
/**
|
||||
* @brief Searches for specified required strings
|
||||
*
|
||||
* @param[in] n The number of char[] or c_str's given
|
||||
* @param[in] ... A comma delimited list of one or more required strings.
|
||||
*
|
||||
* @returns The index of the specified required strings (as if they were an array)
|
||||
*
|
||||
* @throws errParseString with the required strings
|
||||
*/
|
||||
uint dc_required_string_any(const uint n, ...);
|
||||
|
||||
/**
|
||||
* @brief Searches for an optional string
|
||||
*
|
||||
* @param[in] pstr The char[] to look for
|
||||
*
|
||||
* @retval true if the string was found,
|
||||
* @retval false otherwise
|
||||
*/
|
||||
bool dc_optional_string(const char *pstr);
|
||||
|
||||
/**
|
||||
* @brief Searches for an optional string and it's alias
|
||||
*
|
||||
* @param[in] str1 The char[] to look for
|
||||
* @param[in] str2 The alternative char[] to look for
|
||||
*
|
||||
* @retval true if the string was found,
|
||||
* @retval false otherwise
|
||||
*/
|
||||
bool dc_optional_string_either(const char *str1, const char *str2);
|
||||
|
||||
|
||||
// ==========================
|
||||
// Stuffers
|
||||
// ==========================
|
||||
|
||||
/**
|
||||
* @brief Stuffs a float to the given variable.
|
||||
*
|
||||
* @param[in] f The float variable to stuff to
|
||||
*
|
||||
* @throws errParse if an unexpected or otherwise malformed float string is found.
|
||||
* @throws errParse if nothing was found
|
||||
*/
|
||||
void dc_stuff_float(float *f);
|
||||
|
||||
/**
|
||||
* @brief Stuffs an int to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats
|
||||
*
|
||||
* @param[in] i The int variable to stuff to
|
||||
*
|
||||
* @details The binary, hexadecimal, and octal formats must be prefixed by their associated string.
|
||||
* Ex: "0xDEADBEEF" would be parsed properly while "DEADBEEF" would throw an error
|
||||
*
|
||||
* @throws errParse if an unexpected or otherwise malformed float string is found.
|
||||
* @throws errParse if nothing was found
|
||||
*/
|
||||
void dc_stuff_int(int *i);
|
||||
|
||||
/**
|
||||
* @brief Stuffs an unsigned int to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats
|
||||
*
|
||||
* @param[in] i The unsigned int variable to stuff to
|
||||
*
|
||||
* @details The binary, hexadecimal, and octal formats must be prefixed by their associated string.
|
||||
* Ex: "0xDEADBEEF" would be parsed properly while "DEADBEEF" would throw an error
|
||||
*
|
||||
* @throws errParse if an unexpected or otherwise malformed float string is found.
|
||||
* @throws errParse if nothing was found
|
||||
*/
|
||||
void dc_stuff_uint(uint *i);
|
||||
|
||||
/**
|
||||
* @brief Stuffs an unsigned byte to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats
|
||||
*
|
||||
* @param[in] i The ubyte variable to stuff to
|
||||
*
|
||||
* @details The binary, hexadecimal, and octal formats must be prefixed by their associated string.
|
||||
* Ex: "0x0F" would be parsed properly while "0F" would throw an error
|
||||
*
|
||||
* @throws errParse if an unexpected or otherwise malformed float string is found.
|
||||
* @throws errParse if nothing was found
|
||||
*/
|
||||
void dc_stuff_ubyte(ubyte *i);
|
||||
|
||||
/**
|
||||
* @brief stuffs a boolean evaluated integer or string into the given variable.
|
||||
*
|
||||
* @param[in] b The bool variable to stuff to
|
||||
*
|
||||
* @details Supports a number of literal strings as true and false, including "true", "false", "yes", "no" and the
|
||||
* yes/no equivalents in other languages supported in localization.
|
||||
* TODO: Make a static string map to handle this instead of being hard-coded
|
||||
*
|
||||
* @throws errParse if an unexpected or otherwise malformed float string is found.
|
||||
* @throws errParse if nothing was found
|
||||
*/
|
||||
void dc_stuff_boolean(bool *b);
|
||||
|
||||
/**
|
||||
* @brief stuffs a boolean evaluated integer or string into the given variable.
|
||||
*
|
||||
* @param[in] i The int variable to stuff to. 0 is false, 1 is true
|
||||
*
|
||||
* @details Supports a number of literal strings as true and false, including "true", "false", "yes", "no" and the
|
||||
* yes/no equivalents in other languages supported in localization.
|
||||
* TODO: Make a static string map to handle this instead of being hard-coded
|
||||
*
|
||||
* @throws errParse if an unexpected or otherwise malformed float string is found.
|
||||
* @throws errParse if nothing was found
|
||||
*/
|
||||
void dc_stuff_boolean(int *i);
|
||||
|
||||
/**
|
||||
* @brief Stuffs a string to out_str from the command line, stopping at the end of the command line
|
||||
*
|
||||
* @param[out] str Destination string
|
||||
* @param[in] maxlen Maximum length to copy. (maxlen <= sizeof(str)) && (maxlen <= MAX_TOKEN_LENGTH)
|
||||
*
|
||||
* @throws errParse when nothing left was found on the command line
|
||||
* @throws errParseOverflow when parser cannot stuff the entirety of the found string into out_str
|
||||
*/
|
||||
void dc_stuff_string(char *str, size_t maxlen);
|
||||
|
||||
/**
|
||||
* @brief Stuffs a string to out_str from the command line, stopping at the end of the command line
|
||||
*
|
||||
* @param[out] str Destination string
|
||||
*
|
||||
* @throws errParse when nothing left was found on the command line
|
||||
*/
|
||||
void dc_stuff_string(SCP_string &str);
|
||||
|
||||
/**
|
||||
* @brief Stuffs a whitespace delimited string to out_str from the command line, stopping at the end of the command line
|
||||
*
|
||||
* @param[out] str Destination string
|
||||
* @param[in] len Maximum length to copy. (len <= sizeof(str)) && (len <= MAX_TOKEN_LENGTH)
|
||||
*
|
||||
* @throws errParse when nothing left was found on the command line
|
||||
* @throws errParseOverflow when parser cannot stuff the entirety of the found string into out_str
|
||||
*/
|
||||
void dc_stuff_string_white(char *str, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Stuffs a whitespace delimited string to out_str from the command line, stopping at the end of the command line
|
||||
*
|
||||
* @param[out] str Destination string
|
||||
*
|
||||
* @throws errParse when nothing left was found on the command line
|
||||
*/
|
||||
void dc_stuff_string_white(SCP_string &str);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff a float from the Command_string.
|
||||
*
|
||||
* @param[in] f The float variable to maybe stuff.
|
||||
*
|
||||
* @details
|
||||
* If there's nothing on the command line, *f = 0 and false is returned
|
||||
*
|
||||
* If there's something on the command line, and we're able to convert it, *f = the converted value, true is
|
||||
* returned, and the parser is advanced past the token
|
||||
*
|
||||
* If there's something on command line, but we can't convert it, an errParse is thrown
|
||||
*/
|
||||
bool dc_maybe_stuff_float(float *f);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff an int from the Command_string.
|
||||
*
|
||||
* @param[in] i The int variable to maybe stuff.
|
||||
*
|
||||
* @details
|
||||
* If there's nothing on the command line, *i = 0 and false is returned
|
||||
*
|
||||
* If there's something on the command line, and we're able to convert it, *i = the converted value, true is
|
||||
* returned, and the parser is advanced past the token
|
||||
*
|
||||
* If there's something on command line, but we can't convert it, an errParse is thrown
|
||||
*/
|
||||
bool dc_maybe_stuff_int(int *i);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff an uint from the Command_string.
|
||||
*
|
||||
* @param[in] i The uint variable to maybe stuff.
|
||||
*
|
||||
* @details
|
||||
* If there's nothing on the command line, *i = 0 and false is returned
|
||||
*
|
||||
* If there's something on the command line, and we're able to convert it, *i = the converted value, true is
|
||||
* returned, and the parser is advanced past the token
|
||||
*
|
||||
* If there's something on command line, but we can't convert it, an errParse is thrown
|
||||
*/
|
||||
bool dc_maybe_stuff_uint(uint *i);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff an ubyte from the Command_string.
|
||||
*
|
||||
* @param[in] i The ubyte variable to maybe stuff.
|
||||
*
|
||||
* @details
|
||||
* If there's nothing on the command line, *i = 0 and false is returned
|
||||
*
|
||||
* If there's something on the command line, and we're able to convert it, *i = the converted value, true is
|
||||
* returned, and the parser is advanced past the token
|
||||
*
|
||||
* If there's something on command line, but we can't convert it, an errParse is thrown
|
||||
*/
|
||||
bool dc_maybe_stuff_ubyte(ubyte *i);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff a bool from the Command_string.
|
||||
*
|
||||
* @param[in] b The bool variable to maybe stuff.
|
||||
*
|
||||
* @details
|
||||
* If there's nothing on the command line, *b = false and false is returned
|
||||
*
|
||||
* If there's something on the command line, and we're able to convert it, *b = the converted value, true is
|
||||
* returned, and the parser is advanced past the token
|
||||
*
|
||||
* If there's something on command line, but we can't convert it, an errParse is thrown
|
||||
*/
|
||||
bool dc_maybe_stuff_boolean(bool *b);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff an int with a bool value from the Command_string.
|
||||
*
|
||||
* @param[in] i The int variable to maybe stuff.
|
||||
*
|
||||
* @details
|
||||
* If there's nothing on the command line, *i = 0 and false is returned
|
||||
*
|
||||
* If there's something on the command line, and we're able to convert it, *i = the converted value, true is
|
||||
* returned, and the parser is advanced past the token
|
||||
*
|
||||
* If there's something on command line, but we can't convert it, an errParse is thrown
|
||||
*/
|
||||
bool dc_maybe_stuff_boolean(int *i);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff a string to out_str from the command line, stopping at the end of the command line
|
||||
*
|
||||
* @param[out] str Destination string. If nothing was found, str = ""
|
||||
* @param[in] len Maximum length to copy. (len <= sizeof(str)) && (len <= MAX_TOKEN_LENGTH)
|
||||
*
|
||||
* @retval true if the operation was successful,
|
||||
* @retval false otherwise
|
||||
*
|
||||
* @throws errParseOverflow when parser cannot stuff the entirety of the found string into out_str
|
||||
*/
|
||||
bool dc_maybe_stuff_string(char *str, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff a string to out_str from the command line, stopping at the end of the command line
|
||||
*
|
||||
* @param[out] str Destination string. If nothing was found, str = ""
|
||||
*
|
||||
* @retval true if the operation was successful,
|
||||
* @retval false otherwise
|
||||
*/
|
||||
bool dc_maybe_stuff_string(SCP_string &str);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff a whitespace delimited string to out_str from the command line, stopping at the end of the command line
|
||||
*
|
||||
* @param[out] str Destination string. If nothing was found, str = ""
|
||||
* @param[in] len Maximum length to copy. (maxlen <= sizeof(str)) && (maxlen <= MAX_TOKEN_LENGTH)
|
||||
*
|
||||
* @retval true if the operation was successful,
|
||||
* @retval false otherwise
|
||||
*
|
||||
* @throws errParseOverflow when parser cannot stuff the entirety of the found string into out_str
|
||||
*/
|
||||
bool dc_maybe_stuff_string_white(char *str, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Tries to stuff a whitespace delimited string to out_str from the command line, stopping at the end of the command line
|
||||
*
|
||||
* @param[out] str Destination string. If nothing was found, str = ""
|
||||
*
|
||||
* @retval true if the operation was successful,
|
||||
* @retval false otherwise
|
||||
*/
|
||||
bool dc_maybe_stuff_string_white(SCP_string &str);
|
||||
|
||||
#endif // _CONSOLEPARSE_H
|
||||
@@ -4,7 +4,7 @@
|
||||
* 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
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
|
||||
// Internal structure for handling frame data
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
LARGE_INTEGER start_value;
|
||||
LARGE_INTEGER total_value;
|
||||
@@ -101,7 +101,7 @@ void timerbar_start_frame()
|
||||
|
||||
if(QueryPerformanceCounter(&timerbar_ultimate_start_value) == FALSE)
|
||||
{
|
||||
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
draw_func_ptr = NULL;
|
||||
}
|
||||
|
||||
@@ -125,8 +125,8 @@ 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,
|
||||
|
||||
draw_func_ptr(colour,
|
||||
fxpos / WIDTHF,
|
||||
yrow * 0.01f,
|
||||
fxwidth / WIDTHF,
|
||||
@@ -151,8 +151,8 @@ void timerbar_end_frame()
|
||||
|
||||
|
||||
for(int i = 0; i < MAX_NUM_TIMERBARS; i++)
|
||||
{
|
||||
// Nothing to render this frame
|
||||
{
|
||||
// Nothing to render this frame
|
||||
if(profiles[i].frame_total.QuadPart == 0)
|
||||
{
|
||||
continue;
|
||||
@@ -206,22 +206,22 @@ void timerbar_switch_type(int num)
|
||||
LARGE_INTEGER now;
|
||||
if(QueryPerformanceCounter(&now) == FALSE)
|
||||
{
|
||||
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
}
|
||||
|
||||
profiles[timerbar_current_profile].frame_total.QuadPart +=
|
||||
(now.QuadPart - timerbar_last_start_value.QuadPart);
|
||||
(now.QuadPart - timerbar_last_start_value.QuadPart);
|
||||
|
||||
if(num != -1)
|
||||
{
|
||||
// Switch to new profile
|
||||
timerbar_current_profile = num;
|
||||
timerbar_current_profile = num;
|
||||
}
|
||||
|
||||
// Update time to count from
|
||||
if(QueryPerformanceCounter(&timerbar_last_start_value) == FALSE)
|
||||
{
|
||||
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +234,6 @@ void timerbar_switch_type(int num)
|
||||
*/
|
||||
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;
|
||||
draw_func_ptr = new_draw_func_ptr;
|
||||
}
|
||||
|
||||
@@ -157,18 +157,14 @@ static void fireball_set_default_color(int idx)
|
||||
*
|
||||
* NOTE: we can't be too trusting here so a tbm will only modify the LOD count, not add an entry
|
||||
*/
|
||||
void parse_fireball_tbl(char *filename)
|
||||
void parse_fireball_tbl(const char *filename)
|
||||
{
|
||||
int rval;
|
||||
lod_checker lod_check;
|
||||
color fb_color;
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
|
||||
lcl_ext_close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -241,9 +237,6 @@ void parse_fireball_tbl(char *filename)
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
void fireball_parse_tbl()
|
||||
@@ -381,7 +374,9 @@ void fireball_render(object * obj)
|
||||
|
||||
MONITOR_INC( NumFireballsRend, 1 );
|
||||
|
||||
num = obj->instance;
|
||||
memset(&p, 0, sizeof(p));
|
||||
|
||||
num = obj->instance;
|
||||
fb = &Fireballs[num];
|
||||
|
||||
if ( Fireballs[num].current_bitmap < 0 )
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
struct object;
|
||||
struct ship_info;
|
||||
class object;
|
||||
class ship_info;
|
||||
class asteroid_info;
|
||||
|
||||
// values correspond to the fireball render types
|
||||
|
||||
@@ -58,6 +58,7 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
|
||||
vm_vec_scale_add( ¢er, pos, &orient->vec.fvec, -(max_radius/2.5f)/3.0f );
|
||||
|
||||
memset(verts, 0, sizeof(verts));
|
||||
|
||||
if (Warp_glow_bitmap >= 0) {
|
||||
float r = radius;
|
||||
|
||||
@@ -176,7 +176,7 @@ void AltShipClassDlg::alt_class_list_rebuild()
|
||||
m_alt_class_list.AddString(Ship_info[alt_class_pool[i].ship_class].name);
|
||||
}
|
||||
else {
|
||||
m_alt_class_list.AddString("Invalid Ship Class");
|
||||
m_alt_class_list.AddString("Invalid Ship Class");
|
||||
Int3();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ FictionViewerDlg::FictionViewerDlg(CWnd* pParent /*=NULL*/)
|
||||
//{{AFX_DATA_INIT(FictionViewerDlg)
|
||||
m_story_file = _T("");
|
||||
m_font_file = _T("");
|
||||
m_voice_file = _T("");
|
||||
m_fiction_music = 0;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
@@ -33,6 +34,7 @@ void FictionViewerDlg::DoDataExchange(CDataExchange* pDX)
|
||||
//{{AFX_DATA_MAP(FictionViewerDlg)
|
||||
DDX_Text(pDX, IDC_STORY_FILE, m_story_file);
|
||||
DDX_Text(pDX, IDC_FONT_FILE, m_font_file);
|
||||
DDX_Text(pDX, IDC_VOICE_FILE, m_voice_file);
|
||||
DDX_CBIndex(pDX, IDC_FICTION_MUSIC, m_fiction_music);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
@@ -60,6 +62,7 @@ BOOL FictionViewerDlg::OnInitDialog()
|
||||
// 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();
|
||||
@@ -73,7 +76,7 @@ void FictionViewerDlg::OnOK()
|
||||
|
||||
// load it up
|
||||
fiction_viewer_reset();
|
||||
fiction_viewer_load((char *)(LPCSTR) m_story_file, (char *)(LPCSTR) m_font_file);
|
||||
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;
|
||||
@@ -111,5 +114,6 @@ void FictionViewerDlg::OnClose()
|
||||
|
||||
int FictionViewerDlg::query_modified()
|
||||
{
|
||||
return strcmp(m_story_file, fiction_file()) || strcmp(m_font_file, fiction_font()) || 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);
|
||||
}
|
||||
@@ -24,6 +24,7 @@ public:
|
||||
enum { IDD = IDD_FICTION_VIEWER };
|
||||
CString m_story_file;
|
||||
CString m_font_file;
|
||||
CString m_voice_file;
|
||||
int m_fiction_music;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
@@ -233,6 +233,15 @@ void bg_bitmap_dlg::create()
|
||||
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 + 359;
|
||||
if (m_skybox_bank < 0)
|
||||
m_skybox_bank = m_skybox_bank + 359;
|
||||
if (m_skybox_heading < 0)
|
||||
m_skybox_heading = m_skybox_heading + 359;
|
||||
|
||||
|
||||
for(i=0; i<MAX_NEB2_BITMAPS; i++){
|
||||
if(strlen(Neb2_bitmap_filenames[i]) > 0){ //-V805
|
||||
((CComboBox*)GetDlgItem(IDC_NEB2_TEXTURE))->AddString(Neb2_bitmap_filenames[i]);
|
||||
|
||||
@@ -76,6 +76,8 @@ briefing_editor_dlg::briefing_editor_dlg(CWnd* pParent /*=NULL*/)
|
||||
m_cut_prev = FALSE;
|
||||
m_current_briefing = -1;
|
||||
m_flipicon = FALSE;
|
||||
m_use_wing = FALSE;
|
||||
m_use_cargo = FALSE;
|
||||
//}}AFX_DATA_INIT
|
||||
m_voice_id = -1;
|
||||
m_cur_stage = 0;
|
||||
@@ -109,6 +111,8 @@ void briefing_editor_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_CUT_NEXT, m_cut_next);
|
||||
DDX_Check(pDX, IDC_CUT_PREV, m_cut_prev);
|
||||
DDX_Check(pDX, IDC_FLIP_ICON, m_flipicon);
|
||||
DDX_Check(pDX, IDC_USE_WING_ICON, m_use_wing);
|
||||
DDX_Check(pDX, IDC_USE_CARGO_ICON, m_use_cargo);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
DDV_MaxChars(pDX, m_voice, MAX_FILENAME_LEN - 1);
|
||||
@@ -131,6 +135,7 @@ BEGIN_MESSAGE_MAP(briefing_editor_dlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_SAVE_VIEW, OnSaveView)
|
||||
ON_CBN_SELCHANGE(IDC_ICON_IMAGE, OnSelchangeIconImage)
|
||||
ON_CBN_SELCHANGE(IDC_TEAM, OnSelchangeTeam)
|
||||
ON_CBN_SELCHANGE(IDC_SHIP_TYPE, OnSelchangeShipType)
|
||||
ON_BN_CLICKED(IDC_PROPAGATE_ICONS, OnPropagateIcons)
|
||||
ON_WM_INITMENU()
|
||||
ON_BN_CLICKED(IDC_LINES, OnLines)
|
||||
@@ -141,6 +146,8 @@ BEGIN_MESSAGE_MAP(briefing_editor_dlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_COPY_VIEW, OnCopyView)
|
||||
ON_BN_CLICKED(IDC_PASTE_VIEW, OnPasteView)
|
||||
ON_BN_CLICKED(IDC_FLIP_ICON, OnFlipIcon)
|
||||
ON_BN_CLICKED(IDC_USE_WING_ICON, OnWingIcon)
|
||||
ON_BN_CLICKED(IDC_USE_CARGO_ICON, OnCargoIcon)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
@@ -181,7 +188,7 @@ void briefing_editor_dlg::create()
|
||||
CDialog::Create(IDD);
|
||||
theApp.init_window(&Briefing_wnd_data, this);
|
||||
box = (CComboBox *) GetDlgItem(IDC_ICON_IMAGE);
|
||||
for (i=0; i<MAX_BRIEF_ICONS; i++)
|
||||
for (i=0; i<MIN_BRIEF_ICONS; i++)
|
||||
box->AddString(Icon_names[i]);
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_TEAM);
|
||||
@@ -432,6 +439,7 @@ void briefing_editor_dlg::update_data(int update)
|
||||
}
|
||||
|
||||
strcpy_s(ptr->icons[m_last_icon].label, buf);
|
||||
|
||||
if ( m_hilight )
|
||||
ptr->icons[m_last_icon].flags |= BI_HIGHLIGHT;
|
||||
else
|
||||
@@ -442,30 +450,40 @@ void briefing_editor_dlg::update_data(int update)
|
||||
else
|
||||
ptr->icons[m_last_icon].flags &= ~BI_MIRROR_ICON;
|
||||
|
||||
if (m_use_wing)
|
||||
ptr->icons[m_last_icon].flags |= BI_USE_WING_ICON;
|
||||
else
|
||||
ptr->icons[m_last_icon].flags &= ~BI_USE_WING_ICON;
|
||||
|
||||
if (m_use_cargo)
|
||||
ptr->icons[m_last_icon].flags |= BI_USE_CARGO_ICON;
|
||||
else
|
||||
ptr->icons[m_last_icon].flags &= ~BI_USE_CARGO_ICON;
|
||||
|
||||
if ((ptr->icons[m_last_icon].type != m_icon_image) && !m_change_local) {
|
||||
set_modified();
|
||||
reset_icon_loop(m_last_stage);
|
||||
while (get_next_icon(m_id))
|
||||
iconp->type = m_icon_image;
|
||||
}
|
||||
|
||||
ptr->icons[m_last_icon].type = m_icon_image;
|
||||
|
||||
if ((ptr->icons[m_last_icon].team != m_icon_team) && !m_change_local) {
|
||||
set_modified();
|
||||
reset_icon_loop(m_last_stage);
|
||||
while (get_next_icon(m_id))
|
||||
iconp->team = m_icon_team;
|
||||
}
|
||||
|
||||
ptr->icons[m_last_icon].team = m_icon_team;
|
||||
|
||||
if ((ptr->icons[m_last_icon].ship_class != m_ship_type) && !m_change_local) {
|
||||
set_modified();
|
||||
reset_icon_loop(m_last_stage);
|
||||
while (get_next_icon(m_id))
|
||||
iconp->ship_class = m_ship_type;
|
||||
}
|
||||
|
||||
MODIFY(ptr->icons[m_last_icon].ship_class, m_ship_type);
|
||||
|
||||
deconvert_multiline_string(buf2, m_icon_text, MAX_ICON_TEXT_LEN);
|
||||
/*
|
||||
if (stricmp(ptr->icons[m_last_icon].text, buf2) && !m_change_local) {
|
||||
@@ -544,6 +562,8 @@ void briefing_editor_dlg::update_data(int update)
|
||||
if ((m_cur_stage >= 0) && (m_cur_icon >= 0) && (m_cur_icon < ptr->num_icons)) {
|
||||
m_hilight = (ptr->icons[m_cur_icon].flags & BI_HIGHLIGHT)?1:0;
|
||||
m_flipicon = (ptr->icons[m_cur_icon].flags & BI_MIRROR_ICON)?1:0;
|
||||
m_use_wing = (ptr->icons[m_cur_icon].flags & BI_USE_WING_ICON)?1:0;
|
||||
m_use_cargo = (ptr->icons[m_cur_icon].flags & BI_USE_CARGO_ICON)?1:0;
|
||||
m_icon_image = ptr->icons[m_cur_icon].type;
|
||||
m_icon_team = ptr->icons[m_cur_icon].team;
|
||||
m_icon_label = ptr->icons[m_cur_icon].label;
|
||||
@@ -555,6 +575,8 @@ void briefing_editor_dlg::update_data(int update)
|
||||
} else {
|
||||
m_flipicon = FALSE;
|
||||
m_hilight = FALSE;
|
||||
m_use_wing = FALSE;
|
||||
m_use_cargo = FALSE;
|
||||
m_icon_image = -1;
|
||||
m_icon_team = -1;
|
||||
m_ship_type = -1;
|
||||
@@ -564,12 +586,23 @@ void briefing_editor_dlg::update_data(int update)
|
||||
enable = FALSE;
|
||||
}
|
||||
|
||||
// see if icon is overridden by ships.tbl
|
||||
// if so, disable the icon type box
|
||||
int sip_bii_ship = (m_ship_type >= 0) ? Ship_info[m_ship_type].bii_index_ship : -1;
|
||||
int sip_bii_wing = (sip_bii_ship >= 0) ? Ship_info[m_ship_type].bii_index_wing : -1;
|
||||
int sip_bii_cargo = (sip_bii_ship >= 0) ? Ship_info[m_ship_type].bii_index_ship_with_cargo : -1;
|
||||
|
||||
GetDlgItem(IDC_USE_WING_ICON) -> ShowWindow(sip_bii_wing >= 0);
|
||||
GetDlgItem(IDC_USE_CARGO_ICON) -> ShowWindow(sip_bii_cargo >= 0);
|
||||
|
||||
GetDlgItem(IDC_ICON_TEXT) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_ICON_LABEL) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_ICON_IMAGE) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_ICON_IMAGE) -> EnableWindow(enable && (sip_bii_ship < 0));
|
||||
GetDlgItem(IDC_SHIP_TYPE) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_HILIGHT) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_FLIP_ICON) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_USE_WING_ICON) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_USE_CARGO_ICON) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_LOCAL) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_TEAM) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_ID) -> EnableWindow(enable);
|
||||
@@ -1201,6 +1234,11 @@ void briefing_editor_dlg::OnSelchangeTeam()
|
||||
update_data(1);
|
||||
}
|
||||
|
||||
void briefing_editor_dlg::OnSelchangeShipType()
|
||||
{
|
||||
update_data(1);
|
||||
}
|
||||
|
||||
int briefing_editor_dlg::check_mouse_hit(int x, int y)
|
||||
{
|
||||
int i;
|
||||
@@ -1399,10 +1437,15 @@ void briefing_editor_dlg::OnPasteView()
|
||||
|
||||
void briefing_editor_dlg::OnFlipIcon()
|
||||
{
|
||||
// if (m_flipicon)
|
||||
// Briefing->stages[m_cur_stage].icons[m_cur_icon].flags |= BI_MIRROR_ICON;
|
||||
// else
|
||||
// Briefing->stages[m_cur_stage].icons[m_cur_icon].flags &= ~BI_MIRROR_ICON;
|
||||
update_data(1);
|
||||
}
|
||||
|
||||
void briefing_editor_dlg::OnWingIcon()
|
||||
{
|
||||
update_data(1);
|
||||
|
||||
}
|
||||
|
||||
void briefing_editor_dlg::OnCargoIcon()
|
||||
{
|
||||
update_data(1);
|
||||
}
|
||||
@@ -66,6 +66,8 @@ public:
|
||||
BOOL m_cut_prev;
|
||||
int m_current_briefing;
|
||||
BOOL m_flipicon;
|
||||
BOOL m_use_wing;
|
||||
BOOL m_use_cargo;
|
||||
//}}AFX_DATA
|
||||
|
||||
CBitmap m_play_bm;
|
||||
@@ -120,6 +122,7 @@ protected:
|
||||
afx_msg void OnSaveView();
|
||||
afx_msg void OnSelchangeIconImage();
|
||||
afx_msg void OnSelchangeTeam();
|
||||
afx_msg void OnSelchangeShipType();
|
||||
afx_msg void OnPropagateIcons();
|
||||
afx_msg void OnInitMenu(CMenu* pMenu);
|
||||
afx_msg void OnLines();
|
||||
@@ -130,6 +133,8 @@ protected:
|
||||
afx_msg void OnCopyView();
|
||||
afx_msg void OnPasteView();
|
||||
afx_msg void OnFlipIcon();
|
||||
afx_msg void OnWingIcon();
|
||||
afx_msg void OnCargoIcon();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
|
||||
@@ -246,7 +246,6 @@ void campaign_editor::initialize( int init_files )
|
||||
void campaign_editor::mission_selected(int num)
|
||||
{
|
||||
CEdit *bc_dialog, *bc_hall, *bc_persona;
|
||||
char mainhalltext[10];
|
||||
char personatext[10];
|
||||
|
||||
bc_dialog = (CEdit *) GetDlgItem(IDC_BRIEFING_CUTSCENE);
|
||||
@@ -259,8 +258,7 @@ void campaign_editor::mission_selected(int num)
|
||||
bc_dialog->SetWindowText(Campaign.missions[num].briefing_cutscene);
|
||||
|
||||
// new main hall stuff
|
||||
sprintf(mainhalltext, "%s", const_cast<char*>(Campaign.missions[num].main_hall.c_str()));
|
||||
bc_hall->SetWindowText(CString(mainhalltext));
|
||||
bc_hall->SetWindowText(Campaign.missions[num].main_hall.c_str());
|
||||
|
||||
// new debriefing persona stuff
|
||||
sprintf(personatext, "%d", Campaign.missions[num].debrief_persona_index);
|
||||
|
||||
+28
-25
@@ -20,6 +20,7 @@
|
||||
#include "cfile/cfile.h"
|
||||
#include "sound/audiostr.h"
|
||||
#include "localization/localize.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
@@ -61,12 +62,12 @@ event_editor::event_editor(CWnd* pParent /*=NULL*/)
|
||||
m_wave_id = -1;
|
||||
m_log_true = 0;
|
||||
m_log_false = 0;
|
||||
m_log_always_true = 0;
|
||||
m_log_always_false = 0;
|
||||
m_log_1st_repeat = 0;
|
||||
m_log_last_repeat = 0;
|
||||
m_log_1st_trigger = 0;
|
||||
m_log_last_trigger = 0;
|
||||
m_log_state_change = 0;
|
||||
}
|
||||
|
||||
void event_editor::DoDataExchange(CDataExchange* pDX)
|
||||
@@ -90,12 +91,12 @@ void event_editor::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_LBIndex(pDX, IDC_MESSAGE_LIST, m_cur_msg);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_TRUE, m_log_true);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_FALSE, m_log_false);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_ALWAYS_TRUE, m_log_always_true);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_ALWAYS_FALSE, m_log_always_false);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_1ST_REPEAT, m_log_1st_repeat);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_LAST_REPEAT, m_log_last_repeat);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_1ST_TRIGGER, m_log_1st_trigger);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_LAST_TRIGGER, m_log_last_trigger);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_STATE_CHANGE, m_log_state_change);
|
||||
|
||||
|
||||
// m_team == -1 maps to 2
|
||||
@@ -222,21 +223,23 @@ BOOL event_editor::OnInitDialog()
|
||||
}
|
||||
}
|
||||
|
||||
// add new heads, if not already in
|
||||
maybe_add_head(box, "Head-TP2");
|
||||
maybe_add_head(box, "Head-VC2");
|
||||
maybe_add_head(box, "Head-TP4");
|
||||
maybe_add_head(box, "Head-TP5");
|
||||
maybe_add_head(box, "Head-TP6");
|
||||
maybe_add_head(box, "Head-TP7");
|
||||
maybe_add_head(box, "Head-TP8");
|
||||
maybe_add_head(box, "Head-VP2");
|
||||
maybe_add_head(box, "Head-VP2");
|
||||
maybe_add_head(box, "Head-CM2");
|
||||
maybe_add_head(box, "Head-CM3");
|
||||
maybe_add_head(box, "Head-CM4");
|
||||
maybe_add_head(box, "Head-CM5");
|
||||
maybe_add_head(box, "Head-BSH");
|
||||
if (!Disable_hc_message_ani) {
|
||||
maybe_add_head(box, "Head-TP2");
|
||||
maybe_add_head(box, "Head-VC2");
|
||||
maybe_add_head(box, "Head-TP4");
|
||||
maybe_add_head(box, "Head-TP5");
|
||||
maybe_add_head(box, "Head-TP6");
|
||||
maybe_add_head(box, "Head-TP7");
|
||||
maybe_add_head(box, "Head-TP8");
|
||||
maybe_add_head(box, "Head-VP2");
|
||||
maybe_add_head(box, "Head-VP2");
|
||||
maybe_add_head(box, "Head-CM2");
|
||||
maybe_add_head(box, "Head-CM3");
|
||||
maybe_add_head(box, "Head-CM4");
|
||||
maybe_add_head(box, "Head-CM5");
|
||||
maybe_add_head(box, "Head-BSH");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
box->AddString("Head-VC"); // force it in, since Sandeep wants it and it's not used in built-in messages
|
||||
@@ -900,8 +903,6 @@ void event_editor::save_event(int e)
|
||||
m_events[e].mission_log_flags |= MLF_SEXP_TRUE;
|
||||
if (m_log_false)
|
||||
m_events[e].mission_log_flags |= MLF_SEXP_FALSE;
|
||||
if (m_log_always_true)
|
||||
m_events[e].mission_log_flags |= MLF_SEXP_KNOWN_TRUE;
|
||||
if (m_log_always_false)
|
||||
m_events[e].mission_log_flags |= MLF_SEXP_KNOWN_FALSE;
|
||||
if (m_log_1st_repeat)
|
||||
@@ -912,6 +913,8 @@ void event_editor::save_event(int e)
|
||||
m_events[e].mission_log_flags |= MLF_FIRST_TRIGGER_ONLY;
|
||||
if (m_log_last_trigger)
|
||||
m_events[e].mission_log_flags |= MLF_LAST_TRIGGER_ONLY;
|
||||
if (m_log_state_change)
|
||||
m_events[e].mission_log_flags |= MLF_STATE_CHANGE;
|
||||
|
||||
|
||||
// Search for item to update
|
||||
@@ -1046,11 +1049,6 @@ void event_editor::update_cur_event()
|
||||
}else {
|
||||
m_log_false = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_SEXP_KNOWN_TRUE) {
|
||||
m_log_always_true = TRUE;
|
||||
}else {
|
||||
m_log_always_true = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_SEXP_KNOWN_FALSE) {
|
||||
m_log_always_false = TRUE;
|
||||
}else {
|
||||
@@ -1076,6 +1074,11 @@ void event_editor::update_cur_event()
|
||||
}else {
|
||||
m_log_last_trigger = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_STATE_CHANGE) {
|
||||
m_log_state_change = TRUE;
|
||||
}else {
|
||||
m_log_state_change = FALSE;
|
||||
}
|
||||
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
@@ -1231,7 +1234,7 @@ int event_editor::save_message(int num)
|
||||
}
|
||||
|
||||
string_copy(m_messages[num].message, m_message_text, MESSAGE_LENGTH - 1);
|
||||
lcl_fred_replace_stuff(m_messages[num].message, MESSAGE_LENGTH);
|
||||
lcl_fred_replace_stuff(m_messages[num].message, MESSAGE_LENGTH - 1);
|
||||
if (m_messages[num].avi_info.name){
|
||||
free(m_messages[num].avi_info.name);
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ public:
|
||||
int m_last_message_node;
|
||||
int m_log_true;
|
||||
int m_log_false;
|
||||
int m_log_always_true;
|
||||
int m_log_always_false;
|
||||
int m_log_1st_repeat;
|
||||
int m_log_last_repeat;
|
||||
int m_log_1st_trigger;
|
||||
int m_log_last_trigger;
|
||||
int m_log_state_change;
|
||||
//}}AFX_DATA
|
||||
|
||||
CBitmap m_play_bm;
|
||||
|
||||
+1
-1
@@ -676,7 +676,7 @@ void CFREDApp::record_window_data(window_data *wndd, CWnd *wnd)
|
||||
|
||||
void CAboutDlg::OnBug()
|
||||
{
|
||||
char *path = "http://mgo.maxgaming.net/mantis/login_page.php";
|
||||
char *path = "http://scp.indiegames.us/mantis/";
|
||||
|
||||
char buffer[MAX_PATH];
|
||||
sprintf(buffer,"explorer.exe \"%s\"", path);
|
||||
|
||||
+232
-219
File diff suppressed because it is too large.
Load diff
+1
-85
@@ -79,7 +79,6 @@ BEGIN_MESSAGE_MAP(CFREDDoc, CDocument)
|
||||
ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
|
||||
ON_COMMAND(ID_FILE_PREFERENCES, OnFilePreferences)
|
||||
ON_COMMAND(ID_FILE_IMPORT_FSM, OnFileImportFSM)
|
||||
ON_COMMAND(ID_FILE_IMPORT_WEAPONS, OnFileImportWeapons)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
@@ -404,7 +403,7 @@ int CFREDDoc::load_mission(char *pathname, int flags)
|
||||
// fix old ship names for ships in wings if needed
|
||||
while (j--) {
|
||||
if ( (Objects[wing_objects[i][j]].type == OBJ_SHIP) || (Objects[wing_objects[i][j]].type == OBJ_START) ) { // don't change player ship names
|
||||
sprintf(name, "%s %d", Wings[i].name, j + 1);
|
||||
wing_bash_ship_name(name, Wings[i].name, j + 1);
|
||||
old_name = Ships[Wings[i].ship_index[j]].ship_name;
|
||||
if (stricmp(name, old_name)) { // need to fix name
|
||||
update_sexp_references(old_name, name);
|
||||
@@ -1015,89 +1014,6 @@ void CFREDDoc::OnFileImportFSM()
|
||||
recreate_dialogs();
|
||||
}
|
||||
|
||||
void restore_default_weapons(char *ships_tbl);
|
||||
|
||||
void CFREDDoc::OnFileImportWeapons()
|
||||
{
|
||||
int rval;
|
||||
CString ships_tbl_mfc;
|
||||
char ships_tbl[MAX_PATH_LEN];
|
||||
char *ships_tbl_text;
|
||||
char *ships_tbl_text_raw;
|
||||
char *ch;
|
||||
char temp[MAX_PATH_LEN];
|
||||
char error_str[1024];
|
||||
|
||||
// set up import dialog
|
||||
CFileDialog dlg(TRUE, "tbl", NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, "FreeSpace Tables (*.tbl)|*.tbl|All files (*.*)|*.*||");
|
||||
dlg.m_ofn.lpstrTitle = "Specify the ships.tbl with the required loadouts";
|
||||
|
||||
// set initial path
|
||||
strcpy_s(temp, Fred_exe_dir);
|
||||
if ((ch = stristr(temp, "FreeSpace2")) != NULL)
|
||||
{
|
||||
strcpy(ch, "FreeSpace\\Data\\Tables");
|
||||
dlg.m_ofn.lpstrInitialDir = temp;
|
||||
}
|
||||
|
||||
// get ships.tbl
|
||||
if (dlg.DoModal() != IDOK)
|
||||
return;
|
||||
|
||||
ships_tbl_mfc = dlg.GetPathName();
|
||||
|
||||
if (strlen(ships_tbl_mfc) > MAX_PATH_LEN - 1)
|
||||
{
|
||||
MessageBox(NULL, "Path name is too long", "Error", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strlen(ships_tbl_mfc))
|
||||
return;
|
||||
|
||||
strcpy_s(ships_tbl, ships_tbl_mfc);
|
||||
|
||||
// allocate junk
|
||||
ships_tbl_text = (char *) malloc(sizeof(char) * MISSION_TEXT_SIZE);
|
||||
ships_tbl_text_raw = (char *) malloc(sizeof(char) * MISSION_TEXT_SIZE);
|
||||
if (!ships_tbl_text || !ships_tbl_text_raw)
|
||||
{
|
||||
free(ships_tbl_text);
|
||||
free(ships_tbl_text_raw);
|
||||
|
||||
Error(LOCATION, "Not enough memory to import weapons.");
|
||||
return;
|
||||
}
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("FREDDOC: Unable to parse '%s'! Error code = %i.\n", ships_tbl, rval));
|
||||
sprintf(error_str, "Could not parse file: %s", ships_tbl);
|
||||
|
||||
MessageBox(NULL, error_str, "Unable to import weapon loadouts!", MB_ICONERROR | MB_OK);
|
||||
lcl_ext_close();
|
||||
return;
|
||||
}
|
||||
|
||||
// load the other table and convert, freeing memory after use
|
||||
read_file_text(ships_tbl, CF_TYPE_ANY, ships_tbl_text, ships_tbl_text_raw);
|
||||
free(ships_tbl_text_raw);
|
||||
restore_default_weapons(ships_tbl_text);
|
||||
free(ships_tbl_text);
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
|
||||
// we haven't saved it yet
|
||||
set_modified(TRUE);
|
||||
|
||||
// error check and notify
|
||||
if (!Fred_view_wnd->global_error_check())
|
||||
Fred_view_wnd->MessageBox("Weapon loadouts successfully imported with no errors.", "Woohoo!");
|
||||
}
|
||||
|
||||
void CFREDDoc::recreate_dialogs()
|
||||
{
|
||||
if(Briefing_dialog)
|
||||
|
||||
@@ -89,7 +89,6 @@ protected:
|
||||
afx_msg void OnFileNew();
|
||||
afx_msg void editor_init_mission();
|
||||
afx_msg void OnFileImportFSM();
|
||||
afx_msg void OnFileImportWeapons();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "graphics/font.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
|
||||
extern float flFrametime;
|
||||
extern subsys_to_render Render_subsys;
|
||||
@@ -141,7 +142,7 @@ color colour_yellow;
|
||||
void fred_enable_htl()
|
||||
{
|
||||
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( (4.0f/9.0f) * PI * FRED_BRIEFING_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);
|
||||
}
|
||||
|
||||
@@ -407,7 +408,7 @@ void render_waypoints(void)
|
||||
vertex v;
|
||||
|
||||
SCP_list<waypoint_list>::iterator ii;
|
||||
SCP_list<waypoint>::iterator jj;
|
||||
SCP_vector<waypoint>::iterator jj;
|
||||
|
||||
for (ii = Waypoint_lists.begin(); ii != Waypoint_lists.end(); ++ii)
|
||||
{
|
||||
@@ -1488,7 +1489,11 @@ void render_frame()
|
||||
gr_set_font(FONT1);
|
||||
light_reset();
|
||||
|
||||
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
|
||||
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();
|
||||
@@ -1593,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, 0.5f);
|
||||
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()
|
||||
@@ -1857,6 +1866,7 @@ void draw_asteroid_field()
|
||||
int object_check_collision(object *objp, vec3d *p0, vec3d *p1, vec3d *hitpos)
|
||||
{
|
||||
mc_info mc;
|
||||
mc_info_init(&mc);
|
||||
|
||||
if ((objp->type == OBJ_NONE) || (objp->type == OBJ_POINT))
|
||||
return 0;
|
||||
|
||||
@@ -31,7 +31,7 @@ int Multi_ping_timestamp = -1;
|
||||
int Sun_drew = 0;
|
||||
int Networking_disabled = 0;
|
||||
|
||||
void init_ets(struct object*){}
|
||||
void init_ets(class object*){}
|
||||
|
||||
control_info PlayerControls;
|
||||
|
||||
@@ -157,7 +157,7 @@ char demo_read_char() { return 0; }
|
||||
|
||||
int red_alert_default_status() {return 0;}
|
||||
|
||||
void send_ship_kill_packet(struct object *,struct object *,float,unsigned char) {}
|
||||
void send_ship_kill_packet(class object *,class object *,float,unsigned char) {}
|
||||
void send_debris_create_packet( object *objp, ushort net_sig, int model_num, vec3d pos) {}
|
||||
|
||||
int Game_subspace_effect;
|
||||
@@ -209,7 +209,7 @@ int game_hacked_data(){return 0;}
|
||||
int game_single_step;
|
||||
int last_single_step;
|
||||
void get_version_string_short(char *){}
|
||||
void game_tst_mark(struct object *, struct ship *){}
|
||||
void game_tst_mark(class object *, class ship *){}
|
||||
int tst;
|
||||
//int Player_multi_died_check;
|
||||
int Show_framerate = 0;
|
||||
|
||||
+46
-4
@@ -1095,7 +1095,7 @@ void CFREDView::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
Assert(objp->type == OBJ_SHIP);
|
||||
ship = objp->instance;
|
||||
Assert(Ships[ship].wingnum == -1);
|
||||
sprintf(Ships[ship].ship_name, "%s %d", Wings[Duped_wing].name,
|
||||
wing_bash_ship_name(Ships[ship].ship_name, Wings[Duped_wing].name,
|
||||
Wings[Duped_wing].wave_count + 1);
|
||||
|
||||
Wings[Duped_wing].ship_index[Wings[Duped_wing].wave_count] = ship;
|
||||
@@ -2688,6 +2688,46 @@ int CFREDView::global_error_check()
|
||||
internal_error("Invalid dockee point (\"%s\" initially docked with \"%s\")", Ships[i].ship_name, Ships[ship].ship_name);
|
||||
}
|
||||
}
|
||||
|
||||
wing = Ships[i].wingnum;
|
||||
bool is_in_loadout_screen = (ptr->type == OBJ_START);
|
||||
if (!is_in_loadout_screen && wing >= 0) {
|
||||
if ( multi && The_mission.game_type & MISSION_TYPE_MULTI_TEAMS )
|
||||
{
|
||||
for (n = 0; n < MAX_TVT_WINGS; n++) {
|
||||
if (!strcmp(Wings[wing].name, TVT_wing_names[n])) {
|
||||
is_in_loadout_screen = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (n = 0; n < MAX_STARTING_WINGS; n++) {
|
||||
if (!strcmp(Wings[wing].name, Starting_wing_names[n])) {
|
||||
is_in_loadout_screen = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_in_loadout_screen) {
|
||||
int illegal = 0;
|
||||
z = Ships[i].ship_info_index;
|
||||
for (n = 0; n < MAX_SHIP_PRIMARY_BANKS; n++){
|
||||
if (Ships[i].weapons.primary_bank_weapons[n] >= 0 && !Ship_info[z].allowed_weapons[Ships[i].weapons.primary_bank_weapons[n]]){
|
||||
illegal++;
|
||||
}
|
||||
}
|
||||
|
||||
for (n = 0; n < MAX_SHIP_SECONDARY_BANKS; n++){
|
||||
if (Ships[i].weapons.secondary_bank_weapons[n] >= 0 && !Ship_info[z].allowed_weapons[Ships[i].weapons.secondary_bank_weapons[n]]){
|
||||
illegal++;
|
||||
}
|
||||
}
|
||||
|
||||
if (illegal && error("%d illegal weapon(s) found on ship \"%s\"", illegal, Ships[i].ship_name)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2721,7 +2761,7 @@ int CFREDView::global_error_check()
|
||||
|
||||
if ((Objects[obj].type == OBJ_SHIP) || (Objects[obj].type == OBJ_START)) {
|
||||
ship = Objects[obj].instance;
|
||||
sprintf(buf, "%s %d", Wings[i].name, j + 1);
|
||||
wing_bash_ship_name(buf, Wings[i].name, j + 1);
|
||||
if (stricmp(buf, Ships[ship].ship_name)){
|
||||
return internal_error("Ship \"%s\" in wing should be called \"%s\"", Ships[ship].ship_name, buf);
|
||||
}
|
||||
@@ -3267,8 +3307,9 @@ int CFREDView::error(const char *msg, ...)
|
||||
va_list args;
|
||||
|
||||
va_start(args, msg);
|
||||
vsprintf(buf, msg, args);
|
||||
vsnprintf(buf, sizeof(buf)-1, msg, args);
|
||||
va_end(args);
|
||||
buf[sizeof(buf)-1] = '\0';
|
||||
|
||||
g_err = 1;
|
||||
if (MessageBox(buf, "Error", MB_OKCANCEL | MB_ICONEXCLAMATION) == IDOK)
|
||||
@@ -3283,8 +3324,9 @@ int CFREDView::internal_error(const char *msg, ...)
|
||||
va_list args;
|
||||
|
||||
va_start(args, msg);
|
||||
vsprintf(buf, msg, args);
|
||||
vsnprintf(buf, sizeof(buf)-1, msg, args);
|
||||
va_end(args);
|
||||
buf[sizeof(buf)-1] = '\0';
|
||||
|
||||
g_err = 1;
|
||||
|
||||
|
||||
@@ -540,7 +540,7 @@ void initial_status::OnOK()
|
||||
if (m_team_color_setting.IsWindowEnabled() && m_team_color_setting.GetCurSel() > 0)
|
||||
Ships[m_ship].team_name = Team_Names[m_team_color_setting.GetCurSel() - 1];
|
||||
else
|
||||
Ships[m_ship].team_name = "None";
|
||||
Ships[m_ship].team_name = "none";
|
||||
|
||||
update_docking_info();
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ void url_launch(char *url)
|
||||
|
||||
r = (int) ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOW);
|
||||
if (r < 32) {
|
||||
char *txt = NULL;
|
||||
const char *txt = NULL;
|
||||
|
||||
switch (r) {
|
||||
case 0: txt = XSTR("The operating system is out of memory or resources.", 1107); break;
|
||||
|
||||
+34
-59
@@ -64,6 +64,7 @@
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "menuui/techmenu.h"
|
||||
#include "missionui/fictionviewer.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
|
||||
#include <direct.h>
|
||||
#include "cmdline/cmdline.h"
|
||||
@@ -72,6 +73,8 @@
|
||||
|
||||
#define UNKNOWN_USER "Unknown"
|
||||
|
||||
extern void ssm_init(); // Need this to populate Ssm_info so OPF_SSM_CLASS does something. -MageKing17
|
||||
|
||||
int cur_wing = -1;
|
||||
int cur_wing_index;
|
||||
int cur_object_index = -1;
|
||||
@@ -253,29 +256,16 @@ void parse_medal_tbl()
|
||||
}
|
||||
*/
|
||||
|
||||
// an atexit() call!!
|
||||
void fred_close()
|
||||
{
|
||||
if (Fred_texture_replacements != NULL) {
|
||||
delete[] Fred_texture_replacements;
|
||||
Fred_texture_replacements = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void parse_init(bool basic = false);
|
||||
void brief_init_colors();
|
||||
|
||||
void fred_preload_all_briefing_icons()
|
||||
{
|
||||
uint i,j;
|
||||
for (i = 0; i < Species_info.size(); i++)
|
||||
for (SCP_vector<briefing_icon_info>::iterator ii = Briefing_icon_info.begin(); ii != Briefing_icon_info.end(); ++ii)
|
||||
{
|
||||
for (j = 0; j < MAX_BRIEF_ICONS; j++)
|
||||
{
|
||||
generic_anim_load(&Species_info[i].icon_bitmaps[j]);
|
||||
hud_anim_load(&Species_info[i].icon_fade_anims[j]);
|
||||
hud_anim_load(&Species_info[i].icon_highlight_anims[j]);
|
||||
}
|
||||
generic_anim_load(&ii->regular);
|
||||
hud_anim_load(&ii->fade);
|
||||
hud_anim_load(&ii->highlight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,11 +311,14 @@ bool fred_init()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Load game_settings.tbl
|
||||
mod_table_init();
|
||||
|
||||
// initialize localization module. Make sure this is done AFTER initialzing OS.
|
||||
// NOTE : Fred should ALWAYS run in English. Otherwise it might swap in another language
|
||||
// when saving - which would cause inconsistencies when externalizing to tstrings.tbl via Exstr
|
||||
// trust me on this :)
|
||||
lcl_init(LCL_ENGLISH);
|
||||
lcl_init(FS2_OPEN_DEFAULT_LANGUAGE);
|
||||
|
||||
// Goober5000 - force init XSTRs (so they work, but only work in English, based on above comment)
|
||||
extern int Xstr_inited;
|
||||
@@ -384,10 +377,10 @@ bool fred_init()
|
||||
iff_init(); // Goober5000
|
||||
species_init(); // Kazan
|
||||
|
||||
brief_parse_icon_tbl();
|
||||
|
||||
// for fred specific replacement texture stuff
|
||||
//Fred_texture_replacements = (texture_replace*) vm_malloc( sizeof(texture_replace) * MAX_SHIPS * MAX_REPLACEMENT_TEXTURES );
|
||||
Fred_texture_replacements = new texture_replace[MAX_SHIPS*MAX_REPLACEMENT_TEXTURES];
|
||||
atexit(fred_close);
|
||||
Fred_texture_replacements.clear();
|
||||
|
||||
// Goober5000
|
||||
for (i = 0; i < MAX_IFFS; i++)
|
||||
@@ -406,9 +399,7 @@ bool fred_init()
|
||||
|
||||
hud_init_comm_orders(); // Goober5000
|
||||
|
||||
if (!new_alpha_colors_init()) {
|
||||
old_alpha_colors_init();
|
||||
}
|
||||
alpha_colors_init();
|
||||
|
||||
gamesnd_parse_soundstbl(); // needs to be loaded after species stuff but before interface/weapon/ship stuff - taylor
|
||||
mission_brief_common_init();
|
||||
@@ -431,14 +422,14 @@ bool fred_init()
|
||||
create_new_mission();
|
||||
neb2_init(); // fullneb stuff
|
||||
stars_init();
|
||||
ssm_init(); // The game calls this after stars_init(), and we need Ssm_info initialized for OPF_SSM_CLASS. -MageKing17
|
||||
brief_init_colors();
|
||||
brief_parse_icon_tbl();
|
||||
fred_preload_all_briefing_icons(); //phreak. This needs to be done or else the briefing icons won't show up
|
||||
event_music_init();
|
||||
fiction_viewer_reset();
|
||||
cmd_brief_reset();
|
||||
Show_waypoints = TRUE;
|
||||
Campaign.filename[0] = 0; // indicate initialized state
|
||||
mission_campaign_clear();
|
||||
|
||||
stars_post_level_init();
|
||||
|
||||
@@ -510,8 +501,8 @@ void fix_ship_name(int ship)
|
||||
int create_ship(matrix *orient, vec3d *pos, int ship_type)
|
||||
{
|
||||
// Save the Current Working dir to restore in a minute - fred is being stupid
|
||||
char pwd[128];
|
||||
getcwd(pwd, 128); // get the present working dir - probably <fs2path>[/modpapth]/data/missions/
|
||||
char pwd[MAX_PATH_LEN];
|
||||
getcwd(pwd, MAX_PATH_LEN); // get the present working dir - probably <fs2path>[/modpapth]/data/missions/
|
||||
|
||||
|
||||
int obj, z1, z2;
|
||||
@@ -941,8 +932,8 @@ void clear_mission()
|
||||
event_music_reset_choices();
|
||||
clear_texture_replacements();
|
||||
|
||||
// alternate ship type names
|
||||
mission_parse_reset_alt();
|
||||
mission_parse_reset_alt(); // alternate ship type names
|
||||
mission_parse_reset_callsign();
|
||||
|
||||
strcpy(Cargo_names[0], "Nothing");
|
||||
Num_cargo = 1;
|
||||
@@ -1365,8 +1356,16 @@ int common_object_delete(int obj)
|
||||
if(jnp->GetSCPObject() == &Objects[obj])
|
||||
break;
|
||||
}
|
||||
|
||||
// come on, WMC, we don't want to call obj_delete twice...
|
||||
// fool the destructor into not calling obj_delete yet
|
||||
Objects[obj].type = OBJ_NONE;
|
||||
|
||||
// now call the destructor
|
||||
Jump_nodes.erase(jnp);
|
||||
|
||||
// now restore the jump node type so that the below unmark and obj_delete will work
|
||||
Objects[obj].type = OBJ_JUMP_NODE;
|
||||
}
|
||||
|
||||
unmark_object(obj);
|
||||
@@ -1454,7 +1453,7 @@ int delete_ship_from_wing(int ship)
|
||||
wing_objects[wing][i] = wing_objects[wing][end];
|
||||
Wings[wing].ship_index[i] = Wings[wing].ship_index[end];
|
||||
if (Objects[wing_objects[wing][i]].type == OBJ_SHIP) {
|
||||
sprintf(name, "%s %d", Wings[wing].name, i + 1);
|
||||
wing_bash_ship_name(name, Wings[wing].name, i + 1);
|
||||
rename_ship(Wings[wing].ship_index[i], name);
|
||||
}
|
||||
}
|
||||
@@ -1474,28 +1473,6 @@ int delete_ship_from_wing(int ship)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// What does this do?
|
||||
void add_ship_to_wing()
|
||||
{
|
||||
int org_object = cur_object_index;
|
||||
vec3d tvec;
|
||||
|
||||
set_cur_object_index();
|
||||
if (Objects[org_object].type == OBJ_NONE) {
|
||||
vm_vec_make(&tvec, 10.0f, 10.0f, 10.0f);
|
||||
create_object(&tvec);
|
||||
|
||||
} else {
|
||||
Objects[cur_object_index] = Objects[org_object];
|
||||
Objects[cur_object_index].pos.xyz.x += 3.0f;
|
||||
Objects[cur_object_index].pos.xyz.y += 3.0f;
|
||||
physics_init(&Objects[cur_object_index].phys_info);
|
||||
Objects[cur_object_index].orient = Objects[org_object].orient;
|
||||
}
|
||||
|
||||
set_modified();
|
||||
}
|
||||
|
||||
// Return true if current object is valid and is in a wing.
|
||||
// Else return false.
|
||||
int query_object_in_wing(int obj)
|
||||
@@ -1972,7 +1949,7 @@ void ai_update_goal_references(int type, const char *old_name, const char *new_n
|
||||
ai_update_goal_references(Wings[i].ai_goals, type, old_name, new_name);
|
||||
}
|
||||
|
||||
int query_referenced_in_ai_goals(int type, char *name)
|
||||
int query_referenced_in_ai_goals(int type, const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -2642,11 +2619,9 @@ void stuff_special_arrival_anchor_name(char *buf, int anchor_num, int retail_for
|
||||
// Goober5000
|
||||
void update_texture_replacements(const char *old_name, const char *new_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Fred_num_texture_replacements; i++)
|
||||
for (SCP_vector<texture_replace>::iterator ii = Fred_texture_replacements.begin(); ii != Fred_texture_replacements.end(); ++ii)
|
||||
{
|
||||
if (!stricmp(Fred_texture_replacements[i].ship_name, old_name))
|
||||
strcpy_s(Fred_texture_replacements[i].ship_name, new_name);
|
||||
if (!stricmp(ii->ship_name, old_name))
|
||||
strcpy_s(ii->ship_name, new_name);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,6 @@ void delete_marked();
|
||||
void delete_reinforcement(int num);
|
||||
int delete_ship_from_wing(int ship = cur_ship);
|
||||
int find_free_wing();
|
||||
void add_ship_to_wing();
|
||||
int query_object_in_wing(int obj = cur_object_index);
|
||||
void mark_object(int obj);
|
||||
void unmark_object(int obj);
|
||||
@@ -114,7 +113,7 @@ int get_ship_from_obj(int obj);
|
||||
int get_ship_from_obj(object *objp);
|
||||
void set_valid_dock_points(int ship, int type, CComboBox *box);
|
||||
void ai_update_goal_references(int type, const char *old_name, const char *new_name);
|
||||
int query_referenced_in_ai_goals(int type, char *name);
|
||||
int query_referenced_in_ai_goals(int type, const char *name);
|
||||
int advanced_stricmp(char *one, char *two);
|
||||
int reference_handler(char *name, int type, int obj);
|
||||
int orders_reference_handler(int code, char *msg);
|
||||
|
||||
@@ -72,6 +72,8 @@ CMissionNotesDlg::CMissionNotesDlg(CWnd* pParent /*=NULL*/) : CDialog(CMissionNo
|
||||
m_autpilot_cinematics = FALSE;
|
||||
m_no_autpilot = FALSE;
|
||||
m_2d_mission = FALSE;
|
||||
m_always_show_goals = FALSE;
|
||||
m_end_to_mainhall = FALSE;
|
||||
m_max_hull_repair_val = 0.0f;
|
||||
m_max_subsys_repair_val = 100.0f;
|
||||
m_contrail_threshold = CONTRAIL_THRESHOLD_DEFAULT;
|
||||
@@ -122,6 +124,8 @@ void CMissionNotesDlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_USE_AUTOPILOT_CINEMATICS, m_autpilot_cinematics);
|
||||
DDX_Check(pDX, IDC_2D_MISSION, m_2d_mission);
|
||||
DDX_Check(pDX, IDC_DEACTIVATE_AUTOPILOT, m_no_autpilot);
|
||||
DDX_Check(pDX, IDC_ALWAYS_SHOW_GOALS, m_always_show_goals);
|
||||
DDX_Check(pDX, IDC_END_TO_MAINHALL, m_end_to_mainhall);
|
||||
DDX_Text(pDX, IDC_MAX_HULL_REPAIR_VAL, m_max_hull_repair_val);
|
||||
DDV_MinMaxFloat(pDX, m_max_hull_repair_val, 0, 100);
|
||||
DDX_Text(pDX, IDC_MAX_SUBSYS_REPAIR_VAL, m_max_subsys_repair_val);
|
||||
@@ -346,6 +350,19 @@ void CMissionNotesDlg::OnOK()
|
||||
} else {
|
||||
The_mission.flags &= ~MISSION_FLAG_DEACTIVATE_AP;
|
||||
}
|
||||
|
||||
// always show mission goals
|
||||
if ( m_always_show_goals ) {
|
||||
The_mission.flags |= MISSION_FLAG_ALWAYS_SHOW_GOALS;
|
||||
} else {
|
||||
The_mission.flags &= ~MISSION_FLAG_ALWAYS_SHOW_GOALS;
|
||||
}
|
||||
|
||||
if ( m_end_to_mainhall ) {
|
||||
The_mission.flags |= MISSION_FLAG_END_TO_MAINHALL;
|
||||
} else {
|
||||
The_mission.flags &= ~MISSION_FLAG_END_TO_MAINHALL;
|
||||
}
|
||||
|
||||
if ( flags != The_mission.flags ){
|
||||
set_modified();
|
||||
@@ -437,6 +454,7 @@ BOOL CMissionNotesDlg::OnInitDialog()
|
||||
m_autpilot_cinematics = (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS) ? 1 : 0;
|
||||
m_2d_mission = (The_mission.flags & MISSION_FLAG_2D_MISSION) ? 1 : 0;
|
||||
m_no_autpilot = (The_mission.flags & MISSION_FLAG_DEACTIVATE_AP) ? 1 : 0;
|
||||
m_always_show_goals = (The_mission.flags & MISSION_FLAG_ALWAYS_SHOW_GOALS) ? 1 : 0;
|
||||
|
||||
m_loading_640=_T(The_mission.loading_screen[GR_640]);
|
||||
m_loading_1024=_T(The_mission.loading_screen[GR_1024]);
|
||||
|
||||
@@ -63,6 +63,8 @@ public:
|
||||
BOOL m_autpilot_cinematics;
|
||||
BOOL m_no_autpilot;
|
||||
BOOL m_2d_mission;
|
||||
BOOL m_always_show_goals;
|
||||
BOOL m_end_to_mainhall;
|
||||
float m_max_hull_repair_val;
|
||||
float m_max_subsys_repair_val;
|
||||
BOOL m_contrail_threshold_flag;
|
||||
|
||||
+132
-88
@@ -133,10 +133,10 @@ int CFred_mission_save::save_mission_file(char *pathname)
|
||||
err = -3;
|
||||
// else if (save_briefing_info())
|
||||
// err = -4;
|
||||
else if (save_fiction())
|
||||
err = -3;
|
||||
else if (save_cutscenes())
|
||||
err = -4;
|
||||
else if (save_fiction())
|
||||
err = -3;
|
||||
else if (save_cmd_briefs())
|
||||
err = -4;
|
||||
else if (save_briefing())
|
||||
@@ -384,13 +384,13 @@ int CFred_mission_save::save_mission_info()
|
||||
fout(" %d", The_mission.num_respawns);
|
||||
|
||||
if ( Format_fs2_open != FSO_FORMAT_RETAIL ) {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
if (optional_string_fred("+Max Respawn Time:"))
|
||||
parse_comments(2);
|
||||
else {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
fout_version("\n+Max Respawn Time:");
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
|
||||
fout(" %d", The_mission.max_respawn_delay);
|
||||
}
|
||||
@@ -561,29 +561,29 @@ int CFred_mission_save::save_mission_info()
|
||||
if (period != NULL)
|
||||
*period = 0;
|
||||
|
||||
fso_comment_push(";;FSO 3.6.0;;");
|
||||
if (optional_string_fred("$Skybox Model:")) {
|
||||
parse_comments(2);
|
||||
fout(" %s.pof", out_str);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.0;;");
|
||||
fout_version("\n\n$Skybox Model: %s.pof", out_str);
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.0;; $Skybox Model:");
|
||||
}
|
||||
|
||||
// orientation?
|
||||
if ((strlen(The_mission.skybox_model) > 0) && !vm_matrix_same(&vmd_identity_matrix, &The_mission.skybox_orientation)) {
|
||||
fso_comment_push(";;FSO 3.6.14;;");
|
||||
if (optional_string_fred("+Skybox Orientation:")) {
|
||||
parse_comments(1);
|
||||
save_matrix(The_mission.skybox_orientation);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.14;;");
|
||||
fout_version("\n+Skybox Orientation:");
|
||||
save_matrix(The_mission.skybox_orientation);
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.14;; +Skybox Orientation:");
|
||||
}
|
||||
@@ -591,14 +591,14 @@ int CFred_mission_save::save_mission_info()
|
||||
// are skybox flags in use?
|
||||
if (The_mission.skybox_flags != DEFAULT_NMODEL_FLAGS) {
|
||||
//char out_str[4096];
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
if (optional_string_fred("+Skybox Flags:")) {
|
||||
parse_comments(1);
|
||||
fout( " %d", The_mission.skybox_flags);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
fout_version("\n+Skybox Flags: %d", The_mission.skybox_flags);
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.11;; +Skybox Flags:");
|
||||
}
|
||||
@@ -607,14 +607,14 @@ int CFred_mission_save::save_mission_info()
|
||||
int profile_index = (The_mission.ai_profile - Ai_profiles);
|
||||
Assert(profile_index >= 0 && profile_index < MAX_AI_PROFILES);
|
||||
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
if (optional_string_fred("$AI Profile:")) {
|
||||
parse_comments(2);
|
||||
fout(" %s", The_mission.ai_profile->profile_name);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
fout_version("\n\n$AI Profile: %s", The_mission.ai_profile->profile_name);
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
|
||||
// sound environment (EFX/EAX) - taylor
|
||||
sound_env *m_env = &The_mission.sound_environment;
|
||||
@@ -714,7 +714,7 @@ int CFred_mission_save::save_cutscenes()
|
||||
}
|
||||
|
||||
for (uint i = 0; i < The_mission.cutscenes.size(); i++) {
|
||||
if ( strlen(The_mission.cutscenes[i].cutscene_name) ) {
|
||||
if ( strlen(The_mission.cutscenes[i].filename) ) {
|
||||
// determine the name of this cutscene type
|
||||
switch (The_mission.cutscenes[i].type) {
|
||||
case MOVIE_PRE_FICTION:
|
||||
@@ -742,10 +742,10 @@ int CFred_mission_save::save_cutscenes()
|
||||
|
||||
if (optional_string_fred(type)) {
|
||||
parse_comments();
|
||||
fout(" %s", The_mission.cutscenes[i].cutscene_name);
|
||||
fout(" %s", The_mission.cutscenes[i].filename);
|
||||
}
|
||||
else {
|
||||
fout_version("%s %s\n", type, The_mission.cutscenes[i].cutscene_name);
|
||||
fout_version("%s %s\n", type, The_mission.cutscenes[i].filename);
|
||||
}
|
||||
|
||||
required_string_fred("+formula:");
|
||||
@@ -795,6 +795,18 @@ int CFred_mission_save::save_fiction()
|
||||
}
|
||||
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
|
||||
{
|
||||
@@ -993,6 +1005,13 @@ int CFred_mission_save::save_briefing()
|
||||
fout(" %d", (bi->flags & BI_MIRROR_ICON)?1:0 );
|
||||
}
|
||||
|
||||
if ((Format_fs2_open != FSO_FORMAT_RETAIL) && (bi->flags & BI_USE_WING_ICON))
|
||||
{
|
||||
required_string_fred("$use wing icon:");
|
||||
parse_comments();
|
||||
fout(" %d", (bi->flags & BI_USE_WING_ICON)?1:0 );
|
||||
}
|
||||
|
||||
required_string_fred("$multi_text");
|
||||
parse_comments();
|
||||
|
||||
@@ -1165,6 +1184,13 @@ int CFred_mission_save::save_players()
|
||||
int var_idx;
|
||||
int used_pool[MAX_WEAPON_TYPES];
|
||||
|
||||
if (optional_string_fred("#Alternate Types:")) { // Make sure the parser doesn't get out of sync
|
||||
required_string_fred("#end");
|
||||
}
|
||||
if (optional_string_fred("#Callsigns:")) {
|
||||
required_string_fred("#end");
|
||||
}
|
||||
|
||||
// write out alternate name list
|
||||
if(Mission_alt_type_count > 0){
|
||||
fout("\n\n#Alternate Types:\n");
|
||||
@@ -1351,7 +1377,7 @@ void CFred_mission_save::save_single_dock_instance(ship *shipp, dock_instance *d
|
||||
int CFred_mission_save::save_objects()
|
||||
{
|
||||
SCP_string sexp_out;
|
||||
int i, j, k, z;
|
||||
int i, j, z;
|
||||
ai_info *aip;
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
@@ -1385,22 +1411,19 @@ int CFred_mission_save::save_objects()
|
||||
|
||||
//alt classes stuff
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL) {
|
||||
if ((int)shipp->s_alt_classes.size()) {
|
||||
for (k = 0; k < (int)shipp->s_alt_classes.size() ; k++) {
|
||||
// is this a variable?
|
||||
if (shipp->s_alt_classes[k].variable_index != -1) {
|
||||
fout_version("\n;;FSO 3.6.10;; $Alt Ship Class: @%s", Sexp_variables[shipp->s_alt_classes[k].variable_index].variable_name);
|
||||
}
|
||||
else {
|
||||
fout_version("\n;;FSO 3.6.10;; $Alt Ship Class: \"%s\"", Ship_info[shipp->s_alt_classes[k].ship_class].name);
|
||||
}
|
||||
|
||||
// default class?
|
||||
if (shipp->s_alt_classes[k].default_to_this_class) {
|
||||
fout_version("\n;;FSO 3.6.10;; +Default Class:");
|
||||
}
|
||||
for (SCP_vector<alt_class>::iterator ii = shipp->s_alt_classes.begin(); ii != shipp->s_alt_classes.end(); ++ii) {
|
||||
// is this a variable?
|
||||
if (ii->variable_index != -1) {
|
||||
fout("\n$Alt Ship Class: @%s", Sexp_variables[ii->variable_index].variable_name);
|
||||
}
|
||||
else {
|
||||
fout("\n$Alt Ship Class: \"%s\"", Ship_info[ii->ship_class].name);
|
||||
}
|
||||
|
||||
// default class?
|
||||
if (ii->default_to_this_class) {
|
||||
fout("\n+Default Class:");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1724,6 +1747,10 @@ int CFred_mission_save::save_objects()
|
||||
fout(" \"ship-locked\"");
|
||||
if (shipp->flags2 & SF2_WEAPONS_LOCKED)
|
||||
fout(" \"weapons-locked\"");
|
||||
if (shipp->flags2 & SF2_SCRAMBLE_MESSAGES)
|
||||
fout(" \"scramble-messages\"");
|
||||
if (!(objp->flags & OF_COLLIDES))
|
||||
fout(" \"no-collide\"");
|
||||
fout(" )");
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
@@ -1743,6 +1770,7 @@ int CFred_mission_save::save_objects()
|
||||
// special explosions
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL) {
|
||||
if (shipp->use_special_explosion) {
|
||||
fso_comment_push(";;FSO 3.6.13;;");
|
||||
if (optional_string_fred("$Special Explosion:", "$Name:")) {
|
||||
parse_comments();
|
||||
|
||||
@@ -1768,7 +1796,7 @@ int CFred_mission_save::save_objects()
|
||||
fout(" %d", shipp->special_exp_shockwave_speed);
|
||||
}
|
||||
else {
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:", "$Name:");
|
||||
}
|
||||
|
||||
if (shipp->special_exp_deathroll_time > 0) {
|
||||
@@ -1777,11 +1805,10 @@ int CFred_mission_save::save_objects()
|
||||
fout(" %d", shipp->special_exp_deathroll_time);
|
||||
}
|
||||
else {
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:", "$Name:");
|
||||
}
|
||||
}
|
||||
else {
|
||||
fso_comment_push(";;FSO 3.6.13;;");
|
||||
fout_version("\n$Special Explosion:");
|
||||
|
||||
fout_version("\n+Special Exp Damage:");
|
||||
@@ -1806,12 +1833,12 @@ int CFred_mission_save::save_objects()
|
||||
fout(" %d", shipp->special_exp_deathroll_time);
|
||||
}
|
||||
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
}
|
||||
else {
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:", "$Name:");
|
||||
}
|
||||
}
|
||||
// retail format special explosions
|
||||
@@ -1839,33 +1866,33 @@ int CFred_mission_save::save_objects()
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL)
|
||||
{
|
||||
if (shipp->special_hitpoints) {
|
||||
fso_comment_push(";;FSO 3.6.13;;");
|
||||
if (optional_string_fred("+Special Hitpoints:", "$Name:")) {
|
||||
parse_comments();
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.13;;");
|
||||
fout_version("\n+Special Hitpoints:");
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
|
||||
fout(" %d", shipp->special_hitpoints);
|
||||
}
|
||||
else {
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Hitpoints:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Hitpoints:", "$Name:");
|
||||
}
|
||||
|
||||
if (shipp->special_shield >= 0) {
|
||||
fso_comment_push(";;FSO 3.6.13;;");
|
||||
if (optional_string_fred("+Special Shield Points:", "$Name:")) {
|
||||
parse_comments();
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.13;;");
|
||||
fout_version("\n+Special Shield Points:");
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
|
||||
fout(" %d", shipp->special_shield);
|
||||
}
|
||||
else {
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Shield Points:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Shield Points:", "$Name:");
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
@@ -1964,16 +1991,16 @@ int CFred_mission_save::save_objects()
|
||||
// always write out the score to ensure backwards compatibility. If the score is the same as the value
|
||||
// in the table write out a flag to tell the game to simply use whatever is in the table instead
|
||||
if (Ship_info[shipp->ship_info_index].score == shipp->score ) {
|
||||
fso_comment_push(";;FSO 3.6.10;;");
|
||||
if ( optional_string_fred("+Use Table Score:", "$Name:") ) {
|
||||
parse_comments();
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.10;;");
|
||||
fout_version("\n+Use Table Score:");
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
}
|
||||
else {
|
||||
bypass_comment(";;FSO 3.6.10;; +Use Table Score:");
|
||||
bypass_comment(";;FSO 3.6.10;; +Use Table Score:", "$Name:");
|
||||
}
|
||||
|
||||
if (optional_string_fred("+Score:", "$Name:"))
|
||||
@@ -1985,18 +2012,18 @@ int CFred_mission_save::save_objects()
|
||||
|
||||
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL && shipp->assist_score_pct != 0) {
|
||||
fso_comment_push(";;FSO 3.6.10;;");
|
||||
if ( optional_string_fred("+Assist Score Percentage:") ) {
|
||||
parse_comments();
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.10;;");
|
||||
fout_version("\n+Assist Score Percentage:");
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
|
||||
fout(" %f", shipp->assist_score_pct);
|
||||
}
|
||||
else {
|
||||
bypass_comment(";;FSO 3.6.10;; +Assist Score Percentage:");
|
||||
bypass_comment(";;FSO 3.6.10;; +Assist Score Percentage:", "$Name:");
|
||||
}
|
||||
|
||||
// deal with the persona for this ship as well.
|
||||
@@ -2010,17 +2037,16 @@ int CFred_mission_save::save_objects()
|
||||
}
|
||||
|
||||
// Goober5000 - deal with texture replacement ----------------
|
||||
k = 0;
|
||||
if (Fred_num_texture_replacements > 0) {
|
||||
if (!Fred_texture_replacements.empty()) {
|
||||
bool needs_header = true;
|
||||
fso_comment_push(";;FSO 3.6.8;;");
|
||||
|
||||
while (k < Fred_num_texture_replacements) {
|
||||
if ( !stricmp(shipp->ship_name, Fred_texture_replacements[k].ship_name) ) {
|
||||
for (SCP_vector<texture_replace>::iterator ii = Fred_texture_replacements.begin(); ii != Fred_texture_replacements.end(); ++ii) {
|
||||
if ( !stricmp(shipp->ship_name, ii->ship_name) ) {
|
||||
if (needs_header) {
|
||||
if (optional_string_fred("$Texture Replace:")) {
|
||||
parse_comments(1);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.8;;");
|
||||
fout_version("\n$Texture Replace:");
|
||||
}
|
||||
|
||||
@@ -2030,25 +2056,23 @@ int CFred_mission_save::save_objects()
|
||||
// write out this entry
|
||||
if (optional_string_fred("+old:")) {
|
||||
parse_comments(1);
|
||||
fout(" %s", Fred_texture_replacements[k].old_texture);
|
||||
fout(" %s", ii->old_texture);
|
||||
} else {
|
||||
fout_version("\n+old: %s", Fred_texture_replacements[k].old_texture);
|
||||
fout_version("\n+old: %s", ii->old_texture);
|
||||
}
|
||||
|
||||
if (optional_string_fred("+new:")) {
|
||||
parse_comments(1);
|
||||
fout(" %s", Fred_texture_replacements[k].new_texture);
|
||||
fout(" %s", ii->new_texture);
|
||||
} else {
|
||||
fout_version("\n+new: %s", Fred_texture_replacements[k].new_texture);
|
||||
fout_version("\n+new: %s", ii->new_texture);
|
||||
}
|
||||
}
|
||||
|
||||
k++; // increment down the list of texture replacements
|
||||
}
|
||||
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.8;; $Texture Replace:");
|
||||
bypass_comment(";;FSO 3.6.8;; $Texture Replace:", "$Name:");
|
||||
}
|
||||
|
||||
// end of texture replacement -------------------------------
|
||||
@@ -2665,7 +2689,7 @@ int CFred_mission_save::save_waypoints()
|
||||
int CFred_mission_save::save_waypoint_list(waypoint_list *wp_list)
|
||||
{
|
||||
Assert(wp_list != NULL);
|
||||
SCP_list<waypoint>::iterator ii;
|
||||
SCP_vector<waypoint>::iterator ii;
|
||||
|
||||
for (ii = wp_list->get_waypoints().begin(); ii != wp_list->get_waypoints().end(); ++ii)
|
||||
{
|
||||
@@ -2769,11 +2793,16 @@ int CFred_mission_save::save_matrix(matrix &m)
|
||||
|
||||
// Goober5000 - move past the comment without copying it to the output file
|
||||
// (used for special FSO comment tags)
|
||||
void CFred_mission_save::bypass_comment(char *comment)
|
||||
void CFred_mission_save::bypass_comment(const char *comment, const char *end)
|
||||
{
|
||||
char *ch = strstr(raw_ptr, comment);
|
||||
if (ch != NULL)
|
||||
{
|
||||
if (end != NULL) {
|
||||
char *ep = strstr(raw_ptr, end);
|
||||
if (ep != NULL && ep < ch)
|
||||
return;
|
||||
}
|
||||
char *writep = ch;
|
||||
char *readp = strchr(writep, '\n');
|
||||
|
||||
@@ -2795,6 +2824,7 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
{
|
||||
char *comment_start = NULL;
|
||||
int state = 0, same_line = 0, first_comment = 1, tab = 0, flag = 0;
|
||||
bool version_added = false;
|
||||
|
||||
if (newlines < 0) {
|
||||
newlines = -newlines;
|
||||
@@ -2808,12 +2838,13 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
while (newlines-- > 0)
|
||||
fout("\n");
|
||||
|
||||
if (tab)
|
||||
if (tab && token_found)
|
||||
fout_version("\t%s", token_found);
|
||||
else if (token_found)
|
||||
fout_version("%s", token_found);
|
||||
else if (tab)
|
||||
fout("\t");
|
||||
|
||||
if (token_found)
|
||||
fout("%s", token_found);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2826,12 +2857,19 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
fout("\n");
|
||||
|
||||
if (tab) {
|
||||
fout("\t");
|
||||
fout_version("\t");
|
||||
fout("%s", token_found);
|
||||
} else {
|
||||
fout("%s", token_found);
|
||||
fout_version("%s", token_found);
|
||||
}
|
||||
|
||||
// If you have a bunch of lines that all start with the same token (like, say, "+Subsystem:"),
|
||||
// this makes it so it won't just repeatedly match the first one. -MageKing17
|
||||
raw_ptr++;
|
||||
|
||||
if (version_added)
|
||||
fso_comment_pop();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2855,9 +2893,9 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
s_num = 3;
|
||||
}
|
||||
|
||||
if ( (s_num == 3) && (major <= FS_VERSION_MAJOR) && (minor <= FS_VERSION_MINOR) && (build <= FS_VERSION_BUILD) ) {
|
||||
if ( (s_num == 3) && ((major < FS_VERSION_MAJOR) || ((major == FS_VERSION_MAJOR) && ((minor < FS_VERSION_MINOR) || ((minor == FS_VERSION_MINOR) && (build <= FS_VERSION_BUILD))))) ) {
|
||||
state = 3;
|
||||
} else if ( (s_num == 4) && (major <= FS_VERSION_MAJOR) && (minor <= FS_VERSION_MINOR) && (build <= FS_VERSION_BUILD) && (revis <= FS_VERSION_REVIS) ) {
|
||||
} else if ( (s_num == 4) && ((major < FS_VERSION_MAJOR) || ((major == FS_VERSION_MAJOR) && ((minor < FS_VERSION_MINOR) || ((minor == FS_VERSION_MINOR) && ((build < FS_VERSION_BUILD) || ((build == FS_VERSION_BUILD) && (revis <= FS_VERSION_REVIS))))))) ) {
|
||||
state = 3;
|
||||
} else {
|
||||
state = 4;
|
||||
@@ -2923,7 +2961,10 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
if ( (*raw_ptr == ';') && (raw_ptr[1] == ';') && (state == 3) ) {
|
||||
state = raw_ptr[2];
|
||||
raw_ptr[2] = 0;
|
||||
fso_comment_pop();
|
||||
if (version_added)
|
||||
fso_comment_pop();
|
||||
else
|
||||
version_added = true;
|
||||
fso_comment_push(comment_start);
|
||||
raw_ptr[2] = (char)state;
|
||||
state = first_comment = flag = 0;
|
||||
@@ -2934,6 +2975,9 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
raw_ptr++;
|
||||
}
|
||||
|
||||
if (version_added)
|
||||
fso_comment_pop();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3336,13 +3380,13 @@ int CFred_mission_save::save_events()
|
||||
}
|
||||
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL && Mission_events[i].trigger_count != 1 ) {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
if ( optional_string_fred("+Trigger Count:", "$Formula:")){
|
||||
parse_comments();
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
fout_version("\n+Trigger Count:");
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
|
||||
fout(" %d", Mission_events[i].trigger_count);
|
||||
}
|
||||
@@ -3407,13 +3451,13 @@ int CFred_mission_save::save_events()
|
||||
}
|
||||
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL && Mission_events[i].mission_log_flags != 0 ) {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
if ( optional_string_fred("+Event Log Flags: (", "$Formula:")){
|
||||
parse_comments();
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
fout_version("\n+Event Log Flags: (");
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
|
||||
for (j = 0; j < MAX_MISSION_EVENT_LOG_FLAGS ; j++) {
|
||||
add_flag = 1 << j;
|
||||
@@ -3563,10 +3607,10 @@ int CFred_mission_save::save_bitmaps()
|
||||
bool tag = (i < Num_backgrounds - 1);
|
||||
background_t *background = &Backgrounds[i];
|
||||
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
if (optional_string_fred("$Bitmap List:")) {
|
||||
parse_comments(2);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
fout_version("\n\n$Bitmap List:");
|
||||
}
|
||||
|
||||
@@ -3632,14 +3676,14 @@ int CFred_mission_save::save_bitmaps()
|
||||
|
||||
// taylor's environment map thingy
|
||||
if (strlen(The_mission.envmap_name) > 0) { //-V805
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
if (optional_string_fred("$Environment Map:")) {
|
||||
parse_comments(2);
|
||||
fout(" %s", The_mission.envmap_name);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
fout_version("\n\n$Environment Map: %s", The_mission.envmap_name);
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.9;; $Environment Map:");
|
||||
}
|
||||
@@ -3758,14 +3802,14 @@ int CFred_mission_save::save_music()
|
||||
|
||||
// Goober5000 - save using the special comment prefix
|
||||
if (stricmp(The_mission.substitute_event_music_name, "None")) {
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
if (optional_string_fred("$Substitute Event Music:")) {
|
||||
parse_comments(1);
|
||||
fout(" %s", The_mission.substitute_event_music_name);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
fout_version("\n$Substitute Event Music: %s", The_mission.substitute_event_music_name);
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.9;; $Substitute Event Music:");
|
||||
}
|
||||
@@ -3779,14 +3823,14 @@ int CFred_mission_save::save_music()
|
||||
|
||||
// Goober5000 - save using the special comment prefix
|
||||
if (stricmp(The_mission.substitute_briefing_music_name, "None")) {
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
if (optional_string_fred("$Substitute Briefing Music:")) {
|
||||
parse_comments(1);
|
||||
fout(" %s", The_mission.substitute_briefing_music_name);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.9;;");
|
||||
fout_version("\n$Substitute Briefing Music: %s", The_mission.substitute_briefing_music_name);
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.9;; $Substitute Briefing Music:");
|
||||
}
|
||||
@@ -3822,14 +3866,14 @@ int CFred_mission_save::save_music()
|
||||
|
||||
// Goober5000 - save using the special comment prefix
|
||||
if (mission_has_fiction() && Mission_music[SCORE_FICTION_VIEWER] >= 0) {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
if (optional_string_fred("$Fiction Viewer Music:")) {
|
||||
parse_comments(1);
|
||||
fout(" %s", Spooled_music[Mission_music[SCORE_FICTION_VIEWER]].name);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
fout_version("\n$Fiction Viewer Music: %s", Spooled_music[Mission_music[SCORE_FICTION_VIEWER]].name);
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.11;; $Fiction Viewer Music:");
|
||||
}
|
||||
@@ -4026,14 +4070,14 @@ int CFred_mission_save::save_campaign_file(char *pathname)
|
||||
}
|
||||
|
||||
if ( Campaign.missions[m].debrief_persona_index > 0 ) {
|
||||
fso_comment_push(";;FSO 3.6.8;;");
|
||||
if (optional_string_fred("+Debriefing Persona Index:")) {
|
||||
parse_comments(1);
|
||||
fout(" %d", Campaign.missions[m].debrief_persona_index);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.8;;");
|
||||
fout_version("\n+Debriefing Persona Index: %d", Campaign.missions[m].debrief_persona_index);
|
||||
fso_comment_pop();
|
||||
}
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.8;; +Debriefing Persona Index:");
|
||||
}
|
||||
@@ -4212,10 +4256,10 @@ void CFred_mission_save::fso_comment_push(char *ver)
|
||||
elem1 = elem2 = 3;
|
||||
}
|
||||
|
||||
if ( (elem1 == 3) && ((major > in_major) || (minor > in_minor) || (build > in_build)) ) {
|
||||
if ( (elem1 == 3) && ((major > in_major) || ((major == in_major) && ((minor > in_minor) || ((minor == in_minor) && (build > in_build))))) ) {
|
||||
// the push'd version is older than our current version, so just push a copy of the previous version
|
||||
fso_ver_comment.push_back( before );
|
||||
} else if ( (elem1 == 4) && ((major > in_major) || (minor > in_minor) || (build > in_build) || (revis > in_revis)) ) {
|
||||
} else if ( (elem1 == 4) && ((major > in_major) || ((major == in_major) && ((minor > in_minor) || ((minor == in_minor) && ((build > in_build) || ((build == in_build) || (revis > in_revis))))))) ) {
|
||||
// the push'd version is older than our current version, so just push a copy of the previous version
|
||||
fso_ver_comment.push_back( before );
|
||||
} else {
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
void fso_comment_pop(bool pop_all = false);
|
||||
|
||||
// Goober5000
|
||||
void bypass_comment(char *comment);
|
||||
void bypass_comment(const char *comment, const char *end = NULL);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -65,7 +65,9 @@ BEGIN_MESSAGE_MAP(player_start_editor, CDialog)
|
||||
//{{AFX_MSG_MAP(player_start_editor)
|
||||
ON_WM_INITMENU()
|
||||
ON_LBN_SELCHANGE(IDC_SHIP_LIST, OnSelchangeShipList)
|
||||
ON_CLBN_CHKCHANGE(IDC_SHIP_LIST, OnSelchangeShipList)
|
||||
ON_LBN_SELCHANGE(IDC_WEAPON_LIST, OnSelchangeWeaponList)
|
||||
ON_CLBN_CHKCHANGE(IDC_SHIP_LIST, OnSelchangeWeaponList)
|
||||
ON_EN_UPDATE(IDC_SHIP_POOL, OnUpdateShipPool)
|
||||
ON_EN_UPDATE(IDC_WEAPON_POOL, OnUpdateWeaponPool)
|
||||
ON_LBN_SELCHANGE(IDC_SHIP_VARIABLES_LIST, OnSelchangeShipVariablesList)
|
||||
|
||||
+12
-3
@@ -963,6 +963,7 @@
|
||||
#define IDC_MAX_RESPAWN_DELAY_SPIN 1487
|
||||
#define IDC_NAV_NEEDSLINK 1488
|
||||
#define IDC_OBJ_TEAM 1489
|
||||
#define IDC_SCRAMBLE_MESSAGES 1489
|
||||
#define IDC_CAMPAIGN_TYPE 1491
|
||||
#define IDC_SUPPORT_ALLOWED 1492
|
||||
#define IDC_SUBSPACE 1493
|
||||
@@ -1056,7 +1057,11 @@
|
||||
#define IDC_USE_AUTOPILOT_CINEMATICS 1547
|
||||
#define IDC_2D_MISSION 1548
|
||||
#define IDC_LABEL1 1549
|
||||
#define IDC_2D_MISSION2 1549
|
||||
#define IDC_ALWAYS_SHOW_GOALS 1549
|
||||
#define IDC_LABEL2 1550
|
||||
#define IDC_ALWAYS_SHOW_GOALS2 1550
|
||||
#define IDC_END_TO_MAINHALL 1550
|
||||
#define IDC_NEW_TEXTURE 1551
|
||||
#define IDC_TEXTURES 1552
|
||||
#define IDC_OLD_TEXTURE_LIST 1553
|
||||
@@ -1109,8 +1114,10 @@
|
||||
#define IDC_FLIP_ICON 1578
|
||||
#define IDC_DISABLE_BUILTIN_SHIP 1579
|
||||
#define IDC_OTHER 1579
|
||||
#define IDC_USE_WING_ICON 1579
|
||||
#define IDC_DISABLE_BUILTIN_COMMAND_MSGS 1580
|
||||
#define IDC_LBL_OTHER_SUFFIX 1580
|
||||
#define IDC_USE_CARGO_ICON 1580
|
||||
#define IDC_PRIMARIES_LOCKED 1581
|
||||
#define IDC_EXPORT 1581
|
||||
#define IDC_SECONDARIES_LOCKED 1582
|
||||
@@ -1147,6 +1154,8 @@
|
||||
#define IDC_FONT_FILE 1619
|
||||
#define IDC_FICTION_MUSIC 1620
|
||||
#define IDC_SOUND_ENVIRONMENT_LABEL 1621
|
||||
#define IDC_FONT_FILE2 1621
|
||||
#define IDC_VOICE_FILE 1621
|
||||
#define IDC_SOUND_ENVIRONMENT_VOLUME_LABEL 1622
|
||||
#define IDC_SOUND_ENVIRONENT_DAMPING_LABEL 1623
|
||||
#define IDC_SOUND_ENVIRONMENT_DECAY_LABEL 1624
|
||||
@@ -1164,12 +1173,13 @@
|
||||
#define IDC_NEB_FAR_MULTIPLIER 1634
|
||||
#define IDC_MISSION_LOG_TRUE 1635
|
||||
#define IDC_MISSION_LOG_FALSE 1636
|
||||
#define IDC_MISSION_LOG_ALWAYS_TRUE 1637
|
||||
#define IDC_MISSION_LOG_STATE_CHANGE 1637
|
||||
#define IDC_MISSION_LOG_ALWAYS_FALSE 1638
|
||||
#define IDC_MISSION_LOG_1ST_REPEAT 1639
|
||||
#define IDC_MISSION_LOG_LAST_REPEAT 1640
|
||||
#define IDC_MISSION_LOG_1ST_TRIGGER 1641
|
||||
#define IDC_MISSION_LOG_LAST_TRIGGER 1642
|
||||
#define IDC_NO_COLLIDE 1643
|
||||
#define ID_FILE_MISSIONNOTES 32771
|
||||
#define ID_DUPLICATE 32774
|
||||
#define ID_VIEW_ROTATE 32775
|
||||
@@ -1434,7 +1444,6 @@
|
||||
#define ID_FORMAT_FS1_RETAIL 33072
|
||||
#define ID_EDITORS_SET_GLOBAL_SHIP_FLAGS 33073
|
||||
#define ID_FILE_IMPORT_FSM 33074
|
||||
#define ID_FILE_IMPORT_WEAPONS 33075
|
||||
#define ID_VIEW_LIGHTING 33079
|
||||
#define ID_EDITORS_VOICE 33080
|
||||
#define ID_SHOW_IFF_0 33081
|
||||
@@ -1463,7 +1472,7 @@
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 320
|
||||
#define _APS_NEXT_COMMAND_VALUE 33098
|
||||
#define _APS_NEXT_CONTROL_VALUE 1643
|
||||
#define _APS_NEXT_CONTROL_VALUE 1644
|
||||
#define _APS_NEXT_SYMED_VALUE 105
|
||||
#endif
|
||||
#endif
|
||||
+147
-87
@@ -96,7 +96,7 @@ sexp_tree::sexp_tree()
|
||||
}
|
||||
|
||||
// clears out the tree, so all the nodes are unused.
|
||||
void sexp_tree::clear_tree(char *op)
|
||||
void sexp_tree::clear_tree(const char *op)
|
||||
{
|
||||
mprintf(("Resetting dynamic tree node limit from %d to %d...\n", tree_nodes.size(), 0));
|
||||
|
||||
@@ -121,7 +121,7 @@ void sexp_tree::reset_handles()
|
||||
}
|
||||
|
||||
// initializes and creates a tree from a given sexp startpoint.
|
||||
void sexp_tree::load_tree(int index, char *deflt)
|
||||
void sexp_tree::load_tree(int index, const char *deflt)
|
||||
{
|
||||
int cur;
|
||||
|
||||
@@ -440,7 +440,7 @@ void sexp_tree::free_node2(int node)
|
||||
}
|
||||
|
||||
// initialize the data for a node. Should be called right after a new node is allocated.
|
||||
void sexp_tree::set_node(int node, int type, char *text)
|
||||
void sexp_tree::set_node(int node, int type, const char *text)
|
||||
{
|
||||
Assert(type != SEXPT_UNUSED);
|
||||
Assert(tree_nodes[node].type != SEXPT_UNUSED);
|
||||
@@ -532,7 +532,7 @@ void sexp_tree::add_sub_tree(int node, HTREEITEM root)
|
||||
}
|
||||
|
||||
// construct tree nodes for an sexp, adding them to the list and returning first node
|
||||
int sexp_tree::load_sub_tree(int index, bool valid, char *text)
|
||||
int sexp_tree::load_sub_tree(int index, bool valid, const char *text)
|
||||
{
|
||||
int cur;
|
||||
|
||||
@@ -719,6 +719,12 @@ void sexp_tree::right_clicked(int mode)
|
||||
type = tree_nodes[first_arg].type;
|
||||
}
|
||||
}
|
||||
|
||||
// Goober5000 - certain types accept both integers and a list of strings
|
||||
if (op_type == OPF_GAME_SND || op_type == OPF_WEAPON_BANK_NUMBER)
|
||||
{
|
||||
type = SEXPT_NUMBER | SEXPT_STRING;
|
||||
}
|
||||
|
||||
if ( (type & SEXPT_STRING) || (type & SEXPT_NUMBER) ) {
|
||||
|
||||
@@ -741,7 +747,8 @@ void sexp_tree::right_clicked(int mode)
|
||||
if ( Sexp_variables[idx].type & SEXP_VARIABLE_STRING ) {
|
||||
flag &= ~MF_GRAYED;
|
||||
}
|
||||
} else if ( type & SEXPT_NUMBER ) {
|
||||
}
|
||||
if ( type & SEXPT_NUMBER ) {
|
||||
if ( Sexp_variables[idx].type & SEXP_VARIABLE_NUMBER ) {
|
||||
flag &= ~MF_GRAYED;
|
||||
}
|
||||
@@ -823,12 +830,16 @@ void sexp_tree::right_clicked(int mode)
|
||||
case OP_GRANT_MEDAL:
|
||||
case OP_TECH_ADD_SHIP:
|
||||
case OP_TECH_ADD_WEAPON:
|
||||
case OP_TECH_ADD_INTEL:
|
||||
case OP_TECH_ADD_INTEL_XSTR:
|
||||
case OP_TECH_RESET_TO_DEFAULT:
|
||||
#endif*/
|
||||
// unlike the above operators, these are deprecated
|
||||
case OP_HITS_LEFT_SUBSYSTEM:
|
||||
case OP_CUTSCENES_SHOW_SUBTITLE:
|
||||
case OP_ORDER:
|
||||
case OP_TECH_ADD_INTEL:
|
||||
case OP_HUD_GAUGE_SET_ACTIVE:
|
||||
case OP_HUD_ACTIVATE_GAUGE_TYPE:
|
||||
j = Num_op_menus; // don't allow these operators to be visible
|
||||
break;
|
||||
}
|
||||
@@ -861,12 +872,16 @@ void sexp_tree::right_clicked(int mode)
|
||||
case OP_GRANT_MEDAL:
|
||||
case OP_TECH_ADD_SHIP:
|
||||
case OP_TECH_ADD_WEAPON:
|
||||
case OP_TECH_ADD_INTEL:
|
||||
case OP_TECH_ADD_INTEL_XSTR:
|
||||
case OP_TECH_RESET_TO_DEFAULT:
|
||||
#endif*/
|
||||
// unlike the above operators, these are deprecated
|
||||
case OP_HITS_LEFT_SUBSYSTEM:
|
||||
case OP_CUTSCENES_SHOW_SUBTITLE:
|
||||
case OP_ORDER:
|
||||
case OP_TECH_ADD_INTEL:
|
||||
case OP_HUD_GAUGE_SET_ACTIVE:
|
||||
case OP_HUD_ACTIVATE_GAUGE_TYPE:
|
||||
j = Num_submenus; // don't allow these operators to be visible
|
||||
break;
|
||||
}
|
||||
@@ -1091,15 +1106,20 @@ void sexp_tree::right_clicked(int mode)
|
||||
|
||||
} else if (type == OPF_NULL) { // takes operator that doesn't return a value
|
||||
replace_type = OPR_NULL;
|
||||
|
||||
// Goober5000
|
||||
} else if (type == OPF_FLEXIBLE_ARGUMENT) {
|
||||
replace_type = OPR_FLEXIBLE_ARGUMENT;
|
||||
|
||||
} else if (type == OPF_AI_GOAL) {
|
||||
replace_type = OPR_AI_GOAL;
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
else if (type == OPF_FLEXIBLE_ARGUMENT) {
|
||||
replace_type = OPR_FLEXIBLE_ARGUMENT;
|
||||
}
|
||||
// Goober5000
|
||||
else if (type == OPF_GAME_SND || type == OPF_WEAPON_BANK_NUMBER) {
|
||||
// enable number even though we are also going to default to string
|
||||
menu.EnableMenuItem(ID_REPLACE_NUMBER, MF_ENABLED);
|
||||
}
|
||||
|
||||
// default to string
|
||||
if (replace_type == OPR_STRING) {
|
||||
menu.EnableMenuItem(ID_REPLACE_STRING, MF_ENABLED);
|
||||
@@ -1392,7 +1412,7 @@ int sexp_tree::query_node_argument_type(int node)
|
||||
int sexp_tree::end_label_edit(TVITEMA &item)
|
||||
{
|
||||
HTREEITEM h = item.hItem;
|
||||
char *str = item.pszText;
|
||||
char *str = item.pszText;
|
||||
int len, r = 1;
|
||||
bool update_node = true;
|
||||
uint node;
|
||||
@@ -1421,12 +1441,12 @@ int sexp_tree::end_label_edit(TVITEMA &item)
|
||||
|
||||
Assert(node < tree_nodes.size());
|
||||
if (tree_nodes[node].type & SEXPT_OPERATOR) {
|
||||
str = match_closest_operator(str, node);
|
||||
if (!str) return 0; // Goober5000 - avoids crashing
|
||||
const char *op = match_closest_operator(str, node);
|
||||
if (!op) return 0; // Goober5000 - avoids crashing
|
||||
|
||||
SetItemText(h, str);
|
||||
SetItemText(h, op);
|
||||
item_index = node;
|
||||
int op_num = get_operator_index(str);
|
||||
int op_num = get_operator_index(op);
|
||||
if (op_num >= 0 ) {
|
||||
add_or_replace_operator(op_num, 1);
|
||||
}
|
||||
@@ -1478,10 +1498,10 @@ int sexp_tree::end_label_edit(TVITEMA &item)
|
||||
// number of it. What operators are valid is determined by 'node', and an operator is valid
|
||||
// if it is allowed to fit at position 'node'
|
||||
//
|
||||
char *sexp_tree::match_closest_operator(char *str, int node)
|
||||
const char *sexp_tree::match_closest_operator(const char *str, int node)
|
||||
{
|
||||
int z, i, op, arg_num, opf, opr;
|
||||
char *sub_best = NULL, *best = NULL;
|
||||
const char *sub_best = NULL, *best = NULL;
|
||||
|
||||
z = tree_nodes[node].parent;
|
||||
if (z < 0) {
|
||||
@@ -2069,7 +2089,7 @@ void sexp_list_item::set_op(int op_num)
|
||||
// initialize node, type data
|
||||
// Defaults: t = SEXPT_STRING
|
||||
//
|
||||
void sexp_list_item::set_data(char *str, int t)
|
||||
void sexp_list_item::set_data(const char *str, int t)
|
||||
{
|
||||
op = -1;
|
||||
text = str;
|
||||
@@ -2079,7 +2099,7 @@ void sexp_list_item::set_data(char *str, int t)
|
||||
// initialize node, type data, allocating memory for the text
|
||||
// Defaults: t = SEXPT_STRING
|
||||
//
|
||||
void sexp_list_item::set_data_dup(char *str, int t)
|
||||
void sexp_list_item::set_data_dup(const char *str, int t)
|
||||
{
|
||||
op = -1;
|
||||
text = strdup(str);
|
||||
@@ -2105,7 +2125,7 @@ void sexp_list_item::add_op(int op_num)
|
||||
// add a node to end of list
|
||||
// Defaults: t = SEXPT_STRING
|
||||
//
|
||||
void sexp_list_item::add_data(char *str, int t)
|
||||
void sexp_list_item::add_data(const char *str, int t)
|
||||
{
|
||||
sexp_list_item *item, *ptr;
|
||||
|
||||
@@ -2158,7 +2178,7 @@ void sexp_list_item::destroy()
|
||||
while (ptr) {
|
||||
ptr2 = ptr->next;
|
||||
if (ptr->flags & SEXP_ITEM_F_DUP)
|
||||
free(ptr->text);
|
||||
free((void *) ptr->text);
|
||||
|
||||
delete ptr;
|
||||
ptr = ptr2;
|
||||
@@ -2174,8 +2194,7 @@ int sexp_tree::add_default_operator(int op, int argnum)
|
||||
|
||||
h = item_handle;
|
||||
index = item_index;
|
||||
item.text = buf;
|
||||
if (get_default_value(&item, op, argnum))
|
||||
if (get_default_value(&item, buf, op, argnum))
|
||||
return -1;
|
||||
|
||||
if (item.type & SEXPT_OPERATOR) {
|
||||
@@ -2195,7 +2214,9 @@ int sexp_tree::add_default_operator(int op, int argnum)
|
||||
(argnum == 2 && Operators[op].value == OP_STRING_CONCATENATE) ||
|
||||
(argnum == 1 && Operators[op].value == OP_INT_TO_STRING) ||
|
||||
(argnum == 3 && Operators[op].value == OP_STRING_GET_SUBSTRING) ||
|
||||
(argnum == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING))
|
||||
(argnum == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING) ||
|
||||
(argnum == 1 && Operators[op].value == OP_COPY_VARIABLE_FROM_INDEX) ||
|
||||
(argnum == 1 && Operators[op].value == OP_SCRIPT_EVAL_STRING))
|
||||
{
|
||||
|
||||
int sexp_var_index = get_index_sexp_variable_name(item.text);
|
||||
@@ -2217,8 +2238,7 @@ int sexp_tree::add_default_operator(int op, int argnum)
|
||||
char buf2[256];
|
||||
Assert(argnum == 1);
|
||||
sexp_list_item temp_item;
|
||||
temp_item.text = buf2;
|
||||
get_default_value(&temp_item, op, 0);
|
||||
get_default_value(&temp_item, buf2, op, 0);
|
||||
int sexp_var_index = get_index_sexp_variable_name(temp_item.text);
|
||||
Assert(sexp_var_index != -1);
|
||||
|
||||
@@ -2242,7 +2262,7 @@ int sexp_tree::add_default_operator(int op, int argnum)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, int i)
|
||||
{
|
||||
char *str = NULL;
|
||||
int type, index;
|
||||
@@ -2312,9 +2332,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
case 7:
|
||||
temp = 100;
|
||||
break;
|
||||
case 10:
|
||||
temp = SND_SHIP_EXPLODE_1;
|
||||
break;
|
||||
case 11:
|
||||
temp = (int)EMP_DEFAULT_INTENSITY;
|
||||
break;
|
||||
@@ -2343,12 +2360,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
case 7:
|
||||
temp = 10;
|
||||
break;
|
||||
case 8:
|
||||
temp = SND_CAPITAL_WARP_IN;
|
||||
break;
|
||||
case 9:
|
||||
temp = SND_CAPITAL_WARP_OUT;
|
||||
break;
|
||||
default:
|
||||
temp = 0;
|
||||
break;
|
||||
@@ -2411,6 +2422,32 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
// Goober5000 - special cases that used to be numbers but are now hybrids
|
||||
case OPF_GAME_SND:
|
||||
int sound_index = -1;
|
||||
|
||||
if ( (Operators[op].value == OP_EXPLOSION_EFFECT) )
|
||||
{
|
||||
sound_index = SND_SHIP_EXPLODE_1;
|
||||
}
|
||||
else if ( (Operators[op].value == OP_WARP_EFFECT) )
|
||||
{
|
||||
sound_index = (i == 8) ? SND_CAPITAL_WARP_IN : SND_CAPITAL_WARP_OUT;
|
||||
}
|
||||
|
||||
if (sound_index >= 0)
|
||||
{
|
||||
game_snd *snd = &Snds[sound_index];
|
||||
if (can_construe_as_integer(snd->name.c_str()))
|
||||
item->set_data(snd->name.c_str(), (SEXPT_NUMBER | SEXPT_VALID));
|
||||
else
|
||||
item->set_data(snd->name.c_str(), (SEXPT_STRING | SEXPT_VALID));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if no hardcoded default, just use the listing default
|
||||
break;
|
||||
}
|
||||
|
||||
list = get_listing_opf(type, index, i);
|
||||
@@ -2425,20 +2462,24 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
list = list->next;
|
||||
|
||||
if (first_ptr->flags & SEXP_ITEM_F_DUP)
|
||||
free(first_ptr->text);
|
||||
free((void *) first_ptr->text);
|
||||
|
||||
delete first_ptr;
|
||||
}
|
||||
|
||||
if (list) {
|
||||
char *ptr;
|
||||
|
||||
ptr = item->text;
|
||||
if (list)
|
||||
{
|
||||
// copy the information from the list to the passed-in item
|
||||
*item = *list;
|
||||
item->text = ptr;
|
||||
strcpy(item->text, list->text);
|
||||
|
||||
// but use the provided text buffer
|
||||
strcpy(text_buf, list->text);
|
||||
item->text = text_buf;
|
||||
|
||||
// get rid of the list, since we're done with it
|
||||
list->destroy();
|
||||
item->next = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2623,6 +2664,7 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
case OPF_FLEXIBLE_ARGUMENT:
|
||||
case OPF_ANYTHING:
|
||||
case OPF_SKYBOX_MODEL_NAME:
|
||||
case OPF_SKYBOX_FLAGS:
|
||||
case OPF_SHIP_OR_NONE:
|
||||
case OPF_SUBSYSTEM_OR_NONE:
|
||||
case OPF_SHIP_WING_POINT_OR_NONE:
|
||||
@@ -2649,6 +2691,9 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
case OPF_ANIMATION_TYPE:
|
||||
case OPF_SHIP_FLAG:
|
||||
case OPF_NEBULA_PATTERN:
|
||||
case OPF_NAV_POINT:
|
||||
case OPF_TEAM_COLOR:
|
||||
case OPF_GAME_SND:
|
||||
return 1;
|
||||
|
||||
case OPF_SHIP:
|
||||
@@ -2687,10 +2732,7 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
return 0;
|
||||
|
||||
case OPF_PERSONA:
|
||||
if (Num_personas)
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
return (Num_personas > 0) ? 1 : 0;
|
||||
|
||||
case OPF_POINT:
|
||||
case OPF_WAYPOINT_PATH:
|
||||
@@ -2752,29 +2794,13 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
return 0;
|
||||
|
||||
case OPF_VARIABLE_NAME:
|
||||
if (sexp_variable_count() > 0) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
case OPF_NAV_POINT:
|
||||
return 1;
|
||||
return (sexp_variable_count() > 0) ? 1 : 0;
|
||||
|
||||
case OPF_SSM_CLASS:
|
||||
if (Ssm_info_count > 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
return (Ssm_info_count > 0) ? 1 : 0;
|
||||
|
||||
case OPF_MISSION_MOOD:
|
||||
if (Builtin_moods.empty())
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
||||
case OPF_TEAM_COLOR:
|
||||
return 1;
|
||||
return Builtin_moods.empty() ? 0 : 1;
|
||||
|
||||
default:
|
||||
Int3();
|
||||
@@ -2845,7 +2871,7 @@ void sexp_tree::merge_operator(int node)
|
||||
}
|
||||
|
||||
// add a data node under operator pointed to by item_index
|
||||
int sexp_tree::add_data(char *data, int type)
|
||||
int sexp_tree::add_data(const char *data, int type)
|
||||
{
|
||||
int node;
|
||||
|
||||
@@ -2860,7 +2886,7 @@ int sexp_tree::add_data(char *data, int type)
|
||||
}
|
||||
|
||||
// add a (variable) data node under operator pointed to by item_index
|
||||
int sexp_tree::add_variable_data(char *data, int type)
|
||||
int sexp_tree::add_variable_data(const char *data, int type)
|
||||
{
|
||||
int node;
|
||||
|
||||
@@ -2877,7 +2903,7 @@ int sexp_tree::add_variable_data(char *data, int type)
|
||||
|
||||
// add an operator under operator pointed to by item_index. Updates item_index to point
|
||||
// to this new operator.
|
||||
void sexp_tree::add_operator(char *op, HTREEITEM h)
|
||||
void sexp_tree::add_operator(const char *op, HTREEITEM h)
|
||||
{
|
||||
int node;
|
||||
|
||||
@@ -3089,7 +3115,7 @@ int sexp_tree::verify_tree(int node, int *bypass)
|
||||
*/
|
||||
|
||||
// display an error message and position to point of error (a node)
|
||||
int sexp_tree::node_error(int node, char *msg, int *bypass)
|
||||
int sexp_tree::node_error(int node, const char *msg, int *bypass)
|
||||
{
|
||||
char text[512];
|
||||
|
||||
@@ -3249,7 +3275,8 @@ void sexp_tree::verify_and_fix_arguments(int node)
|
||||
(arg_num == 2 && Operators[op].value == OP_STRING_CONCATENATE) ||
|
||||
(arg_num == 1 && Operators[op].value == OP_INT_TO_STRING) ||
|
||||
(arg_num == 3 && Operators[op].value == OP_STRING_GET_SUBSTRING) ||
|
||||
(arg_num == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING))
|
||||
(arg_num == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING) ||
|
||||
(arg_num == 1 && Operators[op].value == OP_COPY_VARIABLE_FROM_INDEX))
|
||||
{
|
||||
// make text_ptr to start - before '('
|
||||
get_variable_name_from_sexp_tree_node_text(tree_nodes[item_index].text, default_variable_text);
|
||||
@@ -3365,7 +3392,7 @@ void sexp_tree::verify_and_fix_arguments(int node)
|
||||
flag--;
|
||||
}
|
||||
|
||||
void sexp_tree::replace_data(char *data, int type)
|
||||
void sexp_tree::replace_data(const char *data, int type)
|
||||
{
|
||||
int node;
|
||||
HTREEITEM h;
|
||||
@@ -3429,7 +3456,7 @@ void sexp_tree::replace_variable_data(int var_idx, int type)
|
||||
|
||||
|
||||
|
||||
void sexp_tree::replace_operator(char *op)
|
||||
void sexp_tree::replace_operator(const char *op)
|
||||
{
|
||||
int node;
|
||||
HTREEITEM h;
|
||||
@@ -3826,7 +3853,7 @@ HTREEITEM sexp_tree::handle(int node)
|
||||
return tree_nodes[node].handle;
|
||||
}
|
||||
|
||||
char *sexp_tree::help(int code)
|
||||
const char *sexp_tree::help(int code)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -3863,7 +3890,7 @@ int sexp_tree::get_type(HTREEITEM h)
|
||||
|
||||
void sexp_tree::update_help(HTREEITEM h)
|
||||
{
|
||||
char *str;
|
||||
const char *str;
|
||||
int i, j, z, c, code, index, sibling_place;
|
||||
CString text;
|
||||
|
||||
@@ -3917,14 +3944,14 @@ void sexp_tree::update_help(HTREEITEM h)
|
||||
char buffer[10240] = {""};
|
||||
|
||||
//Get the help for the current operator
|
||||
char *helpstr = help(code);
|
||||
const char *helpstr = help(code);
|
||||
bool display_number = true;
|
||||
|
||||
//If a help string exists, try to display it
|
||||
if(helpstr != NULL)
|
||||
{
|
||||
char searchstr[32];
|
||||
char *loc=NULL, *loc2=NULL;
|
||||
const char *loc=NULL, *loc2=NULL;
|
||||
|
||||
if(loc == NULL)
|
||||
{
|
||||
@@ -4022,7 +4049,7 @@ void sexp_tree::update_help(HTREEITEM h)
|
||||
|
||||
// find list of sexp_tree nodes with text
|
||||
// stuff node indices into find[]
|
||||
int sexp_tree::find_text(char *text, int *find)
|
||||
int sexp_tree::find_text(const char *text, int *find)
|
||||
{
|
||||
uint i;
|
||||
int find_count;
|
||||
@@ -4335,6 +4362,10 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
|
||||
list = get_listing_opf_skybox_model();
|
||||
break;
|
||||
|
||||
case OPF_SKYBOX_FLAGS:
|
||||
list = get_listing_opf_skybox_flags();
|
||||
break;
|
||||
|
||||
case OPF_BACKGROUND_BITMAP:
|
||||
list = get_listing_opf_background_bitmap();
|
||||
break;
|
||||
@@ -4435,6 +4466,10 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
|
||||
list = get_listing_opf_nebula_patterns();
|
||||
break;
|
||||
|
||||
case OPF_GAME_SND:
|
||||
list = get_listing_opf_game_snds();
|
||||
break;
|
||||
|
||||
default:
|
||||
Int3(); // unknown OPF code
|
||||
list = NULL;
|
||||
@@ -5628,12 +5663,13 @@ sexp_list_item *sexp_tree::get_listing_opf_medal_name()
|
||||
int i;
|
||||
sexp_list_item head;
|
||||
|
||||
for (i=0; i<MAX_ASSIGNABLE_MEDALS; i++)
|
||||
for (i=0; i<Num_medals; i++)
|
||||
{
|
||||
// don't add Rank or the Ace badges
|
||||
if ((i == Rank_medal_index) || (Medals[i].kills_needed > 0))
|
||||
continue;
|
||||
head.add_data(Medals[i].name);
|
||||
|
||||
// also add SOC crest (index 17) and Wings (index 13)
|
||||
head.add_data(Medals[13].name);
|
||||
head.add_data(Medals[17].name);
|
||||
}
|
||||
|
||||
return head.next;
|
||||
}
|
||||
@@ -5778,6 +5814,17 @@ sexp_list_item *sexp_tree::get_listing_opf_skybox_model()
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_skybox_flags()
|
||||
{
|
||||
sexp_list_item head;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Num_skybox_flags; ++i) {
|
||||
head.add_data(Skybox_flags[i]);
|
||||
}
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_background_bitmap()
|
||||
{
|
||||
sexp_list_item head;
|
||||
@@ -5785,7 +5832,7 @@ sexp_list_item *sexp_tree::get_listing_opf_background_bitmap()
|
||||
|
||||
for (i=0; i < stars_get_num_entries(false, true); i++)
|
||||
{
|
||||
head.add_data( (char*)stars_get_name_FRED(i, false) );
|
||||
head.add_data( stars_get_name_FRED(i, false) );
|
||||
}
|
||||
|
||||
return head.next;
|
||||
@@ -5798,7 +5845,7 @@ sexp_list_item *sexp_tree::get_listing_opf_sun_bitmap()
|
||||
|
||||
for (i=0; i < stars_get_num_entries(true, true); i++)
|
||||
{
|
||||
head.add_data( (char*)stars_get_name_FRED(i, true) );
|
||||
head.add_data( stars_get_name_FRED(i, true) );
|
||||
}
|
||||
|
||||
return head.next;
|
||||
@@ -5974,7 +6021,20 @@ sexp_list_item *sexp_tree::get_listing_opf_nebula_patterns()
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_game_snds()
|
||||
{
|
||||
sexp_list_item head;
|
||||
|
||||
head.add_data(SEXP_NONE_STRING);
|
||||
|
||||
for (SCP_vector<game_snd>::iterator iter = Snds.begin(); iter != Snds.end(); ++iter) {
|
||||
if (!can_construe_as_integer(iter->name.c_str())) {
|
||||
head.add_data(iter->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
// Deletes sexp_variable from sexp_tree.
|
||||
// resets tree to not include given variable, and resets text and type
|
||||
|
||||
+25
-20
@@ -97,19 +97,22 @@ class sexp_list_item
|
||||
public:
|
||||
int type;
|
||||
int op;
|
||||
char *text;
|
||||
const char *text;
|
||||
int flags;
|
||||
sexp_list_item *next;
|
||||
|
||||
sexp_list_item() : flags(0), next(NULL) {}
|
||||
|
||||
void set_op(int op_num);
|
||||
void set_data(char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void set_data_dup(char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void set_data(const char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void set_data_dup(const char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
|
||||
void add_op(int op_num);
|
||||
void add_data(char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void add_data(const char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void add_data_dup(const char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void add_list(sexp_list_item *list);
|
||||
|
||||
void shallow_copy(const sexp_list_item *src);
|
||||
void destroy();
|
||||
};
|
||||
|
||||
@@ -118,19 +121,19 @@ class sexp_tree : public CTreeCtrl
|
||||
public:
|
||||
sexp_tree();
|
||||
|
||||
int find_text(char *text, int *find);
|
||||
int find_text(const char *text, int *find);
|
||||
int query_restricted_opf_range(int opf);
|
||||
void verify_and_fix_arguments(int node);
|
||||
void post_load();
|
||||
void update_help(HTREEITEM h);
|
||||
char *help(int code);
|
||||
const char *help(int code);
|
||||
HTREEITEM insert(LPCTSTR lpszItem, int image = BITMAP_ROOT, int sel_image = BITMAP_ROOT, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST);
|
||||
HTREEITEM handle(int node);
|
||||
int get_type(HTREEITEM h);
|
||||
void setup(CEdit *ptr = NULL);
|
||||
int query_false(int node = -1);
|
||||
int add_default_operator(int op, int argnum);
|
||||
int get_default_value(sexp_list_item *item, int op, int i);
|
||||
int get_default_value(sexp_list_item *item, char *text_buf, int op, int i);
|
||||
int query_default_argument_available(int op);
|
||||
int query_default_argument_available(int op, int i);
|
||||
void swap_roots(HTREEITEM one, HTREEITEM two);
|
||||
@@ -139,13 +142,13 @@ public:
|
||||
void copy_branch(HTREEITEM source, HTREEITEM parent = TVI_ROOT, HTREEITEM after = TVI_LAST);
|
||||
void setup_selected(HTREEITEM h = NULL);
|
||||
void add_or_replace_operator(int op, int replace_flag = 0);
|
||||
void replace_one_arg_operator(char *op, char *data, int type);
|
||||
void replace_operator(char *op);
|
||||
void replace_data(char *data, int type);
|
||||
// void replace_one_arg_operator(const char *op, const char *data, int type);
|
||||
void replace_operator(const char *op);
|
||||
void replace_data(const char *data, int type);
|
||||
void replace_variable_data(int var_idx, int type);
|
||||
void link_modified(int *ptr);
|
||||
void ensure_visible(int node);
|
||||
int node_error(int node, char *msg, int *bypass);
|
||||
int node_error(int node, const char *msg, int *bypass);
|
||||
void expand_branch(HTREEITEM h);
|
||||
void expand_operator(int node);
|
||||
void merge_operator(int node);
|
||||
@@ -156,23 +159,23 @@ public:
|
||||
void right_clicked(int mode = 0);
|
||||
int ctree_size;
|
||||
virtual void build_tree();
|
||||
void set_node(int index, int type, char *text);
|
||||
void set_node(int index, int type, const char *text);
|
||||
void free_node(int node, int cascade = 0);
|
||||
int allocate_node(int parent, int after = -1);
|
||||
int allocate_node();
|
||||
int find_free_node();
|
||||
void clear_tree(char *op = NULL);
|
||||
void clear_tree(const char *op = NULL);
|
||||
void reset_handles();
|
||||
int save_tree(int node = -1);
|
||||
void load_tree(int index, char *deflt = "true");
|
||||
void add_one_arg_operator(char *op, char *data, int type);
|
||||
void add_operator(char *op, HTREEITEM h = TVI_ROOT);
|
||||
int add_data(char *data, int type);
|
||||
int add_variable_data(char *data, int type);
|
||||
void load_tree(int index, const char *deflt = "true");
|
||||
void add_one_arg_operator(const char *op, const char *data, int type);
|
||||
void add_operator(const char *op, HTREEITEM h = TVI_ROOT);
|
||||
int add_data(const char *data, int type);
|
||||
int add_variable_data(const char *data, int type);
|
||||
void add_sub_tree(int node, HTREEITEM root);
|
||||
int load_sub_tree(int index, bool valid, char *text);
|
||||
int load_sub_tree(int index, bool valid, const char *text);
|
||||
void hilite_item(int node);
|
||||
char *match_closest_operator(char *str, int node);
|
||||
const char *match_closest_operator(const char *str, int node);
|
||||
void delete_sexp_tree_variable(const char *var_name);
|
||||
void modify_sexp_tree_variable(const char *old_name, int sexp_var_index);
|
||||
int get_item_index_to_var_index();
|
||||
@@ -233,6 +236,7 @@ public:
|
||||
sexp_list_item *get_listing_opf_variable_names();
|
||||
sexp_list_item *get_listing_opf_variable_type();
|
||||
sexp_list_item *get_listing_opf_skybox_model();
|
||||
sexp_list_item *get_listing_opf_skybox_flags();
|
||||
sexp_list_item *get_listing_opf_background_bitmap();
|
||||
sexp_list_item *get_listing_opf_sun_bitmap();
|
||||
sexp_list_item *get_listing_opf_nebula_storm_type();
|
||||
@@ -272,6 +276,7 @@ public:
|
||||
sexp_list_item *get_listing_opf_ship_flags();
|
||||
sexp_list_item *get_listing_opf_team_colors();
|
||||
sexp_list_item *get_listing_opf_nebula_patterns();
|
||||
sexp_list_item *get_listing_opf_game_snds();
|
||||
|
||||
int m_mode;
|
||||
int item_index;
|
||||
|
||||
@@ -471,7 +471,7 @@ void ship_select::OnSelchangeWingList()
|
||||
if (z != wing_sel_last[i]) {
|
||||
waypoint_list *wp_list = find_waypoint_list_at_index(wing_index[i]);
|
||||
Assert(wp_list != NULL);
|
||||
SCP_list<waypoint>::iterator jj;
|
||||
SCP_vector<waypoint>::iterator jj;
|
||||
for (j = 0, jj = wp_list->get_waypoints().begin(); jj != wp_list->get_waypoints().end(); ++j, ++jj) {
|
||||
for (k=0; k<list_size; k++) {
|
||||
if ((obj_index[k]->type == OBJ_WAYPOINT) && (obj_index[k]->instance == calc_waypoint_instance(wing_index[i], j))) {
|
||||
@@ -518,7 +518,7 @@ void ship_select::OnSelchangeShipList()
|
||||
for (i=wlist_size; i<wplist_size; i++) {
|
||||
waypoint_list *wp_list = find_waypoint_list_at_index(wing_index[i]);
|
||||
Assert(wp_list != NULL);
|
||||
SCP_list<waypoint>::iterator jj;
|
||||
SCP_vector<waypoint>::iterator jj;
|
||||
|
||||
count = 0;
|
||||
for (j = 0, jj = wp_list->get_waypoints().begin(); jj != wp_list->get_waypoints().end(); ++j, ++jj) {
|
||||
|
||||
@@ -1164,7 +1164,7 @@ int CShipEditorDlg::update_data(int redraw)
|
||||
break;
|
||||
|
||||
Assert(i < Wings[wing].wave_count);
|
||||
sprintf(old_name, "%s %d", Wings[wing].name, i + 1);
|
||||
wing_bash_ship_name(old_name, Wings[wing].name, i + 1);
|
||||
if (strcmp(old_name, m_ship_name)) {
|
||||
if (bypass_errors)
|
||||
return 0;
|
||||
@@ -2037,7 +2037,7 @@ void CShipEditorDlg::OnSpecialExp()
|
||||
// alternate ship name stuff
|
||||
void CShipEditorDlg::ship_alt_name_init(int base_ship)
|
||||
{
|
||||
int idx;
|
||||
int idx, sel_idx;
|
||||
CComboBox *ptr = (CComboBox*)GetDlgItem(IDC_SHIP_ALT);
|
||||
if(ptr == NULL){
|
||||
Int3();
|
||||
@@ -2054,21 +2054,17 @@ void CShipEditorDlg::ship_alt_name_init(int base_ship)
|
||||
// reset the combobox and add all relevant strings
|
||||
ptr->ResetContent();
|
||||
ptr->AddString("<none>");
|
||||
sel_idx = (base_ship < 0 || !strlen(Fred_alt_names[base_ship])) ? -1 : -2;
|
||||
for(idx=0; idx<Mission_alt_type_count; idx++){
|
||||
ptr->AddString(Mission_alt_types[idx]);
|
||||
if (sel_idx == -2 && !strcmp(Mission_alt_types[idx], Fred_alt_names[base_ship])) {
|
||||
sel_idx = idx;
|
||||
}
|
||||
}
|
||||
Assertion(sel_idx >= -1, "Alt name exists but can't be found in Mission_alt_types; get a coder!\n");
|
||||
|
||||
// "none"
|
||||
if(base_ship < 0){
|
||||
ptr->SetCurSel(0);
|
||||
}
|
||||
|
||||
// otherwise look his stuff up
|
||||
if(strlen(Fred_alt_names[base_ship])){
|
||||
ptr->SelectString(0, Fred_alt_names[base_ship]);
|
||||
} else {
|
||||
ptr->SetCurSel(0);
|
||||
}
|
||||
sel_idx += 1;
|
||||
ptr->SetCurSel(sel_idx);
|
||||
}
|
||||
|
||||
void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
@@ -2137,7 +2133,7 @@ void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
// callsign stuff
|
||||
void CShipEditorDlg::ship_callsign_init(int base_ship)
|
||||
{
|
||||
int idx;
|
||||
int idx, sel_idx;
|
||||
CComboBox *ptr = (CComboBox*)GetDlgItem(IDC_SHIP_CALLSIGN);
|
||||
if(ptr == NULL){
|
||||
Int3();
|
||||
@@ -2154,21 +2150,17 @@ void CShipEditorDlg::ship_callsign_init(int base_ship)
|
||||
// reset the combobox and add all relevant strings
|
||||
ptr->ResetContent();
|
||||
ptr->AddString("<none>");
|
||||
sel_idx = (base_ship < 0 || !strlen(Fred_callsigns[base_ship])) ? -1 : -2;
|
||||
for(idx=0; idx<Mission_callsign_count; idx++){
|
||||
ptr->AddString(Mission_callsigns[idx]);
|
||||
if (sel_idx == -2 && !strcmp(Mission_callsigns[idx], Fred_callsigns[base_ship])) {
|
||||
sel_idx = idx;
|
||||
}
|
||||
}
|
||||
Assertion(sel_idx >= -1, "Callsign exists but can't be found in Mission_callsigns; get a coder!\n");
|
||||
|
||||
// "none"
|
||||
if(base_ship < 0){
|
||||
ptr->SetCurSel(0);
|
||||
}
|
||||
|
||||
// otherwise look his stuff up
|
||||
if(strlen(Fred_callsigns[base_ship])){
|
||||
ptr->SelectString(0, Fred_callsigns[base_ship]);
|
||||
} else {
|
||||
ptr->SetCurSel(0);
|
||||
}
|
||||
sel_idx += 1;
|
||||
ptr->SetCurSel(sel_idx);
|
||||
}
|
||||
|
||||
void CShipEditorDlg::ship_callsign_close(int base_ship)
|
||||
|
||||
@@ -74,7 +74,9 @@ void ship_flags_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name);
|
||||
DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets);
|
||||
DDX_Control(pDX, IDC_CLOAKED, m_cloaked);
|
||||
DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide);
|
||||
DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically);
|
||||
DDX_Control(pDX, IDC_SCRAMBLE_MESSAGES, m_scramble_messages);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
if (pDX->m_bSaveAndValidate) { // get dialog control values
|
||||
@@ -138,6 +140,8 @@ BEGIN_MESSAGE_MAP(ship_flags_dlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_SET_CLASS_DYNAMICALLY, OnSetClassDynamically)
|
||||
ON_BN_CLICKED(IDC_DISABLE_ETS, OnDisableETS)
|
||||
ON_BN_CLICKED(IDC_CLOAKED, OnCloaked)
|
||||
ON_BN_CLICKED(IDC_SCRAMBLE_MESSAGES, OnScrambleMessages)
|
||||
ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
@@ -158,8 +162,8 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
int hidden_from_sensors = 0, primitive_sensors = 0, no_subspace_drive = 0, affected_by_gravity = 0;
|
||||
int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0;
|
||||
int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0;
|
||||
int no_death_scream = 0, always_death_scream = 0;
|
||||
int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0;
|
||||
int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0;
|
||||
int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0;
|
||||
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
@@ -207,6 +211,8 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
hide_ship_name = (shipp->flags2 & SF2_HIDE_SHIP_NAME) ? 1 : 0;
|
||||
no_ets = (shipp->flags2 & SF2_NO_ETS) ? 1 : 0;
|
||||
cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0;
|
||||
scramble_messages = (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) ? 1 : 0;
|
||||
no_collide = (objp->flags & OF_COLLIDES) ? 0 : 1;
|
||||
|
||||
destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0;
|
||||
m_destroy_value.init(shipp->final_death_time);
|
||||
@@ -266,6 +272,8 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
hide_ship_name = tristate_set(shipp->flags2 & SF2_HIDE_SHIP_NAME, hide_ship_name);
|
||||
no_ets = tristate_set(shipp->flags2 & SF2_NO_ETS, no_ets);
|
||||
cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked);
|
||||
scramble_messages = tristate_set(shipp->flags2 & SF2_SCRAMBLE_MESSAGES, scramble_messages);
|
||||
no_collide = tristate_set(!(objp->flags & OF_COLLIDES), no_collide);
|
||||
|
||||
// check the final death time and set the internal variable according to whether or not
|
||||
// the final_death_time is set. Also, the value in the edit box must be set if all the
|
||||
@@ -339,6 +347,8 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
m_hide_ship_name.SetCheck(hide_ship_name);
|
||||
m_disable_ets.SetCheck(no_ets);
|
||||
m_cloaked.SetCheck(cloaked);
|
||||
m_scramble_messages.SetCheck(scramble_messages);
|
||||
m_no_collide.SetCheck(no_collide);
|
||||
|
||||
m_kdamage.setup(IDC_KDAMAGE, this);
|
||||
m_destroy_value.setup(IDC_DESTROY_VALUE, this);
|
||||
@@ -956,6 +966,22 @@ void ship_flags_dlg::update_ship(int shipnum)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_no_collide.GetCheck()) {
|
||||
case 1:
|
||||
if ( objp->flags & OF_COLLIDES )
|
||||
set_modified();
|
||||
|
||||
objp->flags &= ~OF_COLLIDES;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if (!(objp->flags & OF_COLLIDES))
|
||||
set_modified();
|
||||
|
||||
objp->flags |= OF_COLLIDES;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_guardian.GetCheck()) {
|
||||
case 1:
|
||||
if ( !(shipp->ship_guardian_threshold) )
|
||||
@@ -1020,6 +1046,23 @@ void ship_flags_dlg::update_ship(int shipnum)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_scramble_messages.GetCheck()) {
|
||||
case 1:
|
||||
if ( !(shipp->flags2 & SF2_SCRAMBLE_MESSAGES) )
|
||||
set_modified();
|
||||
|
||||
shipp->flags2 |= SF2_SCRAMBLE_MESSAGES;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if ( shipp->flags2 & SF2_SCRAMBLE_MESSAGES )
|
||||
set_modified();
|
||||
|
||||
shipp->flags2 &= ~SF2_SCRAMBLE_MESSAGES;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
shipp->respawn_priority = 0;
|
||||
if(The_mission.game_type & MISSION_TYPE_MULTI) {
|
||||
m_respawn_priority.save(&shipp->respawn_priority);
|
||||
@@ -1362,8 +1405,6 @@ void ship_flags_dlg::OnHideShipName()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ship_flags_dlg::OnDisableETS()
|
||||
{
|
||||
if (m_disable_ets.GetCheck() == 1) {
|
||||
@@ -1381,3 +1422,21 @@ void ship_flags_dlg::OnCloaked()
|
||||
m_cloaked.SetCheck(1);
|
||||
}
|
||||
}
|
||||
|
||||
void ship_flags_dlg::OnScrambleMessages()
|
||||
{
|
||||
if (m_scramble_messages.GetCheck() == 1) {
|
||||
m_scramble_messages.SetCheck(0);
|
||||
} else {
|
||||
m_scramble_messages.SetCheck(1);
|
||||
}
|
||||
}
|
||||
|
||||
void ship_flags_dlg::OnNoCollide()
|
||||
{
|
||||
if (m_no_collide.GetCheck() == 1) {
|
||||
m_no_collide.SetCheck(0);
|
||||
} else {
|
||||
m_no_collide.SetCheck(1);
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,10 @@ public:
|
||||
CButton m_hide_ship_name;
|
||||
CButton m_disable_ets;
|
||||
CButton m_cloaked;
|
||||
CButton m_no_collide;
|
||||
CButton m_set_class_dynamically;
|
||||
CButton m_scramble_messages;
|
||||
|
||||
CSpinButtonCtrl m_destroy_spin;
|
||||
numeric_edit_control m_kdamage;
|
||||
numeric_edit_control m_destroy_value;
|
||||
@@ -123,6 +126,8 @@ protected:
|
||||
afx_msg void OnSetClassDynamically();
|
||||
afx_msg void OnDisableETS();
|
||||
afx_msg void OnCloaked();
|
||||
afx_msg void OnScrambleMessages();
|
||||
afx_msg void OnNoCollide();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
@@ -54,7 +54,7 @@ END_MESSAGE_MAP()
|
||||
|
||||
void CShipTexturesDlg::OnOK()
|
||||
{
|
||||
int i, k, write_index, z, not_found, temp_bmp, temp_frames, temp_fps;
|
||||
int i, z, not_found, temp_bmp, temp_frames, temp_fps;
|
||||
CString missing_files, message;
|
||||
char buf[10];
|
||||
|
||||
@@ -119,43 +119,40 @@ void CShipTexturesDlg::OnOK()
|
||||
// re-sort according to old
|
||||
sort_textures();
|
||||
|
||||
// overwrite old stuff
|
||||
k = 0;
|
||||
write_index = 0;
|
||||
while (k<(MAX_SHIPS * MAX_REPLACEMENT_TEXTURES))
|
||||
// overwrite all the old entries that refer to this ship
|
||||
SCP_vector<texture_replace>::iterator ii, end;
|
||||
end = Fred_texture_replacements.end();
|
||||
for (ii = Fred_texture_replacements.begin(); ii != end; ++ii)
|
||||
{
|
||||
//WMC - This loop will go on for a REALLY LONG TIME
|
||||
//I don't think we need to copy empty entries.
|
||||
if(!strlen(Fred_texture_replacements[k].ship_name))
|
||||
break;
|
||||
|
||||
if (stricmp(Fred_texture_replacements[k].ship_name, Ships[self_ship].ship_name))
|
||||
if (!stricmp(ii->ship_name, Ships[self_ship].ship_name))
|
||||
{
|
||||
// move up, but when copying, src and dest can't be the same
|
||||
if (k != write_index)
|
||||
{
|
||||
texture_set(&Fred_texture_replacements[write_index], &Fred_texture_replacements[k]);
|
||||
}
|
||||
write_index++;
|
||||
do {
|
||||
end--;
|
||||
} while (end != ii && !stricmp(end->ship_name, Ships[self_ship].ship_name));
|
||||
if (end == ii)
|
||||
break;
|
||||
texture_set(&(*ii), &(*end));
|
||||
}
|
||||
|
||||
k++;
|
||||
}
|
||||
Fred_num_texture_replacements = write_index;
|
||||
|
||||
// finally, assign duplicate textures to Fred array
|
||||
if (end != Fred_texture_replacements.end())
|
||||
Fred_texture_replacements.erase(end, Fred_texture_replacements.end());
|
||||
|
||||
// now put the new entries on the end of the list
|
||||
for (i=0; i<texture_count; i++)
|
||||
{
|
||||
// make sure there is an entry
|
||||
if (strlen(new_texture_name[i]))
|
||||
{
|
||||
// assign to global FRED array
|
||||
strcpy_s(Fred_texture_replacements[Fred_num_texture_replacements].old_texture, old_texture_name[i]);
|
||||
strcpy_s(Fred_texture_replacements[Fred_num_texture_replacements].new_texture, new_texture_name[i]);
|
||||
strcpy_s(Fred_texture_replacements[Fred_num_texture_replacements].ship_name, Ships[self_ship].ship_name);
|
||||
texture_replace tr;
|
||||
|
||||
// increment
|
||||
Fred_num_texture_replacements++;
|
||||
strcpy_s(tr.old_texture, old_texture_name[i]);
|
||||
strcpy_s(tr.new_texture, new_texture_name[i]);
|
||||
strcpy_s(tr.ship_name, Ships[self_ship].ship_name);
|
||||
tr.new_texture_id = -1;
|
||||
|
||||
// assign to global FRED array
|
||||
Fred_texture_replacements.push_back(tr);
|
||||
}
|
||||
}
|
||||
} // skipped here if nothing modified
|
||||
@@ -222,42 +219,41 @@ BOOL CShipTexturesDlg::OnInitDialog()
|
||||
// make old texture lowercase
|
||||
strlwr(texture_file);
|
||||
|
||||
// now add it to the box
|
||||
z = box->AddString(texture_file);
|
||||
|
||||
// and add it to the field as well
|
||||
// add it to the field
|
||||
strcpy_s(old_texture_name[texture_count], texture_file);
|
||||
|
||||
// increment
|
||||
texture_count++;
|
||||
|
||||
// sort
|
||||
sort_textures();
|
||||
}
|
||||
}
|
||||
|
||||
// now sort the filenames
|
||||
sort_textures();
|
||||
|
||||
// and add them to the box
|
||||
for (i=0; i<texture_count; i++) {
|
||||
z = box->AddString(old_texture_name[i]);
|
||||
}
|
||||
|
||||
// now look for new textures
|
||||
k=0;
|
||||
while (k < Fred_num_texture_replacements)
|
||||
for (SCP_vector<texture_replace>::iterator ii = Fred_texture_replacements.begin(); ii != Fred_texture_replacements.end(); ++ii)
|
||||
{
|
||||
if (!stricmp(Ships[self_ship].ship_name, Fred_texture_replacements[k].ship_name))
|
||||
if (!stricmp(Ships[self_ship].ship_name, ii->ship_name))
|
||||
{
|
||||
// look for corresponding old texture
|
||||
for (i=0; i<texture_count; i++)
|
||||
{
|
||||
// if match
|
||||
if (!stricmp(old_texture_name[i], Fred_texture_replacements[k].old_texture))
|
||||
if (!stricmp(old_texture_name[i], ii->old_texture))
|
||||
{
|
||||
// assign new texture
|
||||
strcpy_s(new_texture_name[i], Fred_texture_replacements[k].new_texture);
|
||||
strcpy_s(new_texture_name[i], ii->new_texture);
|
||||
|
||||
// we found one, so no more to check
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
k++; // increment down the list of texture replacements
|
||||
}
|
||||
// end of new texture check
|
||||
|
||||
|
||||
@@ -52,8 +52,7 @@ void text_view_dlg::set(int ship_class)
|
||||
{
|
||||
char line[256], line2[256], file_text[82];
|
||||
int i, j, n, found = 0, comment = 0, num_files = 0;
|
||||
char tbl_file_arr[MAX_TBL_PARTS][MAX_FILENAME_LEN];
|
||||
char *tbl_file_names[MAX_TBL_PARTS];
|
||||
SCP_vector<SCP_string> tbl_file_names;
|
||||
CFILE *fp;
|
||||
|
||||
if (ship_class < 0)
|
||||
@@ -112,12 +111,12 @@ void text_view_dlg::set(int ship_class)
|
||||
|
||||
|
||||
// done with ships.tbl, so now check all modular ship tables...
|
||||
num_files = cf_get_file_list_preallocated(MAX_TBL_PARTS, tbl_file_arr, tbl_file_names, CF_TYPE_TABLES, NOX("*-shp.tbm"), CF_SORT_REVERSE);
|
||||
num_files = cf_get_file_list(tbl_file_names, CF_TYPE_TABLES, NOX("*-shp.tbm"), CF_SORT_REVERSE);
|
||||
|
||||
for (n = 0; n < num_files; n++){
|
||||
strcat(tbl_file_names[n], ".tbm");
|
||||
tbl_file_names[n] += ".tbm";
|
||||
|
||||
fp = cfopen(tbl_file_names[n], "r");
|
||||
fp = cfopen(tbl_file_names[n].c_str(), "r");
|
||||
Assert(fp);
|
||||
|
||||
memset( line, 0, sizeof(line) );
|
||||
@@ -160,7 +159,7 @@ void text_view_dlg::set(int ship_class)
|
||||
|
||||
if (!stricmp(line2 + i, Ship_info[ship_class].name)) {
|
||||
memset( file_text, 0, sizeof(file_text) );
|
||||
snprintf(file_text, sizeof(file_text)-1, "-- %s -------------------------------\r\n", tbl_file_names[n]);
|
||||
snprintf(file_text, sizeof(file_text)-1, "-- %s -------------------------------\r\n", tbl_file_names[n].c_str());
|
||||
m_edit += file_text;
|
||||
found = 1;
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ void VoiceActingManager::OnGenerateFileNames()
|
||||
|
||||
// notify user that we are done and how many filenames were changed
|
||||
char message[128] = { '\0' };
|
||||
snprintf(message, sizeof(message), "File name generation complete. Modified %u messages.", modified_filenames);
|
||||
snprintf(message, sizeof(message)-1, "File name generation complete. Modified %u messages.", modified_filenames);
|
||||
MessageBox(message, "Woohoo!");
|
||||
}
|
||||
|
||||
|
||||
+2
-107
@@ -189,7 +189,7 @@ void remove_ship_from_wing(int ship, int min)
|
||||
obj = wing_objects[wing][i] = wing_objects[wing][end];
|
||||
Wings[wing].ship_index[i] = Wings[wing].ship_index[end];
|
||||
if (Objects[obj].type == OBJ_SHIP) {
|
||||
sprintf(buf, "%s %d", Wings[wing].name, i + 1);
|
||||
wing_bash_ship_name(buf, Wings[wing].name, i + 1);
|
||||
rename_ship(Wings[wing].ship_index[i], buf);
|
||||
}
|
||||
}
|
||||
@@ -383,7 +383,7 @@ int create_wing()
|
||||
remove_player_from_wing(ptr->instance);
|
||||
}
|
||||
|
||||
sprintf(msg, "%s %d", Wings[wing].name, i + 1);
|
||||
wing_bash_ship_name(msg, Wings[wing].name, i + 1);
|
||||
rename_ship(ship, msg);
|
||||
|
||||
Wings[wing].ship_index[i] = ship;
|
||||
@@ -512,108 +512,3 @@ int get_free_objnum(void)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Create a wing.
|
||||
// wing_type is the type of wing from the Wing_formations array to create.
|
||||
// leader_index is the index in Objects of the leader object. This object must
|
||||
// have a position and an orientation.
|
||||
// *wingmen is a list of indices of existing ships to be added to the wing.
|
||||
// The wingmen list is terminated by -1.
|
||||
// max_size is the maximum number of ships to add to the wing
|
||||
// fill_flag is set if more ships are to be added to fill out the wing to max_size
|
||||
void create_wing(int wing_type, int leader_index, int *wingmen, int max_size, int fill_flag)
|
||||
{
|
||||
int num_placed, num_vectors, cur_vec_index;
|
||||
object *lobjp = &Objects[leader_index];
|
||||
formation *wingp;
|
||||
object *parent;
|
||||
int wing_list[MAX_OBJECTS];
|
||||
matrix rotmat;
|
||||
|
||||
initialize_wings();
|
||||
|
||||
Assert((wing_type >= 0) && (wing_type < MAX_WING_FORMATIONS));
|
||||
Assert(Wing_formations[wing_type].num_vectors > 0);
|
||||
Assert(Wing_formations[wing_type].num_vectors < MAX_WING_VECTORS);
|
||||
|
||||
Assert(Objects[leader_index].type != OBJ_NONE);
|
||||
Assert(max_size < MAX_SHIPS_PER_WING);
|
||||
|
||||
num_placed = 0;
|
||||
wingp = &Wing_formations[wing_type];
|
||||
num_vectors = wingp->num_vectors;
|
||||
cur_vec_index = 0;
|
||||
parent = lobjp;
|
||||
vm_copy_transpose_matrix(&rotmat, &lobjp->orient);
|
||||
|
||||
while (num_placed < max_size) {
|
||||
vec3d wvec;
|
||||
int curobj;
|
||||
|
||||
if (*wingmen == -1) {
|
||||
if (!fill_flag)
|
||||
break;
|
||||
else {
|
||||
curobj = get_free_objnum();
|
||||
Assert(curobj != -1);
|
||||
Objects[curobj].type = lobjp->type;
|
||||
Assert(Wings[cur_wing].wave_count < MAX_SHIPS_PER_WING);
|
||||
// JEH Wings[cur_wing].ship_list[Wings[cur_wing].count] = curobj;
|
||||
Wings[cur_wing].wave_count++;
|
||||
}
|
||||
} else
|
||||
curobj = *wingmen++;
|
||||
|
||||
Objects[curobj] = *lobjp;
|
||||
vm_vec_rotate(&wvec, &wingp->offsets[cur_vec_index], &rotmat);
|
||||
cur_vec_index = (cur_vec_index + 1) % num_vectors;
|
||||
|
||||
if (num_placed < num_vectors)
|
||||
parent = lobjp;
|
||||
else
|
||||
parent = &Objects[wing_list[num_placed - num_vectors]];
|
||||
|
||||
wing_list[num_placed] = curobj;
|
||||
|
||||
vm_vec_add(&Objects[curobj].pos, &parent->pos, &wvec);
|
||||
|
||||
num_placed++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Create a wing.
|
||||
// cur_object_index becomes the leader.
|
||||
// If count == -1, then all objects of wing cur_wing get added to the wing.
|
||||
// If count == +n, then n objects are added to the wing.
|
||||
void test_form_wing(int count)
|
||||
{
|
||||
int i, wingmen[MAX_OBJECTS];
|
||||
int j, fill_flag;
|
||||
|
||||
j = 0;
|
||||
|
||||
Assert(cur_object_index != -1);
|
||||
Assert(Objects[cur_object_index].type != OBJ_NONE);
|
||||
Assert(get_wingnum(cur_object_index) != -1);
|
||||
get_wingnum(cur_object_index);
|
||||
|
||||
wingmen[0] = -1;
|
||||
|
||||
for (i=1; i<MAX_OBJECTS; i++)
|
||||
if ((get_wingnum(i) == cur_wing) && (Objects[i].type != OBJ_NONE))
|
||||
if (i != cur_object_index)
|
||||
wingmen[j++] = i;
|
||||
|
||||
wingmen[j] = -1;
|
||||
|
||||
fill_flag = 0;
|
||||
|
||||
if (count > 0) {
|
||||
fill_flag = 1;
|
||||
j += count;
|
||||
}
|
||||
|
||||
set_wingnum(cur_object_index, cur_wing);
|
||||
create_wing(0, cur_object_index, wingmen, j, fill_flag);
|
||||
}
|
||||
@@ -693,7 +693,7 @@ int wing_editor::update_data(int redraw)
|
||||
|
||||
for (i=0; i<Wings[cur_wing].wave_count; i++) {
|
||||
if ((Objects[wing_objects[cur_wing][i]].type == OBJ_SHIP) || (Objects[wing_objects[cur_wing][i]].type == OBJ_START)) {
|
||||
sprintf(buf, "%s %d", str, i + 1);
|
||||
wing_bash_ship_name(buf, str, i + 1);
|
||||
rename_ship(Wings[cur_wing].ship_index[i], buf);
|
||||
}
|
||||
}
|
||||
|
||||
+559
-421
File diff suppressed because it is too large.
Load diff
@@ -36,6 +36,8 @@ extern fix Frametime;
|
||||
extern float flRealframetime;
|
||||
extern float flFrametime;
|
||||
extern fix Missiontime;
|
||||
extern int Last_frame_timestamp; // A timestamp for when the previous frame ended
|
||||
extern fix Skybox_timestamp; // A timestamp for animated skyboxes -MageKing17
|
||||
|
||||
// 0 - 4
|
||||
extern int Game_skill_level;
|
||||
|
||||
@@ -336,8 +336,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,0,9755
|
||||
PRODUCTVERSION 3,7,0,9755
|
||||
FILEVERSION 3,7,3,000000
|
||||
PRODUCTVERSION 3,7,3,000000
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -354,12 +354,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Volition Inc."
|
||||
VALUE "FileDescription", "FreeSpace 2 Open"
|
||||
VALUE "FileVersion", "3.7.0.9755"
|
||||
VALUE "FileVersion", "3.7.3.000000"
|
||||
VALUE "InternalName", "FreeSpace 2 Open"
|
||||
VALUE "LegalCopyright", "Copyright © 1998"
|
||||
VALUE "OriginalFilename", "fs2.exe"
|
||||
VALUE "ProductName", "FreeSpace 2 Open"
|
||||
VALUE "ProductVersion", "3.7.0"
|
||||
VALUE "ProductVersion", "3.7.3"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <cstdio>
|
||||
@@ -51,7 +52,7 @@
|
||||
|
||||
|
||||
extern int Multi_debrief_stats_accept_code;
|
||||
extern void HUD_printf(char *format, ...);
|
||||
extern void HUD_printf(const char *format, ...);
|
||||
extern int game_hacked_data();
|
||||
|
||||
|
||||
@@ -122,8 +123,19 @@ void fs2netd_options_config_init()
|
||||
}
|
||||
|
||||
if ( !strlen(Multi_options_g.tracker_port) ) {
|
||||
ml_printf("NOTICE: Port for game/user trackers not specified, using default instead (%s).", FS2NETD_DEFAULT_PORT);
|
||||
strncpy( Multi_options_g.tracker_port, FS2NETD_DEFAULT_PORT, STD_NAME_LEN );
|
||||
if ( FS2NetD_port >= 1024 && FS2NetD_port <= USHRT_MAX ) {
|
||||
ml_printf("NOTICE: User override for game/user tracker port not specified, using game_settings.tbl override (%i).", FS2NetD_port);
|
||||
int result;
|
||||
result = sprintf(Multi_options_g.tracker_port, "%i", FS2NetD_port);
|
||||
Assertion( result > 0, "Copying port %i to tracker_port failed\n", FS2NetD_port );
|
||||
}
|
||||
else {
|
||||
if ( FS2NetD_port != 0 ) {
|
||||
ml_printf("ERROR: game_settings.tbl override for game/user tracker port '%i' must be between %i and %i.", FS2NetD_port, 1024, USHRT_MAX);
|
||||
}
|
||||
ml_printf("NOTICE: Port for game/user trackers not specified, using default instead (%s).", FS2NETD_DEFAULT_PORT);
|
||||
strncpy( Multi_options_g.tracker_port, FS2NETD_DEFAULT_PORT, STD_NAME_LEN );
|
||||
}
|
||||
} else {
|
||||
long port_tmp = strtol(Multi_options_g.tracker_port, (char**)NULL, 10);
|
||||
|
||||
@@ -725,7 +737,7 @@ static void fs2netd_handle_messages()
|
||||
|
||||
case PCKT_SLIST_REPLY: {
|
||||
int numServers = 0;
|
||||
int svr_flags;
|
||||
int svr_flags __attribute__((__unused__)); // gcc [-Wunused-but-set-variable] doesn't like MACROs
|
||||
ushort svr_port;
|
||||
char svr_ip[16];
|
||||
active_game ag;
|
||||
@@ -1539,7 +1551,7 @@ int fs2netd_update_valid_tables()
|
||||
return hacked;
|
||||
}
|
||||
|
||||
void fs2netd_add_table_validation(char *tblname)
|
||||
void fs2netd_add_table_validation(const char *tblname)
|
||||
{
|
||||
uint chksum = 0;
|
||||
|
||||
@@ -1560,7 +1572,7 @@ void fs2netd_add_table_validation(char *tblname)
|
||||
|
||||
crc_valid_status tbl_crc;
|
||||
|
||||
strncpy(tbl_crc.name, tblname, NAME_LENGTH);
|
||||
strcpy_s(tbl_crc.name, tblname);
|
||||
tbl_crc.crc32 = chksum;
|
||||
tbl_crc.valid = 0;
|
||||
|
||||
@@ -1583,9 +1595,6 @@ int fs2netd_get_pilot_info(const char *callsign, player *out_plr, bool first_cal
|
||||
new_plr.reset();
|
||||
strncpy( new_plr.callsign, callsign, CALLSIGN_LEN );
|
||||
|
||||
// initialize the stats to default values
|
||||
init_scoring_element( &new_plr.stats );
|
||||
|
||||
out_plr->reset();
|
||||
|
||||
Local_timeout = timer_get_seconds() + 30;
|
||||
@@ -1612,7 +1621,7 @@ int fs2netd_get_pilot_info(const char *callsign, player *out_plr, bool first_cal
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
memcpy( out_plr, &new_plr, sizeof(player) );
|
||||
out_plr->assign(&new_plr);
|
||||
In_process = false;
|
||||
Local_timeout = -1;
|
||||
}
|
||||
@@ -1637,7 +1646,7 @@ void fs2netd_close()
|
||||
FS2NetD_ban_list.clear();
|
||||
}
|
||||
|
||||
void fs2netd_update_game_count(char *chan_name)
|
||||
void fs2netd_update_game_count(const char *chan_name)
|
||||
{
|
||||
if ( !Logged_in ) {
|
||||
return;
|
||||
@@ -1653,7 +1662,6 @@ void fs2netd_update_game_count(char *chan_name)
|
||||
void fs2netd_spew_table_checksums(char *outfile)
|
||||
{
|
||||
char full_name[MAX_PATH_LEN];
|
||||
int count;
|
||||
FILE *out = NULL;
|
||||
char description[512] = { 0 };
|
||||
char filename[65] = { 0 };
|
||||
@@ -1676,7 +1684,7 @@ void fs2netd_spew_table_checksums(char *outfile)
|
||||
p = Cmdline_spew_table_crcs;
|
||||
|
||||
while (*p && (offset < sizeof(description))) {
|
||||
if (*p == '"') {
|
||||
if (*p == '"' && offset < sizeof(description)-1) {
|
||||
description[offset++] = '"';
|
||||
description[offset++] = '"';
|
||||
} else {
|
||||
@@ -1689,15 +1697,13 @@ void fs2netd_spew_table_checksums(char *outfile)
|
||||
// header
|
||||
fprintf(out, "filename,CRC32,description\r\n");
|
||||
|
||||
count = (int)Table_valid_status.size();
|
||||
|
||||
// do all the checksums
|
||||
for (SCP_vector<crc_valid_status>::iterator tvs = Table_valid_status.begin(); tvs != Table_valid_status.end(); ++tvs) {
|
||||
offset = 0;
|
||||
p = tvs->name;
|
||||
|
||||
while (*p && (offset < sizeof(filename))) {
|
||||
if (*p == '"') {
|
||||
if (*p == '"' && offset < sizeof(filename)-1) {
|
||||
filename[offset++] = '"';
|
||||
filename[offset++] = '"';
|
||||
} else {
|
||||
@@ -1707,7 +1713,11 @@ void fs2netd_spew_table_checksums(char *outfile)
|
||||
p++;
|
||||
}
|
||||
|
||||
filename[offset] = '\0';
|
||||
if (offset < sizeof(filename)) {
|
||||
filename[offset] = '\0';
|
||||
} else {
|
||||
filename[sizeof(filename)-1] = '\0';
|
||||
}
|
||||
|
||||
fprintf(out, "\"%s\",%u,\"%s\"\r\n", filename, tvs->crc32, description);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "network/multi.h"
|
||||
|
||||
struct net_addr;
|
||||
struct player;
|
||||
class player;
|
||||
|
||||
// channel to associate when creating a server
|
||||
extern char Multi_fs_tracker_channel[];
|
||||
@@ -77,8 +77,8 @@ int fs2netd_get_pilot_info(const char *callsign, player *out_plr, bool first_cal
|
||||
|
||||
void fs2netd_options_config_init();
|
||||
|
||||
void fs2netd_add_table_validation(char *tblname);
|
||||
void fs2netd_add_table_validation(const char *tblname);
|
||||
|
||||
void fs2netd_update_game_count(char *chan_name);
|
||||
void fs2netd_update_game_count(const char *chan_name);
|
||||
|
||||
#endif // _FS2NETD_CLIENT_H
|
||||
+11
-11
@@ -131,7 +131,6 @@ int FS2NetD_SendPlayerData(const char *player_name, player *pl, bool do_send)
|
||||
}
|
||||
|
||||
Assert( (num_type_kills >= 0) && (num_type_kills < USHRT_MAX) );
|
||||
|
||||
PXO_ADD_USHORT( (ushort)num_type_kills );
|
||||
|
||||
for (i = 0; i < MAX_SHIP_CLASSES; i++) {
|
||||
@@ -141,10 +140,11 @@ int FS2NetD_SendPlayerData(const char *player_name, player *pl, bool do_send)
|
||||
}
|
||||
}
|
||||
|
||||
PXO_ADD_USHORT( (ushort)MAX_MEDALS );
|
||||
Assert( (Num_medals >= 0) && (Num_medals < USHRT_MAX) );
|
||||
PXO_ADD_USHORT( (ushort)Num_medals );
|
||||
|
||||
for (i = 0; i < MAX_MEDALS; i++) {
|
||||
PXO_ADD_INT( pl->stats.medals[i] );
|
||||
for (i = 0; i < Num_medals; i++) {
|
||||
PXO_ADD_INT( pl->stats.medal_counts[i] );
|
||||
}
|
||||
|
||||
DONE_PACKET();
|
||||
@@ -249,7 +249,7 @@ int FS2NetD_GetPlayerData(const char *player_name, player *pl, bool can_create,
|
||||
}
|
||||
|
||||
// make sure that we get the entire packet
|
||||
while ( (rc_total < (uint)buffer_size) && (rc_total <= sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
|
||||
while ( (rc_total < (uint)buffer_size) && (rc_total < sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
|
||||
if ( FS2NetD_DataReady() ) {
|
||||
rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer) - rc_total);
|
||||
|
||||
@@ -303,8 +303,8 @@ int FS2NetD_GetPlayerData(const char *player_name, player *pl, bool can_create,
|
||||
|
||||
PXO_GET_USHORT( num_medals );
|
||||
|
||||
for (idx = 0; (idx < MAX_MEDALS) && (idx < num_medals); idx++) {
|
||||
PXO_GET_INT( pl->stats.medals[idx] );
|
||||
for (idx = 0; (idx < Num_medals) && (idx < num_medals); idx++) {
|
||||
PXO_GET_INT( pl->stats.medal_counts[idx] );
|
||||
}
|
||||
|
||||
return (int)reply_type;
|
||||
@@ -361,7 +361,7 @@ int FS2NetD_GetBanList(SCP_vector<SCP_string> &mask_list, bool do_send)
|
||||
}
|
||||
|
||||
// make sure that we get the entire packet
|
||||
while ( (rc_total < (uint)buffer_size) && (rc_total <= sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
|
||||
while ( (rc_total < (uint)buffer_size) && (rc_total < sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
|
||||
if ( FS2NetD_DataReady() ) {
|
||||
rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer) - rc_total);
|
||||
|
||||
@@ -435,7 +435,7 @@ int FS2NetD_GetMissionsList(SCP_vector<file_record> &m_list, bool do_send)
|
||||
}
|
||||
|
||||
// make sure that we get the entire packet
|
||||
while ( (rc_total < (uint)buffer_size) && (rc_total <= sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
|
||||
while ( (rc_total < (uint)buffer_size) && (rc_total < sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
|
||||
if ( FS2NetD_DataReady() ) {
|
||||
rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer) - rc_total);
|
||||
|
||||
@@ -735,7 +735,7 @@ int FS2NetD_ValidateTableList(bool do_send)
|
||||
}
|
||||
|
||||
// make sure that we get the entire packet
|
||||
while ( (rc_total < (uint)buffer_size) && (rc_total <= sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
|
||||
while ( (rc_total < (uint)buffer_size) && (rc_total < sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
|
||||
if ( FS2NetD_DataReady() ) {
|
||||
rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer) - rc_total);
|
||||
|
||||
@@ -773,7 +773,7 @@ int FS2NetD_ValidateTableList(bool do_send)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FS2NetD_GameCountUpdate(char *chan_name)
|
||||
void FS2NetD_GameCountUpdate(const char *chan_name)
|
||||
{
|
||||
int buffer_size;
|
||||
char buffer[MAX_PATH+BASE_PACKET_SIZE+10];
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
struct player;
|
||||
class player;
|
||||
struct netgame_info;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ void FS2NetD_SendServerDisconnect();
|
||||
|
||||
void FS2NetD_RequestServerList();
|
||||
|
||||
void FS2NetD_GameCountUpdate(char *chan_name);
|
||||
void FS2NetD_GameCountUpdate(const char *chan_name);
|
||||
|
||||
void FS2NetD_Ping();
|
||||
void FS2NetD_Pong(int tstamp);
|
||||
|
||||
@@ -62,7 +62,7 @@ void FS2NetD_Disconnect()
|
||||
int FS2NetD_ConnectToServer(const char *host, const char *port)
|
||||
{
|
||||
struct hostent *my_host = NULL;
|
||||
char host_str[5];
|
||||
char host_str[254]; // 253 is max domain name length: http://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax
|
||||
#ifdef SCP_UNIX
|
||||
int my_error = 0;
|
||||
#endif
|
||||
@@ -113,7 +113,7 @@ int FS2NetD_ConnectToServer(const char *host, const char *port)
|
||||
// want to keep this as clean and simple as possible and that means
|
||||
// using an actual standard :)
|
||||
|
||||
strncpy( host_str, host, sizeof(host_str) );
|
||||
strcpy_s( host_str, host );
|
||||
|
||||
// check that we aren't in a dotted format, some gethostbyname() implementations don't like that
|
||||
// (NOTE: Yes, I'm aware that this is problematic if a host name uses an initial digit)
|
||||
|
||||
Loaded 100 of 720 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user