mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-12 19:06:09 -10:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1c0fe5575 | ||
|
|
bec060a1f3 | ||
|
|
0023055743 | ||
|
|
5b42f396e4 | ||
|
|
2d36e7adc7 | ||
|
|
ceb9911c72 | ||
|
|
6758c9800c | ||
|
|
a99ce18da2 | ||
|
|
bc703bca1f | ||
|
|
0099852b3d | ||
|
|
d91ba6709f | ||
|
|
9f164b3cc4 | ||
|
|
7033dc1d9a | ||
|
|
674384dc7a | ||
|
|
e42e8dd96b |
No files matched your search
-268
@@ -1,268 +0,0 @@
|
||||
*.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,26 +1,6 @@
|
||||
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
|
||||
|
||||
|
||||
+1
-3
@@ -2,9 +2,7 @@
|
||||
#
|
||||
# This file uses GNU Automake to generate makefiles
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = mongoose code
|
||||
SUBDIRS = code
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
||||
+215
-14
@@ -9,7 +9,7 @@ dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_SDL],
|
||||
[dnl
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
@@ -72,7 +72,7 @@ char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
|
||||
@@ -80,7 +80,7 @@ my_strdup (char *str)
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ int main (int argc, char *argv[])
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
@@ -180,6 +180,207 @@ int main(int argc, char *argv[])
|
||||
])
|
||||
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Macros for wxWindows detection. Typically used in configure.in as:
|
||||
dnl
|
||||
dnl AC_ARG_ENABLE(...)
|
||||
dnl AC_ARG_WITH(...)
|
||||
dnl ...
|
||||
dnl AM_OPTIONS_WXCONFIG
|
||||
dnl ...
|
||||
dnl ...
|
||||
dnl AM_PATH_WXCONFIG(2.3.4, wxWin=1)
|
||||
dnl if test "$wxWin" != 1; then
|
||||
dnl AC_MSG_ERROR([
|
||||
dnl wxWindows must be installed on your system
|
||||
dnl but wx-config script couldn't be found.
|
||||
dnl
|
||||
dnl Please check that wx-config is in path, the directory
|
||||
dnl where wxWindows libraries are installed (returned by
|
||||
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
|
||||
dnl equivalent variable and wxWindows version is 2.3.4 or above.
|
||||
dnl ])
|
||||
dnl fi
|
||||
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
|
||||
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
|
||||
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
|
||||
dnl
|
||||
dnl LDFLAGS="$LDFLAGS $WX_LIBS"
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl AM_OPTIONS_WXCONFIG
|
||||
dnl
|
||||
dnl adds support for --wx-prefix, --wx-exec-prefix and --wx-config
|
||||
dnl command line options
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([AM_OPTIONS_WXCONFIG],
|
||||
[
|
||||
AC_ARG_WITH(wx-prefix, [ --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional)],
|
||||
wx_config_prefix="$withval", wx_config_prefix="")
|
||||
AC_ARG_WITH(wx-exec-prefix,[ --with-wx-exec-prefix=PREFIX Exec prefix where wxWindows is installed (optional)],
|
||||
wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
|
||||
AC_ARG_WITH(wx-config,[ --with-wx-config=CONFIG wx-config script to use (optional)],
|
||||
wx_config_name="$withval", wx_config_name="")
|
||||
])
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl
|
||||
dnl Test for wxWindows, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
|
||||
dnl (the latter is for static linking against wxWindows). Set WX_CONFIG_NAME
|
||||
dnl environment variable to override the default name of the wx-config script
|
||||
dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
|
||||
dnl case the macro won't even waste time on tests for its existence.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
dnl
|
||||
dnl Get the cflags and libraries from the wx-config script
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_WXCONFIG],
|
||||
[
|
||||
dnl do we have wx-config name: it can be wx-config or wxd-config or ...
|
||||
if test x${WX_CONFIG_NAME+set} != xset ; then
|
||||
WX_CONFIG_NAME=wx-config
|
||||
fi
|
||||
if test "x$wx_config_name" != x ; then
|
||||
WX_CONFIG_NAME="$wx_config_name"
|
||||
fi
|
||||
|
||||
dnl deal with optional prefixes
|
||||
if test x$wx_config_exec_prefix != x ; then
|
||||
wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
|
||||
WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
|
||||
fi
|
||||
if test x$wx_config_prefix != x ; then
|
||||
wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
|
||||
WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
|
||||
fi
|
||||
|
||||
dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
|
||||
if test -x "$WX_CONFIG_NAME" ; then
|
||||
AC_MSG_CHECKING(for wx-config)
|
||||
WX_CONFIG_PATH="$WX_CONFIG_NAME"
|
||||
AC_MSG_RESULT($WX_CONFIG_PATH)
|
||||
else
|
||||
AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH")
|
||||
fi
|
||||
|
||||
if test "$WX_CONFIG_PATH" != "no" ; then
|
||||
WX_VERSION=""
|
||||
no_wx=""
|
||||
|
||||
min_wx_version=ifelse([$1], ,2.2.1,$1)
|
||||
AC_MSG_CHECKING(for wxWindows version >= $min_wx_version)
|
||||
|
||||
WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args"
|
||||
|
||||
WX_VERSION=`$WX_CONFIG_WITH_ARGS --version`
|
||||
wx_config_major_version=`echo $WX_VERSION | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
wx_config_minor_version=`echo $WX_VERSION | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
wx_config_micro_version=`echo $WX_VERSION | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
wx_requested_major_version=`echo $min_wx_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
wx_requested_minor_version=`echo $min_wx_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
wx_requested_micro_version=`echo $min_wx_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
wx_ver_ok=""
|
||||
if test $wx_config_major_version -gt $wx_requested_major_version; then
|
||||
wx_ver_ok=yes
|
||||
else
|
||||
if test $wx_config_major_version -eq $wx_requested_major_version; then
|
||||
if test $wx_config_minor_version -gt $wx_requested_minor_version; then
|
||||
wx_ver_ok=yes
|
||||
else
|
||||
if test $wx_config_minor_version -eq $wx_requested_minor_version; then
|
||||
if test $wx_config_micro_version -ge $wx_requested_micro_version; then
|
||||
wx_ver_ok=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$wx_ver_ok" = x ; then
|
||||
no_wx=yes
|
||||
else
|
||||
WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs`
|
||||
WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs`
|
||||
|
||||
dnl starting with version 2.2.6 wx-config has --cppflags argument
|
||||
wx_has_cppflags=""
|
||||
if test $wx_config_major_version -gt 2; then
|
||||
wx_has_cppflags=yes
|
||||
else
|
||||
if test $wx_config_major_version -eq 2; then
|
||||
if test $wx_config_minor_version -gt 2; then
|
||||
wx_has_cppflags=yes
|
||||
else
|
||||
if test $wx_config_minor_version -eq 2; then
|
||||
if test $wx_config_micro_version -ge 6; then
|
||||
wx_has_cppflags=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$wx_has_cppflags" = x ; then
|
||||
dnl no choice but to define all flags like CFLAGS
|
||||
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
|
||||
WX_CPPFLAGS=$WX_CFLAGS
|
||||
WX_CXXFLAGS=$WX_CFLAGS
|
||||
|
||||
WX_CFLAGS_ONLY=$WX_CFLAGS
|
||||
WX_CXXFLAGS_ONLY=$WX_CFLAGS
|
||||
else
|
||||
dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
|
||||
WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags`
|
||||
WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags`
|
||||
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
|
||||
|
||||
WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
|
||||
WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$no_wx" = x ; then
|
||||
AC_MSG_RESULT(yes (version $WX_VERSION))
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
if test "x$WX_VERSION" = x; then
|
||||
dnl no wx-config at all
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
|
||||
fi
|
||||
|
||||
WX_CFLAGS=""
|
||||
WX_CPPFLAGS=""
|
||||
WX_CXXFLAGS=""
|
||||
WX_LIBS=""
|
||||
WX_LIBS_STATIC=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(WX_CPPFLAGS)
|
||||
AC_SUBST(WX_CFLAGS)
|
||||
AC_SUBST(WX_CXXFLAGS)
|
||||
AC_SUBST(WX_CFLAGS_ONLY)
|
||||
AC_SUBST(WX_CXXFLAGS_ONLY)
|
||||
AC_SUBST(WX_LIBS)
|
||||
AC_SUBST(WX_LIBS_STATIC)
|
||||
AC_SUBST(WX_VERSION)
|
||||
])
|
||||
|
||||
# Configure paths for libogg
|
||||
# Jack Moffitt <[email protected]> 10-21-2000
|
||||
# Shamelessly stolen from Owen Taylor and Manish Singh
|
||||
@@ -188,7 +389,7 @@ dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
|
||||
dnl
|
||||
AC_DEFUN([XIPH_PATH_OGG],
|
||||
[dnl
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
|
||||
@@ -246,7 +447,7 @@ int main ()
|
||||
|
||||
if test "x$no_ogg" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.oggtest ; then
|
||||
@@ -292,7 +493,7 @@ dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
|
||||
dnl
|
||||
AC_DEFUN([XIPH_PATH_VORBIS],
|
||||
[dnl
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(vorbis,[ --with-vorbis=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
|
||||
@@ -365,7 +566,7 @@ int main ()
|
||||
|
||||
if test "x$no_vorbis" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.vorbistest ; then
|
||||
@@ -410,7 +611,7 @@ dnl XIPH_PATH_THEORA([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libtheora, and define THEORA_CFLAGS and THEORA_LIBS
|
||||
dnl
|
||||
AC_DEFUN([XIPH_PATH_THEORA],
|
||||
[dnl
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(theora,[ --with-theora=PFX Prefix where libtheora is installed (optional)], theora_prefix="$withval", theora_prefix="")
|
||||
@@ -475,7 +676,7 @@ int main ()
|
||||
|
||||
if test "x$no_theora" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.theoratest ; then
|
||||
@@ -517,7 +718,7 @@ dnl AM_PATH_OPENAL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for OpenAL, and define OPENAL_CFLAGS and OPENAL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_OPENAL],
|
||||
[dnl
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(openal,[ --with-openal=PFX Prefix where OpenAL is installed (optional)], openal_prefix="$withval", openal_prefix="")
|
||||
@@ -584,7 +785,7 @@ int main ()
|
||||
|
||||
if test "x$no_openal" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.openaltest ; then
|
||||
@@ -625,7 +826,7 @@ dnl AM_PATH_OPENGL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for OpenGL, and define OPENGL_CFLAGS and OPENGL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_OPENGL],
|
||||
[dnl
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(opengl,[ --with-opengl=PFX Prefix where OpenGL is installed (optional)], opengl_prefix="$withval", opengl_prefix="")
|
||||
@@ -677,7 +878,7 @@ AC_ARG_ENABLE(opengltest, [ --disable-opengltest Do not try to compile an
|
||||
fi
|
||||
|
||||
if test "x$no_opengl" = "x" ; then
|
||||
ifelse([$1], , :, [$1])
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
OPENGL_CFLAGS=""
|
||||
OPENGL_LIBS=""
|
||||
+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 autoreconf..."
|
||||
autoreconf --install
|
||||
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
|
||||
)
|
||||
# DIE if the subshell failed
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
+14
-87
@@ -185,15 +185,10 @@ 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@ -I../mongoose
|
||||
AM_CXXFLAGS = @D_CFLAGS@ @FS2_CXXFLAGS@
|
||||
AM_LDFLAGS = @D_LDFLAGS@ @FS2_LDFLAGS@
|
||||
|
||||
if BUILD_WXFRED
|
||||
LIBCODE=
|
||||
else
|
||||
LIBCODE=libcode.a
|
||||
endif
|
||||
noinst_LIBRARIES = $(LIBCODE)
|
||||
noinst_LIBRARIES = libcode.a
|
||||
bin_PROGRAMS = @FS2_BINARY@
|
||||
|
||||
EXTRA_PROGRAMS = fs2_open_@PACKAGE_VERSION@ \
|
||||
@@ -263,10 +258,7 @@ FS2_SOURCES = \
|
||||
debris/debris.cpp \
|
||||
debris/debris.h \
|
||||
debugconsole/console.cpp \
|
||||
debugconsole/console.h \
|
||||
debugconsole/consolecmds.cpp \
|
||||
debugconsole/consoleparse.cpp \
|
||||
debugconsole/consoleparse.h \
|
||||
debugconsole/dbugfile.h \
|
||||
debugconsole/timerbar.cpp \
|
||||
debugconsole/timerbar.h \
|
||||
exceptionhandler/exceptionhandler.cpp \
|
||||
@@ -302,7 +294,6 @@ 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 \
|
||||
@@ -821,8 +812,8 @@ fs2_open_@PACKAGE_VERSION@_DEBUG_SOURCES = \
|
||||
fs2_open_@PACKAGE_VERSION@_SOURCES = \
|
||||
${FS2OPEN_SOURCES}
|
||||
|
||||
fs2_open_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a ../mongoose/libmongoose.a
|
||||
fs2_open_@PACKAGE_VERSION@_LDADD = libcode.a ../mongoose/libmongoose.a
|
||||
fs2_open_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a
|
||||
fs2_open_@PACKAGE_VERSION@_LDADD = libcode.a
|
||||
|
||||
##
|
||||
## End MAIN binary
|
||||
@@ -835,79 +826,12 @@ fs2_open_@PACKAGE_VERSION@_LDADD = libcode.a ../mongoose/libmongoose.a
|
||||
##
|
||||
|
||||
wxFRED_SOURCES = \
|
||||
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/wxfred2.cpp \
|
||||
wxfred2/wxfred2.h \
|
||||
wxfred2/fredframe.cpp \
|
||||
wxfred2/fredframe.h \
|
||||
wxfred2/wxfred_xrc.cpp \
|
||||
wxfred2/wxfred_xrc.h
|
||||
|
||||
wxFRED2_@PACKAGE_VERSION@_DEBUG_SOURCES = \
|
||||
${wxFRED_SOURCES}
|
||||
@@ -915,6 +839,9 @@ 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
|
||||
##
|
||||
|
||||
+9
-11
@@ -20,9 +20,9 @@
|
||||
#include "object/waypoint.h"
|
||||
|
||||
struct ship_weapon;
|
||||
class ship_subsys;
|
||||
class object;
|
||||
class ship_info;
|
||||
struct ship_subsys;
|
||||
struct object;
|
||||
struct 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 2
|
||||
#define MAX_AI_FLAG_NAMES 1
|
||||
extern ai_flag_name Ai_flag_names[];
|
||||
|
||||
#define AIF_FORMATION_WING (1 << 0) // Fly in formation as part of wing.
|
||||
@@ -64,8 +64,6 @@ 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)
|
||||
|
||||
@@ -109,7 +107,6 @@ 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)
|
||||
|
||||
@@ -369,10 +366,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
|
||||
size_t wp_index; // waypoint index in list
|
||||
waypoint_list *wp_list; // waypoint list being followed
|
||||
SCP_list<waypoint>::iterator 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.
|
||||
@@ -590,7 +587,7 @@ extern char** Ai_class_names;
|
||||
extern int Num_ai_classes;
|
||||
extern int Ai_firing_enabled;
|
||||
|
||||
extern const char *Skill_level_names(int skill_level, int translate = 1);
|
||||
extern char *Skill_level_names(int skill_level, int translate = 1);
|
||||
extern int Ai_goal_signature;
|
||||
|
||||
// need access to following data in AiBig.cpp
|
||||
@@ -625,6 +622,7 @@ 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);
|
||||
|
||||
@@ -67,7 +67,7 @@ int ai_path_type_match(char *p)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void parse_ai_profiles_tbl(const char *filename)
|
||||
void parse_ai_profiles_tbl(char *filename)
|
||||
{
|
||||
int i, rval;
|
||||
char profile_name[NAME_LENGTH];
|
||||
@@ -75,9 +75,13 @@ void parse_ai_profiles_tbl(const 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;
|
||||
}
|
||||
|
||||
@@ -463,8 +467,6 @@ void parse_ai_profiles_tbl(const 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);
|
||||
|
||||
// ----------
|
||||
|
||||
// compatibility
|
||||
@@ -510,8 +512,11 @@ void parse_ai_profiles_tbl(const char *filename)
|
||||
required_string("#End");
|
||||
|
||||
// add tbl/tbm to multiplayer validation list
|
||||
extern void fs2netd_add_table_validation(const char *tblname);
|
||||
extern void fs2netd_add_table_validation(char *tblname);
|
||||
fs2netd_add_table_validation(filename);
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
void ai_profiles_init()
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
#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
|
||||
|
||||
+72
-111
@@ -171,8 +171,6 @@ 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;
|
||||
@@ -369,13 +367,9 @@ 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->targeted_subsys->system_info->path_num >= 0) ) {
|
||||
if ( (aip->targeted_subsys != NULL) && (aip->target_objnum >= 0) && (aip->targeted_subsys->system_info->path_num >= 0) ) {
|
||||
int subsys_path_num, subsys_in_sight, checked_sight;
|
||||
float dist;
|
||||
|
||||
@@ -603,15 +597,11 @@ 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;
|
||||
vec3d vec_to_enemy;
|
||||
float weapon_travel_dist;
|
||||
vec3d *rel_pos, vec_to_enemy;
|
||||
float weapon_travel_dist;
|
||||
|
||||
start_bank = Ships[aip->shipnum].weapons.current_primary_bank;
|
||||
|
||||
@@ -636,25 +626,11 @@ 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);
|
||||
|
||||
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 {
|
||||
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 {
|
||||
@@ -675,22 +651,10 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -747,75 +711,86 @@ 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;
|
||||
if (current_bank > -1) {
|
||||
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
|
||||
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 (!(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(!(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 (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;
|
||||
}
|
||||
float t = 0.25f; // default delay in seconds until next fire.
|
||||
|
||||
float t = 0.25f; // default delay in seconds until next fire.
|
||||
|
||||
if (dist_to_enemy < firing_range*1.0f) {
|
||||
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)) {
|
||||
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
}
|
||||
//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 {
|
||||
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]++;
|
||||
t = swip->fire_wait;
|
||||
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
|
||||
swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
|
||||
} 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_adjusted] = myrand() % swip->burst_shots;
|
||||
} else {
|
||||
swp->burst_counter[current_bank_adjusted] = 0;
|
||||
}
|
||||
swp->burst_counter[current_bank] = 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;
|
||||
} else {
|
||||
swp->burst_counter[current_bank] = 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -886,9 +861,6 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -929,12 +901,8 @@ 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 ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags & AIF_KAMIKAZE)) {
|
||||
afterburners_stop(Pl_objp);
|
||||
}
|
||||
if (maybe_avoid_big_ship(Pl_objp, En_objp, aip, &predicted_enemy_pos, 10.0f))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (aip->target_time < 2.0f)
|
||||
@@ -950,13 +918,6 @@ 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__
|
||||
|
||||
class object;
|
||||
struct object;
|
||||
struct ai_info;
|
||||
struct vec3d;
|
||||
class ship_subsys;
|
||||
struct ship_subsys;
|
||||
|
||||
void ai_big_ship(object *objp);
|
||||
void ai_big_chase();
|
||||
|
||||
+180
-537
File diff suppressed because it is too large.
Load diff
+9
-23
@@ -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
|
||||
const char *Ai_goal_text(int goal)
|
||||
char *Ai_goal_text(int goal)
|
||||
{
|
||||
switch(goal) {
|
||||
case 1:
|
||||
@@ -979,16 +979,6 @@ 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))
|
||||
@@ -1384,17 +1374,13 @@ 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 our mothership is present
|
||||
// if no subspace drive, only valid if there's somewhere to depart to
|
||||
|
||||
// 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;
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -2354,7 +2340,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, const char *name)
|
||||
int query_referenced_in_ai_goals(ai_goal *goals, int type, char *name)
|
||||
{
|
||||
int i, mode, flag;
|
||||
|
||||
@@ -2419,7 +2405,7 @@ int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *ai_add_dock_name(const char *str)
|
||||
char *ai_add_dock_name(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 const char *Ai_goal_text(int goal);
|
||||
extern 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, const char *name);
|
||||
extern char *ai_add_dock_name(const char *str);
|
||||
extern int query_referenced_in_ai_goals(ai_goal *goals, int type, char *name);
|
||||
extern char *ai_add_dock_name(char *str);
|
||||
|
||||
extern int ai_query_goal_valid( int ship, int ai_goal );
|
||||
|
||||
|
||||
+32
-104
@@ -22,7 +22,6 @@
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "weapon/muzzleflash.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
@@ -39,7 +38,8 @@
|
||||
float Lethality_range_const = 2.0f;
|
||||
DCF(lethality_range, "N for modifying range: 1 / (1+N) at 100")
|
||||
{
|
||||
dc_stuff_float(&Lethality_range_const);
|
||||
dc_get_arg(ARG_FLOAT);
|
||||
Lethality_range_const = Dc_arg_float;
|
||||
}
|
||||
|
||||
float Player_lethality_bump[NUM_SKILL_LEVELS] = {
|
||||
@@ -354,54 +354,6 @@ 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
|
||||
*
|
||||
@@ -527,7 +479,7 @@ int valid_turret_enemy(object *objp, object *turret_parent)
|
||||
}
|
||||
|
||||
// don't shoot at ships without collision check
|
||||
if (!(objp->flags & OF_COLLIDES)) {
|
||||
if (sip->flags & SIF_NO_COLLIDE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -549,11 +501,7 @@ 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->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) ) ) {
|
||||
if ( (!(wip->wi_flags & WIF_BOMB) && !(Ai_info[Ships[turret_parent->instance].ai_index].ai_profile_flags & AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY) ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -650,15 +598,9 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
// check if turret flagged to only target tagged ships
|
||||
if (eeo->eeo_flags & EEOF_TAGGED_ONLY) {
|
||||
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))) )) {
|
||||
if (!ship_is_tagged(objp)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1107,7 +1049,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) || (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags3 & WIF3_TURRET_INTERCEPTABLE))
|
||||
if (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB)
|
||||
{
|
||||
evaluate_obj_as_target(objp, &eeo);
|
||||
}
|
||||
@@ -1377,7 +1319,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 __attribute__((__unused__)) = 0; // to be used in future, see comment @ end of function
|
||||
int ret_val = 0;
|
||||
|
||||
if (ss->turret_enemy_objnum != -1) {
|
||||
model_subsystem *tp = ss->system_info;
|
||||
@@ -1423,7 +1365,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_scale_sub2(&target_moving_direction, &objp->phys_info.vel, wip->vel_inherit_amount);
|
||||
vm_vec_sub2(&target_moving_direction, &objp->phys_info.vel);
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -1524,16 +1466,10 @@ 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, "Adjusts the maximum number of tries an AI may do when trying to pick a subsystem to attack (Default is 5)")
|
||||
DCF(mf, "")
|
||||
{
|
||||
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;
|
||||
}
|
||||
dc_get_arg(ARG_INT);
|
||||
aifft_max_checks = Dc_arg_int;
|
||||
}
|
||||
|
||||
|
||||
@@ -1884,7 +1820,8 @@ 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);
|
||||
@@ -1892,12 +1829,13 @@ 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;
|
||||
|
||||
@@ -1909,7 +1847,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);
|
||||
|
||||
@@ -1925,10 +1863,8 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
{
|
||||
flak_set_range(objp, flak_range_override);
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
} 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);
|
||||
}
|
||||
|
||||
// in multiplayer (and the master), then send a turret fired packet.
|
||||
@@ -2018,11 +1954,6 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
Weapons[Objects[weapon_objnum].instance].turret_subsys = tsi->turret;
|
||||
Weapons[Objects[weapon_objnum].instance].target_num = tsi->turret->turret_enemy_objnum;
|
||||
|
||||
// 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.
|
||||
@@ -2030,7 +1961,8 @@ 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;
|
||||
@@ -2117,7 +2049,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(200);
|
||||
ss->turret_animation_done_time = timestamp(1000);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@@ -2287,8 +2219,6 @@ 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) {
|
||||
@@ -2321,16 +2251,14 @@ 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
|
||||
{
|
||||
// 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))) {
|
||||
//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))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2556,11 +2484,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;
|
||||
|
||||
+6
-10
@@ -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_zoomed;
|
||||
instance->base_h = gr_screen.max_h_unscaled_zoomed;
|
||||
instance->base_w = gr_screen.max_w_unscaled;
|
||||
instance->base_h = gr_screen.max_h_unscaled;
|
||||
} else {
|
||||
instance->base_w = aps->base_w;
|
||||
instance->base_h = aps->base_h;
|
||||
@@ -488,20 +488,16 @@ 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, GR_RESIZE_MENU);
|
||||
gr_set_clip(0, 0, instance->base_w, instance->base_h, false);
|
||||
if ( instance->aa_color == NULL ) {
|
||||
gr_bitmap(instance->x, instance->y, GR_RESIZE_MENU_NO_OFFSET);
|
||||
gr_bitmap(instance->x, instance->y);
|
||||
}
|
||||
else {
|
||||
gr_set_color_fast( (color*)instance->aa_color );
|
||||
gr_aabitmap(instance->x, instance->y, GR_RESIZE_MENU_NO_OFFSET);
|
||||
gr_aabitmap(instance->x, instance->y);
|
||||
}
|
||||
gr_set_screen_scale(old_max_w_unscaled, old_max_h_unscaled, old_max_w_unscaled_zoomed, old_max_h_unscaled_zoomed);
|
||||
gr_reset_screen_scale();
|
||||
gr_reset_clip();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -301,6 +301,7 @@ 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:
|
||||
@@ -466,6 +467,7 @@ 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:
|
||||
|
||||
+29
-11
@@ -39,8 +39,6 @@
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multi.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "globalincs/compatibility.h"
|
||||
|
||||
@@ -861,7 +859,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 > asfieldp->bound_rad) ) {
|
||||
if ((dot < 0.7f) || (dist > 3000.0f)) {
|
||||
if (Num_asteroids > MAX_ASTEROIDS-10) {
|
||||
objp->flags |= OF_SHOULD_BE_DEAD;
|
||||
} else {
|
||||
@@ -869,11 +867,12 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
|
||||
asteroid_wrap_pos(objp, asfieldp);
|
||||
Asteroids[objp->instance].target_objnum = -1;
|
||||
|
||||
dist = vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
|
||||
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 < (asfieldp->bound_rad * 1.3f)) ) {
|
||||
// player would see asteroid pop out other side, so reverse velocity instead of wrapping
|
||||
if (( dot > 0.7f) && (dist < 3000.0f)) {
|
||||
// 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;
|
||||
@@ -915,7 +914,6 @@ 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 );
|
||||
@@ -1405,8 +1403,23 @@ void asteroid_level_close()
|
||||
Asteroid_field.num_initial_asteroids=0;
|
||||
}
|
||||
|
||||
DCF_BOOL2(asteroids, Asteroids_enabled, "enables or disables asteroids", "Usage: asteroids [bool]\nTurns asteroid system on/off. If nothing passed, then toggles it.\n");
|
||||
|
||||
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") );
|
||||
}
|
||||
|
||||
void hud_target_asteroid()
|
||||
{
|
||||
@@ -1628,7 +1641,6 @@ 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);
|
||||
|
||||
@@ -1759,7 +1771,6 @@ 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];
|
||||
|
||||
@@ -1895,8 +1906,12 @@ 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;
|
||||
}
|
||||
|
||||
@@ -2025,6 +2040,9 @@ 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
|
||||
|
||||
|
||||
class object;
|
||||
class polymodel;
|
||||
struct object;
|
||||
struct polymodel;
|
||||
struct collision_info_struct;
|
||||
|
||||
#define MAX_ASTEROIDS 512
|
||||
@@ -52,8 +52,7 @@ 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
|
||||
@@ -80,14 +79,10 @@ public:
|
||||
fireball_radius_multiplier( -1 )
|
||||
{
|
||||
name[ 0 ] = 0;
|
||||
memset( pof_files, 0, sizeof( pof_files ) );
|
||||
memset( detail_distance, 0, sizeof( detail_distance ) );
|
||||
|
||||
for (int i = 0; i < NUM_DEBRIS_POFS; i++)
|
||||
{
|
||||
modelp[i] = NULL;
|
||||
model_num[i] = -1;
|
||||
pof_files[i][0] = 0;
|
||||
}
|
||||
memset( modelp, 0, sizeof( modelp ) );
|
||||
memset( model_num, -1, sizeof( model_num ) );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -124,7 +119,6 @@ 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) != 0 ) {
|
||||
if ( ship_find_repair_ship(Player_obj) != NULL ) {
|
||||
if (send_msg)
|
||||
send_autopilot_msgID(NP_MSG_FAIL_SUPPORT_PRESENT);
|
||||
return false;
|
||||
@@ -231,43 +231,32 @@ 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.
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -1212,7 +1201,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);
|
||||
@@ -1251,9 +1240,7 @@ void send_autopilot_msg(char *msg, char *snd)
|
||||
// Inits the Nav System
|
||||
void NavSystem_Init()
|
||||
{
|
||||
for (int i = 0; i < MAX_NAVPOINTS; i++)
|
||||
Navs[i].clear();
|
||||
|
||||
memset((char *)&Navs, 0, sizeof(Navs));
|
||||
AutoPilotEngaged = false;
|
||||
CurrentNav = -1;
|
||||
audio_handle = -1;
|
||||
@@ -1274,9 +1261,13 @@ 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;
|
||||
}
|
||||
|
||||
@@ -1333,6 +1324,9 @@ void parse_autopilot_table(char *filename)
|
||||
|
||||
|
||||
required_string("#END");
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
|
||||
@@ -1349,6 +1343,13 @@ 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)
|
||||
@@ -1359,6 +1360,7 @@ bool DelNavPoint(char *Nav)
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool DelNavPoint(int nav)
|
||||
{
|
||||
if (nav != -1)
|
||||
@@ -1371,7 +1373,7 @@ bool DelNavPoint(int nav)
|
||||
}
|
||||
|
||||
}
|
||||
Navs[MAX_NAVPOINTS-1].clear();
|
||||
ZeroNav(MAX_NAVPOINTS-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1399,7 +1401,7 @@ bool AddNav_Ship(char *Nav, char *TargetName, int flags)
|
||||
// Create the NavPoint struct
|
||||
NavPoint tnav;
|
||||
|
||||
strcpy_s(tnav.m_NavName, Nav);
|
||||
strncpy(tnav.m_NavName, Nav, 32);
|
||||
tnav.flags = NP_SHIP | flags;
|
||||
|
||||
Assert(!(tnav.flags & NP_WAYPOINT));
|
||||
@@ -1445,7 +1447,7 @@ bool AddNav_Waypoint(char *Nav, char *WP_Path, int node, int flags)
|
||||
// Create the NavPoint struct
|
||||
NavPoint tnav;
|
||||
|
||||
strcpy_s(tnav.m_NavName, Nav);
|
||||
strncpy(tnav.m_NavName, Nav, TOKEN_LENGTH);
|
||||
tnav.flags = NP_WAYPOINT | flags;
|
||||
|
||||
Assert(!(tnav.flags & NP_SHIP));
|
||||
|
||||
@@ -25,9 +25,8 @@
|
||||
#define NP_NOSELECT ( NP_HIDDEN | NP_NOACCESS )
|
||||
#define NP_VALIDTYPE ( NP_WAYPOINT | NP_SHIP )
|
||||
|
||||
class NavPoint
|
||||
struct NavPoint
|
||||
{
|
||||
public:
|
||||
char m_NavName[32];
|
||||
int flags;
|
||||
|
||||
@@ -36,15 +35,6 @@ public:
|
||||
|
||||
vec3d *GetPosition();
|
||||
char* GetInternalName();
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_NavName[0] = 0;
|
||||
flags = 0;
|
||||
|
||||
target_obj = NULL;
|
||||
waypoint_num = -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
+81
-77
@@ -1,119 +1,121 @@
|
||||
#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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef BMPMAN_INTERNAL
|
||||
#error The file header "bmpman/bm_internal.h" is protected. Make sure you know what you are doing!
|
||||
#endif
|
||||
|
||||
#include "bmpman/bmpman.h"
|
||||
|
||||
#ifndef __BM_INTERNAL_H__
|
||||
#define __BM_INTERNAL_H__
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
|
||||
// Bitmap types
|
||||
enum BM_TYPE
|
||||
{
|
||||
BM_TYPE_NONE = 0, //!< No type
|
||||
BM_TYPE_USER, //!< in-memory
|
||||
BM_TYPE_PCX, //!< PCX
|
||||
BM_TYPE_TGA, //!< 16 or 32 bit targa
|
||||
BM_TYPE_DDS, //!< generic identifier for DDS
|
||||
BM_TYPE_PNG, //!< PNG
|
||||
BM_TYPE_JPG, //!< 32 bit jpeg
|
||||
BM_TYPE_ANI, //!< in-house ANI format
|
||||
BM_TYPE_EFF, //!< specifies any type of animated image, the EFF itself is just text
|
||||
|
||||
// special types
|
||||
BM_TYPE_RENDER_TARGET_STATIC, //!< 24/32 bit setup internally as a static render target
|
||||
BM_TYPE_RENDER_TARGET_DYNAMIC, //!< 24/32 bit setup internally as a dynamic render target
|
||||
// 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
|
||||
|
||||
// Compressed types (bitmap.c_type)
|
||||
BM_TYPE_DXT1, //!< 24 bit with switchable alpha
|
||||
BM_TYPE_DXT3, //!< 32 bit with 4 bit alpha
|
||||
BM_TYPE_DXT5, //!< 32 bit with 8 bit alpha
|
||||
BM_TYPE_CUBEMAP_DDS, //!< generic DDS cubemap (uncompressed cubemap surface)
|
||||
BM_TYPE_CUBEMAP_DXT1, //!< 24-bit cubemap (compressed cubemap surface)
|
||||
BM_TYPE_CUBEMAP_DXT3, //!< 32-bit cubemap (compressed cubemap surface)
|
||||
BM_TYPE_CUBEMAP_DXT5 //!< 32-bit cubemap (compressed cubemap surface)
|
||||
};
|
||||
|
||||
union bm_extra_info {
|
||||
/// Moved from cpp file ///////////////////
|
||||
// Consider these 'protected' structures and functions that should only be used by special bitmap functions
|
||||
typedef 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 animations -- number of frames in the animation
|
||||
int keyframe; //!< used for animations -- keyframe info
|
||||
ubyte fps; //!< used for animations -- frames per second
|
||||
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
|
||||
|
||||
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
|
||||
} 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; //!< For user bitmaps, 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; // Flags passed to bm_create
|
||||
} user;
|
||||
};
|
||||
} bm_extra_info;
|
||||
|
||||
struct bitmap_entry {
|
||||
|
||||
typedef 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 bm; //!< Bitmap info
|
||||
// Bitmap info
|
||||
bitmap bm;
|
||||
|
||||
bm_extra_info info; //!< Data for animations and user bitmaps
|
||||
// Data for animations and user bitmaps
|
||||
bm_extra_info info;
|
||||
|
||||
#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 );
|
||||
@@ -124,4 +126,6 @@ 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__
|
||||
+1926
-1747
File diff suppressed because it is too large.
Load diff
+204
-546
@@ -1,630 +1,288 @@
|
||||
#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
|
||||
*/
|
||||
|
||||
#include "cfile/cfile.h"
|
||||
#ifndef _BMPMAN_H
|
||||
#define _BMPMAN_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define BMPMAN_NDEBUG //!< Enables BMPMAN debugging code
|
||||
#define BMPMAN_NDEBUG
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup BMPMAN_CONSTANTS Macro constants used in/with bmpman.h
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#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
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
||||
// Flag positions for bitmap.flags
|
||||
#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
|
||||
// ***** 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
|
||||
|
||||
// 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
|
||||
//compressed texture types
|
||||
#define BMP_TEX_COMP ( BMP_TEX_DXT1 | BMP_TEX_DXT3 | BMP_TEX_DXT5 )
|
||||
|
||||
// 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
|
||||
//non compressed textures
|
||||
#define BMP_TEX_NONCOMP ( BMP_TEX_XPARENT | BMP_TEX_OTHER )
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
// any texture type
|
||||
#define BMP_TEX_ANY ( BMP_TEX_COMP | BMP_TEX_NONCOMP )
|
||||
|
||||
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)
|
||||
*/
|
||||
};
|
||||
#define BMP_FLAG_RENDER_TARGET_STATIC (1<<0)
|
||||
#define BMP_FLAG_RENDER_TARGET_DYNAMIC (1<<1)
|
||||
#define BMP_FLAG_CUBEMAP (1<<2)
|
||||
|
||||
extern int bm_texture_ram; //!< how many bytes of textures are used.
|
||||
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_paging; //!< Bool type that indicates if BMPMAN is currently paging.
|
||||
|
||||
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
|
||||
extern int Bm_paging;
|
||||
|
||||
/**
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
int bm_get_cache_slot( int bitmap_id, int separate_ani_frames );
|
||||
|
||||
/**
|
||||
* @brief Gets the next available bitmap slot.
|
||||
*/
|
||||
int bm_get_next_handle();
|
||||
|
||||
/**
|
||||
* @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);
|
||||
void *bm_malloc(int n, 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);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
// how many bytes of textures are used.
|
||||
extern int bm_texture_ram;
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
// 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);
|
||||
int bm_load(const SCP_string& 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);
|
||||
// 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
// 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);
|
||||
|
||||
/**
|
||||
* @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.
|
||||
// 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);
|
||||
|
||||
* @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);
|
||||
// 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 );
|
||||
|
||||
/**
|
||||
* @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);
|
||||
// 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 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);
|
||||
// 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 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);
|
||||
//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 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);
|
||||
// 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 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
|
||||
// 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);
|
||||
|
||||
* @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
|
||||
*/
|
||||
//gets the image type
|
||||
ubyte bm_get_type(int handle);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
// Unlocks a bitmap
|
||||
extern void bm_unlock( int bitmapnum );
|
||||
|
||||
/**
|
||||
* @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);
|
||||
//WMC - Returns 0 if invalid, nonzero if valid
|
||||
extern int bm_is_valid(int handle);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
// 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 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);
|
||||
// get filename
|
||||
extern void bm_get_filename(int bitmapnum, char *filename);
|
||||
|
||||
/**
|
||||
* @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 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 Loads all data for all bitmaps that have been requested to be loaded
|
||||
*
|
||||
* @note This function is not defined.
|
||||
*/
|
||||
void bm_gfx_load_all();
|
||||
// call to get the palette for a bitmap
|
||||
void bm_get_palette(int n, ubyte *pal, char *name);
|
||||
|
||||
/**
|
||||
* @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();
|
||||
// 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 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
|
||||
*/
|
||||
// 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
|
||||
void bm_get_frame_usage(int *ntotal, int *nnew);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
// Reload a different image into an existing bmpman slot
|
||||
int bm_reload(int bitmap_handle, 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 );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//============================================================================
|
||||
// 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.
|
||||
|
||||
/**
|
||||
* @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 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 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 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 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);
|
||||
// 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 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);
|
||||
// unload a texture that was paged in
|
||||
int bm_page_out( 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);
|
||||
//
|
||||
// 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 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();
|
||||
|
||||
/**
|
||||
* @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);
|
||||
// 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_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()
|
||||
*/
|
||||
// get the rgba components of a pixel, any of the parameters can be NULL
|
||||
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
/**
|
||||
* @brief Returns the compression type of the bitmap indexed by handle
|
||||
*/
|
||||
int bm_is_compressed(int handle);
|
||||
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 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_is_compressed(int num);
|
||||
int bm_get_tcache_type(int num);
|
||||
int bm_get_size(int num);
|
||||
int bm_get_num_mipmaps(int num);
|
||||
int bm_has_alpha_channel(int handle);
|
||||
|
||||
/**
|
||||
* @brief (DEBUG) Prints all loaded bitmaps to an outwindow
|
||||
*/
|
||||
void bm_print_bitmaps();
|
||||
|
||||
/**
|
||||
* @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_make_render_target( int width, int height, int flags );
|
||||
int bm_is_render_target(int bitmap_id);
|
||||
int bm_set_render_target(int handle, int face = -1);
|
||||
|
||||
/**
|
||||
* @brief Loads and parses an .EFF
|
||||
*
|
||||
* @param[in] filename The filename of the .EFF
|
||||
* @param[in] dir_type
|
||||
* @param[out] nframes (optional) If given, is set to the number of frames this .EFF has
|
||||
* @param[out] nfps (optional) If given, is set to the fps of this .EFF
|
||||
* @param[out] key (optional) If given, is set to the keyframe index of this .EFF
|
||||
* @param[out] type (optional) If given, is set to the BM_TYPE of the .EFF
|
||||
*
|
||||
* @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);
|
||||
|
||||
int bm_load_and_parse_eff(char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type);
|
||||
#endif
|
||||
+14
-14
@@ -540,10 +540,8 @@ void warp_camera::get_info(vec3d *position, matrix *orientation)
|
||||
//*************************subtitle*************************
|
||||
|
||||
#define MAX_SUBTITLE_LINES 64
|
||||
subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char* in_imageanim, float in_display_time, float in_fade_time, const color *in_text_color, int in_text_fontnum, bool center_x, bool center_y, int in_width, int in_height, bool in_post_shaded)
|
||||
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)
|
||||
{
|
||||
SCP_string text_buf;
|
||||
|
||||
// basic init, this always has to be done
|
||||
memset( imageanim, 0, sizeof(imageanim) );
|
||||
memset( &text_pos, 0, 2*sizeof(int) );
|
||||
@@ -553,16 +551,17 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char*
|
||||
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')
|
||||
{
|
||||
text_buf = in_text;
|
||||
sexp_replace_variable_names_with_values(text_buf);
|
||||
in_text = text_buf.c_str();
|
||||
strcpy_s(text_buf, in_text);
|
||||
sexp_replace_variable_names_with_values(text_buf, 256);
|
||||
in_text = text_buf;
|
||||
}
|
||||
|
||||
|
||||
int num_text_lines = 0;
|
||||
const char *text_line_ptrs[MAX_SUBTITLE_LINES];
|
||||
char *text_line_ptrs[MAX_SUBTITLE_LINES];
|
||||
int text_line_lens[MAX_SUBTITLE_LINES];
|
||||
|
||||
//Setup text
|
||||
@@ -570,10 +569,11 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char*
|
||||
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++)
|
||||
{
|
||||
text_buf.assign(text_line_ptrs[i], text_line_lens[i]);
|
||||
text_lines.push_back(text_buf);
|
||||
temp_str.assign(text_line_ptrs[i], text_line_lens[i]);
|
||||
text_lines.push_back(temp_str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(), GR_RESIZE_NONE);
|
||||
gr_string(x, y, (char*)line->c_str(), false);
|
||||
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 > 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.x = image_pos.w / (float) orig_w;
|
||||
scale.xyz.y = image_pos.h / (float) orig_h;
|
||||
scale.xyz.z = 1.0f;
|
||||
|
||||
gr_push_scale_matrix(&scale);
|
||||
gr_bitmap(fl2i(image_pos.x / scale.xyz.x), fl2i(image_pos.y / scale.xyz.y), GR_RESIZE_NONE);
|
||||
gr_bitmap(image_pos.x, image_pos.y, false);
|
||||
gr_pop_scale_matrix();
|
||||
}
|
||||
// no scaling
|
||||
else
|
||||
{
|
||||
gr_bitmap(image_pos.x, image_pos.y, GR_RESIZE_NONE);
|
||||
gr_bitmap(image_pos.x, image_pos.y, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,8 +137,8 @@ private:
|
||||
|
||||
bool post_shaded;
|
||||
public:
|
||||
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,
|
||||
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,
|
||||
bool center_x = false, bool center_y = false, int in_width = 0, int in_height = 0, bool post_shaded=false);
|
||||
~subtitle();
|
||||
|
||||
|
||||
+35
-29
@@ -35,6 +35,7 @@
|
||||
#include "osapi/osapi.h"
|
||||
|
||||
|
||||
|
||||
char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
#ifdef SCP_UNIX
|
||||
char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
@@ -99,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];
|
||||
|
||||
const char *Cfile_cdrom_dir = NULL;
|
||||
char *Cfile_cdrom_dir = NULL;
|
||||
|
||||
//
|
||||
// Function prototypes for internally-called functions
|
||||
@@ -122,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(const char *exe_path)
|
||||
int cfile_in_root_dir(char *exe_path)
|
||||
{
|
||||
int token_count = 0;
|
||||
char path_copy[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
@@ -166,7 +167,7 @@ int cfile_in_root_dir(const char *exe_path)
|
||||
// returns: success ==> 0
|
||||
// error ==> non-zero
|
||||
//
|
||||
int cfile_init(const char *exe_dir, const char *cdrom_dir)
|
||||
int cfile_init(char *exe_dir, char *cdrom_dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -313,17 +314,17 @@ int cfile_push_chdir(int type)
|
||||
}
|
||||
|
||||
|
||||
int cfile_chdir(const char *dir)
|
||||
int cfile_chdir(char *dir)
|
||||
{
|
||||
int e;
|
||||
char OriginalDirectory[CFILE_ROOT_DIRECTORY_LEN];
|
||||
const char *Path = NULL;
|
||||
char *Path = NULL;
|
||||
char NoDir[] = "\\.";
|
||||
|
||||
_getcwd(OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN-1);
|
||||
|
||||
#ifdef _WIN32
|
||||
const char *colon_pos = strchr(dir, ':');
|
||||
char *colon_pos = strchr(dir, ':');
|
||||
if (colon_pos) {
|
||||
if (!cfile_chdrive( tolower(*(colon_pos - 1)) - 'a' + 1, 1))
|
||||
return 1;
|
||||
@@ -428,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(const char *filename, const char *ext)
|
||||
char *cf_add_ext(char *filename, char *ext)
|
||||
{
|
||||
int flen, elen;
|
||||
static char path[MAX_PATH_LEN];
|
||||
@@ -446,7 +447,7 @@ char *cf_add_ext(const char *filename, const char *ext)
|
||||
}
|
||||
|
||||
// Deletes a file. Returns 0 if an error occurs, 1 on success
|
||||
int cf_delete(const char *filename, int dir_type)
|
||||
int cf_delete(char *filename, int dir_type)
|
||||
{
|
||||
char longname[MAX_PATH_LEN];
|
||||
|
||||
@@ -477,7 +478,7 @@ int cf_delete(const char *filename, int dir_type)
|
||||
|
||||
|
||||
// Same as _access function to read a file's access bits
|
||||
int cf_access(const char *filename, int dir_type, int mode)
|
||||
int cf_access(char *filename, int dir_type, int mode)
|
||||
{
|
||||
char longname[MAX_PATH_LEN];
|
||||
|
||||
@@ -491,23 +492,29 @@ 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.
|
||||
// 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)
|
||||
int cf_exists(char *filename, int dir_type)
|
||||
{
|
||||
int offset = 1;
|
||||
char longname[MAX_PATH_LEN];
|
||||
|
||||
if ( (filename == NULL) || !strlen(filename) )
|
||||
return 0;
|
||||
Assert(CF_TYPE_SPECIFIED(dir_type));
|
||||
|
||||
return (cf_find_file_location(filename, dir_type, 0, NULL, &offset, NULL) && !offset);
|
||||
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;
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
// Returns !0 if the file exists, 0 if not.
|
||||
// Checks both the file system and the VPs.
|
||||
int cf_exists_full(const char *filename, int dir_type)
|
||||
int cf_exists_full(char *filename, int dir_type)
|
||||
{
|
||||
if ( (filename == NULL) || !strlen(filename) )
|
||||
return 0;
|
||||
@@ -516,7 +523,7 @@ int cf_exists_full(const char *filename, int dir_type)
|
||||
}
|
||||
|
||||
// same as the above, but with extension check
|
||||
int cf_exists_full_ext(const char *filename, int dir_type, const int num_ext, const char **ext_list)
|
||||
int cf_exists_full_ext(char *filename, int dir_type, const int num_ext, const char **ext_list)
|
||||
{
|
||||
if ( (filename == NULL) || !strlen(filename) )
|
||||
return 0;
|
||||
@@ -528,7 +535,7 @@ int cf_exists_full_ext(const char *filename, int dir_type, const int num_ext, co
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void cf_attrib(const char *filename, int set, int clear, int dir_type)
|
||||
void cf_attrib(char *filename, int set, int clear, int dir_type)
|
||||
{
|
||||
char longname[MAX_PATH_LEN];
|
||||
|
||||
@@ -547,7 +554,7 @@ void cf_attrib(const char *filename, int set, int clear, int dir_type)
|
||||
}
|
||||
#endif
|
||||
|
||||
int cf_rename(const char *old_name, const char *name, int dir_type)
|
||||
int cf_rename(char *old_name, char *name, int dir_type)
|
||||
{
|
||||
Assert( CF_TYPE_SPECIFIED(dir_type) );
|
||||
|
||||
@@ -627,7 +634,7 @@ extern int game_cd_changed();
|
||||
// error ==> NULL
|
||||
//
|
||||
|
||||
CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, bool localize)
|
||||
CFILE *cfopen(char *file_path, 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 )
|
||||
@@ -729,7 +736,6 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
|
||||
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 ) {
|
||||
|
||||
@@ -782,7 +788,7 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
|
||||
// returns: success ==> address of CFILE structure
|
||||
// error ==> NULL
|
||||
//
|
||||
CFILE *cfopen_special(const char *file_path, const char *mode, const int size, const int offset, int dir_type)
|
||||
CFILE *cfopen_special(char *file_path, char *mode, const int size, const int offset, int dir_type)
|
||||
{
|
||||
if ( !cfile_inited) {
|
||||
Int3();
|
||||
@@ -1331,7 +1337,7 @@ int cfwrite_char(char b, CFILE *file)
|
||||
return cfwrite( &b, sizeof(b), 1, file);
|
||||
}
|
||||
|
||||
int cfwrite_string(const char *buf, CFILE *file)
|
||||
int cfwrite_string(char *buf, CFILE *file)
|
||||
{
|
||||
if ( (!buf) || (buf && !buf[0]) ) {
|
||||
return cfwrite_char(0, file);
|
||||
@@ -1469,7 +1475,7 @@ int cfputc(int c, CFILE *cfile)
|
||||
// returns: success ==> non-negative value
|
||||
// error ==> EOF
|
||||
//
|
||||
int cfputs(const char *str, CFILE *cfile)
|
||||
int cfputs(char *str, CFILE *cfile)
|
||||
{
|
||||
if(!cf_is_valid(cfile))
|
||||
return EOF;
|
||||
@@ -1687,7 +1693,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(const char *filename, uint *chk_long, bool full)
|
||||
int cf_chksum_pack(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)
|
||||
@@ -1756,7 +1762,7 @@ int cf_chksum_pack(const 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(const char *filename, ushort *chksum, int max_size, int cf_type)
|
||||
int cf_chksum_short(char *filename, ushort *chksum, int max_size, int cf_type)
|
||||
{
|
||||
int ret_val;
|
||||
CFILE *cfile = NULL;
|
||||
@@ -1806,7 +1812,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(const char *filename, uint *chksum, int max_size, int cf_type)
|
||||
int cf_chksum_long(char *filename, uint *chksum, int max_size, int cf_type)
|
||||
{
|
||||
int ret_val;
|
||||
CFILE *cfile = NULL;
|
||||
|
||||
+25
-25
@@ -99,7 +99,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)(const char *filename);
|
||||
extern int (*Get_file_list_filter)(char *filename);
|
||||
|
||||
// extra check for child directory under CF_TYPE_*
|
||||
// NOTE: if specified cf_get_file_list() will not search pack files!
|
||||
@@ -115,7 +115,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(const char *exe_dir, const char *cdrom_dir=NULL);
|
||||
int cfile_init(char *exe_dir,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 +123,18 @@ int cfile_init(const char *exe_dir, const char *cdrom_dir=NULL);
|
||||
void cfile_refresh();
|
||||
|
||||
// add an extension to a filename if it doesn't already have it
|
||||
char *cf_add_ext(const char *filename, const char *ext);
|
||||
char *cf_add_ext(char *filename, 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(const char *filename, const char *mode, int type = CFILE_NORMAL, int dir_type = CF_TYPE_ANY, bool localize = false);
|
||||
CFILE *cfopen(char *filename, 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(const char *file_path, const char *mode, const int size, const int offset, int dir_type = CF_TYPE_ANY);
|
||||
CFILE *cfopen_special(char *file_path, 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 +149,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(const char *filename, int dir_type);
|
||||
int cf_delete(char *filename, int dir_type);
|
||||
|
||||
// Same as _access function to read a file's access bits
|
||||
int cf_access(const char *filename, int dir_type, int mode);
|
||||
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(const char *filename, int dir_type);
|
||||
int cf_exists(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(const char *filename, int dir_type);
|
||||
int cf_exists_full(char *filename, int dir_type);
|
||||
// check num_ext worth of ext_list extensions
|
||||
int cf_exists_full_ext(const char *filename, int dir_type, const int num_ext, const char **ext_list);
|
||||
int cf_exists_full_ext(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 +197,7 @@ int cftell(CFILE *fp);
|
||||
int cfputc(int c, CFILE *cfile);
|
||||
|
||||
// cfputs() writes a string to a file
|
||||
int cfputs(const char *str, CFILE *cfile);
|
||||
int cfputs(char *str, CFILE *cfile);
|
||||
|
||||
// cfgetc() reads a character to a file
|
||||
int cfgetc(CFILE *cfile);
|
||||
@@ -212,20 +212,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(const char *filename, ushort *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
|
||||
int cf_chksum_short(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(const char *filename, uint *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
|
||||
int cf_chksum_long(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(const char *filename, uint *chk_long, bool full = false);
|
||||
int cf_chksum_pack(char *filename, uint *chk_long, bool full = false);
|
||||
|
||||
// convenient for misc checksumming purposes ------------------------------------------
|
||||
|
||||
@@ -238,16 +238,16 @@ uint cf_add_chksum_long(uint seed, ubyte *buffer, int size);
|
||||
// convenient for misc checksumming purposes ------------------------------------------
|
||||
|
||||
//================= HIGH LEVEL FUNCTIONS ==================
|
||||
int cfexist(const char *filename); // Returns true if file exists on disk (1) or in hog (2).
|
||||
int cfexist(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(const char *old_name, const char *name, int type = CF_TYPE_ANY );
|
||||
int cf_rename(char *old_name, char *name, int type = CF_TYPE_ANY );
|
||||
|
||||
// changes the attributes of a file
|
||||
void cf_attrib(const char *name, int set, int clear, int type);
|
||||
void cf_attrib(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 +294,7 @@ int cfwrite_vector(vec3d *vec, CFILE *file);
|
||||
int cfwrite_angles(angles *ang, CFILE *file);
|
||||
|
||||
// writes variable length, null-termined string.
|
||||
int cfwrite_string(const char *buf, CFILE *file);
|
||||
int cfwrite_string(char *buf, CFILE *file);
|
||||
|
||||
/**
|
||||
* @brief Write a fixed length string (not including its null terminator), with the length stored in file
|
||||
@@ -304,9 +304,9 @@ int cfwrite_string(const 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, 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 );
|
||||
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 );
|
||||
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 +319,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( const char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize = false);
|
||||
int cf_find_file_location( 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 +333,10 @@ int cf_find_file_location( const char *filespec, int pathtype, int max_out, char
|
||||
// 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(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);
|
||||
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);
|
||||
|
||||
// Functions to change directories
|
||||
int cfile_chdir(const char *dir);
|
||||
int cfile_chdir(char *dir);
|
||||
|
||||
#ifdef _WIN32
|
||||
int cfile_chdrive(int DriveNum, int flag);
|
||||
@@ -387,6 +387,6 @@ namespace cfile
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* __CFILE_H__ */
|
||||
+20
-22
@@ -366,7 +366,7 @@ void cf_build_pack_list( cf_root *root )
|
||||
}
|
||||
|
||||
|
||||
void cf_build_root_list(const char *cdrom_dir)
|
||||
void cf_build_root_list(char *cdrom_dir)
|
||||
{
|
||||
Num_roots = 0;
|
||||
Num_path_roots = 0;
|
||||
@@ -388,7 +388,7 @@ void cf_build_root_list(const char *cdrom_dir)
|
||||
|
||||
// truncated string check
|
||||
if ( (strlen(Cfile_user_dir) + strlen(str_temp) + 1) >= CF_MAX_PATHNAME_LENGTH ) {
|
||||
Error(LOCATION, "Home directory plus mod directory exceeds CF_MAX_PATHNAME_LENGTH\n");
|
||||
Int3();
|
||||
}
|
||||
|
||||
root = cf_create_root();
|
||||
@@ -444,7 +444,7 @@ void cf_build_root_list(const char *cdrom_dir)
|
||||
|
||||
// truncated string check
|
||||
if ( (strlen(root->path) + strlen(str_temp) + 1) >= CF_MAX_PATHNAME_LENGTH ) {
|
||||
Error(LOCATION, "Installed path plus mod directory exceeds CF_MAX_PATHNAME_LENGTH\n");
|
||||
Int3();
|
||||
}
|
||||
|
||||
path_len = strlen(root->path);
|
||||
@@ -503,11 +503,11 @@ void cf_build_root_list(const 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( const char *ext_list, const char *ext )
|
||||
int is_ext_in_list( char *ext_list, char *ext )
|
||||
{
|
||||
char tmp_ext[128];
|
||||
|
||||
strcpy_s( tmp_ext, ext);
|
||||
strncpy( tmp_ext, ext, 127 );
|
||||
strlwr(tmp_ext);
|
||||
if ( strstr(ext_list, tmp_ext )) {
|
||||
return 1;
|
||||
@@ -695,7 +695,6 @@ 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);
|
||||
@@ -767,7 +766,7 @@ void cf_build_file_list()
|
||||
}
|
||||
|
||||
|
||||
void cf_build_secondary_filelist(const char *cdrom_dir)
|
||||
void cf_build_secondary_filelist(char *cdrom_dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -834,7 +833,7 @@ void cf_free_secondary_filelist()
|
||||
*
|
||||
* @return If not found returns 0.
|
||||
*/
|
||||
int cf_find_file_location( const char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
|
||||
int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
|
||||
{
|
||||
int i;
|
||||
uint ui;
|
||||
@@ -1025,7 +1024,7 @@ int cf_find_file_location( const char *filespec, int pathtype, int max_out, char
|
||||
}
|
||||
|
||||
// -- from parselo.cpp --
|
||||
extern char *stristr(char *str, const char *substr);
|
||||
extern char *stristr(const char *str, const char *substr);
|
||||
|
||||
/**
|
||||
* Searches for a file.
|
||||
@@ -1045,7 +1044,7 @@ extern char *stristr(char *str, const char *substr);
|
||||
*
|
||||
* @return If not found returns -1, else returns offset into ext_list.
|
||||
*/
|
||||
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 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 cur_ext, i;
|
||||
uint ui;
|
||||
@@ -1319,10 +1318,9 @@ int cf_find_file_location_ext( const char *filename, const int ext_num, const ch
|
||||
|
||||
|
||||
// Returns true if filename matches filespec, else zero if not
|
||||
int cf_matches_spec(const char *filespec, const char *filename)
|
||||
int cf_matches_spec(char *filespec, char *filename)
|
||||
{
|
||||
const char *src_ext;
|
||||
const char *dst_ext;
|
||||
char *src_ext, *dst_ext;
|
||||
|
||||
src_ext = strrchr(filespec, '*');
|
||||
if(!src_ext)
|
||||
@@ -1355,7 +1353,7 @@ int cf_matches_spec(const char *filespec, const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
int (*Get_file_list_filter)(const char *filename) = NULL;
|
||||
int (*Get_file_list_filter)(char *filename) = NULL;
|
||||
const char *Get_file_list_child = NULL;
|
||||
int Skip_packfile_search = 0;
|
||||
|
||||
@@ -1384,7 +1382,7 @@ static bool verify_file_list_child()
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cf_file_already_in_list( SCP_vector<SCP_string> &list, const char *filename )
|
||||
static int cf_file_already_in_list( SCP_vector<SCP_string> &list, char *filename )
|
||||
{
|
||||
char name_no_extension[MAX_PATH_LEN];
|
||||
size_t i, size = list.size();
|
||||
@@ -1412,7 +1410,7 @@ static int cf_file_already_in_list( SCP_vector<SCP_string> &list, const char *fi
|
||||
// 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, const char *filter, int sort, SCP_vector<file_list_info> *info )
|
||||
int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, char *filter, int sort, SCP_vector<file_list_info> *info )
|
||||
{
|
||||
char *ptr;
|
||||
uint i;
|
||||
@@ -1589,7 +1587,7 @@ int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, const char *fi
|
||||
return (int)list.size();
|
||||
}
|
||||
|
||||
int cf_file_already_in_list( int num_files, char **list, const char *filename )
|
||||
int cf_file_already_in_list( int num_files, char **list, char *filename )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1613,7 +1611,7 @@ int cf_file_already_in_list( int num_files, char **list, const 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, const char *filter, int sort, file_list_info *info )
|
||||
int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort, file_list_info *info )
|
||||
{
|
||||
char *ptr;
|
||||
uint i;
|
||||
@@ -1788,7 +1786,7 @@ int cf_get_file_list( int max, char **list, int pathtype, const char *filter, in
|
||||
return num_files;
|
||||
}
|
||||
|
||||
int cf_file_already_in_list_preallocated( int num_files, char arr[][MAX_FILENAME_LEN], const char *filename )
|
||||
int cf_file_already_in_list_preallocated( int num_files, char arr[][MAX_FILENAME_LEN], char *filename )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1812,7 +1810,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, const 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, char *filter, int sort, file_list_info *info )
|
||||
{
|
||||
int num_files = 0, own_flag = 0;
|
||||
|
||||
@@ -1999,7 +1997,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, const char *filename, bool localize )
|
||||
int cf_create_default_path_string( char *path, uint path_max, int pathtype, char *filename, bool localize )
|
||||
{
|
||||
#ifdef SCP_UNIX
|
||||
if ( filename && strpbrk(filename,"/") ) {
|
||||
@@ -2071,7 +2069,7 @@ int cf_create_default_path_string(char *path, uint path_max, int pathtype, const
|
||||
// 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, const char *filename, bool localize )
|
||||
int cf_create_default_path_string( SCP_string &path, int pathtype, 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( const char *cdrom_path );
|
||||
void cf_build_secondary_filelist( 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, 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 );
|
||||
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 );
|
||||
|
||||
#endif //_CFILESYSTEM_H
|
||||
+230
-374
@@ -29,40 +29,22 @@
|
||||
|
||||
#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;
|
||||
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)
|
||||
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)
|
||||
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(const char *name, const char *help, const int arg_type, const bool stacks = false);
|
||||
cmdline_parm(char *name, char *help, bool stacks = false);
|
||||
~cmdline_parm();
|
||||
int found();
|
||||
int get_int();
|
||||
@@ -71,11 +53,12 @@ public:
|
||||
bool check_if_args_is_valid();
|
||||
};
|
||||
|
||||
static cmdline_parm Parm_list(NULL, NULL, AT_NONE);
|
||||
static cmdline_parm Parm_list(NULL, NULL);
|
||||
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
|
||||
@@ -100,7 +83,7 @@ enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// DO NOT CHANGE THE SIZE OF THIS AT_STRING!
|
||||
// DO NOT CHANGE THE SIZE OF THIS STRING!
|
||||
char name[32];
|
||||
|
||||
} EasyFlag;
|
||||
@@ -130,24 +113,21 @@ typedef struct
|
||||
// Please group them by type, ie graphics, gameplay etc, maximum 20 different types
|
||||
Flag exe_params[] =
|
||||
{
|
||||
{ "-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", },
|
||||
{ "-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", },
|
||||
{ "-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, 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" },
|
||||
{ "-nonormal", "Disable normal maps", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-normal" },
|
||||
{ "-3dshockwave", "Enable 3D shockwaves", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dshockwave" },
|
||||
{ "-post_process", "Enable post processing", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-post_process" },
|
||||
{ "-soft_particles", "Enable soft particles", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-soft_particles" },
|
||||
{ "-fxaa", "Enable FXAA anti-aliasing", true, EASY_MEM_ALL_ON, EASY_DEFAULT_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", },
|
||||
{ "-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"},
|
||||
|
||||
{ "-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", },
|
||||
@@ -161,7 +141,6 @@ 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", },
|
||||
@@ -184,22 +163,20 @@ 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://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ati_swap", },
|
||||
{ "-ati_swap", "Fix colour issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://scp.indiegames.us/mantis/view.php?id=1669", },
|
||||
{ "-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", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_di_mouse", },
|
||||
{ "-disable_di_mouse", "Don't use DirectInput for mouse control", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
#endif
|
||||
{ "-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", },
|
||||
{ "-use_gldrawelements","Don't use glDrawRangeElements", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-old_collision", "Use old collision detection system", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
|
||||
{ "-ingame_join", "Allow in-game joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
|
||||
{ "-voicer", "Enable voice recognition", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-voicer", },
|
||||
{ "-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", },
|
||||
{ "-fb_explosions", "Enable Framebuffer Shockwaves", true, 0, EASY_DEFAULT, "Experimental", "", },
|
||||
|
||||
{ "-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", },
|
||||
@@ -210,9 +187,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", "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", },
|
||||
{ "-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", },
|
||||
{ "-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", },
|
||||
@@ -223,36 +200,30 @@ 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", },
|
||||
{ "-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", },
|
||||
{ "-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", },
|
||||
};
|
||||
|
||||
// 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", "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)
|
||||
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)
|
||||
|
||||
char *Cmdline_connect_addr = NULL;
|
||||
char *Cmdline_game_name = NULL;
|
||||
@@ -279,32 +250,31 @@ int Cmdline_use_last_pilot = 0;
|
||||
// FSO options -------------------------------------------------
|
||||
|
||||
// Graphics related
|
||||
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);
|
||||
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);
|
||||
|
||||
float Cmdline_clip_dist = Default_min_draw_distance;
|
||||
float Cmdline_fov = 0.75f;
|
||||
@@ -329,13 +299,12 @@ 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, 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
|
||||
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
|
||||
|
||||
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;
|
||||
@@ -343,11 +312,11 @@ int Cmdline_NoFPSCap = 0; // Disable FPS capping - kazan
|
||||
int Cmdline_no_vsync = 0;
|
||||
|
||||
// HUD related
|
||||
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
|
||||
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
|
||||
|
||||
int Cmdline_ballistic_gauge = 0; // WMCoolmon's gauge thingy
|
||||
int Cmdline_dualscanlines = 0;
|
||||
@@ -356,41 +325,39 @@ int Cmdline_rearm_timer = 0;
|
||||
int Cmdline_targetinfo = 0;
|
||||
|
||||
// Gameplay related
|
||||
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
|
||||
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
|
||||
|
||||
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, 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
|
||||
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
|
||||
|
||||
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", "List of folders to overwrite/add-to the default data", AT_STRING, true); // Cmdline_mod -- DTP modsupport
|
||||
cmdline_parm mod_arg("-mod", NULL, true); // Cmdline_mod -- DTP modsupport
|
||||
|
||||
char *Cmdline_mod = NULL; //DTP for mod argument
|
||||
char *Cmdline_mod = NULL; //DTP for mod arguement
|
||||
|
||||
// Multiplayer/Network related
|
||||
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);
|
||||
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);
|
||||
|
||||
char *Cmdline_almission = NULL; //DTP for autoload multi mission.
|
||||
int Cmdline_ingamejoin = 0;
|
||||
@@ -400,24 +367,21 @@ char *Cmdline_spew_table_crcs = NULL;
|
||||
int Cmdline_objupd = 3; // client object updates on LAN by default
|
||||
|
||||
// Troubleshooting
|
||||
cmdline_parm loadallweapons_arg("-loadallweps", NULL, AT_NONE); // Cmdline_load_all_weapons
|
||||
cmdline_parm htl_arg("-nohtl", NULL, AT_NONE); // Cmdline_nohtl -- don't use HT&L
|
||||
cmdline_parm noibx_arg("-noibx", NULL, AT_NONE); // Cmdline_noibx
|
||||
cmdline_parm nomovies_arg("-nomovies", NULL, AT_NONE); // Cmdline_nomovies -- Allows video streaming
|
||||
cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL, AT_NONE); // Cmdline_no_set_gamma
|
||||
cmdline_parm no_vbo_arg("-novbo", NULL, AT_NONE); // Cmdline_novbo
|
||||
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);
|
||||
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);
|
||||
|
||||
int Cmdline_load_all_weapons = 0;
|
||||
int Cmdline_nohtl = 0;
|
||||
@@ -426,7 +390,6 @@ 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;
|
||||
@@ -434,35 +397,32 @@ 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", "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
|
||||
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
|
||||
#ifdef Allow_NoWarn
|
||||
cmdline_parm nowarn_arg("-no_warn", "Disable warnings (not recommended)", AT_NONE); // Cmdline_nowarn
|
||||
cmdline_parm nowarn_arg("-no_warn", NULL); // Cmdline_nowarn
|
||||
#endif
|
||||
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);
|
||||
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);
|
||||
#ifdef SCP_UNIX
|
||||
cmdline_parm no_grab("-nograb", NULL, AT_NONE); // Cmdline_no_grab
|
||||
cmdline_parm no_grab("-nograb", NULL); // Cmdline_no_grab
|
||||
#endif
|
||||
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
|
||||
cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL); //Cmdline_reparse_mainhall
|
||||
|
||||
char *Cmdline_start_mission = NULL;
|
||||
int Cmdline_old_collision_sys = 0;
|
||||
@@ -486,22 +446,19 @@ 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", "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
|
||||
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
|
||||
|
||||
// Deprecated flags - CommanderDJ
|
||||
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);
|
||||
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);
|
||||
|
||||
int Cmdline_deprecated_spec = 0;
|
||||
int Cmdline_deprecated_glow = 0;
|
||||
@@ -665,7 +622,7 @@ void parm_stuff_args(cmdline_parm *parm, char *cmdline)
|
||||
}
|
||||
|
||||
|
||||
// internal function - parse the command line, extracting parameter arguments if they exist
|
||||
// internal function - parse the command line, extracting parameter arguements if they exist
|
||||
// cmdline - command line string passed to the application
|
||||
void os_parse_parms(char *cmdline)
|
||||
{
|
||||
@@ -735,7 +692,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,"Unrecognized command line parameter %s, continue?",token);
|
||||
sprintf(buffer,"Unrecogzined command line parameter %s, continue?",token);
|
||||
if( MessageBox(NULL, buffer, "Warning", MB_OKCANCEL | MB_ICONQUESTION) == IDCANCEL)
|
||||
exit(0);
|
||||
#elif defined(APPLE_APP)
|
||||
@@ -771,19 +728,11 @@ 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
|
||||
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);
|
||||
}
|
||||
}
|
||||
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++;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
@@ -806,119 +755,113 @@ 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) {
|
||||
if (strstr(cmdline, PARSE_COMMAND_LINE_STRING) != NULL) {
|
||||
parse_config = false;
|
||||
}
|
||||
|
||||
// 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
|
||||
// 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
|
||||
#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 ) {
|
||||
char *buf, *p;
|
||||
// if the file exists, get a single line, and deal with it
|
||||
if ( fp && parse_config ) {
|
||||
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';
|
||||
}
|
||||
|
||||
#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);
|
||||
// replace the newline character with a NULL
|
||||
if ( (p = strrchr(buf, '\n')) != NULL ) {
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
// parse user specific cmdline_fso config file (will supersede options in global file)
|
||||
char cmdname[MAX_PATH];
|
||||
// append a space for the os_parse_parms() check
|
||||
strcat_s(buf, len, " ");
|
||||
#endif
|
||||
|
||||
snprintf(cmdname, MAX_PATH, "%s/%s/data/cmdline_fso.cfg", detect_home(), Osreg_user_dir);
|
||||
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);
|
||||
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);
|
||||
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 the file exists, get a single line, and deal with it
|
||||
if ( fp ) {
|
||||
char *buf, *p;
|
||||
// append a space for the os_parse_parms() check
|
||||
strcat_s(buf, len, " ");
|
||||
|
||||
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);
|
||||
}
|
||||
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
|
||||
*
|
||||
* @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_)
|
||||
// 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_)
|
||||
{
|
||||
name = name_;
|
||||
help = help_;
|
||||
stacks = stacks_;
|
||||
args = NULL;
|
||||
name_found = 0;
|
||||
|
||||
if (Parm_list_inited == 0) {
|
||||
Assertion(&Parm_list == this, "Coding error! 1st initialised cmdline_parm must be static Parm_list\n");
|
||||
list_init(this);
|
||||
list_init(&Parm_list);
|
||||
Parm_list_inited = 1;
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
if (name != NULL) {
|
||||
list_append(&Parm_list, this);
|
||||
}
|
||||
}
|
||||
@@ -957,10 +900,9 @@ int cmdline_parm::found()
|
||||
return name_found;
|
||||
}
|
||||
|
||||
// returns - the interger representation for the parameter argument
|
||||
// returns - the interger representation for the parameter arguement
|
||||
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;
|
||||
@@ -969,7 +911,7 @@ int cmdline_parm::get_int()
|
||||
// first off, DON'T STACK NON-STRINGS!!
|
||||
Int3();
|
||||
|
||||
// secondly, we still need to get it right for the user's sake...
|
||||
// secondly, we still need to get it right for the users sake...
|
||||
char *moron = strstr(args, ",");
|
||||
|
||||
if ( moron && ((strlen(moron) + 1) < strlen(args)) ) {
|
||||
@@ -982,10 +924,9 @@ int cmdline_parm::get_int()
|
||||
}
|
||||
|
||||
|
||||
// returns - the float representation for the parameter argument
|
||||
// returns - the float representation for the parameter arguement
|
||||
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;
|
||||
@@ -994,7 +935,7 @@ float cmdline_parm::get_float()
|
||||
// first off, DON'T STACK NON-STRINGS!!
|
||||
Int3();
|
||||
|
||||
// secondly, we still need to get it right for the user's sake
|
||||
// secondly, we still need to get it right for the users sake
|
||||
char *moron = strstr(args, ",");
|
||||
|
||||
if ( moron && ((strlen(moron) + 1) < strlen(args)) ) {
|
||||
@@ -1007,10 +948,9 @@ float cmdline_parm::get_float()
|
||||
}
|
||||
|
||||
|
||||
// returns - the string value for the parameter argument
|
||||
// returns - the string value for the parameter arguement
|
||||
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;
|
||||
@@ -1278,6 +1218,12 @@ 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';
|
||||
@@ -1289,49 +1235,7 @@ bool SetCmdlineParams()
|
||||
memset( modlist, 0, len + 2 );
|
||||
strcpy_s(modlist, len+2, Cmdline_mod);
|
||||
|
||||
#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
|
||||
//modlist[len]= '\0'; // double null termination at the end
|
||||
|
||||
// null terminate each individual
|
||||
for (int i = 0; i < len; i++)
|
||||
@@ -1396,10 +1300,6 @@ 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();
|
||||
@@ -1514,11 +1414,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_novbo = 1;
|
||||
}
|
||||
|
||||
if ( no_pbo_arg.found() )
|
||||
{
|
||||
Cmdline_no_pbo = 1;
|
||||
}
|
||||
|
||||
if ( no_drawrangeelements.found() )
|
||||
{
|
||||
Cmdline_drawelements = 1;
|
||||
@@ -1529,11 +1424,6 @@ 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;
|
||||
@@ -1616,11 +1506,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_fb_explosions = 1;
|
||||
}
|
||||
|
||||
if ( brieflighting_arg.found() )
|
||||
{
|
||||
Cmdline_brief_lighting = 1;
|
||||
}
|
||||
|
||||
if ( postprocess_arg.found() )
|
||||
{
|
||||
Cmdline_postprocess = 1;
|
||||
@@ -1641,22 +1526,6 @@ 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() )
|
||||
{
|
||||
@@ -1734,16 +1603,3 @@ 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,7 +96,6 @@ 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;
|
||||
@@ -121,7 +120,6 @@ 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;
|
||||
@@ -130,7 +128,6 @@ 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;
|
||||
@@ -152,8 +149,5 @@ 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"
|
||||
|
||||
class object;
|
||||
struct object;
|
||||
|
||||
#define CMEASURE_WAIT 333 // delay in milliseconds between countermeasure firing.
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "network/multi_pmsg.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "debugconsole/console.h"
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -126,7 +124,7 @@ int Conflict_bright = 0;
|
||||
|
||||
static int Num_cc_lines;
|
||||
static struct {
|
||||
const char *label;
|
||||
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
|
||||
@@ -137,7 +135,6 @@ 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;
|
||||
};
|
||||
|
||||
@@ -177,9 +174,6 @@ 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
|
||||
@@ -351,7 +345,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];
|
||||
@@ -540,8 +534,6 @@ config_item_undo *get_undo_block(int size)
|
||||
ptr->list = NULL;
|
||||
}
|
||||
|
||||
ptr->reset_to_preset = -1;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -574,45 +566,41 @@ int control_config_undo_last()
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Config_item_undo->reset_to_preset > -1) {
|
||||
control_config_reset_defaults(Config_item_undo->reset_to_preset);
|
||||
if (Config_item_undo->index[0] & JOY_AXIS) {
|
||||
tab = SHIP_TAB;
|
||||
} else {
|
||||
if (Config_item_undo->index[0] & JOY_AXIS) {
|
||||
tab = SHIP_TAB;
|
||||
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 {
|
||||
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 (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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,25 +860,10 @@ 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 != preset[i].key_default) || (Control_config[i].joy_id != preset[i].joy_default)) {
|
||||
if ((Control_config[i].key_id != Control_config[i].key_default) || (Control_config[i].joy_id != Control_config[i].joy_default)) {
|
||||
total++;
|
||||
}
|
||||
}
|
||||
@@ -901,7 +874,7 @@ int control_config_do_reset()
|
||||
}
|
||||
}
|
||||
|
||||
if (!total && !cycling_presets) {
|
||||
if (!total) {
|
||||
gamesnd_play_iface(SND_GENERAL_FAIL);
|
||||
return -1;
|
||||
}
|
||||
@@ -909,7 +882,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 != preset[i].key_default) || (Control_config[i].joy_id != preset[i].joy_default)) {
|
||||
if ((Control_config[i].key_id != Control_config[i].key_default) || (Control_config[i].joy_id != Control_config[i].joy_default)) {
|
||||
ptr->index[j] = i;
|
||||
ptr->list[j] = Control_config[i];
|
||||
j++;
|
||||
@@ -928,43 +901,23 @@ int control_config_do_reset()
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(j == total);
|
||||
|
||||
if (cycling_presets)
|
||||
control_config_reset_defaults(Defaults_cycle_pos);
|
||||
else
|
||||
control_config_reset_defaults();
|
||||
|
||||
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 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)
|
||||
// This sets all the controls to their default values
|
||||
void control_config_reset_defaults()
|
||||
{
|
||||
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++) {
|
||||
// Note that key_default and joy_default are NOT overwritten here;
|
||||
// they should retain the values of the first preset because
|
||||
// for example the key-pressed SEXP works off the defaults of the first preset
|
||||
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;
|
||||
Control_config[i].key_id = Control_config[i].key_default;
|
||||
Control_config[i].joy_id = Control_config[i].joy_default;
|
||||
}
|
||||
|
||||
for (i=0; i<NUM_JOY_AXIS_ACTIONS; i++) {
|
||||
@@ -1263,7 +1216,7 @@ void control_config_button_pressed(int n)
|
||||
}
|
||||
}
|
||||
|
||||
const char *control_config_tooltip_handler(const char *str)
|
||||
char *control_config_tooltip_handler(char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1288,16 +1241,14 @@ 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
|
||||
Control_config_overlay_id = help_overlay_get_index(CONTROL_CONFIG_OVERLAY);
|
||||
help_overlay_set_state(Control_config_overlay_id,gr_screen.res,0);
|
||||
help_overlay_load(CONTROL_CONFIG_OVERLAY);
|
||||
help_overlay_set_state(CONTROL_CONFIG_OVERLAY,0);
|
||||
|
||||
// reset conflict flashing
|
||||
Conflict_stamp = -1;
|
||||
@@ -1387,6 +1338,9 @@ 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);
|
||||
@@ -1438,8 +1392,7 @@ void control_config_close()
|
||||
|
||||
void control_config_do_frame(float frametime)
|
||||
{
|
||||
const char *str;
|
||||
char buf[256], *jptr;
|
||||
char buf[256], *str, *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
|
||||
@@ -1498,7 +1451,7 @@ void control_config_do_frame(float frametime)
|
||||
}
|
||||
|
||||
} else {
|
||||
if (help_overlay_active(Control_config_overlay_id)) {
|
||||
if (help_overlay_active(CONTROL_CONFIG_OVERLAY)) {
|
||||
CC_Buttons[gr_screen.res][HELP_BUTTON].button.reset_status();
|
||||
Ui_window.set_ignore_gadgets(1);
|
||||
}
|
||||
@@ -1508,14 +1461,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_id)) {
|
||||
help_overlay_set_state(Control_config_overlay_id, gr_screen.res, 0);
|
||||
if (help_overlay_active(CONTROL_CONFIG_OVERLAY)) {
|
||||
help_overlay_set_state(CONTROL_CONFIG_OVERLAY, 0);
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !help_overlay_active(Control_config_overlay_id) ) {
|
||||
if ( !help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
}
|
||||
|
||||
@@ -1542,7 +1495,7 @@ void control_config_do_frame(float frametime)
|
||||
}
|
||||
|
||||
if ((k > 0) && !Config_allowed[k & KEY_MASK]) {
|
||||
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR( "That is a non-bindable key. Please try again.", 207));
|
||||
popup(0, 1, POPUP_OK, XSTR( "That is a non-bindable key. Please try again.", 207));
|
||||
k = 0;
|
||||
}
|
||||
|
||||
@@ -1609,7 +1562,7 @@ void control_config_do_frame(float frametime)
|
||||
}
|
||||
|
||||
} else if (Search_mode) {
|
||||
if (help_overlay_active(Control_config_overlay_id)) {
|
||||
if (help_overlay_active(CONTROL_CONFIG_OVERLAY)) {
|
||||
CC_Buttons[gr_screen.res][HELP_BUTTON].button.reset_status();
|
||||
Ui_window.set_ignore_gadgets(1);
|
||||
}
|
||||
@@ -1619,14 +1572,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_id) ) {
|
||||
help_overlay_set_state(Control_config_overlay_id, gr_screen.res, 0);
|
||||
if ( help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
help_overlay_set_state(CONTROL_CONFIG_OVERLAY, 0);
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !help_overlay_active(Control_config_overlay_id) ) {
|
||||
if ( !help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
}
|
||||
|
||||
@@ -1720,7 +1673,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_id) ) {
|
||||
if ( help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
CC_Buttons[gr_screen.res][HELP_BUTTON].button.reset_status();
|
||||
Ui_window.set_ignore_gadgets(1);
|
||||
}
|
||||
@@ -1728,14 +1681,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_id) ) {
|
||||
help_overlay_set_state(Control_config_overlay_id, gr_screen.res, 0);
|
||||
if ( help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
help_overlay_set_state(CONTROL_CONFIG_OVERLAY, 0);
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !help_overlay_active(Control_config_overlay_id) ) {
|
||||
if ( !help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
|
||||
Ui_window.set_ignore_gadgets(0);
|
||||
}
|
||||
|
||||
@@ -1841,7 +1794,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_RESIZE_MENU);
|
||||
gr_bitmap(0, 0);
|
||||
}
|
||||
|
||||
// highlight tab with conflict
|
||||
@@ -1875,7 +1828,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_RESIZE_MENU);
|
||||
gr_string((gr_screen.max_w / 2) - (sw / 2), Conflict_warning_coords[gr_screen.res][1], conflict_str);
|
||||
|
||||
gr_set_font(FONT1);
|
||||
} else {
|
||||
@@ -1931,7 +1884,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_menu(x - w / 2, y - font_height / 2, XSTR( "?", 208));
|
||||
gr_printf(x - w / 2, y - font_height / 2, XSTR( "?", 208));
|
||||
}
|
||||
|
||||
} else if (!(z & JOY_AXIS) && ((Conflicts[z].key >= 0) || (Conflicts[z].joy >= 0))) {
|
||||
@@ -1943,7 +1896,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_menu(x - w / 2, y - font_height, str);
|
||||
gr_printf(x - w / 2, y - font_height, str);
|
||||
|
||||
if (Control_config[i].hasXSTR) {
|
||||
strcpy_s(buf, XSTR(Control_config[i].text, CONTROL_CONFIG_XSTR + i));
|
||||
@@ -1953,12 +1906,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_menu(x - w / 2, y, buf);
|
||||
gr_printf(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_menu(x - w / 2, y - font_height / 2, bound_string);
|
||||
gr_printf(x - w / 2, y - font_height / 2, bound_string);
|
||||
if (timestamp_elapsed(bound_timestamp)) {
|
||||
*bound_string = 0;
|
||||
}
|
||||
@@ -1966,7 +1919,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_menu(Control_more_coords[gr_screen.res][CONTROL_X_COORD], Control_more_coords[gr_screen.res][CONTROL_Y_COORD], XSTR( "More...", 210));
|
||||
gr_printf(Control_more_coords[gr_screen.res][CONTROL_X_COORD], Control_more_coords[gr_screen.res][CONTROL_Y_COORD], XSTR( "More...", 210));
|
||||
}
|
||||
|
||||
conflict = 0;
|
||||
@@ -1992,7 +1945,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_menu(Control_list_coords[gr_screen.res][CONTROL_X_COORD], y, buf);
|
||||
gr_printf(Control_list_coords[gr_screen.res][CONTROL_X_COORD], y, buf);
|
||||
}
|
||||
|
||||
if (!(z & JOY_AXIS)) {
|
||||
@@ -2004,7 +1957,7 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
if ((k < 0) && (j < 0)) {
|
||||
gr_set_color_fast(&Color_grey);
|
||||
gr_printf_menu(x, y, XSTR( "None", 211));
|
||||
gr_printf(x, y, XSTR( "None", 211));
|
||||
|
||||
} else {
|
||||
if (k >= 0) {
|
||||
@@ -2024,7 +1977,7 @@ void control_config_do_frame(float frametime)
|
||||
gr_set_color_fast(c);
|
||||
}
|
||||
|
||||
gr_printf_menu(x, y, buf);
|
||||
gr_printf(x, y, buf);
|
||||
|
||||
len = strlen(buf);
|
||||
Cc_lines[line].kx = x - Control_list_coords[gr_screen.res][CONTROL_X_COORD];
|
||||
@@ -2034,7 +1987,7 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
if (j >= 0) {
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
gr_printf_menu(x, y, XSTR( ", ", 212));
|
||||
gr_printf(x, y, XSTR( ", ", 212));
|
||||
gr_get_string_size(&w, NULL, XSTR( ", ", 212));
|
||||
x += w;
|
||||
}
|
||||
@@ -2058,7 +2011,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_menu(x, y, buf);
|
||||
gr_printf(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);
|
||||
@@ -2074,7 +2027,7 @@ void control_config_do_frame(float frametime)
|
||||
|
||||
if (j < 0) {
|
||||
gr_set_color_fast(&Color_grey);
|
||||
gr_printf_menu(x, y, XSTR( "None", 211));
|
||||
gr_printf(x, y, XSTR( "None", 211));
|
||||
|
||||
} else {
|
||||
if (Conflicts_axes[z & ~JOY_AXIS] >= 0) {
|
||||
@@ -2093,7 +2046,7 @@ void control_config_do_frame(float frametime)
|
||||
gr_set_color_fast(c);
|
||||
}
|
||||
|
||||
gr_string(x, y, Joy_axis_text[j], GR_RESIZE_MENU);
|
||||
gr_string(x, y, Joy_axis_text[j]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2108,7 +2061,7 @@ void control_config_do_frame(float frametime)
|
||||
}
|
||||
|
||||
// blit help overlay if active
|
||||
help_overlay_maybe_blit(Control_config_overlay_id, gr_screen.res);
|
||||
help_overlay_maybe_blit(CONTROL_CONFIG_OVERLAY);
|
||||
|
||||
gr_flip();
|
||||
}
|
||||
@@ -2133,8 +2086,6 @@ 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;
|
||||
}
|
||||
|
||||
@@ -2149,11 +2100,6 @@ 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;
|
||||
}
|
||||
|
||||
@@ -2165,7 +2111,7 @@ void control_check_indicate()
|
||||
#ifndef NDEBUG
|
||||
if (Show_controls_info) {
|
||||
gr_set_color_fast(&HUD_color_debug);
|
||||
gr_printf_no_resize(gr_screen.max_w - 154, 5, NOX("Ctrls checked: %d"), Control_check_count);
|
||||
gr_printf(490, 15, NOX("Ctrls checked: %d"), Control_check_count);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2259,17 +2205,6 @@ 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;
|
||||
}
|
||||
|
||||
@@ -2325,7 +2260,6 @@ 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
|
||||
@@ -2333,20 +2267,7 @@ void control_used(int id)
|
||||
return;
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
Control_config[id].used = timestamp();
|
||||
}
|
||||
|
||||
void control_config_clear_used_status()
|
||||
|
||||
+124
-130
@@ -5,11 +5,9 @@
|
||||
* 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
|
||||
|
||||
@@ -69,7 +67,6 @@ typedef struct config_item {
|
||||
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
|
||||
} config_item;
|
||||
|
||||
/*!
|
||||
@@ -77,203 +74,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;
|
||||
@@ -288,10 +285,7 @@ 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 char **Scan_code_text;
|
||||
extern char **Joy_button_text;
|
||||
|
||||
@@ -303,8 +297,8 @@ void control_config_close();
|
||||
|
||||
void control_config_cancel_exit();
|
||||
|
||||
void control_config_reset_defaults(int presetnum=-1);
|
||||
int translate_key_to_index(const char *key, bool find_override=true);
|
||||
void control_config_reset_defaults();
|
||||
int translate_key_to_index(char *key);
|
||||
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
+19
-15
@@ -55,8 +55,12 @@ 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;
|
||||
}
|
||||
|
||||
@@ -72,6 +76,8 @@ 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 );
|
||||
|
||||
@@ -84,12 +90,8 @@ void cutscene_init()
|
||||
compact_multitext_string(buf);
|
||||
cutinfo.description = vm_strdup(buf);
|
||||
|
||||
if (optional_string("$cd:"))
|
||||
stuff_int( &cutinfo.cd );
|
||||
else
|
||||
cutinfo.cd = 0;
|
||||
|
||||
cutinfo.viewable = false;
|
||||
required_string("$cd:");
|
||||
stuff_int( &cutinfo.cd );
|
||||
|
||||
if (isFirstCutscene) {
|
||||
isFirstCutscene = false;
|
||||
@@ -101,10 +103,14 @@ 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
|
||||
@@ -150,8 +156,6 @@ 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
|
||||
@@ -250,7 +254,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 const char *Text_lines[MAX_TEXT_LINES];
|
||||
static char *Text_lines[MAX_TEXT_LINES];
|
||||
|
||||
|
||||
int cutscenes_validate_cd(char *mve_name, int prompt_for_cd)
|
||||
@@ -258,7 +262,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[MAX_PATH_LEN];
|
||||
char volume_name[128];
|
||||
|
||||
int num_attempts = 0;
|
||||
|
||||
@@ -318,7 +322,7 @@ void cutscenes_screen_play()
|
||||
strcpy_s(name, Cutscenes[which_cutscene].filename );
|
||||
// full_name = cf_add_ext(name, NOX(".mve"));
|
||||
|
||||
main_hall_stop_music(true);
|
||||
main_hall_stop_music();
|
||||
main_hall_stop_ambient();
|
||||
int rval = movie_play(name);
|
||||
main_hall_start_music();
|
||||
@@ -331,7 +335,7 @@ void cutscenes_screen_play()
|
||||
else
|
||||
sprintf(str, XSTR("Unable to play movie %s.", 204), Cutscenes[which_cutscene].name);
|
||||
|
||||
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, str );
|
||||
popup(0, 1, POPUP_OK, str );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -578,7 +582,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_RESIZE_MENU);
|
||||
gr_bitmap(0, 0);
|
||||
}
|
||||
|
||||
Ui_window.draw();
|
||||
@@ -608,7 +612,7 @@ void cutscenes_screen_do_frame()
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
}
|
||||
|
||||
gr_printf_menu(Cutscene_list_coords[gr_screen.res][0], Cutscene_list_coords[gr_screen.res][1] + y, Cutscenes[Cutscene_list[z]].name);
|
||||
gr_printf(Cutscene_list_coords[gr_screen.res][0], Cutscene_list_coords[gr_screen.res][1] + y, Cutscenes[Cutscene_list[z]].name);
|
||||
|
||||
y += font_height;
|
||||
z++;
|
||||
@@ -647,7 +651,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_RESIZE_MENU);
|
||||
gr_string(Cutscene_desc_coords[gr_screen.res][0], Cutscene_desc_coords[gr_screen.res][1] + y, line);
|
||||
|
||||
y += font_height;
|
||||
z++;
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
typedef struct cutscene_info {
|
||||
cutscene_info() :
|
||||
viewable(false)
|
||||
{}
|
||||
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
char name[NAME_LENGTH];
|
||||
char *description;
|
||||
|
||||
@@ -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, GR_RESIZE_FULL);
|
||||
gr_bitmap ((int)g_screenX, (int)g_screenY, true);
|
||||
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, sizeof(lower_name)-1 );
|
||||
strncpy( lower_name, filename, strlen(filename) );
|
||||
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(const char *filename, CFILE *img_cfp, int *width, int *height, int *bpp, int *compression_type, int *levels, int *size, ubyte *palette)
|
||||
int dds_read_header(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(const char *filename, ubyte *data, ubyte *bpp, int cf_type)
|
||||
int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp, int cf_type)
|
||||
{
|
||||
int retval;
|
||||
int w,h,ct,lvl;
|
||||
@@ -321,7 +321,7 @@ int dds_read_bitmap(const 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, const char *filename)
|
||||
void dds_save_image(int width, int height, int bpp, int num_mipmaps, ubyte *data, int cubemap, 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(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);
|
||||
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);
|
||||
|
||||
//reads bitmap
|
||||
//size of the data it stored in size
|
||||
int dds_read_bitmap(const char *filename, ubyte *data, ubyte *bpp = NULL, int cf_type = CF_TYPE_ANY);
|
||||
int dds_read_bitmap(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, const char *filename = NULL);
|
||||
void dds_save_image(int width, int height, int bpp, int num_mipmaps, ubyte *data = NULL, int cubemap = 0, char *filename = NULL);
|
||||
|
||||
//returns a string from a DDS error code
|
||||
const char *dds_error_string(int code);
|
||||
|
||||
@@ -101,7 +101,6 @@ 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;
|
||||
@@ -238,7 +237,6 @@ void debris_delete( object * obj )
|
||||
}
|
||||
|
||||
db->flags = 0;
|
||||
db->objnum = -1;
|
||||
Num_debris_pieces--;
|
||||
}
|
||||
|
||||
@@ -526,11 +524,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 * (myrand() * RAND_MAX_1f) + 0.5f;
|
||||
db->lifeleft = 2.0f * ((float) myrand()/(float) RAND_MAX) + 0.5f;
|
||||
else
|
||||
db->lifeleft = -1.0f; // large hull pieces stay around forever
|
||||
} else {
|
||||
db->lifeleft = (myrand() * RAND_MAX_1f) * 2.0f + 0.1f;
|
||||
db->lifeleft = (i2fl(myrand())/i2fl(RAND_MAX))*2.0f+0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,7 +805,6 @@ 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 );
|
||||
@@ -837,7 +834,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
|
||||
weapon *wp = &Weapons[other_obj->instance];
|
||||
wp->collisionOccured = true;
|
||||
memcpy(&wp->collisionInfo, &mc, sizeof(mc_info));
|
||||
wp->collisionInfo = mc_info(mc);
|
||||
|
||||
return mc.num_hits;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
class object;
|
||||
struct object;
|
||||
struct CFILE;
|
||||
|
||||
#define MAX_DEBRIS_ARCS 8 // Must be less than MAX_ARC_EFFECTS in model.h
|
||||
|
||||
+614
-481
File diff suppressed because it is too large.
Load diff
@@ -1,279 +0,0 @@
|
||||
#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
|
||||
@@ -1,162 +0,0 @@
|
||||
/*
|
||||
* 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
@@ -1,459 +0,0 @@
|
||||
#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,14 +157,18 @@ 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(const char *filename)
|
||||
void parse_fireball_tbl(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;
|
||||
}
|
||||
|
||||
@@ -237,6 +241,9 @@ void parse_fireball_tbl(const char *filename)
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
void fireball_parse_tbl()
|
||||
@@ -374,9 +381,7 @@ void fireball_render(object * obj)
|
||||
|
||||
MONITOR_INC( NumFireballsRend, 1 );
|
||||
|
||||
memset(&p, 0, sizeof(p));
|
||||
|
||||
num = obj->instance;
|
||||
num = obj->instance;
|
||||
fb = &Fireballs[num];
|
||||
|
||||
if ( Fireballs[num].current_bitmap < 0 )
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
class object;
|
||||
class ship_info;
|
||||
struct object;
|
||||
struct ship_info;
|
||||
class asteroid_info;
|
||||
|
||||
// values correspond to the fireball render types
|
||||
|
||||
@@ -58,7 +58,6 @@ 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,7 +22,6 @@ 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
|
||||
}
|
||||
@@ -34,7 +33,6 @@ 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
|
||||
}
|
||||
@@ -62,7 +60,6 @@ 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();
|
||||
@@ -76,7 +73,7 @@ void FictionViewerDlg::OnOK()
|
||||
|
||||
// load it up
|
||||
fiction_viewer_reset();
|
||||
fiction_viewer_load((const char *)(LPCSTR)m_story_file, (const char *)(LPCSTR)m_font_file, (const char *)(LPCSTR)m_voice_file);
|
||||
fiction_viewer_load((char *)(LPCSTR) m_story_file, (char *)(LPCSTR) m_font_file);
|
||||
|
||||
// set music
|
||||
Mission_music[SCORE_FICTION_VIEWER] = m_fiction_music - 1;
|
||||
@@ -114,6 +111,5 @@ void FictionViewerDlg::OnClose()
|
||||
|
||||
int FictionViewerDlg::query_modified()
|
||||
{
|
||||
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);
|
||||
return strcmp(m_story_file, fiction_file()) || strcmp(m_font_file, fiction_font()) || m_fiction_music != (Mission_music[SCORE_FICTION_VIEWER] + 1);
|
||||
}
|
||||
@@ -24,7 +24,6 @@ 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,15 +233,6 @@ 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,8 +76,6 @@ 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;
|
||||
@@ -111,8 +109,6 @@ 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);
|
||||
@@ -135,7 +131,6 @@ 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)
|
||||
@@ -146,8 +141,6 @@ 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()
|
||||
|
||||
@@ -188,7 +181,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<MIN_BRIEF_ICONS; i++)
|
||||
for (i=0; i<MAX_BRIEF_ICONS; i++)
|
||||
box->AddString(Icon_names[i]);
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_TEAM);
|
||||
@@ -439,7 +432,6 @@ 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
|
||||
@@ -450,40 +442,30 @@ 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;
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
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) {
|
||||
@@ -562,8 +544,6 @@ 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;
|
||||
@@ -575,8 +555,6 @@ 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;
|
||||
@@ -586,23 +564,12 @@ 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 && (sip_bii_ship < 0));
|
||||
GetDlgItem(IDC_ICON_IMAGE) -> EnableWindow(enable);
|
||||
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);
|
||||
@@ -1234,11 +1201,6 @@ 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;
|
||||
@@ -1437,15 +1399,10 @@ void briefing_editor_dlg::OnPasteView()
|
||||
|
||||
void briefing_editor_dlg::OnFlipIcon()
|
||||
{
|
||||
update_data(1);
|
||||
}
|
||||
|
||||
void briefing_editor_dlg::OnWingIcon()
|
||||
{
|
||||
update_data(1);
|
||||
}
|
||||
|
||||
void briefing_editor_dlg::OnCargoIcon()
|
||||
{
|
||||
// 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);
|
||||
|
||||
}
|
||||
@@ -66,8 +66,6 @@ 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;
|
||||
@@ -122,7 +120,6 @@ 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();
|
||||
@@ -133,8 +130,6 @@ 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,6 +246,7 @@ 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);
|
||||
@@ -258,7 +259,8 @@ void campaign_editor::mission_selected(int num)
|
||||
bc_dialog->SetWindowText(Campaign.missions[num].briefing_cutscene);
|
||||
|
||||
// new main hall stuff
|
||||
bc_hall->SetWindowText(Campaign.missions[num].main_hall.c_str());
|
||||
sprintf(mainhalltext, "%s", const_cast<char*>(Campaign.missions[num].main_hall.c_str()));
|
||||
bc_hall->SetWindowText(CString(mainhalltext));
|
||||
|
||||
// new debriefing persona stuff
|
||||
sprintf(personatext, "%d", Campaign.missions[num].debrief_persona_index);
|
||||
|
||||
+25
-28
@@ -20,7 +20,6 @@
|
||||
#include "cfile/cfile.h"
|
||||
#include "sound/audiostr.h"
|
||||
#include "localization/localize.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
@@ -62,12 +61,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)
|
||||
@@ -91,12 +90,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
|
||||
@@ -223,23 +222,21 @@ BOOL event_editor::OnInitDialog()
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
}
|
||||
// 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");
|
||||
|
||||
/*
|
||||
box->AddString("Head-VC"); // force it in, since Sandeep wants it and it's not used in built-in messages
|
||||
@@ -903,6 +900,8 @@ 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)
|
||||
@@ -913,8 +912,6 @@ 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
|
||||
@@ -1049,6 +1046,11 @@ 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 {
|
||||
@@ -1074,11 +1076,6 @@ 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);
|
||||
}
|
||||
@@ -1234,7 +1231,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 - 1);
|
||||
lcl_fred_replace_stuff(m_messages[num].message, MESSAGE_LENGTH);
|
||||
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://scp.indiegames.us/mantis/";
|
||||
char *path = "http://mgo.maxgaming.net/mantis/login_page.php";
|
||||
|
||||
char buffer[MAX_PATH];
|
||||
sprintf(buffer,"explorer.exe \"%s\"", path);
|
||||
|
||||
+221
-234
File diff suppressed because it is too large.
Load diff
+85
-1
@@ -79,6 +79,7 @@ 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()
|
||||
|
||||
@@ -403,7 +404,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
|
||||
wing_bash_ship_name(name, Wings[i].name, j + 1);
|
||||
sprintf(name, "%s %d", 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);
|
||||
@@ -1014,6 +1015,89 @@ 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,6 +89,7 @@ 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,7 +53,6 @@
|
||||
#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;
|
||||
@@ -142,7 +141,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( Briefing_window_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);
|
||||
gr_set_view_matrix(&Eye_position, &Eye_matrix);
|
||||
}
|
||||
|
||||
@@ -408,7 +407,7 @@ void render_waypoints(void)
|
||||
vertex v;
|
||||
|
||||
SCP_list<waypoint_list>::iterator ii;
|
||||
SCP_vector<waypoint>::iterator jj;
|
||||
SCP_list<waypoint>::iterator jj;
|
||||
|
||||
for (ii = Waypoint_lists.begin(); ii != Waypoint_lists.end(); ++ii)
|
||||
{
|
||||
@@ -1489,11 +1488,7 @@ void render_frame()
|
||||
gr_set_font(FONT1);
|
||||
light_reset();
|
||||
|
||||
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);
|
||||
}
|
||||
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
|
||||
Viewer_pos = eye_pos; // for starfield code
|
||||
|
||||
fred_enable_htl();
|
||||
@@ -1598,11 +1593,7 @@ void render_frame()
|
||||
gr_set_clip(0, 0, True_rw, True_rh);
|
||||
|
||||
g3_start_frame(0); // ** Accounted for
|
||||
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);
|
||||
}
|
||||
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
|
||||
}
|
||||
|
||||
void game_do_frame()
|
||||
@@ -1866,7 +1857,6 @@ 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(class object*){}
|
||||
void init_ets(struct 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(class object *,class object *,float,unsigned char) {}
|
||||
void send_ship_kill_packet(struct object *,struct 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(class object *, class ship *){}
|
||||
void game_tst_mark(struct object *, struct ship *){}
|
||||
int tst;
|
||||
//int Player_multi_died_check;
|
||||
int Show_framerate = 0;
|
||||
|
||||
+4
-46
@@ -1095,7 +1095,7 @@ void CFREDView::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
Assert(objp->type == OBJ_SHIP);
|
||||
ship = objp->instance;
|
||||
Assert(Ships[ship].wingnum == -1);
|
||||
wing_bash_ship_name(Ships[ship].ship_name, Wings[Duped_wing].name,
|
||||
sprintf(Ships[ship].ship_name, "%s %d", Wings[Duped_wing].name,
|
||||
Wings[Duped_wing].wave_count + 1);
|
||||
|
||||
Wings[Duped_wing].ship_index[Wings[Duped_wing].wave_count] = ship;
|
||||
@@ -2688,46 +2688,6 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2761,7 +2721,7 @@ int CFREDView::global_error_check()
|
||||
|
||||
if ((Objects[obj].type == OBJ_SHIP) || (Objects[obj].type == OBJ_START)) {
|
||||
ship = Objects[obj].instance;
|
||||
wing_bash_ship_name(buf, Wings[i].name, j + 1);
|
||||
sprintf(buf, "%s %d", 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);
|
||||
}
|
||||
@@ -3307,9 +3267,8 @@ int CFREDView::error(const char *msg, ...)
|
||||
va_list args;
|
||||
|
||||
va_start(args, msg);
|
||||
vsnprintf(buf, sizeof(buf)-1, msg, args);
|
||||
vsprintf(buf, msg, args);
|
||||
va_end(args);
|
||||
buf[sizeof(buf)-1] = '\0';
|
||||
|
||||
g_err = 1;
|
||||
if (MessageBox(buf, "Error", MB_OKCANCEL | MB_ICONEXCLAMATION) == IDOK)
|
||||
@@ -3324,9 +3283,8 @@ int CFREDView::internal_error(const char *msg, ...)
|
||||
va_list args;
|
||||
|
||||
va_start(args, msg);
|
||||
vsnprintf(buf, sizeof(buf)-1, msg, args);
|
||||
vsprintf(buf, 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) {
|
||||
const char *txt = NULL;
|
||||
char *txt = NULL;
|
||||
|
||||
switch (r) {
|
||||
case 0: txt = XSTR("The operating system is out of memory or resources.", 1107); break;
|
||||
|
||||
+59
-34
@@ -64,7 +64,6 @@
|
||||
#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"
|
||||
@@ -73,8 +72,6 @@
|
||||
|
||||
#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;
|
||||
@@ -256,16 +253,29 @@ 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()
|
||||
{
|
||||
for (SCP_vector<briefing_icon_info>::iterator ii = Briefing_icon_info.begin(); ii != Briefing_icon_info.end(); ++ii)
|
||||
uint i,j;
|
||||
for (i = 0; i < Species_info.size(); i++)
|
||||
{
|
||||
generic_anim_load(&ii->regular);
|
||||
hud_anim_load(&ii->fade);
|
||||
hud_anim_load(&ii->highlight);
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,14 +321,11 @@ 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(FS2_OPEN_DEFAULT_LANGUAGE);
|
||||
lcl_init(LCL_ENGLISH);
|
||||
|
||||
// Goober5000 - force init XSTRs (so they work, but only work in English, based on above comment)
|
||||
extern int Xstr_inited;
|
||||
@@ -377,10 +384,10 @@ bool fred_init()
|
||||
iff_init(); // Goober5000
|
||||
species_init(); // Kazan
|
||||
|
||||
brief_parse_icon_tbl();
|
||||
|
||||
// for fred specific replacement texture stuff
|
||||
Fred_texture_replacements.clear();
|
||||
//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);
|
||||
|
||||
// Goober5000
|
||||
for (i = 0; i < MAX_IFFS; i++)
|
||||
@@ -399,7 +406,9 @@ bool fred_init()
|
||||
|
||||
hud_init_comm_orders(); // Goober5000
|
||||
|
||||
alpha_colors_init();
|
||||
if (!new_alpha_colors_init()) {
|
||||
old_alpha_colors_init();
|
||||
}
|
||||
|
||||
gamesnd_parse_soundstbl(); // needs to be loaded after species stuff but before interface/weapon/ship stuff - taylor
|
||||
mission_brief_common_init();
|
||||
@@ -422,14 +431,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;
|
||||
mission_campaign_clear();
|
||||
Campaign.filename[0] = 0; // indicate initialized state
|
||||
|
||||
stars_post_level_init();
|
||||
|
||||
@@ -501,8 +510,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[MAX_PATH_LEN];
|
||||
getcwd(pwd, MAX_PATH_LEN); // get the present working dir - probably <fs2path>[/modpapth]/data/missions/
|
||||
char pwd[128];
|
||||
getcwd(pwd, 128); // get the present working dir - probably <fs2path>[/modpapth]/data/missions/
|
||||
|
||||
|
||||
int obj, z1, z2;
|
||||
@@ -932,8 +941,8 @@ void clear_mission()
|
||||
event_music_reset_choices();
|
||||
clear_texture_replacements();
|
||||
|
||||
mission_parse_reset_alt(); // alternate ship type names
|
||||
mission_parse_reset_callsign();
|
||||
// alternate ship type names
|
||||
mission_parse_reset_alt();
|
||||
|
||||
strcpy(Cargo_names[0], "Nothing");
|
||||
Num_cargo = 1;
|
||||
@@ -1356,16 +1365,8 @@ 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);
|
||||
@@ -1453,7 +1454,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) {
|
||||
wing_bash_ship_name(name, Wings[wing].name, i + 1);
|
||||
sprintf(name, "%s %d", Wings[wing].name, i + 1);
|
||||
rename_ship(Wings[wing].ship_index[i], name);
|
||||
}
|
||||
}
|
||||
@@ -1473,6 +1474,28 @@ 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)
|
||||
@@ -1949,7 +1972,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, const char *name)
|
||||
int query_referenced_in_ai_goals(int type, char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -2619,9 +2642,11 @@ 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)
|
||||
{
|
||||
for (SCP_vector<texture_replace>::iterator ii = Fred_texture_replacements.begin(); ii != Fred_texture_replacements.end(); ++ii)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Fred_num_texture_replacements; i++)
|
||||
{
|
||||
if (!stricmp(ii->ship_name, old_name))
|
||||
strcpy_s(ii->ship_name, new_name);
|
||||
if (!stricmp(Fred_texture_replacements[i].ship_name, old_name))
|
||||
strcpy_s(Fred_texture_replacements[i].ship_name, new_name);
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,7 @@ 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);
|
||||
@@ -113,7 +114,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, const char *name);
|
||||
int query_referenced_in_ai_goals(int type, 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,8 +72,6 @@ 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;
|
||||
@@ -124,8 +122,6 @@ 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);
|
||||
@@ -350,19 +346,6 @@ 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();
|
||||
@@ -454,7 +437,6 @@ 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,8 +63,6 @@ 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;
|
||||
|
||||
+88
-132
@@ -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_cutscenes())
|
||||
err = -4;
|
||||
else if (save_fiction())
|
||||
err = -3;
|
||||
else if (save_cutscenes())
|
||||
err = -4;
|
||||
else if (save_cmd_briefs())
|
||||
err = -4;
|
||||
else if (save_briefing())
|
||||
@@ -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].filename) ) {
|
||||
if ( strlen(The_mission.cutscenes[i].cutscene_name) ) {
|
||||
// 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].filename);
|
||||
fout(" %s", The_mission.cutscenes[i].cutscene_name);
|
||||
}
|
||||
else {
|
||||
fout_version("%s %s\n", type, The_mission.cutscenes[i].filename);
|
||||
fout_version("%s %s\n", type, The_mission.cutscenes[i].cutscene_name);
|
||||
}
|
||||
|
||||
required_string_fred("+formula:");
|
||||
@@ -795,18 +795,6 @@ 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
|
||||
{
|
||||
@@ -1005,13 +993,6 @@ 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();
|
||||
|
||||
@@ -1184,13 +1165,6 @@ 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");
|
||||
@@ -1377,7 +1351,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, z;
|
||||
int i, j, k, z;
|
||||
ai_info *aip;
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
@@ -1411,19 +1385,22 @@ int CFred_mission_save::save_objects()
|
||||
|
||||
//alt classes stuff
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL) {
|
||||
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);
|
||||
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:");
|
||||
}
|
||||
}
|
||||
|
||||
// default class?
|
||||
if (ii->default_to_this_class) {
|
||||
fout("\n+Default Class:");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1747,10 +1724,6 @@ 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(" )");
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
@@ -1770,7 +1743,6 @@ 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();
|
||||
|
||||
@@ -1796,7 +1768,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:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:");
|
||||
}
|
||||
|
||||
if (shipp->special_exp_deathroll_time > 0) {
|
||||
@@ -1805,10 +1777,11 @@ 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:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:");
|
||||
}
|
||||
}
|
||||
else {
|
||||
fso_comment_push(";;FSO 3.6.13;;");
|
||||
fout_version("\n$Special Explosion:");
|
||||
|
||||
fout_version("\n+Special Exp Damage:");
|
||||
@@ -1833,12 +1806,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:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:");
|
||||
}
|
||||
}
|
||||
// retail format special explosions
|
||||
@@ -1866,33 +1839,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:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Hitpoints:");
|
||||
}
|
||||
|
||||
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:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.13;; +Special Shield Points:");
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
@@ -1991,16 +1964,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:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.10;; +Use Table Score:");
|
||||
}
|
||||
|
||||
if (optional_string_fred("+Score:", "$Name:"))
|
||||
@@ -2012,18 +1985,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:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.10;; +Assist Score Percentage:");
|
||||
}
|
||||
|
||||
// deal with the persona for this ship as well.
|
||||
@@ -2037,16 +2010,17 @@ int CFred_mission_save::save_objects()
|
||||
}
|
||||
|
||||
// Goober5000 - deal with texture replacement ----------------
|
||||
if (!Fred_texture_replacements.empty()) {
|
||||
k = 0;
|
||||
if (Fred_num_texture_replacements > 0) {
|
||||
bool needs_header = true;
|
||||
fso_comment_push(";;FSO 3.6.8;;");
|
||||
|
||||
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) ) {
|
||||
while (k < Fred_num_texture_replacements) {
|
||||
if ( !stricmp(shipp->ship_name, Fred_texture_replacements[k].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:");
|
||||
}
|
||||
|
||||
@@ -2056,23 +2030,25 @@ int CFred_mission_save::save_objects()
|
||||
// write out this entry
|
||||
if (optional_string_fred("+old:")) {
|
||||
parse_comments(1);
|
||||
fout(" %s", ii->old_texture);
|
||||
fout(" %s", Fred_texture_replacements[k].old_texture);
|
||||
} else {
|
||||
fout_version("\n+old: %s", ii->old_texture);
|
||||
fout_version("\n+old: %s", Fred_texture_replacements[k].old_texture);
|
||||
}
|
||||
|
||||
if (optional_string_fred("+new:")) {
|
||||
parse_comments(1);
|
||||
fout(" %s", ii->new_texture);
|
||||
fout(" %s", Fred_texture_replacements[k].new_texture);
|
||||
} else {
|
||||
fout_version("\n+new: %s", ii->new_texture);
|
||||
fout_version("\n+new: %s", Fred_texture_replacements[k].new_texture);
|
||||
}
|
||||
}
|
||||
|
||||
k++; // increment down the list of texture replacements
|
||||
}
|
||||
|
||||
fso_comment_pop();
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.8;; $Texture Replace:", "$Name:");
|
||||
bypass_comment(";;FSO 3.6.8;; $Texture Replace:");
|
||||
}
|
||||
|
||||
// end of texture replacement -------------------------------
|
||||
@@ -2689,7 +2665,7 @@ int CFred_mission_save::save_waypoints()
|
||||
int CFred_mission_save::save_waypoint_list(waypoint_list *wp_list)
|
||||
{
|
||||
Assert(wp_list != NULL);
|
||||
SCP_vector<waypoint>::iterator ii;
|
||||
SCP_list<waypoint>::iterator ii;
|
||||
|
||||
for (ii = wp_list->get_waypoints().begin(); ii != wp_list->get_waypoints().end(); ++ii)
|
||||
{
|
||||
@@ -2793,16 +2769,11 @@ 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(const char *comment, const char *end)
|
||||
void CFred_mission_save::bypass_comment(char *comment)
|
||||
{
|
||||
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');
|
||||
|
||||
@@ -2824,7 +2795,6 @@ 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;
|
||||
@@ -2838,13 +2808,12 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
while (newlines-- > 0)
|
||||
fout("\n");
|
||||
|
||||
if (tab && token_found)
|
||||
fout_version("\t%s", token_found);
|
||||
else if (token_found)
|
||||
fout_version("%s", token_found);
|
||||
else if (tab)
|
||||
if (tab)
|
||||
fout("\t");
|
||||
|
||||
if (token_found)
|
||||
fout("%s", token_found);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2857,19 +2826,12 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
fout("\n");
|
||||
|
||||
if (tab) {
|
||||
fout_version("\t");
|
||||
fout("\t");
|
||||
fout("%s", token_found);
|
||||
} else {
|
||||
fout_version("%s", token_found);
|
||||
fout("%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;
|
||||
}
|
||||
|
||||
@@ -2893,9 +2855,9 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
s_num = 3;
|
||||
}
|
||||
|
||||
if ( (s_num == 3) && ((major < FS_VERSION_MAJOR) || ((major == FS_VERSION_MAJOR) && ((minor < FS_VERSION_MINOR) || ((minor == FS_VERSION_MINOR) && (build <= FS_VERSION_BUILD))))) ) {
|
||||
if ( (s_num == 3) && (major <= FS_VERSION_MAJOR) && (minor <= FS_VERSION_MINOR) && (build <= FS_VERSION_BUILD) ) {
|
||||
state = 3;
|
||||
} 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))))))) ) {
|
||||
} else if ( (s_num == 4) && (major <= FS_VERSION_MAJOR) && (minor <= FS_VERSION_MINOR) && (build <= FS_VERSION_BUILD) && (revis <= FS_VERSION_REVIS) ) {
|
||||
state = 3;
|
||||
} else {
|
||||
state = 4;
|
||||
@@ -2961,10 +2923,7 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
if ( (*raw_ptr == ';') && (raw_ptr[1] == ';') && (state == 3) ) {
|
||||
state = raw_ptr[2];
|
||||
raw_ptr[2] = 0;
|
||||
if (version_added)
|
||||
fso_comment_pop();
|
||||
else
|
||||
version_added = true;
|
||||
fso_comment_pop();
|
||||
fso_comment_push(comment_start);
|
||||
raw_ptr[2] = (char)state;
|
||||
state = first_comment = flag = 0;
|
||||
@@ -2975,9 +2934,6 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
raw_ptr++;
|
||||
}
|
||||
|
||||
if (version_added)
|
||||
fso_comment_pop();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3380,13 +3336,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);
|
||||
}
|
||||
@@ -3451,13 +3407,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;
|
||||
@@ -3607,10 +3563,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:");
|
||||
}
|
||||
|
||||
@@ -3676,14 +3632,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:");
|
||||
}
|
||||
@@ -3802,14 +3758,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:");
|
||||
}
|
||||
@@ -3823,14 +3779,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:");
|
||||
}
|
||||
@@ -3866,14 +3822,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:");
|
||||
}
|
||||
@@ -4070,14 +4026,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:");
|
||||
}
|
||||
@@ -4256,10 +4212,10 @@ void CFred_mission_save::fso_comment_push(char *ver)
|
||||
elem1 = elem2 = 3;
|
||||
}
|
||||
|
||||
if ( (elem1 == 3) && ((major > in_major) || ((major == in_major) && ((minor > in_minor) || ((minor == in_minor) && (build > in_build))))) ) {
|
||||
if ( (elem1 == 3) && ((major > in_major) || (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) || ((major == in_major) && ((minor > in_minor) || ((minor == in_minor) && ((build > in_build) || ((build == in_build) || (revis > in_revis))))))) ) {
|
||||
} else if ( (elem1 == 4) && ((major > in_major) || (minor > in_minor) || (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(const char *comment, const char *end = NULL);
|
||||
void bypass_comment(char *comment);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -65,9 +65,7 @@ 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)
|
||||
|
||||
+3
-12
@@ -963,7 +963,6 @@
|
||||
#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
|
||||
@@ -1057,11 +1056,7 @@
|
||||
#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
|
||||
@@ -1114,10 +1109,8 @@
|
||||
#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
|
||||
@@ -1154,8 +1147,6 @@
|
||||
#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
|
||||
@@ -1173,13 +1164,12 @@
|
||||
#define IDC_NEB_FAR_MULTIPLIER 1634
|
||||
#define IDC_MISSION_LOG_TRUE 1635
|
||||
#define IDC_MISSION_LOG_FALSE 1636
|
||||
#define IDC_MISSION_LOG_STATE_CHANGE 1637
|
||||
#define IDC_MISSION_LOG_ALWAYS_TRUE 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
|
||||
@@ -1444,6 +1434,7 @@
|
||||
#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
|
||||
@@ -1472,7 +1463,7 @@
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 320
|
||||
#define _APS_NEXT_COMMAND_VALUE 33098
|
||||
#define _APS_NEXT_CONTROL_VALUE 1644
|
||||
#define _APS_NEXT_CONTROL_VALUE 1643
|
||||
#define _APS_NEXT_SYMED_VALUE 105
|
||||
#endif
|
||||
#endif
|
||||
+86
-146
@@ -96,7 +96,7 @@ sexp_tree::sexp_tree()
|
||||
}
|
||||
|
||||
// clears out the tree, so all the nodes are unused.
|
||||
void sexp_tree::clear_tree(const char *op)
|
||||
void sexp_tree::clear_tree(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, const char *deflt)
|
||||
void sexp_tree::load_tree(int index, 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, const char *text)
|
||||
void sexp_tree::set_node(int node, int type, 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, const char *text)
|
||||
int sexp_tree::load_sub_tree(int index, bool valid, char *text)
|
||||
{
|
||||
int cur;
|
||||
|
||||
@@ -719,12 +719,6 @@ 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) ) {
|
||||
|
||||
@@ -747,8 +741,7 @@ void sexp_tree::right_clicked(int mode)
|
||||
if ( Sexp_variables[idx].type & SEXP_VARIABLE_STRING ) {
|
||||
flag &= ~MF_GRAYED;
|
||||
}
|
||||
}
|
||||
if ( type & SEXPT_NUMBER ) {
|
||||
} else if ( type & SEXPT_NUMBER ) {
|
||||
if ( Sexp_variables[idx].type & SEXP_VARIABLE_NUMBER ) {
|
||||
flag &= ~MF_GRAYED;
|
||||
}
|
||||
@@ -830,16 +823,12 @@ 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_XSTR:
|
||||
case OP_TECH_ADD_INTEL:
|
||||
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;
|
||||
}
|
||||
@@ -872,16 +861,12 @@ 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_XSTR:
|
||||
case OP_TECH_ADD_INTEL:
|
||||
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;
|
||||
}
|
||||
@@ -1106,18 +1091,13 @@ void sexp_tree::right_clicked(int mode)
|
||||
|
||||
} else if (type == OPF_NULL) { // takes operator that doesn't return a value
|
||||
replace_type = OPR_NULL;
|
||||
} else if (type == OPF_AI_GOAL) {
|
||||
replace_type = OPR_AI_GOAL;
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
else if (type == OPF_FLEXIBLE_ARGUMENT) {
|
||||
} 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);
|
||||
|
||||
} else if (type == OPF_AI_GOAL) {
|
||||
replace_type = OPR_AI_GOAL;
|
||||
}
|
||||
|
||||
// default to string
|
||||
@@ -1412,7 +1392,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;
|
||||
@@ -1441,12 +1421,12 @@ int sexp_tree::end_label_edit(TVITEMA &item)
|
||||
|
||||
Assert(node < tree_nodes.size());
|
||||
if (tree_nodes[node].type & SEXPT_OPERATOR) {
|
||||
const char *op = match_closest_operator(str, node);
|
||||
if (!op) return 0; // Goober5000 - avoids crashing
|
||||
str = match_closest_operator(str, node);
|
||||
if (!str) return 0; // Goober5000 - avoids crashing
|
||||
|
||||
SetItemText(h, op);
|
||||
SetItemText(h, str);
|
||||
item_index = node;
|
||||
int op_num = get_operator_index(op);
|
||||
int op_num = get_operator_index(str);
|
||||
if (op_num >= 0 ) {
|
||||
add_or_replace_operator(op_num, 1);
|
||||
}
|
||||
@@ -1498,10 +1478,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'
|
||||
//
|
||||
const char *sexp_tree::match_closest_operator(const char *str, int node)
|
||||
char *sexp_tree::match_closest_operator(char *str, int node)
|
||||
{
|
||||
int z, i, op, arg_num, opf, opr;
|
||||
const char *sub_best = NULL, *best = NULL;
|
||||
char *sub_best = NULL, *best = NULL;
|
||||
|
||||
z = tree_nodes[node].parent;
|
||||
if (z < 0) {
|
||||
@@ -2089,7 +2069,7 @@ void sexp_list_item::set_op(int op_num)
|
||||
// initialize node, type data
|
||||
// Defaults: t = SEXPT_STRING
|
||||
//
|
||||
void sexp_list_item::set_data(const char *str, int t)
|
||||
void sexp_list_item::set_data(char *str, int t)
|
||||
{
|
||||
op = -1;
|
||||
text = str;
|
||||
@@ -2099,7 +2079,7 @@ void sexp_list_item::set_data(const char *str, int t)
|
||||
// initialize node, type data, allocating memory for the text
|
||||
// Defaults: t = SEXPT_STRING
|
||||
//
|
||||
void sexp_list_item::set_data_dup(const char *str, int t)
|
||||
void sexp_list_item::set_data_dup(char *str, int t)
|
||||
{
|
||||
op = -1;
|
||||
text = strdup(str);
|
||||
@@ -2125,7 +2105,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(const char *str, int t)
|
||||
void sexp_list_item::add_data(char *str, int t)
|
||||
{
|
||||
sexp_list_item *item, *ptr;
|
||||
|
||||
@@ -2178,7 +2158,7 @@ void sexp_list_item::destroy()
|
||||
while (ptr) {
|
||||
ptr2 = ptr->next;
|
||||
if (ptr->flags & SEXP_ITEM_F_DUP)
|
||||
free((void *) ptr->text);
|
||||
free(ptr->text);
|
||||
|
||||
delete ptr;
|
||||
ptr = ptr2;
|
||||
@@ -2194,7 +2174,8 @@ int sexp_tree::add_default_operator(int op, int argnum)
|
||||
|
||||
h = item_handle;
|
||||
index = item_index;
|
||||
if (get_default_value(&item, buf, op, argnum))
|
||||
item.text = buf;
|
||||
if (get_default_value(&item, op, argnum))
|
||||
return -1;
|
||||
|
||||
if (item.type & SEXPT_OPERATOR) {
|
||||
@@ -2214,9 +2195,7 @@ 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 == 1 && Operators[op].value == OP_COPY_VARIABLE_FROM_INDEX) ||
|
||||
(argnum == 1 && Operators[op].value == OP_SCRIPT_EVAL_STRING))
|
||||
(argnum == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING))
|
||||
{
|
||||
|
||||
int sexp_var_index = get_index_sexp_variable_name(item.text);
|
||||
@@ -2238,7 +2217,8 @@ int sexp_tree::add_default_operator(int op, int argnum)
|
||||
char buf2[256];
|
||||
Assert(argnum == 1);
|
||||
sexp_list_item temp_item;
|
||||
get_default_value(&temp_item, buf2, op, 0);
|
||||
temp_item.text = buf2;
|
||||
get_default_value(&temp_item, op, 0);
|
||||
int sexp_var_index = get_index_sexp_variable_name(temp_item.text);
|
||||
Assert(sexp_var_index != -1);
|
||||
|
||||
@@ -2262,7 +2242,7 @@ int sexp_tree::add_default_operator(int op, int argnum)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, int i)
|
||||
int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
{
|
||||
char *str = NULL;
|
||||
int type, index;
|
||||
@@ -2332,6 +2312,9 @@ int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, i
|
||||
case 7:
|
||||
temp = 100;
|
||||
break;
|
||||
case 10:
|
||||
temp = SND_SHIP_EXPLODE_1;
|
||||
break;
|
||||
case 11:
|
||||
temp = (int)EMP_DEFAULT_INTENSITY;
|
||||
break;
|
||||
@@ -2360,6 +2343,12 @@ int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, 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;
|
||||
@@ -2422,32 +2411,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, 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);
|
||||
@@ -2462,24 +2425,20 @@ int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, i
|
||||
list = list->next;
|
||||
|
||||
if (first_ptr->flags & SEXP_ITEM_F_DUP)
|
||||
free((void *) first_ptr->text);
|
||||
free(first_ptr->text);
|
||||
|
||||
delete first_ptr;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
// copy the information from the list to the passed-in item
|
||||
if (list) {
|
||||
char *ptr;
|
||||
|
||||
ptr = item->text;
|
||||
*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;
|
||||
}
|
||||
|
||||
@@ -2664,7 +2623,6 @@ 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:
|
||||
@@ -2691,9 +2649,6 @@ 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:
|
||||
@@ -2732,7 +2687,10 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
return 0;
|
||||
|
||||
case OPF_PERSONA:
|
||||
return (Num_personas > 0) ? 1 : 0;
|
||||
if (Num_personas)
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
|
||||
case OPF_POINT:
|
||||
case OPF_WAYPOINT_PATH:
|
||||
@@ -2794,13 +2752,29 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
return 0;
|
||||
|
||||
case OPF_VARIABLE_NAME:
|
||||
return (sexp_variable_count() > 0) ? 1 : 0;
|
||||
if (sexp_variable_count() > 0) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
case OPF_NAV_POINT:
|
||||
return 1;
|
||||
|
||||
case OPF_SSM_CLASS:
|
||||
return (Ssm_info_count > 0) ? 1 : 0;
|
||||
if (Ssm_info_count > 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
case OPF_MISSION_MOOD:
|
||||
return Builtin_moods.empty() ? 0 : 1;
|
||||
if (Builtin_moods.empty())
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
||||
case OPF_TEAM_COLOR:
|
||||
return 1;
|
||||
|
||||
default:
|
||||
Int3();
|
||||
@@ -2871,7 +2845,7 @@ void sexp_tree::merge_operator(int node)
|
||||
}
|
||||
|
||||
// add a data node under operator pointed to by item_index
|
||||
int sexp_tree::add_data(const char *data, int type)
|
||||
int sexp_tree::add_data(char *data, int type)
|
||||
{
|
||||
int node;
|
||||
|
||||
@@ -2886,7 +2860,7 @@ int sexp_tree::add_data(const char *data, int type)
|
||||
}
|
||||
|
||||
// add a (variable) data node under operator pointed to by item_index
|
||||
int sexp_tree::add_variable_data(const char *data, int type)
|
||||
int sexp_tree::add_variable_data(char *data, int type)
|
||||
{
|
||||
int node;
|
||||
|
||||
@@ -2903,7 +2877,7 @@ int sexp_tree::add_variable_data(const 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(const char *op, HTREEITEM h)
|
||||
void sexp_tree::add_operator(char *op, HTREEITEM h)
|
||||
{
|
||||
int node;
|
||||
|
||||
@@ -3115,7 +3089,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, const char *msg, int *bypass)
|
||||
int sexp_tree::node_error(int node, char *msg, int *bypass)
|
||||
{
|
||||
char text[512];
|
||||
|
||||
@@ -3275,8 +3249,7 @@ 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 == 1 && Operators[op].value == OP_COPY_VARIABLE_FROM_INDEX))
|
||||
(arg_num == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING))
|
||||
{
|
||||
// make text_ptr to start - before '('
|
||||
get_variable_name_from_sexp_tree_node_text(tree_nodes[item_index].text, default_variable_text);
|
||||
@@ -3392,7 +3365,7 @@ void sexp_tree::verify_and_fix_arguments(int node)
|
||||
flag--;
|
||||
}
|
||||
|
||||
void sexp_tree::replace_data(const char *data, int type)
|
||||
void sexp_tree::replace_data(char *data, int type)
|
||||
{
|
||||
int node;
|
||||
HTREEITEM h;
|
||||
@@ -3456,7 +3429,7 @@ void sexp_tree::replace_variable_data(int var_idx, int type)
|
||||
|
||||
|
||||
|
||||
void sexp_tree::replace_operator(const char *op)
|
||||
void sexp_tree::replace_operator(char *op)
|
||||
{
|
||||
int node;
|
||||
HTREEITEM h;
|
||||
@@ -3853,7 +3826,7 @@ HTREEITEM sexp_tree::handle(int node)
|
||||
return tree_nodes[node].handle;
|
||||
}
|
||||
|
||||
const char *sexp_tree::help(int code)
|
||||
char *sexp_tree::help(int code)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -3890,7 +3863,7 @@ int sexp_tree::get_type(HTREEITEM h)
|
||||
|
||||
void sexp_tree::update_help(HTREEITEM h)
|
||||
{
|
||||
const char *str;
|
||||
char *str;
|
||||
int i, j, z, c, code, index, sibling_place;
|
||||
CString text;
|
||||
|
||||
@@ -3944,14 +3917,14 @@ void sexp_tree::update_help(HTREEITEM h)
|
||||
char buffer[10240] = {""};
|
||||
|
||||
//Get the help for the current operator
|
||||
const char *helpstr = help(code);
|
||||
char *helpstr = help(code);
|
||||
bool display_number = true;
|
||||
|
||||
//If a help string exists, try to display it
|
||||
if(helpstr != NULL)
|
||||
{
|
||||
char searchstr[32];
|
||||
const char *loc=NULL, *loc2=NULL;
|
||||
char *loc=NULL, *loc2=NULL;
|
||||
|
||||
if(loc == NULL)
|
||||
{
|
||||
@@ -4049,7 +4022,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(const char *text, int *find)
|
||||
int sexp_tree::find_text(char *text, int *find)
|
||||
{
|
||||
uint i;
|
||||
int find_count;
|
||||
@@ -4362,10 +4335,6 @@ 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;
|
||||
@@ -4466,10 +4435,6 @@ 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;
|
||||
@@ -5663,13 +5628,12 @@ sexp_list_item *sexp_tree::get_listing_opf_medal_name()
|
||||
int i;
|
||||
sexp_list_item head;
|
||||
|
||||
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;
|
||||
for (i=0; i<MAX_ASSIGNABLE_MEDALS; i++)
|
||||
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;
|
||||
}
|
||||
@@ -5814,17 +5778,6 @@ 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;
|
||||
@@ -5832,7 +5785,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( stars_get_name_FRED(i, false) );
|
||||
head.add_data( (char*)stars_get_name_FRED(i, false) );
|
||||
}
|
||||
|
||||
return head.next;
|
||||
@@ -5845,7 +5798,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( stars_get_name_FRED(i, true) );
|
||||
head.add_data( (char*)stars_get_name_FRED(i, true) );
|
||||
}
|
||||
|
||||
return head.next;
|
||||
@@ -6021,20 +5974,7 @@ 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
|
||||
|
||||
+20
-25
@@ -97,22 +97,19 @@ class sexp_list_item
|
||||
public:
|
||||
int type;
|
||||
int op;
|
||||
const char *text;
|
||||
char *text;
|
||||
int flags;
|
||||
sexp_list_item *next;
|
||||
|
||||
sexp_list_item() : flags(0), next(NULL) {}
|
||||
|
||||
void set_op(int op_num);
|
||||
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 set_data(char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void set_data_dup(char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void add_op(int op_num);
|
||||
void add_data(const char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void add_data(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();
|
||||
};
|
||||
|
||||
@@ -121,19 +118,19 @@ class sexp_tree : public CTreeCtrl
|
||||
public:
|
||||
sexp_tree();
|
||||
|
||||
int find_text(const char *text, int *find);
|
||||
int find_text(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);
|
||||
const char *help(int code);
|
||||
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, char *text_buf, int op, int i);
|
||||
int get_default_value(sexp_list_item *item, 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);
|
||||
@@ -142,13 +139,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(const char *op, const char *data, int type);
|
||||
void replace_operator(const char *op);
|
||||
void replace_data(const char *data, int type);
|
||||
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_variable_data(int var_idx, int type);
|
||||
void link_modified(int *ptr);
|
||||
void ensure_visible(int node);
|
||||
int node_error(int node, const char *msg, int *bypass);
|
||||
int node_error(int node, char *msg, int *bypass);
|
||||
void expand_branch(HTREEITEM h);
|
||||
void expand_operator(int node);
|
||||
void merge_operator(int node);
|
||||
@@ -159,23 +156,23 @@ public:
|
||||
void right_clicked(int mode = 0);
|
||||
int ctree_size;
|
||||
virtual void build_tree();
|
||||
void set_node(int index, int type, const char *text);
|
||||
void set_node(int index, int type, 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(const char *op = NULL);
|
||||
void clear_tree(char *op = NULL);
|
||||
void reset_handles();
|
||||
int save_tree(int node = -1);
|
||||
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 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 add_sub_tree(int node, HTREEITEM root);
|
||||
int load_sub_tree(int index, bool valid, const char *text);
|
||||
int load_sub_tree(int index, bool valid, char *text);
|
||||
void hilite_item(int node);
|
||||
const char *match_closest_operator(const char *str, int node);
|
||||
char *match_closest_operator(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();
|
||||
@@ -236,7 +233,6 @@ 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();
|
||||
@@ -276,7 +272,6 @@ 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_vector<waypoint>::iterator jj;
|
||||
SCP_list<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_vector<waypoint>::iterator jj;
|
||||
SCP_list<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);
|
||||
wing_bash_ship_name(old_name, Wings[wing].name, i + 1);
|
||||
sprintf(old_name, "%s %d", 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, sel_idx;
|
||||
int idx;
|
||||
CComboBox *ptr = (CComboBox*)GetDlgItem(IDC_SHIP_ALT);
|
||||
if(ptr == NULL){
|
||||
Int3();
|
||||
@@ -2054,17 +2054,21 @@ 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");
|
||||
|
||||
sel_idx += 1;
|
||||
ptr->SetCurSel(sel_idx);
|
||||
// "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);
|
||||
}
|
||||
}
|
||||
|
||||
void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
@@ -2133,7 +2137,7 @@ void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
// callsign stuff
|
||||
void CShipEditorDlg::ship_callsign_init(int base_ship)
|
||||
{
|
||||
int idx, sel_idx;
|
||||
int idx;
|
||||
CComboBox *ptr = (CComboBox*)GetDlgItem(IDC_SHIP_CALLSIGN);
|
||||
if(ptr == NULL){
|
||||
Int3();
|
||||
@@ -2150,17 +2154,21 @@ 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");
|
||||
|
||||
sel_idx += 1;
|
||||
ptr->SetCurSel(sel_idx);
|
||||
// "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);
|
||||
}
|
||||
}
|
||||
|
||||
void CShipEditorDlg::ship_callsign_close(int base_ship)
|
||||
|
||||
@@ -74,9 +74,7 @@ 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
|
||||
@@ -140,8 +138,6 @@ 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()
|
||||
|
||||
@@ -162,8 +158,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, 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;
|
||||
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;
|
||||
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
@@ -211,8 +207,6 @@ 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);
|
||||
@@ -272,8 +266,6 @@ 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
|
||||
@@ -347,8 +339,6 @@ 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);
|
||||
@@ -966,22 +956,6 @@ 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) )
|
||||
@@ -1046,23 +1020,6 @@ 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);
|
||||
@@ -1405,6 +1362,8 @@ void ship_flags_dlg::OnHideShipName()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ship_flags_dlg::OnDisableETS()
|
||||
{
|
||||
if (m_disable_ets.GetCheck() == 1) {
|
||||
@@ -1422,21 +1381,3 @@ 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,10 +65,7 @@ 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;
|
||||
@@ -126,8 +123,6 @@ 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, z, not_found, temp_bmp, temp_frames, temp_fps;
|
||||
int i, k, write_index, z, not_found, temp_bmp, temp_frames, temp_fps;
|
||||
CString missing_files, message;
|
||||
char buf[10];
|
||||
|
||||
@@ -119,40 +119,43 @@ void CShipTexturesDlg::OnOK()
|
||||
// re-sort according to old
|
||||
sort_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)
|
||||
// overwrite old stuff
|
||||
k = 0;
|
||||
write_index = 0;
|
||||
while (k<(MAX_SHIPS * MAX_REPLACEMENT_TEXTURES))
|
||||
{
|
||||
if (!stricmp(ii->ship_name, Ships[self_ship].ship_name))
|
||||
//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))
|
||||
{
|
||||
do {
|
||||
end--;
|
||||
} while (end != ii && !stricmp(end->ship_name, Ships[self_ship].ship_name));
|
||||
if (end == ii)
|
||||
break;
|
||||
texture_set(&(*ii), &(*end));
|
||||
// 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++;
|
||||
}
|
||||
|
||||
k++;
|
||||
}
|
||||
Fred_num_texture_replacements = write_index;
|
||||
|
||||
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
|
||||
// finally, assign duplicate textures to Fred array
|
||||
for (i=0; i<texture_count; i++)
|
||||
{
|
||||
// make sure there is an entry
|
||||
if (strlen(new_texture_name[i]))
|
||||
{
|
||||
texture_replace tr;
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
// increment
|
||||
Fred_num_texture_replacements++;
|
||||
}
|
||||
}
|
||||
} // skipped here if nothing modified
|
||||
@@ -219,41 +222,42 @@ BOOL CShipTexturesDlg::OnInitDialog()
|
||||
// make old texture lowercase
|
||||
strlwr(texture_file);
|
||||
|
||||
// add it to the field
|
||||
// now add it to the box
|
||||
z = box->AddString(texture_file);
|
||||
|
||||
// and add it to the field as well
|
||||
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
|
||||
for (SCP_vector<texture_replace>::iterator ii = Fred_texture_replacements.begin(); ii != Fred_texture_replacements.end(); ++ii)
|
||||
k=0;
|
||||
while (k < Fred_num_texture_replacements)
|
||||
{
|
||||
if (!stricmp(Ships[self_ship].ship_name, ii->ship_name))
|
||||
if (!stricmp(Ships[self_ship].ship_name, Fred_texture_replacements[k].ship_name))
|
||||
{
|
||||
// look for corresponding old texture
|
||||
for (i=0; i<texture_count; i++)
|
||||
{
|
||||
// if match
|
||||
if (!stricmp(old_texture_name[i], ii->old_texture))
|
||||
if (!stricmp(old_texture_name[i], Fred_texture_replacements[k].old_texture))
|
||||
{
|
||||
// assign new texture
|
||||
strcpy_s(new_texture_name[i], ii->new_texture);
|
||||
strcpy_s(new_texture_name[i], Fred_texture_replacements[k].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,7 +52,8 @@ 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;
|
||||
SCP_vector<SCP_string> tbl_file_names;
|
||||
char tbl_file_arr[MAX_TBL_PARTS][MAX_FILENAME_LEN];
|
||||
char *tbl_file_names[MAX_TBL_PARTS];
|
||||
CFILE *fp;
|
||||
|
||||
if (ship_class < 0)
|
||||
@@ -111,12 +112,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(tbl_file_names, CF_TYPE_TABLES, NOX("*-shp.tbm"), CF_SORT_REVERSE);
|
||||
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);
|
||||
|
||||
for (n = 0; n < num_files; n++){
|
||||
tbl_file_names[n] += ".tbm";
|
||||
strcat(tbl_file_names[n], ".tbm");
|
||||
|
||||
fp = cfopen(tbl_file_names[n].c_str(), "r");
|
||||
fp = cfopen(tbl_file_names[n], "r");
|
||||
Assert(fp);
|
||||
|
||||
memset( line, 0, sizeof(line) );
|
||||
@@ -159,7 +160,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].c_str());
|
||||
snprintf(file_text, sizeof(file_text)-1, "-- %s -------------------------------\r\n", tbl_file_names[n]);
|
||||
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)-1, "File name generation complete. Modified %u messages.", modified_filenames);
|
||||
snprintf(message, sizeof(message), "File name generation complete. Modified %u messages.", modified_filenames);
|
||||
MessageBox(message, "Woohoo!");
|
||||
}
|
||||
|
||||
|
||||
+107
-2
@@ -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) {
|
||||
wing_bash_ship_name(buf, Wings[wing].name, i + 1);
|
||||
sprintf(buf, "%s %d", 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);
|
||||
}
|
||||
|
||||
wing_bash_ship_name(msg, Wings[wing].name, i + 1);
|
||||
sprintf(msg, "%s %d", Wings[wing].name, i + 1);
|
||||
rename_ship(ship, msg);
|
||||
|
||||
Wings[wing].ship_index[i] = ship;
|
||||
@@ -512,3 +512,108 @@ 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)) {
|
||||
wing_bash_ship_name(buf, str, i + 1);
|
||||
sprintf(buf, "%s %d", str, i + 1);
|
||||
rename_ship(Wings[cur_wing].ship_index[i], buf);
|
||||
}
|
||||
}
|
||||
|
||||
+420
-558
File diff suppressed because it is too large.
Load diff
@@ -36,8 +36,6 @@ 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,2,11329
|
||||
PRODUCTVERSION 3,7,2,11329
|
||||
FILEVERSION 3,7,0,9755
|
||||
PRODUCTVERSION 3,7,0,9755
|
||||
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.2.11329"
|
||||
VALUE "FileVersion", "3.7.0.9755"
|
||||
VALUE "InternalName", "FreeSpace 2 Open"
|
||||
VALUE "LegalCopyright", "Copyright © 1998"
|
||||
VALUE "OriginalFilename", "fs2.exe"
|
||||
VALUE "ProductName", "FreeSpace 2 Open"
|
||||
VALUE "ProductVersion", "3.7.2"
|
||||
VALUE "ProductVersion", "3.7.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <cstdio>
|
||||
@@ -52,7 +51,7 @@
|
||||
|
||||
|
||||
extern int Multi_debrief_stats_accept_code;
|
||||
extern void HUD_printf(const char *format, ...);
|
||||
extern void HUD_printf(char *format, ...);
|
||||
extern int game_hacked_data();
|
||||
|
||||
|
||||
@@ -123,19 +122,8 @@ void fs2netd_options_config_init()
|
||||
}
|
||||
|
||||
if ( !strlen(Multi_options_g.tracker_port) ) {
|
||||
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 );
|
||||
}
|
||||
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);
|
||||
|
||||
@@ -737,7 +725,7 @@ static void fs2netd_handle_messages()
|
||||
|
||||
case PCKT_SLIST_REPLY: {
|
||||
int numServers = 0;
|
||||
int svr_flags __attribute__((__unused__)); // gcc [-Wunused-but-set-variable] doesn't like MACROs
|
||||
int svr_flags;
|
||||
ushort svr_port;
|
||||
char svr_ip[16];
|
||||
active_game ag;
|
||||
@@ -1551,7 +1539,7 @@ int fs2netd_update_valid_tables()
|
||||
return hacked;
|
||||
}
|
||||
|
||||
void fs2netd_add_table_validation(const char *tblname)
|
||||
void fs2netd_add_table_validation(char *tblname)
|
||||
{
|
||||
uint chksum = 0;
|
||||
|
||||
@@ -1572,7 +1560,7 @@ void fs2netd_add_table_validation(const char *tblname)
|
||||
|
||||
crc_valid_status tbl_crc;
|
||||
|
||||
strcpy_s(tbl_crc.name, tblname);
|
||||
strncpy(tbl_crc.name, tblname, NAME_LENGTH);
|
||||
tbl_crc.crc32 = chksum;
|
||||
tbl_crc.valid = 0;
|
||||
|
||||
@@ -1595,6 +1583,9 @@ 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;
|
||||
@@ -1621,7 +1612,7 @@ int fs2netd_get_pilot_info(const char *callsign, player *out_plr, bool first_cal
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
out_plr->assign(&new_plr);
|
||||
memcpy( out_plr, &new_plr, sizeof(player) );
|
||||
In_process = false;
|
||||
Local_timeout = -1;
|
||||
}
|
||||
@@ -1646,7 +1637,7 @@ void fs2netd_close()
|
||||
FS2NetD_ban_list.clear();
|
||||
}
|
||||
|
||||
void fs2netd_update_game_count(const char *chan_name)
|
||||
void fs2netd_update_game_count(char *chan_name)
|
||||
{
|
||||
if ( !Logged_in ) {
|
||||
return;
|
||||
@@ -1662,6 +1653,7 @@ void fs2netd_update_game_count(const 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 };
|
||||
@@ -1684,7 +1676,7 @@ void fs2netd_spew_table_checksums(char *outfile)
|
||||
p = Cmdline_spew_table_crcs;
|
||||
|
||||
while (*p && (offset < sizeof(description))) {
|
||||
if (*p == '"' && offset < sizeof(description)-1) {
|
||||
if (*p == '"') {
|
||||
description[offset++] = '"';
|
||||
description[offset++] = '"';
|
||||
} else {
|
||||
@@ -1697,13 +1689,15 @@ 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 == '"' && offset < sizeof(filename)-1) {
|
||||
if (*p == '"') {
|
||||
filename[offset++] = '"';
|
||||
filename[offset++] = '"';
|
||||
} else {
|
||||
@@ -1713,11 +1707,7 @@ void fs2netd_spew_table_checksums(char *outfile)
|
||||
p++;
|
||||
}
|
||||
|
||||
if (offset < sizeof(filename)) {
|
||||
filename[offset] = '\0';
|
||||
} else {
|
||||
filename[sizeof(filename)-1] = '\0';
|
||||
}
|
||||
filename[offset] = '\0';
|
||||
|
||||
fprintf(out, "\"%s\",%u,\"%s\"\r\n", filename, tvs->crc32, description);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "network/multi.h"
|
||||
|
||||
struct net_addr;
|
||||
class player;
|
||||
struct 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(const char *tblname);
|
||||
void fs2netd_add_table_validation(char *tblname);
|
||||
|
||||
void fs2netd_update_game_count(const char *chan_name);
|
||||
void fs2netd_update_game_count(char *chan_name);
|
||||
|
||||
#endif // _FS2NETD_CLIENT_H
|
||||
+11
-11
@@ -131,6 +131,7 @@ 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++) {
|
||||
@@ -140,11 +141,10 @@ int FS2NetD_SendPlayerData(const char *player_name, player *pl, bool do_send)
|
||||
}
|
||||
}
|
||||
|
||||
Assert( (Num_medals >= 0) && (Num_medals < USHRT_MAX) );
|
||||
PXO_ADD_USHORT( (ushort)Num_medals );
|
||||
PXO_ADD_USHORT( (ushort)MAX_MEDALS );
|
||||
|
||||
for (i = 0; i < Num_medals; i++) {
|
||||
PXO_ADD_INT( pl->stats.medal_counts[i] );
|
||||
for (i = 0; i < MAX_MEDALS; i++) {
|
||||
PXO_ADD_INT( pl->stats.medals[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 < Num_medals) && (idx < num_medals); idx++) {
|
||||
PXO_GET_INT( pl->stats.medal_counts[idx] );
|
||||
for (idx = 0; (idx < MAX_MEDALS) && (idx < num_medals); idx++) {
|
||||
PXO_GET_INT( pl->stats.medals[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(const char *chan_name)
|
||||
void FS2NetD_GameCountUpdate(char *chan_name)
|
||||
{
|
||||
int buffer_size;
|
||||
char buffer[MAX_PATH+BASE_PACKET_SIZE+10];
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
class player;
|
||||
struct player;
|
||||
struct netgame_info;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ void FS2NetD_SendServerDisconnect();
|
||||
|
||||
void FS2NetD_RequestServerList();
|
||||
|
||||
void FS2NetD_GameCountUpdate(const char *chan_name);
|
||||
void FS2NetD_GameCountUpdate(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[254]; // 253 is max domain name length: http://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax
|
||||
char host_str[5];
|
||||
#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 :)
|
||||
|
||||
strcpy_s( host_str, host );
|
||||
strncpy( host_str, host, sizeof(host_str) );
|
||||
|
||||
// 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)
|
||||
|
||||
+398
-333
File diff suppressed because it is too large.
Load diff
Loaded 100 of 714 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user