Compare commits

..
Author SHA1 Message Date
penguin af3b97aae5 Change version display 2002-08-04 05:13:00 +00:00
penguin c3c0b0e1f4 Display fs2_open version instead of "Freespace 2" 2002-08-04 05:12:42 +00:00
penguin 9d5863bc76 Change version display location 2002-08-04 05:12:10 +00:00
penguin 4b2d436b04 Update version number to 3.1 2002-08-04 05:11:36 +00:00
penguin 404195d389 Don't write version to registry; change way version string is formatted 2002-08-04 05:11:05 +00:00
randomtiger df29aad213 Fixed Geforce 4 bug that caused font and hall video distortion.
Very small change in 'gr_d3d_aabitmap_ex_internal'

Tested and works on the following systems

OUTSIDER Voodoo 3 win98
OUTSIDER Geforce 2 win2000
Me Geforce 4 PNY 4600 XP
JBX-Phoenix Geforce 4 PNY XP
Mehrunes GeForce 3 XP
WMCoolmon nVidia TNT2 M64 win2000
Orange GeForce 4 4200 XP
ShadowWolf_IH Monster2 win98
ShadowWolf_IH voodoo 2 win98
2002-08-03 19:42:17 +00:00
wmcoolmon 026601e350 Fixed Win32 debug configuration 2002-08-03 18:35:21 +00:00
wmcoolmon 05a48addc6 Sync with makefile 1.4 2002-08-03 17:42:40 +00:00
penguin a1e9e62b6e updated 2002-08-01 04:04:01 +00:00
penguin 64ea61c93a The big include file move 2002-08-01 02:00:46 +00:00
penguin a0bbf8fd54 The big include file move 2002-08-01 01:41:11 +00:00
wmcoolmon 15e9872bb5 Fixed a bug I added in ship_do_rearm_frame 2002-07-30 18:11:25 +00:00
wmcoolmon a1f592ffef Modified to add hull repair capabilities and toggling of them via a mission flag, MISSION_FLAG_SUPPORT_REPAIRS_HULL 2002-07-30 17:57:40 +00:00
wmcoolmon 07de43ffc4 Added mission flag "MISSION_FLAG_SUPPORT_REPAIRS_HULL" for toggling Support Ship hull repair on and off 2002-07-30 17:35:22 +00:00
unknownplayer 522fa4c906 Started work on DX8.1 implementation. Updated the project files to encompass
the new files. Disable the compiler tag to use old DX code (THERE IS NO
NEW CODE YET!)
2002-07-30 14:29:15 +00:00
penguin 7611e0a2d2 Added Network/fs2ox.cpp 2002-07-29 22:24:57 +00:00
penguin 9290659edf First attempt at "fs2_open exchange" (PXO substitute) screen 2002-07-29 22:24:26 +00:00
penguin 3a88c2f9e3 We finally have a ChangeLog 2002-07-29 22:14:48 +00:00
penguin a732686bf6 Moved extern declaration of ssm_create outside of block (it wouldn't compile w/ gcc) 2002-07-29 20:48:51 +00:00
penguin 2ede27a557 added #ifdef _WIN32 around windows-specific system headers 2002-07-29 20:12:31 +00:00
penguin 8300b018f0 removed bogus #include windows.h 2002-07-29 20:12:02 +00:00
penguin 93aed25251 added #ifdef _WIN32 around windows-specific system headers 2002-07-29 19:52:48 +00:00
penguin 591563118c added #ifdef _WIN32 around windows-specific system headers 2002-07-29 19:37:21 +00:00
penguin b59b5dd5d8 added #ifdef _WIN32 around windows-specific system headers 2002-07-29 19:17:21 +00:00
penguin bb0bde6409 added #ifdef _WIN32 around windows-specific system headers 2002-07-29 19:04:48 +00:00
DTP 66a392ddae Forgot to Bump MAX_MODEL_SUBSYSTEMS from 128 to 200 2002-07-29 08:31:52 +00:00
DTP 8bfc9fa709 BUMPED MAX_POLYGON_MODELS TO 198 , MAX_SHIP_TYPES - 2 = 198 2002-07-29 08:28:00 +00:00
DTP ccbdeeff67 Bumped all MAX_SHIPS, and SHIP_LIMIT to 400.(let the mission designers decide what is good, and what is bad 2002-07-29 08:24:42 +00:00
DTP 0f1176adaf Bumped MAX_SHIP_SUBOBJECTS to 2100(2100 /(average fighter has 7 subsystems) = 400 fighters 2002-07-29 08:22:42 +00:00
DTP b75fce3d5c Bumped MAX_SUBSYS_LIST from 32 to 200 2002-07-29 08:19:41 +00:00
DTP ab68ad4855 -almission(autoload mission) commandline arguement handling implemented 2002-07-29 08:05:20 +00:00
DTP 426cf0b969 FIX; Startgame arguement dont go ahead when a singleplayer pilot is selected 2002-07-29 07:56:10 +00:00
DTP 2d1f7ba50f added -almission commandline arguement, will autoload mission i.e fs2_open.exe -almission kickass will autoload kickass.fs2 which should be a multiplayer mission. 2002-07-29 06:35:15 +00:00
DTP 69145e65f1 FIX -stargame commandline arguement will now let you quit, a thing not possible before when using the startgame arguement 2002-07-28 15:07:43 +00:00
penguin 3dcb4b380a Testing commit as penguin 2002-07-26 18:02:33 +00:00
drevil 8e996fdf67 Updated password file 2002-07-26 17:59:31 +00:00
penguin 7367d8a31f renamed 'big' and 'small' (conflict w/ MS include file) 2002-07-26 16:17:46 +00:00
penguin d5fcfc773c fixed bug where winsock.h wasn't defined 2002-07-26 16:12:05 +00:00
wmcoolmon 5cdd3a676d Added Bobboau's beam tiling code 2002-07-26 03:11:24 +00:00
wmcoolmon fd95da4c0a Added Bobboau's fighter-beam code. 2002-07-25 04:50:48 +00:00
penguin 1aa613e0f5 Added ifndef NO_STANDALONE 2002-07-22 01:39:24 +00:00
penguin 7d91a35878 Stub defines for NO_SOUND 2002-07-22 01:37:24 +00:00
penguin fa2c566b3f Linux port -- added NO_STANDALONE ifdefs 2002-07-22 01:22:26 +00:00
penguin f2b7f9718a Made more compatible w/ Win32; defines for NO_SOUND, NO_JOYSTICK, NO_NETWORK 2002-07-22 01:14:09 +00:00
penguin 08c0bd3aee Moved the dummy "sound" definitions to main program (freespace.cpp) 2002-07-22 01:10:10 +00:00
penguin 3a39133e04 More defines for winsock compatibility 2002-07-22 01:06:04 +00:00
penguin c3ec5825a4 took out GAME_CD_CHECK define 2002-07-22 01:04:37 +00:00
DTP baddd6703d Bumped Max Shield Icons to 80 2002-07-20 23:51:59 +00:00
DTP 0c3733d2cd Fixed multiplayer music. succes music on all Primary goals complete, fail music
if otherwise
2002-07-20 23:50:53 +00:00
DTP c536d49afd Fixed Secondary bank bug, where next valid secondary bank inherits current
valid banks FULL fire delay
2002-07-20 23:49:46 +00:00
DTP b031aee73a bumped MAX_MISSION_TEXT to 1000000 in code/parse/parselo.h 2002-07-20 19:21:13 +00:00
penguin c480e2c944 Fixed bug (potential access of unitialized pointer) in hud_config_render_gauges() -- thanks to DTP for finding it! 2002-07-18 20:07:49 +00:00
unknownplayer c7cd913df4 no message 2002-07-18 14:36:53 +00:00
unknownplayer 58a465e805 Revised AI primary selection code again to be more intelligent. 2002-07-18 09:55:26 +00:00
unknownplayer cf08ff0cd5 Rewrote my original algorithm to search by proportional hull damage.
Does the same thing a little better.
2002-07-18 05:38:28 +00:00
unknownplayer c839e8168a Fixed AI problems with using the maxim on fighters. 2002-07-18 03:27:38 +00:00
unknownplayer 3257777c18 Added some commentry to the low detail shield function. 2002-07-18 03:26:35 +00:00
unknownplayer 1028e14398 no message 2002-07-18 03:25:10 +00:00
unknownplayer b733679875 Altered project files to properly build debug info. Should save you all some time. 2002-07-17 23:59:56 +00:00
unknownplayer 723cbd5938 Minor commenting added to two functions. 2002-07-17 23:58:46 +00:00
wmcoolmon 0e48ea11ac Added SSM code for Tag C from Bobboau. Note that strings.tbl may need to be updated. 2002-07-17 20:04:00 +00:00
unknownplayer 57ab92645c Added a custom build step to copy to c:\games\freespace2\fs2_open.exe
when you build.
2002-07-17 12:52:01 +00:00
unknownplayer 2431f5db2c Updated to enable compilation under MSVC++ - all changes are marked
with my name ##UnknownPlayer##
2002-07-16 14:39:16 +00:00
unknownplayer 34d960638a This is the code project file. Use the workspace file I included to get at this. 2002-07-16 14:37:51 +00:00
unknownplayer 3bb26b10a3 This is the workspace for freespace2.dsp - it contains everything needed to
compile fs2_open.exe
2002-07-16 14:37:09 +00:00
unknownplayer 3cdc511b2d This is the project file to compile fs2_open. It's a real project file - use the
workspace though
2002-07-16 14:36:30 +00:00
penguin 4543d0c80c Changed so that debug make debug and release makes release :) 2002-07-16 01:15:59 +00:00
penguin 2a740ad2c8 Commented out "fs2_open.dep" stuff 2002-07-16 01:15:15 +00:00
inquisitor 7187da0233 Visual Studio files
compiles fs2_open.exe - 0 error(s), 7 warning(s)
2002-07-15 22:36:08 +00:00
wmcoolmon ab43e4d987 Added support for toggling ship trails 2002-07-15 02:11:00 +00:00
wmcoolmon 8056476db1 Added initial code for "ship-lights-on" and "ship-lights-off" SEXPs 2002-07-13 09:16:18 +00:00
penguin 4b471d6045 Added flags2 (ran out of bits in flags!) to ship struct; bit 0 will be used
to toggle Bobboau's lights.
2002-07-12 16:59:04 +00:00
penguin 8b19d7c8eb Removed dummy include file 2002-07-12 02:56:07 +00:00
penguin 90c6679f03 Fixed endian-ness of new "GLOW" IDs 2002-07-12 02:44:18 +00:00
wmcoolmon 4c73e5fe20 Added Bobboau's glow code; all comments include "-Bobboau" 2002-07-10 18:42:14 +00:00
penguin dd3a3138a7 Back-port to MSVC 2002-07-07 19:56:00 +00:00
penguin 9e8a091172 Makefile for Microsoft Visual C++ 2002-07-07 19:49:42 +00:00
drevil 5d72560a30 Adding mysterial and penguin to CVS's admin files 2002-06-08 19:21:16 +00:00
drevil 2a9c65bd3f Changing my password 2002-06-08 19:10:16 +00:00
drevil 6b4cca55be Changing my password 2002-06-08 19:04:53 +00:00
penguin c18139e73f Added machine-independent version of MulDiv (in case we don't know
the processor type)
2002-06-04 06:38:21 +00:00
penguin be6ee814c2 Minor changes 2002-06-03 05:03:45 +00:00
penguin ea6130e542 Initial revision 2002-06-03 04:34:38 +00:00
penguin 48a566a2d5 Warpcore CVS sync 2002-06-03 04:10:40 +00:00
penguin dab5b293d4 Dummy include file 2002-06-03 04:08:13 +00:00
penguin 2a2cd3c873 Warpcore CVS sync 2002-06-03 03:55:40 +00:00
penguin 51ffb56b16 Volition sources -- warpcore CVS import 2002-06-03 03:26:03 +00:00
fs2source 211e7a4284 Commited initial passwd/writers files,
inquisitor
drevil
anonymous

added

anonymous has no write access
2002-06-02 00:39:17 +00:00
fs2source 24643586f1 initial checkin 2002-06-01 21:21:20 +00:00
fs2source 08986cb47e initial checkin 2002-06-01 21:21:19 +00:00
(no author) c3d878b1b3 New repository initialized by cvs2svn. 2002-06-01 21:21:19 +00:00
552 changed files with 421634 additions and 413 deletions

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
# [<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'
+15
View File
@@ -0,0 +1,15 @@
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list
# of files to check. A non-zero exit of the filter program will
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
+14
View File
@@ -0,0 +1,14 @@
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no
# Put CVS lock files in this directory rather than directly in the repository.
#LockDir=/var/lock/cvs
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
# level of the new working directory when using the `cvs checkout'
# command.
#TopLevelAdmin=no
# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
# history file, or a subset as needed (ie `TMAR' logs all write operations)
#LogHistory=TOFEWGCMAR
+23
View File
@@ -0,0 +1,23 @@
# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
# -k expansion mode value: b, o, kkv, &c
#
# and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'
+21
View File
@@ -0,0 +1,21 @@
# The "editinfo" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.
+26
View File
@@ -0,0 +1,26 @@
# The "loginfo" file controls where "cvs commit" log information
# is sent. The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT. If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter. The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators. The format
# characters are:
#
# s = file name
# V = old version number (pre-checkin)
# v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
+26
View File
@@ -0,0 +1,26 @@
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.
+12
View File
@@ -0,0 +1,12 @@
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT. If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"
+9
View File
@@ -0,0 +1,9 @@
drevil:f76FWdDTUBG5c:fs2source
mysterial:f7nJUwoIhmSrg:fs2source
wmcoolmon:f7JRB.js9Q1sE:fs2source
inquisitor:f7BVkOvwjDlWk:fs2source
penguin:Jh.dOjaiO2jHk:fs2source
DTP:f7M92Z/6/uep.:fs2source
unknownplayer:f79BgAn.IzJs6:fs2source
phreak:f7WQyGiT/jzlM:fs2source
anonymous:oIKtWP1q6GDt6:fs2source
+13
View File
@@ -0,0 +1,13 @@
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT. For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
+20
View File
@@ -0,0 +1,20 @@
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4-> file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
+21
View File
@@ -0,0 +1,21 @@
# The "verifymsg" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.
+4
View File
@@ -0,0 +1,4 @@
drevil
inquisitor
mysterial
penguin
+148
View File
@@ -0,0 +1,148 @@
# Microsoft Developer Studio Project File - Name="Freespace2" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Freespace2 - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Freespace2.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Freespace2.mak" CFG="Freespace2 - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Freespace2 - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Freespace2 - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/Freespace2", RHWBAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Freespace2 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release\Profile"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /Ot /Ow /Og /Oi /Oy /I "code" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /U "_DEBUG" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib code.lib /nologo /subsystem:windows /map /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcd.lib" /out:"c:\games\freespace2\fs2_open.exe" /libpath:"release"
!ELSEIF "$(CFG)" == "Freespace2 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug\Profile"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /G5 /MTd /W4 /Gm /Gi /GX /ZI /Od /I "." /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "NO_CD_CHECK" /D "USE_DX81" /U "NDEBUG" /Fr /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo /o"debug/profile/Freespace2.bsc" "./debug/profile/*.sbr"
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib code.lib /nologo /subsystem:windows /debug /debugtype:both /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcd.lib" /out:"Debug/fs2_open.exe" /libpath:"debug"
# SUBTRACT LINK32 /pdb:none /incremental:no /map
# Begin Custom Build - Copying $(InputPath) to c:\games\freespace2
InputPath=.\Debug\fs2_open.exe
SOURCE="$(InputPath)"
"c:\games\freespace2\fs2_open.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) c:\games\freespace2
# End Custom Build
!ENDIF
# Begin Target
# Name "Freespace2 - Win32 Release"
# Name "Freespace2 - Win32 Debug"
# Begin Source File
SOURCE=.\code\FREESPACE2\app_icon.ico
# End Source File
# Begin Source File
SOURCE=.\code\FREESPACE2\FreeSpace.cpp
# End Source File
# Begin Source File
SOURCE=.\code\FREESPACE2\FreeSpace.h
# End Source File
# Begin Source File
SOURCE=.\code\FREESPACE2\FreeSpace.rc
# End Source File
# Begin Source File
SOURCE=.\code\FREESPACE2\FreespaceResource.h
# End Source File
# Begin Source File
SOURCE=.\code\freespace2\goal_com.bmp
# End Source File
# Begin Source File
SOURCE=.\code\freespace2\goal_fail.bmp
# End Source File
# Begin Source File
SOURCE=.\code\freespace2\goal_inc.bmp
# End Source File
# Begin Source File
SOURCE=.\code\freespace2\goal_none.bmp
# End Source File
# Begin Source File
SOURCE=.\code\freespace2\goal_ord.bmp
# End Source File
# Begin Source File
SOURCE=.\code\FREESPACE2\LevelPaging.cpp
# End Source File
# Begin Source File
SOURCE=.\code\FREESPACE2\LevelPaging.h
# End Source File
# End Target
# End Project
+44
View File
@@ -0,0 +1,44 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Freespace2"=".\Freespace2.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name code
End Project Dependency
}}}
###############################################################################
Project: "code"=".\code\code.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
+81
View File
@@ -0,0 +1,81 @@
README for fs2_open, Release 0.1
WARNINGS:
========
This is very much an pre-alpha build. Don't expect too much from it!
In particular, do not run this in the same directory as existing pilot
files or anything else that you don't want to get destroyed...
I have tried to modify as little code as possible to keep the existing
Windows code from breaking, but I have not verified that this code
will still work on Windows. Some changes may be necessary.
There are occasional crashes and segfaults from time to time.
All of this was tested on my system only. I don't know if any
assumptions about my hardware have crept into the code. I guess it
goes without saying that this will only work on x86-based Linux
systems :-)
STATUS:
=======
Most 2D graphics appear to be working, although very slowly.
Improving the performance of the 2D graphic system is a high priority.
3D graphics are in a very primitive state right now. No texturing is
done, so all objects (ships, lasers, explosions, etc.) look "ghostly."
Nebula missions do not work at all.
Sound, joystick, and network are all disabled.
REQUIREMENTS:
=============
The only "non-standard" package that you will need (as far as I can
tell) is the SDL library, available at http://www.libsdl.org I think
SDL requires XFree86 release 4 or higher.
INSTALLING:
===========
There is no configure script, no options, etc. -- just a Makefile. It
is likely that you will need to adjust it to match your configuration,
in particular the location of the SDL files.
If everything is right, you should be able to run 'make' from the
fs2_open/code directory and create an 'fs2' executable.
RUNNING:
========
The fs2 executable should be copied (or symlinked) to the same
directory as the *.VP files. All the *.VP files that you need should
be here -- the code isn't smart enough to look in your CD for command
brief ANIs, etc.
It only runs in windowed mode, no full screen.
I have never run it in high-resolution mode (1024x768), so all bets
are off if you try it.
There seems to be a bug in some of the 'glob' routines that scan for
files in the 'data' directory, so you will have better results if you:
1. Keep everything in the *.VP file (i.e., no mods)
2. Only have one player file
I recommend that background graphics be turned off via the "Options"
screen or it will look very odd. Your in-game framerate will be
significantly higher if you turn off (or set to 'popup') as many HUD
gauges as possible.
Due to the painful slowness of the 2D UI, you might need to hold the
mouse button down a little longer to get buttons to activate.
===
Mike Harris (HLP penguin)
02 June 2002
File diff suppressed because it is too large. Load diff
+701
View File
@@ -0,0 +1,701 @@
TARGET = fs2
ifeq ($(USE_SOUND), 1)
SOUND_DEF=
SOUND_OBJS= \
gamesnd/eventmusic.o \
gamesnd/gamesnd.o \
object/objectsnd.o \
sound/acm.o \
sound/audiostr.o \
sound/ds.o \
sound/ds3d.o \
sound/dscap.o \
sound/midifile.o \
sound/rbaudio.o \
sound/rtvoice.o \
sound/sound.o \
sound/winmidi.o \
sound/winmidi_base.o \
vcodec/codec1.o
else
SOUND_DEF=-DNO_SOUND
SOUND_OBJS=
endif # USE_SOUND
ifeq ($(USE_JOYSTICK), 1)
JOYSTICK_DEF=
JOYSTICK_OBJS= \
io/joy.o \
io/joy_ff.o \
io/swff_lib.o
else
JOYSTICK_DEF=-DNO_JOYSTICK
JOYSTICK_OBJS=
endif # USE_JOYSTICK
ifeq ($(USE_NETWORK), 1)
# no support for standalone server yet... (UI is Win32 specific)
NETWORK_DEF=-DNO_STANDALONE
NETWORK_OBJS= \
hud/hudobserver.o \
network/multi.o \
network/multimsgs.o \
network/multiteamselect.o \
network/multiui.o \
network/multiutil.o \
network/multi_campaign.o \
network/multi_data.o \
network/multi_dogfight.o \
network/multi_endgame.o \
network/multi_ingame.o \
network/multi_kick.o \
network/multi_log.o \
network/multi_obj.o \
network/multi_observer.o \
network/multi_options.o \
network/multi_pause.o \
network/multi_pinfo.o \
network/multi_ping.o \
network/multi_pmsg.o \
network/multi_rate.o \
network/multi_respawn.o \
network/multi_team.o \
network/multi_voice.o \
network/multi_xfer.o \
network/psnet.o \
network/psnet2.o \
menuui/optionsmenumulti.o \
missionui/chatbox.o
#
# Network/stand_gui.o
#
else
NETWORK_DEF=-DNO_NETWORK -DNO_STANDALONE
NETWORK_OBJS=
endif # USE_NETWORK
ifeq ($(USE_OPENGL), 0)
OPENGL_DEF=
else
OPENGL_DEF=-DUSE_OPENGL
endif # USE_OPENGL
LDFLAGS = -g
LDLIBS = -L/usr/X11R6/lib -lSDL -lGL -lGLU -lpthread
CXXFLAGS = \
-g \
-I/usr/local/include/SDL \
-I. -Iwindows_stub \
-fno-exceptions \
-IWeapon -ILocalization -INebula -IDemo -IInetfile -IExceptionHandler \
-D_DEBUG -DNO_CD_CHECK -UNDEBUG \
-DNO_DIRECT3D $(SOUND_DEF) $(JOYSTICK_DEF) $(NETWORK_DEF) $(OPENGL_DEF)
ANIM_OBJFILES = \
anim/animplay.o \
anim/packunpack.o
ASTEROID_OBJFILES = \
asteroid/asteroid.o
BMPMAN_OBJFILES = \
bmpman/bmpman.o
CFILE_OBJFILES = \
cfile/cfile.o \
cfile/cfilearchive.o \
cfile/cfilelist.o \
cfile/cfilesystem.o
CMDLINE_OBJFILES = \
cmdline/cmdline.o
CMEASURE_OBJFILES = \
cmeasure/cmeasure.o
CONTROLCONFIG_OBJFILES = \
controlconfig/controlsconfig.o \
controlconfig/controlsconfigcommon.o
CUTSCENE_OBJFILES = \
cutscene/cutscenes.o
DEBRIS_OBJFILES = \
debris/debris.o
DEBUGCONSOLE_OBJFILES = \
debugconsole/console.o
DEMO_OBJFILES = \
demo/demo.o
EXCEPTIONHANDLER_OBJFILES = \
exceptionhandler/exceptionhandler.o
FIREBALL_OBJFILES = \
fireball/fireballs.o \
fireball/warpineffect.o
GAMEHELP_OBJFILES = \
gamehelp/contexthelp.o \
gamehelp/gameplayhelp.o
GAMESEQUENCE_OBJFILES = \
gamesequence/gamesequence.o
# gamesnd/eventmusic.o
# gamesnd/gamesnd.o
GAMESND_OBJFILES =
# glide/glide.o
GLIDE_OBJFILES =
# globalincs/windebug.o
GLOBALINCS_OBJFILES = \
globalincs/alphacolors.o \
globalincs/crypt.o \
globalincs/systemvars.o \
globalincs/version.o
# graphics/grd3d.o
# graphics/grd3drender.o
# graphics/grd3dtexture.o
# graphics/grdirectdraw.o
# graphics/grglide.o
# graphics/grglidetexture.o
# graphics/grsoft.o
# graphics/scaler.o
# graphics/tmapgenericscans.o
# graphics/tmapscantiled128x128.o
# graphics/tmapscantiled16x16.o
# graphics/tmapscantiled256x256.o
# graphics/tmapscantiled32x32.o
# graphics/tmapscantiled64x64.o
# graphics/tmapscanline.o
# graphics/tmapper.o
GRAPHICS_OBJFILES = \
graphics/2d.o \
graphics/aaline.o \
graphics/bitblt.o \
graphics/circle.o \
graphics/colors.o \
graphics/font.o \
graphics/gradient.o \
graphics/gropengl.o \
graphics/grzbuffer.o \
graphics/line.o \
graphics/pixel.o \
graphics/rect.o \
graphics/shade.o
# hud/hudobserver.o
HUD_OBJFILES = \
hud/hud.o \
hud/hudartillery.o \
hud/hudbrackets.o \
hud/hudconfig.o \
hud/hudescort.o \
hud/hudets.o \
hud/hudlock.o \
hud/hudmessage.o \
hud/hudreticle.o \
hud/hudshield.o \
hud/hudsquadmsg.o \
hud/hudtarget.o \
hud/hudtargetbox.o \
hud/hudwingmanstatus.o
INETFILE_OBJFILES = \
inetfile/cftp.o \
inetfile/chttpget.o \
inetfile/inetgetfile.o
# io/joy.o
# io/joy_ff.o
# io/swff_lib.o
IO_OBJFILES = \
io/key.o \
io/keycontrol.o \
io/mouse.o \
io/timer.o \
io/xmouse.o
JUMPNODE_OBJFILES = \
jumpnode/jumpnode.o
LIGHTING_OBJFILES = \
lighting/lighting.o
LOCALIZATION_OBJFILES = \
localization/fhash.o \
localization/localize.o
MATH_OBJFILES = \
math/fix.o \
math/floating.o \
math/fvi.o \
math/spline.o \
math/staticrand.o \
math/vecmat.o
# menuui/optionsmenumulti.o
MENUUI_OBJFILES = \
menuui/barracks.o \
menuui/credits.o \
menuui/fishtank.o \
menuui/mainhallmenu.o \
menuui/mainhalltemp.o \
menuui/optionsmenu.o \
menuui/playermenu.o \
menuui/readyroom.o \
menuui/snazzyui.o \
menuui/techmenu.o \
menuui/trainingmenu.o
MISSION_OBJFILES = \
mission/missionbriefcommon.o \
mission/missioncampaign.o \
mission/missiongoals.o \
mission/missiongrid.o \
mission/missionhotkey.o \
mission/missionload.o \
mission/missionlog.o \
mission/missionmessage.o \
mission/missionparse.o \
mission/missiontraining.o
# missionui/chatbox.o
MISSIONUI_OBJFILES = \
missionui/missionbrief.o \
missionui/missioncmdbrief.o \
missionui/missiondebrief.o \
missionui/missionloopbrief.o \
missionui/missionpause.o \
missionui/missionrecommend.o \
missionui/missionscreencommon.o \
missionui/missionshipchoice.o \
missionui/missionstats.o \
missionui/missionweaponchoice.o \
missionui/redalert.o
MODEL_OBJFILES = \
model/modelcollide.o \
model/modelinterp.o \
model/modeloctant.o \
model/modelread.o
NEBULA_OBJFILES = \
nebula/neb.o \
nebula/neblightning.o
# network/multi.o
# network/multi_campaign.o
# network/multi_data.o
# network/multi_dogfight.o
# network/multi_endgame.o
# network/multi_ingame.o
# network/multi_kick.o
# network/multi_log.o
# network/multimsgs.o
# network/multi_obj.o
# network/multi_observer.o
# network/multi_oo.o
# network/multi_options.o
# network/multi_pause.o
# network/multi_pinfo.o
# network/multi_ping.o
# network/multi_pmsg.o
# network/multi_rate.o
# network/multi_respawn.o
# network/multi_team.o
# network/multi_update.o
# network/multi_voice.o
# network/multi_xfer.o
# network/multilag.o
# network/multiteamselect.o
# network/multiui.o
# network/psnet.o
# network/psnet2.o
# network/stand_gui.o
NETWORK_OBJFILES = \
network/multiutil.o
# object/objectsnd.o
OBJECT_OBJFILES = \
object/collidedebrisship.o \
object/collidedebrisweapon.o \
object/collideshipship.o \
object/collideshipweapon.o \
object/collideweaponweapon.o \
object/objcollide.o \
object/object.o \
object/objectsort.o
OBSERVER_OBJFILES = \
observer/observer.o
OSAPI_OBJFILES = \
osapi/osapi_unix.o \
osapi/osregistry_unix.o \
osapi/outwnd_unix.o
PALMAN_OBJFILES = \
palman/palman.o
PARSE_OBJFILES = \
parse/encrypt.o \
parse/parselo.o \
parse/sexp.o
PARTICLE_OBJFILES = \
particle/particle.o
PCXUTILS_OBJFILES = \
pcxutils/pcxutils.o
PHYSICS_OBJFILES = \
physics/physics.o
PLAYERMAN_OBJFILES = \
playerman/managepilot.o \
playerman/playercontrol.o
POPUP_OBJFILES = \
popup/popup.o \
popup/popupdead.o
RADAR_OBJFILES = \
radar/radar.o
RENDER_OBJFILES = \
render/3dclipper.o \
render/3ddraw.o \
render/3dlaser.o \
render/3dmath.o \
render/3dsetup.o
SHIP_OBJFILES = \
ship/afterburner.o \
ship/ai.o \
ship/aibig.o \
ship/aicode.o \
ship/aigoals.o \
ship/awacs.o \
ship/shield.o \
ship/ship.o \
ship/shipcontrails.o \
ship/shipfx.o \
ship/shiphit.o
SOUND_OBJFILES = \
sound/acm.o \
sound/audiostr.o \
sound/ds.o \
sound/ds3d.o \
sound/dscap.o \
sound/midifile.o \
sound/rbaudio.o \
sound/rtvoice.o \
sound/sound.o \
sound/winmidi.o \
sound/winmidi_base.o
STARFIELD_OBJFILES = \
starfield/nebula.o \
starfield/starfield.o \
starfield/supernova.o
STATS_OBJFILES = \
stats/medals.o \
stats/scoring.o \
stats/stats.o
TGAUTILS_OBJFILES = \
tgautils/tgautils.o
UI_OBJFILES = \
ui/button.o \
ui/checkbox.o \
ui/gadget.o \
ui/icon.o \
ui/inputbox.o \
ui/keytrap.o \
ui/listbox.o \
ui/radio.o \
ui/scroll.o \
ui/slider.o \
ui/slider2.o \
ui/uidraw.o \
ui/uimouse.o \
ui/window.o
VCODEC_OBJFILES = \
vcodec/codec1.o
WEAPON_OBJFILES = \
weapon/beam.o \
weapon/corkscrew.o \
weapon/emp.o \
weapon/flak.o \
weapon/muzzleflash.o \
weapon/shockwave.o \
weapon/swarm.o \
weapon/trails.o \
weapon/weapons.o
# SOUND_OBJFILES
# INETFILE_OBJFILES
# EXCEPTIONHANDLER_OBJFILES
OBJFILES = \
ANIM_OBJFILES \
ASTEROID_OBJFILES \
BMPMAN_OBJFILES \
CFILE_OBJFILES \
CMDLINE_OBJFILES \
CMEASURE_OBJFILES \
CONTROLCONFIG_OBJFILES \
CUTSCENE_OBJFILES \
DEBRIS_OBJFILES \
DEBUGCONSOLE_OBJFILES \
FIREBALL_OBJFILES \
GAMEHELP_OBJFILES \
GAMESEQUENCE_OBJFILES \
GAMESND_OBJFILES \
GLIDE_OBJFILES \
GLOBALINCS_OBJFILES \
GRAPHICS_OBJFILES \
HUD_OBJFILES \
IO_OBJFILES \
JUMPNODE_OBJFILES \
LIGHTING_OBJFILES \
MATH_OBJFILES \
MENUUI_OBJFILES \
MISSION_OBJFILES \
MISSIONUI_OBJFILES \
MODEL_OBJFILES \
NETWORK_OBJFILES \
OBJECT_OBJFILES \
OBSERVER_OBJFILES \
OSAPI_OBJFILES \
PALMAN_OBJFILES \
PARSE_OBJFILES \
PARTICLE_OBJFILES \
PCXUTILS_OBJFILES \
PHYSICS_OBJFILES \
PLAYERMAN_OBJFILES \
POPUP_OBJFILES \
RADAR_OBJFILES \
RENDER_OBJFILES \
SHIP_OBJFILES \
STARFIELD_OBJFILES \
STATS_OBJFILES \
UI_OBJFILES \
VCODEC_OBJFILES \
WEAPON_OBJFILES \
NEBULA_OBJFILES \
LOCALIZATION_OBJFILES \
TGAUTILS_OBJFILES \
DEMO_OBJFILES
# SOUND_OBJFILES
# INETFILE_OBJFILES
# EXCEPTIONHANDLER_OBJFILES
LIB_OBJFILES = \
$(ANIM_OBJFILES) \
$(ASTEROID_OBJFILES) \
$(BMPMAN_OBJFILES) \
$(CFILE_OBJFILES) \
$(CMDLINE_OBJFILES) \
$(CMEASURE_OBJFILES) \
$(CONTROLCONFIG_OBJFILES) \
$(CUTSCENE_OBJFILES) \
$(DEBRIS_OBJFILES) \
$(DEBUGCONSOLE_OBJFILES) \
$(FIREBALL_OBJFILES) \
$(GAMEHELP_OBJFILES) \
$(GAMESEQUENCE_OBJFILES) \
$(GAMESND_OBJFILES) \
$(GLIDE_OBJFILES) \
$(GLOBALINCS_OBJFILES) \
$(GRAPHICS_OBJFILES) \
$(HUD_OBJFILES) \
$(IO_OBJFILES) \
$(JUMPNODE_OBJFILES) \
$(LIGHTING_OBJFILES) \
$(MATH_OBJFILES) \
$(MENUUI_OBJFILES) \
$(MISSION_OBJFILES) \
$(MISSIONUI_OBJFILES) \
$(MODEL_OBJFILES) \
$(NETWORK_OBJFILES) \
$(OBJECT_OBJFILES) \
$(OBSERVER_OBJFILES) \
$(OSAPI_OBJFILES) \
$(PALMAN_OBJFILES) \
$(PARSE_OBJFILES) \
$(PARTICLE_OBJFILES) \
$(PCXUTILS_OBJFILES) \
$(PHYSICS_OBJFILES) \
$(PLAYERMAN_OBJFILES) \
$(POPUP_OBJFILES) \
$(RADAR_OBJFILES) \
$(RENDER_OBJFILES) \
$(SHIP_OBJFILES) \
$(STARFIELD_OBJFILES) \
$(STATS_OBJFILES) \
$(UI_OBJFILES) \
$(VCODEC_OBJFILES) \
$(WEAPON_OBJFILES) \
$(NEBULA_OBJFILES) \
$(LOCALIZATION_OBJFILES) \
$(TGAUTILS_OBJFILES) \
$(DEMO_OBJFILES) \
$(SOUND_OBJS) \
$(JOYSTICK_OBJS) \
$(NETWORK_OBJS)
FREESPACE2_OBJFILES = \
freespace2/freespace.o \
freespace2/levelpaging.o
STUB_OBJFILES = \
windows_stub/stubs.o
# ==============================
.PHONY: all clean code \
ANIM_OBJFILES \
ASTEROID_OBJFILES \
BMPMAN_OBJFILES \
CMDLINE_OBJFILES \
CMEASURE_OBJFILES \
CONTROLCONFIG_OBJFILES \
CUTSCENE_OBJFILES \
DEBRIS_OBJFILES \
DEBUGCONSOLE_OBJFILES \
FIREBALL_OBJFILES \
GAMEHELP_OBJFILES \
GAMESEQUENCE_OBJFILES \
GAMESND_OBJFILES \
GLIDE_OBJFILES \
GLOBALINCS_OBJFILES \
GRAPHICS_OBJFILES \
HUD_OBJFILES \
IO_OBJFILES \
JUMPNODE_OBJFILES \
LIGHTING_OBJFILES \
MATH_OBJFILES \
MENUUI_OBJFILES \
MISSION_OBJFILES \
MISSIONUI_OBJFILES \
MODEL_OBJFILES \
OBJECT_OBJFILES \
OBSERVER_OBJFILES \
OSAPI_OBJFILES \
PALMAN_OBJFILES \
PARSE_OBJFILES \
PARTICLE_OBJFILES \
PCXUTILS_OBJFILES \
PHYSICS_OBJFILES \
PLAYERMAN_OBJFILES \
POPUP_OBJFILES \
RADAR_OBJFILES \
RENDER_OBJFILES \
SHIP_OBJFILES \
SOUND_OBJFILES \
STARFIELD_OBJFILES \
STATS_OBJFILES \
UI_OBJFILES \
VCODEC_OBJFILES \
WEAPON_OBJFILES \
NEBULA_OBJFILES \
LOCALIZATION_OBJFILES \
TGAUTILS_OBJFILES \
DEMO_OBJFILES \
INETFILE_OBJFILES \
EXCEPTIONHANDLER_OBJFILES \
NETWORK_OBJFILES
.cpp.o:
$(CXX) $(CXXFLAGS) -c -o $@ $<
all: $(TARGET)
clean:
rm -f $(TARGET) libcode.a core *.o *~
find -name *.o -exec rm {} \;
find -name *~ -exec rm {} \;
code: libcode.a
# ==============================
libcode.a: $(LIB_OBJFILES)
$(AR) -r $@ $(LIB_OBJFILES)
# $(CXX) -o $@ $(LIB_OBJFILES)
fs2: libcode.a $(FREESPACE2_OBJFILES) $(STUB_OBJFILES)
$(CXX) $(LDFLAGS) -o $@ $(FREESPACE2_OBJFILES) $(STUB_OBJFILES) $(LDLIBS) -L. -lcode
# exceptions to the rule...
freespace2/freespace.o: freespace2/freespace.cpp
$(CXX) $(CXXFLAGS) -fexceptions -c -o $@ $<
ANIM_OBJFILES: $(ANIM_OBJFILES)
ASTEROID_OBJFILES: $(ASTEROID_OBJFILES)
BMPMAN_OBJFILES: $(BMPMAN_OBJFILES)
CMDLINE_OBJFILES: $(CMDLINE_OBJFILES)
CMEASURE_OBJFILES: $(CMEASURE_OBJFILES)
CONTROLCONFIG_OBJFILES: $(CONTROLCONFIG_OBJFILES)
CUTSCENE_OBJFILES: $(CUTSCENE_OBJFILES)
DEBRIS_OBJFILES: $(DEBRIS_OBJFILES)
DEBUGCONSOLE_OBJFILES: $(DEBUGCONSOLE_OBJFILES)
FIREBALL_OBJFILES: $(FIREBALL_OBJFILES)
GAMEHELP_OBJFILES: $(GAMEHELP_OBJFILES)
GAMESEQUENCE_OBJFILES: $(GAMESEQUENCE_OBJFILES)
GAMESND_OBJFILES: $(GAMESND_OBJFILES)
GLIDE_OBJFILES: $(GLIDE_OBJFILES)
GLOBALINCS_OBJFILES: $(GLOBALINCS_OBJFILES)
GRAPHICS_OBJFILES: $(GRAPHICS_OBJFILES)
HUD_OBJFILES: $(HUD_OBJFILES)
IO_OBJFILES: $(IO_OBJFILES)
JUMPNODE_OBJFILES: $(JUMPNODE_OBJFILES)
LIGHTING_OBJFILES: $(LIGHTING_OBJFILES)
MATH_OBJFILES: $(MATH_OBJFILES)
MENUUI_OBJFILES: $(MENUUI_OBJFILES)
MISSION_OBJFILES: $(MISSION_OBJFILES)
MISSIONUI_OBJFILES: $(MISSIONUI_OBJFILES)
MODEL_OBJFILES: $(MODEL_OBJFILES)
OBJECT_OBJFILES: $(OBJECT_OBJFILES)
OBSERVER_OBJFILES: $(OBSERVER_OBJFILES)
OSAPI_OBJFILES: $(OSAPI_OBJFILES)
PALMAN_OBJFILES: $(PALMAN_OBJFILES)
PARSE_OBJFILES: $(PARSE_OBJFILES)
PARTICLE_OBJFILES: $(PARTICLE_OBJFILES)
PCXUTILS_OBJFILES: $(PCXUTILS_OBJFILES)
PHYSICS_OBJFILES: $(PHYSICS_OBJFILES)
PLAYERMAN_OBJFILES: $(PLAYERMAN_OBJFILES)
POPUP_OBJFILES: $(POPUP_OBJFILES)
RADAR_OBJFILES: $(RADAR_OBJFILES)
RENDER_OBJFILES: $(RENDER_OBJFILES)
SHIP_OBJFILES: $(SHIP_OBJFILES)
SOUND_OBJFILES: $(SOUND_OBJFILES)
STARFIELD_OBJFILES: $(STARFIELD_OBJFILES)
STATS_OBJFILES: $(STATS_OBJFILES)
UI_OBJFILES: $(UI_OBJFILES)
VCODEC_OBJFILES: $(VCODEC_OBJFILES)
WEAPON_OBJFILES: $(WEAPON_OBJFILES)
NEBULA_OBJFILES: $(NEBULA_OBJFILES)
LOCALIZATION_OBJFILES: $(LOCALIZATION_OBJFILES)
TGAUTILS_OBJFILES: $(TGAUTILS_OBJFILES)
DEMO_OBJFILES: $(DEMO_OBJFILES)
INETFILE_OBJFILES: $(INETFILE_OBJFILES)
EXCEPTIONHANDLER_OBJFILES: $(EXCEPTIONHANDLER_OBJFILES)
NETWORK_OBJFILES: $(NETWORK_OBJFILES)
File diff suppressed because it is too large. Load diff
+156
View File
@@ -0,0 +1,156 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Anim/AnimPlay.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Header file for playing back anim files
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/03 22:07:07 mharris
* got some stuff to compile
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 3 10/22/98 6:14p Dave
* Optimized some #includes in Anim folder. Put in the beginnings of
* parse/localization support for externalized strings and tstrings.tbl
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 11 5/07/98 3:11a Lawrance
* Implement custom streaming code
*
* 10 4/27/98 3:36p Dave
*
* 9 3/25/98 8:43p Hoffoss
* Changed anim_play() to not be so damn complex when you try and call it.
*
* 8 12/24/97 8:57p Lawrance
* Added anim_ignore_next_frametime()
*
* 7 11/19/97 8:28p Dave
* Hooked in Main Hall screen. Put in Anim support for ping ponging
* animations as well as general reversal of anim direction.
*
* 6 8/30/97 2:11p Lawrance
* allow animations to loop
*
* 5 8/25/97 11:13p Lawrance
* support framerate independent playback with the option of now advancing
* more than one frame at a time
*
* 4 7/21/97 11:41a Lawrance
* make playback time of .ani files keyed of frametime
*
* 3 7/20/97 6:57p Lawrance
* supporting new RLE format
*
* 2 6/26/97 12:12a Lawrance
* supporting anti-aliased bitmap animations
*
* 1 6/23/97 5:09p Lawrance
*
* 10 5/19/97 2:28p Lawrance
* changes some variables to flags
*
* 9 5/15/97 5:58p Lawrance
* fix some bugs that were present with animations when playing multiple
* missions
*
* 8 5/15/97 4:42p Lawrance
* suporting anims in-game
*
* 7 5/15/97 11:46a Lawrance
* add function to check if an anim is playing
*
* 6 2/28/97 12:17p Lawrance
* supporting mapping file to memory
*
* 5 2/25/97 11:06a Lawrance
* moved some higher level functions to from PackUnpack to AnimPlay
*
* 4 2/19/97 9:27p Lawrance
* added pause capability to anim playback
*
* 3 2/17/97 4:19p Lawrance
* using frame numbers instead of percentages for accessing keyframes
*
* 2 2/17/97 3:01p Lawrance
* code for playing back an anim
*
* $NoKeywords: $
*/
#ifndef __ANIMPLAY_H__
#define __ANIMPLAY_H__
#include "globalincs/pstypes.h"
struct anim;
struct anim_info;
struct anim_instance;
struct CFILE;
// structure passed in when playing an anim. Talk about overkill..
typedef struct {
anim *anim_info;
int x;
int y;
int start_at;
int stop_at;
int screen_id;
vector *world_pos;
float radius;
int framerate_independent;
void *color;
int skip_frames;
int looped;
int ping_pong;
} anim_play_struct;
extern int Anim_paused;
void anim_init();
void anim_level_init();
void anim_level_close();
void anim_render_all(int screen_id, float frametime);
void anim_render_one(int screen_id, anim_instance *ani, float frametime);
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y);
anim_instance *anim_play(anim_play_struct *aps);
void anim_ignore_next_frametime();
int anim_stop_playing(anim_instance* anim_instance);
int anim_show_next_frame(anim_instance *instance, float frametime);
void anim_release_all_instances(int screen_id = 0);
void anim_release_render_instance(anim_instance* instance);
anim *anim_load(char *name, int file_mapped = 0);
int anim_free(anim *ptr);
int anim_playing(anim_instance *ai);
int anim_write_frames_out(char *filename);
void anim_display_info(char *filename);
void anim_read_header(anim *ptr, CFILE *fp);
void anim_reverse_direction(anim_instance *ai); // called automatically for ping-ponging, and can also be called externally
void anim_pause(anim_instance *ai);
void anim_unpause(anim_instance *ai);
int anim_instance_is_streamed(anim_instance *ai);
unsigned char anim_instance_get_byte(anim_instance *ai, int offset);
#endif /* __ANIMPLAY_H__ */
File diff suppressed because it is too large. Load diff
+256
View File
@@ -0,0 +1,256 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Anim/PackUnpack.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Code for handling packing and unpacking in Hoffoss's RLE format, used for
* Anim files. Also handles Anim loading, creating Anim instances (for
* utilizing an Anim), and getting getting frames of the Anim.
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/03 22:07:07 mharris
* got some stuff to compile
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 7 7/16/99 1:49p Dave
* 8 bit aabitmaps. yay.
*
* 6 1/14/99 12:48a Dave
* Todo list bug fixes. Made a pass at putting briefing icons back into
* FRED. Sort of works :(
*
* 5 11/30/98 1:07p Dave
* 16 bit conversion, first run.
*
* 4 10/22/98 6:14p Dave
* Optimized some #includes in Anim folder. Put in the beginnings of
* parse/localization support for externalized strings and tstrings.tbl
*
* 3 10/16/98 3:42p Andsager
* increase MAX_WEAPONS and MAX_SHIPS and som header files
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 32 5/18/98 5:59p Hoffoss
* Made command briefing advanced now once the speech stops and animation
* has fully played once, whichever is longer.
*
* 31 5/07/98 3:11a Lawrance
* Implement custom streaming code
*
* 30 1/14/98 6:43p Lawrance
* Add ref_count to anim struct, so we don't free multiple times
*
* 29 11/19/97 8:28p Dave
* Hooked in Main Hall screen. Put in Anim support for ping ponging
* animations as well as general reversal of anim direction.
*
* 28 8/30/97 2:11p Lawrance
* allow animations to loop
*
* 27 8/25/97 11:13p Lawrance
* support framerate independent playback with the option of now advancing
* more than one frame at a time
*
* 26 8/21/97 5:11p Lawrance
* frame numbering for ANI's now is from 0 -> total_frames-1.
*
* 25 7/28/97 10:42p Lawrance
* re-did interface to unpack_frame() to make more general
*
* 24 7/21/97 11:41a Lawrance
* make playback time of .ani files keyed of frametime
*
* 23 7/20/97 6:57p Lawrance
* supporting new RLE format
*
* 22 6/27/97 4:36p Lawrance
* update pal translation table when gr_screen.signature changes
*
* 21 6/26/97 12:12a Lawrance
* supporting anti-aliased bitmap animations
*
* 20 6/25/97 3:03p Lawrance
* fix palette translation problem with anti-alised bitmaps
*
* 19 5/27/97 3:48p Lawrance
* don't re-create a bitmap if using the same frame of animation
*
* 18 5/21/97 11:06a Lawrance
* enabling a user-defined transparent value
*
* 17 5/19/97 3:21p Lawrance
* add fps parm, version num to anim header
*
* 16 5/19/97 2:28p Lawrance
* changes some variables to flags
*
* 15 5/15/97 4:42p Lawrance
* supporting animations in-game
*
* 14 3/01/97 2:08p Lawrance
* not using windows.h, since memory mapping details moved to cfile
*
* 13 2/28/97 12:17p Lawrance
* supporting mapping file to memory
*
* 12 2/25/97 11:06a Lawrance
* moved some higher level functions to from PackUnpack to AnimPlay
*
* 11 2/19/97 9:51p Lawrance
* made keyframe decompression more effecient, moved
* default anim FPS to header file
*
* 10 2/19/97 4:01p Lawrance
* load_anim returns int, not void
*
* 9 2/17/97 4:19p Lawrance
* changed stop and start to be actual frame numbers, not percentages
*
* 8 2/17/97 4:17p Hoffoss
* modified packing internal format and added random access function to an
* Anim frame.
*
* 7 2/17/97 2:59p Lawrance
* integrating into game
*
* 6 2/14/97 11:09p Hoffoss
* Made optimizations.
*
* 5 2/14/97 10:48p Hoffoss
* fixed bug.
*
* 4 2/14/97 10:38p Lawrance
* fixing bugs
*
* 3 2/14/97 3:29p Hoffoss
* Added header for MSDEV to fill in.
*
* $NoKeywords: $
*/
#ifndef __PACKUNPACK_H__
#define __PACKUNPACK_H__
#include "globalincs/pstypes.h"
struct CFILE;
#define ANI_STREAM_CACHE_SIZE 4096
#define PACKER_CODE 0xEE // Use'd by PACKING_METHOD_RLE
#define PACKING_METHOD_RLE 0 // Hoffoss's RLE format
#define PACKING_METHOD_RLE_KEY 1 // Hoffoss's key frame RLE format
#define PACKING_METHOD_STD_RLE 2 // Standard RLE format (high bit is count)
#define PACKING_METHOD_STD_RLE_KEY 3 // Standard RLE format key frame
#define STD_RLE_CODE 0x80
typedef struct key_frame {
int frame_num; // which frame number this key frame is
int offset; // offset from the start of data block
} key_frame;
#define ANF_MEM_MAPPED (1<<0) // animation is memory-mapped file
#define ANF_STREAMED (1<<1)
#define ANF_XPARENT (1<<2) // animation has transparency
#define ANF_ALL_KEYFRAMES (1<<3) // all the frames are keyframes (this is necessary if we want to play the file backwards)
typedef struct anim {
anim *next;
char name[MAX_PATH_LEN];
ubyte packer_code;
int width;
int height;
int total_frames;
int instance_count; // number of instances that are currently playing
int ref_count; // number of times this anim has been loaded
float time; // playback time in seconds
int num_keys;
key_frame *keys;
ubyte palette[768];
ubyte palette_translation[256];
ubyte *data; // points to compressed data
CFILE* cfile_ptr;
int version;
int fps;
ubyte xparent_r; // red component for the transparent color in source image
ubyte xparent_g; // green component for the transparent color in source image
ubyte xparent_b; // blue component for the transparent color in source image
int flags;
uint screen_sig;
int file_offset; // file offset to start of frame data
int cache_file_offset;
ubyte *cache;
} anim_t;
// the direction to play the anim (forwards or backwards)
#define ANIM_DIRECT_FORWARD 0
#define ANIM_DIRECT_REVERSE 1
typedef struct anim_instance {
anim_instance *next, *prev;
int x,y; // coordinates anim is played at (top left corner of anim)
vector *world_pos; // world (x,y,z) position of explosion
float radius; // radius of image, needed for scaling
int frame_num; // current frame, or last frame if between frames (first frame is 0)
int last_frame_num;// last frame rendered
anim *parent; // pointer to anim structure, which holds compressed data
ubyte *data; // pointer to next frame's compressed data
ubyte *frame; // uncompressed frame
float time_elapsed; // how long the anim has played for (in seconds)
int start_at; // frame anim playing should start
int stop_at; // frame anim playing should stop
int framerate_independent; // animation should play back in same amount of time, regardless
int skip_frames; // should anim skip frames during framerate independent playback
int looped; // should anim keep playing over and over...
int stop_now; // flag to indicate time to stop the animation
int last_bitmap; // id of last bitmap that was rendered out from animation
int screen_id; // 0 means all screens should render, otherwise screen specific
void *aa_color; // anti-aliased bitmap color
int xlate_pal;
int direction; // playing forwards or backwards ?
int ping_pong; // should be played ping-pong style
int paused; // pause the anim
int file_offset; // current offset into frame (like data, put offset into file)
int loop_count; // starts at 0, and is incremented each time it loops
} anim_instance_t;
extern int packer_code;
int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_type);
int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, int compress_type);
ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp);
int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp);
void anim_init();
anim_instance *init_anim_instance(anim *ptr, int bpp);
void free_anim_instance(anim_instance *inst);
int anim_get_next_frame(anim_instance *inst);
int anim_get_frame(anim_instance *inst, int frame_num, int xlate_pal=1);
ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp);
void anim_set_palette(anim *a);
void anim_check_for_palette_change(anim_instance *inst);
#endif /* __PACKUNPACK_H__ */
File diff suppressed because it is too large. Load diff
+267
View File
@@ -0,0 +1,267 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Asteroid/Asteroid.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Header file for asteroids
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/03 22:07:08 mharris
* got some stuff to compile
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 12 6/09/99 2:55p Andsager
* Allow multiple asteroid subtypes (of large, medium, small) and follow
* family.
*
* 11 6/07/99 1:18p Andsager
* Make asteroids choose consistent texture from large to small. Modify
* fireball radius of dying asteroids.
*
* 10 5/03/99 10:50p Andsager
* Make Asteroid_obj_list. Change get_nearest_turret_objnum() to use
* Asteroid_obj_list, Ship_obj_list and Missile_obj_list vs.
* obj_used_list.
*
* 9 4/16/99 2:34p Andsager
* Second pass on debris fields
*
* 8 4/15/99 5:00p Andsager
* Frist pass on Debris field
*
* 7 3/31/99 9:51a Andsager
* Add for generalization to debris field
*
* 6 2/07/99 8:51p Andsager
* Add inner bound to asteroid field. Inner bound tries to stay astroid
* free. Wrap when within and don't throw at ships inside.
*
* 5 1/20/99 6:04p Dave
* Another bit of stuff for beam weapons. Ships will properly use them
* now, although they're really deadly.
*
* 4 11/05/98 5:55p Dave
* Big pass at reducing #includes
*
* 3 10/16/98 1:22p Andsager
* clean up header files
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 17 3/26/98 9:19a Lawrance
* Support multiple asteroid pofs
*
* 16 3/17/98 12:16a Allender
* asteroids in multiplayer -- minor problems with position being correct
*
* 15 3/14/98 1:44p Mike
* Todolist items 3365..3368. Make child asteroids collide properly.
* Make asteroid throwing less bunchy, toss asteroids earlier, make
* facing-ness not break mission balance.
*
* 14 3/11/98 12:13a Lawrance
* Auto-target asteroids if no hostile ships present
*
* 13 3/08/98 4:16p Hoffoss
*
* 12 3/07/98 3:48p Lawrance
* Show offscreen indicators for asteroids
*
* 11 3/04/98 11:59p Lawrance
* create an asteroid.tbl, read all asteroid data from there
*
* 10 3/04/98 4:11p Lawrance
* Have area effects affect asteroids, have asteroids cast an area effect,
* fix ship shockwaves
*
* 9 3/03/98 12:48a Lawrance
* Ensure collide_objnum is still valid each frame.
*
* 8 3/02/98 11:35p Lawrance
* Keep track of asteroids that will impact ships on the escort view.
*
* 7 2/26/98 10:07p Hoffoss
* Rewrote state saving and restoring to fix bugs and simplify the code.
*
* 6 2/26/98 4:22p Lawrance
* Change wrapping behavior, make vel random
*
* 5 2/20/98 8:31p Lawrance
* delay creation of sub-asteroids
*
* 4 2/19/98 4:33p Lawrance
* hook in new sounds and custom explosion animation
*
* 3 2/19/98 12:46a Lawrance
* Further work on asteroids.
*
* 2 2/10/98 6:43p Lawrance
* Moved asteroid code to a separate lib.
*
* 1 2/10/98 6:05p Lawrance
*
* $NoKeywords: $
*/
#ifndef __ASTEROID_H__
#define __ASTEROID_H__
#include "ship/ship.h"
#include "parse/parselo.h" // for NAME_LENGTH
struct object;
struct polymodel;
struct collision_info_struct;
#define MAX_ASTEROIDS 256
// DEBRIS TYPES
#define MAX_DEBRIS_TYPES 12
#define ASTEROID_TYPE_SMALL 0
#define ASTEROID_TYPE_MEDIUM 1
#define ASTEROID_TYPE_BIG 2
//
#define DEBRIS_TERRAN_SMALL 3
#define DEBRIS_TERRAN_MEDIUM 4
#define DEBRIS_TERRAN_LARGE 5
//
#define DEBRIS_VASUDAN_SMALL 6
#define DEBRIS_VASUDAN_MEDIUM 7
#define DEBRIS_VASUDAN_LARGE 8
//
#define DEBRIS_SHIVAN_SMALL 9
#define DEBRIS_SHIVAN_MEDIUM 10
#define DEBRIS_SHIVAN_LARGE 11
// END DEBRIS TYPES
typedef struct debris_struct {
int index;
char *name;
} debris_struct;
// Data structure to track the active asteroids
typedef struct asteroid_obj {
asteroid_obj *next, *prev;
int flags, objnum;
} asteroid_obj;
extern asteroid_obj Asteroid_obj_list;
extern debris_struct Field_debris_info[];
#define MAX_ASTEROID_POFS 3 // Max number of POFs per asteroid type
#define AF_USED (1<<0) // Set means used.
typedef struct asteroid_info {
char name[NAME_LENGTH]; // name for the asteroid
char pof_files[MAX_ASTEROID_POFS][NAME_LENGTH]; // POF files to load/associate with ship
int num_detail_levels; // number of detail levels for this ship
int detail_distance[MAX_SHIP_DETAIL_LEVELS]; // distance to change detail levels at
float max_speed; // cap on speed for asteroid
float inner_rad; // radius within which maximum area effect damage is applied
float outer_rad; // radius at which no area effect damage is applied
float damage; // maximum damage applied from area effect explosion
float blast; // maximum blast impulse from area effect explosion
float initial_hull_strength; // starting strength of asteroid
polymodel *modelp[MAX_ASTEROID_POFS];
int model_num[MAX_ASTEROID_POFS];
} asteroid_info;
typedef struct asteroid {
int flags;
int objnum;
int type; // In 0..Num_asteroid_types
int asteroid_subtype; // Which index into asteroid_info for modelnum and modelp
int check_for_wrap; // timestamp to check for asteroid wrapping around field
int check_for_collide; // timestamp to check for asteroid colliding with escort ships
int final_death_time; // timestamp to swap in new models after explosion starts
int collide_objnum; // set to objnum that asteroid will be impacting soon
int collide_objsig; // object signature corresponding to collide_objnum
vector death_hit_pos; // hit pos that caused death
int target_objnum; // Yes, hah! Asteroids can have targets. See asteroid_aim_at_target().
} asteroid;
// TYPEDEF FOR SPECIES OF DEBRIS - BITFIELD
#define DS_TERRAN 0x01
#define DS_VASUDAN 0x02
#define DS_SHIVAN 0x04
// TYPEDEF FOR DEBRIS TYPE
typedef enum {
DG_ASTEROID,
DG_SHIP
} debris_genre_t;
// TYPEDEF FOR FIELD TYPE
typedef enum {
FT_ACTIVE,
FT_PASSIVE
} field_type_t;
#define MAX_ACTIVE_DEBRIS_TYPES 3
typedef struct asteroid_field {
vector min_bound; // Minimum range of field.
vector max_bound; // Maximum range of field.
int has_inner_bound;
vector inner_min_bound;
vector inner_max_bound;
vector vel; // Average asteroid moves at this velocity.
float speed; // Average speed of field
int num_initial_asteroids; // Number of asteroids at creation.
field_type_t field_type; // active throws and wraps, passive does not
debris_genre_t debris_genre; // type of debris (ship or asteroid) [generic type]
int field_debris_type[MAX_ACTIVE_DEBRIS_TYPES]; // one of the debris type defines above
} asteroid_field;
extern asteroid_info Asteroid_info[MAX_DEBRIS_TYPES];
extern asteroid Asteroids[MAX_ASTEROIDS];
extern asteroid_field Asteroid_field;
extern int Num_asteroid_types;
extern int Num_asteroids;
extern int Asteroids_enabled;
void asteroid_init();
void asteroid_level_init();
void asteroid_level_close();
void asteroid_create_all();
void asteroid_render( object *asteroid_objp );
void asteroid_delete( object *asteroid_objp );
void asteroid_process_pre( object *asteroid_objp, float frame_time);
void asteroid_process_post( object *asteroid_objp, float frame_time);
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vector * hitpos, collision_info_struct *asteroid_hit_info=NULL );
void asteroid_hit( object *asteroid_objp, object *other_objp, vector *hitpos, float damage );
int asteroid_count();
int asteroid_collide_objnum(object *asteroid_objp);
float asteroid_time_to_impact(object *asteroid_objp);
void asteroid_show_brackets();
void asteroid_target_closest_danger();
int asteroid_get_random_in_cone(vector *pos, vector *dir, float ang, int danger = 0);
// need to extern for multiplayer
void asteroid_sub_create(object *parent_objp, int asteroid_type, vector *relvec);
void asteroid_frame();
#endif // __ASTEROID_H__
File diff suppressed because it is too large. Load diff
+354
View File
@@ -0,0 +1,354 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Bmpman/BmpMan.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:21 $
* $Author: penguin $
*
* Prototypes for Bitmap Manager functions
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 16 8/10/99 6:54p Dave
* Mad optimizations. Added paging to the nebula effect.
*
* 15 8/06/99 1:52p Dave
* Bumped up MAX_BITMAPS for the demo.
*
* 14 7/15/99 9:20a Andsager
* FS2_DEMO initial checkin
*
* 13 7/13/99 1:15p Dave
* 32 bit support. Whee!
*
* 12 6/29/99 10:35a Dave
* Interface polygon bitmaps! Whee!
*
* 11 6/16/99 4:06p Dave
* New pilot info popup. Added new draw-bitmap-as-poly function.
*
* 10 5/05/99 9:02p Dave
* Fixed D3D aabitmap rendering. Spiffed up nebula effect a bit (added
* rotations, tweaked values, made bitmap selection more random). Fixed
* D3D beam weapon clipping problem. Added D3d frame dumping.
*
* 9 2/08/99 5:07p Dave
* FS2 chat server support. FS2 specific validated missions.
*
* 8 2/05/99 12:52p Dave
* Fixed Glide nondarkening textures.
*
* 7 2/03/99 11:44a Dave
* Fixed d3d transparent textures.
*
* 6 12/06/98 2:36p Dave
* Drastically improved nebula fogging.
*
* 5 12/01/98 4:46p Dave
* Put in targa bitmap support (16 bit).
*
* 4 12/01/98 8:06a Dave
* Temporary checkin to fix some texture transparency problems in d3d.
*
* 3 11/30/98 1:07p Dave
* 16 bit conversion, first run.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 32 4/16/98 6:31p Hoffoss
* Added function to get filename of a bitmap handle, which we don't have
* yet and I need.
*
* 31 4/02/98 11:40a Lawrance
* check for #ifdef DEMO instead of #ifdef DEMO_RELEASE
*
* 30 3/30/98 4:02p John
* Made machines with < 32 MB of RAM use every other frame of certain
* bitmaps. Put in code to ke7ep track of how much RAM we've malloc'd.
*
* 29 3/29/98 4:05p John
* New paging code that loads everything necessary at level startup.
*
* 28 3/26/98 5:21p John
* Added new code to preload all bitmaps at the start of a level.
* Commented it out, though.
*
* 27 3/24/98 6:18p John
* Hacked MAX_BITMAPS up to 3500
*
* 26 3/10/98 4:18p John
* Cleaned up graphics lib. Took out most unused gr functions. Made D3D
* & Glide have popups and print screen. Took out all >8bpp software
* support. Made Fred zbuffer. Made zbuffer allocate dynamically to
* support Fred. Made zbuffering key off of functions rather than one
* global variable.
*
* 25 3/02/98 6:46p John
* Upped MAX_BITMAPS to 2000
*
* 24 3/02/98 6:00p John
* Moved MAX_BITMAPS into BmpMan.h so the stuff in the graphics code that
* is dependent on it won't break if it changes. Made ModelCache slots
* be equal to MAX_OBJECTS which is what it is.
*
* 23 2/06/98 8:25p John
* Added code for new bitmaps since last frame
*
* 22 2/06/98 8:10p John
* Added code to show amout of texture usage each frame.
*
* 21 1/29/98 11:48a John
* Added new counter measure rendering as model code. Made weapons be
* able to have impact explosion.
*
* 20 1/11/98 2:14p John
* Changed a lot of stuff that had to do with bitmap loading. Made cfile
* not do callbacks, I put that in global code. Made only bitmaps that
* need to load for a level load.
*
* 19 9/03/97 4:19p John
* changed bmpman to only accept ani and pcx's. made passing .pcx or .ani
* to bm_load functions not needed. Made bmpman keep track of palettes
* for bitmaps not mapped into game palettes.
*
* 18 8/25/97 11:14p Lawrance
* added support for .ani files in bm_load_animation()
*
* 17 7/16/97 3:07p John
*
* 16 6/17/97 8:58p Lawrance
* fixed bug with not nulling bm.data with USER bitmaps
*
* 15 6/12/97 2:44a Lawrance
* changed bm_unlock() to take an index into bm_bitmaps(). Added
* ref_count to bitmap_entry struct
*
* 14 5/20/97 10:36a John
* Fixed problem with user bitmaps and direct3d caching.
*
* 13 3/24/97 3:25p John
* Cleaned up and restructured model_collide code and fvi code. In fvi
* made code that finds uvs work.. Added bm_get_pixel to BmpMan.
*
* 12 2/17/97 5:18p John
* Added a bunch of RCS headers to a bunch of old files that don't have
* them.
*
* $NoKeywords: $
*/
#ifndef _BMPMAN_H
#define _BMPMAN_H
#ifdef FS2_DEMO
#define MAX_BITMAPS 3500
#else
#define MAX_BITMAPS 3500 // How many bitmaps the game can handle
#endif
// 16 bit pixel formats
#define BM_PIXEL_FORMAT_ARGB 0 // for glide - can assume certain things, like 1555 LFB writes, whee!
#define BM_PIXEL_FORMAT_D3D 1 // d3d - card dependant. booo!
#define BM_PIXEL_FORMAT_ARGB_D3D 2 // this card has nice 1555 textures like Glide - ahhhhh!
// 16 bit pixel formats
extern int Bm_pixel_format;
#define BYTES_PER_PIXEL(x) ((x+7)/8)
// how many bytes of textures are used.
extern int bm_texture_ram;
// 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);
// 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);
// 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, int flags = 0);
// Frees up a bitmap's data, but bitmap number 'n' can
// still be used, it will just have to be paged in next
// time it is locked.
int bm_unload( int n );
// 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.
void bm_release(int n);
// 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, int *fps = NULL, int can_drop_frames = 0 );
// 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 );
// 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);
// Unlocks a bitmap
extern void bm_unlock( int bitmapnum );
// Gets info. w,h,or flags,nframes or fps can be NULL if you don't care.
extern void bm_get_info( int bitmapnum, int *w=NULL, int * h=NULL, ubyte * flags=NULL, int *nframes=NULL, int *fps=NULL, bitmap_section_info **sections = NULL );
// get filename
extern void bm_get_filename(int bitmapnum, char *filename);
// resyncs all the bitmap palette
extern void bm_update();
// call to load all data for all bitmaps that have been requested to be loaded
extern void bm_load_all();
extern void bm_unload_all();
// call to get the palette for a bitmap
extern void bm_get_palette(int n, ubyte *pal, char *name);
// Hacked function to get a pixel from a bitmap.
// Only works good in 8bpp mode.
void bm_get_pixel( int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *b );
// 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);
/*
* 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
//============================================================================
void bm_page_in_start();
void bm_page_in_stop();
// Paging code in a library should call these functions
// in its page in function.
// Marks a texture as being used for this level
// If num_frames is passed, assume this is an animation
void bm_page_in_texture( int bitmapnum, int num_frames=1 );
// Marks a texture as being used for this level
// If num_frames is passed, assume this is an animation
void bm_page_in_nondarkening_texture( int bitmap, 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 );
// 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 );
//
// 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);
void BM_SELECT_SCREEN_FORMAT();
void BM_SELECT_TEX_FORMAT();
void BM_SELECT_ALPHA_TEX_FORMAT();
// convert a 24 bit value to a 16 bit value
void bm_24_to_16(int bit_24, ushort *bit_16);
// 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);
void bm_set_components_argb(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_d3d(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);
// 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);
//============================================================================
// section info stuff
//============================================================================
// given a bitmap and a section, return the size (w, h)
void bm_get_section_size(int bitmapnum, int sx, int sy, int *w, int *h);
#endif
File diff suppressed because it is too large. Load diff
+628
View File
@@ -0,0 +1,628 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/CFile/cfile.h $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* <insert description of file here>
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/07/07 19:55:58 penguin
* Back-port to MSVC
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.3 2002/05/16 06:03:29 mharris
* Unix port changes
*
* Revision 1.2 2002/05/09 22:58:08 mharris
* Added ifdef WIN32 around change-drive functions
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 11 9/08/99 12:03a Dave
* Make squad logos render properly in D3D all the time. Added intel anim
* directory.
*
* 10 8/31/99 9:46a Dave
* Support for new cfile cbanims directory.
*
* 9 5/19/99 4:07p Dave
* Moved versioning code into a nice isolated common place. Fixed up
* updating code on the pxo screen. Fixed several stub problems.
*
* 8 3/28/99 5:58p Dave
* Added early demo code. Make objects move. Nice and framerate
* independant, but not much else. Don't use yet unless you're me :)
*
* 7 3/24/99 4:05p Dave
* Put in support for assigning the player to a specific squadron with a
* specific logo. Preliminary work for doing pos/orient checksumming in
* multiplayer to reduce bandwidth.
*
* 6 1/12/99 3:15a Dave
* Barracks screen support for selecting squad logos. We need real artwork
* :)
*
* 5 10/29/98 10:41a Dave
* Change the way cfile initializes exe directory.
*
* 4 10/13/98 9:19a Andsager
* Add localization support to cfile. Optional parameter with cfopen that
* looks for localized files.
*
* 3 10/12/98 9:54a Dave
* Fixed a few file organization things.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 84 9/09/98 5:53p Dave
* Put in new tracker packets in API. Change cfile to be able to checksum
* portions of a file.
*
* 83 8/12/98 4:53p Dave
* Put in 32 bit checksumming for PXO missions. No validation on the
* actual tracker yet, though.
*
* 82 5/19/98 1:19p Allender
* new low level reliable socket reading code. Make all missions/campaign
* load/save to data missions folder (i.e. we are rid of the player
* missions folder)
*
* 81 5/13/98 10:22p John
* Added cfile functions to read/write rle compressed blocks of data.
* Made palman use it for .clr files. Made alphacolors calculate on the
* fly rather than caching to/from disk.
*
* 80 5/01/98 10:21a John
* Added code to find all pack files in all trees. Added code to create
* any directories that we write to.
*
* 79 4/30/98 10:29p John
* Added code to refresh filelist if cd-rom changed or packfiles created
* or deleted.
*
* 78 4/30/98 10:06p John
* Started adding code for splitting the maps data tree for hardware
* textures.
*
* 77 4/30/98 9:43p John
* Restructured some stuff.
*
* 76 4/30/98 8:23p John
* Fixed some bugs with Fred caused by my new cfile code.
*
* 75 4/30/98 4:53p John
* Restructured and cleaned up cfile code. Added capability to read off
* of CD-ROM drive and out of multiple pack files.
*
* 74 4/20/98 6:04p Dave
* Implement multidata cache flushing and xferring mission files to
* multidata. Make sure observers can't change hud config. Fix pilot image
* viewing in popup. Put in game status field. Tweaked multi options.
*
* 73 4/01/98 6:06p Hoffoss
* Added a command briefing directory for those voice files.
*
* 72 3/31/98 4:51p Dave
* Removed medals screen and multiplayer buttons from demo version. Put in
* new pilot popup screen. Make ships in mp team vs. team have proper team
* ids. Make mp respawns a permanent option saved in the player file.
*
* 71 3/26/98 6:01p Dave
* Put in file checksumming routine in cfile. Made pilot pic xferring more
* robust. Cut header size of voice data packets in half. Put in
* restricted game host query system.
*
* 70 3/10/98 2:27p Hoffoss
* Added change directory with history stack functions, so you can switch
* to a new directory, do something, and restore to what it was. useful
* for Fred.
*
* 69 3/07/98 3:48p Lawrance
* get save game working, allow restore from main menu
*
* 68 2/26/98 10:07p Hoffoss
* Rewrote state saving and restoring to fix bugs and simplify the code.
*
* 67 2/20/98 4:43p Dave
* Finished support for multiplayer player data files. Split off
* multiplayer campaign functionality.
*
* 66 2/19/98 6:26p Dave
* Fixed a few file xfer bugs. Tweaked mp team select screen. Put in
* initial support for player data uploading.
*
* 65 2/06/98 3:47p Allender
* subtitling for movies
*
* 64 2/05/98 10:15p Lawrance
* Add support for .svg filenames.
*
* 63 1/12/98 10:07p Hoffoss
* Made tab cycle properly in debriefing screen and put in aux. pilot
* image directory.
*
* 62 1/11/98 2:45p John
* Changed .lst to .clt
*
* 61 1/11/98 2:14p John
* Changed a lot of stuff that had to do with bitmap loading. Made cfile
* not do callbacks, I put that in global code. Made only bitmaps that
* need to load for a level load.
*
* 60 1/02/98 4:41p Allender
* added new mission folder for "player" missions
*
* 59 12/28/97 12:42p John
* Put in support for reading archive files; Made missionload use the
* cf_get_file_list function. Moved demos directory out of data tree.
*
* 58 12/17/97 10:16p Allender
* implemented a "no callback" flag to tell the cfile code not to use the
* cf_callback on files which specify this flag
*
* 57 12/08/97 6:23p Lawrance
* add cflush()
*
* 56 12/07/97 4:30p John
* Fixed bug with cfile versioning if two files use it at once. Added
* code to cfile so I could display a loading box while loading.
*
* 55 11/24/97 9:28a Hoffoss
* Moved define of CF_TYPE_MULTI_PLAYERS so it's in order. I started to
* add it because I couldn't find it, so that's indication enough it
* needed it.
*
* 54 11/20/97 1:07a Lawrance
* add support for voice/debriefings directory
*
* 53 11/19/97 7:27p Hoffoss
* Added version checking read functions.
*
* 52 11/18/97 10:53a Hoffoss
*
* 51 11/17/97 6:07p Hoffoss
* Make get_file_list() allow filtering via a callback function.
*
* 50 11/16/97 2:29p John
* added versioning to nebulas; put nebula code into freespace.
*
* 49 11/15/97 6:10p Lawrance
* add in support for new voice directories
*
* 48 11/11/97 4:54p Dave
* Put in support for single vs. multiplayer pilots. Put in initial player
* selection screen (no command line option yet). Started work on
* multiplayer campaign file save gaming.
*
* 47 11/07/97 4:00p Hoffoss
* Capitalized directory names, changed the player/image directory to work
* like the rest, and forced the player/images directory to be created.
*
* 46 11/06/97 5:38p Hoffoss
* Added a new player image directory and added support for it.
*
* 45 11/04/97 7:46p Lawrance
* Add support for data\interface\HUD directory
*
* 44 10/29/97 6:22p Hoffoss
* Added some new file listing functions.
*
* 43 10/28/97 10:54a Lawrance
* support for 8b22k and 16b11k directories under the sound directory
*
* 42 10/14/97 11:34p Lawrance
* add function to get full path for a given filename
*
* 41 9/24/97 5:30p Lawrance
* add directory for voices
*
* 40 9/20/97 8:16a John
* Made .clr files go into the Cache directory. Replaced cfopen(name,NULL)
* to delete a file with cf_delete.
*
* 39 9/09/97 6:50p Hoffoss
* Fixed bug with mission saving.
*
* 38 9/05/97 4:52p Lawrance
* fix prototype for cfread_angles() and cfwrite_angles()
*
* 37 8/29/97 4:47p Dave
* Added an extension for state transfer status files.
*
* 36 8/21/97 12:14p Dave
* Changed demo file extension from .keg to .fsd
*
* 35 8/19/97 5:51p Hoffoss
* Fixes to cfopen to not check the default directory first, but check it
* last. Also tracks info as to where a file is located when opened.
*
* 34 8/17/97 10:22p Hoffoss
* Fixed several bugs in Fred with Undo feature. In the process, recoded
* a lot of CFile.cpp.
*
* 33 8/17/97 12:47p Hoffoss
* Changed code so I can force missions to load from the missions
* directory regardless of it's extension.
*
* 32 8/13/97 1:39p Adam
* make .ani files available in the data/effects directory
*
* 31 8/13/97 12:24p Lawrance
* Add support for effects directory
*
* 30 7/30/97 5:23p Dave
* Added file extensions for demo stuff
*
* 29 7/28/97 10:42p Lawrance
* added ctmpfile(), analog to tmpfile()
*
* 28 7/16/97 5:29p John
* added palette table caching and made scaler and liner no light tmapper
* do alpha blending in 8 bpp mode.
*
* 27 6/05/97 4:53p John
* First rev of new antialiased font stuff.
*
* 26 6/05/97 1:22p Allender
* added .ntl as an extension for nettest program
*
* 25 4/25/97 11:31a Allender
* Campaign state now saved in campaign save file in player directory.
* Made some global variables follow naming convention. Solidified
* continuing campaigns based on new structure
*
* 24 4/17/97 9:01p Allender
* start of campaign stuff. Campaigns now stored in external file (no
* filenames in code). Continuing campaign won't work at this point
*
* 23 4/03/97 4:26p Lawrance
* adding .wav search to music directory
*
* 22 4/01/97 9:26a Allender
* added support for descent style fonts although they are not used in the
* game yet
*
* 21 3/04/97 8:17a John
* Fixed movie code to not require a file handle. Used CFILE instead.
* Took cfile_get_handle or whatever out.
*
* 20 3/03/97 8:57a Lawrance
* took out cf_returnfp()
*
* 19 3/01/97 2:09p Lawrance
* supporting memory mapped files, moved cfile implementation details into
* .cpp file
*
* 18 2/17/97 3:00p Lawrance
* added .ani type to MAPS_EXT and INTERFACE_EXT
*
* 17 2/07/97 9:00a Lawrance
* added cfread_uint() and cwrite_uint()
*
* 16 2/04/97 9:29a Allender
* added cfwrite* functions
*
* 15 1/22/97 10:48a Lawrance
* supporting AVI playback
*
* 14 12/23/96 10:56a John
* Totally restructured the POF stuff to support multiple
* detail levels in one POF file.
*
*
* 13 11/20/96 10:00a Hoffoss
* Added cfile_chdir() function.
*
* 12 11/13/96 10:14a Allender
* added small routines to read basic data types. Also changed code to
* try to find extensions in more than 1 directory.
*
* 11 11/11/96 3:21p Allender
* added extension for movies
*
* $NoKeywords: $
*/
#ifndef __CFILE_H__
#define __CFILE_H__
#include <time.h>
#include "globalincs/pstypes.h"
#if defined _WIN32
#define DIR_SEPARATOR_CHAR '\\'
#define DIR_SEPARATOR_STR "\\"
#elif defined unix
#define DIR_SEPARATOR_CHAR '/'
#define DIR_SEPARATOR_STR "/"
#else
#error unknown OS
#endif
#define CF_EOF (-1)
#define CF_SEEK_SET (0)
#define CF_SEEK_CUR (1)
#define CF_SEEK_END (2)
typedef struct CFILE {
int id; // Index into cfile.cpp specific structure
int version; // version of this file
} CFILE;
// extra info that can be returned when getting a file listing
typedef struct {
time_t write_time;
} file_list_info;
#define CF_MAX_FILENAME_LENGTH 32 // Includes null terminater, so real length is 31
#define CF_MAX_PATHNAME_LENGTH 256 // Includes null terminater, so real length is 255
#define CF_TYPE_ANY -1 // Used to check in any directory
#define CF_TYPE_INVALID 0
#define CF_TYPE_ROOT 1 // Root must be 1!!
#define CF_TYPE_DATA 2
#define CF_TYPE_MAPS 3
#define CF_TYPE_TEXT 4
#define CF_TYPE_MISSIONS 5
#define CF_TYPE_MODELS 6
#define CF_TYPE_TABLES 7
#define CF_TYPE_SOUNDS 8
#define CF_TYPE_SOUNDS_8B22K 9
#define CF_TYPE_SOUNDS_16B11K 10
#define CF_TYPE_VOICE 11
#define CF_TYPE_VOICE_BRIEFINGS 12
#define CF_TYPE_VOICE_CMD_BRIEF 13
#define CF_TYPE_VOICE_DEBRIEFINGS 14
#define CF_TYPE_VOICE_PERSONAS 15
#define CF_TYPE_VOICE_SPECIAL 16
#define CF_TYPE_VOICE_TRAINING 17
#define CF_TYPE_MUSIC 18
#define CF_TYPE_MOVIES 19
#define CF_TYPE_INTERFACE 20
#define CF_TYPE_FONT 21
#define CF_TYPE_EFFECTS 22
#define CF_TYPE_HUD 23
#define CF_TYPE_PLAYER_MAIN 24
#define CF_TYPE_PLAYER_IMAGES_MAIN 25
#define CF_TYPE_CACHE 26
#define CF_TYPE_PLAYERS 27
#define CF_TYPE_SINGLE_PLAYERS 28
#define CF_TYPE_MULTI_PLAYERS 29
#define CF_TYPE_MULTI_CACHE 30
#define CF_TYPE_CONFIG 31
#define CF_TYPE_SQUAD_IMAGES_MAIN 32
#define CF_TYPE_DEMOS 33
#define CF_TYPE_CBANIMS 34
#define CF_TYPE_INTEL_ANIMS 35
#define CF_MAX_PATH_TYPES 36 // Can be as high as you'd like
// TRUE if type is specified and valid
#define CF_TYPE_SPECIFIED(path_type) (((path_type)>CF_TYPE_INVALID) && ((path_type)<CF_MAX_PATH_TYPES))
// #define's for the type parameter in cfopen.
#define CFILE_NORMAL 0 // open file normally
#define CFILE_MEMORY_MAPPED (1<<0) // open file as a memory-mapped file
#define CF_SORT_NONE 0
#define CF_SORT_NAME 1
#define CF_SORT_TIME 2
#define cfread_fix(file) (fix)cfread_int(file)
#define cfwrite_fix(i,file) cfwrite_int(i,file)
// callback function used for get_file_list() to filter files to be added to list. Return 1
// to add file to list, or 0 to not add it.
extern int (*Get_file_list_filter)(char *filename);
// cfile directory. valid after cfile_init() returns successfully
#define CFILE_ROOT_DIRECTORY_LEN 256
extern char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN];
//================= LOW-LEVEL FUNCTIONS ==================
// Call this once at the beginning of the program
int cfile_init(char *exe_dir,char *cdrom_dir=NULL);
// Call this if pack files got added or removed or the
// cdrom changed. This will refresh the list of filenames
// stored in packfiles and on the cdrom.
void cfile_refresh();
// add an extension to a filename if it doesn't already have it
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(char *filename, char *mode, int type = CFILE_NORMAL, int dir_type = CF_TYPE_ANY, bool localize = false);
// Flush the open file buffer
int cflush(CFILE *cfile);
// version number of opened file. Will be 0 unless you put something else here after you
// open a file. Once set, you can use minimum version numbers with the read functions.
void cf_set_version( CFILE * cfile, int version );
// Deletes a file.
void cf_delete( char *filename, int dir_type );
// Same as _access function to read a file's access bits
int cf_access( char *filename, int dir_type, int mode );
// Returns 1 if file exists, 0 if not.
int cf_exist( char *filename, int dir_type );
// ctmpfile() opens a temporary file stream. File is deleted automatically when closed
CFILE *ctmpfile();
// Closes the file
int cfclose(CFILE *cfile);
// Returns size of file...
int cfilelength(CFILE *fp);
// Reads data
int cfread(void *buf, int elsize, int nelem, CFILE *fp);
// cfwrite() writes to the file
int cfwrite(void *buf, int elsize, int nelem, CFILE *cfile);
// Reads/writes RLE compressed data.
int cfread_compressed(void *buf, int elsize, int nelem, CFILE *cfile);
int cfwrite_compressed(void *param_buf, int param_elsize, int param_nelem, CFILE *cfile);
// Moves the file pointer
int cfseek(CFILE *fp, int offset, int where);
// Returns current position of file.
int cftell(CFILE *fp);
// cfputc() writes a character to a file
int cfputc(int c, CFILE *cfile);
// cfputs() writes a string to a file
int cfputs(char *str, CFILE *cfile);
// cfgetc() reads a character to a file
int cfgetc(CFILE *cfile);
// cfgets() reads a string from a file
char *cfgets(char *buf, int n, CFILE *cfile);
// cfeof() Tests for end-of-file on a stream
int cfeof(CFILE *cfile);
// Return the data pointer associated with the CFILE structure (for memory mapped files)
void *cf_returndata(CFILE *cfile);
// get the 2 byte checksum of the passed filename - return 0 if operation failed, 1 if succeeded
int cf_chksum_short(char *filename, ushort *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
// get the 2 byte checksum of the passed file - return 0 if operation failed, 1 if succeeded
// NOTE : preserves current file position
int cf_chksum_short(CFILE *file, ushort *chksum, int max_size = -1);
// get the 32 bit CRC checksum of the passed filename - return 0 if operation failed, 1 if succeeded
int cf_chksum_long(char *filename, uint *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
// 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);
// convenient for misc checksumming purposes ------------------------------------------
// update cur_chksum with the chksum of the new_data of size new_data_size
ushort cf_add_chksum_short(ushort seed, char *buffer, int size);
// update cur_chksum with the chksum of the new_data of size new_data_size
unsigned long cf_add_chksum_long(unsigned long seed, char *buffer, int size);
// convenient for misc checksumming purposes ------------------------------------------
//================= HIGH LEVEL FUNCTIONS ==================
int cfexist(char *filename); // Returns true if file exists on disk (1) or in hog (2).
// rename a file, utilizing the extension to determine where file is.
#define CF_RENAME_SUCCESS 0 // successfully renamed the file
#define CF_RENAME_FAIL_ACCESS 1 // new name could not be created
#define CF_RENAME_FAIL_EXIST 2 // old name does not exist
int cf_rename(char *old_name, char *name, int type = CF_TYPE_ANY );
// changes the attributes of a file
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
int cfile_flush_dir(int type);
// functions for reading from cfile
// These are all high level, built up from
// cfread.
int cfgetc(CFILE *fp);
char *cfgets(char *buf, size_t n, CFILE *fp);
char cfread_char(CFILE *file, int ver = 0, char deflt = 0);
ubyte cfread_ubyte(CFILE *file, int ver = 0, ubyte deflt = 0);
short cfread_short(CFILE *file, int ver = 0, short deflt = 0);
ushort cfread_ushort(CFILE *file, int ver = 0, ushort deflt = 0);
int cfread_int(CFILE *file, int ver = 0, int deflt = 0);
uint cfread_uint(CFILE *file, int ver = 0, uint deflt = 0);
float cfread_float(CFILE *file, int ver = 0, float deflt = 0.0f);
void cfread_vector(vector *vec, CFILE *file, int ver = 0, vector *deflt = NULL);
void cfread_angles(angles *ang, CFILE *file, int ver = 0, angles *deflt = NULL);
// Reads variable length, null-termined string. Will only read up
// to n characters.
void cfread_string(char *buf,int n, CFILE *file);
// Read a fixed length that is null-terminatedm, and has the length
// stored in file
void cfread_string_len(char *buf,int n, CFILE *file);
// functions for writing cfiles
int cfwrite_char(char c, CFILE *file);
int cfwrite_float(float f, CFILE *file);
int cfwrite_int(int i, CFILE *file);
int cfwrite_uint(uint i, CFILE *file);
int cfwrite_short(short s, CFILE *file);
int cfwrite_ushort(ushort s, CFILE *file);
int cfwrite_ubyte(ubyte u, CFILE *file);
int cfwrite_vector(vector *vec, CFILE *file);
int cfwrite_angles(angles *ang, CFILE *file);
// writes variable length, null-termined string.
int cfwrite_string(char *buf, CFILE *file);
// write a fixed length that is null-terminatedm, and has the length
// stored in file
int cfwrite_string_len(char *buf, CFILE *file);
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 );
// Searches for a file. Follows all rules and precedence and searches
// CD's and pack files.
// Input: filespace - Filename & extension
// pathtype - See CF_TYPE_ defines in CFILE.H
// Output: pack_filename - Absolute path and filename of this file. Could be a packfile or the actual file.
// size - File size
// offset - Offset into pack file. 0 if not a packfile.
// Returns: If not found returns 0.
int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, int *size, int *offset, bool localize = false);
// Functions to change directories
int cfile_chdir(char *dir);
#ifdef _WIN32
int cfile_chdrive(int DriveNum, int flag);
#endif
// push current directory on a 'stack' (so we can restore it) and change the directory
int cfile_push_chdir(int type);
// restore directory on top of the stack
int cfile_pop_dir();
#endif /* __CFILE_H__ */
+287
View File
@@ -0,0 +1,287 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/CFile/CfileArchive.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Low-level code for reading data out of large archive files or normal files. All
* reads/seeks come through here.
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/07/29 19:17:21 penguin
* added #ifdef _WIN32 around windows-specific system headers
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 4 2/22/99 10:31p Andsager
* Get rid of unneeded includes.
*
* 3 1/06/99 2:24p Dave
* Stubs and release build fixes.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 12 5/14/98 8:10p Lawrance
* Fix bug with trying to read past the end of a file (when from a
* packfile).
*
* 11 5/11/98 11:48a John
* fixed bug with memory mapped files
*
* 10 5/11/98 10:59a John
* added in debug code
*
* 9 5/11/98 10:59a John
* Moved the low-level file reading code into cfilearchive.cpp.
*
* 8 4/30/98 4:53p John
* Restructured and cleaned up cfile code. Added capability to read off
* of CD-ROM drive and out of multiple pack files.
*
* 7 4/20/98 11:49a Hoffoss
* Fixed bug with directory name getting.
*
* 6 4/10/98 12:18a Hoffoss
* Make pilot image search in pack file possible.
*
* 5 1/19/98 9:37p Allender
* Great Compiler Warning Purge of Jan, 1998. Used pragma's in a couple
* of places since I was unsure of what to do with code.
*
* 4 12/30/97 5:31p Lawrance
* fixed problem for people that didn't have a VP file
*
* 3 12/30/97 4:31p Sandeep
* Changed pakfile format
*
* 2 12/28/97 12:42p John
* Put in support for reading archive files; Made missionload use the
* cf_get_file_list function. Moved demos directory out of data tree.
*
* 1 12/28/97 11:48a John
*
* $NoKeywords: $
*/
#define _CFILE_INTERNAL
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#ifdef _WIN32
#include <io.h>
#include <direct.h>
#include <windows.h>
#include <winbase.h> /* needed for memory mapping of file functions */
#endif
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
#include "cfile/cfilearchive.h"
#define CHECK_POSITION
// Called once to setup the low-level reading code.
void cf_init_lowlevel_read_code( CFILE * cfile, int offset, int size )
{
Assert(cfile != NULL);
Cfile_block *cb;
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
cb = &Cfile_block_list[cfile->id];
cb->lib_offset = offset;
cb->raw_position = 0;
cb->size = size;
if ( cb->fp ) {
if ( cb->lib_offset ) {
fseek( cb->fp, cb->lib_offset, SEEK_SET );
}
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int raw_position = ftell(cb->fp) - cb->lib_offset;
Assert(raw_position == cb->raw_position);
#endif
}
}
// cfeof() Tests for end-of-file on a stream
//
// returns a nonzero value after the first read operation that attempts to read
// past the end of the file. It returns 0 if the current position is not end of file.
// There is no error return.
int cfeof(CFILE *cfile)
{
Assert(cfile != NULL);
Cfile_block *cb;
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
cb = &Cfile_block_list[cfile->id];
int result;
result = 0;
// cfeof() not supported for memory-mapped files
Assert( !cb->data );
Assert(cb->fp != NULL);
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int raw_position = ftell(cb->fp) - cb->lib_offset;
Assert(raw_position == cb->raw_position);
#endif
if (cb->raw_position >= cb->size ) {
result = 1;
} else {
result = 0;
}
return result;
}
// cftell() returns offset into file
//
// returns: success ==> offset into the file
// error ==> -1
//
int cftell( CFILE * cfile )
{
Assert(cfile != NULL);
Cfile_block *cb;
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
cb = &Cfile_block_list[cfile->id];
// Doesn't work for memory mapped files
Assert( !cb->data );
Assert(cb->fp != NULL);
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int raw_position = ftell(cb->fp) - cb->lib_offset;
Assert(raw_position == cb->raw_position);
#endif
return cb->raw_position;
}
// cfseek() moves the file pointer
//
// returns: success ==> 0
// error ==> non-zero
//
int cfseek( CFILE *cfile, int offset, int where )
{
Assert(cfile != NULL);
Cfile_block *cb;
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
cb = &Cfile_block_list[cfile->id];
// TODO: seek to offset in memory mapped file
Assert( !cb->data );
Assert( cb->fp != NULL );
int goal_position;
switch( where ) {
case CF_SEEK_SET:
goal_position = offset+cb->lib_offset;
break;
case CF_SEEK_CUR:
{
goal_position = cb->raw_position+offset+cb->lib_offset;
}
break;
case CF_SEEK_END:
goal_position = cb->size+offset+cb->lib_offset;
break;
default:
Int3();
return 1;
}
int result = fseek(cb->fp, goal_position, SEEK_SET );
cb->raw_position = goal_position - cb->lib_offset;
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int tmp_offset = ftell(cb->fp) - cb->lib_offset;
Assert(tmp_offset==cb->raw_position);
#endif
return result;
}
// cfread() reads from a file
//
// returns: returns the number of full elements read
//
//
int cfread(void *buf, int elsize, int nelem, CFILE *cfile)
{
Assert(cfile != NULL);
Assert(buf != NULL);
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
Cfile_block *cb;
cb = &Cfile_block_list[cfile->id];
// cfread() not supported for memory-mapped files
Assert( !cb->data );
Assert(cb->fp != NULL);
int size = elsize*nelem;
Assert(nelem > 0);
Assert(elsize > 0);
Assert(size > 0);
if ( (cb->raw_position+size) > cb->size ) {
size = cb->size - cb->raw_position;
if ( size < 1 ) {
return 0;
}
//mprintf(( "CFILE: EOF encountered in file\n" ));
}
int bytes_read = fread( buf, 1, size, cb->fp );
if ( bytes_read > 0 ) {
cb->raw_position += bytes_read;
}
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int tmp_offset = ftell(cb->fp) - cb->lib_offset;
Assert(tmp_offset==cb->raw_position);
#endif
return bytes_read / elsize;
}
+89
View File
@@ -0,0 +1,89 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/CFile/CfileArchive.h $
* $Revision: 2.1 $
* $Date: 2002-07-07 19:55:58 $
* $Author: penguin $
*
* External def's for CfileArchive.cpp. This should only be used
* internally by cfile stuff.
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/17 02:56:19 mharris
* first crack at unix compatibity
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 4 5/11/98 10:59a John
* Moved the low-level file reading code into cfilearchive.cpp.
*
* 3 4/30/98 4:53p John
* Restructured and cleaned up cfile code. Added capability to read off
* of CD-ROM drive and out of multiple pack files.
*
* 2 12/28/97 12:42p John
* Put in support for reading archive files; Made missionload use the
* cf_get_file_list function. Moved demos directory out of data tree.
*
* 1 12/28/97 11:48a John
*
* $NoKeywords: $
*/
#ifndef _CFILEARCHIVE_H
#define _CFILEARCHIVE_H
#ifndef _CFILE_INTERNAL
#error This file should only be included internally in CFILE!!
#endif
// The following Cfile_block data is private to cfile.cpp
// DO NOT MOVE the Cfile_block* information to cfile.h / do not extern this data
//
#define CFILE_BLOCK_UNUSED 0
#define CFILE_BLOCK_USED 1
typedef struct Cfile_block {
int type; // CFILE_BLOCK_UNUSED, CFILE_BLOCK_USED
int dir_type; // directory location
FILE *fp; // File pointer if opening an individual file
void *data; // Pointer for memory-mapped file access. NULL if not mem-mapped.
#ifdef _WIN32
HANDLE hInFile; // Handle from CreateFile()
HANDLE hMapFile; // Handle from CreateFileMapping()
#else
// int fd; // file descriptor
size_t data_length; // length of data for mmap
#endif
int lib_offset;
int raw_position;
int size; // for packed files
} Cfile_block;
#define MAX_CFILE_BLOCKS 64
extern Cfile_block Cfile_block_list[MAX_CFILE_BLOCKS];
extern CFILE Cfile_list[MAX_CFILE_BLOCKS];
// Called once to setup the low-level reading code.
void cf_init_lowlevel_read_code( CFILE * cfile, int offset, int size );
#endif
+493
View File
@@ -0,0 +1,493 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/CFile/CfileList.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Code for doing directory lists and sorts
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/07/29 19:37:21 penguin
* added #ifdef _WIN32 around windows-specific system headers
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 3 2/22/99 10:31p Andsager
* Get rid of unneeded includes.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 6 5/13/98 10:22p John
* Added cfile functions to read/write rle compressed blocks of data.
* Made palman use it for .clr files. Made alphacolors calculate on the
* fly rather than caching to/from disk.
*
* 5 5/06/98 5:30p John
* Removed unused cfilearchiver. Removed/replaced some unused/little used
* graphics functions, namely gradient_h and _v and pixel_sp. Put in new
* DirectX header files and libs that fixed the Direct3D alpha blending
* problems.
*
* 4 4/30/98 4:53p John
* Restructured and cleaned up cfile code. Added capability to read off
* of CD-ROM drive and out of multiple pack files.
*
* 3 4/10/98 12:18a Hoffoss
* Make pilot image search in pack file possible.
*
* 2 3/30/98 10:36p Allender
* be sure to call _findclose() when done reading a file list
*
* 1 12/28/97 11:48a John
*
* $NoKeywords: $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#ifdef _WIN32
#include <io.h>
#include <direct.h>
#include <windows.h>
#include <winbase.h> /* needed for memory mapping of file functions */
#endif
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
// Sorts a list of filenames using the specified sorting method (CF_SORT_*).
// n = number of filenames in list to sort
// list = list of filenames to be sorted
// sort = sorting method to use (one of the CF_SORT_* defines)
// info = extra info for each file. Only required if sorting by time, however if you
// have extra file info, you should pass it as well to get it sorted too (so an
// index into list is the same index for info for that file
void cf_sort_filenames( int n, char **list, int sort, file_list_info *info )
{
int i, j, incr;
char *t;
file_list_info tt;
if (sort == CF_SORT_NAME) {
incr = n / 2;
while (incr > 0) {
for (i=incr; i<n; i++) {
j = i - incr;
while (j >= 0) {
if (stricmp(list[j], list[j + incr]) > 0) {
t = list[j];
list[j] = list[j + incr];
list[j + incr] = t;
if (info) {
tt = info[j];
info[j] = info[j + incr];
info[j + incr] = tt;
}
j -= incr;
} else
break;
}
}
incr /= 2;
}
return;
} else if (sort == CF_SORT_TIME) {
Assert(info);
incr = n / 2;
while (incr > 0) {
for (i=incr; i<n; i++) {
j = i - incr;
while (j >= 0) {
if (info[j].write_time < info[j + incr].write_time) {
t = list[j];
list[j] = list[j + incr];
list[j + incr] = t;
tt = info[j];
info[j] = info[j + incr];
info[j + incr] = tt;
j -= incr;
} else
break;
}
}
incr /= 2;
}
return;
}
nprintf(("Error", "Unknown sorting method %d passed to cf_sort_filenames()\n", sort));
}
// cf_compress - Do Run Length Compression on a block of data. Targa format.
//
// Usage:
// out Buffer to write it out to
// in Buffer to compress
// bytecount Number of bytes input
int cf_compress(char *out, char *in, int bytecount )
{
int pixcount; // number of pixels in the current packet
char *inputpixel=NULL; // current input pixel position
char *matchpixel=NULL; // pixel value to match for a run
char *flagbyte=NULL; // location of last flag byte to set
int rlcount; // current count in r.l. string
int rlthresh; // minimum valid run length
char *copyloc; // location to begin copying at
// set the threshold -- the minimum valid run length
rlthresh = 2; // Require a 2 pixel span before rle'ing
// set the first pixel up
flagbyte = out; // place to put next flag if run
inputpixel = in;
pixcount = 1;
rlcount = 0;
copyloc = (char *)0;
// loop till data processing complete
do {
// if we have accumulated a 128-byte packet, process it
if ( pixcount == 129 ) {
*flagbyte = 127;
// set the run flag if this is a run
if ( rlcount >= rlthresh ) {
*flagbyte |= 0x80;
pixcount = 2;
}
// copy the data into place
++flagbyte;
memmove( flagbyte, copyloc, pixcount-1 );
flagbyte += pixcount-1;
pixcount = 1;
// set up for next packet
continue;
}
// if zeroth byte, handle as special case
if ( pixcount == 1 ) {
rlcount = 0;
copyloc = inputpixel; /* point to 1st guy in packet */
matchpixel = inputpixel; /* set pointer to pix to match */
pixcount = 2;
inputpixel += 1;
continue;
}
// assembling a packet -- look at next pixel
// current pixel == match pixel?
if ( *inputpixel == *matchpixel ) {
// establishing a run of enough length to
// save space by doing it
// -- write the non-run length packet
// -- start run-length packet
if ( ++rlcount == rlthresh ) {
// close a non-run packet
if ( pixcount > (rlcount+1) ) {
// write out length and do not set run flag
*flagbyte++ = (char)(pixcount - 2 - rlthresh);
memmove(flagbyte, copyloc, (pixcount-1-rlcount) );
flagbyte += (pixcount-1-rlcount);
copyloc = inputpixel;
pixcount = rlcount + 1;
}
}
} else {
// no match -- either break a run or continue without one
// if a run exists break it:
// write the bytes in the string (1+1)
// start the next string
if ( rlcount >= rlthresh ) {
*flagbyte++ = (char)(0x80 | rlcount);
memmove(flagbyte, copyloc, 1 );
flagbyte += 1;
pixcount = 1;
continue;
} else {
// not a match and currently not a run
// - save the current pixel
// - reset the run-length flag
rlcount = 0;
matchpixel = inputpixel;
}
}
pixcount++;
inputpixel += 1;
} while ( inputpixel < (in + bytecount));
// quit this buffer without loosing any data
if ( --pixcount >= 1 ) {
*flagbyte = (char)(pixcount - 1);
if ( rlcount >= rlthresh ) {
*flagbyte |= 0x80;
pixcount = 1;
}
// copy the data into place
++flagbyte;
memmove(flagbyte, copyloc, pixcount );
flagbyte += pixcount;
}
return(flagbyte-out);
}
// cf_decompress - Do Decompression on a run-length encoded block of data. Targa format.
//
// Usage:
// out Buffer to write it out to
// in Buffer to compress
// bytecount Number of bytes input
int cf_decompress(char *out, char *in )
{
int count;
char *param_out = out;
while(1) {
count = int(*in++);
int run_span = count & 0x80;
count &= (~0x80);
if ( count > 0 ) {
if ( run_span ) {
// RLE'd data
ubyte c = *in++;
memset( out, c, count );
out += count;
} else {
memmove( out, in, count );
in += count;
out += count;
}
}
}
return out - param_out;
}
// cfread() reads from a file and decompresses it
//
// returns: returns the number of full elements read
//
//
int cfread_compressed(void *buf, int elsize, int nelem, CFILE *cfile)
{
char *out = (char *)buf;
while(1) {
byte count;
if ( cfread( &count, 1, 1, cfile ) != 1 ) {
break;
}
int run_span = count & 0x80;
count &= (~0x80);
count++;
if ( count > 0 ) {
if ( run_span ) {
// RLE'd data
byte c;
if ( cfread( &c, 1, 1, cfile ) != 1 ) {
break;
}
memset( out, c, count );
} else {
if ( cfread( out, 1, count, cfile ) != count ) {
break;
}
}
out += count;
if ( out >= (char *)buf + (elsize*nelem)) {
break;
}
} else {
break;
}
}
return (out - (char *)buf)/elsize;
}
int cfwrite_compressed(void *param_buf, int param_elsize, int param_nelem, CFILE *cfile)
{
char *in = (char *)param_buf;
int bytecount = (param_elsize * param_nelem );
int pixcount; // number of pixels in the current packet
char *inputpixel=NULL; // current input pixel position
char *matchpixel=NULL; // pixel value to match for a run
int rlcount; // current count in r.l. string
int rlthresh; // minimum valid run length
char *copyloc; // location to begin copying at
// set the threshold -- the minimum valid run length
rlthresh = 2; // Require a 2 pixel span before rle'ing
// set the first pixel up
inputpixel = in;
pixcount = 1;
rlcount = 0;
copyloc = (char *)0;
// loop till data processing complete
do {
// if we have accumulated a 128-byte packet, process it
if ( pixcount == 129 ) {
ubyte code = 127;
// set the run flag if this is a run
if ( rlcount >= rlthresh ) {
code |= 0x80;
pixcount = 2;
}
cfwrite( &code, 1, 1, cfile );
// copy the data into place
cfwrite( copyloc, 1, pixcount-1, cfile );
pixcount = 1;
// set up for next packet
continue;
}
// if zeroth byte, handle as special case
if ( pixcount == 1 ) {
rlcount = 0;
copyloc = inputpixel; /* point to 1st guy in packet */
matchpixel = inputpixel; /* set pointer to pix to match */
pixcount = 2;
inputpixel += 1;
continue;
}
// assembling a packet -- look at next pixel
// current pixel == match pixel?
if ( *inputpixel == *matchpixel ) {
// establishing a run of enough length to
// save space by doing it
// -- write the non-run length packet
// -- start run-length packet
if ( ++rlcount == rlthresh ) {
// close a non-run packet
if ( pixcount > (rlcount+1) ) {
// write out length and do not set run flag
ubyte code = (ubyte)(pixcount - 2 - rlthresh);
cfwrite( &code, 1, 1, cfile );
cfwrite( copyloc, 1, (pixcount-1-rlcount), cfile );
copyloc = inputpixel;
pixcount = rlcount + 1;
}
}
} else {
// no match -- either break a run or continue without one
// if a run exists break it:
// write the bytes in the string (1+1)
// start the next string
if ( rlcount >= rlthresh ) {
ubyte code = (ubyte)(0x80 | rlcount);
cfwrite( &code, 1, 1, cfile );
cfwrite( copyloc, 1, 1, cfile );
pixcount = 1;
continue;
} else {
// not a match and currently not a run
// - save the current pixel
// - reset the run-length flag
rlcount = 0;
matchpixel = inputpixel;
}
}
pixcount++;
inputpixel += 1;
} while ( inputpixel < (in + bytecount));
// quit this buffer without loosing any data
if ( --pixcount >= 1 ) {
ubyte code = ubyte(pixcount - 1);
// set the run flag if this is a run
if ( rlcount >= rlthresh ) {
code |= 0x80;
pixcount = 1;
}
cfwrite( &code, 1, 1, cfile );
// copy the data into place
cfwrite( copyloc, 1, pixcount, cfile );
}
return param_nelem;
}
File diff suppressed because it is too large. Load diff
+75
View File
@@ -0,0 +1,75 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/CFile/CfileSystem.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:21 $
* $Author: penguin $
*
* Functions to keep track of and find files that can exist
* on the harddrive, cd-rom, or in a pack file on either of those.
* This keeps a list of all the files in packfiles or on CD-rom
* and when you need a file you call one function which then searches
* all those locations, inherently enforcing precedence orders.
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 3 10/13/98 9:19a Andsager
* Add localization support to cfile. Optional parameter with cfopen that
* looks for localized files.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 5 5/01/98 10:21a John
* Added code to find all pack files in all trees. Added code to create
* any directories that we write to.
*
* 4 4/30/98 10:21p John
* Added code to cleanup cfilesystem
*
* $NoKeywords: $
*/
#ifndef _CFILESYSTEM_H
#define _CFILESYSTEM_H
// Builds a list of all the files
void cf_build_secondary_filelist( char *cdrom_path );
void cf_free_secondary_filelist();
// Internal stuff
typedef struct cf_pathtype {
int index; // To verify that the CF_TYPE define is correctly indexed into this array
char *path; // Path relative to Freespace root, has ending backslash.
char *extensions; // Extensions used in this pathtype, separated by spaces
int parent_index; // Index of this directory's parent. Used for creating directories when writing.
} cf_pathtype;
// During cfile_init, verify that Pathtypes[n].index == n for each item
extern cf_pathtype Pathtypes[CF_MAX_PATH_TYPES];
// Returns the default storage path for files given a
// particular pathtype. In other words, the path to
// the unpacked, non-cd'd, stored on hard drive path.
// If filename isn't null it will also tack the filename
// on the end, creating a completely valid filename.
// Input: pathtype - CF_TYPE_??
// filename - optional, if set, tacks the filename onto end of path.
// Output: path - Fully qualified pathname.
void cf_create_default_path_string( char *path, int pathtype, char *filename=NULL, bool localize = false);
#endif //_CFILESYSTEM_H
@@ -0,0 +1,282 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Cfilearchiver/CfileArchiver.cpp $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:21 $
* $Author: penguin $
*
* Program to create an archive file for use with cfile stuff
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 2 10/23/98 6:15p Dave
*
* $NoKeywords: $
*/
#include <stdlib.h>
#include <stdio.h>
#include <direct.h>
#include <io.h>
#include <string.h>
#include <conio.h>
unsigned int Total_size=16; // Start with size of header
unsigned int Num_files =0;
FILE * fp_out = NULL;
FILE * fp_out_hdr = NULL;
typedef struct vp_header {
char id[4];
int version;
int index_offset;
int num_files;
} vp_header;
//vp_header Vp_header;
char archive_dat[1024];
char archive_hdr[1024];
#define BLOCK_SIZE (1024*1024)
#define VERSION_NUMBER 2;
char tmp_data[BLOCK_SIZE]; // 1 MB
void write_header()
{
fseek(fp_out, 0, SEEK_SET);
fwrite("VPVP", 1, 4, fp_out);
int ver = VERSION_NUMBER;
fwrite(&ver, 1, 4, fp_out);
fwrite(&Total_size, 1, 4, fp_out);
fwrite(&Num_files, 1, 4, fp_out);
}
int write_index(char *hf, char *df)
{
FILE *h = fopen(hf, "rb");
if (!h) return 0;
FILE *d = fopen(df, "a+b");
if (!d) return 0;
for (unsigned int i=0;i<Num_files;i++) {
fread(tmp_data, 32+4+4+4, 1, h);
fwrite(tmp_data, 32+4+4+4, 1, d);
}
fclose(h);
fclose(d);
return 1;
}
void pack_file( char *filespec, char *filename, int filesize, time_t time_write )
{
char path[1024];
if ( strstr( filename, ".vp" )) {
// Don't pack yourself!!
return;
}
if ( strstr( filename, ".hdr" )) {
// Don't pack yourself!!
return;
}
if ( filesize == 0 ) {
// Don't pack 0 length files, screws up directory structure!
return;
}
memset( path, 0, sizeof(path));
strcpy( path, filename );
if ( strlen(filename)>31 ) {
printf( "Filename '%s' too long\n", filename );
exit(1);
}
fwrite( &Total_size, 1, 4, fp_out_hdr );
fwrite( &filesize, 1, 4, fp_out_hdr );
fwrite( &path, 1, 32, fp_out_hdr );
fwrite( &time_write, 1, sizeof(time_t), fp_out_hdr);
Total_size += filesize;
Num_files++;
printf( "Packing %s\\%s...", filespec, filename );
sprintf( path, "%s\\%s", filespec, filename );
FILE *fp = fopen( path, "rb" );
if ( fp == NULL ) {
printf( "Error opening '%s'\n", path );
exit(1);
}
int nbytes, nbytes_read=0;
do {
nbytes = fread( tmp_data, 1, BLOCK_SIZE, fp );
if ( nbytes > 0 ) {
fwrite( tmp_data, 1, nbytes, fp_out );
nbytes_read += nbytes;
}
} while( nbytes > 0 );
fclose(fp);
printf( " %d bytes\n", nbytes_read );
}
// This function adds a directory marker to the header file
void add_directory( char * dirname)
{
char path[256];
char *pathptr = path;
char *tmpptr;
strcpy(path, dirname);
fwrite(&Total_size, 1, 4, fp_out_hdr);
int i = 0;
fwrite(&i, 1, 4, fp_out_hdr);
// strip out any directories that this dir is a subdir of
while ((tmpptr = strchr(pathptr, '\\')) != NULL) {
pathptr = tmpptr+1;
}
fwrite(pathptr, 1, 32, fp_out_hdr);
fwrite(&i, 1, 4, fp_out_hdr); // timestamp = 0
Num_files++;
}
void pack_directory( char * filespec)
{
int find_handle;
_finddata_t find;
char tmp[512];
char tmp1[512];
/*
char dir_name[512];
char *last_slash;
last_slash = strrchr(filespec, '\\');
if ( last_slash ) {
strcpy(dir_name, last_slash+1);
} else {
strcpy(dir_name, filespec);
}
if ( !stricmp(dir_name, "voice") ) {
return;
}
*/
strcpy( tmp1, filespec );
add_directory(filespec);
strcat( tmp1, "\\*.*" );
printf( "In dir '%s'\n", tmp1 );
find_handle = _findfirst( tmp1, &find );
if( find_handle != -1 ) {
if ( find.attrib & _A_SUBDIR ) {
if (strcmp( "..", find.name) && strcmp( ".", find.name)) {
strcpy( tmp, filespec );
strcat( tmp, "\\" );
strcat( tmp, find.name );
pack_directory(tmp);
}
} else {
pack_file( filespec, find.name, find.size, find.time_write );
}
while( !_findnext( find_handle, &find ) ) {
if ( find.attrib & _A_SUBDIR ) {
if (strcmp( "..", find.name) && strcmp( ".", find.name)) {
strcpy( tmp, filespec );
strcat( tmp, "\\" );
strcat( tmp, find.name );
pack_directory(tmp);
}
} else {
pack_file( filespec, find.name, find.size, find.time_write );
}
}
}
add_directory("..");
}
int main(int argc, char *argv[] )
{
char archive[1024];
char *p;
if ( argc < 3 ) {
printf( "Usage: %s archive_name src_dir\n", argv[0] );
printf( "Example: %s freespace c:\\freespace\\data\n", argv[0] );
printf( "Creates an archive named freespace out of the\nfreespace data tree\n" );
printf( "Press any key to exit...\n" );
getch();
return 1;
}
strcpy( archive, argv[1] );
p = strchr( archive, '.' );
if (p) *p = 0; // remove extension
strcpy( archive_dat, archive );
strcat( archive_dat, ".vp" );
strcpy( archive_hdr, archive );
strcat( archive_hdr, ".hdr" );
fp_out = fopen( archive_dat, "wb" );
if ( !fp_out ) {
printf( "Couldn't open '%s'!\n", archive_dat );
printf( "Press any key to exit...\n" );
getch();
return 1;
}
fp_out_hdr = fopen( archive_hdr, "wb" );
if ( !fp_out_hdr ) {
printf( "Couldn't open '%s'!\n", archive_hdr );
printf( "Press any key to exit...\n" );
getch();
return 1;
}
write_header();
pack_directory( argv[2] );
write_header();
fclose(fp_out);
fclose(fp_out_hdr);
printf( "Data files written, appending index...\n" );
if (!write_index(archive_hdr, archive_dat)) {
printf("Error appending index!\n");
printf("Press any key to exit...\n");
getch();
return 1;
}
printf( "%d total KB.\n", Total_size/1024 );
return 0;
}
+648
View File
@@ -0,0 +1,648 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Cmdline/cmdline.cpp $
* $Revision: 2.3 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2002/07/29 06:35:15 DTP
* added -almission commandline arguement, will autoload mission i.e fs2_open.exe -almission kickass will autoload kickass.fs2 which should be a multiplayer mission.
*
* Revision 2.1 2002/07/07 19:55:58 penguin
* Back-port to MSVC
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.3 2002/05/08 17:29:17 mharris
* more port tweaks
*
* Revision 1.2 2002/05/07 13:22:14 mharris
* added pstypes.h include
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 8 8/26/99 8:51p Dave
* Gave multiplayer TvT messaging a heavy dose of sanity. Cheat codes.
*
* 7 7/15/99 3:07p Dave
* 32 bit detection support. Mouse coord commandline.
*
* 6 7/13/99 1:15p Dave
* 32 bit support. Whee!
*
* 5 6/22/99 9:37p Dave
* Put in pof spewing.
*
* 4 1/12/99 5:45p Dave
* Moved weapon pipeline in multiplayer to almost exclusively client side.
* Very good results. Bandwidth goes down, playability goes up for crappy
* connections. Fixed object update problem for ship subsystems.
*
* 3 11/17/98 11:12a Dave
* Removed player identification by address. Now assign explicit id #'s.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 38 10/02/98 3:22p Allender
* fix up the -connect option and fix the -port option
*
* 37 9/15/98 4:04p Allender
* added back in the -ip_addr command line switch because it needs to be
* in the standalone server only executable
*
* 36 9/14/98 11:52a Allender
* don't use cfile
*
* 35 9/14/98 11:28a Allender
* support for server bashing of address when received from client. Added
* a cmdline.cfg file to process command line arguments from a file
*
* 34 9/08/98 2:20p Allender
* temporary code to force IP address to a specific value.
*
* 33 8/20/98 5:30p Dave
* Put in handy multiplayer logfile system. Now need to put in useful
* applications of it all over the code.
*
* 32 8/07/98 10:39a Allender
* fixed debug standalone problem where stats would continually get sent
* to tracker. more debug code to help find stats problem
*
* 31 7/24/98 11:14a Allender
* start of new command line options for version 1.04
*
* 30 5/21/98 1:50a Dave
* Remove obsolete command line functions. Reduce shield explosion packets
* drastically. Tweak PXO screen even more. Fix file xfer system so that
* we can guarantee file uniqueness.
*
* 29 5/18/98 9:10p Dave
* Put in many new PXO features. Fixed skill level bashing in multiplayer.
* Removed several old command line options. Put in network config files.
*
* 28 5/09/98 7:16p Dave
* Put in CD checking. Put in standalone host password. Made pilot into
* popup scrollable.
*
* 27 4/23/98 8:27p Allender
* basic support for cutscene playback. Into movie code in place. Tech
* room can view cutscenes stored in CDROM_dir variable
*
* 26 4/09/98 5:43p Dave
* Remove all command line processing from the demo. Began work fixing up
* the new multi host options screen.
*
* 25 4/02/98 11:40a Lawrance
* check for #ifdef DEMO instead of #ifdef DEMO_RELEASE
*
* 24 4/01/98 5:56p Dave
* Fixed a messaging bug which caused msg_all mode in multiplayer not to
* work. Compile out a host of multiplayer options not available in the
* demo.
*
* 23 3/14/98 2:48p Dave
* Cleaned up observer joining code. Put in support for file xfers to
* ingame joiners (observers or not). Revamped and reinstalled pseudo
* lag/loss system.
*
* 22 2/22/98 12:19p John
* Externalized some strings
*
* 21 1/31/98 4:32p Dave
* Put in new support for VMT player validation, game logging in and game
* logging out.
*
* 20 12/10/97 4:45p Dave
* Added in more detailed support for multiplayer packet lag/loss. Fixed
* some multiplayer stuff. Added some controls to the standalone.
*
* 19 12/09/97 6:14p Lawrance
* add -nomusic flag
*
* 18 12/01/97 5:10p Dave
* Fixed a syntax bug.
*
* 17 12/01/97 4:59p Dave
* Synchronized multiplayer debris objects. Put in pilot popup in main
* hall. Optimized simulated multiplayer lag module. Fixed a potential
* file_xfer bug.
*
* 16 11/28/97 7:04p Dave
* Emergency checkin due to big system crash.
*
* 15 11/28/97 5:06p Dave
* Put in facilities for simulating multiplayer lag.
*
* 14 11/24/97 5:42p Dave
* Fixed a file xfer buffer free/malloc problem. Lengthened command line
* switch string parse length.
*
* 13 11/12/97 4:39p Dave
* Put in multiplayer campaign support parsing, loading and saving. Made
* command-line variables better named. Changed some things on the initial
* pilot select screen.
*
* 12 11/11/97 4:54p Dave
* Put in support for single vs. multiplayer pilots. Put in initial player
* selection screen (no command line option yet). Started work on
* multiplayer campaign file save gaming.
*
* 11 11/11/97 11:55a Allender
* initialize network at beginning of application. create new call to set
* which network protocol to use
*
* 10 9/18/97 10:12p Dave
* Added -gimmemedals, which gives the current pilot all the medals in the
* game (debug)
*
* 9 9/18/97 9:20a Dave
* Minor modifications
*
* 8 9/15/97 11:40p Lawrance
* remove demo granularity switch
*
* 7 9/09/97 3:39p Sandeep
* warning level 4 bugs
*
* 6 9/03/97 5:03p Lawrance
* add support for -nosound command line parm
*
* 5 8/22/97 8:52a Dave
* Removed a return statement which would have broken the parser out too
* early.
*
* 4 8/21/97 4:55p Dave
* Added a switch for multiplayer chat streaming. Added a section for
* global command line vars.
*
* 3 8/06/97 2:26p Dave
* Made the command line parse more robust. Made it easier to add and
* process new command-line switches.
*
* 2 8/04/97 3:13p Dave
* Added command line functions. See cmdline.cpp for directions on adding
* new switches
*
* 1 8/04/97 9:58a Dave
*
* $NoKeywords: $
*/
#include <string.h>
#include <stdlib.h>
#include "globalincs/pstypes.h"
#include "cmdline/cmdline.h"
#include "globalincs/linklist.h"
#include "globalincs/systemvars.h"
#include "network/multi.h"
#include "cfile/cfile.h"
// variables
class cmdline_parm {
public:
cmdline_parm *next, *prev;
char *name; // name of parameter, must start with '-' char
char *help; // help text for this parameter
char *args; // string value for parameter arguements (NULL if no arguements)
int name_found; // true if parameter on command line, otherwise false
cmdline_parm(char *name, char *help);
~cmdline_parm();
int found();
int get_int();
float get_float();
char *str();
};
// here are the command line parameters that we will be using for FreeSpace
cmdline_parm standalone_arg("-standalone", NULL);
cmdline_parm nosound_arg("-nosound", NULL);
cmdline_parm nomusic_arg("-nomusic", NULL);
cmdline_parm startgame_arg("-startgame", NULL);
cmdline_parm gamename_arg("-gamename", NULL);
cmdline_parm gamepassword_arg("-password", NULL);
cmdline_parm gameclosed_arg("-closed", NULL);
cmdline_parm gamerestricted_arg("-restricted", NULL);
cmdline_parm allowabove_arg("-allowabove", NULL);
cmdline_parm allowbelow_arg("-allowbelow", NULL);
cmdline_parm port_arg("-port", NULL);
cmdline_parm connect_arg("-connect", NULL);
cmdline_parm multilog_arg("-multilog", NULL);
cmdline_parm server_firing_arg("-oldfire", NULL);
cmdline_parm client_dodamage("-clientdamage", NULL);
cmdline_parm pof_spew("-pofspew", NULL);
cmdline_parm d3d_32bit("-32bit", NULL);
cmdline_parm mouse_coords("-coords", NULL);
cmdline_parm timeout("-timeout", NULL);
cmdline_parm d3d_window("-window", NULL);
cmdline_parm almission_arg("-almission", NULL); //DTP for autoload Multi mission
int Cmdline_multi_stream_chat_to_file = 0;
int Cmdline_freespace_no_sound = 0;
int Cmdline_freespace_no_music = 0;
int Cmdline_gimme_all_medals = 0;
int Cmdline_use_last_pilot = 0;
int Cmdline_multi_protocol = -1;
int Cmdline_cd_check = 1;
int Cmdline_start_netgame = 0;
int Cmdline_closed_game = 0;
int Cmdline_restricted_game = 0;
int Cmdline_network_port = -1;
char *Cmdline_game_name = NULL;
char *Cmdline_game_password = NULL;
char *Cmdline_rank_above= NULL;
char *Cmdline_rank_below = NULL;
char *Cmdline_connect_addr = NULL;
char *Cmdline_almission = NULL; //DTP FOR AUTO-LOAD Multi MISSION
int Cmdline_multi_log = 0;
int Cmdline_server_firing = 0;
int Cmdline_client_dodamage = 0;
int Cmdline_spew_pof_info = 0;
int Cmdline_force_32bit = 0;
int Cmdline_mouse_coords = 0;
int Cmdline_timeout = -1;
int Cmdline_window = 0;
static cmdline_parm Parm_list(NULL, NULL);
static int Parm_list_inited = 0;
// Return true if this character is an extra char (white space and quotes)
int is_extra_space(char ch)
{
return ((ch == ' ') || (ch == '\t') || (ch == 0x0a) || (ch == '\'') || (ch == '\"'));
}
// eliminates all leading and trailing extra chars from a string. Returns pointer passed in.
char *drop_extra_chars(char *str)
{
int s, e;
s = 0;
while (str[s] && is_extra_space(str[s]))
s++;
e = strlen(str) - 1;
while (e > s) {
if (!is_extra_space(str[e])){
break;
}
e--;
}
if (e > s){
memmove(str, str + s, e - s + 1);
}
str[e - s + 1] = 0;
return str;
}
// internal function - copy the value for a parameter agruement into the cmdline_parm arg field
void parm_stuff_args(cmdline_parm *parm, char *cmdline)
{
char buffer[1024];
memset(buffer, 0, 1024);
char *dest = buffer;
cmdline += strlen(parm->name);
while ((*cmdline != 0) && (*cmdline != '-')) {
*dest++ = *cmdline++;
}
drop_extra_chars(buffer);
// mwa 9/14/98 -- made it so that newer command line arguments found will overwrite
// the old arguments
// Assert(parm->args == NULL);
if ( parm->args != NULL ) {
delete( parm->args );
parm->args = NULL;
}
int size = strlen(buffer) + 1;
if (size > 0) {
parm->args = new char[size];
memset(parm->args, 0, size);
strcpy(parm->args, buffer);
}
}
// 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)
{
// locate command line parameters
cmdline_parm *parmp;
char *cmdline_offset;
for (parmp = GET_FIRST(&Parm_list); parmp !=END_OF_LIST(&Parm_list); parmp = GET_NEXT(parmp) ) {
cmdline_offset = strstr(cmdline, parmp->name);
if (cmdline_offset) {
parmp->name_found = 1;
parm_stuff_args(parmp, cmdline_offset);
}
}
}
// validate the command line parameters. Display an error if an unrecognized parameter is located.
void os_validate_parms(char *cmdline)
{
cmdline_parm *parmp;
char seps[] = " ,\t\n";
char *token;
int parm_found;
token = strtok(cmdline, seps);
while(token != NULL) {
if (token[0] == '-') {
parm_found = 0;
for (parmp = GET_FIRST(&Parm_list); parmp !=END_OF_LIST(&Parm_list); parmp = GET_NEXT(parmp) ) {
if (!stricmp(parmp->name, token)) {
parm_found = 1;
break;
}
}
if (parm_found == 0) {
Error(LOCATION,"Unrecogzined command line parameter %s", token);
}
}
token = strtok(NULL, seps);
}
}
// Call once to initialize the command line system
//
// cmdline - command line string passed to the application
void os_init_cmdline(char *cmdline)
{
FILE *fp;
// 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
fp = fopen("data\\cmdline.cfg", "rt");
// if the file exists, get a single line, and deal with it
if ( fp ) {
char buf[1024], *p;
fgets(buf, 1024, fp);
// replace the newline character with a NUL:
if ( (p = strrchr(buf, '\n')) != NULL ) {
*p = '\0';
}
os_parse_parms(buf);
os_validate_parms(buf);
fclose(fp);
}
os_parse_parms(cmdline);
os_validate_parms(cmdline);
}
// arg constructor
// name_ - name of the parameter, must start with '-' character
// help_ - help text for this parameter
cmdline_parm::cmdline_parm(char *name_, char *help_)
{
name = name_;
help = help_;
args = NULL;
name_found = 0;
if (Parm_list_inited == 0) {
list_init(&Parm_list);
Parm_list_inited = 1;
}
if (name != NULL) {
list_append(&Parm_list, this);
}
}
// destructor - frees any allocated memory
cmdline_parm::~cmdline_parm()
{
if (args) {
delete [] args;
args = NULL;
}
}
// returns - true if the parameter exists on the command line, otherwise false
int cmdline_parm::found()
{
return name_found;
}
// returns - the interger representation for the parameter arguement
int cmdline_parm::get_int()
{
Assert(args);
return atoi(args);
}
// returns - the float representation for the parameter arguement
float cmdline_parm::get_float()
{
Assert(args);
return (float)atof(args);
}
// returns - the string value for the parameter arguement
char *cmdline_parm::str()
{
Assert(args);
return args;
}
// external entry point into this modules
#ifdef _WIN32
int parse_cmdline(char *cmdline)
#else
int parse_cmdline(int argc, char *argv[])
#endif
{
#ifdef _WIN32
os_init_cmdline(cmdline);
#else
if (argc > 1) {
// kind of silly -- combine arg list into single string for parsing,
// but it fits with the win32-centric existing code.
char *cmdline = NULL;
unsigned int arglen = 0;
int i;
for (i = 1; i < argc; i++)
arglen += strlen(argv[i]);
if (argc > 2)
arglen += argc - 2; // leave room for the separators
cmdline = new char [arglen+1];
i = 1;
strcpy(cmdline, argv[i]);
for ( ; i < argc; i++) {
strcat(cmdline, " ");
strcat(cmdline, argv[i]);
}
os_init_cmdline(cmdline);
delete [] cmdline;
} else {
// no cmdline args
os_init_cmdline("");
}
#endif
// is this a standalone server??
if (standalone_arg.found()) {
Is_standalone = 1;
}
// run with no sound
if ( nosound_arg.found() ) {
Cmdline_freespace_no_sound = 1;
}
// run with no music
if ( nomusic_arg.found() ) {
Cmdline_freespace_no_music = 1;
}
// should we start a network game
if ( startgame_arg.found() ) {
Cmdline_use_last_pilot = 1;
Cmdline_start_netgame = 1;
}
// closed network game
if ( gameclosed_arg.found() ) {
Cmdline_closed_game = 1;
}
// restircted network game
if ( gamerestricted_arg.found() ) {
Cmdline_restricted_game = 1;
}
// get the name of the network game
if ( gamename_arg.found() ) {
Cmdline_game_name = gamename_arg.str();
// be sure that this string fits in our limits
if ( strlen(Cmdline_game_name) > MAX_GAMENAME_LEN ) {
Cmdline_game_name[MAX_GAMENAME_LEN-1] = '\0';
}
}
// get the password for a pssword game
if ( gamepassword_arg.found() ) {
Cmdline_game_password = gamepassword_arg.str();
// be sure that this string fits in our limits
if ( strlen(Cmdline_game_name) > MAX_PASSWD_LEN ) {
Cmdline_game_name[MAX_PASSWD_LEN-1] = '\0';
}
}
// set the rank above/below arguments
if ( allowabove_arg.found() ) {
Cmdline_rank_above = allowabove_arg.str();
}
if ( allowbelow_arg.found() ) {
Cmdline_rank_below = allowbelow_arg.str();
}
// get the port number for games
if ( port_arg.found() ) {
Cmdline_network_port = port_arg.get_int();
}
// the connect argument specifies to join a game at this particular address
if ( connect_arg.found() ) {
Cmdline_use_last_pilot = 1;
Cmdline_connect_addr = connect_arg.str();
}
// see if the multilog flag was set
if ( multilog_arg.found() ){
Cmdline_multi_log = 1;
}
// maybe use old-school server-side firing
if (server_firing_arg.found() ){
Cmdline_server_firing = 1;
}
// maybe use old-school client damage
if(client_dodamage.found()){
Cmdline_client_dodamage = 1;
}
// spew pof info
if(pof_spew.found()){
Cmdline_spew_pof_info = 1;
}
// 32 bit
if(d3d_32bit.found()){
Cmdline_force_32bit = 1;
}
// mouse coords
if(mouse_coords.found()){
Cmdline_mouse_coords = 1;
}
// net timeout
if(timeout.found()){
Cmdline_timeout = timeout.get_int();
}
// d3d windowed
if(d3d_window.found()){
Cmdline_window = 1;
}
if(almission_arg.found()){//DTP for autoload mission // developer oritentated
Cmdline_almission = almission_arg.str();
Cmdline_use_last_pilot = 1;
Cmdline_start_netgame = 1;
}
return 1;
}
+203
View File
@@ -0,0 +1,203 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Cmdline/cmdline.h $
* $Revision: 2.2 $
* $Date: 2002-07-29 06:35:15 $
* $Author: DTP $
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/07/07 19:55:58 penguin
* Back-port to MSVC
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/08 17:29:17 mharris
* more port tweaks
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 8 8/26/99 8:51p Dave
* Gave multiplayer TvT messaging a heavy dose of sanity. Cheat codes.
*
* 7 7/15/99 3:07p Dave
* 32 bit detection support. Mouse coord commandline.
*
* 6 7/13/99 1:15p Dave
* 32 bit support. Whee!
*
* 5 6/22/99 9:37p Dave
* Put in pof spewing.
*
* 4 1/12/99 5:45p Dave
* Moved weapon pipeline in multiplayer to almost exclusively client side.
* Very good results. Bandwidth goes down, playability goes up for crappy
* connections. Fixed object update problem for ship subsystems.
*
* 3 11/17/98 11:12a Dave
* Removed player identification by address. Now assign explicit id #'s.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 27 9/15/98 4:04p Allender
* added back in the -ip_addr command line switch because it needs to be
* in the standalone server only executable
*
* 26 9/14/98 11:28a Allender
* support for server bashing of address when received from client. Added
* a cmdline.cfg file to process command line arguments from a file
*
* 25 9/08/98 2:20p Allender
* temporary code to force IP address to a specific value.
*
* 24 8/20/98 5:30p Dave
* Put in handy multiplayer logfile system. Now need to put in useful
* applications of it all over the code.
*
* 23 8/07/98 10:40a Allender
* new command line flags for starting netgames. Only starting currently
* works, and PXO isn't implemented yet
*
* 22 7/24/98 11:14a Allender
* start of new command line options for version 1.04
*
* 21 5/21/98 1:50a Dave
* Remove obsolete command line functions. Reduce shield explosion packets
* drastically. Tweak PXO screen even more. Fix file xfer system so that
* we can guarantee file uniqueness.
*
* 20 5/18/98 9:10p Dave
* Put in many new PXO features. Fixed skill level bashing in multiplayer.
* Removed several old command line options. Put in network config files.
*
* 19 5/09/98 7:16p Dave
* Put in CD checking. Put in standalone host password. Made pilot into
* popup scrollable.
*
* 18 4/23/98 8:27p Allender
* basic support for cutscene playback. Into movie code in place. Tech
* room can view cutscenes stored in CDROM_dir variable
*
* 17 3/14/98 2:48p Dave
* Cleaned up observer joining code. Put in support for file xfers to
* ingame joiners (observers or not). Revamped and reinstalled pseudo
* lag/loss system.
*
* 16 1/31/98 4:32p Dave
* Put in new support for VMT player validation, game logging in and game
* logging out.
*
* 15 12/10/97 4:45p Dave
* Added in more detailed support for multiplayer packet lag/loss. Fixed
* some multiplayer stuff. Added some controls to the standalone.
*
* 14 12/09/97 6:14p Lawrance
* add -nomusic flag
*
* 13 11/28/97 7:04p Dave
* Emergency checkin due to big system crash.
*
* 12 11/28/97 5:06p Dave
* Put in facilities for simulating multiplayer lag.
*
* 11 11/24/97 5:42p Dave
* Fixed a file xfer buffer free/malloc problem. Lengthened command line
* switch string parse length.
*
* 10 11/12/97 4:39p Dave
* Put in multiplayer campaign support parsing, loading and saving. Made
* command-line variables better named. Changed some things on the initial
* pilot select screen.
*
* 9 11/11/97 4:54p Dave
* Put in support for single vs. multiplayer pilots. Put in initial player
* selection screen (no command line option yet). Started work on
* multiplayer campaign file save gaming.
*
* 8 9/18/97 10:13p Dave
* Added -gimmemedals, which gives the current pilot all the medals in the
* game (debug)
*
* 7 9/18/97 9:20a Dave
* Minor modifications
*
* 6 9/15/97 11:40p Lawrance
* remove demo granularity switch
*
* 5 9/03/97 5:03p Lawrance
* add support for -nosound command line parm
*
* 4 8/21/97 4:55p Dave
* Added a switch for multiplayer chat streaming. Added a section for
* global command line vars.
*
* 3 8/06/97 2:26p Dave
* Made the command line parse more robust. Made it easier to add and
* process new command-line switches.
*
* 2 8/04/97 3:13p Dave
* Added command line functions. See cmdline.cpp for directions on adding
* new switches
*
* 1 8/04/97 9:58a Dave
*
* $NoKeywords: $
*/
#ifndef FS_CMDLINE_HEADER_FILE
#define FS_CMDLINE_HEADER_FILE
#ifdef _WIN32
int parse_cmdline(char *cmdline);
#else
int parse_cmdline(int argc, char *argv[]);
#endif
// COMMAND LINE SETTINGS
// This section is for reference by all the *_init() functions. For example, the multiplayer init function
// could check to see if (int Cmdline_multi_stream_chat_to_file) has been set by the command line parser.
//
// Add any extern definitions here and put the actual variables inside of cmdline.cpp for ease of use
// Also, check to make sure anything you add doesn't break Fred or TestCode
extern int Cmdline_multi_stream_chat_to_file;
extern int Cmdline_freespace_no_sound;
extern int Cmdline_freespace_no_music;
extern int Cmdline_gimme_all_medals;
extern int Cmdline_use_last_pilot;
extern int Cmdline_cd_check;
extern int Cmdline_start_netgame;
extern int Cmdline_closed_game;
extern int Cmdline_restricted_game;
extern int Cmdline_network_port;
extern char *Cmdline_game_name;
extern char *Cmdline_game_password;
extern char *Cmdline_rank_above;
extern char *Cmdline_rank_below;
extern char *Cmdline_connect_addr;
extern int Cmdline_multi_log;
extern int Cmdline_server_firing;
extern int Cmdline_client_dodamage;
extern int Cmdline_spew_pof_info;
extern int Cmdline_force_32bit;
extern int Cmdline_mouse_coords;
extern int Cmdline_timeout;
extern int Cmdline_window;
extern char *Cmdline_almission; //DTP for autoload mission
#endif
+495
View File
@@ -0,0 +1,495 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/CMeasure/CMeasure.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Counter measures. Created by Mike Kulas, May 12, 1997.
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/03 22:07:08 mharris
* got some stuff to compile
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 5 9/05/99 11:25p Mikek
* Debug code (only on NDEBUG). Don't drop countermeasures if
* Ai_firing_enabled not set.
*
* 4 11/05/98 5:55p Dave
* Big pass at reducing #includes
*
* 3 10/13/98 9:28a Dave
* Started neatening up freespace.h. Many variables renamed and
* reorganized. Added AlphaColors.[h,cpp]
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 44 4/29/98 9:36p Allender
* ingame join tweaks. added network message for countermeasures
*
* 43 4/13/98 5:11p Mike
* More improvement to countermeasure code.
*
* 42 4/13/98 2:14p Mike
* Countermeasure balance testing for Jim.
*
* 41 4/10/98 11:02p Mike
* Make countermeasures less effective against aspect seekers than against
* heat seekers.
* Make AI ships match bank with each other when attacking a faraway
* target.
* Make ships not do silly loop-de-loop sometimes when attacking a faraway
* target.
*
* 40 3/31/98 5:11p John
* Removed demo/save/restore. Made NDEBUG defined compile. Removed a
* bunch of debug stuff out of player file. Made model code be able to
* unload models and malloc out only however many models are needed.
*
* 39 3/17/98 3:49p John
* Turned off lighting on counter measures.
*
* 38 2/26/98 10:07p Hoffoss
* Rewrote state saving and restoring to fix bugs and simplify the code.
*
* 37 2/23/98 5:44p Johnson
* Resolve build error.
*
* 36 2/23/98 4:30p Mike
* Make homing missiles detonate after they pass up their target. Make
* countermeasures less effective.
*
* 35 2/09/98 8:04p Lawrance
* Add objnum to cmeasure struct, correctly set source_objnum
*
* 34 2/05/98 11:20p Lawrance
* save/restore countermeasure data
*
* 33 2/05/98 12:51a Mike
* Early asteroid stuff.
*
* 32 2/04/98 12:20p Mike
* Make countermeasures detonate in a smaller radius. Make all in radius,
* not just homing one, detonate.
*
* 31 1/29/98 11:48a John
* Added new counter measure rendering as model code. Made weapons be
* able to have impact explosion.
*
* 30 1/29/98 11:11a John
* Put in code to show dummy counter measure object.
*
* 29 1/23/98 5:06p John
* Took L out of vertex structure used B (blue) instead. Took all small
* fireballs out of fireball types and used particles instead. Fixed some
* debris explosion things. Restructured fireball code. Restructured
* some lighting code. Made dynamic lighting on by default. Made groups
* of lasers only cast one light. Made fireballs not cast light.
*
* 28 1/23/98 9:43a Mike
* Debug-C to disallow countermeasure firing.
* Fix bug in countermeasure tracking by aspect seekers.
*
* 27 1/20/98 9:47a Mike
* Suppress optimized compiler warnings.
* Some secondary weapon work.
*
* 26 1/16/98 11:43a Mike
* Fix countermeasures.
*
* 25 12/30/97 6:44p John
* Made g3_Draw_bitmap functions account for aspect of bitmap.
*
* 24 11/29/97 2:05p John
* made g3_draw_bitmap and g3_draw_rotated bitmap take w&h, not w/2 & h/2,
* like they used to incorrectly assume. Added code to model to read in
* thruster radius's.
*
* 23 10/27/97 3:24p Lawrance
* ensure countermeasures keep their initial velocity
*
* 22 9/14/97 4:50p Lawrance
* added some demo debugging code
*
* 21 9/04/97 5:09p Andsager
* implement physics using moment of inertia and mass (from BSPgen).
* Added to phys_info struct. Updated ship_info, polymodel structs.
* Updated weapon ($Mass and $Force) and ship ($Mass -> $Density) tables
*
* 20 8/20/97 11:09a Mike
* Make countermeasure lifetime based on skill level.
*
* 19 8/13/97 9:50p Allender
* split *_move into *_process_pre and *_process_post functions.
* process_pre functions called before object is moved. _process_post
* functions called after object is moved. Reordered code in ship_post
* and weapon_post for multiplayer
*
* 18 8/13/97 4:45p Allender
* fixed ship_fire_primary and fire_secondary to not take parameter for
* determining whether to count ammo or not. Fixed countermeasure firing
* for multiplayer
*
* 17 8/13/97 12:06p Lawrance
* supporting multiple types of fireball explosions
*
* 16 8/11/97 6:03p Mike
* Make ships with no shields not claim to have shields in target box.
*
* 15 8/08/97 4:29p Allender
* countermeasure stuff for multiplayer
*
* 14 7/31/97 5:55p John
* made so you pass flags to obj_create.
* Added new collision code that ignores any pairs that will never
* collide.
*
* 13 7/15/97 12:03p Andsager
* New physics stuff
*
* 12 7/11/97 11:54a John
* added rotated 3d bitmaps.
*
* 11 6/24/97 10:04a Allender
* major multiplayer improvements. Better sequencing before game.
* Dealing with weapon/fireball/counter measure objects between
* client/host.
*
* 10 6/24/97 12:38a Lawrance
* fix minor bug with cycling cmeasure
*
* 9 6/05/97 1:37a Lawrance
* change syntax of a snd_play()
*
* 8 5/22/97 5:45p Mike
* Better countermeasure firing, key off availability, specify in
* weapons.tbl
*
* 7 5/22/97 12:06p Lawrance
* include Sound.h for playing sound fx
*
* 6 5/22/97 12:04p Lawrance
* added soundhook for cmeasure cycle
*
* 5 5/15/97 5:05p Mike
* In the midst of changing subsystem targetnig from type-based to
* pointer-based.
* Also allowed you to view a target while dead.
*
* 4 5/14/97 4:08p Lawrance
* removing my_index from game arrays
*
* 3 5/14/97 10:50a Mike
* More countermeasure stuff.
*
* 2 5/12/97 5:58p Mike
* Add countermeasures.
*
* 1 5/12/97 2:23p Mike
*
* $NoKeywords: $
*/
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
#include "cmeasure/cmeasure.h"
#include "freespace2/freespace.h"
#include "math/vecmat.h"
#include "graphics/2d.h"
#include "render/3d.h"
#include "model/model.h"
#include "physics/physics.h"
#include "math/floating.h"
#include "model/model.h"
#include "ship/ship.h"
#include "io/timer.h"
#include "fireball/fireballs.h"
#include "radar/radar.h"
#include "mission/missionparse.h" // For MAX_SPECIES_NAMES
#include "gamesnd/gamesnd.h"
#include "object/objectsnd.h"
#include "sound/sound.h"
#include "math/staticrand.h"
cmeasure_info Cmeasure_info[MAX_CMEASURE_TYPES];
cmeasure Cmeasures[MAX_CMEASURES];
int Num_cmeasure_types = 0;
int Num_cmeasures = 0;
int Cmeasure_inited = 0;
int Cmeasures_homing_check = 0;
int Countermeasures_enabled = 1; // Debug, set to 0 means no one can fire countermeasures.
// This will get called at the start of each level.
void cmeasure_init()
{
int i;
if ( !Cmeasure_inited ) {
Cmeasure_inited = 1;
/* // Do all the processing that happens only once
if ( Debris_model < 0 ) {
if (Debris_model>-1) {
polymodel * pm;
pm = model_get(Debris_model);
Debris_num_submodels = pm->n_models;
}
}
for (i=0; i<MAX_SPECIES_NAMES; i++ ) {
Debris_textures[i] = bm_load( Debris_texture_files[i] );
if ( Debris_textures[i] < 0 ) {
Warning( LOCATION, "Couldn't load species %d debris\ntexture, '%s'\n", i, Debris_texture_files[i] );
}
}
*/
}
// Reset everything between levels
Num_cmeasures = 0;
for (i=0; i<MAX_CMEASURES; i++ ) {
Cmeasures[i].subtype = CMEASURE_UNUSED;
}
}
void cmeasure_render(object * objp)
{
// JAS TODO: Replace with proper fireball
cmeasure *cmp;
cmeasure_info *cmip;
cmp = &Cmeasures[objp->instance];
cmip = &Cmeasure_info[cmp->subtype];
if ( cmp->subtype == CMEASURE_UNUSED ) {
Int3(); // Hey, what are we doing in here?
return;
}
// float size = -1.0f;
// vertex p;
// g3_rotate_vertex(&p, &objp->pos );
// if ( rand() > RAND_MAX/2 ) {
// gr_set_color( 255, 0, 0 );
// } else {
// gr_set_color( 255, 255, 255 );
// }
// g3_draw_sphere(&p, 100.0f );
if ( cmip->model_num > -1 ) {
model_clear_instance(cmip->model_num);
model_render(cmip->model_num, &objp->orient, &objp->pos, MR_NO_LIGHTING );
} else {
mprintf(( "Not rendering countermeasure because model_num is negative\n" ));
}
/*
// JAS TODO: Replace with proper fireball
int framenum = -1;
float size = -1.0f;
vertex p;
cmeasure *cmp;
fireball_data *fd;
cmp = &Cmeasures[objp->instance];
fd = &Fireball_data[FIREBALL_SHIP_EXPLODE1];
switch (cmp->subtype) {
case CMEASURE_UNUSED:
Int3(); // Hey, what are we doing in here?
break;
default:
framenum = (int) (fd->num_frames * Cmeasures[objp->instance].lifeleft*4) % fd->num_frames;
size = objp->radius;
break;
}
Assert(framenum != -1);
Assert(size != -1.0f);
gr_set_bitmap(fd->bitmap_id + framenum);
g3_rotate_vertex(&p, &objp->pos );
g3_draw_bitmap(&p, 0, size*0.5f, TMAP_FLAG_TEXTURED );
*/
}
void cmeasure_delete( object * objp )
{
int num;
num = objp->instance;
// Assert( Cmeasures[num].objnum == OBJ_INDEX(objp));
Cmeasures[num].subtype = CMEASURE_UNUSED;
Num_cmeasures--;
Assert( Num_cmeasures >= 0 );
}
// broke cmeasure_move into two functions -- process_pre and process_post (as was done with
// all *_move functions). Nothing to do for process_pre
void cmeasure_process_pre( object *objp, float frame_time)
{
}
void cmeasure_process_post(object * objp, float frame_time)
{
int num;
num = objp->instance;
// Assert( Cmeasures[num].objnum == objnum );
cmeasure *cmp = &Cmeasures[num];
if ( cmp->lifeleft >= 0.0f) {
cmp->lifeleft -= frame_time;
if ( cmp->lifeleft < 0.0f ) {
objp->flags |= OF_SHOULD_BE_DEAD;
// demo_do_flag_dead(OBJ_INDEX(objp));
}
}
}
float Skill_level_cmeasure_life_scale[NUM_SKILL_LEVELS] = {3.0f, 2.0f, 1.5f, 1.25f, 1.0f};
// creates one countermeasure. A ship fires 1 of these per launch. rand_val is used
// in multiplayer. If -1, then create a random number. If non-negative, use this
// number for static_rand functions
int cmeasure_create( object * source_obj, vector * pos, int cm_type, int rand_val )
{
int n, objnum, parent_objnum, arand;
object * obj;
ship *shipp;
cmeasure *cmp;
cmeasure_info *cmeasurep;
#ifndef NDEBUG
if (!Countermeasures_enabled || !Ai_firing_enabled)
return -1;
#endif
Cmeasures_homing_check = 2; // Tell homing code to scan everything for two frames. If only one frame, get sync problems due to objects being created at end of frame!
parent_objnum = OBJ_INDEX(source_obj);
Assert( source_obj->type == OBJ_SHIP );
Assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS );
shipp = &Ships[source_obj->instance];
if ( Num_cmeasures >= MAX_CMEASURES)
return -1;
for (n=0; n<MAX_CMEASURES; n++ )
if ( Cmeasures[n].subtype == CMEASURE_UNUSED)
break;
if ( n == MAX_CMEASURES)
return -1;
nprintf(("Network", "Cmeasure created by %s\n", Ships[source_obj->instance].ship_name));
cmp = &Cmeasures[n];
cmeasurep = &Cmeasure_info[cm_type];
if ( pos == NULL )
pos = &source_obj->pos;
objnum = obj_create( OBJ_CMEASURE, parent_objnum, n, &source_obj->orient, pos, 1.0f, OF_RENDERS | OF_PHYSICS );
Assert( objnum >= 0 && objnum < MAX_OBJECTS );
// Create Debris piece n!
if ( rand_val == -1 )
arand = myrand(); // use a random number to get lifeleft, and random vector for displacement from ship
else
arand = rand_val;
cmp->lifeleft = static_randf(arand) * (cmeasurep->life_max - cmeasurep->life_min) / cmeasurep->life_min;
if (source_obj->flags & OF_PLAYER_SHIP){
cmp->lifeleft *= Skill_level_cmeasure_life_scale[Game_skill_level];
}
cmp->lifeleft = cmeasurep->life_min + cmp->lifeleft * (cmeasurep->life_max - cmeasurep->life_min);
// cmp->objnum = objnum;
cmp->team = shipp->team;
cmp->subtype = cm_type;
cmp->objnum = objnum;
cmp->source_objnum = parent_objnum;
cmp->source_sig = Objects[objnum].signature;
cmp->flags = 0;
nprintf(("Jim", "Frame %i: Launching countermeasure #%i\n", Framecount, Objects[objnum].signature));
obj = &Objects[objnum];
Num_cmeasures++;
vector vel, rand_vec;
vm_vec_scale_add(&vel, &source_obj->phys_info.vel, &source_obj->orient.vec.fvec, -25.0f);
static_randvec(arand+1, &rand_vec);
vm_vec_scale_add2(&vel, &rand_vec, 2.0f);
obj->phys_info.vel = vel;
vm_vec_zero(&obj->phys_info.rotvel);
// blow out his reverse thrusters. Or drag, same thing.
obj->phys_info.rotdamp = 10000.0f;
obj->phys_info.side_slip_time_const = 10000.0f;
vm_vec_zero(&obj->phys_info.max_vel); // make so he can't turn on his own VOLITION anymore.
obj->phys_info.max_vel.xyz.z = -25.0f;
vm_vec_copy_scale(&obj->phys_info.desired_vel, &obj->orient.vec.fvec, obj->phys_info.max_vel.xyz.z );
vm_vec_zero(&obj->phys_info.max_rotvel); // make so he can't change speed on his own VOLITION anymore.
// obj->phys_info.flags |= PF_USE_VEL;
return arand; // need to return this value for multiplayer purposes
}
void cmeasure_select_next(object *objp)
{
ship *shipp;
Assert(objp->type == OBJ_SHIP);
shipp = &Ships[objp->instance];
shipp->current_cmeasure++;
if (shipp->current_cmeasure >= Num_cmeasure_types)
shipp->current_cmeasure = 0;
//snd_play( &Snds[SND_CMEASURE_CYCLE] );
mprintf(("Countermeasure type set to %i in frame %i\n", shipp->current_cmeasure, Framecount));
}
+173
View File
@@ -0,0 +1,173 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/CMeasure/CMeasure.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Counter measures. Created by Mike Kulas, May 12, 1997.
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 3 11/05/98 5:55p Dave
* Big pass at reducing #includes
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 20 4/11/98 5:17p Jim
* Reduced countermeasure firing rate from 2 times per second to 3 times
* per second.
*
* 19 4/10/98 11:02p Mike
* Make countermeasures less effective against aspect seekers than against
* heat seekers.
* Make AI ships match bank with each other when attacking a faraway
* target.
* Make ships not do silly loop-de-loop sometimes when attacking a faraway
* target.
*
* 18 4/01/98 5:34p John
* Made only the used POFs page in for a level. Reduced some interp
* arrays. Made custom detail level work differently.
*
* 17 2/26/98 10:07p Hoffoss
* Rewrote state saving and restoring to fix bugs and simplify the code.
*
* 16 2/23/98 4:30p Mike
* Make homing missiles detonate after they pass up their target. Make
* countermeasures less effective.
*
* 15 2/09/98 8:04p Lawrance
* Add objnum to cmeasure struct, correctly set source_objnum
*
* 14 2/05/98 11:20p Lawrance
* save/restore countermeasure data
*
* 13 1/29/98 11:48a John
* Added new counter measure rendering as model code. Made weapons be
* able to have impact explosion.
*
* 12 1/16/98 11:43a Mike
* Fix countermeasures.
*
* 11 8/13/97 9:50p Allender
* split *_move into *_process_pre and *_process_post functions.
* process_pre functions called before object is moved. _process_post
* functions called after object is moved. Reordered code in ship_post
* and weapon_post for multiplayer
*
* 10 8/13/97 4:45p Allender
* fixed ship_fire_primary and fire_secondary to not take parameter for
* determining whether to count ammo or not. Fixed countermeasure firing
* for multiplayer
*
* 9 8/08/97 4:29p Allender
* countermeasure stuff for multiplayer
*
* 8 7/09/97 12:04a Mike
* Error prevention in matrix_interpolate().
*
* 7 6/24/97 10:04a Allender
* major multiplayer improvements. Better sequencing before game.
* Dealing with weapon/fireball/counter measure objects between
* client/host.
*
* 6 5/22/97 5:45p Mike
* Better countermeasure firing, key off availability, specify in
* weapons.tbl
*
* 5 5/15/97 5:05p Mike
* In the midst of changing subsystem targetnig from type-based to
* pointer-based.
* Also allowed you to view a target while dead.
*
* 4 5/14/97 4:08p Lawrance
* removing my_index from game arrays
*
* 3 5/14/97 10:50a Mike
* More countermeasure stuff.
*
* 2 5/12/97 5:58p Mike
* Add countermeasures.
*
* 1 5/12/97 2:23p Mike
*
* $NoKeywords: $
*/
#ifndef _CMEASURE_H
#define _CMEASURE_H
#include "parse/parselo.h"
#include "object/object.h"
#define MAX_CMEASURES 64
// Goes in cmeasure.subtype
#define CMEASURE_UNUSED -1
#define MAX_CMEASURE_TYPES 3
#define CMEASURE_WAIT 333 // delay in milliseconds between countermeasure firing.
#define CMF_DUD_HEAT 0x01 // If set, this cmeasure is a dud to heat seekers. Set at create time.
#define CMF_DUD_ASPECT 0x02 // If set, this cmeasure is a dud to aspect seekers. Set at create time.
#define CMF_DUD (CMF_DUD_HEAT | CMF_DUD_ASPECT)
// Maximum distance at which a countermeasure can be tracked
// If this value is too large, missiles will always be tracking countermeasures.
#define MAX_CMEASURE_TRACK_DIST 300.0f
typedef struct cmeasure_info {
char cmeasure_name[NAME_LENGTH];
float max_speed; // launch speed, relative to ship
float fire_wait; // time between launches
float life_min, life_max; // lifetime will be in range min..max.
int launch_sound; // Sound played when launched.
char pof_name[NAME_LENGTH];
int model_num; // What this renders as
} cmeasure_info;
typedef struct cmeasure {
int flags; // You know, flag type things.
int subtype; // See CMEASURE_??? defines
int objnum;
int source_objnum; // What object this came from
int source_sig; // Signature of the source object
int team; // Team of the ship where the cmeasure came from
float lifeleft; // When 0 or less object dies
} cmeasure;
extern cmeasure_info Cmeasure_info[MAX_CMEASURE_TYPES];
extern cmeasure Cmeasures[MAX_CMEASURES];
extern int Num_cmeasure_types;
extern int Num_cmeasures;
extern int Cmeasures_homing_check;
extern void cmeasure_init();
extern void cmeasure_render( object * obj );
extern void cmeasure_delete( object * obj );
extern void cmeasure_process_pre( object * obj, float frame_time);
extern void cmeasure_process_post( object * obj, float frame_time);
extern int cmeasure_create( object * source_obj, vector *pos, int cm_type, int rand_val = -1 );
extern void cmeasure_select_next(object *objp);
#endif // _CMEASURE_H
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,489 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfig.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:21 $
* $Author: penguin $
*
* Header file for keyboard, joystick and mouse configuration
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 6 8/22/99 5:53p Dave
* Scoring fixes. Added self destruct key. Put callsigns in the logfile
* instead of ship designations for multiplayer players.
*
* 5 8/19/99 10:59a Dave
* Packet loss detection.
*
* 4 8/01/99 12:39p Dave
* Added HUD contrast control key (for nebula).
*
* 3 11/05/98 4:18p Dave
* First run nebula support. Beefed up localization a bit. Removed all
* conditional compiles for foreign versions. Modified mission file
* format.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 26 6/13/98 5:19p Hoffoss
* externalized control config texts.
*
* 25 5/15/98 8:37p Lawrance
* Add 'equalize recharge rates' and 'target ship that sent last
* transmission' key bindings
*
* 24 5/14/98 5:32p Hoffoss
* Improved axis binding code some more.
*
* 23 5/13/98 7:15p Hoffoss
* Fixed remaining bugs with axis binding.
*
* 22 5/13/98 1:17a Hoffoss
* Added joystick axes configurability.
*
* 21 4/30/98 9:43p Hoffoss
* Added new actions for free look movement which are default bounded to
* the hat.
*
* 20 4/25/98 1:59p Lawrance
* fix merge typo
*
* 19 4/25/98 1:24p Lawrance
* Add time compression keys to key config
*
* 18 4/25/98 12:43p Allender
* added new shortcut key for attack my subsystem
*
* 17 4/18/98 5:00p Dave
* Put in observer zoom key. Made mission sync screen more informative.
*
* 16 4/10/98 12:47p Allender
* changed working on replay popup. Don't reference repair in comm menu.
* Added Shift-R for repair me
*
* 15 4/08/98 11:11a Hoffoss
* Fixed some bugs that showed up due to fixing other bugs the other day
* with controls.
*
* 14 3/31/98 4:15p Hoffoss
* Disabled the show objectives action.
*
* 13 3/23/98 12:27p Hoffoss
* Whoops, changed order in list but forget to actually change the number.
*
* 12 3/23/98 11:35a Hoffoss
* Fixed #defines that were out of sync.
*
* 11 3/19/98 5:04p Dave
* Put in support for targeted multiplayer text and voice messaging (all,
* friendly, hostile, individual).
*
* 10 3/11/98 5:28p Hoffoss
* Added control config debug display info to possibly aid in tracking
* down a bug.
*
* 9 2/28/98 7:02p Lawrance
* overhaul on-line help
*
* 8 2/26/98 12:33a Lawrance
* Added back slew mode, lots of changes to external and chase views.
*
* 7 2/02/98 6:59p Lawrance
* Adding new targeting keys (bomb, uninspected cargo, new ship, live
* turrets).
*
* 6 1/30/98 10:40a Lawrance
* remove any binding references to hotkey screen
*
* 5 1/28/98 6:19p Dave
* Reduced standalone memory usage ~8 megs. Put in support for handling
* multiplayer submenu handling for endgame, etc.
*
* 4 1/22/98 4:53p Hoffoss
* Made training messages/directives display a joystick button in place of
* a keypress if there is no keypress bound to the action.
*
* 3 1/02/98 4:42p Allender
* removed unused key bindings from control config list
*
* 2 12/30/97 4:47p Allender
* work with ignore my target command. Added new keyboard hotkey. Made
* it work globally
*
* 1 12/24/97 11:59a Hoffoss
*
* 41 11/24/97 10:20p Lawrance
* Add key 'KEY_N' to target next ship on monitoring view
*
* 40 11/21/97 5:57p Hoffoss
* Fixed bug where timef type controls weren't checking joystick buttons.
*
* 39 11/20/97 1:08a Lawrance
* add support for 'R' key - target closest friendly repair ship
*
* 38 11/17/97 6:40p Lawrance
* Changed 'I' key to toggle of extended target info, moved target closest
* locked missile to 'L'
*
* 37 11/02/97 1:15p Hoffoss
* Externed an array I need elsewhere.
*
* 36 10/28/97 12:12a Lawrance
* remove unused keys (Alt-H and Alt-F)
*
* 35 10/24/97 11:00p Hoffoss
* Controls config screen much improved.
*
* 34 10/22/97 4:50p Hoffoss
* Disabled throttle by default.
*
* 33 10/21/97 7:05p Hoffoss
* Overhauled the key/joystick control structure and usage throughout the
* entire FreeSpace code. The whole system is very different now.
*
* 32 10/18/97 7:19p Hoffoss
* Added timestamp recording when a key is pressed.
*
* 31 9/14/97 10:24p Lawrance
* add damage screen popup window
*
* 30 9/10/97 6:02p Hoffoss
* Added code to check for key-pressed sexp operator in FreeSpace as part
* of training mission stuff.
*
* 29 9/09/97 9:18a Hoffoss
* Added message token translation (phase 1) to FreeSpace for training
* missions support.
*
* 28 8/31/97 6:38p Lawrance
* pass in frametime to do_frame loop
*
* 27 8/29/97 5:02p Sandeep
* fixed joystick support for shield config
*
* 26 8/25/97 12:24a Lawrance
* added keys for shield management
*
* 25 8/22/97 10:44p Sandeep
* Added Configurable support for energy management keys, keyboard and
* joystick
*
* 24 8/21/97 5:03p Sandeep
* Fixed joystick functions past "Target Closest Hostile Targeting Self"
* bug.
*
* 23 8/20/97 4:22p Sandeep
* Add support for joystick mapping to all keyboard configurable commands.
* Changed pilot file to allow support for new joystick, incompatible
* version 33
*
* 22 8/07/97 11:27p Lawrance
* add support for 4th joystick axis (rudder), add new option to roll ship
*
* 21 7/08/97 11:37a Lawrance
* add joystick support for afterburners
*
* 20 7/01/97 11:52a Lawrance
* add targeting key, allow player to clear all bindings
*
* 19 6/24/97 12:38a Lawrance
* added in some new joystick bindings
*
* 18 6/17/97 8:57p Lawrance
* added target previous hostile/friendly
*
* 17 6/03/97 1:39a Allender
* made macros for joystick button id's
*
* 16 5/28/97 9:53a Lawrance
* move goals keys and squadmate message key from function keys to
* assignable keys
*
* 15 5/26/97 5:49p Lawrance
* supporting max range on radar
*
* 14 5/26/97 3:31p Lawrance
* assign key bindings for view modes and view controls
*
* 13 5/14/97 10:50a Mike
* More countermeasure stuff.
*
* 12 4/24/97 2:40p Lawrance
* add key for targeting closest ship attacking self
*
* 11 4/05/97 3:46p Allender
* lots 'o messaging stuff. Make shortcut keys for squadmate messaging
* work. Make menus a little more dynamic
*
* 10 4/01/97 7:50p Lawrance
* added many new keys, don't allow Shft or Alt as action keys, only allow
* Ctrl as an action key
*
* 9 3/10/97 8:30a Lawrance
* changed -/+ 5% throttle keys to 1/3 2/3 throttle keys
*
* 8 12/18/96 6:09p Lawrance
* allowing shift+alt+ctrl modifiers on keyboard bindings
*
* 7 12/18/96 10:18a Lawrance
* integrating joystick axis configuration
*
* 6 12/17/96 11:10a Lawrance
* added targeting of subsystem in reticle
*
* 5 12/06/96 12:27a Lawrance
* adding support for joystick configuration
*
* 4 12/05/96 2:47p Lawrance
* changed how keyboard configuration was done to make code more easily
* changeable
*
* 3 12/03/96 10:11p Lawrance
* Integrating keyboard configuration
*
* 2 12/03/96 3:45p Lawrance
*
* $NoKeywords: $
*
*/
#ifndef CONTROLS_CONFIG_H
#define CONTROLS_CONFIG_H
#define CONTROL_CONFIG_XSTR 507
#define JOY_X_AXIS 0
#define JOY_Y_AXIS 1
#define JOY_Z_AXIS 2
#define JOY_RX_AXIS 3
#define JOY_RY_AXIS 4
#define JOY_RZ_AXIS 5
#define NUM_JOY_AXIS_ACTIONS 5
#define JOY_HEADING_AXIS 0
#define JOY_PITCH_AXIS 1
#define JOY_BANK_AXIS 2
#define JOY_ABS_THROTTLE_AXIS 3
#define JOY_REL_THROTTLE_AXIS 4
// --------------------------------------------------
// different types of controls that can be assigned
// --------------------------------------------------
#define CC_TYPE_TRIGGER 0
#define CC_TYPE_CONTINUOUS 1
typedef struct config_item {
short key_default; // default key bound to action
short joy_default; // default joystick button bound to action
char tab; // what tab (catagory) it belongs in
char *text; // describes the action in the config screen
char type; // manner control should be checked in
short key_id; // actual key bound to action
short joy_id; // joystick button bound to action
int used; // has control been used yet in mission? If so, this is the timestamp
} config_item;
// --------------------------------------------------
// Keyboard #defines for the actions
// This is the value of the id field in config_item
// --------------------------------------------------
// targeting a ship
#define TARGET_NEXT 0
#define TARGET_PREV 1
#define TARGET_NEXT_CLOSEST_HOSTILE 2
#define TARGET_PREV_CLOSEST_HOSTILE 3
#define TOGGLE_AUTO_TARGETING 4
#define TARGET_NEXT_CLOSEST_FRIENDLY 5
#define TARGET_PREV_CLOSEST_FRIENDLY 6
#define TARGET_SHIP_IN_RETICLE 7
#define TARGET_CLOSEST_SHIP_ATTACKING_TARGET 8
#define TARGET_LAST_TRANMISSION_SENDER 9
#define STOP_TARGETING_SHIP 10
// targeting a ship's subsystem
#define TARGET_SUBOBJECT_IN_RETICLE 11
#define TARGET_NEXT_SUBOBJECT 12
#define TARGET_PREV_SUBOBJECT 13
#define STOP_TARGETING_SUBSYSTEM 14
// speed matching
#define MATCH_TARGET_SPEED 15
#define TOGGLE_AUTO_MATCH_TARGET_SPEED 16
// weapons
#define FIRE_PRIMARY 17
#define FIRE_SECONDARY 18
#define CYCLE_NEXT_PRIMARY 19
#define CYCLE_PREV_PRIMARY 20
#define CYCLE_SECONDARY 21
#define CYCLE_NUM_MISSLES 22
#define LAUNCH_COUNTERMEASURE 23
// controls
#define FORWARD_THRUST 24
#define REVERSE_THRUST 25
#define BANK_LEFT 26
#define BANK_RIGHT 27
#define PITCH_FORWARD 28
#define PITCH_BACK 29
#define YAW_LEFT 30
#define YAW_RIGHT 31
// throttle control
#define ZERO_THROTTLE 32
#define MAX_THROTTLE 33
#define ONE_THIRD_THROTTLE 34
#define TWO_THIRDS_THROTTLE 35
#define PLUS_5_PERCENT_THROTTLE 36
#define MINUS_5_PERCENT_THROTTLE 37
// squadmate messaging keys
#define ATTACK_MESSAGE 38
#define DISARM_MESSAGE 39
#define DISABLE_MESSAGE 40
#define ATTACK_SUBSYSTEM_MESSAGE 41
#define CAPTURE_MESSAGE 42
#define ENGAGE_MESSAGE 43
#define FORM_MESSAGE 44
#define IGNORE_MESSAGE 45
#define PROTECT_MESSAGE 46
#define COVER_MESSAGE 47
#define WARP_MESSAGE 48
#define REARM_MESSAGE 49
#define TARGET_CLOSEST_SHIP_ATTACKING_SELF 50
// Views
#define VIEW_CHASE 51
#define VIEW_EXTERNAL 52
#define VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK 53
#define VIEW_SLEW 54
#define VIEW_OTHER_SHIP 55
#define VIEW_DIST_INCREASE 56
#define VIEW_DIST_DECREASE 57
#define VIEW_CENTER 58
#define PADLOCK_UP 59
#define PADLOCK_DOWN 60
#define PADLOCK_LEFT 61
#define PADLOCK_RIGHT 62
#define RADAR_RANGE_CYCLE 63
#define SQUADMSG_MENU 64
#define SHOW_GOALS 65
#define END_MISSION 66
#define TARGET_TARGETS_TARGET 67
#define AFTERBURNER 68
#define INCREASE_WEAPON 69
#define DECREASE_WEAPON 70
#define INCREASE_SHIELD 71
#define DECREASE_SHIELD 72
#define INCREASE_ENGINE 73
#define DECREASE_ENGINE 74
#define ETS_EQUALIZE 75
#define SHIELD_EQUALIZE 76
#define SHIELD_XFER_TOP 77
#define SHIELD_XFER_BOTTOM 78
#define SHIELD_XFER_LEFT 79
#define SHIELD_XFER_RIGHT 80
#define XFER_SHIELD 81
#define XFER_LASER 82
#define SHOW_DAMAGE_POPUP 83 // AL: this binding should be removing next time the controls are reorganized
#define BANK_WHEN_PRESSED 84
#define SHOW_NAVMAP 85
#define ADD_REMOVE_ESCORT 86
#define ESCORT_CLEAR 87
#define TARGET_NEXT_ESCORT_SHIP 88
#define TARGET_CLOSEST_REPAIR_SHIP 89
#define TARGET_NEXT_UNINSPECTED_CARGO 90
#define TARGET_PREV_UNINSPECTED_CARGO 91
#define TARGET_NEWEST_SHIP 92
#define TARGET_NEXT_LIVE_TURRET 93
#define TARGET_PREV_LIVE_TURRET 94
#define TARGET_NEXT_BOMB 95
#define TARGET_PREV_BOMB 96
// multiplayer messaging keys
#define MULTI_MESSAGE_ALL 97
#define MULTI_MESSAGE_FRIENDLY 98
#define MULTI_MESSAGE_HOSTILE 99
#define MULTI_MESSAGE_TARGET 100
// multiplayer misc keys
#define MULTI_OBSERVER_ZOOM_TO 101
#define TIME_SPEED_UP 102
#define TIME_SLOW_DOWN 103
#define TOGGLE_HUD_CONTRAST 104
#define MULTI_TOGGLE_NETINFO 105
#define MULTI_SELF_DESTRUCT 106
// this should be the total number of control action defines above (or last define + 1)
#define CCFG_MAX 107
extern int Failed_key_index;
extern int Invert_heading;
extern int Invert_pitch;
extern int Invert_roll;
extern int Invert_thrust;
extern int Disable_axis2;
extern int Disable_axis3;
extern int Axis_map_to[];
extern int Invert_axis[];
extern int Invert_axis_defaults[];
extern config_item Control_config[]; // stores the keyboard configuration
extern char **Scan_code_text;
extern char **Joy_button_text;
// initialize common control config stuff - call at game startup after localization has been initialized
void control_config_common_init();
void control_config_init();
void control_config_do_frame(float frametime);
void control_config_close();
void control_config_cancel_exit();
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);
int check_control(int id, int key = -1);
void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr);
void control_used(int id);
void control_config_clear();
void clear_key_binding(short key);
void control_check_indicate();
void control_config_clear_used_status();
#endif
@@ -0,0 +1,870 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfigCommon.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* C module for keyboard, joystick and mouse configuration common stuff (between Fred and FreeSpace)
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 14 11/01/99 3:36p Jefff
* had scan code texts for y and z in german swapped
*
* 13 11/01/99 2:16p Jefff
* minor key name change in german
*
* 12 10/29/99 6:10p Jefff
* squashed the damned y/z german issues once and for all
*
* 11 10/28/99 11:16p Jefff
* Changed some german key names. Made key translations always use the
* english table.
*
* 10 10/28/99 2:05a Jefff
* revised some german key names. changed some y/z switch stuff.
*
* 9 10/25/99 5:39p Jefff
* swap init binding for y and z keys in German builds
*
* 8 9/01/99 2:56p Jefff
* a few control key description changes
*
* 7 8/22/99 5:53p Dave
* Scoring fixes. Added self destruct key. Put callsigns in the logfile
* instead of ship designations for multiplayer players.
*
* 6 8/19/99 10:59a Dave
* Packet loss detection.
*
* 5 8/01/99 12:39p Dave
* Added HUD contrast control key (for nebula).
*
* 4 7/23/99 2:57p Andsager
* fix translate_key_to_index to work with localization
*
* 3 11/05/98 4:18p Dave
* First run nebula support. Beefed up localization a bit. Removed all
* conditional compiles for foreign versions. Modified mission file
* format.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 41 6/19/98 3:51p Lawrance
* localize control text
*
* 40 6/17/98 11:05a Lawrance
* localize the control config strings
*
* 39 5/24/98 2:28p Hoffoss
* Because we never really care about if the left or the right shift or
* alt key was used, but rather than either shift or alt was used, made
* both map to the left one. Solves some problems, causes none.
*
* 38 5/22/98 11:21a Hoffoss
* Added bank when pressed back in.
*
* 37 5/15/98 8:37p Lawrance
* Add 'equalize recharge rates' and 'target ship that sent last
* transmission' key bindings
*
* 36 5/13/98 7:15p Hoffoss
* Fixed remaining bugs with axis binding.
*
* 35 5/13/98 1:17a Hoffoss
* Added joystick axes configurability.
*
* 34 5/12/98 11:25a Hoffoss
* Disabled bank when pressed action.
*
* 33 5/09/98 10:48p Lawrance
* change text for view bindings
*
* 32 5/09/98 4:52p Lawrance
* Implement padlock view (up/rear/left/right)
*
* 31 4/30/98 9:43p Hoffoss
* Added new actions for free look movement which are default bounded to
* the hat.
*
* 30 4/25/98 1:25p Lawrance
* Add time compression keys to key config
*
* 29 4/25/98 12:43p Allender
* added new shortcut key for attack my subsystem
*
* 28 4/18/98 5:00p Dave
* Put in observer zoom key. Made mission sync screen more informative.
*
* 27 4/17/98 1:24a Lawrance
* fix spelling error
*
* 26 4/15/98 11:06a Lawrance
* fix bug with a multi key showing up in demo, remove obsolete bindings
* from demo and full version
*
* 25 4/10/98 12:47p Allender
* changed working on replay popup. Don't reference repair in comm menu.
* Added Shift-R for repair me
*
* 24 4/08/98 11:11a Hoffoss
* Fixed some bugs that showed up due to fixing other bugs the other day
* with controls.
*
* 23 4/07/98 4:06p Lawrance
* Change binding next for bomb targeting
*
* 22 4/07/98 1:52p Lawrance
* fix error in binding text for energy keys
*
* 21 4/06/98 11:17a Hoffoss
* Fixed num lock/pause interplay bug.
*
* 20 4/01/98 6:46p Lawrance
* change text for Alt+J
*
* 19 3/31/98 4:15p Hoffoss
* Disabled the show objectives action.
*
* 18 3/25/98 2:16p Dave
* Select random default image for newly created pilots. Fixed several
* multi-pause messaging bugs. Begin work on online help for multiplayer
* keys.
*
* 17 3/19/98 5:04p Dave
* Put in support for targeted multiplayer text and voice messaging (all,
* friendly, hostile, individual).
*
* 16 3/17/98 11:25a Hoffoss
* Fixed some of the action's names.
*
* 15 3/17/98 10:48a Hoffoss
* Allowed a special hack for "bank while pressed" action to use alt and
* shift keys standalone.
*
* 14 2/28/98 9:47p Lawrance
* change some binding text
*
* 13 2/28/98 7:02p Lawrance
* overhaul on-line help
*
* 12 2/26/98 12:33a Lawrance
* Added back slew mode, lots of changes to external and chase views.
*
* 11 2/23/98 11:25a Sandeep
* added default keys
*
* 10 2/22/98 6:27p Lawrance
* External mode takes precedence over chase mode. Fix bug with repair
* ships docking in chase mode.
*
* 9 2/22/98 12:19p John
* Externalized some strings
*
* 8 2/02/98 6:59p Lawrance
* Adding new targeting keys (bomb, uninspected cargo, new ship, live
* turrets).
*
* 7 1/27/98 4:24p Allender
* moved hotkey selection to F3 instead of X. Made palette flash
* disappear in multiplayer pause menu
*
* 6 1/22/98 4:53p Hoffoss
* Made training messages/directives display a joystick button in place of
* a keypress if there is no keypress bound to the action.
*
* 5 1/22/98 4:15p Hoffoss
* Added code to allow popup to tell player he needs to bind a key for the
* training mission.
*
* 4 1/02/98 4:42p Allender
* removed unused key bindings from control config list
*
* 3 12/30/97 4:47p Allender
* work with ignore my target command. Added new keyboard hotkey. Made
* it work globally
*
* 2 12/24/97 3:37p Hoffoss
* Moved control config stuff to seperate library to Fred can access it as
* well.
*
* 1 12/24/97 3:27p Hoffoss
*
* 1 12/24/97 11:58a Hoffoss
*
* 98 12/22/97 2:15p Hoffoss
* Fixed bug where joystick axis lines weren't being displayed.
*
* 97 12/16/97 2:44p Hoffoss
* Added clear button to control config screen.
*
* 96 12/12/97 3:07p Hoffoss
* Changed how deleting bindings work. Each control of an action can be
* deleted independently or both at once.
*
* 95 12/07/97 2:36p John
* Made warp out be Alt+J instead of J
*
* 94 12/03/97 4:59p Hoffoss
* Added reset sound and change control config sounds around.
*
* 93 12/03/97 4:16p Hoffoss
* Changed sound stuff used in interface screens for interface purposes.
*
* 92 12/01/97 5:25p Hoffoss
* Routed interface sound playing through a special function that will
* only allow one instance of the sound to play at a time, avoiding
* over-mixing problems.
*
* 91 12/01/97 3:38p Hoffoss
* Changed placement of 'More' indicator.
*
* 90 11/25/97 3:49p Hoffoss
* Changed subhilighting to happen when mouse is over line, rather than
* mouse button down but not up again yet.
*
* 89 11/24/97 10:20p Lawrance
* Add key 'KEY_N' to target next ship on monitoring view
*
* 88 11/24/97 6:15p Lawrance
* fix button scroll problem
*
* 87 11/23/97 6:15p Hoffoss
* Make exiting the controls config screen save the pilot, so changes keep
* even if programs crashes or something.
*
* 86 11/21/97 5:57p Hoffoss
* Fixed bug where timef type controls weren't checking joystick buttons.
*
* 85 11/21/97 4:06p Hoffoss
* Fixed bug with enabling of axis are reversed.
*
* 84 11/20/97 4:47p Hoffoss
* Swapped throttle and rudder, which apparently were backwards.
*
* 83 11/20/97 4:00p Lawrance
* set z to a valid value
*
* 82 11/20/97 3:52p Hoffoss
* Made "None" appear if no control is bound to function.
*
* 81 11/20/97 2:10p Hoffoss
* Added defaults for joystick buttons 2 and 3.
*
* 80 11/20/97 1:08a Lawrance
* add support for 'R' key - target closest friendly repair ship
*
* 79 11/19/97 8:33p Hoffoss
* New controls config screen baby!
*
* 78 11/17/97 7:09p Hoffoss
* Made chase view control a trigger type.
*
* 77 11/17/97 6:40p Lawrance
* Changed 'I' key to toggle of extended target info, moved target closest
* locked missile to 'L'
*
* 76 11/17/97 3:26p Jasen
* Adjusted coordinates for the help button .ani location
*
* 75 11/16/97 3:51p Hoffoss
* Added more button to config screen when scrolling allowed.
*
* 74 11/16/97 3:20p Hoffoss
* Added various suggestions from the Todolist.
*
* 73 11/14/97 4:33p Mike
* Change Debug key to backquote (from F11).
* Balance a ton of subsystems in ships.tbl.
* Change "Heavy Laser" to "Disruptor".
*
* 72 11/12/97 2:54p Hoffoss
* Made modifiers non-stand alone, added support for red tabs on
* conflicts.
*
* 71 10/30/97 6:01p Hoffoss
* Changed screen to utilize the new text color standards.
*
* 70 10/29/97 7:25p Hoffoss
* Added crude support for UI button double click checking.
*
* 69 10/29/97 6:32p Hoffoss
* Changed some interface apperances.
*
* 68 10/29/97 4:54p Hoffoss
* Changed scan_code_text element for Enter to 'Enter' instead of 'a' with
* a caret over it (what's that all about?)
*
* 67 10/28/97 10:42a Hoffoss
* Fixed handling of continuous controls that have modifiers to the key.
*
* 66 10/28/97 10:03a Hoffoss
* Fixed bug with continuous type controls not registering if pressed and
* released too quickly. Also some other little changes.
*
* 65 10/28/97 12:12a Lawrance
* remove unused keys (Alt-H and Alt-F)
*
* 64 10/27/97 12:23p Hoffoss
* Improved warning system and fixed coloring bug.
*
* 63 10/27/97 11:39a Hoffoss
* Added control conflicts checking.
*
* 62 10/26/97 3:20p Hoffoss
* Added many missing features to control config screen.
*
* 61 10/25/97 5:41p Hoffoss
* More functionality added to the controls config screen.
*
* 60 10/24/97 11:00p Hoffoss
* Controls config screen much improved.
*
* 59 10/22/97 4:50p Hoffoss
* Disabled throttle by default.
*
* 58 10/22/97 11:00a Hoffoss
* Changed VIEW_SLEW and VIEW_EXTERNAL to be continuous rather than
* trigger actions.
*
* 57 10/21/97 7:05p Hoffoss
* Overhauled the key/joystick control structure and usage throughout the
* entire FreeSpace code. The whole system is very different now.
*
* 56 10/18/97 7:19p Hoffoss
* Added timestamp recording when a key is pressed.
*
* 55 10/13/97 4:33p Hoffoss
* Made training messages go away after time.
*
* 54 10/13/97 3:24p Hoffoss
* Made it so training message text can be arbitrarily bolded.
*
* 53 9/24/97 4:52p Hoffoss
* Changed training message key token handling, and implemented a new
* training message system method to test out for a while.
*
* 52 9/14/97 10:24p Lawrance
* add damage screen popup window
*
* 51 9/10/97 6:02p Hoffoss
* Added code to check for key-pressed sexp operator in FreeSpace as part
* of training mission stuff.
*
* 50 9/09/97 3:39p Sandeep
* warning level 4 bugs
* $NoKeywords: $
*
*/
#include "controlconfig/controlsconfig.h"
#include "io/key.h"
#include "io/joy.h"
#include "localization/localize.h"
#define TARGET_TAB 0
#define SHIP_TAB 1
#define WEAPON_TAB 2
#define COMPUTER_TAB 3
int Failed_key_index;
// assume control keys are used as modifiers until we find out
int Shift_is_modifier;
int Ctrl_is_modifier;
int Alt_is_modifier;
int Axis_enabled[JOY_NUM_AXES] = { 1, 1, 1, 0, 0, 0 };
int Axis_enabled_defaults[JOY_NUM_AXES] = { 1, 1, 1, 0, 0, 0 };
int Invert_axis[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
int Invert_axis_defaults[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
// arrays which hold the key mappings. The array index represents a key-independent action.
//
//XSTR:OFF
config_item Control_config[CCFG_MAX + 1] = {
// targeting a ship
{ KEY_T, -1, TARGET_TAB, "Target Next Ship" },
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, "Target Previous Ship" },
{ KEY_H, 2, TARGET_TAB, "Target Next Closest Hostile Ship" },
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, "Target Previous Closest Hostile Ship" },
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, "Toggle Auto Targeting" },
{ KEY_F, -1, TARGET_TAB, "Target Next Closest Friendly Ship" },
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, "Target Previous Closest Friendly Ship" },
{ KEY_Y, 4, TARGET_TAB, "Target Ship in Reticle" },
{ KEY_G, -1, TARGET_TAB, "Target Target's Nearest Attacker" },
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, "Target Last Ship to Send Transmission" },
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, "Turn Off Auto-Targeting" },
// targeting a ship's subsystem
{ KEY_V, -1, TARGET_TAB, "Target Subsystem in Reticle" },
{ KEY_S, -1, TARGET_TAB, "Target Next Subsystem" },
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, "Target Previous Subsystem" },
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, "Turn Off Auto-Targeting of Subsystems" },
// matching speed
{ KEY_M, -1, COMPUTER_TAB, "Match Target Speed" },
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, "Toggle Auto Speed Matching" },
// weapons
{ KEY_LCTRL, 0, WEAPON_TAB, "Fire Primary Weapon", CC_TYPE_CONTINUOUS },
{ KEY_SPACEBAR, 1, WEAPON_TAB, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS },
{ KEY_PERIOD, -1, WEAPON_TAB, "Cycle Forward Primary Weapon" },
{ KEY_COMMA, -1, WEAPON_TAB, "Cycle Backward Primary Weapon" },
{ KEY_DIVIDE, -1, WEAPON_TAB, "Cycle Secondary Weapon Bank" },
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, "Cycle Secondary Weapon Firing Rate" },
{ KEY_X, 3, WEAPON_TAB, "Launch Countermeasure" },
// controls
{ KEY_A, -1, SHIP_TAB, "Forward Thrust", CC_TYPE_CONTINUOUS },
{ KEY_Z, -1, SHIP_TAB, "Reverse Thrust", CC_TYPE_CONTINUOUS },
{ KEY_PAD7, -1, SHIP_TAB, "Bank Left", CC_TYPE_CONTINUOUS },
{ KEY_PAD9, -1, SHIP_TAB, "Bank Right", CC_TYPE_CONTINUOUS },
{ KEY_PAD8, -1, SHIP_TAB, "Pitch Forward", CC_TYPE_CONTINUOUS },
{ KEY_PAD2, -1, SHIP_TAB, "Pitch Backward", CC_TYPE_CONTINUOUS },
{ KEY_PAD4, -1, SHIP_TAB, "Turn Left", CC_TYPE_CONTINUOUS },
{ KEY_PAD6, -1, SHIP_TAB, "Turn Right", CC_TYPE_CONTINUOUS },
// throttle controls
{ KEY_BACKSP, -1, SHIP_TAB, "Set Throttle to Zero" },
{ KEY_SLASH, -1, SHIP_TAB, "Set Throttle to Max" },
{ KEY_LBRACKET, -1, SHIP_TAB, "Set Throttle to One-Third" },
{ KEY_RBRACKET, -1, SHIP_TAB, "Set Throttle to Two-Thirds" },
{ KEY_EQUAL, -1, SHIP_TAB, "Increase Throttle 5 Percent" },
{ KEY_MINUS, -1, SHIP_TAB, "Decrease Throttle 5 Percent" },
// squadmate messaging
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, "Attack My Target" },
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, "Disarm My Target" },
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, "Disable My Target" },
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, "Attack my Subsystem" },
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, "Capture My Target" },
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, "Engage Enemy" },
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, "Form on my Wing" },
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, "Ignore my Target" },
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, "Protect my Target" },
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, "Cover me" },
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, "Return to base" },
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, "Rearm me" },
{ KEY_R, 6, TARGET_TAB, "Target Closest Attacking Ship" },
// Views
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, "Chase View" },
{ KEY_PADPERIOD, -1, COMPUTER_TAB, "External View"},
{ KEY_PADENTER, -1, COMPUTER_TAB, "Toggle External Camera Lock"},
{ KEY_PAD0, -1, COMPUTER_TAB, "Free Look View", CC_TYPE_CONTINUOUS },
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, "Current Target View" },
{ KEY_PADPLUS, -1, COMPUTER_TAB, "Increase View Distance", CC_TYPE_CONTINUOUS },
{ KEY_PADMINUS, -1, COMPUTER_TAB, "Decrease View Distance", CC_TYPE_CONTINUOUS },
{ KEY_PAD5, -1, COMPUTER_TAB, "Center View", CC_TYPE_CONTINUOUS },
{ -1, 33, COMPUTER_TAB, "View Up", CC_TYPE_CONTINUOUS },
{ -1, 32, COMPUTER_TAB, "View Rear", CC_TYPE_CONTINUOUS },
{ -1, 34, COMPUTER_TAB, "View Left", CC_TYPE_CONTINUOUS },
{ -1, 35, COMPUTER_TAB, "View Right", CC_TYPE_CONTINUOUS },
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, "Cycle Radar Range" },
{ KEY_C, -1, COMPUTER_TAB, "Communications Menu" },
{ -1, -1, -1, "Show Objectives" },
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, "Enter Subspace (End Mission)" },
{ KEY_J, -1, TARGET_TAB, "Target Target's Target" },
{ KEY_TAB, 5, SHIP_TAB, "Afterburner", CC_TYPE_CONTINUOUS },
{ KEY_INSERT, -1, COMPUTER_TAB, "Increase Weapon Energy" },
{ KEY_DELETE, -1, COMPUTER_TAB, "Decrease Weapon Energy" },
{ KEY_HOME, -1, COMPUTER_TAB, "Increase Shield Energy" },
{ KEY_END, -1, COMPUTER_TAB, "Decrease Shield Energy" },
{ KEY_PAGEUP, -1, COMPUTER_TAB, "Increase Engine Energy" },
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, "Decrease Engine Energy" },
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, "Equalize Energy Settings" },
{ KEY_Q, 7, COMPUTER_TAB, "Equalize Shield" },
{ KEY_UP, -1, COMPUTER_TAB, "Augment Forward Shield" },
{ KEY_DOWN, -1, COMPUTER_TAB, "Augment Rear Shield" },
{ KEY_LEFT, -1, COMPUTER_TAB, "Augment Left Shield" },
{ KEY_RIGHT, -1, COMPUTER_TAB, "Augment Right Shield" },
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, "Transfer Energy Laser->Shield" },
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, "Transfer Energy Shield->Laser" },
{ -1, -1, -1, "Show Damage Popup Window" },
{ -1, -1, SHIP_TAB, "Bank When Pressed", CC_TYPE_CONTINUOUS },
{ -1, -1, -1, "Show NavMap" },
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, "Add or Remove Escort" },
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, "Clear Escort List" },
{ KEY_E, -1, TARGET_TAB, "Target Next Escort Ship" },
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, "Target Closest Repair Ship" },
{ KEY_U, -1, TARGET_TAB, "Target Next Uninspected Cargo" },
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, "Target Previous Uninspected Cargo" },
{ KEY_N, -1, TARGET_TAB, "Target Newest Ship In Area" },
{ KEY_K, -1, TARGET_TAB, "Target Next Live Turret" },
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, "Target Previous Live Turret" },
{ KEY_B, -1, TARGET_TAB, "Target Next Hostile Bomb or Bomber" },
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, "Target Previous Hostile Bomb or Bomber" },
// multiplayer messaging keys
{ KEY_1, -1, COMPUTER_TAB, "(Multiplayer) Message All", CC_TYPE_CONTINUOUS },
{ KEY_2, -1, COMPUTER_TAB, "(Multiplayer) Message Friendly", CC_TYPE_CONTINUOUS },
{ KEY_3, -1, COMPUTER_TAB, "(Multiplayer) Message Hostile", CC_TYPE_CONTINUOUS },
{ KEY_4, -1, COMPUTER_TAB, "(Multiplayer) Message Target", CC_TYPE_CONTINUOUS },
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, "(Multiplayer) Observer zoom to target"},
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, "Increase time compression" },
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, "Decrease time compression" },
{ KEY_L, -1, COMPUTER_TAB, "Toggle high HUD contrast" },
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, "(Multiplayer) Toggle network info"},
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, "(Multiplayer) Self destruct"},
{ -1, -1, -1, "" }
};
char *Scan_code_text_german[] = {
"", "Esc", "1", "2", "3", "4", "5", "6",
"7", "8", "9", "0", "Akzent '", "\xE1", "R\x81""cktaste", "Tab",
"Q", "W", "E", "R", "T", "Z", "U", "I",
"O", "P", "\x9A", "+", "Eingabe", "Strg Links", "A", "S",
"D", "F", "G", "H", "J", "K", "L", "\x99",
"\xAE", "`", "Shift", "#", "Y", "X", "C", "V",
"B", "N", "M", ",", ".", "-", "Shift", "Num *",
"Alt", "Leertaste", "Hochstell", "F1", "F2", "F3", "F4", "F5",
"F6", "F7", "F8", "F9", "F10", "Pause", "Rollen", "Num 7",
"Num 8", "Num 9", "Num -", "Num 4", "Num 5", "Num 6", "Num +", "Num 1",
"Num 2", "Num 3", "Num 0", "Num ,", "", "", "", "F11",
"F12", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "Num Eingabe", "Strg Rechts", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "Num /", "", "Druck",
"Alt", "", "", "", "", "", "", "",
"", "", "", "", "", "Num Lock", "", "Pos 1",
"Pfeil Hoch", "Bild Hoch", "", "Pfeil Links", "", "Pfeil Rechts", "", "Ende",
"Pfeil Runter", "Bild Runter", "Einfg", "Entf", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
};
char *Joy_button_text_german[] = {
"Knopf 1", "Knopf 2", "Knopf 3", "Knopf 4", "Knopf 5", "Knopf 6",
"Knopf 7", "Knopf 8", "Knopf 9", "Knopf 10", "Knopf 11", "Knopf 12",
"Knopf 13", "Knopf 14", "Knopf 15", "Knopf 16", "Knopf 17", "Knopf 18",
"Knopf 19", "Knopf 20", "Knopf 21", "Knopf 22", "Knopf 23", "Knopf 24",
"Knopf 25", "Knopf 26", "Knopf 27", "Knopf 28", "Knopf 29", "Knopf 30",
"Knopf 31", "Knopf 32", "Hut Hinten", "Hut Vorne", "Hut Links", "Hut Rechts"
};
char *Scan_code_text_french[] = {
"", "\x90""chap", "1", "2", "3", "4", "5", "6",
"7", "8", "9", "0", "-", "=", "Fl\x82""che Ret.", "Tab",
"Q", "W", "E", "R", "T", "Y", "U", "I",
"O", "P", "[", "]", "Entr\x82""e", "Ctrl Gauche", "A", "S",
"D", "F", "G", "H", "J", "K", "L", ";",
"'", "`", "Maj.", "\\", "Z", "X", "C", "V",
"B", "N", "M", ",", ".", "/", "Maj.", "Pav\x82 *",
"Alt", "Espace", "Verr. Maj.", "F1", "F2", "F3", "F4", "F5",
"F6", "F7", "F8", "F9", "F10", "Pause", "Arret defil", "Pav\x82 7",
"Pav\x82 8", "Pav\x82 9", "Pav\x82 -", "Pav\x82 4", "Pav\x82 5", "Pav\x82 6", "Pav\x82 +", "Pav\x82 1",
"Pav\x82 2", "Pav\x82 3", "Pav\x82 0", "Pav\x82 .", "", "", "", "F11",
"F12", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "Pav\x82 Entr", "Ctrl Droite", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "Pav\x82 /", "", "Impr \x82""cran",
"Alt", "", "", "", "", "", "", "",
"", "", "", "", "", "Verr num", "", "Orig.",
"Fl\x82""che Haut", "Page Haut", "", "Fl\x82""che Gauche", "", "Fl\x82""che Droite", "", "Fin",
"Fl\x82""che Bas", "Page Bas", "Inser", "Suppr", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
};
char *Joy_button_text_french[] = {
"Bouton 1", "Bouton 2", "Bouton 3", "Bouton 4", "Bouton 5", "Bouton 6",
"Bouton 7", "Bouton 8", "Bouton 9", "Bouton 10", "Bouton 11", "Bouton 12",
"Bouton 13", "Bouton 14", "Bouton 15", "Bouton 16", "Bouton 17", "Bouton 18",
"Bouton 19", "Bouton 20", "Bouton 21", "Bouton 22", "Bouton 23", "Bouton 24",
"Bouton 25", "Bouton 26", "Bouton 27", "Bouton 28", "Bouton 29", "Bouton 30",
"Bouton 31", "Bouton 32", "Chapeau Arrière", "Chapeau Avant", "Chapeau Gauche", "Chapeau Droite"
};
// This is the text that is displayed on the screen for the keys a player selects
char *Scan_code_text_english[] = {
"", "Esc", "1", "2", "3", "4", "5", "6",
"7", "8", "9", "0", "-", "=", "Backspace", "Tab",
"Q", "W", "E", "R", "T", "Y", "U", "I",
"O", "P", "[", "]", "Enter", "Left Ctrl", "A", "S",
"D", "F", "G", "H", "J", "K", "L", ";",
"'", "`", "Shift", "\\", "Z", "X", "C", "V",
"B", "N", "M", ",", ".", "/", "Shift", "Pad *",
"Alt", "Spacebar", "Caps Lock", "F1", "F2", "F3", "F4", "F5",
"F6", "F7", "F8", "F9", "F10", "Pause", "Scroll Lock", "Pad 7",
"Pad 8", "Pad 9", "Pad -", "Pad 4", "Pad 5", "Pad 6", "Pad +", "Pad 1",
"Pad 2", "Pad 3", "Pad 0", "Pad .", "", "", "", "F11",
"F12", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "Pad Enter", "Right Ctrl", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "Pad /", "", "Print Scrn",
"Alt", "", "", "", "", "", "", "",
"", "", "", "", "", "Num Lock", "", "Home",
"Up Arrow", "Page Up", "", "Left Arrow", "", "Right Arrow", "", "End",
"Down Arrow", "Page Down", "Insert", "Delete", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
};
char *Joy_button_text_english[] = {
"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6",
"Button 7", "Button 8", "Button 9", "Button 10", "Button 11", "Button 12",
"Button 13", "Button 14", "Button 15", "Button 16", "Button 17", "Button 18",
"Button 19", "Button 20", "Button 21", "Button 22", "Button 23", "Button 24",
"Button 25", "Button 26", "Button 27", "Button 28", "Button 29", "Button 30",
"Button 31", "Button 32", "Hat Back", "Hat Forward", "Hat Left", "Hat Right"
};
char **Scan_code_text = Scan_code_text_english;
char **Joy_button_text = Joy_button_text_english;
void set_modifier_status()
{
int i;
Alt_is_modifier = 0;
Shift_is_modifier = 0;
Ctrl_is_modifier = 0;
for (i=0; i<CCFG_MAX; i++) {
if (Control_config[i].key_id < 0)
continue;
if (Control_config[i].key_id & KEY_ALTED)
Alt_is_modifier = 1;
if (Control_config[i].key_id & KEY_SHIFTED)
Shift_is_modifier = 1;
if (Control_config[i].key_id & KEY_CTRLED) {
Assert(0); // get Alan
Ctrl_is_modifier = 1;
}
}
}
int translate_key_to_index(char *key)
{
int i, index = -1, alt = 0, shift = 0, max_scan_codes;
if (Lcl_gr) {
max_scan_codes = sizeof(Scan_code_text_german) / sizeof(char *);
} else if (Lcl_fr) {
max_scan_codes = sizeof(Scan_code_text_french) / sizeof(char *);
} else {
max_scan_codes = sizeof(Scan_code_text_english) / sizeof(char *);
}
// look for modifiers
Assert(key);
if (!strnicmp(key, "Alt", 3)) {
alt = 1;
key += 3;
if (*key)
key++;
}
char *translated_shift;
if(Lcl_gr){
translated_shift = "Shift";
} else if(Lcl_fr){
translated_shift = "Maj.";
} else {
translated_shift = "Shift";
}
if (!strnicmp(key, translated_shift, 5)) {
shift = 1;
key += 5;
if (*key)
key++;
}
// look up index for default key
if (*key) {
for (i=0; i<max_scan_codes; i++)
if (!stricmp(key, Scan_code_text_english[i])) {
index = i;
break;
}
if (i == max_scan_codes)
return -1;
if (shift)
index |= KEY_SHIFTED;
if (alt)
index |= KEY_ALTED;
// convert scancode to Control_config index
for (i=0; i<CCFG_MAX; i++) {
if (Control_config[i].key_default == index) {
index = i;
break;
}
}
if (i == CCFG_MAX)
return -1;
return index;
}
return -1;
}
// Given the system default key 'key', return the current key that is bound to the function
// Both are 'key' and the return value are descriptive strings that can be displayed
// directly to the user. If 'key' isn't a real key or not normally bound to anything,
// or there is no key current bound to the function, NULL is returned.
char *translate_key(char *key)
{
int index = -1, code = -1;
index = translate_key_to_index(key);
if (index < 0)
return NULL;
code = Control_config[index].key_id;
Failed_key_index = index;
if (code < 0) {
code = Control_config[index].joy_id;
if (code >= 0)
return Joy_button_text[code];
}
return textify_scancode(code);
}
char *textify_scancode(int code)
{
static char text[40];
if (code < 0)
return "None";
*text = 0;
if (code & KEY_ALTED) {
if(Lcl_gr){
strcat(text, "Alt-");
} else if(Lcl_fr){
strcat(text, "Alt-");
} else {
strcat(text, "Alt-");
}
}
if (code & KEY_SHIFTED) {
if(Lcl_gr){
strcat(text, "Shift-");
} else if(Lcl_fr){
strcat(text, "Maj.-");
} else {
strcat(text, "Shift-");
}
}
strcat(text, Scan_code_text[code & KEY_MASK]);
return text;
}
//XSTR:ON
// initialize common control config stuff - call at game startup after localization has been initialized
void control_config_common_init()
{
if(Lcl_gr){
Scan_code_text = Scan_code_text_german;
Joy_button_text = Joy_button_text_german;
// swap init bindings for y and z keys
Control_config[TARGET_SHIP_IN_RETICLE].key_default = KEY_Z;
Control_config[TARGET_LAST_TRANMISSION_SENDER].key_default = KEY_ALTED | KEY_Z;
Control_config[REVERSE_THRUST].key_default = KEY_Y;
Control_config[DISARM_MESSAGE].key_default = KEY_SHIFTED | KEY_Y;
} else if(Lcl_fr){
Scan_code_text = Scan_code_text_french;
Joy_button_text = Joy_button_text_french;
} else {
Scan_code_text = Scan_code_text_english;
Joy_button_text = Joy_button_text_english;
}
}
+84
View File
@@ -0,0 +1,84 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Cryptstring/cryptstring.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Applet for crypting strings.
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 2 10/23/98 6:21p Dave
*
* $NoKeywords: $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "globalincs/crypt.h"
int main(int argc, char **argv)
{
int i;
char *crypt_string;
if ( argc == 1 ) {
printf("Usage: cryptstring <string1> <string2> ...\n");
printf("Output will be <crypt1> <crypt2>\n");
exit(1);
}
for ( i = 1; i < argc; i++ ) {
char *s;
s = argv[i];
// if the length of the string is greater than the number of crypted symbols we
// return, then pass only the maximum length
if ( strlen(s) > CRYPT_STRING_LENGTH )
s += (strlen(s) - CRYPT_STRING_LENGTH);
crypt_string = jcrypt(s);
printf("%s\n", crypt_string);
}
return 0;
}
char *jcrypt (char *plainstring)
{
int i,t,len;
static char cryptstring[CRYPT_STRING_LENGTH + 1];
len=strlen (plainstring);
if (len > CRYPT_STRING_LENGTH)
len = CRYPT_STRING_LENGTH;
for (i = 0;i < len; i++) {
cryptstring[i]=0;
for (t = 0; t < len; t++) {
cryptstring[i]^=(plainstring[t] ^ plainstring[i%(t+1)]);
cryptstring[i]%=90;
cryptstring[i]+=33;
}
}
cryptstring[i]=0;
return ((char *)cryptstring);
}
+773
View File
@@ -0,0 +1,773 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Cutscene/Cutscenes.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Code for the cutscenes viewer screen
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/07/07 19:55:58 penguin
* Back-port to MSVC
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.4 2002/05/16 00:39:47 mharris
* Added ifdef WIN32 around cd stuff
*
* Revision 1.3 2002/05/13 21:43:37 mharris
* A little more network and sound cleanup
*
* Revision 1.2 2002/05/07 02:57:33 mharris
* make Buttons[] static
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 15 6/16/00 3:15p Jefff
* sim of the year dvd version changes, a few german soty localization
* fixes
*
* 14 10/13/99 10:20a Jefff
* fixed bug where intro cutscene showed 2x after getting bad ending
*
* 13 10/06/99 10:30a Jefff
* OEM updates
*
* 12 9/30/99 6:01p Jefff
* OEM updates
*
* 11 9/07/99 1:10p Mikek
* Make movie check not hang in ~RELEASE_REAL build.
*
* 10 9/06/99 6:38p Dave
* Improved CD detection code.
*
* 9 9/06/99 1:16a Dave
* Make sure the user sees the intro movie.
*
* 8 9/03/99 1:31a Dave
* CD checking by act. Added support to play 2 cutscenes in a row
* seamlessly. Fixed super low level cfile bug related to files in the
* root directory of a CD. Added cheat code to set campaign mission # in
* main hall.
*
* 7 7/19/99 2:13p Dave
* Added some new strings for Heiko.
*
* 6 6/01/99 3:52p Dave
* View footage screen. Fixed xstrings to not display the & symbol. Popup,
* dead popup, pxo find player popup, pxo private room popup.
*
* 5 1/30/99 5:08p Dave
* More new hi-res stuff.Support for nice D3D textures.
*
* 4 10/23/98 3:51p Dave
* Full support for tstrings.tbl and foreign languages. All that remains
* is to make it active in Fred.
*
* 3 10/13/98 9:28a Dave
* Started neatening up freespace.h. Many variables renamed and
* reorganized. Added AlphaColors.[h,cpp]
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 18 6/09/98 10:31a Hoffoss
* Created index numbers for all xstr() references. Any new xstr() stuff
* added from here on out should be added to the end if the list. The
* current list count can be found in FreeSpace.cpp (search for
* XSTR_SIZE).
*
* 17 6/01/98 11:43a John
* JAS & MK: Classified all strings for localization.
*
* 16 5/24/98 9:01p Lawrance
* Add commit sounds when accept is pressed
*
* 15 5/21/98 8:05p Allender
* fix possible bug with number of cutscenes shown in the list
*
* 14 5/21/98 12:35a Lawrance
* Tweak how CD is checked for
*
* 13 5/20/98 1:34p Hoffoss
* Added cutscene description rendering.
*
* 12 5/19/98 12:19p Mike
* Cheat codes!
*
* 11 5/12/98 4:17p Hoffoss
* Make ctrl-arrows (up/down) switch between tech room screens.
*
* 10 5/11/98 8:04p Hoffoss
* Fixed minor bugs.
*
* 9 5/10/98 10:05p Allender
* only show cutscenes which have been seen before. Made Fred able to
* write missions anywhere, defaulting to player misison folder, not data
* mission folder. Fix FreeSpace code to properly read missions from
* correct locations
*
* 8 5/08/98 5:30p Lawrance
* add CD checks for movie playing
*
* 7 5/08/98 4:07p Allender
* more cutscene stuff
*
* 6 5/07/98 2:33p Hoffoss
* Removed help and options buttons.
*
* 5 4/30/98 4:53p John
* Restructured and cleaned up cfile code. Added capability to read off
* of CD-ROM drive and out of multiple pack files.
*
* 4 4/23/98 8:27p Allender
* basic support for cutscene playback. Into movie code in place. Tech
* room can view cutscenes stored in CDROM_dir variable
*
* 3 4/21/98 7:07p Hoffoss
* Fixed problem where when switching screens flashes old tab hilight once
* before switching to new state.
*
* 2 4/17/98 6:33p Hoffoss
* Made changes to the tech room group of screens. Cutscenes screen is
* now in a new file.
*
* $NoKeywords: $
*/
#include "cutscene/cutscenes.h"
#include "ui/ui.h"
#include "cfile/cfile.h"
#include "gamesnd/gamesnd.h"
#include "gamesequence/gamesequence.h"
#include "freespace2/freespace.h"
#include "io/key.h"
#include "bmpman/bmpman.h"
// #include "movie.h"
#include "popup/popup.h"
#include "menuui/mainhallmenu.h"
#include "globalincs/alphacolors.h"
#include "localization/localize.h"
char *Cutscene_bitmap_name[GR_NUM_RESOLUTIONS] = {
"ViewFootage",
"2_ViewFootage"
};
char *Cutscene_mask_name[GR_NUM_RESOLUTIONS] = {
"ViewFootage-m",
"2_ViewFootage-m"
};
int Num_cutscenes;
int Cutscenes_viewable;
int Description_index;
cutscene_info Cutscenes[MAX_CUTSCENES];
//extern int All_movies_enabled; // If set, all movies may be viewed. Keyed off cheat code.
// initialization stuff for cutscenes
void cutscene_init()
{
char buf[MULTITEXT_LENGTH];
int rval;
if ((rval = setjmp(parse_abort)) != 0) {
Error(LOCATION, "Error parsing 'rank.tbl'\r\nError code = %i.\r\n", rval);
}
// open localization
lcl_ext_open();
read_file_text("cutscenes.tbl");
reset_parse();
// parse in all the rank names
Num_cutscenes = 0;
skip_to_string("#Cutscenes");
ignore_white_space();
while ( required_string_either("#End", "$Filename:") ) {
Assert ( Num_cutscenes < MAX_CUTSCENES );
required_string("$Filename:");
stuff_string( Cutscenes[Num_cutscenes].filename, F_PATHNAME, NULL );
required_string("$Name:");
stuff_string( Cutscenes[Num_cutscenes].name, F_NAME, NULL );
required_string("$Description:");
stuff_string(buf, F_MULTITEXT, NULL);
drop_white_space(buf);
compact_multitext_string(buf);
Cutscenes[Num_cutscenes].description = strdup(buf);
required_string("$cd:");
stuff_int( &Cutscenes[Num_cutscenes].cd );
Num_cutscenes++;
}
required_string("#End");
Cutscenes_viewable = INTRO_CUTSCENE_FLAG;
// close localization
lcl_ext_close();
}
// function to return 0 based index of which CD a particular movie is on
// returns -1 on failure.
int cutscenes_get_cd_num( char *filename )
{
#ifdef _WIN32
#if defined(OEM_BUILD)
return 0; // only 1 cd for OEM
#else
int i;
for (i = 0; i < Num_cutscenes; i++ ) {
if ( !stricmp(Cutscenes[i].filename, filename) ) {
return (Cutscenes[i].cd - 1);
}
}
return -1;
#endif // defined(OEM_BUILD)
#else // !WIN32
return -1;
#endif // ifdef WIN32
}
// marks a cutscene as viewable
void cutscene_mark_viewable(char *filename)
{
int i;
for (i = 0; i < Num_cutscenes; i++ ) {
if ( !stricmp(Cutscenes[i].filename, filename) ) {
Cutscenes_viewable |= (1<<i);
return;
}
}
}
#define NUM_BUTTONS 8
#define TECH_DATABASE_BUTTON 0
#define SIMULATOR_BUTTON 1
#define CUTSCENES_BUTTON 2
#define CREDITS_BUTTON 3
#define SCROLL_UP_BUTTON 4
#define SCROLL_DOWN_BUTTON 5
#define PLAY_BUTTON 6
#define EXIT_BUTTON 7
static int Num_files;
static int Cutscene_list[MAX_CUTSCENES];
static int Stats_scroll_offset;
static int Selected_line = 0; // line that is currently selected for binding
static int Scroll_offset;
static int Background_bitmap;
static UI_BUTTON List_region;
static UI_WINDOW Ui_window;
static ui_button_info Buttons[GR_NUM_RESOLUTIONS][NUM_BUTTONS] = {
{ // GR_640
ui_button_info("TDB_00", 7, 5, 37, 7, 0), // tech database 1
ui_button_info("TDB_01", 7, 19, 37, 23, 1), // tech database 2
ui_button_info("TDB_02", 7, 34, 37, 38, 2), // tech database 3
ui_button_info("TDB_03", 7, 49, 37, 54, 3), // tech database 4
ui_button_info("VFB_04", 6, 318, -1, -1, 4), // scroll up
ui_button_info("VFB_05", 36, 318, -1, -1, 5), // scroll down
ui_button_info("VFB_06", 578, 319, 587, 366, 6), // play
ui_button_info("VFB_07", 574, 431, 587, 413, 7), // exit
},
{ // GR_1024
ui_button_info("2_TDB_00", 12, 7, 59, 12, 0), // tech database 1
ui_button_info("2_TDB_01", 12, 31, 59, 37, 1), // tech database 2
ui_button_info("2_TDB_02", 12, 56, 59, 62, 2), // tech database 3
ui_button_info("2_TDB_03", 12, 81, 59, 88, 3), // tech database 4
ui_button_info("2_VFB_04", 9, 509, -1, -1, 4), // scroll up
ui_button_info("2_VFB_05", 58, 509, -1, -1, 5), // scroll down
ui_button_info("2_VFB_06", 925, 511, 940, 586, 6), // play
ui_button_info("2_VFB_07", 918, 689, 940, 661, 7), // exit
}
};
// text
#define NUM_CUTSCENE_TEXT 6
UI_XSTR Cutscene_text[GR_NUM_RESOLUTIONS][NUM_CUTSCENE_TEXT] = {
{ // GR_640
{"Technical Database", 1055, 37, 7, UI_XSTR_COLOR_GREEN, -1, &Buttons[0][TECH_DATABASE_BUTTON].button },
{"Mission Simulator", 1056, 37, 23, UI_XSTR_COLOR_GREEN, -1, &Buttons[0][SIMULATOR_BUTTON].button },
{"Cutscenes", 1057, 37, 38, UI_XSTR_COLOR_GREEN, -1, &Buttons[0][CUTSCENES_BUTTON].button },
{"Credits", 1058, 37, 54, UI_XSTR_COLOR_GREEN, -1, &Buttons[0][CREDITS_BUTTON].button },
{"Play", 1335, 587, 366, UI_XSTR_COLOR_GREEN, -1, &Buttons[0][PLAY_BUTTON].button },
{"Exit", 1419, 587, 413, UI_XSTR_COLOR_PINK, -1, &Buttons[0][EXIT_BUTTON].button },
},
{ // GR_1024
{"Technical Database", 1055, 59, 12, UI_XSTR_COLOR_GREEN, -1, &Buttons[1][TECH_DATABASE_BUTTON].button },
{"Mission Simulator", 1056, 59, 37, UI_XSTR_COLOR_GREEN, -1, &Buttons[1][SIMULATOR_BUTTON].button },
{"Cutscenes", 1057, 59, 62, UI_XSTR_COLOR_GREEN, -1, &Buttons[1][CUTSCENES_BUTTON].button },
{"Credits", 1058, 59, 88, UI_XSTR_COLOR_GREEN, -1, &Buttons[1][CREDITS_BUTTON].button },
{"Play", 1335, 940, 586, UI_XSTR_COLOR_GREEN, -1, &Buttons[1][PLAY_BUTTON].button },
{"Exit", 1419, 940, 661, UI_XSTR_COLOR_PINK, -1, &Buttons[1][EXIT_BUTTON].button },
}
};
int Cutscene_list_coords[GR_NUM_RESOLUTIONS][4] = {
{ // GR_640
9, 117, 621, 198
},
{ // GR_1024
14, 188, 994, 316
}
};
int Cutscene_desc_coords[GR_NUM_RESOLUTIONS][4] = {
{ // GR_640
9, 378, 484, 73
},
{ // GR_1024
14, 605, 775, 117
}
};
#define MAX_TEXT_LINES 20
int Cutscene_max_text_lines[GR_NUM_RESOLUTIONS] = {
10,
MAX_TEXT_LINES
};
#define MAX_TEXT_LINE_LEN 256
static int Text_size;
static int Text_offset = 0;
static int Text_line_size[MAX_TEXT_LINES];
static char *Text_lines[MAX_TEXT_LINES];
int cutscenes_validate_cd(char *mve_name, int prompt_for_cd)
{
#ifdef _WIN32
int cd_present = 0;
int cd_drive_num;
int cd_mve_is_on;
char volume_name[128];
#ifdef RELEASE_REAL
int num_attempts = 0;
#endif
while(1) {
int path_set_ok;
cd_mve_is_on = cutscenes_get_cd_num(mve_name);
if ((cd_mve_is_on != 0) && (cd_mve_is_on != 1) && (cd_mve_is_on != 2)) {
cd_present = 0;
break;
}
#if defined(OEM_BUILD)
sprintf(volume_name, NOX("FS2_OEM"));
#else
sprintf(volume_name, NOX("FREESPACE2_%c"), '1' + cd_mve_is_on);
#endif
cd_drive_num = find_freespace_cd(volume_name);
path_set_ok = set_cdrom_path(cd_drive_num);
if ( path_set_ok ) {
cd_present = 1;
break;
}
#ifdef RELEASE_REAL
if ( !prompt_for_cd ) {
cd_present = 0;
break;
}
// no CD found, so prompt user
char popup_msg[256];
int popup_rval;
#if defined(DVD_MESSAGE_HACK)
sprintf(popup_msg, XSTR( "Movie not found\n\nInsert FreeSpace DVD to continue", 203));
#else
sprintf(popup_msg, XSTR( "Movie not found\n\nInsert FreeSpace CD #%d to continue", 203), cd_mve_is_on+1);
#endif
popup_rval = popup(PF_BODY_BIG, 2, POPUP_CANCEL, POPUP_OK, popup_msg);
if ( popup_rval != 1 ) {
cd_present = 0;
break;
}
if ( num_attempts++ > 5 ) {
cd_present = 0;
break;
}
#else
cd_present = 0;
break;
#endif
}
return cd_present;
#else // !WIN32
return 0;
#endif // ifdef WIN32
}
void cutscenes_screen_play()
{
char name[MAX_FILENAME_LEN], *full_name;
int which_cutscene;
Assert( (Selected_line >= 0) && (Selected_line < Num_files) );
which_cutscene = Cutscene_list[Selected_line];
strcpy(name, Cutscenes[which_cutscene].filename );
full_name = cf_add_ext(name, NOX(".mve"));
// no soup for you!
/*
int rval = movie_play(full_name);
if ( !rval ) {
char str[256];
sprintf(str, XSTR( "Unable to play movie %s.", 204), Cutscenes[which_cutscene].name );
popup(0, 1, POPUP_OK, str );
}
*/
}
void cutscenes_screen_scroll_line_up()
{
if (Selected_line) {
Selected_line--;
gamesnd_play_iface(SND_SCROLL);
} else
gamesnd_play_iface(SND_GENERAL_FAIL);
if (Selected_line < Scroll_offset)
Scroll_offset = Selected_line;
}
void cutscenes_screen_scroll_line_down()
{
int h;
if (Selected_line < Num_files - 1) {
Selected_line++;
gamesnd_play_iface(SND_SCROLL);
} else
gamesnd_play_iface(SND_GENERAL_FAIL);
h = Cutscene_list_coords[gr_screen.res][3] / gr_get_font_height();
if (Selected_line >= Scroll_offset + h){
Scroll_offset++;
}
}
void cutscenes_screen_scroll_screen_up()
{
int h;
if (Scroll_offset) {
Scroll_offset--;
Assert(Selected_line > Scroll_offset);
h = Cutscene_list_coords[gr_screen.res][3] / gr_get_font_height();
while (Selected_line >= Scroll_offset + h){
Selected_line--;
}
gamesnd_play_iface(SND_SCROLL);
} else {
gamesnd_play_iface(SND_GENERAL_FAIL);
}
}
void cutscenes_screen_scroll_screen_down()
{
int h;
h = Cutscene_list_coords[gr_screen.res][3] / gr_get_font_height();
if (Scroll_offset + h < Num_files) {
Scroll_offset++;
if (Selected_line < Scroll_offset){
Selected_line = Scroll_offset;
}
gamesnd_play_iface(SND_SCROLL);
} else {
gamesnd_play_iface(SND_GENERAL_FAIL);
}
}
int cutscenes_screen_button_pressed(int n)
{
switch (n) {
case TECH_DATABASE_BUTTON:
gamesnd_play_iface(SND_SWITCH_SCREENS);
gameseq_post_event(GS_EVENT_TECH_MENU);
return 1;
case SIMULATOR_BUTTON:
gamesnd_play_iface(SND_SWITCH_SCREENS);
gameseq_post_event(GS_EVENT_SIMULATOR_ROOM);
return 1;
case CREDITS_BUTTON:
gamesnd_play_iface(SND_SWITCH_SCREENS);
gameseq_post_event(GS_EVENT_CREDITS);
return 1;
case SCROLL_UP_BUTTON:
cutscenes_screen_scroll_screen_up();
break;
case SCROLL_DOWN_BUTTON:
cutscenes_screen_scroll_screen_down();
break;
case PLAY_BUTTON:
cutscenes_screen_play();
break;
case EXIT_BUTTON:
gamesnd_play_iface(SND_COMMIT_PRESSED);
gameseq_post_event(GS_EVENT_MAIN_MENU);
game_flush();
break;
}
return 0;
}
void cutscenes_screen_init()
{
int i;
ui_button_info *b;
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Ui_window.set_mask_bmap(Cutscene_mask_name[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[gr_screen.res][i];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, (i < 2), 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// add xstrs
for(i=0; i<NUM_CUTSCENE_TEXT; i++){
Ui_window.add_XSTR(&Cutscene_text[gr_screen.res][i]);
}
Buttons[gr_screen.res][EXIT_BUTTON].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_PAGEUP);
Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_PAGEDOWN);
List_region.create(&Ui_window, "", Cutscene_list_coords[gr_screen.res][0], Cutscene_list_coords[gr_screen.res][1], Cutscene_list_coords[gr_screen.res][2], Cutscene_list_coords[gr_screen.res][3], 0, 1);
List_region.hide();
// set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_PAGEUP);
Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_PAGEDOWN);
Background_bitmap = bm_load(Cutscene_bitmap_name[gr_screen.res]);
Scroll_offset = Selected_line = 0;
Description_index = -1;
// when doing a debug version, just put all of the movie files here.
#ifndef NDEBUG
//Cutscenes_viewable = 0xffffffff; // makes all cutscenes viewble.
#endif
// if (All_movies_enabled)
// Cutscenes_viewable = 0xffffffff; // Cheat code enables all movies.
Num_files = 0;
for ( i = 0; i < Num_cutscenes; i++ ) {
if ( Cutscenes_viewable & (1<<i) ) {
Cutscene_list[Num_files] = i;
Num_files++;
}
}
}
void cutscenes_screen_close()
{
if (Background_bitmap)
bm_unload(Background_bitmap);
Ui_window.destroy();
}
void cutscenes_screen_do_frame()
{
int i, k, y, z;
int font_height = gr_get_font_height();
int select_tease_line = -1;
k = Ui_window.process();
switch (k) {
case KEY_DOWN: // select next line
cutscenes_screen_scroll_line_down();
break;
case KEY_UP: // select previous line
cutscenes_screen_scroll_line_up();
break;
case KEY_TAB:
case KEY_CTRLED | KEY_DOWN:
cutscenes_screen_button_pressed(CREDITS_BUTTON);
break;
case KEY_SHIFTED | KEY_TAB:
case KEY_CTRLED | KEY_UP:
cutscenes_screen_button_pressed(SIMULATOR_BUTTON);
break;
case KEY_ENTER:
cutscenes_screen_play();
break;
case KEY_ESC: // cancel
gameseq_post_event(GS_EVENT_MAIN_MENU);
game_flush();
break;
case KEY_F1: // show help overlay
break;
case KEY_F2: // goto options screen
gameseq_post_event(GS_EVENT_OPTIONS_MENU);
break;
} // end switch
for (i=0; i<NUM_BUTTONS; i++){
if (Buttons[gr_screen.res][i].button.pressed()){
if (cutscenes_screen_button_pressed(i)){
return;
}
}
}
if (List_region.button_down()) {
List_region.get_mouse_pos(NULL, &y);
z = Scroll_offset + y / font_height;
if ((z >= 0) && (z < Num_files))
select_tease_line = z;
}
if (List_region.pressed()) {
List_region.get_mouse_pos(NULL, &y);
z = Scroll_offset + y / font_height;
if ((z >= 0) && (z < Num_files))
Selected_line = z;
}
GR_MAYBE_CLEAR_RES(Background_bitmap);
if (Background_bitmap >= 0) {
gr_set_bitmap(Background_bitmap);
gr_bitmap(0, 0);
}
Ui_window.draw();
for (i=TECH_DATABASE_BUTTON; i<=CREDITS_BUTTON; i++){
if (Buttons[gr_screen.res][i].button.button_down()){
break;
}
}
if (i > CREDITS_BUTTON){
Buttons[gr_screen.res][CUTSCENES_BUTTON].button.draw_forced(2);
}
y = 0;
z = Scroll_offset;
while (y + font_height <= Cutscene_list_coords[gr_screen.res][3]) {
if (z >= Num_files){
break;
}
if (z == Selected_line){
gr_set_color_fast(&Color_text_selected);
} else if (z == select_tease_line) {
gr_set_color_fast(&Color_text_subselected);
} else {
gr_set_color_fast(&Color_text_normal);
}
gr_printf(Cutscene_list_coords[gr_screen.res][0], Cutscene_list_coords[gr_screen.res][1] + y, Cutscenes[Cutscene_list[z]].name);
y += font_height;
z++;
}
if (Description_index != Selected_line) {
char *src;
Description_index = Selected_line;
Text_size = 0;
src = Cutscenes[Cutscene_list[Description_index]].description;
if (src) {
Text_size = split_str(src, Cutscene_desc_coords[gr_screen.res][2], Text_line_size, Text_lines, Cutscene_max_text_lines[gr_screen.res]);
Assert(Text_size >= 0 && Text_size < Cutscene_max_text_lines[gr_screen.res]);
}
}
if (Description_index >= 0) {
int len;
char line[MAX_TEXT_LINE_LEN + 1];
gr_set_color_fast(&Color_text_normal);
y = 0;
z = Text_offset;
while (y + font_height <= Cutscene_desc_coords[gr_screen.res][3]) {
if (z >= Text_size)
break;
len = Text_line_size[z];
if (len > MAX_TEXT_LINE_LEN)
len = MAX_TEXT_LINE_LEN;
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);
y += font_height;
z++;
}
}
gr_flip();
}
+87
View File
@@ -0,0 +1,87 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Cutscene/Cutscenes.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Code for the cutscenes viewer screen
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 6 5/21/98 12:35a Lawrance
* Tweak how CD is checked for
*
* 5 5/10/98 10:05p Allender
* only show cutscenes which have been seen before. Made Fred able to
* write missions anywhere, defaulting to player misison folder, not data
* mission folder. Fix FreeSpace code to properly read missions from
* correct locations
*
* 4 5/08/98 5:30p Lawrance
* add cutscenes_validate_cd()
*
* 3 5/08/98 4:07p Allender
* more cutscene stuff
*
* 2 4/17/98 6:33p Hoffoss
* Made changes to the tech room group of screens. Cutscenes screen is
* now in a new file.
*
* $NoKeywords: $
*/
#ifndef _FREESPACE_CUTSCENES_SCREEN_HEADER_FILE
#define _FREESPACE_CUTSCENES_SCREEN_HEADER_FILE
#include "parse/parselo.h"
#define MAX_CUTSCENES 10
// this cutscene is always available.
#define INTRO_CUTSCENE_FLAG (1<<0)
typedef struct cutscene_info
{
char filename[MAX_FILENAME_LEN];
char name[NAME_LENGTH];
char *description;
int cd;
} cutscene_info;
extern cutscene_info Cutscenes[MAX_CUTSCENES];
extern int Num_cutscenes;
extern int Cutscenes_viewable;
// initializa table data
void cutscene_init();
int cutscene_get_cd_num(char *filename);
void cutscenes_screen_init();
void cutscenes_screen_close();
void cutscenes_screen_do_frame();
int cutscenes_validate_cd(char *mve_name, int prompt_for_cd = 1);
void cutscene_mark_viewable(char *filename);
#endif
File diff suppressed because it is too large. Load diff
+203
View File
@@ -0,0 +1,203 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Debris/Debris.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:21 $
* $Author: penguin $
*
* Code for the pieces of exploding object debris.
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 6 7/15/99 9:20a Andsager
* FS2_DEMO initial checkin
*
* 5 7/01/99 11:44a Dave
* Updated object sound system to allow multiple obj sounds per ship.
* Added hit-by-beam sound. Added killed by beam sound.
*
* 4 11/05/98 5:55p Dave
* Big pass at reducing #includes
*
* 3 10/16/98 1:22p Andsager
* clean up header files
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 29 4/02/98 6:30p Lawrance
* reduce max debris piece if DEMO defined
*
* 28 4/02/98 11:40a Lawrance
* check for #ifdef DEMO instead of #ifdef DEMO_RELEASE
*
* 27 2/26/98 10:07p Hoffoss
* Rewrote state saving and restoring to fix bugs and simplify the code.
*
* 26 2/19/98 12:46a Lawrance
* Further work on asteroids.
*
* 25 2/10/98 6:43p Lawrance
* Moved asteroid code to a separate lib.
*
* 24 2/06/98 3:08p Mike
* More asteroid stuff, including resolving conflicts between the two
* asteroid_field structs!
*
* 23 2/05/98 12:51a Mike
* Early asteroid stuff.
*
* 22 1/29/98 5:50p John
* Made electrical arcing on debris pieces be persistent from frame to
* frame
*
* 21 1/21/98 7:18p Lawrance
* Fix bug with creating debris before the mission starts.
*
* 20 12/22/97 9:56p Andsager
* Implement ship:debris collisions. Generalize and move
* ship_ship_or_debris_hit struct from CollideShipShip to ObjCollide.h
*
* 19 11/19/97 5:57p Mike
* Make debris go away if more than N units away from the nearest player.
* Make speed of a docked object not read zero if it's moving.
*
* 18 10/01/97 10:52a Mike
* Change debris prototype to take an additional parameter to give debris
* more thrust when it is created.
*
* 17 9/20/97 9:25a John
* fixed bug with species specific debris shards.
*
* 16 8/13/97 9:50p Allender
* split *_move into *_process_pre and *_process_post functions.
* process_pre functions called before object is moved. _process_post
* functions called after object is moved. Reordered code in ship_post
* and weapon_post for multiplayer
*
* 15 7/24/97 8:35a Allender
* allow ships to blow up before missions starts. Made some debris system
* items available in other modules
*
* 14 7/13/97 5:53p Lawrance
* save model name in debris
*
* 13 7/02/97 11:48a Lawrance
* update debris to delay persistant sound
*
* 12 6/06/97 4:13p Lawrance
* leave debris chunks from very large ships persistant, scale fireball
* lifetime by ship radius
*
* 11 6/06/97 12:12p Lawrance
* limit hull debris pieces, destroying oldest debris to make way for new
* debris.
*
* 10 5/14/97 4:08p Lawrance
* removing my_index from game arrays
*
* 9 4/03/97 12:23a Mike
* Make debris collidable-with. Can hit it, too.
* Make AI ships stop firing when target enters death roll.
*
* 8 3/31/97 11:11a John
* added ship species specific debris.
*
* 7 3/25/97 3:55p Lawrance
* allowing debris to be targeted and shown on radar
*
* 6 2/27/97 12:07p John
* Added code to suppord debris chunks after a ship is exploded..
*
* 5 2/26/97 2:18p Lawrance
* adding Debris[] to save/restore
*
* 4 2/10/97 12:38p John
* made all ships blow up into debris pieces when exploded.
*
* 3 2/07/97 10:45a John
* Initial bare bones implementation of blowing off turrets.
*
* 2 2/07/97 9:30a John
*
* 1 2/06/97 4:13p John
*
* $NoKeywords: $
*/
#ifndef _DEBRIS_H
#define _DEBRIS_H
struct object;
struct CFILE;
#define MAX_DEBRIS_ARCS 8 // Must be less than MAX_ARC_EFFECTS in model.h
typedef struct debris {
debris *next, *prev; // used for a linked list of the hull debris chunks
int flags; // See DEBRIS_??? defines
int source_objnum; // What object this came from
int source_sig; // Signature of the source object
int ship_info_index; // Ship info index of the ship type debris came from
int team; // Team of the ship where the debris came from
int objnum; // What object this is linked to
float lifeleft; // When 0 or less object dies
int model_num; // What model this uses
int submodel_num; // What submodel this uses
int next_fireball; // When to start a fireball
int is_hull; // indicates a large hull chunk of debris
int species; // What species this is from. -1 if don't care.
int fire_timeout; // timestamp that holds time for fireballs to stop appearing
int sound_delay; // timestamp to signal when sound should start
fix time_started; // time when debris was created
int next_distance_check; // timestamp to determine whether to delete this piece of debris.
vector arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
int arc_timestamp[MAX_DEBRIS_ARCS]; // When this times out, the spark goes away. -1 is not used
int arc_frequency; // Starts at 0, gets bigger
} debris;
// flags for debris pieces
#define DEBRIS_USED (1<<0)
#define DEBRIS_EXPIRE (1<<1) // debris can expire (ie hull chunks from small ships)
#ifdef FS2_DEMO
#define MAX_DEBRIS_PIECES 48
#else
#define MAX_DEBRIS_PIECES 64
#endif
extern debris Debris[MAX_DEBRIS_PIECES];
extern int Num_debris_pieces;
struct collision_info_struct;
void debris_init();
void debris_render( object * obj );
void debris_delete( object * obj );
void debris_process_pre( object * obj, float frame_time);
void debris_process_post( object * obj, float frame_time);
object *debris_create( object * source_obj, int model_num, int submodel_num, vector *pos, vector *exp_center, int hull_flag, float exp_force );
int debris_check_collision( object * obj, object * other_obj, vector * hitpos, collision_info_struct *debris_hit_info=NULL );
void debris_hit( object * debris_obj, object * other_obj, vector * hitpos, float damage );
int debris_get_team(object *objp);
void debris_clear_expired_flag(debris *db);
#endif // _DEBRIS_H
+802
View File
@@ -0,0 +1,802 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/DebugConsole/Console.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Routines for managing the debug console window.
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 4 6/04/99 10:35a Dave
*
* 3 10/13/98 9:28a Dave
* Started neatening up freespace.h. Many variables renamed and
* reorganized. Added AlphaColors.[h,cpp]
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 17 2/05/98 11:43a Allender
* enhcanced network statistic collection. Made callback in debug console
* to do networking if player is in the console
*
* 16 1/22/98 6:42p John
* Move game_flush out of debug console into freespace. Made object
* pair code throw out some weapons that turn. Added stats for how many
* object pair are actually checked.
*
* 15 1/16/98 11:56a Allender
* ability to scroll back in debug console, and call game_flush() when
* leaving
*
* 14 1/10/98 1:14p John
* Added explanation to debug console commands
*
* 13 12/21/97 4:39p John
* fixed bug in name compare
*
* 12 12/21/97 4:33p John
* Made debug console functions a class that registers itself
* automatically, so you don't need to add the function to
* debugfunctions.cpp.
*
* 11 9/13/97 9:31a Lawrance
* if playing a demo, clear key filter then reset it once done with debug
* console
*
* 10 9/09/97 3:39p Sandeep
* warning level 4 bugs
*
* 9 6/13/97 3:50p John
* sped up debug console printf
*
* 8 6/13/97 3:27p John
* made debug console pretty
*
* 7 6/09/97 9:24a John
* Changed the way fonts are set.
*
* 6 5/29/97 3:09p John
* Took out debug menu.
* Made software scaler draw larger bitmaps.
* Optimized Direct3D some.
*
* 5 5/13/97 4:07p John
* made numbers also be marked as strings.
*
* 4 4/28/97 5:24p John
* made so : and \ don't get parsed out in debug console.
*
* 3 4/24/97 11:49a John
* added new lighting commands to console.
*
* 2 4/24/97 10:36a John
* moved the debug console stuff into it's own lib... made it compile with
* Fred.
*
* 1 4/24/97 10:16a John
* Initial rev
*
* $NoKeywords: $
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <string.h>
#include "globalincs/pstypes.h"
#include "freespace2/freespace.h"
#include "graphics/font.h"
#include "io/timer.h"
#include "graphics/2d.h"
#include "io/key.h"
#include "globalincs/alphacolors.h"
#include "osapi/osapi.h"
#define MAX_COMMANDS 300
static int Num_debug_commands = 0;
static debug_command *Debug_command[MAX_COMMANDS];
debug_command::debug_command(char *_name, char *_help, void (*_func)() )
{
int i;
if ( Num_debug_commands >= MAX_COMMANDS ) {
Int3(); // Too many debug console commands!! Increase MAX_COMMANDS!!
return;
}
for (i=0; i<Num_debug_commands; i++ ) {
int ret = stricmp( Debug_command[i]->name, _name );
if ( ret == 0) {
Int3(); // This debug console command already exists!!!!
return;
} else if ( ret > 0 ) {
break; // Insert it here
} else if ( ret < 0 ) {
// do nothing
}
}
if ( i < Num_debug_commands ) {
// Insert it at element i
int j;
for (j=Num_debug_commands; j>i; j-- ) {
Debug_command[j] = Debug_command[j-1];
}
Debug_command[i] = this;
Num_debug_commands++;
} else {
Debug_command[Num_debug_commands] = this;
Num_debug_commands++;
}
name = _name;
help = _help;
func = _func;
}
// some global variables
int Dc_command; // If this is set, then process the command
int Dc_help; // If this is set, then print out the help text in the form, "usage: ... \nLong description\n" );
int Dc_status; // If this is set, then print out the current status of the command.
char *Dc_arg; // The (lowercased) string value of the argument retrieved from dc_arg
char *Dc_arg_org; // Dc_arg before it got converted to lowercase
uint Dc_arg_type; // The type of dc_arg.
char *Dc_command_line; // The rest of the command line, from the end of the last processed arg on.
int Dc_arg_int; // If Dc_arg_type & ARG_INT is set, then this is the value
float Dc_arg_float; // If Dc_arg_type & ARG_FLOAT is set, then this is the value
int scroll_times = 0; // incremented each time display scrolls
int debug_inited = 0;
#define DROWS 25
#define DCOLS 80
int debug_x=0, debug_y=0;
char debug_text[DROWS][DCOLS];
static char command_line[1024];
static int command_line_pos = 0;
#define DEBUG_HISTORY 16
static char oldcommand_line[DEBUG_HISTORY][1024];
int last_oldcommand=-1;
int command_scroll = 0;
///=========================== SCANNER =======================
typedef enum {
LETTER, QUOTE, SPECIAL, EOF_CODE, DIGIT,
} CHAR_CODE;
typedef enum {
NO_TOKEN, IDENTIFIER, NUMBER, STRING,
} TOKEN_CODE;
#define MAX_TOKEN_STRING_LENGTH 128
char scanner_ch;
TOKEN_CODE scanner_token;
char scanner_token_string[MAX_TOKEN_STRING_LENGTH];
char scanner_word_string[MAX_TOKEN_STRING_LENGTH];
char * scanner_bufferp = "";
char * scanner_tokenp = scanner_token_string;
CHAR_CODE scanner_char_table[256];
#define scanner_char_code(x) scanner_char_table[x]
void scanner_get_char()
{
if ( *scanner_bufferp == '\0' ) {
scanner_ch = 0;
return;
}
scanner_ch = *scanner_bufferp++;
}
void scanner_init()
{
int ch;
for (ch=0; ch<256; ++ch) scanner_char_table[ch] = SPECIAL;
for (ch='0'; ch<='9'; ++ch) scanner_char_table[ch] = DIGIT;
for (ch='A'; ch<='Z'; ++ch) scanner_char_table[ch] = LETTER;
for (ch='a'; ch<='z'; ++ch) scanner_char_table[ch] = LETTER;
scanner_char_table['.'] = DIGIT;
scanner_char_table['-'] = DIGIT;
scanner_char_table['+'] = DIGIT;
scanner_char_table['_'] = LETTER;
scanner_char_table[34] = QUOTE;
scanner_char_table[0] = EOF_CODE;
scanner_char_table[':'] = LETTER;
scanner_char_table['\\'] = LETTER;
scanner_ch = 0;
}
void scanner_skip_blanks()
{
while( (scanner_ch ==' ') || (scanner_ch =='\t') )
scanner_get_char();
}
void scanner_downshift_word()
{
int offset = 'a' - 'A';
char * tp;
strcpy( scanner_word_string, scanner_token_string );
tp = scanner_word_string;
do {
*tp = (char)((*tp>='A') && (*tp <='Z') ? *tp + offset : *tp) ;
tp++;
} while (*tp != '\0' );
}
void scanner_get_word()
{
while( (scanner_char_code(scanner_ch)==LETTER) || (scanner_char_code(scanner_ch)==DIGIT) ) {
*scanner_tokenp++ = scanner_ch;
scanner_get_char();
}
*scanner_tokenp = '\0';
scanner_token = IDENTIFIER;
}
void scanner_get_string()
{
*scanner_tokenp++ = 34;
scanner_get_char();
while(scanner_ch != 34 ) {
*scanner_tokenp++ = scanner_ch;
scanner_get_char();
}
scanner_get_char();
*scanner_tokenp++ = 34;
*scanner_tokenp = '\0';
scanner_token = STRING;
}
void scanner_get_token()
{
scanner_skip_blanks();
scanner_tokenp = scanner_token_string;
*scanner_tokenp = 0;
switch( scanner_char_code(scanner_ch) ) {
case QUOTE: scanner_get_string(); break;
case EOF_CODE: scanner_token = NO_TOKEN; break;
case DIGIT:
case LETTER: scanner_get_word(); break;
default:
*scanner_tokenp++ = scanner_ch;
*scanner_tokenp = '\0';
scanner_get_char();
scanner_token = IDENTIFIER;
break;
}
scanner_downshift_word();
}
void scanner_start_command( char * s )
{
scanner_bufferp = s;
scanner_get_char();
}
int Dc_debug_on = 0;
jmp_buf dc_bad_arg;
void dc_get_arg(uint type)
{
scanner_get_token();
Dc_command_line = scanner_bufferp;
Dc_arg_org = scanner_token_string;
Dc_arg = scanner_word_string;
if (Dc_debug_on) {
dc_printf( "next arg is '%s', was originally '%s'\n", Dc_arg, Dc_arg_org );
dc_printf( "Rest of the command line is '%s'\n", Dc_command_line );
}
if ( scanner_token == NO_TOKEN ) {
Dc_arg_type = ARG_NONE;
} else if ( scanner_token == IDENTIFIER ) {
Dc_arg_type = ARG_STRING;
} else if ( scanner_token == STRING ) {
Dc_arg_type = ARG_QUOTE;
} else {
Dc_arg_type = ARG_STRING;
}
if ( Dc_arg_type & ARG_STRING ) {
int i, num_digits, len;
len = strlen(Dc_arg);
num_digits = 0;
for (i=0; i<len; i++)
if ( scanner_char_table[Dc_arg[i]] == DIGIT ) num_digits++;
if ( num_digits==len ) {
Dc_arg_type |= ARG_FLOAT;
Dc_arg_float = (float)atof(Dc_arg);
if ( !strchr( Dc_arg, '.' )) {
Dc_arg_type |= ARG_INT;
Dc_arg_int = atoi(Dc_arg);
}
} else {
if ( (Dc_arg[0] == '0') && (Dc_arg[1] == 'x') ) {
char *p;
int n;
n = strtol(Dc_arg,&p,0);
if ( *p == 0 ) {
Dc_arg_type |= ARG_INT|ARG_HEX;
Dc_arg_int = n;
}
}
}
if (Dc_debug_on) {
if ( Dc_arg_type & ARG_FLOAT )
dc_printf( "Found float number! %f\n", Dc_arg_float );
if ( Dc_arg_type & ARG_INT )
dc_printf( "Found int number! %d\n", Dc_arg_int );
if ( Dc_arg_type & ARG_HEX )
dc_printf( "Found hex number! 0x%x\n", Dc_arg_int );
}
if ( !stricmp( Dc_arg, "on" ))
Dc_arg_type |= ARG_TRUE;
if ( !stricmp( Dc_arg, "true" ))
Dc_arg_type |= ARG_TRUE;
if ( !stricmp( Dc_arg, "off" ))
Dc_arg_type |= ARG_FALSE;
if ( !stricmp( Dc_arg, "false" ))
Dc_arg_type |= ARG_FALSE;
if ( !stricmp( Dc_arg, "+" ))
Dc_arg_type |= ARG_PLUS;
if ( !stricmp( Dc_arg, "-" ))
Dc_arg_type |= ARG_MINUS;
if ( !stricmp( Dc_arg, "," ))
Dc_arg_type |= ARG_COMMA;
}
if ( Dc_arg_type & ARG_INT) {
if ( Dc_arg_int )
Dc_arg_type |= ARG_TRUE;
else
Dc_arg_type |= ARG_FALSE;
}
if ( !(Dc_arg_type&type) ) {
if ( (Dc_arg_type & ARG_NONE) && !(type & ARG_NONE))
dc_printf( "Error: Not enough parameters.\n" );
else
dc_printf( "Error: '%s' invalid type\n", Dc_arg );
longjmp(dc_bad_arg,1);
}
}
void debug_help();
void debug_do_command(char * command)
{
int i;
int mode = 0;
if ( strlen(command) < 1 ) return;
Dc_debug_on = 0;
Dc_command_line = command;
scanner_start_command(command);
if (setjmp(dc_bad_arg) ) {
return;
}
dc_get_arg( ARG_ANY );
if ( !strcmp( Dc_arg, "debug" ) ) {
Dc_debug_on = 1;
dc_printf( "Command line: '%s'\n", Dc_command_line );
dc_get_arg( ARG_ANY );
}
if ( !strcmp( Dc_arg, "?" ) ) {
mode = 1;
dc_get_arg( ARG_ANY );
if ( Dc_arg_type&ARG_NONE ) {
debug_help();
return;
}
}
if ( !strcmp( Dc_arg, "help" ) || !strcmp( Dc_arg, "man" ) ) {
mode = 2;
dc_get_arg( ARG_ANY );
if ( Dc_arg_type&ARG_NONE ) {
debug_help();
return;
}
}
if ( strstr( Dc_command_line, "?" ) ) {
mode = 2;
}
if ( !(Dc_arg_type&ARG_STRING) ) {
dc_printf( "Invalid keyword '%s'\n", Dc_arg );
return;
}
if (Dc_debug_on) {
dc_printf( "Searching for command '%s'\n", Dc_arg );
}
for (i=0; i<Num_debug_commands; i++ ) {
if ( !stricmp( Debug_command[i]->name, Dc_arg )) {
if (mode==0) {
if (Dc_debug_on)
dc_printf( "Calling function '%s'\n", Dc_arg );
Dc_command = 1;
Dc_help = 0;
Dc_status = 1;
} else if (mode==1) {
if (Dc_debug_on)
dc_printf( "Checking status for '%s'\n", Dc_arg );
Dc_command = 0;
Dc_help = 0;
Dc_status = 1;
} else {
if (Dc_debug_on)
dc_printf( "Doing help for '%s'\n", Dc_arg );
Dc_command = 0;
Dc_help = 1;
Dc_status = 0;
}
(*Debug_command[i]->func)();
if (mode==0) {
dc_get_arg(ARG_ANY);
if (!(Dc_arg_type&ARG_NONE)) {
dc_printf( "Ignoring the unused command line tail '%s %s'\n", Dc_arg_org, Dc_command_line );
}
}
return;
}
}
dc_printf( "Unknown command '%s'\n", Dc_arg );
}
void debug_draw()
{
int i;
gr_clear();
gr_set_font(FONT1);
gr_set_color_fast( &Color_bright );
gr_string( 0x8000, 3, "Debug Console" );
gr_set_color_fast( &Color_normal );
for (i=0; i<DROWS; i++ ) {
gr_string( 0, i*16+16, debug_text[i] );
}
int t = timer_get_fixed_seconds() / (F1_0/3);
if ( t & 1 ) {
int w,h;
char c;
c = debug_text[debug_y][command_line_pos+1];
debug_text[debug_y][command_line_pos+1] = 0;
gr_get_string_size( &w, &h, debug_text[debug_y] );
//gr_string( w, debug_y*16, "_" );
gr_rect(w+1,debug_y*16+1+16,2,14);
debug_text[debug_y][command_line_pos+1] = c;
}
gr_flip();
}
void debug_output( char c )
{
if ( c == '\t' ) {
int next_tab = ((debug_x/28)+1)*28;
if ( next_tab >= DCOLS-1 ) {
debug_x=0;
debug_y++;
scroll_times++;
if ( debug_y >= DROWS ) {
int i;
for (i=1; i<DROWS; i++ )
strcpy( debug_text[i-1], debug_text[i] );
debug_y = DROWS-1;
debug_x = 0;
debug_text[debug_y][debug_x] = 0;
}
debug_text[debug_y][debug_x] = 0;
return;
}
for ( ; debug_x < next_tab; )
debug_text[debug_y][debug_x++] = ' ';
debug_text[debug_y][debug_x] = 0;
return;
}
if ( (c == '\n') || (debug_x >= DCOLS-1) ) {
debug_x=0;
debug_y++;
scroll_times++;
if ( debug_y >= DROWS ) {
int i;
for (i=1; i<DROWS; i++ )
strcpy( debug_text[i-1], debug_text[i] );
debug_y = DROWS-1;
debug_x = 0;
debug_text[debug_y][debug_x] = 0;
}
debug_text[debug_y][debug_x] = 0;
if ( c == '\n' ) return;
}
debug_text[debug_y][debug_x++] = c;
debug_text[debug_y][debug_x] = 0;
}
void dc_printf(char *format, ...)
{
char tmp[DCOLS*2];
va_list args;
va_start(args, format);
vsprintf(tmp, format, args);
va_end(args);
char *p = tmp;
while( *p ) {
debug_output(*p);
p++;
}
}
void debug_init()
{
int i;
if ( debug_inited ) return;
debug_inited = 1;
debug_x=0;
debug_y=0;
for (i=0; i<DROWS; i++ ) {
debug_text[i][0] = 0;
}
dc_printf("Debug console started.\n" );
}
void debug_console( void (*_func)() )
{
int done = 0;
scanner_init();
while( key_inkey() ){
os_poll();
}
if ( !debug_inited ) debug_init();
debug_draw();
while (!done) {
// poll the os
os_poll();
int k = key_inkey();
switch( k ) {
case KEY_SHIFTED+KEY_ENTER:
case KEY_ESC:
done=1; break;
case KEY_BACKSP:
if ( command_line_pos > 0 ) {
command_line[--command_line_pos] = 0;
}
break;
case KEY_F3:
if ( last_oldcommand > -1 ) {
strcpy( command_line, oldcommand_line[last_oldcommand] );
command_line_pos = strlen(command_line);
command_line[command_line_pos] = 0;
}
break;
case KEY_UP:
command_scroll--;
if (command_scroll<0)
command_scroll = last_oldcommand;
if ( command_scroll > -1 ) {
strcpy( command_line, oldcommand_line[command_scroll] );
command_line_pos = strlen(command_line);
command_line[command_line_pos] = 0;
}
break;
case KEY_DOWN:
command_scroll++;
if (command_scroll>last_oldcommand)
command_scroll = 0;
if (command_scroll>last_oldcommand)
command_scroll = -1;
if ( command_scroll > -1 ) {
strcpy( command_line, oldcommand_line[command_scroll] );
command_line_pos = strlen(command_line);
command_line[command_line_pos] = 0;
}
break;
case KEY_ENTER: {
debug_output( '\n' );
debug_draw();
debug_do_command(command_line);
int i, found = 0;
for (i=0; i<=last_oldcommand; i++ ) {
if (!stricmp( oldcommand_line[i], command_line )) {
found = 1;
}
}
if ( !found ) {
if ( last_oldcommand < DEBUG_HISTORY-1 ) {
last_oldcommand++;
strcpy( oldcommand_line[last_oldcommand], command_line);
} else {
int i;
for (i=0; i<last_oldcommand; i++ ) {
strcpy( oldcommand_line[i], oldcommand_line[i+1] );
}
strcpy( oldcommand_line[last_oldcommand], command_line);
}
}
// int i;
// for (i=0; i<=last_oldcommand; i++ ) {
// dc_printf( "OC %d. %s\n", i, oldcommand_line[i] );
// }
debug_output( '\n' );
command_line_pos = 0;
command_line[command_line_pos] = 0;
command_scroll = 0;
}
break;
default: {
ubyte c = (ubyte)key_to_ascii(k);
if ( c != 255 ) {
command_line[command_line_pos++] = c;
command_line[command_line_pos] = 0;
}
}
}
strcpy( debug_text[debug_y], ">" );
strcat( debug_text[debug_y], command_line );
debug_draw();
if ( _func ){
_func();
}
}
while( key_inkey() ){
os_poll();
}
}
void debug_help()
{
int s, i;
dc_printf( "Available functions:\n\n" );
s = scroll_times;
for (i=0; i<Num_debug_commands; i++ ) {
dc_printf( " %s - %s\n", Debug_command[i]->name, Debug_command[i]->help );
//mprintf(( "Scroll times %d\n", scroll_times - s ));
if ( scroll_times - s > DROWS - 3 ) {
int k;
dc_printf( " Press a key...B for back\n" );
debug_draw();
k = key_getch();
s = scroll_times;
if ( k == KEY_B ) {
i -= ((DROWS-3)*2);
if ( i <= 0 )
i = -1;
}
}
debug_draw();
}
dc_printf( "\n" );
dc_printf( "Typing '? function_name' will give the current status.\n" );
dc_printf( "Typing 'function_name ?' will give help on the function.\n" );
dc_printf( "Typing ? or help will give you help.\n");
dc_printf( "F3 selects last command line.\n" );
}
File diff suppressed because it is too large. Load diff
+112
View File
@@ -0,0 +1,112 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Demo/Demo.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:21 $
* $Author: penguin $
*
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 3 3/29/99 6:17p Dave
* More work on demo system. Got just about everything in except for
* blowing ships up, secondary weapons and player death/warpout.
*
* 2 3/28/99 5:58p Dave
* Added early demo code. Make objects move. Nice and framerate
* independant, but not much else. Don't use yet unless you're me :)
*
*
* $NoKeywords: $
*/
#ifndef _FS2_DEMO_SYSTEM_HEADER_FILE
#define _FS2_DEMO_SYSTEM_HEADER_FILE
// -----------------------------------------------------------------------------------------------------------------------------
// DEMO DEFINES/VARS
//
// compile in the demo system
#define DEMO_SYSTEM
struct object;
struct ship;
// an error reading or writing the demo file
#define DEMO_ERROR_NONE 0 // no error
#define DEMO_ERROR_GENERAL 1 // general problem
#define DEMO_ERROR_FRAMESIZE 2 // frame size was too big (> 32k)
#define DEMO_ERROR_DISK_SPACE 3 // out of disk space
#define DEMO_ERROR_DISK_ACCESS 4 // problem accessing disk
#define DEMO_ERROR_VERSION 5 // bad version #
#define DEMO_ERROR_MISSION 6 // different mission file checksums
extern int Demo_error;
extern int Demo_make;
// -----------------------------------------------------------------------------------------------------------------------------
// DEMO FUNCTIONS
//
// do frame for the demo - start for the frame
int demo_do_frame_start();
// do frame for the demo - end for the frame
int demo_do_frame_end();
// initialize a demo for recording
// NOTE : call this after loading the mission and going through the briefing, but _before_ physically moving into the mission
int demo_start_record(char *file);
// initialize a demo for playback - calling this will load up the demo file and move the player into the playback state
int demo_start_playback(char *file);
// finish the demo, whether recording or playing back
void demo_close();
// if we should run the simulation for this object, or let the demo system handle it
int demo_should_sim(object *objp);
// functions for posting critical events to the demo system ------------------------------------------------------------
// post an object dump event (only used internally)
void demo_POST_object_dump();
// post a primary fired event
void demo_POST_primary_fired(object *objp, int banks, int linked);
// post a unique message
void demo_POST_unique_message(char *id, char *who_from, int m_source, int priority);
// post a builtin message
void demo_POST_builtin_message(int type, ship *shipp, int priority, int timing);
// post an object create message
void demo_POST_obj_create(char *pobj_name, int signature);
// post a warpin event
void demo_POST_warpin(int signature, int ship_flags);
// post a warpout event
void demo_POST_warpout(int signature, int ship_flags);
// post a departed event
void demo_POST_departed(int signature, int ship_flags);
// post a ship kill event
void demo_POST_ship_kill(object *objp);
#endif
+131
View File
@@ -0,0 +1,131 @@
/*==========================================================================;
*
* Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved.
*
* File: async.h
* Content: AsyncData object include file
***************************************************************************/
#ifndef __ASYNC_INCLUDED__
#define __ASYNC_INCLUDED__
#include <ole2.h> // for DECLARE_INTERFACE and HRESULT
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* GUIDS used by DPAsyncData objects
*/
// {47BCD7E0-2E89-11d0-A889-00A0C905433C}
DEFINE_GUID(IID_IDPAsyncData, 0x47bcd7e0, 0x2e89, 0x11d0, 0xa8, 0x89, 0x0, 0xa0, 0xc9, 0x5, 0x43, 0x3c);
/****************************************************************************
*
* IDPAsyncData Structures
*
* Various structures used to invoke DPAsyncData.
*
****************************************************************************/
typedef struct IDPAsyncData FAR *LPDPASYNCDATA;
/****************************************************************************
*
* IDPAsyncData Interface
*
****************************************************************************/
#undef INTERFACE
#define INTERFACE IDPAsyncData
DECLARE_INTERFACE_( IDPAsyncData, IUnknown )
{
/* IUnknown Methods */
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDPAsyncData Methods */
STDMETHOD(AddItem) (THIS_ LPDWORD, LPVOID, DWORD) PURE;
STDMETHOD(Cancel) (THIS) PURE;
STDMETHOD(GetFlags) (THIS_ LPDWORD) PURE;
STDMETHOD(GetItem) (THIS_ DWORD, LPVOID *) PURE;
STDMETHOD(GetItemCount) (THIS_ LPDWORD) PURE;
STDMETHOD(GetStatus) (THIS_ LPDWORD, LPDWORD, HRESULT *) PURE;
STDMETHOD(IsSnapshotCurrent) (THIS) PURE;
STDMETHOD(RefreshSnapshot) (THIS) PURE;
STDMETHOD(RemoveItem) (THIS_ DWORD) PURE;
STDMETHOD(SetFlags) (THIS_ DWORD) PURE;
STDMETHOD(SetItem) (THIS_ DWORD, LPVOID, DWORD) PURE;
STDMETHOD(SetStatus) (THIS_ DWORD) PURE;
STDMETHOD(SetStatusEvent) (THIS_ DWORD, HANDLE) PURE;
};
/****************************************************************************
*
* IDPAsyncData interface macros
*
****************************************************************************/
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDPAsyncData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDPAsyncData_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDPAsyncData_Release(p) (p)->lpVtbl->Release(p)
#define IDPAsyncData_AddItem(p) (p)->lpVtbl->AddItem(p)
#define IDPAsyncData_Cancel(p) (p)->lpVtbl->Cancel(p)
#define IDPAsyncData_GetItem(p,a,b) (p)->lpVtbl->GetItem(p,a,b)
#define IDPAsyncData_GetItemCount(p,a) (p)->lpVtbl->GetItemCount(p,a)
#define IDPAsyncData_GetStatus(p,a,b,c) (p)->lpVtbl->GetStatus(p,a,b,c)
#define IDPAsyncData_IsSnapshotCurrent(p) (p)->lpVtbl->IsSnapshotCurrent(p)
#define IDPAsyncData_RefreshSnapshot(p) (p)->lpVtbl->RefreshSnapshot(p)
#define IDPAsyncData_RemoveItem(p) (p)->lpVtbl->RemoveItem(p)
#define IDPAsyncData_SetFlags(p) (p)->lpVtbl->SetFlags(p)
#define IDPAsyncData_SetItem(p) (p)->lpVtbl->SetItem(p)
#define IDPAsyncData_SetStatus(p) (p)->lpVtbl->SetStatus(p)
#define IDPAsyncData_SetStatusEvent(p,a,b) (p)->lpVtbl->SetStatusEvent(p,a,b)
#else /* C++ */
#define IDPAsyncData_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDPAsyncData_AddRef(p) (p)->AddRef()
#define IDPAsyncData_Release(p) (p)->Release()
#define IDPAsyncData_AddItem(p) (p)->AddItem()
#define IDPAsyncData_Cancel(p) (p)->Cancel()
#define IDPAsyncData_GetItem(p,a,b) (p)->GetItem(a,b)
#define IDPAsyncData_GetItemCount(p,a) (p)->GetItemCount(a)
#define IDPAsyncData_GetStatus(p,a,b,c) (p)->GetStatus(a,b,c)
#define IDPAsyncData_IsSnapshotCurrent(p) (p)->IsSnapshotCurrent()
#define IDPAsyncData_RefreshSnapshot(p) (p)->RefreshSnapshot()
#define IDPAsyncData_RemoveItem(p) (p)->RemoveItem()
#define IDPAsyncData_SetFlags(p) (p)->SetFlags()
#define IDPAsyncData_SetItem(p) (p)->SetItem()
#define IDPAsyncData_SetStatus(p) (p)->SetStatus()
#define IDPAsyncData_SetStatusEvent(p,a,b) (p)->SetStatusEvent(a,b)
#endif
/****************************************************************************
*
* AsyncData Flags
*
****************************************************************************/
/*
* This flag is set if the ItemData is ANSI. If it is not set, the ItemData
* is either Unicode or doesn't contain any string information.
*/
#define DPASYNCDATA_ANSI (0x00000001)
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif /* __ASYNC_INCLUDED__ */
+896
View File
@@ -0,0 +1,896 @@
/*==========================================================================;
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* File: d3d.h
* Content: Direct3D include file
*
***************************************************************************/
#ifndef _D3D_H_
#define _D3D_H_
#include <stdlib.h>
#ifdef _WIN32
#define COM_NO_WINDOWS_H
#include <objbase.h>
#else
#include "d3dcom.h"
#endif
#ifdef _WIN32
#define D3DAPI WINAPI
#else
#define D3DAPI
#endif
/*
* Interface IID's
*/
#if defined( _WIN32 ) && !defined( _NO_COM)
DEFINE_GUID( IID_IDirect3D, 0x3BBA0080,0x2421,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 );
DEFINE_GUID( IID_IDirect3D2, 0x6aae1ec1,0x662a,0x11d0,0x88,0x9d,0x00,0xaa,0x00,0xbb,0xb7,0x6a);
DEFINE_GUID( IID_IDirect3DRampDevice, 0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 );
DEFINE_GUID( IID_IDirect3DRGBDevice, 0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 );
DEFINE_GUID( IID_IDirect3DHALDevice, 0x84E63dE0,0x46AA,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E );
DEFINE_GUID( IID_IDirect3DMMXDevice, 0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29 );
DEFINE_GUID( IID_IDirect3DDevice, 0x64108800,0x957d,0X11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29 );
DEFINE_GUID( IID_IDirect3DDevice2, 0x93281501, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29);
DEFINE_GUID( IID_IDirect3DTexture, 0x2CDCD9E0,0x25A0,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 );
DEFINE_GUID( IID_IDirect3DTexture2, 0x93281502, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29);
DEFINE_GUID( IID_IDirect3DLight, 0x4417C142,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E );
DEFINE_GUID( IID_IDirect3DMaterial, 0x4417C144,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E );
DEFINE_GUID( IID_IDirect3DMaterial2, 0x93281503, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29);
DEFINE_GUID( IID_IDirect3DExecuteBuffer,0x4417C145,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E );
DEFINE_GUID( IID_IDirect3DViewport, 0x4417C146,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E );
DEFINE_GUID( IID_IDirect3DViewport2, 0x93281500, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29);
#endif
/*
* Data structures
*/
#ifdef __cplusplus
/* 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined */
struct IDirect3D;
struct IDirect3D2;
struct IDirect3DDevice;
struct IDirect3DDevice2;
struct IDirect3DExecuteBuffer;
struct IDirect3DLight;
struct IDirect3DMaterial;
struct IDirect3DMaterial2;
struct IDirect3DTexture;
struct IDirect3DTexture2;
struct IDirect3DViewport;
struct IDirect3DViewport2;
typedef struct IDirect3D *LPDIRECT3D;
typedef struct IDirect3D2 *LPDIRECT3D2;
typedef struct IDirect3DDevice *LPDIRECT3DDEVICE;
typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2;
typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER;
typedef struct IDirect3DLight *LPDIRECT3DLIGHT;
typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL;
typedef struct IDirect3DMaterial2 *LPDIRECT3DMATERIAL2;
typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE;
typedef struct IDirect3DTexture2 *LPDIRECT3DTEXTURE2;
typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT;
typedef struct IDirect3DViewport2 *LPDIRECT3DVIEWPORT2;
#else
typedef struct IDirect3D *LPDIRECT3D;
typedef struct IDirect3D2 *LPDIRECT3D2;
typedef struct IDirect3DDevice *LPDIRECT3DDEVICE;
typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2;
typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER;
typedef struct IDirect3DLight *LPDIRECT3DLIGHT;
typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL;
typedef struct IDirect3DMaterial2 *LPDIRECT3DMATERIAL2;
typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE;
typedef struct IDirect3DTexture2 *LPDIRECT3DTEXTURE2;
typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT;
typedef struct IDirect3DViewport2 *LPDIRECT3DVIEWPORT2;
#endif
#include "directx/vd3dtypes.h"
#include "directx/vd3dcaps.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* IDirect3D
*/
#undef INTERFACE
#define INTERFACE IDirect3D
DECLARE_INTERFACE_(IDirect3D, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3D methods ***/
STDMETHOD(Initialize) (THIS_ REFIID) PURE;
STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID) PURE;
STDMETHOD(CreateLight) (THIS_ LPDIRECT3DLIGHT*, IUnknown*) PURE;
STDMETHOD(CreateMaterial) (THIS_ LPDIRECT3DMATERIAL*, IUnknown*) PURE;
STDMETHOD(CreateViewport) (THIS_ LPDIRECT3DVIEWPORT*, IUnknown*) PURE;
STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3D_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3D_Initialize(p, a) (p)->lpVtbl->Initialize(p, a)
#define IDirect3D_EnumDevices(p, a, b) (p)->lpVtbl->EnumDevices(p, a, b)
#define IDirect3D_CreateLight(p, a, b) (p)->lpVtbl->CreateLight(p, a, b)
#define IDirect3D_CreateMaterial(p, a, b) (p)->lpVtbl->CreateMaterial(p, a, b)
#define IDirect3D_CreateViewport(p, a, b) (p)->lpVtbl->CreateViewport(p, a, b)
#define IDirect3D_FindDevice(p, a, b) (p)->lpVtbl->FindDevice(p, a, b)
#else
#define IDirect3D_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3D_AddRef(p) (p)->AddRef()
#define IDirect3D_Release(p) (p)->Release()
#define IDirect3D_Initialize(p, a) (p)->Initialize(a)
#define IDirect3D_EnumDevices(p, a, b) (p)->EnumDevices(a, b)
#define IDirect3D_CreateLight(p, a, b) (p)->CreateLight(a, b)
#define IDirect3D_CreateMaterial(p, a, b) (p)->CreateMaterial(a, b)
#define IDirect3D_CreateViewport(p, a, b) (p)->CreateViewport(a, b)
#define IDirect3D_FindDevice(p, a, b) (p)->FindDevice(a, b)
#endif
/*
* IDirect3D2
*/
#undef INTERFACE
#define INTERFACE IDirect3D2
DECLARE_INTERFACE_(IDirect3D2, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3D methods ***/
STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID) PURE;
STDMETHOD(CreateLight) (THIS_ LPDIRECT3DLIGHT*, IUnknown*) PURE;
STDMETHOD(CreateMaterial) (THIS_ LPDIRECT3DMATERIAL2*, IUnknown*) PURE;
STDMETHOD(CreateViewport) (THIS_ LPDIRECT3DVIEWPORT2*, IUnknown*) PURE;
STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE;
STDMETHOD(CreateDevice)(THIS_ REFCLSID, LPDIRECTDRAWSURFACE, LPDIRECT3DDEVICE2 *) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3D2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3D2_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3D2_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3D2_EnumDevices(p, a, b) (p)->lpVtbl->EnumDevices(p, a, b)
#define IDirect3D2_CreateLight(p, a, b) (p)->lpVtbl->CreateLight(p, a, b)
#define IDirect3D2_CreateMaterial(p, a, b) (p)->lpVtbl->CreateMaterial(p, a, b)
#define IDirect3D2_CreateViewport(p, a, b) (p)->lpVtbl->CreateViewport(p, a, b)
#define IDirect3D2_FindDevice(p, a, b) (p)->lpVtbl->FindDevice(p, a, b)
#define IDirect3D2_CreateDevice(p, a, b, c) (p)->lpVtbl->CreateDevice(p, a, b, c)
#else
#define IDirect3D2_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3D2_AddRef(p) (p)->AddRef()
#define IDirect3D2_Release(p) (p)->Release()
#define IDirect3D2_EnumDevices(p, a, b) (p)->EnumDevices(a, b)
#define IDirect3D2_CreateLight(p, a, b) (p)->CreateLight(a, b)
#define IDirect3D2_CreateMaterial(p, a, b) (p)->CreateMaterial(a, b)
#define IDirect3D2_CreateViewport(p, a, b) (p)->CreateViewport(a, b)
#define IDirect3D2_FindDevice(p, a, b) (p)->FindDevice(a, b)
#define IDirect3D2_CreateDevice(p, a, b, c) (p)->CreateDevice(a, b, c)
#endif
/*
* IDirect3DDevice
*/
#undef INTERFACE
#define INTERFACE IDirect3DDevice
DECLARE_INTERFACE_(IDirect3DDevice, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DDevice methods ***/
STDMETHOD(Initialize) (THIS_ LPDIRECT3D, LPGUID, LPD3DDEVICEDESC) PURE;
STDMETHOD(GetCaps) (THIS_ LPD3DDEVICEDESC, LPD3DDEVICEDESC) PURE;
STDMETHOD(SwapTextureHandles) (THIS_ LPDIRECT3DTEXTURE, LPDIRECT3DTEXTURE) PURE;
STDMETHOD(CreateExecuteBuffer) (THIS_ LPD3DEXECUTEBUFFERDESC, LPDIRECT3DEXECUTEBUFFER*, IUnknown*) PURE;
STDMETHOD(GetStats) (THIS_ LPD3DSTATS) PURE;
STDMETHOD(Execute) (THIS_ LPDIRECT3DEXECUTEBUFFER, LPDIRECT3DVIEWPORT, DWORD) PURE;
STDMETHOD(AddViewport) (THIS_ LPDIRECT3DVIEWPORT) PURE;
STDMETHOD(DeleteViewport) (THIS_ LPDIRECT3DVIEWPORT) PURE;
STDMETHOD(NextViewport) (THIS_ LPDIRECT3DVIEWPORT, LPDIRECT3DVIEWPORT*, DWORD) PURE;
STDMETHOD(Pick) (THIS_ LPDIRECT3DEXECUTEBUFFER, LPDIRECT3DVIEWPORT, DWORD, LPD3DRECT) PURE;
STDMETHOD(GetPickRecords)(THIS_ LPDWORD, LPD3DPICKRECORD) PURE;
STDMETHOD(EnumTextureFormats) (THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK, LPVOID) PURE;
STDMETHOD(CreateMatrix) (THIS_ LPD3DMATRIXHANDLE) PURE;
STDMETHOD(SetMatrix) (THIS_ D3DMATRIXHANDLE, const LPD3DMATRIX) PURE;
STDMETHOD(GetMatrix) (THIS_ D3DMATRIXHANDLE, LPD3DMATRIX) PURE;
STDMETHOD(DeleteMatrix) (THIS_ D3DMATRIXHANDLE) PURE;
STDMETHOD_(HRESULT, BeginScene) (THIS) PURE;
STDMETHOD_(HRESULT, EndScene) (THIS) PURE;
STDMETHOD(GetDirect3D) (THIS_ LPDIRECT3D*) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DDevice_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DDevice_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DDevice_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DDevice_Initialize(p, a, b, c) (p)->lpVtbl->Initialize(p, a, b, c)
#define IDirect3DDevice_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b)
#define IDirect3DDevice_SwapTextureHandles(p, a, b) (p)->lpVtbl->SwapTextureHandles(p, a, b)
#define IDirect3DDevice_CreateExecuteBuffer(p, a, b, c) (p)->lpVtbl->CreateExecuteBuffer(p, a, b, c)
#define IDirect3DDevice_GetStats(p, a) (p)->lpVtbl->GetStats(p, a)
#define IDirect3DDevice_Execute(p, a, b, c) (p)->lpVtbl->Execute(p, a, b, c)
#define IDirect3DDevice_AddViewport(p, a) (p)->lpVtbl->AddViewport(p, a)
#define IDirect3DDevice_DeleteViewport(p, a) (p)->lpVtbl->DeleteViewport(p, a)
#define IDirect3DDevice_NextViewport(p, a, b) (p)->lpVtbl->NextViewport(p, a, b)
#define IDirect3DDevice_Pick(p, a, b, c, d) (p)->lpVtbl->Pick(p, a, b, c, d)
#define IDirect3DDevice_GetPickRecords(p, a, b) (p)->lpVtbl->GetPickRecords(p, a, b)
#define IDirect3DDevice_EnumTextureFormats(p, a, b) (p)->lpVtbl->EnumTextureFormats(p, a, b)
#define IDirect3DDevice_CreateMatrix(p, a) (p)->lpVtbl->CreateMatrix(p, a)
#define IDirect3DDevice_SetMatrix(p, a, b) (p)->lpVtbl->SetMatrix(p, a, b)
#define IDirect3DDevice_GetMatrix(p, a, b) (p)->lpVtbl->GetMatrix(p, a, b)
#define IDirect3DDevice_DeleteMatrix(p, a) (p)->lpVtbl->DeleteMatrix(p, a)
#define IDirect3DDevice_BeginScene(p) (p)->lpVtbl->BeginScene(p)
#define IDirect3DDevice_EndScene(p) (p)->lpVtbl->EndScene(p)
#define IDirect3DDevice_GetDirect3D(p, a) (p)->lpVtbl->GetDirect3D(p, a)
#else
#define IDirect3DDevice_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DDevice_AddRef(p) (p)->AddRef()
#define IDirect3DDevice_Release(p) (p)->Release()
#define IDirect3DDevice_Initialize(p, a, b, c) (p)->Initialize(a, b, c)
#define IDirect3DDevice_GetCaps(p, a, b) (p)->GetCaps(a, b)
#define IDirect3DDevice_SwapTextureHandles(p, a, b) (p)->SwapTextureHandles(a, b)
#define IDirect3DDevice_CreateExecuteBuffer(p, a, b, c) (p)->CreateExecuteBuffer(a, b, c)
#define IDirect3DDevice_GetStats(p, a) (p)->GetStats(a)
#define IDirect3DDevice_Execute(p, a, b, c) (p)->Execute(a, b, c)
#define IDirect3DDevice_AddViewport(p, a) (p)->AddViewport(a)
#define IDirect3DDevice_DeleteViewport(p, a) (p)->DeleteViewport(a)
#define IDirect3DDevice_NextViewport(p, a, b) (p)->NextViewport(a, b)
#define IDirect3DDevice_Pick(p, a, b, c, d) (p)->Pick(a, b, c, d)
#define IDirect3DDevice_GetPickRecords(p, a, b) (p)->GetPickRecords(a, b)
#define IDirect3DDevice_EnumTextureFormats(p, a, b) (p)->EnumTextureFormats(a, b)
#define IDirect3DDevice_CreateMatrix(p, a) (p)->CreateMatrix(a)
#define IDirect3DDevice_SetMatrix(p, a, b) (p)->SetMatrix(a, b)
#define IDirect3DDevice_GetMatrix(p, a, b) (p)->GetMatrix(a, b)
#define IDirect3DDevice_DeleteMatrix(p, a) (p)->DeleteMatrix(a)
#define IDirect3DDevice_BeginScene(p) (p)->BeginScene()
#define IDirect3DDevice_EndScene(p) (p)->EndScene()
#define IDirect3DDevice_GetDirect3D(p, a) (p)->GetDirect3D(a)
#endif
/*
* IDirect3DDevice2
*/
#undef INTERFACE
#define INTERFACE IDirect3DDevice2
DECLARE_INTERFACE_(IDirect3DDevice2, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DDevice2 methods ***/
STDMETHOD(GetCaps) (THIS_ LPD3DDEVICEDESC, LPD3DDEVICEDESC) PURE;
STDMETHOD(SwapTextureHandles) (THIS_ LPDIRECT3DTEXTURE2, LPDIRECT3DTEXTURE2) PURE;
STDMETHOD(GetStats) (THIS_ LPD3DSTATS) PURE;
STDMETHOD(AddViewport) (THIS_ LPDIRECT3DVIEWPORT2) PURE;
STDMETHOD(DeleteViewport) (THIS_ LPDIRECT3DVIEWPORT2) PURE;
STDMETHOD(NextViewport) (THIS_ LPDIRECT3DVIEWPORT2, LPDIRECT3DVIEWPORT2*, DWORD) PURE;
STDMETHOD(EnumTextureFormats) (THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK, LPVOID) PURE;
STDMETHOD_(HRESULT, BeginScene) (THIS) PURE;
STDMETHOD_(HRESULT, EndScene) (THIS) PURE;
STDMETHOD(GetDirect3D) (THIS_ LPDIRECT3D2*) PURE;
/*** DrawPrimitive API ***/
STDMETHOD(SetCurrentViewport) (THIS_ LPDIRECT3DVIEWPORT2) PURE;
STDMETHOD(GetCurrentViewport) (THIS_ LPDIRECT3DVIEWPORT2 *) PURE;
STDMETHOD(SetRenderTarget) (THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE;
STDMETHOD(GetRenderTarget) (THIS_ LPDIRECTDRAWSURFACE *) PURE;
STDMETHOD(Begin) (THIS_ D3DPRIMITIVETYPE, D3DVERTEXTYPE, DWORD) PURE;
STDMETHOD(BeginIndexed) (THIS_ D3DPRIMITIVETYPE, D3DVERTEXTYPE, LPVOID, DWORD, DWORD) PURE;
STDMETHOD(Vertex) (THIS_ LPVOID) PURE;
STDMETHOD(Index) (THIS_ WORD) PURE;
STDMETHOD(End) (THIS_ DWORD) PURE;
STDMETHOD(GetRenderState) (THIS_ D3DRENDERSTATETYPE, LPDWORD) PURE;
STDMETHOD(SetRenderState) (THIS_ D3DRENDERSTATETYPE, DWORD) PURE;
STDMETHOD(GetLightState) (THIS_ D3DLIGHTSTATETYPE, LPDWORD) PURE;
STDMETHOD(SetLightState) (THIS_ D3DLIGHTSTATETYPE, DWORD) PURE;
STDMETHOD(SetTransform) (THIS_ D3DTRANSFORMSTATETYPE, LPD3DMATRIX) PURE;
STDMETHOD(GetTransform) (THIS_ D3DTRANSFORMSTATETYPE, LPD3DMATRIX) PURE;
STDMETHOD(MultiplyTransform) (THIS_ D3DTRANSFORMSTATETYPE, LPD3DMATRIX) PURE;
STDMETHOD(DrawPrimitive) (THIS_ D3DPRIMITIVETYPE, D3DVERTEXTYPE, LPVOID, DWORD, DWORD) PURE;
STDMETHOD(DrawIndexedPrimitive) (THIS_ D3DPRIMITIVETYPE, D3DVERTEXTYPE, LPVOID, DWORD, LPWORD, DWORD, DWORD) PURE;
STDMETHOD(SetClipStatus) (THIS_ LPD3DCLIPSTATUS) PURE;
STDMETHOD(GetClipStatus) (THIS_ LPD3DCLIPSTATUS) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DDevice2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DDevice2_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DDevice2_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DDevice2_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b)
#define IDirect3DDevice2_SwapTextureHandles(p, a, b) (p)->lpVtbl->SwapTextureHandles(p, a, b)
#define IDirect3DDevice2_GetStats(p, a) (p)->lpVtbl->CreateViewport(p, a)
#define IDirect3DDevice2_AddViewport(p, a) (p)->lpVtbl->AddViewport(p, a)
#define IDirect3DDevice2_DeleteViewport(p, a) (p)->lpVtbl->DeleteViewport(p, a)
#define IDirect3DDevice2_NextViewport(p, a, b) (p)->lpVtbl->NextViewport(p, a, b)
#define IDirect3DDevice2_EnumTextureFormats(p, a, b) (p)->lpVtbl->EnumTextureFormats(p, a, b)
#define IDirect3DDevice2_BeginScene(p) (p)->lpVtbl->BeginScene(p)
#define IDirect3DDevice2_EndScene(p) (p)->lpVtbl->EndScene(p)
#define IDirect3DDevice2_GetDirect3D(p, a) (p)->lpVtbl->GetDirect3D(p, a)
#define IDirect3DDevice2_SetCurrentViewport(p, a) (p)->lpVtbl->SetCurrentViewport(p, a)
#define IDirect3DDevice2_GetCurrentViewport(p, a) (p)->lpVtbl->GetCurrentViewport(p, a)
#define IDirect3DDevice2_SetRenderTarget(p, a, b) (p)->lpVtbl->SetRenderTarget(p, a, b)
#define IDirect3DDevice2_GetRenderTarget(p, a) (p)->lpVtbl->GetRenderTarget(p, a)
#define IDirect3DDevice2_Begin(p, a, b, c) (p)->lpVtbl->Begin(p, a, b, c)
#define IDirect3DDevice2_BeginIndexed(p, a, b, c, d, e) (p)->lpVtbl->Begin(p, a, b, c, d, e)
#define IDirect3DDevice2_Vertex(p, a) (p)->lpVtbl->Vertex(p, a)
#define IDirect3DDevice2_Index(p, a) (p)->lpVtbl->Index(p, a)
#define IDirect3DDevice2_End(p, a) (p)->lpVtbl->End(p, a)
#define IDirect3DDevice2_GetRenderState(p, a, b) (p)->lpVtbl->GetRenderState(p, a, b)
#define IDirect3DDevice2_SetRenderState(p, a, b) (p)->lpVtbl->SetRenderState(p, a, b)
#define IDirect3DDevice2_GetLightState(p, a, b) (p)->lpVtbl->GetLightState(p, a, b)
#define IDirect3DDevice2_SetLightState(p, a, b) (p)->lpVtbl->SetLightState(p, a, b)
#define IDirect3DDevice2_SetTransform(p, a, b) (p)->lpVtbl->SetTransform(p, a, b)
#define IDirect3DDevice2_GetTransform(p, a, b) (p)->lpVtbl->GetTransform(p, a, b)
#define IDirect3DDevice2_MultiplyTransform(p, a, b) (p)->lpVtbl->MultiplyTransform(p, a, b)
#define IDirect3DDevice2_DrawPrimitive(p, a, b, c, d, e) (p)->lpVtbl->DrawPrimitive(p, a, b, c, d, e)
#define IDirect3DDevice2_DrawIndexedPrimitive(p, a, b, c, d, e, f, g) \
(p)->lpVtbl->DrawIndexedPrimitive(p, a, b, c, d, e, f, g)
#define IDirect3DDevice2_SetClipStatus(p, a) (p)->lpVtbl->SetClipStatus(p, a)
#define IDirect3DDevice2_GetClipStatus(p, a) (p)->lpVtbl->GetClipStatus(p, a)
#else
#define IDirect3DDevice2_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DDevice2_AddRef(p) (p)->AddRef()
#define IDirect3DDevice2_Release(p) (p)->Release()
#define IDirect3DDevice2_GetCaps(p, a, b) (p)->GetCaps(a, b)
#define IDirect3DDevice2_SwapTextureHandles(p, a, b) (p)->SwapTextureHandles(a, b)
#define IDirect3DDevice2_GetStats(p, a) (p)->CreateViewport(a)
#define IDirect3DDevice2_AddViewport(p, a) (p)->AddViewport(a)
#define IDirect3DDevice2_DeleteViewport(p, a) (p)->DeleteViewport(a)
#define IDirect3DDevice2_NextViewport(p, a, b) (p)->NextViewport(a, b)
#define IDirect3DDevice2_EnumTextureFormats(p, a, b) (p)->EnumTextureFormats(a, b)
#define IDirect3DDevice2_BeginScene(p) (p)->BeginScene()
#define IDirect3DDevice2_EndScene(p) (p)->EndScene()
#define IDirect3DDevice2_GetDirect3D(p, a) (p)->GetDirect3D(a)
#define IDirect3DDevice2_SetCurrentViewport(p, a) (p)->SetCurrentViewport(a)
#define IDirect3DDevice2_GetCurrentViewport(p, a) (p)->GetCurrentViewport(a)
#define IDirect3DDevice2_SetRenderTarget(p, a, b) (p)->SetRenderTarget(a, b)
#define IDirect3DDevice2_GetRenderTarget(p, a) (p)->GetRenderTarget(a)
#define IDirect3DDevice2_Begin(p, a, b, c) (p)->Begin(a, b, c)
#define IDirect3DDevice2_BeginIndexed(p, a, b, c, d, e) (p)->Begin(a, b, c, d, e)
#define IDirect3DDevice2_Vertex(p, a) (p)->Vertex(a)
#define IDirect3DDevice2_Index(p, a) (p)->Index(a)
#define IDirect3DDevice2_End(p, a) (p)->End(a)
#define IDirect3DDevice2_GetRenderState(p, a, b) (p)->GetRenderState(a, b)
#define IDirect3DDevice2_SetRenderState(p, a, b) (p)->SetRenderState(a, b)
#define IDirect3DDevice2_GetLightState(p, a, b) (p)->GetLightState(a, b)
#define IDirect3DDevice2_SetLightState(p, a, b) (p)->SetLightState(a, b)
#define IDirect3DDevice2_SetTransform(p, a, b) (p)->SetTransform(a, b)
#define IDirect3DDevice2_GetTransform(p, a, b) (p)->GetTransform(a, b)
#define IDirect3DDevice2_MultiplyTransform(p, a, b) (p)->MultiplyTransform(a, b)
#define IDirect3DDevice2_DrawPrimitive(p, a, b, c, d, e) (p)->DrawPrimitive(a, b, c, d, e)
#define IDirect3DDevice2_DrawIndexedPrimitive(p, a, b, c, d, e, f, g) \
(p)->DrawIndexedPrimitive(a, b, c, d, e, f, g)
#define IDirect3DDevice2_SetClipStatus(p, a) (p)->SetClipStatus(a)
#define IDirect3DDevice2_GetClipStatus(p, a) (p)->GetClipStatus(a)
#endif
/*
* IDirect3DExecuteBuffer
*/
#undef INTERFACE
#define INTERFACE IDirect3DExecuteBuffer
DECLARE_INTERFACE_(IDirect3DExecuteBuffer, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DExecuteBuffer methods ***/
STDMETHOD(Initialize) (THIS_ LPDIRECT3DDEVICE, LPD3DEXECUTEBUFFERDESC) PURE;
STDMETHOD(Lock) (THIS_ LPD3DEXECUTEBUFFERDESC) PURE;
STDMETHOD_(HRESULT, Unlock) (THIS) PURE;
STDMETHOD(SetExecuteData) (THIS_ LPD3DEXECUTEDATA) PURE;
STDMETHOD(GetExecuteData) (THIS_ LPD3DEXECUTEDATA) PURE;
STDMETHOD(Validate) (THIS_ LPDWORD, LPD3DVALIDATECALLBACK, LPVOID, DWORD) PURE;
STDMETHOD(Optimize) (THIS_ DWORD) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DExecuteBuffer_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DExecuteBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DExecuteBuffer_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DExecuteBuffer_Initialize(p, a, b) (p)->lpVtbl->Initialize(p, a, b)
#define IDirect3DExecuteBuffer_Lock(p, a) (p)->lpVtbl->Lock(p, a)
#define IDirect3DExecuteBuffer_Unlock(p) (p)->lpVtbl->Unlock(p)
#define IDirect3DExecuteBuffer_SetExecuteData(p, a) (p)->lpVtbl->SetExecuteData(p, a)
#define IDirect3DExecuteBuffer_GetExecuteData(p, a) (p)->lpVtbl->GetExecuteData(p, a)
#define IDirect3DExecuteBuffer_Validate(p, a, b, c, d) (p)->lpVtbl->Validate(p, a, b, c, d)
#define IDirect3DExecuteBuffer_Optimize(p, a) (p)->lpVtbl->Optimize(p, a)
#else
#define IDirect3DExecuteBuffer_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DExecuteBuffer_AddRef(p) (p)->AddRef()
#define IDirect3DExecuteBuffer_Release(p) (p)->Release()
#define IDirect3DExecuteBuffer_Initialize(p, a, b) (p)->Initialize(a, b)
#define IDirect3DExecuteBuffer_Lock(p, a) (p)->Lock(a)
#define IDirect3DExecuteBuffer_Unlock(p) (p)->Unlock()
#define IDirect3DExecuteBuffer_SetExecuteData(p, a) (p)->SetExecuteData(a)
#define IDirect3DExecuteBuffer_GetExecuteData(p, a) (p)->GetExecuteData(a)
#define IDirect3DExecuteBuffer_Validate(p, a, b, c, d) (p)->Validate(a, b, c, d)
#define IDirect3DExecuteBuffer_Optimize(p, a) (p)->Optimize(a)
#endif
/*
* IDirect3DLight
*/
#undef INTERFACE
#define INTERFACE IDirect3DLight
DECLARE_INTERFACE_(IDirect3DLight, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DLight methods ***/
STDMETHOD(Initialize) (THIS_ LPDIRECT3D) PURE;
STDMETHOD(SetLight) (THIS_ LPD3DLIGHT) PURE;
STDMETHOD(GetLight) (THIS_ LPD3DLIGHT) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DLight_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DLight_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DLight_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DLight_Initialize(p, a) (p)->lpVtbl->Initialize(p, a)
#define IDirect3DLight_SetLight(p, a) (p)->lpVtbl->SetLight(p, a)
#define IDirect3DLight_GetLight(p, a) (p)->lpVtbl->GetLight(p, a)
#else
#define IDirect3DLight_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DLight_AddRef(p) (p)->AddRef()
#define IDirect3DLight_Release(p) (p)->Release()
#define IDirect3DLight_Initialize(p, a) (p)->Initialize(a)
#define IDirect3DLight_SetLight(p, a) (p)->SetLight(a)
#define IDirect3DLight_GetLight(p, a) (p)->GetLight(a)
#endif
/*
* IDirect3DMaterial
*/
#undef INTERFACE
#define INTERFACE IDirect3DMaterial
DECLARE_INTERFACE_(IDirect3DMaterial, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DMaterial methods ***/
STDMETHOD(Initialize) (THIS_ LPDIRECT3D) PURE;
STDMETHOD(SetMaterial) (THIS_ LPD3DMATERIAL) PURE;
STDMETHOD(GetMaterial) (THIS_ LPD3DMATERIAL) PURE;
STDMETHOD(GetHandle) (THIS_ LPDIRECT3DDEVICE, LPD3DMATERIALHANDLE) PURE;
STDMETHOD_(HRESULT, Reserve) (THIS) PURE;
STDMETHOD_(HRESULT, Unreserve) (THIS) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DMaterial_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DMaterial_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DMaterial_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DMaterial_Initialize(p, a) (p)->lpVtbl->Initialize(p, a)
#define IDirect3DMaterial_SetMaterial(p, a) (p)->lpVtbl->SetMaterial(p, a)
#define IDirect3DMaterial_GetMaterial(p, a) (p)->lpVtbl->GetMaterial(p, a)
#define IDirect3DMaterial_GetHandle(p, a, b) (p)->lpVtbl->GetHandle(p, a, b)
#define IDirect3DMaterial_Reserve(p) (p)->lpVtbl->Reserve(p)
#define IDirect3DMaterial_Unreserve(p) (p)->lpVtbl->Unreserve(p)
#else
#define IDirect3DMaterial_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DMaterial_AddRef(p) (p)->AddRef()
#define IDirect3DMaterial_Release(p) (p)->Release()
#define IDirect3DMaterial_Initialize(p, a) (p)->Initialize(a)
#define IDirect3DMaterial_SetMaterial(p, a) (p)->SetMaterial(a)
#define IDirect3DMaterial_GetMaterial(p, a) (p)->GetMaterial(a)
#define IDirect3DMaterial_GetHandle(p, a, b) (p)->GetHandle(a, b)
#define IDirect3DMaterial_Reserve(p) (p)->Reserve()
#define IDirect3DMaterial_Unreserve(p) (p)->Unreserve()
#endif
/*
* IDirect3DMaterial2
*/
#undef INTERFACE
#define INTERFACE IDirect3DMaterial2
DECLARE_INTERFACE_(IDirect3DMaterial2, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DMaterial2 methods ***/
STDMETHOD(SetMaterial) (THIS_ LPD3DMATERIAL) PURE;
STDMETHOD(GetMaterial) (THIS_ LPD3DMATERIAL) PURE;
STDMETHOD(GetHandle) (THIS_ LPDIRECT3DDEVICE2, LPD3DMATERIALHANDLE) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DMaterial2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DMaterial2_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DMaterial2_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DMaterial2_SetMaterial(p, a) (p)->lpVtbl->SetMaterial(p, a)
#define IDirect3DMaterial2_GetMaterial(p, a) (p)->lpVtbl->GetMaterial(p, a)
#define IDirect3DMaterial2_GetHandle(p, a, b) (p)->lpVtbl->GetHandle(p, a, b)
#else
#define IDirect3DMaterial2_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DMaterial2_AddRef(p) (p)->AddRef()
#define IDirect3DMaterial2_Release(p) (p)->Release()
#define IDirect3DMaterial2_SetMaterial(p, a) (p)->SetMaterial(a)
#define IDirect3DMaterial2_GetMaterial(p, a) (p)->GetMaterial(a)
#define IDirect3DMaterial2_GetHandle(p, a, b) (p)->GetHandle(a, b)
#endif
/*
* IDirect3DTexture
*/
#undef INTERFACE
#define INTERFACE IDirect3DTexture
DECLARE_INTERFACE_(IDirect3DTexture, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DTexture methods ***/
STDMETHOD(Initialize) (THIS_ LPDIRECT3DDEVICE, LPDIRECTDRAWSURFACE) PURE;
STDMETHOD(GetHandle) (THIS_ LPDIRECT3DDEVICE, LPD3DTEXTUREHANDLE) PURE;
STDMETHOD(PaletteChanged) (THIS_ DWORD, DWORD) PURE;
STDMETHOD(Load) (THIS_ LPDIRECT3DTEXTURE) PURE;
STDMETHOD_(HRESULT, Unload) (THIS) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DTexture_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DTexture_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DTexture_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DTexture_Initialize(p, a, b) (p)->lpVtbl->Initialize(p, a, b)
#define IDirect3DTexture_GetHandle(p, a, b) (p)->lpVtbl->GetHandle(p, a, b)
#define IDirect3DTexture_PaletteChanged(p, a, b) (p)->lpVtbl->PaletteChanged(p, a, b)
#define IDirect3DTexture_Load(p, a) (p)->lpVtbl->Load(p, a)
#define IDirect3DTexture_Unload(p) (p)->lpVtbl->Unload(p)
#else
#define IDirect3DTexture_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DTexture_AddRef(p) (p)->AddRef()
#define IDirect3DTexture_Release(p) (p)->Release()
#define IDirect3DTexture_Initialize(p, a, b) (p)->Initialize(a, b)
#define IDirect3DTexture_GetHandle(p, a, b) (p)->GetHandle(a, b)
#define IDirect3DTexture_PaletteChanged(p, a, b) (p)->PaletteChanged(a, b)
#define IDirect3DTexture_Load(p, a) (p)->Load(a)
#define IDirect3DTexture_Unload(p) (p)->Unload()
#endif
/*
* IDirect3DTexture2
*/
#undef INTERFACE
#define INTERFACE IDirect3DTexture2
DECLARE_INTERFACE_(IDirect3DTexture2, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DTexture2 methods ***/
STDMETHOD(GetHandle) (THIS_ LPDIRECT3DDEVICE2, LPD3DTEXTUREHANDLE) PURE;
STDMETHOD(PaletteChanged) (THIS_ DWORD, DWORD) PURE;
STDMETHOD(Load) (THIS_ LPDIRECT3DTEXTURE2) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DTexture2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DTexture2_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DTexture2_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DTexture2_GetHandle(p, a, b) (p)->lpVtbl->GetHandle(p, a, b)
#define IDirect3DTexture2_PaletteChanged(p, a, b) (p)->lpVtbl->PaletteChanged(p, a, b)
#define IDirect3DTexture2_Load(p, a) (p)->lpVtbl->Load(p, a)
#else
#define IDirect3DTexture2_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DTexture2_AddRef(p) (p)->AddRef()
#define IDirect3DTexture2_Release(p) (p)->Release()
#define IDirect3DTexture2_GetHandle(p, a, b) (p)->GetHandle(a, b)
#define IDirect3DTexture2_PaletteChanged(p, a, b) (p)->PaletteChanged(a, b)
#define IDirect3DTexture2_Load(p, a) (p)->Load(a)
#endif
/*
* IDirect3DViewport
*/
#undef INTERFACE
#define INTERFACE IDirect3DViewport
DECLARE_INTERFACE_(IDirect3DViewport, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DViewport methods ***/
STDMETHOD(Initialize) (THIS_ LPDIRECT3D) PURE;
STDMETHOD(GetViewport) (THIS_ LPD3DVIEWPORT) PURE;
STDMETHOD(SetViewport) (THIS_ LPD3DVIEWPORT) PURE;
STDMETHOD(TransformVertices) (THIS_ DWORD, LPD3DTRANSFORMDATA, DWORD, LPDWORD) PURE;
STDMETHOD(LightElements) (THIS_ DWORD, LPD3DLIGHTDATA) PURE;
STDMETHOD(SetBackground) (THIS_ D3DMATERIALHANDLE) PURE;
STDMETHOD(GetBackground) (THIS_ LPD3DMATERIALHANDLE, LPBOOL) PURE;
STDMETHOD(SetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE) PURE;
STDMETHOD(GetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE*, LPBOOL) PURE;
STDMETHOD(Clear) (THIS_ DWORD, LPD3DRECT, DWORD) PURE;
STDMETHOD(AddLight) (THIS_ LPDIRECT3DLIGHT) PURE;
STDMETHOD(DeleteLight) (THIS_ LPDIRECT3DLIGHT) PURE;
STDMETHOD(NextLight) (THIS_ LPDIRECT3DLIGHT, LPDIRECT3DLIGHT*, DWORD) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DViewport_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DViewport_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DViewport_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DViewport_Initialize(p, a) (p)->lpVtbl->Initialize(p, a)
#define IDirect3DViewport_GetViewport(p, a) (p)->lpVtbl->GetViewport(p, a)
#define IDirect3DViewport_SetViewport(p, a) (p)->lpVtbl->SetViewport(p, a)
#define IDirect3DViewport_TransformVertices(p, a, b, c, d) (p)->lpVtbl->TransformVertices(p, a, b, c, d)
#define IDirect3DViewport_LightElements(p, a, b) (p)->lpVtbl->LightElements(p, a, b)
#define IDirect3DViewport_SetBackground(p, a) (p)->lpVtbl->SetBackground(p, a)
#define IDirect3DViewport_GetBackground(p, a, b) (p)->lpVtbl->GetBackground(p, a, b)
#define IDirect3DViewport_SetBackgroundDepth(p, a) (p)->lpVtbl->SetBackgroundDepth(p, a)
#define IDirect3DViewport_GetBackgroundDepth(p, a, b) (p)->lpVtbl->GetBackgroundDepth(p, a, b)
#define IDirect3DViewport_Clear(p, a, b, c) (p)->lpVtbl->Clear(p, a, b, c)
#define IDirect3DViewport_AddLight(p, a) (p)->lpVtbl->AddLight(p, a)
#define IDirect3DViewport_DeleteLight(p, a) (p)->lpVtbl->DeleteLight(p, a)
#define IDirect3DViewport_NextLight(p, a, b, c) (p)->lpVtbl->NextLight(p, a, b, c)
#else
#define IDirect3DViewport_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DViewport_AddRef(p) (p)->AddRef()
#define IDirect3DViewport_Release(p) (p)->Release()
#define IDirect3DViewport_Initialize(p, a) (p)->Initialize(a)
#define IDirect3DViewport_GetViewport(p, a) (p)->GetViewport(a)
#define IDirect3DViewport_SetViewport(p, a) (p)->SetViewport(a)
#define IDirect3DViewport_TransformVertices(p, a, b, c, d) (p)->TransformVertices(a, b, c, d)
#define IDirect3DViewport_LightElements(p, a, b) (p)->LightElements(a, b)
#define IDirect3DViewport_SetBackground(p, a) (p)->SetBackground(a)
#define IDirect3DViewport_GetBackground(p, a, b) (p)->GetBackground(a, b)
#define IDirect3DViewport_SetBackgroundDepth(p, a) (p)->SetBackgroundDepth(a)
#define IDirect3DViewport_GetBackgroundDepth(p, a, b) (p)->GetBackgroundDepth(a, b)
#define IDirect3DViewport_Clear(p, a, b, c) (p)->Clear(a, b, c)
#define IDirect3DViewport_AddLight(p, a) (p)->AddLight(a)
#define IDirect3DViewport_DeleteLight(p, a) (p)->DeleteLight(a)
#define IDirect3DViewport_NextLight(p, a, b, c) (p)->NextLight(a, b, c)
#endif
/*
* IDirect3DViewport2
*/
#undef INTERFACE
#define INTERFACE IDirect3DViewport2
DECLARE_INTERFACE_(IDirect3DViewport2, IDirect3DViewport)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
/*** IDirect3DViewport methods ***/
STDMETHOD(Initialize) (THIS_ LPDIRECT3D) PURE;
STDMETHOD(GetViewport) (THIS_ LPD3DVIEWPORT) PURE;
STDMETHOD(SetViewport) (THIS_ LPD3DVIEWPORT) PURE;
STDMETHOD(TransformVertices) (THIS_ DWORD, LPD3DTRANSFORMDATA, DWORD, LPDWORD) PURE;
STDMETHOD(LightElements) (THIS_ DWORD, LPD3DLIGHTDATA) PURE;
STDMETHOD(SetBackground) (THIS_ D3DMATERIALHANDLE) PURE;
STDMETHOD(GetBackground) (THIS_ LPD3DMATERIALHANDLE, LPBOOL) PURE;
STDMETHOD(SetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE) PURE;
STDMETHOD(GetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE*, LPBOOL) PURE;
STDMETHOD(Clear) (THIS_ DWORD, LPD3DRECT, DWORD) PURE;
STDMETHOD(AddLight) (THIS_ LPDIRECT3DLIGHT) PURE;
STDMETHOD(DeleteLight) (THIS_ LPDIRECT3DLIGHT) PURE;
STDMETHOD(NextLight) (THIS_ LPDIRECT3DLIGHT, LPDIRECT3DLIGHT*, DWORD) PURE;
/*** IDirect3DViewport2 methods ***/
STDMETHOD(GetViewport2) (THIS_ LPD3DVIEWPORT2) PURE;
STDMETHOD(SetViewport2) (THIS_ LPD3DVIEWPORT2) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DViewport2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirect3DViewport2_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DViewport2_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DViewport2_Initialize(p, a) (p)->lpVtbl->Initialize(p, a)
#define IDirect3DViewport2_GetViewport(p, a) (p)->lpVtbl->GetViewport(p, a)
#define IDirect3DViewport2_SetViewport(p, a) (p)->lpVtbl->SetViewport(p, a)
#define IDirect3DViewport2_TransformVertices(p, a, b, c, d) (p)->lpVtbl->TransformVertices(p, a, b, c, d)
#define IDirect3DViewport2_LightElements(p, a, b) (p)->lpVtbl->LightElements(p, a, b)
#define IDirect3DViewport2_SetBackground(p, a) (p)->lpVtbl->SetBackground(p, a)
#define IDirect3DViewport2_GetBackground(p, a, b) (p)->lpVtbl->GetBackground(p, a, b)
#define IDirect3DViewport2_SetBackgroundDepth(p, a) (p)->lpVtbl->SetBackgroundDepth(p, a)
#define IDirect3DViewport2_GetBackgroundDepth(p, a, b) (p)->lpVtbl->GetBackgroundDepth(p, a, b)
#define IDirect3DViewport2_Clear(p, a, b, c) (p)->lpVtbl->Clear(p, a, b, c)
#define IDirect3DViewport2_AddLight(p, a) (p)->lpVtbl->AddLight(p, a)
#define IDirect3DViewport2_DeleteLight(p, a) (p)->lpVtbl->DeleteLight(p, a)
#define IDirect3DViewport2_NextLight(p, a, b, c) (p)->lpVtbl->NextLight(p, a, b, c)
#define IDirect3DViewport2_GetViewport2(p, a) (p)->lpVtbl->GetViewport2(p, a)
#define IDirect3DViewport2_SetViewport2(p, a) (p)->lpVtbl->SetViewport2(p, a)
#else
#define IDirect3DViewport2_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IDirect3DViewport2_AddRef(p) (p)->AddRef()
#define IDirect3DViewport2_Release(p) (p)->Release()
#define IDirect3DViewport2_Initialize(p, a) (p)->Initialize(a)
#define IDirect3DViewport2_GetViewport(p, a) (p)->GetViewport(a)
#define IDirect3DViewport2_SetViewport(p, a) (p)->SetViewport(a)
#define IDirect3DViewport2_TransformVertices(p, a, b, c, d) (p)->TransformVertices(a, b, c, d)
#define IDirect3DViewport2_LightElements(p, a, b) (p)->LightElements(a, b)
#define IDirect3DViewport2_SetBackground(p, a) (p)->SetBackground(a)
#define IDirect3DViewport2_GetBackground(p, a, b) (p)->GetBackground(a, b)
#define IDirect3DViewport2_SetBackgroundDepth(p, a) (p)->SetBackgroundDepth(a)
#define IDirect3DViewport2_GetBackgroundDepth(p, a, b) (p)->GetBackgroundDepth(a, b)
#define IDirect3DViewport2_Clear(p, a, b, c) (p)->Clear(a, b, c)
#define IDirect3DViewport2_AddLight(p, a) (p)->AddLight(a)
#define IDirect3DViewport2_DeleteLight(p, a) (p)->DeleteLight(a)
#define IDirect3DViewport2_NextLight(p, a, b, c) (p)->NextLight(a, b, c)
#define IDirect3DViewport2_GetViewport2(p, a) (p)->GetViewport2(a)
#define IDirect3DViewport2_SetViewport2(p, a) (p)->SetViewport2(a)
#endif
/****************************************************************************
*
* Flags for IDirect3DDevice::NextViewport
*
****************************************************************************/
/*
* Return the next viewport
*/
#define D3DNEXT_NEXT 0x00000001l
/*
* Return the first viewport
*/
#define D3DNEXT_HEAD 0x00000002l
/*
* Return the last viewport
*/
#define D3DNEXT_TAIL 0x00000004l
/****************************************************************************
*
* Flags for DrawPrimitive/DrawIndexedPrimitive
* Also valid for Begin/BeginIndexed
*
****************************************************************************/
/*
* Wait until the device is ready to draw the primitive
* This will cause DP to not return DDERR_WASSTILLDRAWING
*/
#define D3DDP_WAIT 0x00000001l
/*
* Hint that the primitives have been clipped by the application.
*/
#define D3DDP_DONOTCLIP 0x00000004l
/*
* Hint that the extents need not be updated.
*/
#define D3DDP_DONOTUPDATEEXTENTS 0x00000008l
/*
* Direct3D Errors
* DirectDraw error codes are used when errors not specified here.
*/
#define D3D_OK DD_OK
#define D3DERR_BADMAJORVERSION MAKE_DDHRESULT(700)
#define D3DERR_BADMINORVERSION MAKE_DDHRESULT(701)
/*
* An invalid device was requested by the application.
*/
#define D3DERR_INVALID_DEVICE MAKE_DDHRESULT(705)
#define D3DERR_INITFAILED MAKE_DDHRESULT(706)
/*
* SetRenderTarget attempted on a device that was
* QI'd off the render target.
*/
#define D3DERR_DEVICEAGGREGATED MAKE_DDHRESULT(707)
#define D3DERR_EXECUTE_CREATE_FAILED MAKE_DDHRESULT(710)
#define D3DERR_EXECUTE_DESTROY_FAILED MAKE_DDHRESULT(711)
#define D3DERR_EXECUTE_LOCK_FAILED MAKE_DDHRESULT(712)
#define D3DERR_EXECUTE_UNLOCK_FAILED MAKE_DDHRESULT(713)
#define D3DERR_EXECUTE_LOCKED MAKE_DDHRESULT(714)
#define D3DERR_EXECUTE_NOT_LOCKED MAKE_DDHRESULT(715)
#define D3DERR_EXECUTE_FAILED MAKE_DDHRESULT(716)
#define D3DERR_EXECUTE_CLIPPED_FAILED MAKE_DDHRESULT(717)
#define D3DERR_TEXTURE_NO_SUPPORT MAKE_DDHRESULT(720)
#define D3DERR_TEXTURE_CREATE_FAILED MAKE_DDHRESULT(721)
#define D3DERR_TEXTURE_DESTROY_FAILED MAKE_DDHRESULT(722)
#define D3DERR_TEXTURE_LOCK_FAILED MAKE_DDHRESULT(723)
#define D3DERR_TEXTURE_UNLOCK_FAILED MAKE_DDHRESULT(724)
#define D3DERR_TEXTURE_LOAD_FAILED MAKE_DDHRESULT(725)
#define D3DERR_TEXTURE_SWAP_FAILED MAKE_DDHRESULT(726)
#define D3DERR_TEXTURE_LOCKED MAKE_DDHRESULT(727)
#define D3DERR_TEXTURE_NOT_LOCKED MAKE_DDHRESULT(728)
#define D3DERR_TEXTURE_GETSURF_FAILED MAKE_DDHRESULT(729)
#define D3DERR_MATRIX_CREATE_FAILED MAKE_DDHRESULT(730)
#define D3DERR_MATRIX_DESTROY_FAILED MAKE_DDHRESULT(731)
#define D3DERR_MATRIX_SETDATA_FAILED MAKE_DDHRESULT(732)
#define D3DERR_MATRIX_GETDATA_FAILED MAKE_DDHRESULT(733)
#define D3DERR_SETVIEWPORTDATA_FAILED MAKE_DDHRESULT(734)
#define D3DERR_INVALIDCURRENTVIEWPORT MAKE_DDHRESULT(735)
#define D3DERR_INVALIDPRIMITIVETYPE MAKE_DDHRESULT(736)
#define D3DERR_INVALIDVERTEXTYPE MAKE_DDHRESULT(737)
#define D3DERR_TEXTURE_BADSIZE MAKE_DDHRESULT(738)
#define D3DERR_INVALIDRAMPTEXTURE MAKE_DDHRESULT(739)
#define D3DERR_MATERIAL_CREATE_FAILED MAKE_DDHRESULT(740)
#define D3DERR_MATERIAL_DESTROY_FAILED MAKE_DDHRESULT(741)
#define D3DERR_MATERIAL_SETDATA_FAILED MAKE_DDHRESULT(742)
#define D3DERR_MATERIAL_GETDATA_FAILED MAKE_DDHRESULT(743)
#define D3DERR_INVALIDPALETTE MAKE_DDHRESULT(744)
#define D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY MAKE_DDHRESULT(745)
#define D3DERR_ZBUFF_NEEDS_VIDEOMEMORY MAKE_DDHRESULT(746)
#define D3DERR_SURFACENOTINVIDMEM MAKE_DDHRESULT(747)
#define D3DERR_LIGHT_SET_FAILED MAKE_DDHRESULT(750)
#define D3DERR_LIGHTHASVIEWPORT MAKE_DDHRESULT(751)
#define D3DERR_LIGHTNOTINTHISVIEWPORT MAKE_DDHRESULT(752)
#define D3DERR_SCENE_IN_SCENE MAKE_DDHRESULT(760)
#define D3DERR_SCENE_NOT_IN_SCENE MAKE_DDHRESULT(761)
#define D3DERR_SCENE_BEGIN_FAILED MAKE_DDHRESULT(762)
#define D3DERR_SCENE_END_FAILED MAKE_DDHRESULT(763)
#define D3DERR_INBEGIN MAKE_DDHRESULT(770)
#define D3DERR_NOTINBEGIN MAKE_DDHRESULT(771)
#define D3DERR_NOVIEWPORTS MAKE_DDHRESULT(772)
#define D3DERR_VIEWPORTDATANOTSET MAKE_DDHRESULT(773)
#define D3DERR_VIEWPORTHASNODEVICE MAKE_DDHRESULT(774)
#define D3DERR_NOCURRENTVIEWPORT MAKE_DDHRESULT(775)
#ifdef __cplusplus
};
#endif
#endif /* _D3D_H_ */
+313
View File
@@ -0,0 +1,313 @@
/*==========================================================================;
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* File: d3dcaps.h
* Content: Direct3D capabilities include file
*
***************************************************************************/
#ifndef _D3DCAPS_H
#define _D3DCAPS_H
/*
* Pull in DirectDraw include file automatically:
*/
#include "directx/vddraw.h"
#pragma pack(4)
/* Description of capabilities of transform */
typedef struct _D3DTRANSFORMCAPS {
DWORD dwSize;
DWORD dwCaps;
} D3DTRANSFORMCAPS, *LPD3DTRANSFORMCAPS;
#define D3DTRANSFORMCAPS_CLIP 0x00000001L /* Will clip whilst transforming */
/* Description of capabilities of lighting */
typedef struct _D3DLIGHTINGCAPS {
DWORD dwSize;
DWORD dwCaps; /* Lighting caps */
DWORD dwLightingModel; /* Lighting model - RGB or mono */
DWORD dwNumLights; /* Number of lights that can be handled */
} D3DLIGHTINGCAPS, *LPD3DLIGHTINGCAPS;
#define D3DLIGHTINGMODEL_RGB 0x00000001L
#define D3DLIGHTINGMODEL_MONO 0x00000002L
#define D3DLIGHTCAPS_POINT 0x00000001L /* Point lights supported */
#define D3DLIGHTCAPS_SPOT 0x00000002L /* Spot lights supported */
#define D3DLIGHTCAPS_DIRECTIONAL 0x00000004L /* Directional lights supported */
#define D3DLIGHTCAPS_PARALLELPOINT 0x00000008L /* Parallel point lights supported */
/* Description of capabilities for each primitive type */
typedef struct _D3DPrimCaps {
DWORD dwSize;
DWORD dwMiscCaps; /* Capability flags */
DWORD dwRasterCaps;
DWORD dwZCmpCaps;
DWORD dwSrcBlendCaps;
DWORD dwDestBlendCaps;
DWORD dwAlphaCmpCaps;
DWORD dwShadeCaps;
DWORD dwTextureCaps;
DWORD dwTextureFilterCaps;
DWORD dwTextureBlendCaps;
DWORD dwTextureAddressCaps;
DWORD dwStippleWidth; /* maximum width and height of */
DWORD dwStippleHeight; /* of supported stipple (up to 32x32) */
} D3DPRIMCAPS, *LPD3DPRIMCAPS;
/* D3DPRIMCAPS dwMiscCaps */
#define D3DPMISCCAPS_MASKPLANES 0x00000001L
#define D3DPMISCCAPS_MASKZ 0x00000002L
#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L
#define D3DPMISCCAPS_CONFORMANT 0x00000008L
#define D3DPMISCCAPS_CULLNONE 0x00000010L
#define D3DPMISCCAPS_CULLCW 0x00000020L
#define D3DPMISCCAPS_CULLCCW 0x00000040L
/* D3DPRIMCAPS dwRasterCaps */
#define D3DPRASTERCAPS_DITHER 0x00000001L
#define D3DPRASTERCAPS_ROP2 0x00000002L
#define D3DPRASTERCAPS_XOR 0x00000004L
#define D3DPRASTERCAPS_PAT 0x00000008L
#define D3DPRASTERCAPS_ZTEST 0x00000010L
#define D3DPRASTERCAPS_SUBPIXEL 0x00000020L
#define D3DPRASTERCAPS_SUBPIXELX 0x00000040L
#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L
#define D3DPRASTERCAPS_FOGTABLE 0x00000100L
#define D3DPRASTERCAPS_STIPPLE 0x00000200L
#define D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT 0x00000400L
#define D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT 0x00000800L
#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L
#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L
#define D3DPRASTERCAPS_ZBIAS 0x00004000L
#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L
#define D3DPRASTERCAPS_FOGRANGE 0x00010000L
#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L
/* D3DPRIMCAPS dwZCmpCaps, dwAlphaCmpCaps */
#define D3DPCMPCAPS_NEVER 0x00000001L
#define D3DPCMPCAPS_LESS 0x00000002L
#define D3DPCMPCAPS_EQUAL 0x00000004L
#define D3DPCMPCAPS_LESSEQUAL 0x00000008L
#define D3DPCMPCAPS_GREATER 0x00000010L
#define D3DPCMPCAPS_NOTEQUAL 0x00000020L
#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L
#define D3DPCMPCAPS_ALWAYS 0x00000080L
/* D3DPRIMCAPS dwSourceBlendCaps, dwDestBlendCaps */
#define D3DPBLENDCAPS_ZERO 0x00000001L
#define D3DPBLENDCAPS_ONE 0x00000002L
#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L
#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L
#define D3DPBLENDCAPS_SRCALPHA 0x00000010L
#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L
#define D3DPBLENDCAPS_DESTALPHA 0x00000040L
#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L
#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L
#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L
#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L
#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L
#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L
/* D3DPRIMCAPS dwShadeCaps */
#define D3DPSHADECAPS_COLORFLATMONO 0x00000001L
#define D3DPSHADECAPS_COLORFLATRGB 0x00000002L
#define D3DPSHADECAPS_COLORGOURAUDMONO 0x00000004L
#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L
#define D3DPSHADECAPS_COLORPHONGMONO 0x00000010L
#define D3DPSHADECAPS_COLORPHONGRGB 0x00000020L
#define D3DPSHADECAPS_SPECULARFLATMONO 0x00000040L
#define D3DPSHADECAPS_SPECULARFLATRGB 0x00000080L
#define D3DPSHADECAPS_SPECULARGOURAUDMONO 0x00000100L
#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L
#define D3DPSHADECAPS_SPECULARPHONGMONO 0x00000400L
#define D3DPSHADECAPS_SPECULARPHONGRGB 0x00000800L
#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00001000L
#define D3DPSHADECAPS_ALPHAFLATSTIPPLED 0x00002000L
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L
#define D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED 0x00008000L
#define D3DPSHADECAPS_ALPHAPHONGBLEND 0x00010000L
#define D3DPSHADECAPS_ALPHAPHONGSTIPPLED 0x00020000L
#define D3DPSHADECAPS_FOGFLAT 0x00040000L
#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L
#define D3DPSHADECAPS_FOGPHONG 0x00100000L
/* D3DPRIMCAPS dwTextureCaps */
#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L
#define D3DPTEXTURECAPS_POW2 0x00000002L
#define D3DPTEXTURECAPS_ALPHA 0x00000004L
#define D3DPTEXTURECAPS_TRANSPARENCY 0x00000008L
#define D3DPTEXTURECAPS_BORDER 0x00000010L
#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L
/* D3DPRIMCAPS dwTextureFilterCaps */
#define D3DPTFILTERCAPS_NEAREST 0x00000001L
#define D3DPTFILTERCAPS_LINEAR 0x00000002L
#define D3DPTFILTERCAPS_MIPNEAREST 0x00000004L
#define D3DPTFILTERCAPS_MIPLINEAR 0x00000008L
#define D3DPTFILTERCAPS_LINEARMIPNEAREST 0x00000010L
#define D3DPTFILTERCAPS_LINEARMIPLINEAR 0x00000020L
/* D3DPRIMCAPS dwTextureBlendCaps */
#define D3DPTBLENDCAPS_DECAL 0x00000001L
#define D3DPTBLENDCAPS_MODULATE 0x00000002L
#define D3DPTBLENDCAPS_DECALALPHA 0x00000004L
#define D3DPTBLENDCAPS_MODULATEALPHA 0x00000008L
#define D3DPTBLENDCAPS_DECALMASK 0x00000010L
#define D3DPTBLENDCAPS_MODULATEMASK 0x00000020L
#define D3DPTBLENDCAPS_COPY 0x00000040L
#define D3DPTBLENDCAPS_ADD 0x00000080L
/* D3DPRIMCAPS dwTextureAddressCaps */
#define D3DPTADDRESSCAPS_WRAP 0x00000001L
#define D3DPTADDRESSCAPS_MIRROR 0x00000002L
#define D3DPTADDRESSCAPS_CLAMP 0x00000004L
#define D3DPTADDRESSCAPS_BORDER 0x00000008L
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L
/*
* Description for a device.
* This is used to describe a device that is to be created or to query
* the current device.
*/
typedef struct _D3DDeviceDesc {
DWORD dwSize; /* Size of D3DDEVICEDESC structure */
DWORD dwFlags; /* Indicates which fields have valid data */
D3DCOLORMODEL dcmColorModel; /* Color model of device */
DWORD dwDevCaps; /* Capabilities of device */
D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */
BOOL bClipping; /* Device can do 3D clipping */
D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */
D3DPRIMCAPS dpcLineCaps;
D3DPRIMCAPS dpcTriCaps;
DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */
DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
DWORD dwMaxBufferSize; /* Maximum execute buffer size */
DWORD dwMaxVertexCount; /* Maximum vertex count */
// *** New fields for DX5 *** //
// Width and height caps are 0 for legacy HALs.
DWORD dwMinTextureWidth, dwMinTextureHeight;
DWORD dwMaxTextureWidth, dwMaxTextureHeight;
DWORD dwMinStippleWidth, dwMaxStippleWidth;
DWORD dwMinStippleHeight, dwMaxStippleHeight;
} D3DDEVICEDESC, *LPD3DDEVICEDESC;
#define D3DDEVICEDESCSIZE (sizeof(D3DDEVICEDESC))
typedef HRESULT (FAR PASCAL * LPD3DENUMDEVICESCALLBACK)(LPGUID lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID);
/* D3DDEVICEDESC dwFlags indicating valid fields */
#define D3DDD_COLORMODEL 0x00000001L /* dcmColorModel is valid */
#define D3DDD_DEVCAPS 0x00000002L /* dwDevCaps is valid */
#define D3DDD_TRANSFORMCAPS 0x00000004L /* dtcTransformCaps is valid */
#define D3DDD_LIGHTINGCAPS 0x00000008L /* dlcLightingCaps is valid */
#define D3DDD_BCLIPPING 0x00000010L /* bClipping is valid */
#define D3DDD_LINECAPS 0x00000020L /* dpcLineCaps is valid */
#define D3DDD_TRICAPS 0x00000040L /* dpcTriCaps is valid */
#define D3DDD_DEVICERENDERBITDEPTH 0x00000080L /* dwDeviceRenderBitDepth is valid */
#define D3DDD_DEVICEZBUFFERBITDEPTH 0x00000100L /* dwDeviceZBufferBitDepth is valid */
#define D3DDD_MAXBUFFERSIZE 0x00000200L /* dwMaxBufferSize is valid */
#define D3DDD_MAXVERTEXCOUNT 0x00000400L /* dwMaxVertexCount is valid */
/* D3DDEVICEDESC dwDevCaps flags */
#define D3DDEVCAPS_FLOATTLVERTEX 0x00000001L /* Device accepts floating point */
/* for post-transform vertex data */
#define D3DDEVCAPS_SORTINCREASINGZ 0x00000002L /* Device needs data sorted for increasing Z*/
#define D3DDEVCAPS_SORTDECREASINGZ 0X00000004L /* Device needs data sorted for decreasing Z*/
#define D3DDEVCAPS_SORTEXACT 0x00000008L /* Device needs data sorted exactly */
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */
#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */
#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */
#define D3DFDS_COLORMODEL 0x00000001L /* Match color model */
#define D3DFDS_GUID 0x00000002L /* Match guid */
#define D3DFDS_HARDWARE 0x00000004L /* Match hardware/software */
#define D3DFDS_TRIANGLES 0x00000008L /* Match in triCaps */
#define D3DFDS_LINES 0x00000010L /* Match in lineCaps */
#define D3DFDS_MISCCAPS 0x00000020L /* Match primCaps.dwMiscCaps */
#define D3DFDS_RASTERCAPS 0x00000040L /* Match primCaps.dwRasterCaps */
#define D3DFDS_ZCMPCAPS 0x00000080L /* Match primCaps.dwZCmpCaps */
#define D3DFDS_ALPHACMPCAPS 0x00000100L /* Match primCaps.dwAlphaCmpCaps */
#define D3DFDS_SRCBLENDCAPS 0x00000200L /* Match primCaps.dwSourceBlendCaps */
#define D3DFDS_DSTBLENDCAPS 0x00000400L /* Match primCaps.dwDestBlendCaps */
#define D3DFDS_SHADECAPS 0x00000800L /* Match primCaps.dwShadeCaps */
#define D3DFDS_TEXTURECAPS 0x00001000L /* Match primCaps.dwTextureCaps */
#define D3DFDS_TEXTUREFILTERCAPS 0x00002000L /* Match primCaps.dwTextureFilterCaps */
#define D3DFDS_TEXTUREBLENDCAPS 0x00004000L /* Match primCaps.dwTextureBlendCaps */
#define D3DFDS_TEXTUREADDRESSCAPS 0x00008000L /* Match primCaps.dwTextureBlendCaps */
/*
* FindDevice arguments
*/
typedef struct _D3DFINDDEVICESEARCH {
DWORD dwSize;
DWORD dwFlags;
BOOL bHardware;
D3DCOLORMODEL dcmColorModel;
GUID guid;
DWORD dwCaps;
D3DPRIMCAPS dpcPrimCaps;
} D3DFINDDEVICESEARCH, *LPD3DFINDDEVICESEARCH;
typedef struct _D3DFINDDEVICERESULT {
DWORD dwSize;
GUID guid; /* guid which matched */
D3DDEVICEDESC ddHwDesc; /* hardware D3DDEVICEDESC */
D3DDEVICEDESC ddSwDesc; /* software D3DDEVICEDESC */
} D3DFINDDEVICERESULT, *LPD3DFINDDEVICERESULT;
/*
* Description of execute buffer.
*/
typedef struct _D3DExecuteBufferDesc {
DWORD dwSize; /* size of this structure */
DWORD dwFlags; /* flags indicating which fields are valid */
DWORD dwCaps; /* capabilities of execute buffer */
DWORD dwBufferSize; /* size of execute buffer data */
LPVOID lpData; /* pointer to actual data */
} D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC;
/* D3DEXECUTEBUFFER dwFlags indicating valid fields */
#define D3DDEB_BUFSIZE 0x00000001l /* buffer size valid */
#define D3DDEB_CAPS 0x00000002l /* caps valid */
#define D3DDEB_LPDATA 0x00000004l /* lpData valid */
/* D3DEXECUTEBUFFER dwCaps */
#define D3DDEBCAPS_SYSTEMMEMORY 0x00000001l /* buffer in system memory */
#define D3DDEBCAPS_VIDEOMEMORY 0x00000002l /* buffer in device memory */
#define D3DDEBCAPS_MEM (D3DDEBCAPS_SYSTEMMEMORY|D3DDEBCAPS_VIDEOMEMORY)
#pragma pack()
#endif /* _D3DCAPS_H_ */
+793
View File
@@ -0,0 +1,793 @@
/*==========================================================================;
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* File: d3di.h
* Content: Direct3D internal include file
*@@BEGIN_MSINTERNAL
*
* $Id: vd3di.h,v 2.2 2002-08-01 01:41:04 penguin Exp $
*
* History:
* Date By Reason
* ==== == ======
* 05/11/95 stevela Initial rev with this header.
* 11/11/95 stevela Light code changed.
* 21/11/95 colinmc Made Direct3D aggregatable
* (so it can be QI'd off DirectDraw).
* 23/11/95 colinmc Made Direct3D textures and devices aggregatable
* (QI'd off DirectDrawSurfaces).
* 07/12/95 stevela Merged in Colin's changes.
* 10/12/95 stevela Removed AGGREGATE_D3D.
* Removed Validate macros from here. Now in d3dpr.h
* 02/03/96 colinmc Minor build fix
* 17/04/96 stevela Use ddraw.h externally and ddrawp.h internally
*@@END_MSINTERNAL
*
***************************************************************************/
#ifndef _D3DI_H
#define _D3DI_H
//@@BEGIN_MSINTERNAL
#include "vddrawp.h"
#if 0
//@@END_MSINTERNAL
#include "directx/vddraw.h"
//@@BEGIN_MSINTERNAL
#endif
//@@END_MSINTERNAL
#include "directx/vd3d.h"
// @@BEGIN_MSINTERNAL
#if !defined(BUILD_RLAPI) && !defined(BUILD_DDDDK)
#include "vddrawi.h"
#include "rlreg.h"
#include "lists.h"
#include "object/object.h"
/*
INDEX_BATCH_SCALE is the constant which is used by DrawIndexedPrim
to deterimine if the number of primitives being drawn is small
relative to the number of vertices being passed. If it is then
the prims are dereferenced in batches and sent to DrawPrim.
*/
#define INDEX_BATCH_SCALE 2
/*
typedef D3DCOLORMODEL D3DCOLORMODEL;
#define D3DCOLOR_RAMP D3DCOLOR_RAMP
#define D3DCOLOR_RGB D3DCOLOR_RGB
#define D3D_COLORMODEL D3D_COLORMODEL
*/
#endif /* !BUILD_RLAPI */
// @@END_MSINTERNAL
typedef DWORD D3DI_BUFFERHANDLE, *LPD3DI_BUFFERHANDLE;
/*
* Internal version of executedata
*/
typedef struct _D3DI_ExecuteData {
DWORD dwSize;
D3DI_BUFFERHANDLE dwHandle; /* Handle allocated by driver */
DWORD dwVertexOffset;
DWORD dwVertexCount;
DWORD dwInstructionOffset;
DWORD dwInstructionLength;
DWORD dwHVertexOffset;
D3DSTATUS dsStatus; /* Status after execute */
} D3DI_EXECUTEDATA, *LPD3DI_EXECUTEDATA;
/*
* Internal version of lightdata and constants for flags
*/
#define D3DLIGHTI_ATT0_IS_NONZERO (0x00010000)
#define D3DLIGHTI_ATT1_IS_NONZERO (0x00020000)
#define D3DLIGHTI_ATT2_IS_NONZERO (0x00040000)
#define D3DLIGHTI_LINEAR_FALLOFF (0x00080000)
#define D3DLIGHTI_UNIT_SCALE (0x00100000)
#define D3DLIGHTI_LIGHT_AT_EYE (0x00200000)
typedef struct _D3DI_LIGHT {
D3DLIGHTTYPE type;
DWORD version; /* matches number on D3DLIGHT struct */
BOOL valid;
D3DVALUE red, green, blue, shade;
D3DVECTOR position;
D3DVECTOR model_position;
D3DVECTOR direction;
D3DVECTOR model_direction;
D3DVECTOR halfway;
D3DVECTOR model_eye; /* direction from eye in model space */
D3DVECTOR model_scale; /* model scale for proper range computations */
D3DVALUE range;
D3DVALUE range_squared;
D3DVALUE falloff;
D3DVALUE attenuation0;
D3DVALUE attenuation1;
D3DVALUE attenuation2;
D3DVALUE cos_theta_by_2;
D3DVALUE cos_phi_by_2;
DWORD flags;
} D3DI_LIGHT, *LPD3DI_LIGHT;
// @@BEGIN_MSINTERNAL
#if !defined(BUILD_RLAPI) && !defined(BUILD_DDDDK)
#ifndef BUILD_HEL
#ifdef BUILD_D3D_LAYER
#include "driver.h"
#endif
typedef struct IUnknownVtbl D3DUNKNOWNCALLBACKS, *LPD3DUNKNOWNCALLBACKS;
typedef struct ID3DObjectVtbl D3DOBJECTVTBL, *LPD3DOBJECTVTBL;
typedef struct IDirect3DVtbl DIRECT3DCALLBACKS, *LPDIRECT3DCALLBACKS;
typedef struct IDirect3D2Vtbl DIRECT3D2CALLBACKS, *LPDIRECT3D2CALLBACKS;
typedef struct IDirect3DDeviceVtbl DIRECT3DDEVICECALLBACKS, *LPDIRECT3DDEVICECALLBACKS;
typedef struct IDirect3DDevice2Vtbl DIRECT3DDEVICE2CALLBACKS, *LPDIRECT3DDEVICE2CALLBACKS;
typedef struct IDirect3DExecuteBufferVtbl DIRECT3DEXECUTEBUFFERCALLBACKS, *LPDIRECT3DEXECUTEBUFFERCALLBACKS;
typedef struct IDirect3DLightVtbl DIRECT3DLIGHTCALLBACKS, *LPDIRECT3DLIGHTCALLBACKS;
typedef struct IDirect3DMaterialVtbl DIRECT3DMATERIALCALLBACKS, *LPDIRECT3DMATERIALCALLBACKS;
typedef struct IDirect3DMaterial2Vtbl DIRECT3DMATERIAL2CALLBACKS, *LPDIRECT3DMATERIAL2CALLBACKS;
typedef struct IDirect3DTextureVtbl DIRECT3DTEXTURECALLBACKS, *LPDIRECT3DTEXTURECALLBACKS;
typedef struct IDirect3DTexture2Vtbl DIRECT3DTEXTURE2CALLBACKS, *LPDIRECT3DTEXTURE2CALLBACKS;
typedef struct IDirect3DViewport2Vtbl DIRECT3DVIEWPORT2CALLBACKS, *LPDIRECT3DVIEWPORT2CALLBACKS;
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _DIRECT3DI *LPDIRECT3DI;
typedef struct _DIRECT3DDEVICEI *LPDIRECT3DDEVICEI;
typedef struct _DIRECT3DEXECUTEBUFFERI *LPDIRECT3DEXECUTEBUFFERI;
typedef struct _DIRECT3DLIGHTI *LPDIRECT3DLIGHTI;
typedef struct _DIRECT3DMATERIALI *LPDIRECT3DMATERIALI;
typedef struct _DIRECT3DTEXTUREI *LPDIRECT3DTEXTUREI;
typedef struct _DIRECT3DVIEWPORTI *LPDIRECT3DVIEWPORTI;
/*
* If we have an aggregate Direct3D we need a structure to
* represent an interface distinct from the underlying
* object. This is that structure. None of this would be necessary
* in C++
*/
typedef struct _DIRECT3DUNKNOWNI
{
LPD3DUNKNOWNCALLBACKS lpVtbl;
LPDIRECT3DI lpObj;
} DIRECT3DUNKNOWNI;
typedef struct _DIRECT3DUNKNOWNI *LPDIRECT3DUNKNOWNI;
typedef struct _DIRECT3DOLDI
{
LPDIRECT3DCALLBACKS lpVtbl;
LPDIRECT3DI lpObj;
} DIRECT3DOLDI;
typedef struct _DIRECT3DOLDI *LPDIRECT3DOLDI;
/*
* Internal version of Direct3D object; it has data after the vtable
*/
typedef struct _DIRECT3DI
{
/*** Object Interface ***/
LPDIRECT3D2CALLBACKS lpVtbl; /* Pointer to callbacks */
int refCnt; /* Reference count object */
/*** Object Relations ***/
/* Devices */
int numDevs;/* Number of devices */
LIST_ROOT(_devices, _DIRECT3DDEVICEI) devices;
/* Associated IDirect3DDevices */
/* Viewports */
int numViewports; /* Number of viewports */
LIST_ROOT(_viewports, _DIRECT3DVIEWPORTI) viewports;
/* Created IDirect3DViewports */
/* Lights */
int numLights; /* Number of lights */
LIST_ROOT(_lights, _DIRECT3DLIGHTI) lights;
/* Created IDirect3DLights */
/* Materials */
int numMaterials; /* Number of materials */
LIST_ROOT(_materials, _DIRECT3DMATERIALI) materials;
/* Created IDirect3DMaterials */
/*** Object Data ***/
unsigned long v_next; /* id of next viewport to be created */
RLDDIRegistry* lpReg; /* Registry */
/*
* DirectDraw Interface
*/
LPDDRAWI_DIRECTDRAW_INT lpDDInt;
/*
* The special IUnknown interface for the aggregate that does
* not punt to the parent object.
*/
LPUNKNOWN lpOwningIUnknown; /* The owning IUnknown */
DIRECT3DUNKNOWNI lpThisIUnknown; /* Our IUnknown interface */
DIRECT3DOLDI lpThisIDirect3D; /* Our IDirect3D interface */
DWORD dwVersion; /* 1 for legacy D3D, 2 for D3D2 */
} DIRECT3DI;
/*
* If we have an aggreate Direct3DDevice we need a structure to
* represent an interface distinct from the underlying
* object. This is that structure.
*/
typedef struct _DIRECT3DDEVICEUNKNOWNI
{
LPDIRECT3DDEVICE2CALLBACKS lpVtbl;
LPDIRECT3DDEVICEI lpObj;
} DIRECT3DDEVICEUNKNOWNI;
typedef struct _DIRECT3DDEVICEUNKNOWNI *LPDIRECT3DDEVICEUNKNOWNI;
typedef struct _DIRECT3DDEVICEOLDI
{
LPDIRECT3DDEVICECALLBACKS lpVtbl;
LPDIRECT3DDEVICEI lpObj;
} DIRECT3DDEVICEOLDI;
typedef struct _DIRECT3DDEVICEOLDI *LPDIRECT3DDEVICEOLDI;
/*
* Internal version of Direct3DDevice object; it has data after the vtable
*/
#include "vd3dhal.h"
typedef RLDDIDriver* (*RLDDIDDrawCreateDriverFn)(
LPDDRAWI_DIRECTDRAW_INT lpDDInt,
LPDIRECTDRAWSURFACE lpDDS,
LPDIRECTDRAWSURFACE lpZ,
LPDIRECTDRAWPALETTE lpPal,
LPDIRECT3DDEVICEI);
typedef HRESULT (*RLDDIGetCapsFn)(LPD3DDEVICEDESC*, LPD3DDEVICEDESC*);
typedef void (*RLDDIInitFn)(RLDDIMallocFn, RLDDIReallocFn, RLDDIFreeFn, RLDDIRaiseFn, RLDDIValue**, int, int);
typedef void (*RLDDIPushDriverFn)(RLDDIDriverStack*, RLDDIDriver*);
typedef void (*RLDDIPopDriverFn)(RLDDIDriverStack*);
struct _RLDDIGenRasDriver;
typedef struct _RLDDIGenRasDriver* LPRLDDIGENRASDRIVER;
struct _RLDDIDDrawDriver;
typedef struct _RLDDIDDrawDriver* LPRLDDIDDRAWDRIVER;
struct _RLDDITransformDriver;
typedef struct _RLDDITransformDriver* LPRLDDITRANSFORMDRIVER;
typedef HRESULT (*PFNLOCKTEXTURE)(LPRLDDIGENRASDRIVER driver);
typedef void (*PFNUNLOCKTEXTURE)(LPRLDDIGENRASDRIVER driver);
typedef int (*PFNSETFILLPARAMS)(LPRLDDIGENRASDRIVER driver, D3DSTATE* in_params,
int count);
typedef HRESULT (*PFNREALLOCALIGNED)(void** p_inout, size_t size);
typedef HRESULT (*PFNMALLOCALIGNED)(void** p_inout, size_t size);
typedef HRESULT (*PFNFREEALIGNED)(void* p_inout);
typedef HRESULT (*PFNDRVSETRENDERTARGET)(LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE,
LPDIRECTDRAWPALETTE, LPDIRECT3DDEVICEI);
typedef HRESULT (*PFNDOFLUSHBEGINEND)(LPDIRECT3DDEVICE2, DWORD);
typedef HRESULT (*PFNDRAWPRIMITIVES)(LPDIRECT3DDEVICEI, LPD3DTLVERTEX, LPVOID, LPD3DINSTRUCTION, DWORD);
typedef struct _D3DI_TEXTUREBLOCK
{
LIST_MEMBER(_D3DI_TEXTUREBLOCK) list;
/* Next block in IDirect3DTexture */
LIST_MEMBER(_D3DI_TEXTUREBLOCK) devList;
/* Next block in IDirect3DDevice */
LPDIRECT3DDEVICEI lpD3DDeviceI;
LPDIRECT3DTEXTUREI lpD3DTextureI;
D3DTEXTUREHANDLE hTex;
/* texture handle */
} D3DI_TEXTUREBLOCK;
typedef struct _D3DI_TEXTUREBLOCK *LPD3DI_TEXTUREBLOCK;
typedef struct _D3DI_MATERIALBLOCK
{
LIST_MEMBER(_D3DI_MATERIALBLOCK) list;
/* Next block in IDirect3DMaterial */
LIST_MEMBER(_D3DI_MATERIALBLOCK) devList;
/* Next block in IDirect3DDevice */
LPDIRECT3DDEVICEI lpD3DDeviceI;
LPDIRECT3DMATERIALI lpD3DMaterialI;
D3DMATERIALHANDLE hMat;
/* material handle */
} D3DI_MATERIALBLOCK;
typedef struct _D3DI_MATERIALBLOCK *LPD3DI_MATERIALBLOCK;
#define D3D_RSTATEBUF_SIZE 128
#define D3D_MAX_RSTATES 96 /* Last render state ID + 1 */
#define D3D_MAX_MMX_VERTICES 1024
extern DWORD dwD3DTriBatchSize, dwTriBatchSize, dwLineBatchSize;
extern DWORD dwHWBufferSize, dwHWMaxTris;
extern DWORD dwHWFewVertices;
typedef struct _D3DHAL_DRAWPRIMCOUNTS *LPD3DHAL_DRAWPRIMCOUNTS;
// Legacy HAL batching is done with these structs.
typedef struct _D3DI_HWCOUNTS {
WORD wNumStateChanges; // Number of state changes batched
WORD wNumVertices; // Number of vertices in tri list
WORD wNumTriangles; // Number of triangles in tri list
} D3DI_HWCOUNTS, *LPD3DI_HWCOUNTS;
typedef struct _DIRECT3DDEVICEI
{
/*** Object Interface ***/
LPDIRECT3DDEVICE2CALLBACKS lpVtbl; /* Pointer to callbacks */
int refCnt; /* Reference count */
/*** Object Relations ***/
LPDIRECT3DI lpDirect3DI; /* parent */
LIST_MEMBER(_DIRECT3DDEVICEI)list; /* Next device IDirect3D */
/* Textures */
LIST_ROOT(_textures, _D3DI_TEXTUREBLOCK) texBlocks;
/* Ref to created IDirect3DTextures */
/* Execute buffers */
LIST_ROOT(_buffers, _DIRECT3DEXECUTEBUFFERI) buffers;
/* Created IDirect3DExecuteBuffers */
/* Viewports */
int numViewports;
CIRCLE_QUEUE_ROOT(_dviewports, _DIRECT3DVIEWPORTI) viewports;
/* Associated IDirect3DViewports */
LPDIRECT3DVIEWPORT2 lpCurrentViewport;
/* Materials */
LIST_ROOT(_dmmaterials, _D3DI_MATERIALBLOCK) matBlocks;
/* Ref to associated IDirect3DMaterials */
/*** Object Data ***/
/* Private interfaces */
LPD3DOBJECTVTBL lpClassVtbl; /* Private Vtbl */
LPD3DOBJECTVTBL lpObjVtbl; /* Private Vtbl */
LPD3DHAL_CALLBACKS lpD3DHALCallbacks; /* HW specific */
LPD3DHAL_GLOBALDRIVERDATA lpD3DHALGlobalDriverData; /* HW specific */
/* Viewports */
unsigned long v_id; /* ID of last viewport rendered */
/* Lights */
int numLights;
/* This indicates the maximum number
of lights that have been set in
the device. */
/* Device characteristics */
int age;
int width;
int height;
int depth;
unsigned long red_mask, green_mask, blue_mask;
int dither;
int ramp_size; /* SW specific */
D3DCOLORMODEL color_model;
int wireframe_options;
D3DTEXTUREFILTER texture_quality;
D3DVALUE gamma;
unsigned char gamma_table[256];
int aspectx, aspecty;
D3DVALUE perspective_tolerance;
/* Library information */
#ifdef _WIN32
HINSTANCE hDrvDll;
char dllname[MAXPATH];
char base[256];
#endif
#ifdef SHLIB
void* so;
#endif
/* Are we in a scene? */
BOOL bInScene;
/* Our Device type */
GUID guid;
/* GetCaps function from the library */
RLDDIGetCapsFn GetCapsFn;
/* Functions required to build driver */
RLDDIInitFn RLDDIInit;
RLDDIPushDriverFn RLDDIPushDriver;
RLDDIPopDriverFn RLDDIPopDriver;
RLDDIDDrawCreateDriverFn RLDDIDDrawCreateDriver;
/* Device description */
D3DDEVICEDESC d3dHWDevDesc;
D3DDEVICEDESC d3dHELDevDesc;
/* Driver stack */
RLDDIDriverStack* stack;
/*
* The special IUnknown interface for the aggregate that does
* not punt to the parent object.
*/
LPUNKNOWN lpOwningIUnknown; /* The owning IUnknown */
DIRECT3DDEVICEUNKNOWNI lpThisIUnknown; /* Our IUnknown interface */
DIRECT3DDEVICEOLDI lpThisID3DDev; /* Our IDirect3DDevice interface */
LPD3DHAL_CALLBACKS2 lpD3DHALCallbacks2; /* HW specific */
/*
* Renderstate cache for DrawPrimitive
*/
WORD wRStateBufLevel;
D3DSTATE renStateBuf[D3D_RSTATEBUF_SIZE];
/* Pointers to drivers used by DrawPrimitive */
LPRLDDIGENRASDRIVER rasDriver; /* SW specific */
LPRLDDITRANSFORMDRIVER xfmDriver; /* Assumed to be NULL for HW */
LPRLDDIDDRAWDRIVER drawDriver; /* Assumed to be NULL for HW */
/*
* Pointers to functions used by DrawPrim&Begin/End
*/
PFNLOCKTEXTURE pfnLockTexture; /* SW specific */
PFNUNLOCKTEXTURE pfnUnlockTexture; /* SW specific */
PFNSETFILLPARAMS pfnSetFillParams; /* SW specific */
PFNREALLOCALIGNED pfnReallocAligned; /* SW specific */
PFNDRVSETRENDERTARGET pfnDrvSetRenderTarget; /* SW specific */
HRESULT (*pfnFlushStates)(struct _DIRECT3DDEVICEI*);
PFNDOFLUSHBEGINEND pfnDoFlushBeginEnd;
PFNDRAWPRIMITIVES pfnDrawPrimitives;
/* Are we between Begin/End? */
BOOL bInBegin;
D3DVERTEXTYPE vtVertexType;
D3DPRIMITIVETYPE ptPrimitiveType;
CRITICAL_SECTION BeginEndCSect;
// max number of vertices
#define BEGIN_DATA_BLOCK_SIZE 256
LPVOID lpvVertexBatch;
WORD *lpIndexBatch;
// lpvVertexData is non-NULL if we are InBegin and indexed.
LPVOID lpvVertexData;
DWORD dwNumVertices;
DWORD dwMaxVertexCount; // current number of vertices there is space for
WORD *lpVertexIndices;
DWORD dwNumIndices;
DWORD dwMaxIndexCount; // current number of indices there is space for
DWORD dwFlags;
WORD wFlushed;
/*
* DrawPrimitives batching
*/
// Buffer to put DrawPrimitives stuff into
// Used for both legacy and DrawPrimitive HALs
WORD *lpwDPBuffer;
WORD *lpwDPBufferAlloced;
/* Legacy HALs */
// pointer to current prim counts struct
LPD3DHAL_DRAWPRIMCOUNTS lpDPPrimCounts;
// Buffer of counts structures that keep track of the
// number of render states and vertices buffered
LPD3DI_HWCOUNTS lpHWCounts;
// Buffer of triangle structures.
LPD3DTRIANGLE lpHWTris;
// Buffer of interleaved render states and primitives.
LPD3DTLVERTEX lpHWVertices;
// Byte offset into lpHWVertices. This gets incremented
// by 8 when a render state is batched and by 32*dwNumVertices
// when a primitive is batched.
DWORD dwHWOffset;
// Max value of dwHWOffset. Used to decide whether to flush.
DWORD dwHWMaxOffset;
// Index into lpHWTris.
DWORD dwHWTriIndex;
// Number of counts structures used so far. This actually
// gives the number of primitives batched and the index of
// the counts structure to batch render states into.
DWORD dwHWNumCounts;
/* DrawPrimitive-aware HALs */
// Byte offset into buffer (we are currently
// using the device's wTriIndex)
DWORD dwDPOffset;
// Maximum offset. If dwDPOffset exceeds this, it is
// time to flush.
DWORD dwDPMaxOffset;
WORD *wTriIndex;
// buffers for TL and H vertices
LPD3DTLVERTEX lpTLVbuf;
LPD3DHVERTEX lpHVbuf;
DWORD dwVbufSize;
LPD3DHAL_D3DEXTENDEDCAPS lpD3DExtendedCaps; /* HW specific */
} DIRECT3DDEVICEI;
/*
* Internal version of Direct3DExecuteBuffer object;
* it has data after the vtable
*/
typedef struct _DIRECT3DEXECUTEBUFFERI
{
/*** Object Interface ***/
LPDIRECT3DEXECUTEBUFFERCALLBACKS lpVtbl; /* Pointer to callbacks */
int refCnt; /* Reference count */
/*** Object Relations ***/
LPDIRECT3DDEVICEI lpD3DDeviceI; /* Parent */
LIST_MEMBER(_DIRECT3DEXECUTEBUFFERI)list;
/* Next buffer in IDirect3D */
/*** Object Data ***/
DWORD pid; /* Process locking execute buffer */
D3DEXECUTEBUFFERDESC debDesc;
/* Description of the buffer */
D3DEXECUTEDATA exData; /* Execute Data */
BOOL locked; /* Is the buffer locked */
D3DI_BUFFERHANDLE hBuf;
/* Execute buffer handle */
} DIRECT3DEXECUTEBUFFERI;
/*
* Internal version of Direct3DLight object;
* it has data after the vtable
*/
typedef struct _DIRECT3DLIGHTI
{
/*** Object Interface ***/
LPDIRECT3DLIGHTCALLBACKS lpVtbl; /* Pointer to callbacks */
int refCnt; /* Reference count */
/*** Object Relations ***/
LPDIRECT3DI lpDirect3DI; /* Parent */
LIST_MEMBER(_DIRECT3DLIGHTI)list;
/* Next light in IDirect3D */
LPDIRECT3DVIEWPORTI lpD3DViewportI; /* Guardian */
CIRCLE_QUEUE_MEMBER(_DIRECT3DLIGHTI)light_list;
/* Next light in IDirect3DViewport */
/*** Object Data ***/
D3DLIGHT2 dlLight;/* Data describing light */
D3DI_LIGHT diLightData;
/* Internal representation of light */
} DIRECT3DLIGHTI;
typedef struct _DIRECT3DMATERIALOLDI
{
LPDIRECT3DMATERIALCALLBACKS lpVtbl;
LPDIRECT3DMATERIALI lpObj;
} DIRECT3DMATERIALOLDI, *LPDIRECT3DMATERIALOLDI;
/*
* Internal version of Direct3DMaterial object;
* it has data after the vtable
*/
typedef struct _DIRECT3DMATERIALI
{
/*** Object Interface ***/
LPDIRECT3DMATERIAL2CALLBACKS lpVtbl; /* Pointer to callbacks */
int refCnt; /* Reference count */
/*** Object Relations ***/
LPDIRECT3DI lpDirect3DI; /* Parent */
DIRECT3DMATERIALOLDI lpThisID3DMat; /* Our IDirect3DMaterial interface */
LIST_MEMBER(_DIRECT3DMATERIALI)list;
/* Next MATERIAL in IDirect3D */
LIST_ROOT(_mblocks, _D3DI_MATERIALBLOCK)blocks;
/* devices we're associated with */
/*** Object Data ***/
D3DMATERIAL dmMaterial; /* Data describing material */
BOOL bRes; /* Is this material reserved in the driver */
} DIRECT3DMATERIALI;
/*
* If we have an aggreate Direct3DTexture we need a structure
* to represent an unknown interface distinct from the underlying
* object. This is that structure.
*/
typedef struct _DIRECT3DTEXTUREUNKNOWNI
{
LPDIRECT3DTEXTURECALLBACKS lpVtbl;
LPDIRECT3DTEXTUREI lpObj;
} DIRECT3DTEXTUREUNKNOWNI;
typedef struct _DIRECT3DTEXTUREUNKNOWNI *LPDIRECT3DTEXTUREUNKNOWNI;
typedef struct _DIRECT3DTEXTUREOLDI
{
LPDIRECT3DTEXTURECALLBACKS lpVtbl;
LPDIRECT3DTEXTUREI lpObj;
} DIRECT3DTEXTUREOLDI, *LPDIRECT3DTEXTUREOLDI;
/*
* Internal version of Direct3DTexture object; it has data after the vtable
*/
typedef struct _DIRECT3DTEXTUREI
{
/*** Object Interface ***/
LPDIRECT3DTEXTURE2CALLBACKS lpVtbl; /* Pointer to callbacks */
int refCnt; /* Reference count */
/*** Object Relations ***/
LIST_ROOT(_blocks, _D3DI_TEXTUREBLOCK) blocks;
/* Devices we're associated with */
/*** Object Data ***/
LPDIRECTDRAWSURFACE lpDDS;
/*
* The special IUnknown interface for the aggregate that does
* not punt to the parent object.
*/
LPUNKNOWN lpOwningIUnknown; /* The owning IUnknown */
DIRECT3DTEXTUREUNKNOWNI lpThisIUnknown; /* Our IUnknown interface */
DIRECT3DTEXTUREOLDI lpThisID3DTex; /* Our IDirect3DTexture interface */
BOOL bIsPalettized;
} DIRECT3DTEXTUREI;
/*
* Internal version of Direct3DViewport object; it has data after the vtable
*/
typedef struct _DIRECT3DVIEWPORTI
{
/*** Object Interface ***/
LPDIRECT3DVIEWPORT2CALLBACKS lpVtbl; /* Pointer to callbacks */
int refCnt; /* Reference count */
/*** Object Relations */
LPDIRECT3DI lpDirect3DI; /* Parent */
LIST_MEMBER(_DIRECT3DVIEWPORTI)list;
/* Next viewport in IDirect3D */
LPDIRECT3DDEVICEI lpD3DDeviceI; /* Guardian */
CIRCLE_QUEUE_MEMBER(_DIRECT3DVIEWPORTI)vw_list;
/* Next viewport in IDirect3DDevice */
/* Lights */
int numLights;
CIRCLE_QUEUE_ROOT(_dlights, _DIRECT3DLIGHTI) lights;
/* Associated IDirect3DLights */
/*** Object Data ***/
unsigned long v_id; /* Id for this viewport */
D3DVIEWPORT2 v_data;
BOOL v_data_is_set;
BOOL have_background;
D3DMATERIALHANDLE background;
/* Background material */
BOOL have_depth;
LPDIRECTDRAWSURFACE depth; /* Background depth */
BOOL bLightsChanged;
/* Have the lights changed since they
were last collected? */
DWORD clrCount; /* Number of rects allocated */
LPD3DRECT clrRects; /* Rects used for clearing */
} DIRECT3DVIEWPORTI;
/*
* Picking stuff.
*/
typedef struct _D3DI_PICKDATA {
D3DI_EXECUTEDATA* exe;
D3DPICKRECORD* records;
int pick_count;
D3DRECT pick;
} D3DI_PICKDATA, *LPD3DI_PICKDATA;
/*
* Direct3D memory allocation
*/
/*
* Register a set of functions to be used in place of malloc, realloc
* and free for memory allocation. The functions D3DMalloc, D3DRealloc
* and D3DFree will use these functions. The default is to use the
* ANSI C library routines malloc, realloc and free.
*/
typedef LPVOID (*D3DMALLOCFUNCTION)(size_t);
typedef LPVOID (*D3DREALLOCFUNCTION)(LPVOID, size_t);
typedef VOID (*D3DFREEFUNCTION)(LPVOID);
/*
* Allocate size bytes of memory and return a pointer to it in *p_return.
* Returns D3DERR_BADALLOC with *p_return unchanged if the allocation fails.
*/
extern __declspec (dllexport) HRESULT D3DAPI D3DMalloc(LPVOID* p_return, size_t size);
/*
* Change the size of an allocated block of memory. A pointer to the
* block is passed in in *p_inout. If *p_inout is NULL then a new
* block is allocated. If the reallocation is successful, *p_inout is
* changed to point to the new block. If the allocation fails,
* *p_inout is unchanged and D3DERR_BADALLOC is returned.
*/
HRESULT D3DAPI D3DRealloc(LPVOID* p_inout, size_t size);
/*
* Free a block of memory previously allocated with D3DMalloc or
* D3DRealloc.
*/
extern __declspec (dllexport) VOID D3DAPI D3DFree(LPVOID p);
/*
* Used for raising errors from the driver.
*/
HRESULT D3DAPI D3DRaise(HRESULT);
/*
* Convert RLDDI error codes to D3D error codes
*/
#define RLDDITOD3DERR(_errcode) (RLDDIToD3DErrors[_errcode])
extern HRESULT RLDDIToD3DErrors[];
/*
* maths
*/
#if 1 /* defined(STACK_CALL) && defined(__WATCOMC__) */
D3DVALUE D3DIPow(D3DVALUE, D3DVALUE);
#else
#define D3DIPow(v,p) DTOVAL(pow(VALTOD(v), VALTOD(p)))
#endif
/*
* Light utils
*/
void D3DI_DeviceMarkLightEnd(LPDIRECT3DDEVICEI, int);
void D3DI_UpdateLightInternal(LPDIRECT3DLIGHTI);
void D3DI_VectorNormalise12(LPD3DVECTOR v);
D3DTEXTUREHANDLE D3DI_FindTextureHandle(LPDIRECT3DTEXTUREI, LPDIRECT3DDEVICEI);
void D3DI_SetTextureHandle(LPDIRECT3DTEXTUREI, LPDIRECT3DDEVICEI, D3DTEXTUREHANDLE);
void D3DI_RemoveTextureBlock(LPD3DI_TEXTUREBLOCK);
void D3DI_RemoveMaterialBlock(LPD3DI_MATERIALBLOCK);
extern BOOL D3DI_isHALValid(LPD3DHAL_CALLBACKS);
#ifdef BUILD_D3D_LAYER
extern RLDDIValue* RLDDIFInvSqrtTable;
#endif
#ifdef __cplusplus
};
#endif
#endif /* BUILD_HEL */
#endif /* !BUILD_RLAPI */
// @@END_MSINTERNAL
#endif /* _D3DI_H */
+229
View File
@@ -0,0 +1,229 @@
/*==========================================================================;
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* File: d3drm.h
* Content: Direct3DRM include file
*
***************************************************************************/
#ifndef __D3DRM_H__
#define __D3DRM_H__
#include "directx/vddraw.h"
#include "directx/vd3drmobj.h"
#ifdef __cplusplus
extern "C" {
struct IDirect3DRM;
#endif
DEFINE_GUID(IID_IDirect3DRM, 0x2bc49361, 0x8327, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1);
DEFINE_GUID(IID_IDirect3DRM2, 0x4516ecc8, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
WIN_TYPES(IDirect3DRM, DIRECT3DRM);
WIN_TYPES(IDirect3DRM2, DIRECT3DRM2);
/* Create a Direct3DRM API */
STDAPI Direct3DRMCreate(LPDIRECT3DRM FAR *lplpDirect3DRM);
#undef INTERFACE
#define INTERFACE IDirect3DRM
DECLARE_INTERFACE_(IDirect3DRM, IUnknown)
{
IUNKNOWN_METHODS(PURE);
STDMETHOD(CreateObject)
(THIS_ REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv) PURE;
STDMETHOD(CreateFrame) (THIS_ LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME *) PURE;
STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *) PURE;
STDMETHOD(CreateMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER *) PURE;
STDMETHOD(CreateFace) (THIS_ LPDIRECT3DRMFACE *) PURE;
STDMETHOD(CreateAnimation) (THIS_ LPDIRECT3DRMANIMATION *) PURE;
STDMETHOD(CreateAnimationSet)(THIS_ LPDIRECT3DRMANIMATIONSET *) PURE;
STDMETHOD(CreateTexture) (THIS_ LPD3DRMIMAGE, LPDIRECT3DRMTEXTURE *) PURE;
STDMETHOD(CreateLight) (THIS_ D3DRMLIGHTTYPE, D3DCOLOR, LPDIRECT3DRMLIGHT *) PURE;
STDMETHOD(CreateLightRGB)
(THIS_ D3DRMLIGHTTYPE, D3DVALUE, D3DVALUE, D3DVALUE, LPDIRECT3DRMLIGHT *) PURE;
STDMETHOD(CreateMaterial) (THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL *) PURE;
STDMETHOD(CreateDevice) (THIS_ DWORD, DWORD, LPDIRECT3DRMDEVICE *) PURE;
/* Create a Windows Device using DirectDraw surfaces */
STDMETHOD(CreateDeviceFromSurface)
( THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD,
LPDIRECTDRAWSURFACE lpDDSBack, LPDIRECT3DRMDEVICE *
) PURE;
/* Create a Windows Device using D3D objects */
STDMETHOD(CreateDeviceFromD3D)
( THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev,
LPDIRECT3DRMDEVICE *
) PURE;
STDMETHOD(CreateDeviceFromClipper)
( THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID,
int width, int height, LPDIRECT3DRMDEVICE *) PURE;
STDMETHOD(CreateTextureFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DRMTEXTURE *) PURE;
STDMETHOD(CreateShadow)
( THIS_ LPDIRECT3DRMVISUAL, LPDIRECT3DRMLIGHT,
D3DVALUE px, D3DVALUE py, D3DVALUE pz,
D3DVALUE nx, D3DVALUE ny, D3DVALUE nz,
LPDIRECT3DRMVISUAL *
) PURE;
STDMETHOD(CreateViewport)
( THIS_ LPDIRECT3DRMDEVICE, LPDIRECT3DRMFRAME, DWORD, DWORD,
DWORD, DWORD, LPDIRECT3DRMVIEWPORT *
) PURE;
STDMETHOD(CreateWrap)
( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME,
D3DVALUE ox, D3DVALUE oy, D3DVALUE oz,
D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
D3DVALUE ux, D3DVALUE uy, D3DVALUE uz,
D3DVALUE ou, D3DVALUE ov,
D3DVALUE su, D3DVALUE sv,
LPDIRECT3DRMWRAP *
) PURE;
STDMETHOD(CreateUserVisual) (THIS_ D3DRMUSERVISUALCALLBACK, LPVOID lPArg, LPDIRECT3DRMUSERVISUAL *) PURE;
STDMETHOD(LoadTexture) (THIS_ const char *, LPDIRECT3DRMTEXTURE *) PURE;
STDMETHOD(LoadTextureFromResource) (THIS_ HRSRC rs, LPDIRECT3DRMTEXTURE *) PURE;
STDMETHOD(SetSearchPath) (THIS_ LPCSTR) PURE;
STDMETHOD(AddSearchPath) (THIS_ LPCSTR) PURE;
STDMETHOD(GetSearchPath) (THIS_ DWORD *size_return, LPSTR path_return) PURE;
STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE;
STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE;
STDMETHOD(GetDevices) (THIS_ LPDIRECT3DRMDEVICEARRAY *) PURE;
STDMETHOD(GetNamedObject) (THIS_ const char *, LPDIRECT3DRMOBJECT *) PURE;
STDMETHOD(EnumerateObjects) (THIS_ D3DRMOBJECTCALLBACK, LPVOID) PURE;
STDMETHOD(Load)
( THIS_ LPVOID, LPVOID, LPIID *, DWORD, D3DRMLOADOPTIONS,
D3DRMLOADCALLBACK, LPVOID, D3DRMLOADTEXTURECALLBACK, LPVOID,
LPDIRECT3DRMFRAME
) PURE;
STDMETHOD(Tick) (THIS_ D3DVALUE) PURE;
};
#undef INTERFACE
#define INTERFACE IDirect3DRM2
DECLARE_INTERFACE_(IDirect3DRM2, IUnknown)
{
IUNKNOWN_METHODS(PURE);
STDMETHOD(CreateObject)
(THIS_ REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv) PURE;
STDMETHOD(CreateFrame) (THIS_ LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME2 *) PURE;
STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *) PURE;
STDMETHOD(CreateMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER2 *) PURE;
STDMETHOD(CreateFace) (THIS_ LPDIRECT3DRMFACE *) PURE;
STDMETHOD(CreateAnimation) (THIS_ LPDIRECT3DRMANIMATION *) PURE;
STDMETHOD(CreateAnimationSet)(THIS_ LPDIRECT3DRMANIMATIONSET *) PURE;
STDMETHOD(CreateTexture) (THIS_ LPD3DRMIMAGE, LPDIRECT3DRMTEXTURE2 *) PURE;
STDMETHOD(CreateLight) (THIS_ D3DRMLIGHTTYPE, D3DCOLOR, LPDIRECT3DRMLIGHT *) PURE;
STDMETHOD(CreateLightRGB)
(THIS_ D3DRMLIGHTTYPE, D3DVALUE, D3DVALUE, D3DVALUE, LPDIRECT3DRMLIGHT *) PURE;
STDMETHOD(CreateMaterial) (THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL *) PURE;
STDMETHOD(CreateDevice) (THIS_ DWORD, DWORD, LPDIRECT3DRMDEVICE2 *) PURE;
/* Create a Windows Device using DirectDraw surfaces */
STDMETHOD(CreateDeviceFromSurface)
( THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD,
LPDIRECTDRAWSURFACE lpDDSBack, LPDIRECT3DRMDEVICE2 *
) PURE;
/* Create a Windows Device using D3D objects */
STDMETHOD(CreateDeviceFromD3D)
( THIS_ LPDIRECT3D2 lpD3D, LPDIRECT3DDEVICE2 lpD3DDev,
LPDIRECT3DRMDEVICE2 *
) PURE;
STDMETHOD(CreateDeviceFromClipper)
( THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID,
int width, int height, LPDIRECT3DRMDEVICE2 *) PURE;
STDMETHOD(CreateTextureFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DRMTEXTURE2 *) PURE;
STDMETHOD(CreateShadow)
( THIS_ LPDIRECT3DRMVISUAL, LPDIRECT3DRMLIGHT,
D3DVALUE px, D3DVALUE py, D3DVALUE pz,
D3DVALUE nx, D3DVALUE ny, D3DVALUE nz,
LPDIRECT3DRMVISUAL *
) PURE;
STDMETHOD(CreateViewport)
( THIS_ LPDIRECT3DRMDEVICE, LPDIRECT3DRMFRAME, DWORD, DWORD,
DWORD, DWORD, LPDIRECT3DRMVIEWPORT *
) PURE;
STDMETHOD(CreateWrap)
( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME,
D3DVALUE ox, D3DVALUE oy, D3DVALUE oz,
D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
D3DVALUE ux, D3DVALUE uy, D3DVALUE uz,
D3DVALUE ou, D3DVALUE ov,
D3DVALUE su, D3DVALUE sv,
LPDIRECT3DRMWRAP *
) PURE;
STDMETHOD(CreateUserVisual) (THIS_ D3DRMUSERVISUALCALLBACK, LPVOID lPArg, LPDIRECT3DRMUSERVISUAL *) PURE;
STDMETHOD(LoadTexture) (THIS_ const char *, LPDIRECT3DRMTEXTURE2 *) PURE;
STDMETHOD(LoadTextureFromResource) (THIS_ HMODULE hModule, LPCTSTR strName, LPCTSTR strType, LPDIRECT3DRMTEXTURE2 *) PURE;
STDMETHOD(SetSearchPath) (THIS_ LPCSTR) PURE;
STDMETHOD(AddSearchPath) (THIS_ LPCSTR) PURE;
STDMETHOD(GetSearchPath) (THIS_ DWORD *size_return, LPSTR path_return) PURE;
STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE;
STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE;
STDMETHOD(GetDevices) (THIS_ LPDIRECT3DRMDEVICEARRAY *) PURE;
STDMETHOD(GetNamedObject) (THIS_ const char *, LPDIRECT3DRMOBJECT *) PURE;
STDMETHOD(EnumerateObjects) (THIS_ D3DRMOBJECTCALLBACK, LPVOID) PURE;
STDMETHOD(Load)
( THIS_ LPVOID, LPVOID, LPIID *, DWORD, D3DRMLOADOPTIONS,
D3DRMLOADCALLBACK, LPVOID, D3DRMLOADTEXTURECALLBACK, LPVOID,
LPDIRECT3DRMFRAME
) PURE;
STDMETHOD(Tick) (THIS_ D3DVALUE) PURE;
STDMETHOD(CreateProgressiveMesh)(THIS_ LPDIRECT3DRMPROGRESSIVEMESH *) PURE;
};
#define D3DRM_OK DD_OK
#define D3DRMERR_BADOBJECT MAKE_DDHRESULT(781)
#define D3DRMERR_BADTYPE MAKE_DDHRESULT(782)
#define D3DRMERR_BADALLOC MAKE_DDHRESULT(783)
#define D3DRMERR_FACEUSED MAKE_DDHRESULT(784)
#define D3DRMERR_NOTFOUND MAKE_DDHRESULT(785)
#define D3DRMERR_NOTDONEYET MAKE_DDHRESULT(786)
#define D3DRMERR_FILENOTFOUND MAKE_DDHRESULT(787)
#define D3DRMERR_BADFILE MAKE_DDHRESULT(788)
#define D3DRMERR_BADDEVICE MAKE_DDHRESULT(789)
#define D3DRMERR_BADVALUE MAKE_DDHRESULT(790)
#define D3DRMERR_BADMAJORVERSION MAKE_DDHRESULT(791)
#define D3DRMERR_BADMINORVERSION MAKE_DDHRESULT(792)
#define D3DRMERR_UNABLETOEXECUTE MAKE_DDHRESULT(793)
#define D3DRMERR_LIBRARYNOTFOUND MAKE_DDHRESULT(794)
#define D3DRMERR_INVALIDLIBRARY MAKE_DDHRESULT(795)
#define D3DRMERR_PENDING MAKE_DDHRESULT(796)
#define D3DRMERR_NOTENOUGHDATA MAKE_DDHRESULT(797)
#define D3DRMERR_REQUESTTOOLARGE MAKE_DDHRESULT(798)
#define D3DRMERR_REQUESTTOOSMALL MAKE_DDHRESULT(799)
#define D3DRMERR_CONNECTIONLOST MAKE_DDHRESULT(800)
#define D3DRMERR_LOADABORTED MAKE_DDHRESULT(801)
#define D3DRMERR_NOINTERNET MAKE_DDHRESULT(802)
#define D3DRMERR_BADCACHEFILE MAKE_DDHRESULT(803)
#define D3DRMERR_BOXNOTSET MAKE_DDHRESULT(804)
#define D3DRMERR_BADPMDATA MAKE_DDHRESULT(805)
#ifdef __cplusplus
};
#endif
#endif /* _D3DRMAPI_H_ */
+472
View File
@@ -0,0 +1,472 @@
/*==========================================================================;
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* File: d3drm.h
* Content: Direct3DRM include file
*
***************************************************************************/
#ifndef __D3DRMDEFS_H__
#define __D3DRMDEFS_H__
#include <stddef.h>
#include "directx/vd3dtypes.h"
#ifdef _WIN32
#define D3DRMAPI __stdcall
#else
#define D3DRMAPI
#endif
#if defined(__cplusplus)
extern "C" {
#endif
#ifndef TRUE
#define FALSE 0
#define TRUE 1
#endif
typedef struct _D3DRMVECTOR4D
{ D3DVALUE x, y, z, w;
} D3DRMVECTOR4D, *LPD3DRMVECTOR4D;
typedef D3DVALUE D3DRMMATRIX4D[4][4];
typedef struct _D3DRMQUATERNION
{ D3DVALUE s;
D3DVECTOR v;
} D3DRMQUATERNION, *LPD3DRMQUATERNION;
typedef struct _D3DRMRAY
{ D3DVECTOR dvDir;
D3DVECTOR dvPos;
} D3DRMRAY, *LPD3DRMRAY;
typedef struct _D3DRMBOX
{ D3DVECTOR min, max;
} D3DRMBOX, *LPD3DRMBOX;
typedef void (*D3DRMWRAPCALLBACK)
(LPD3DVECTOR, int* u, int* v, LPD3DVECTOR a, LPD3DVECTOR b, LPVOID);
typedef enum _D3DRMLIGHTTYPE
{ D3DRMLIGHT_AMBIENT,
D3DRMLIGHT_POINT,
D3DRMLIGHT_SPOT,
D3DRMLIGHT_DIRECTIONAL,
D3DRMLIGHT_PARALLELPOINT
} D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE;
typedef enum _D3DRMSHADEMODE {
D3DRMSHADE_FLAT = 0,
D3DRMSHADE_GOURAUD = 1,
D3DRMSHADE_PHONG = 2,
D3DRMSHADE_MASK = 7,
D3DRMSHADE_MAX = 8
} D3DRMSHADEMODE, *LPD3DRMSHADEMODE;
typedef enum _D3DRMLIGHTMODE {
D3DRMLIGHT_OFF = 0 * D3DRMSHADE_MAX,
D3DRMLIGHT_ON = 1 * D3DRMSHADE_MAX,
D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX,
D3DRMLIGHT_MAX = 8 * D3DRMSHADE_MAX
} D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE;
typedef enum _D3DRMFILLMODE {
D3DRMFILL_POINTS = 0 * D3DRMLIGHT_MAX,
D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX,
D3DRMFILL_SOLID = 2 * D3DRMLIGHT_MAX,
D3DRMFILL_MASK = 7 * D3DRMLIGHT_MAX,
D3DRMFILL_MAX = 8 * D3DRMLIGHT_MAX
} D3DRMFILLMODE, *LPD3DRMFILLMODE;
typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
#define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME)
#define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID)
#define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
#define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
#define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
#define D3DRMRENDERMODE_BLENDEDTRANSPARENCY 1
#define D3DRMRENDERMODE_SORTEDTRANSPARENCY 2
typedef enum _D3DRMTEXTUREQUALITY
{ D3DRMTEXTURE_NEAREST, /* choose nearest texel */
D3DRMTEXTURE_LINEAR, /* interpolate 4 texels */
D3DRMTEXTURE_MIPNEAREST, /* nearest texel in nearest mipmap */
D3DRMTEXTURE_MIPLINEAR, /* interpolate 2 texels from 2 mipmaps */
D3DRMTEXTURE_LINEARMIPNEAREST, /* interpolate 4 texels in nearest mipmap */
D3DRMTEXTURE_LINEARMIPLINEAR /* interpolate 8 texels from 2 mipmaps */
} D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY;
typedef enum _D3DRMCOMBINETYPE
{ D3DRMCOMBINE_REPLACE,
D3DRMCOMBINE_BEFORE,
D3DRMCOMBINE_AFTER
} D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE;
typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL;
typedef enum _D3DRMPALETTEFLAGS
{ D3DRMPALETTE_FREE, /* renderer may use this entry freely */
D3DRMPALETTE_READONLY, /* fixed but may be used by renderer */
D3DRMPALETTE_RESERVED /* may not be used by renderer */
} D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS;
typedef struct _D3DRMPALETTEENTRY
{ unsigned char red; /* 0 .. 255 */
unsigned char green; /* 0 .. 255 */
unsigned char blue; /* 0 .. 255 */
unsigned char flags; /* one of D3DRMPALETTEFLAGS */
} D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY;
typedef struct _D3DRMIMAGE
{ int width, height; /* width and height in pixels */
int aspectx, aspecty; /* aspect ratio for non-square pixels */
int depth; /* bits per pixel */
int rgb; /* if false, pixels are indices into a
palette otherwise, pixels encode
RGB values. */
int bytes_per_line; /* number of bytes of memory for a
scanline. This must be a multiple
of 4. */
void* buffer1; /* memory to render into (first buffer). */
void* buffer2; /* second rendering buffer for double
buffering, set to NULL for single
buffering. */
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
unsigned long alpha_mask; /* if rgb is true, these are masks for
the red, green and blue parts of a
pixel. Otherwise, these are masks
for the significant bits of the
red, green and blue elements in the
palette. For instance, most SVGA
displays use 64 intensities of red,
green and blue, so the masks should
all be set to 0xfc. */
int palette_size; /* number of entries in palette */
D3DRMPALETTEENTRY* palette; /* description of the palette (only if
rgb is false). Must be (1<<depth)
elements. */
} D3DRMIMAGE, *LPD3DRMIMAGE;
typedef enum _D3DRMWRAPTYPE
{ D3DRMWRAP_FLAT,
D3DRMWRAP_CYLINDER,
D3DRMWRAP_SPHERE,
D3DRMWRAP_CHROME
} D3DRMWRAPTYPE, *LPD3DRMWRAPTYPE;
#define D3DRMWIREFRAME_CULL 1 /* cull backfaces */
#define D3DRMWIREFRAME_HIDDENLINE 2 /* lines are obscured by closer objects */
typedef enum _D3DRMPROJECTIONTYPE
{ D3DRMPROJECT_PERSPECTIVE,
D3DRMPROJECT_ORTHOGRAPHIC,
D3DRMPROJECT_RIGHTHANDPERSPECTIVE,
D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC
} D3DRMPROJECTIONTYPE, *LPD3DRMPROJECTIONTYPE;
typedef enum _D3DRMXOFFORMAT
{ D3DRMXOF_BINARY,
D3DRMXOF_COMPRESSED,
D3DRMXOF_TEXT
} D3DRMXOFFORMAT, *LPD3DRMXOFFORMAT;
typedef DWORD D3DRMSAVEOPTIONS;
#define D3DRMXOFSAVE_NORMALS 1
#define D3DRMXOFSAVE_TEXTURECOORDINATES 2
#define D3DRMXOFSAVE_MATERIALS 4
#define D3DRMXOFSAVE_TEXTURENAMES 8
#define D3DRMXOFSAVE_ALL 15
#define D3DRMXOFSAVE_TEMPLATES 16
#define D3DRMXOFSAVE_TEXTURETOPOLOGY 32
typedef enum _D3DRMCOLORSOURCE
{ D3DRMCOLOR_FROMFACE,
D3DRMCOLOR_FROMVERTEX
} D3DRMCOLORSOURCE, *LPD3DRMCOLORSOURCE;
typedef enum _D3DRMFRAMECONSTRAINT
{ D3DRMCONSTRAIN_Z, /* use only X and Y rotations */
D3DRMCONSTRAIN_Y, /* use only X and Z rotations */
D3DRMCONSTRAIN_X /* use only Y and Z rotations */
} D3DRMFRAMECONSTRAINT, *LPD3DRMFRAMECONSTRAINT;
typedef enum _D3DRMMATERIALMODE
{ D3DRMMATERIAL_FROMMESH,
D3DRMMATERIAL_FROMPARENT,
D3DRMMATERIAL_FROMFRAME
} D3DRMMATERIALMODE, *LPD3DRMMATERIALMODE;
typedef enum _D3DRMFOGMODE
{ D3DRMFOG_LINEAR, /* linear between start and end */
D3DRMFOG_EXPONENTIAL, /* density * exp(-distance) */
D3DRMFOG_EXPONENTIALSQUARED /* density * exp(-distance*distance) */
} D3DRMFOGMODE, *LPD3DRMFOGMODE;
typedef enum _D3DRMZBUFFERMODE {
D3DRMZBUFFER_FROMPARENT, /* default */
D3DRMZBUFFER_ENABLE, /* enable zbuffering */
D3DRMZBUFFER_DISABLE /* disable zbuffering */
} D3DRMZBUFFERMODE, *LPD3DRMZBUFFERMODE;
typedef enum _D3DRMSORTMODE {
D3DRMSORT_FROMPARENT, /* default */
D3DRMSORT_NONE, /* don't sort child frames */
D3DRMSORT_FRONTTOBACK, /* sort child frames front-to-back */
D3DRMSORT_BACKTOFRONT /* sort child frames back-to-front */
} D3DRMSORTMODE, *LPD3DRMSORTMODE;
/*
* Values for flags in Frame2::AddMoveCallback.
*/
#define D3DRMCALLBACK_PREORDER 0
#define D3DRMCALLBACK_POSTORDER 1
/*
* Values for flags in MeshBuilder2::RayPick.
*/
#define D3DRMRAYPICK_ONLYBOUNDINGBOXES 1
#define D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES 2
#define D3DRMRAYPICK_INTERPOLATEUV 4
#define D3DRMRAYPICK_INTERPOLATECOLOR 8
#define D3DRMRAYPICK_INTERPOLATENORMAL 0x10
/*
* Values for flags in MeshBuilder2::GenerateNormals.
*/
#define D3DRMGENERATENORMALS_PRECOMPACT 1
#define D3DRMGENERATENORMALS_USECREASEANGLE 2
typedef DWORD D3DRMANIMATIONOPTIONS;
#define D3DRMANIMATION_OPEN 0x01L
#define D3DRMANIMATION_CLOSED 0x02L
#define D3DRMANIMATION_LINEARPOSITION 0x04L
#define D3DRMANIMATION_SPLINEPOSITION 0x08L
#define D3DRMANIMATION_SCALEANDROTATION 0x00000010L
#define D3DRMANIMATION_POSITION 0x00000020L
typedef DWORD D3DRMINTERPOLATIONOPTIONS;
#define D3DRMINTERPOLATION_OPEN 0x01L
#define D3DRMINTERPOLATION_CLOSED 0x02L
#define D3DRMINTERPOLATION_NEAREST 0x0100L
#define D3DRMINTERPOLATION_LINEAR 0x04L
#define D3DRMINTERPOLATION_SPLINE 0x08L
#define D3DRMINTERPOLATION_VERTEXCOLOR 0x40L
#define D3DRMINTERPOLATION_SLERPNORMALS 0x80L
typedef DWORD D3DRMLOADOPTIONS;
#define D3DRMLOAD_FROMFILE 0x00L
#define D3DRMLOAD_FROMRESOURCE 0x01L
#define D3DRMLOAD_FROMMEMORY 0x02L
#define D3DRMLOAD_FROMSTREAM 0x04L
#define D3DRMLOAD_FROMURL 0x08L
#define D3DRMLOAD_BYNAME 0x10L
#define D3DRMLOAD_BYPOSITION 0x20L
#define D3DRMLOAD_BYGUID 0x40L
#define D3DRMLOAD_FIRST 0x80L
#define D3DRMLOAD_INSTANCEBYREFERENCE 0x100L
#define D3DRMLOAD_INSTANCEBYCOPYING 0x200L
#define D3DRMLOAD_ASYNCHRONOUS 0x400L
typedef struct _D3DRMLOADRESOURCE {
HMODULE hModule;
LPCTSTR lpName;
LPCTSTR lpType;
} D3DRMLOADRESOURCE, *LPD3DRMLOADRESOURCE;
typedef struct _D3DRMLOADMEMORY {
LPVOID lpMemory;
DWORD dSize;
} D3DRMLOADMEMORY, *LPD3DRMLOADMEMORY;
#define D3DRMPMESHSTATUS_VALID 0x01L
#define D3DRMPMESHSTATUS_INTERRUPTED 0x02L
#define D3DRMPMESHSTATUS_BASEMESHCOMPLETE 0x04L
#define D3DRMPMESHSTATUS_COMPLETE 0x08L
#define D3DRMPMESHSTATUS_RENDERABLE 0x10L
#define D3DRMPMESHEVENT_BASEMESH 0x01L
#define D3DRMPMESHEVENT_COMPLETE 0x02L
typedef struct _D3DRMPMESHLOADSTATUS {
DWORD dwSize; // Size of this structure
DWORD dwPMeshSize; // Total Size (bytes)
DWORD dwBaseMeshSize; // Total Size of the Base Mesh
DWORD dwBytesLoaded; // Total bytes loaded
DWORD dwVerticesLoaded; // Number of vertices loaded
DWORD dwFacesLoaded; // Number of faces loaded
HRESULT dwLoadResult; // Result of the load operation
DWORD dwFlags;
} D3DRMPMESHLOADSTATUS, *LPD3DRMPMESHLOADSTATUS;
typedef enum _D3DRMUSERVISUALREASON {
D3DRMUSERVISUAL_CANSEE,
D3DRMUSERVISUAL_RENDER
} D3DRMUSERVISUALREASON, *LPD3DRMUSERVISUALREASON;
typedef DWORD D3DRMMAPPING, D3DRMMAPPINGFLAG, *LPD3DRMMAPPING;
static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU = 1;
static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV = 2;
static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT = 4;
typedef struct _D3DRMVERTEX
{ D3DVECTOR position;
D3DVECTOR normal;
D3DVALUE tu, tv;
D3DCOLOR color;
} D3DRMVERTEX, *LPD3DRMVERTEX;
typedef LONG D3DRMGROUPINDEX; /* group indexes begin a 0 */
static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS = -1;
/*
* Create a color from three components in the range 0-1 inclusive.
*/
extern D3DCOLOR D3DRMAPI D3DRMCreateColorRGB(D3DVALUE red,
D3DVALUE green,
D3DVALUE blue);
/*
* Create a color from four components in the range 0-1 inclusive.
*/
extern D3DCOLOR D3DRMAPI D3DRMCreateColorRGBA(D3DVALUE red,
D3DVALUE green,
D3DVALUE blue,
D3DVALUE alpha);
/*
* Get the red component of a color.
*/
extern D3DVALUE D3DRMAPI D3DRMColorGetRed(D3DCOLOR);
/*
* Get the green component of a color.
*/
extern D3DVALUE D3DRMAPI D3DRMColorGetGreen(D3DCOLOR);
/*
* Get the blue component of a color.
*/
extern D3DVALUE D3DRMAPI D3DRMColorGetBlue(D3DCOLOR);
/*
* Get the alpha component of a color.
*/
extern D3DVALUE D3DRMAPI D3DRMColorGetAlpha(D3DCOLOR);
/*
* Add two vectors. Returns its first argument.
*/
extern LPD3DVECTOR D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR d,
LPD3DVECTOR s1,
LPD3DVECTOR s2);
/*
* Subtract two vectors. Returns its first argument.
*/
extern LPD3DVECTOR D3DRMAPI D3DRMVectorSubtract(LPD3DVECTOR d,
LPD3DVECTOR s1,
LPD3DVECTOR s2);
/*
* Reflect a ray about a given normal. Returns its first argument.
*/
extern LPD3DVECTOR D3DRMAPI D3DRMVectorReflect(LPD3DVECTOR d,
LPD3DVECTOR ray,
LPD3DVECTOR norm);
/*
* Calculate the vector cross product. Returns its first argument.
*/
extern LPD3DVECTOR D3DRMAPI D3DRMVectorCrossProduct(LPD3DVECTOR d,
LPD3DVECTOR s1,
LPD3DVECTOR s2);
/*
* Return the vector dot product.
*/
extern D3DVALUE D3DRMAPI D3DRMVectorDotProduct(LPD3DVECTOR s1,
LPD3DVECTOR s2);
/*
* Scale a vector so that its modulus is 1. Returns its argument or
* NULL if there was an error (e.g. a zero vector was passed).
*/
extern LPD3DVECTOR D3DRMAPI D3DRMVectorNormalize(LPD3DVECTOR);
#define D3DRMVectorNormalise D3DRMVectorNormalize
/*
* Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
*/
extern D3DVALUE D3DRMAPI D3DRMVectorModulus(LPD3DVECTOR v);
/*
* Set the rotation part of a matrix to be a rotation of theta radians
* around the given axis.
*/
extern LPD3DVECTOR D3DRMAPI D3DRMVectorRotate(LPD3DVECTOR r, LPD3DVECTOR v, LPD3DVECTOR axis, D3DVALUE theta);
/*
* Scale a vector uniformly in all three axes
*/
extern LPD3DVECTOR D3DRMAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor);
/*
* Return a random unit vector
*/
extern LPD3DVECTOR D3DRMAPI D3DRMVectorRandom(LPD3DVECTOR d);
/*
* Returns a unit quaternion that represents a rotation of theta radians
* around the given axis.
*/
extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION quat,
LPD3DVECTOR v,
D3DVALUE theta);
/*
* Calculate the product of two quaternions
*/
extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q,
LPD3DRMQUATERNION a,
LPD3DRMQUATERNION b);
/*
* Interpolate between two quaternions
*/
extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q,
LPD3DRMQUATERNION a,
LPD3DRMQUATERNION b,
D3DVALUE alpha);
/*
* Calculate the matrix for the rotation that a unit quaternion represents
*/
extern void D3DRMAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D dmMat, LPD3DRMQUATERNION lpDqQuat);
/*
* Calculate the quaternion that corresponds to a rotation matrix
*/
extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromMatrix(LPD3DRMQUATERNION, D3DRMMATRIX4D);
#if defined(__cplusplus)
};
#endif
#endif
File diff suppressed because it is too large. Load diff
+51
View File
@@ -0,0 +1,51 @@
/*==========================================================================;
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* File: d3drm.h
* Content: Direct3DRM include file
*
***************************************************************************/
#ifndef __D3DRMWIN_H__
#define __D3DRMWIN_H__
#ifdef _WIN32
#ifndef WIN32
#define WIN32
#endif
#endif
#include "directx/vd3drm.h"
#include "directx/vddraw.h"
#include "directx/vd3d.h"
/*
* GUIDS used by Direct3DRM Windows interface
*/
DEFINE_GUID(IID_IDirect3DRMWinDevice, 0xc5016cc0, 0xd273, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1);
WIN_TYPES(IDirect3DRMWinDevice, DIRECT3DRMWINDEVICE);
#undef INTERFACE
#define INTERFACE IDirect3DRMWinDevice
DECLARE_INTERFACE_(IDirect3DRMWinDevice, IDirect3DRMObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECT3DRMOBJECT_METHODS(PURE);
/*
* IDirect3DRMWinDevice methods
*/
/* Repaint the window with the last frame which was rendered. */
STDMETHOD(HandlePaint)(THIS_ HDC hdc) PURE;
/* Respond to a WM_ACTIVATE message. */
STDMETHOD(HandleActivate)(THIS_ WORD wparam) PURE;
};
#endif
File diff suppressed because it is too large. Load diff
+240
View File
@@ -0,0 +1,240 @@
/******************************************************************
* *
* D3DVec.inl *
* *
* Float-valued 3D vector class for Direct3D. *
* *
* Copyright (c) 1996-1997 Microsoft Corp. All rights reserved. *
* *
******************************************************************/
#include <math.h>
// =====================================
// Constructors
// =====================================
inline
_D3DVECTOR::_D3DVECTOR(D3DVALUE f)
{
x = y = z = f;
}
inline
_D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z)
{
x = _x; y = _y; z = _z;
}
inline
_D3DVECTOR::_D3DVECTOR(const D3DVALUE f[3])
{
x = f[0]; y = f[1]; z = f[2];
}
// =====================================
// Access grants
// =====================================
inline const D3DVALUE&
_D3DVECTOR::operator[](int i) const
{
return (&x)[i];
}
inline D3DVALUE&
_D3DVECTOR::operator[](int i)
{
return (&x)[i];
}
// =====================================
// Assignment operators
// =====================================
inline _D3DVECTOR&
_D3DVECTOR::operator += (const _D3DVECTOR& v)
{
x += v.x; y += v.y; z += v.z;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator -= (const _D3DVECTOR& v)
{
x -= v.x; y -= v.y; z -= v.z;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator *= (const _D3DVECTOR& v)
{
x *= v.x; y *= v.y; z *= v.z;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator /= (const _D3DVECTOR& v)
{
x /= v.x; y /= v.y; z /= v.z;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator *= (D3DVALUE s)
{
x *= s; y *= s; z *= s;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator /= (D3DVALUE s)
{
x /= s; y /= s; z /= s;
return *this;
}
inline _D3DVECTOR
operator + (const _D3DVECTOR& v)
{
return v;
}
inline _D3DVECTOR
operator - (const _D3DVECTOR& v)
{
return _D3DVECTOR(-v.x, -v.y, -v.z);
}
inline _D3DVECTOR
operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
}
inline _D3DVECTOR
operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
}
inline _D3DVECTOR
operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR(v1.x*v2.x, v1.y*v2.y, v1.z*v2.z);
}
inline _D3DVECTOR
operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR(v1.x/v2.x, v1.y/v2.y, v1.z/v2.z);
}
inline int
operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return v1[0] < v2[0] && v1[1] < v2[1] && v1[2] < v2[2];
}
inline int
operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return v1[0] <= v2[0] && v1[1] <= v2[1] && v1[2] <= v2[2];
}
inline _D3DVECTOR
operator * (const _D3DVECTOR& v, D3DVALUE s)
{
return _D3DVECTOR(s*v.x, s*v.y, s*v.z);
}
inline _D3DVECTOR
operator * (D3DVALUE s, const _D3DVECTOR& v)
{
return _D3DVECTOR(s*v.x, s*v.y, s*v.z);
}
inline _D3DVECTOR
operator / (const _D3DVECTOR& v, D3DVALUE s)
{
return _D3DVECTOR(v.x/s, v.y/s, v.z/s);
}
inline int
operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return v1.x==v2.x && v1.y==v2.y && v1.z == v2.z;
}
inline D3DVALUE
Magnitude (const _D3DVECTOR& v)
{
return (D3DVALUE) sqrt(SquareMagnitude(v));
}
inline D3DVALUE
SquareMagnitude (const _D3DVECTOR& v)
{
return v.x*v.x + v.y*v.y + v.z*v.z;
}
inline _D3DVECTOR
Normalize (const _D3DVECTOR& v)
{
return v / Magnitude(v);
}
inline D3DVALUE
Min (const _D3DVECTOR& v)
{
D3DVALUE ret = v.x;
if (v.y < ret) ret = v.y;
if (v.z < ret) ret = v.z;
return ret;
}
inline D3DVALUE
Max (const _D3DVECTOR& v)
{
D3DVALUE ret = v.x;
if (ret < v.y) ret = v.y;
if (ret < v.z) ret = v.z;
return ret;
}
inline _D3DVECTOR
Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR( v1[0] < v2[0] ? v1[0] : v2[0],
v1[1] < v2[1] ? v1[1] : v2[1],
v1[2] < v2[2] ? v1[2] : v2[2]);
}
inline _D3DVECTOR
Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR( v1[0] > v2[0] ? v1[0] : v2[0],
v1[1] > v2[1] ? v1[1] : v2[1],
v1[2] > v2[2] ? v1[2] : v2[2]);
}
inline D3DVALUE
DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return v1.x*v2.x + v1.y * v2.y + v1.z*v2.z;
}
inline _D3DVECTOR
CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
_D3DVECTOR result;
result[0] = v1[1] * v2[2] - v1[2] * v2[1];
result[1] = v1[2] * v2[0] - v1[0] * v2[2];
result[2] = v1[0] * v2[1] - v1[1] * v2[0];
return result;
}
File diff suppressed because it is too large. Load diff
Binary file not shown.
File diff suppressed because it is too large. Load diff
Binary file not shown.
File diff suppressed because it is too large. Load diff
+627
View File
@@ -0,0 +1,627 @@
/*==========================================================================;
*
* Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved.
*
* File: dplobby.h
* Content: DirectPlayLobby include file
***************************************************************************/
#ifndef __DPLOBBY_INCLUDED__
#define __DPLOBBY_INCLUDED__
#include "directx/vdplay.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* GUIDS used by DirectPlay objects
*/
/* {AF465C71-9588-11cf-A020-00AA006157AC} */
DEFINE_GUID(IID_IDirectPlayLobby, 0xaf465c71, 0x9588, 0x11cf, 0xa0, 0x20, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac);
/* {26C66A70-B367-11cf-A024-00AA006157AC} */
DEFINE_GUID(IID_IDirectPlayLobbyA, 0x26c66a70, 0xb367, 0x11cf, 0xa0, 0x24, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac);
/* {0194C220-A303-11d0-9C4F-00A0C905425E} */
DEFINE_GUID(IID_IDirectPlayLobby2, 0x194c220, 0xa303, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
/* {1BB4AF80-A303-11d0-9C4F-00A0C905425E} */
DEFINE_GUID(IID_IDirectPlayLobby2A, 0x1bb4af80, 0xa303, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
/* {2FE8F810-B2A5-11d0-A787-0000F803ABFC} */
DEFINE_GUID(CLSID_DirectPlayLobby, 0x2fe8f810, 0xb2a5, 0x11d0, 0xa7, 0x87, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc);
/****************************************************************************
*
* IDirectPlayLobby Structures
*
* Various structures used to invoke DirectPlayLobby.
*
****************************************************************************/
typedef struct IDirectPlayLobby FAR *LPDIRECTPLAYLOBBY;
typedef struct IDirectPlayLobby FAR *LPDIRECTPLAYLOBBYA;
typedef struct IDirectPlayLobby IDirectPlayLobbyA;
typedef struct IDirectPlayLobby2 FAR *LPDIRECTPLAYLOBBY2;
typedef struct IDirectPlayLobby2 FAR *LPDIRECTPLAYLOBBY2A;
typedef struct IDirectPlayLobby2 IDirectPlayLobby2A;
/*
* DPLAPPINFO
* Used to hold information about a registered DirectPlay
* application
*/
typedef struct DPLAPPINFO
{
DWORD dwSize; // Size of this structure
GUID guidApplication; // GUID of the Application
union
{
LPSTR lpszAppNameA; // Pointer to the Application Name
LPWSTR lpszAppName;
};
} DPLAPPINFO, FAR *LPDPLAPPINFO;
/*
* LPCDPLAPPINFO
* A constant pointer to DPLAPPINFO
*/
typedef const DPLAPPINFO FAR *LPCDPLAPPINFO;
/*
* DPCOMPOUNDADDRESSELEMENT
*
* An array of these is passed to CreateCompoundAddresses()
*/
typedef struct DPCOMPOUNDADDRESSELEMENT
{
GUID guidDataType;
DWORD dwDataSize;
LPVOID lpData;
} DPCOMPOUNDADDRESSELEMENT, FAR *LPDPCOMPOUNDADDRESSELEMENT;
/*
* LPCDPCOMPOUNDADDRESSELEMENT
* A constant pointer to DPCOMPOUNDADDRESSELEMENT
*/
typedef const DPCOMPOUNDADDRESSELEMENT FAR *LPCDPCOMPOUNDADDRESSELEMENT;
/****************************************************************************
*
* Enumeration Method Callback Prototypes
*
****************************************************************************/
/*
* Callback for EnumAddress()
*/
typedef BOOL (FAR PASCAL *LPDPENUMADDRESSCALLBACK)(
REFGUID guidDataType,
DWORD dwDataSize,
LPCVOID lpData,
LPVOID lpContext);
/*
* Callback for EnumAddressTypes()
*/
typedef BOOL (FAR PASCAL *LPDPLENUMADDRESSTYPESCALLBACK)(
REFGUID guidDataType,
LPVOID lpContext,
DWORD dwFlags);
/*
* Callback for EnumLocalApplications()
*/
typedef BOOL (FAR PASCAL * LPDPLENUMLOCALAPPLICATIONSCALLBACK)(
LPCDPLAPPINFO lpAppInfo,
LPVOID lpContext,
DWORD dwFlags);
/****************************************************************************
*
* DirectPlayLobby API Prototypes
*
****************************************************************************/
#ifdef UNICODE
#define DirectPlayLobbyCreate DirectPlayLobbyCreateW
#else
#define DirectPlayLobbyCreate DirectPlayLobbyCreateA
#endif /* UNICODE */
extern HRESULT WINAPI DirectPlayLobbyCreateW(LPGUID, LPDIRECTPLAYLOBBY *, IUnknown *, LPVOID, DWORD );
extern HRESULT WINAPI DirectPlayLobbyCreateA(LPGUID, LPDIRECTPLAYLOBBYA *, IUnknown *, LPVOID, DWORD );
/****************************************************************************
*
* IDirectPlayLobby (and IDirectPlayLobbyA) Interface
*
****************************************************************************/
#undef INTERFACE
#define INTERFACE IDirectPlayLobby
DECLARE_INTERFACE_( IDirectPlayLobby, IUnknown )
{
/* IUnknown Methods */
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectPlayLobby Methods */
STDMETHOD(Connect) (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE;
STDMETHOD(CreateAddress) (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE;
STDMETHOD(EnumAddress) (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE;
STDMETHOD(EnumAddressTypes) (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE;
STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE;
STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE;
STDMETHOD(ReceiveLobbyMessage) (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE;
STDMETHOD(RunApplication) (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE;
STDMETHOD(SendLobbyMessage) (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE;
STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE;
STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE;
};
/****************************************************************************
*
* IDirectPlayLobby2 (and IDirectPlayLobby2A) Interface
*
****************************************************************************/
#undef INTERFACE
#define INTERFACE IDirectPlayLobby2
DECLARE_INTERFACE_( IDirectPlayLobby2, IDirectPlayLobby )
{
/* IUnknown Methods */
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectPlayLobby Methods */
STDMETHOD(Connect) (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE;
STDMETHOD(CreateAddress) (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE;
STDMETHOD(EnumAddress) (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE;
STDMETHOD(EnumAddressTypes) (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE;
STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE;
STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE;
STDMETHOD(ReceiveLobbyMessage) (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE;
STDMETHOD(RunApplication) (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE;
STDMETHOD(SendLobbyMessage) (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE;
STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE;
STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE;
/* IDirectPlayLobby2 Methods */
STDMETHOD(CreateCompoundAddress)(THIS_ LPCDPCOMPOUNDADDRESSELEMENT,DWORD,LPVOID,LPDWORD) PURE;
};
/****************************************************************************
*
* IDirectPlayLobby interface macros
*
****************************************************************************/
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectPlayLobby_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectPlayLobby_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectPlayLobby_Release(p) (p)->lpVtbl->Release(p)
#define IDirectPlayLobby_Connect(p,a,b,c) (p)->lpVtbl->Connect(p,a,b,c)
#define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f) (p)->lpVtbl->CreateAddress(p,a,b,c,d,e,f)
#define IDirectPlayLobby_CreateCompoundAddress(p,a,b,c,d) (p)->lpVtbl->CreateCompoundAddress(p,a,b,c,d)
#define IDirectPlayLobby_EnumAddress(p,a,b,c,d) (p)->lpVtbl->EnumAddress(p,a,b,c,d)
#define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d) (p)->lpVtbl->EnumAddressTypes(p,a,b,c,d)
#define IDirectPlayLobby_EnumLocalApplications(p,a,b,c) (p)->lpVtbl->EnumLocalApplications(p,a,b,c)
#define IDirectPlayLobby_GetConnectionSettings(p,a,b,c) (p)->lpVtbl->GetConnectionSettings(p,a,b,c)
#define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e) (p)->lpVtbl->ReceiveLobbyMessage(p,a,b,c,d,e)
#define IDirectPlayLobby_RunApplication(p,a,b,c,d) (p)->lpVtbl->RunApplication(p,a,b,c,d)
#define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d) (p)->lpVtbl->SendLobbyMessage(p,a,b,c,d)
#define IDirectPlayLobby_SetConnectionSettings(p,a,b,c) (p)->lpVtbl->SetConnectionSettings(p,a,b,c)
#define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c) (p)->lpVtbl->SetLobbyMessageEvent(p,a,b,c)
#else /* C++ */
#define IDirectPlayLobby_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectPlayLobby_AddRef(p) (p)->AddRef()
#define IDirectPlayLobby_Release(p) (p)->Release()
#define IDirectPlayLobby_Connect(p,a,b,c) (p)->Connect(a,b,c)
#define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f) (p)->CreateAddress(a,b,c,d,e,f)
#define IDirectPlayLobby_CreateCompoundAddress(p,a,b,c,d) (p)->lpVtbl->CreateCompoundAddress(a,b,c,d)
#define IDirectPlayLobby_EnumAddress(p,a,b,c,d) (p)->EnumAddress(a,b,c,d)
#define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d) (p)->EnumAddressTypes(a,b,c,d)
#define IDirectPlayLobby_EnumLocalApplications(p,a,b,c) (p)->EnumLocalApplications(a,b,c)
#define IDirectPlayLobby_GetConnectionSettings(p,a,b,c) (p)->GetConnectionSettings(a,b,c)
#define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e) (p)->ReceiveLobbyMessage(a,b,c,d,e)
#define IDirectPlayLobby_RunApplication(p,a,b,c,d) (p)->RunApplication(a,b,c,d)
#define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d) (p)->SendLobbyMessage(a,b,c,d)
#define IDirectPlayLobby_SetConnectionSettings(p,a,b,c) (p)->SetConnectionSettings(a,b,c)
#define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c) (p)->SetLobbyMessageEvent(a,b,c)
#endif
/****************************************************************************
*
* DirectPlayLobby Flags
*
****************************************************************************/
/*
* This is a message flag used by ReceiveLobbyMessage. It can be
* returned in the dwMessageFlags parameter to indicate a message from
* the system.
*/
#define DPLMSG_SYSTEM 0x00000001
/*
* This is a message flag used by ReceiveLobbyMessage and SendLobbyMessage.
* It is used to indicate that the message is a standard lobby message.
* DPLMSG_SETPROPERTY, DPLMSG_SETPROPERTYRESPONSE, DPLMSG_GETPROPERTY,
* DPLMSG_GETPROPERTYRESPONSE
*/
#define DPLMSG_STANDARD 0x00000002
/****************************************************************************
*
* DirectPlayLobby messages and message data structures
*
* All system messages have a dwMessageFlags value of DPLMSG_SYSTEM returned
* from a call to ReceiveLobbyMessage.
*
* All standard messages have a dwMessageFlags value of DPLMSG_STANDARD returned
* from a call to ReceiveLobbyMessage.
*
****************************************************************************/
/*
* DPLMSG_GENERIC
* Generic message structure used to identify the message type.
*/
typedef struct _DPLMSG_GENERIC
{
DWORD dwType; // Message type
} DPLMSG_GENERIC, FAR *LPDPLMSG_GENERIC;
/*
* DPLMSG_SETPROPERTY
* Standard message sent by an application to a lobby to set a
* property
*/
typedef struct _DPLMSG_SETPROPERTY
{
DWORD dwType; // Message type
DWORD dwRequestID; // Request ID (DPL_NOCONFIRMATION if no confirmation desired)
GUID guidPlayer; // Player GUID
GUID guidPropertyTag; // Property GUID
DWORD dwDataSize; // Size of data
DWORD dwPropertyData[1]; // Buffer containing data
} DPLMSG_SETPROPERTY, FAR *LPDPLMSG_SETPROPERTY;
#define DPL_NOCONFIRMATION 0
/*
* DPLMSG_SETPROPERTYRESPONSE
* Standard message returned by a lobby to confirm a
* DPLMSG_SETPROPERTY message.
*/
typedef struct _DPLMSG_SETPROPERTYRESPONSE
{
DWORD dwType; // Message type
DWORD dwRequestID; // Request ID
GUID guidPlayer; // Player GUID
GUID guidPropertyTag; // Property GUID
HRESULT hr; // Return Code
} DPLMSG_SETPROPERTYRESPONSE, FAR *LPDPLMSG_SETPROPERTYRESPONSE;
/*
* DPLMSG_GETPROPERTY
* Standard message sent by an application to a lobby to request
* the current value of a property
*/
typedef struct _DPLMSG_GETPROPERTY
{
DWORD dwType; // Message type
DWORD dwRequestID; // Request ID
GUID guidPlayer; // Player GUID
GUID guidPropertyTag; // Property GUID
} DPLMSG_GETPROPERTY, FAR *LPDPLMSG_GETPROPERTY;
/*
* DPLMSG_GETPROPERTYRESPONSE
* Standard message returned by a lobby in response to a
* DPLMSG_GETPROPERTY message.
*/
typedef struct _DPLMSG_GETPROPERTYRESPONSE
{
DWORD dwType; // Message type
DWORD dwRequestID; // Request ID
GUID guidPlayer; // Player GUID
GUID guidPropertyTag; // Property GUID
HRESULT hr; // Return Code
DWORD dwDataSize; // Size of data
DWORD dwPropertyData[1]; // Buffer containing data
} DPLMSG_GETPROPERTYRESPONSE, FAR *LPDPLMSG_GETPROPERTYRESPONSE;
/******************************************
*
* DirectPlay Lobby message dwType values
*
*****************************************/
/*
* The application has read the connection settings.
* It is now O.K. for the lobby client to release
* its IDirectPlayLobby interface.
*/
#define DPLSYS_CONNECTIONSETTINGSREAD 0x00000001
/*
* The application's call to DirectPlayConnect failed
*/
#define DPLSYS_DPLAYCONNECTFAILED 0x00000002
/*
* The application has created a DirectPlay session.
*/
#define DPLSYS_DPLAYCONNECTSUCCEEDED 0x00000003
/*
* The application has terminated.
*/
#define DPLSYS_APPTERMINATED 0x00000004
/*
* The message is a DPLMSG_SETPROPERTY message.
*/
#define DPLSYS_SETPROPERTY 0x00000005
/*
* The message is a DPLMSG_SETPROPERTYRESPONSE message.
*/
#define DPLSYS_SETPROPERTYRESPONSE 0x00000006
/*
* The message is a DPLMSG_GETPROPERTY message.
*/
#define DPLSYS_GETPROPERTY 0x00000007
/*
* The message is a DPLMSG_GETPROPERTYRESPONSE message.
*/
#define DPLSYS_GETPROPERTYRESPONSE 0x00000008
/****************************************************************************
*
* DirectPlay defined property GUIDs and associated data structures
*
****************************************************************************/
/*
* DPLPROPERTY_MessagesSupported
*
* Request whether the lobby supports standard. Lobby with respond with either
* TRUE or FALSE or may not respond at all.
*
* Property data is a single BOOL with TRUE or FALSE
*/
// {762CCDA1-D916-11d0-BA39-00C04FD7ED67}
DEFINE_GUID(DPLPROPERTY_MessagesSupported,
0x762ccda1, 0xd916, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67);
/*
* DPLPROPERTY_LobbyGuid
*
* Request the GUID that identifies the lobby software that the application
* is communicating with.
*
* Property data is a single GUID.
*/
// {F56920A0-D218-11d0-BA39-00C04FD7ED67}
DEFINE_GUID(DPLPROPERTY_LobbyGuid,
0xf56920a0, 0xd218, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67);
/*
* DPLPROPERTY_PlayerGuid
*
* Request the GUID that identifies the player on this machine for sending
* property data back to the lobby.
*
* Property data is the DPLDATA_PLAYERDATA structure
*/
// {B4319322-D20D-11d0-BA39-00C04FD7ED67}
DEFINE_GUID(DPLPROPERTY_PlayerGuid,
0xb4319322, 0xd20d, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67);
/*
* DPLDATA_PLAYERGUID
*
* Data structure to hold the GUID of the player and player creation flags
* from the lobby.
*/
typedef struct _DPLDATA_PLAYERGUID
{
GUID guidPlayer;
DWORD dwPlayerFlags;
} DPLDATA_PLAYERGUID, FAR *LPDPLDATA_PLAYERGUID;
/*
* DPLPROPERTY_PlayerScore
*
* Used to send an array of long integers to the lobby indicating the
* score of a player.
*
* Property data is the DPLDATA_PLAYERSCORE structure.
*/
// {48784000-D219-11d0-BA39-00C04FD7ED67}
DEFINE_GUID(DPLPROPERTY_PlayerScore,
0x48784000, 0xd219, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67);
/*
* DPLDATA_PLAYERSCORE
*
* Data structure to hold an array of long integers representing a player score.
* Application must allocate enough memory to hold all the scores.
*/
typedef struct _DPLDATA_PLAYERSCORE
{
DWORD dwScoreCount;
LONG Score[1];
} DPLDATA_PLAYERSCORE, FAR *LPDPLDATA_PLAYERSCORE;
/****************************************************************************
*
* DirectPlay Address ID's
*
****************************************************************************/
/* DirectPlay Address
*
* A DirectPlay address consists of multiple chunks of data, each tagged
* with a GUID signifying the type of data in the chunk. The chunk also
* has a length so that unknown chunk types can be skipped.
*
* The EnumAddress() function is used to parse these address data chunks.
*/
/*
* DPADDRESS
*
* Header for block of address data elements
*/
typedef struct _DPADDRESS
{
GUID guidDataType;
DWORD dwDataSize;
} DPADDRESS;
typedef DPADDRESS FAR *LPDPADDRESS;
/*
* DPAID_TotalSize
*
* Chunk is a DWORD containing size of entire DPADDRESS structure
*/
// {1318F560-912C-11d0-9DAA-00A0C90A43CB}
DEFINE_GUID(DPAID_TotalSize,
0x1318f560, 0x912c, 0x11d0, 0x9d, 0xaa, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb);
/*
* DPAID_ServiceProvider
*
* Chunk is a GUID describing the service provider that created the chunk.
* All addresses must contain this chunk.
*/
// {07D916C0-E0AF-11cf-9C4E-00A0C905425E}
DEFINE_GUID(DPAID_ServiceProvider,
0x7d916c0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
/*
* DPAID_LobbyProvider
*
* Chunk is a GUID describing the lobby provider that created the chunk.
* All addresses must contain this chunk.
*/
// {59B95640-9667-11d0-A77D-0000F803ABFC}
DEFINE_GUID(DPAID_LobbyProvider,
0x59b95640, 0x9667, 0x11d0, 0xa7, 0x7d, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc);
/*
* DPAID_Phone and DPAID_PhoneW
*
* Chunk is a string containing a phone number (i.e. "1-800-555-1212")
* in ANSI or UNICODE format
*/
// {78EC89A0-E0AF-11cf-9C4E-00A0C905425E}
DEFINE_GUID(DPAID_Phone,
0x78ec89a0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
// {BA5A7A70-9DBF-11d0-9CC1-00A0C905425E}
DEFINE_GUID(DPAID_PhoneW,
0xba5a7a70, 0x9dbf, 0x11d0, 0x9c, 0xc1, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
/*
* DPAID_Modem and DPAID_ModemW
*
* Chunk is a string containing a modem name registered with TAPI
* in ANSI or UNICODE format
*/
// {F6DCC200-A2FE-11d0-9C4F-00A0C905425E}
DEFINE_GUID(DPAID_Modem,
0xf6dcc200, 0xa2fe, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
// {01FD92E0-A2FF-11d0-9C4F-00A0C905425E}
DEFINE_GUID(DPAID_ModemW,
0x1fd92e0, 0xa2ff, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
/*
* DPAID_Inet and DPAID_InetW
*
* Chunk is a string containing a TCP/IP host name or an IP address
* (i.e. "dplay.microsoft.com" or "137.55.100.173") in ANSI or UNICODE format
*/
// {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E}
DEFINE_GUID(DPAID_INet,
0xc4a54da0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
// {E63232A0-9DBF-11d0-9CC1-00A0C905425E}
DEFINE_GUID(DPAID_INetW,
0xe63232a0, 0x9dbf, 0x11d0, 0x9c, 0xc1, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
/*
* DPCOMPORTADDRESS
*
* Used to specify com port settings. The constants that define baud rate,
* stop bits and parity are defined in WINBASE.H. The constants for flow
* control are given below.
*/
#define DPCPA_NOFLOW 0 // no flow control
#define DPCPA_XONXOFFFLOW 1 // software flow control
#define DPCPA_RTSFLOW 2 // hardware flow control with RTS
#define DPCPA_DTRFLOW 3 // hardware flow control with DTR
#define DPCPA_RTSDTRFLOW 4 // hardware flow control with RTS and DTR
typedef struct _DPCOMPORTADDRESS
{
DWORD dwComPort; // COM port to use (1-4)
DWORD dwBaudRate; // baud rate (100-256k)
DWORD dwStopBits; // no. stop bits (1-2)
DWORD dwParity; // parity (none, odd, even, mark)
DWORD dwFlowControl; // flow control (none, xon/xoff, rts, dtr)
} DPCOMPORTADDRESS;
typedef DPCOMPORTADDRESS FAR *LPDPCOMPORTADDRESS;
/*
* DPAID_ComPort
*
* Chunk contains a DPCOMPORTADDRESS structure defining the serial port.
*/
// {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E}
DEFINE_GUID(DPAID_ComPort,
0xf2f0ce00, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
/****************************************************************************
*
* dplobby 1.0 obsolete definitions
* Included for compatibility only.
*
****************************************************************************/
#define DPLAD_SYSTEM DPLMSG_SYSTEM
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif /* __DPLOBBY_INCLUDED__ */
+267
View File
@@ -0,0 +1,267 @@
/*==========================================================================
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* File: dsetup.h
* Content: DirectXSetup, error codes and flags
***************************************************************************/
#ifndef __DSETUP_H__
#define __DSETUP_H__
#include <windows.h> // windows stuff
#ifdef _WIN32
#define COM_NO_WINDOWS_H
#include <objbase.h>
#else
#endif
#ifdef __cplusplus
extern "C" {
#endif
// DSETUP Error Codes, must remain compatible with previous setup.
#define DSETUPERR_SUCCESS_RESTART 1
#define DSETUPERR_SUCCESS 0
#define DSETUPERR_BADWINDOWSVERSION -1
#define DSETUPERR_SOURCEFILENOTFOUND -2
#define DSETUPERR_BADSOURCESIZE -3
#define DSETUPERR_BADSOURCETIME -4
#define DSETUPERR_NOCOPY -5
#define DSETUPERR_OUTOFDISKSPACE -6
#define DSETUPERR_CANTFINDINF -7
#define DSETUPERR_CANTFINDDIR -8
#define DSETUPERR_INTERNAL -9
#define DSETUPERR_NTWITHNO3D -10 /* REM: obsolete, you'll never see this */
#define DSETUPERR_UNKNOWNOS -11
#define DSETUPERR_USERHITCANCEL -12
#define DSETUPERR_NOTPREINSTALLEDONNT -13
// DSETUP flags. DirectX 5.0 apps should use these flags only.
#define DSETUP_DDRAWDRV 0x00000008 /* install DirectDraw Drivers */
#define DSETUP_DSOUNDDRV 0x00000010 /* install DirectSound Drivers */
#define DSETUP_DXCORE 0x00010000 /* install DirectX runtime */
#define DSETUP_DIRECTX (DSETUP_DXCORE|DSETUP_DDRAWDRV|DSETUP_DSOUNDDRV)
#define DSETUP_TESTINSTALL 0x00020000 /* just test install, don't do anything */
// These OBSOLETE flags are here for compatibility with pre-DX5 apps only.
// They are present to allow DX3 apps to be recompiled with DX5 and still work.
// DO NOT USE THEM for DX5. They will go away in future DX releases.
#define DSETUP_DDRAW 0x00000001 /* OBSOLETE. install DirectDraw */
#define DSETUP_DSOUND 0x00000002 /* OBSOLETE. install DirectSound */
#define DSETUP_DPLAY 0x00000004 /* OBSOLETE. install DirectPlay */
#define DSETUP_DPLAYSP 0x00000020 /* OBSOLETE. install DirectPlay Providers */
#define DSETUP_DVIDEO 0x00000040 /* OBSOLETE. install DirectVideo */
#define DSETUP_D3D 0x00000200 /* OBSOLETE. install Direct3D */
#define DSETUP_DINPUT 0x00000800 /* OBSOLETE. install DirectInput */
#define DSETUP_DIRECTXSETUP 0x00001000 /* OBSOLETE. install DirectXSetup DLL's */
#define DSETUP_NOUI 0x00002000 /* OBSOLETE. install DirectX with NO UI */
#define DSETUP_PROMPTFORDRIVERS 0x10000000 /* OBSOLETE. prompt when replacing display/audio drivers */
#define DSETUP_RESTOREDRIVERS 0x20000000 /* OBSOLETE. restore display/audio drivers */
//******************************************************************
// DirectX Setup Callback mechanism
//******************************************************************
// DSETUP Message Info Codes, passed to callback as Reason parameter.
#define DSETUP_CB_MSG_NOMESSAGE 0
#define DSETUP_CB_MSG_CANTINSTALL_UNKNOWNOS 1
#define DSETUP_CB_MSG_CANTINSTALL_NT 2
#define DSETUP_CB_MSG_CANTINSTALL_BETA 3
#define DSETUP_CB_MSG_CANTINSTALL_NOTWIN32 4
#define DSETUP_CB_MSG_CANTINSTALL_WRONGLANGUAGE 5
#define DSETUP_CB_MSG_CANTINSTALL_WRONGPLATFORM 6
#define DSETUP_CB_MSG_PREINSTALL_NT 7
#define DSETUP_CB_MSG_NOTPREINSTALLEDONNT 8
#define DSETUP_CB_MSG_SETUP_INIT_FAILED 9
#define DSETUP_CB_MSG_INTERNAL_ERROR 10
#define DSETUP_CB_MSG_CHECK_DRIVER_UPGRADE 11
#define DSETUP_CB_MSG_OUTOFDISKSPACE 12
#define DSETUP_CB_MSG_BEGIN_INSTALL 13
#define DSETUP_CB_MSG_BEGIN_INSTALL_RUNTIME 14
#define DSETUP_CB_MSG_BEGIN_INSTALL_DRIVERS 15
#define DSETUP_CB_MSG_BEGIN_RESTORE_DRIVERS 16
#define DSETUP_CB_MSG_FILECOPYERROR 17
#define DSETUP_CB_UPGRADE_TYPE_MASK 0x000F
#define DSETUP_CB_UPGRADE_KEEP 0x0001
#define DSETUP_CB_UPGRADE_SAFE 0x0002
#define DSETUP_CB_UPGRADE_FORCE 0x0004
#define DSETUP_CB_UPGRADE_UNKNOWN 0x0008
#define DSETUP_CB_UPGRADE_HASWARNINGS 0x0100
#define DSETUP_CB_UPGRADE_CANTBACKUP 0x0200
#define DSETUP_CB_UPGRADE_DEVICE_ACTIVE 0x0800
#define DSETUP_CB_UPGRADE_DEVICE_DISPLAY 0x1000
#define DSETUP_CB_UPGRADE_DEVICE_MEDIA 0x2000
typedef struct _DSETUP_CB_UPGRADEINFO
{
DWORD UpgradeFlags;
} DSETUP_CB_UPGRADEINFO;
typedef struct _DSETUP_CB_FILECOPYERROR
{
DWORD dwError;
} DSETUP_CB_FILECOPYERROR;
#ifdef _WIN32
//
// Data Structures
//
#ifndef UNICODE_ONLY
typedef struct _DIRECTXREGISTERAPPA {
DWORD dwSize;
DWORD dwFlags;
LPSTR lpszApplicationName;
LPGUID lpGUID;
LPSTR lpszFilename;
LPSTR lpszCommandLine;
LPSTR lpszPath;
LPSTR lpszCurrentDirectory;
} DIRECTXREGISTERAPPA, *PDIRECTXREGISTERAPPA, *LPDIRECTXREGISTERAPPA;
#endif //!UNICODE_ONLY
#ifndef ANSI_ONLY
typedef struct _DIRECTXREGISTERAPPW {
DWORD dwSize;
DWORD dwFlags;
LPWSTR lpszApplicationName;
LPGUID lpGUID;
LPWSTR lpszFilename;
LPWSTR lpszCommandLine;
LPWSTR lpszPath;
LPWSTR lpszCurrentDirectory;
} DIRECTXREGISTERAPPW, *PDIRECTXREGISTERAPPW, *LPDIRECTXREGISTERAPPW;
#endif //!ANSI_ONLY
#ifdef UNICODE
typedef DIRECTXREGISTERAPPW DIRECTXREGISTERAPP;
typedef PDIRECTXREGISTERAPPW PDIRECTXREGISTERAPP;
typedef LPDIRECTXREGISTERAPPW LPDIRECTXREGISTERAPP;
#else
typedef DIRECTXREGISTERAPPA DIRECTXREGISTERAPP;
typedef PDIRECTXREGISTERAPPA PDIRECTXREGISTERAPP;
typedef LPDIRECTXREGISTERAPPA LPDIRECTXREGISTERAPP;
#endif // UNICODE
//
// API
//
#ifndef UNICODE_ONLY
INT
WINAPI
DirectXSetupA(
HWND hWnd,
LPSTR lpszRootPath,
DWORD dwFlags
);
#endif //!UNICODE_ONLY
#ifndef ANSI_ONLY
INT
WINAPI
DirectXSetupW(
HWND hWnd,
LPWSTR lpszRootPath,
DWORD dwFlags
);
#endif //!ANSI_ONLY
#ifdef UNICODE
#define DirectXSetup DirectXSetupW
#else
#define DirectXSetup DirectXSetupA
#endif // !UNICODE
#ifndef UNICODE_ONLY
INT
WINAPI
DirectXDeviceDriverSetupA(
HWND hWnd,
LPSTR lpszDriverClass,
LPSTR lpszDriverPath,
DWORD dwFlags
);
#endif //!UNICODE_ONLY
#ifndef ANSI_ONLY
INT
WINAPI
DirectXDeviceDriverSetupW(
HWND hWnd,
LPWSTR lpszDriverClass,
LPWSTR lpszDriverPath,
DWORD dwFlags
);
#endif //!ANSI_ONLY
#ifdef UNICODE
#define DirectXDeviceDriverSetup DirectXDeviceDriverSetupW
#else
#define DirectXDeviceDriverSetup DirectXDeviceDriverSetupA
#endif // !UNICODE
#ifndef UNICODE_ONLY
INT
WINAPI
DirectXRegisterApplicationA(
HWND hWnd,
LPDIRECTXREGISTERAPPA lpDXRegApp
);
#endif //!UNICODE_ONLY
#ifndef ANSI_ONLY
INT
WINAPI
DirectXRegisterApplicationW(
HWND hWnd,
LPDIRECTXREGISTERAPPW lpDXRegApp
);
#endif //!ANSI_ONLY
#ifdef UNICODE
#define DirectXRegisterApplication DirectXRegisterApplicationW
#else
#define DirectXRegisterApplication DirectXRegisterApplicationA
#endif // !UNICODE
INT
WINAPI
DirectXUnRegisterApplication(
HWND hWnd,
LPGUID lpGUID
);
//
// Function Pointers
//
#ifdef UNICODE
typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPWSTR, DWORD);
typedef INT (WINAPI * LPDIRECTXDEVICEDRIVERSETUP)(HWND, LPWSTR, LPSTR, DWORD);
typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPDIRECTXREGISTERAPPW);
#else
typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPSTR, DWORD);
typedef INT (WINAPI * LPDIRECTXDEVICEDRIVERSETUP)(HWND, LPSTR, LPSTR, DWORD);
typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPDIRECTXREGISTERAPPA);
#endif // UNICODE
typedef DWORD (FAR PASCAL * DSETUP_CALLBACK)(DWORD Reason,
DWORD MsgType, /* Same as flags to MessageBox */
LPSTR szMessage,
LPSTR szName,
void *pInfo);
INT WINAPI DirectXSetupSetCallback(DSETUP_CALLBACK Callback);
INT WINAPI DirectXSetupGetVersion(DWORD *lpdwVersion, DWORD *lpdwMinorVersion);
#endif // WIN32
#ifdef __cplusplus
};
#endif
#endif
+863
View File
@@ -0,0 +1,863 @@
/*==========================================================================;
*
* Copyright (C) 1995,1996 Microsoft Corporation. All Rights Reserved.
*
* File: dsound.h
* Content: DirectSound include file
*
**************************************************************************/
#ifndef __DSOUND_INCLUDED__
#define __DSOUND_INCLUDED__
#include "directx/vd3dtypes.h"
#define COM_NO_WINDOWS_H
#include <objbase.h>
#define _FACDS 0x878
#define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code)
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000}
DEFINE_GUID(CLSID_DirectSound, 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
// DirectSound Capture Component GUID {B0210780-89CD-11d0-AF08-00A0C925CD16}
DEFINE_GUID(CLSID_DirectSoundCapture, 0xb0210780, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);
//
// Structures
//
#ifdef __cplusplus
// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined
struct IDirectSound;
struct IDirectSoundBuffer;
struct IDirectSound3DListener;
struct IDirectSound3DBuffer;
struct IDirectSoundCapture;
struct IDirectSoundCaptureBuffer;
struct IDirectSoundNotify;
#endif // __cplusplus
typedef struct IDirectSound *LPDIRECTSOUND;
typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER;
typedef struct IDirectSound3DListener *LPDIRECTSOUND3DLISTENER;
typedef struct IDirectSound3DBuffer *LPDIRECTSOUND3DBUFFER;
typedef struct IDirectSoundCapture *LPDIRECTSOUNDCAPTURE;
typedef struct IDirectSoundCaptureBuffer *LPDIRECTSOUNDCAPTUREBUFFER;
typedef struct IDirectSoundNotify *LPDIRECTSOUNDNOTIFY;
typedef struct _DSCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwMinSecondarySampleRate;
DWORD dwMaxSecondarySampleRate;
DWORD dwPrimaryBuffers;
DWORD dwMaxHwMixingAllBuffers;
DWORD dwMaxHwMixingStaticBuffers;
DWORD dwMaxHwMixingStreamingBuffers;
DWORD dwFreeHwMixingAllBuffers;
DWORD dwFreeHwMixingStaticBuffers;
DWORD dwFreeHwMixingStreamingBuffers;
DWORD dwMaxHw3DAllBuffers;
DWORD dwMaxHw3DStaticBuffers;
DWORD dwMaxHw3DStreamingBuffers;
DWORD dwFreeHw3DAllBuffers;
DWORD dwFreeHw3DStaticBuffers;
DWORD dwFreeHw3DStreamingBuffers;
DWORD dwTotalHwMemBytes;
DWORD dwFreeHwMemBytes;
DWORD dwMaxContigFreeHwMemBytes;
DWORD dwUnlockTransferRateHwBuffers;
DWORD dwPlayCpuOverheadSwBuffers;
DWORD dwReserved1;
DWORD dwReserved2;
} DSCAPS, *LPDSCAPS;
typedef const DSCAPS *LPCDSCAPS;
typedef struct _DSBCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwUnlockTransferRate;
DWORD dwPlayCpuOverhead;
} DSBCAPS, *LPDSBCAPS;
typedef const DSBCAPS *LPCDSBCAPS;
typedef struct _DSBUFFERDESC
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwReserved;
LPWAVEFORMATEX lpwfxFormat;
} DSBUFFERDESC, *LPDSBUFFERDESC;
typedef const DSBUFFERDESC *LPCDSBUFFERDESC;
typedef struct _DS3DBUFFER
{
DWORD dwSize;
D3DVECTOR vPosition;
D3DVECTOR vVelocity;
DWORD dwInsideConeAngle;
DWORD dwOutsideConeAngle;
D3DVECTOR vConeOrientation;
LONG lConeOutsideVolume;
D3DVALUE flMinDistance;
D3DVALUE flMaxDistance;
DWORD dwMode;
} DS3DBUFFER, *LPDS3DBUFFER;
typedef const DS3DBUFFER *LPCDS3DBUFFER;
typedef struct _DS3DLISTENER
{
DWORD dwSize;
D3DVECTOR vPosition;
D3DVECTOR vVelocity;
D3DVECTOR vOrientFront;
D3DVECTOR vOrientTop;
D3DVALUE flDistanceFactor;
D3DVALUE flRolloffFactor;
D3DVALUE flDopplerFactor;
} DS3DLISTENER, *LPDS3DLISTENER;
typedef const DS3DLISTENER *LPCDS3DLISTENER;
typedef struct _DSCCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwFormats;
DWORD dwChannels;
} DSCCAPS, *LPDSCCAPS;
typedef const DSCCAPS *LPCDSCCAPS;
typedef struct _DSCBUFFERDESC
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwReserved;
LPWAVEFORMATEX lpwfxFormat;
} DSCBUFFERDESC, *LPDSCBUFFERDESC;
typedef const DSCBUFFERDESC *LPCDSCBUFFERDESC;
typedef struct _DSCBCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwReserved;
} DSCBCAPS, *LPDSCBCAPS;
typedef const DSCBCAPS *LPCDSCBCAPS;
typedef struct _DSBPOSITIONNOTIFY
{
DWORD dwOffset;
HANDLE hEventNotify;
} DSBPOSITIONNOTIFY, *LPDSBPOSITIONNOTIFY;
typedef const DSBPOSITIONNOTIFY *LPCDSBPOSITIONNOTIFY;
//
// Compatibility typedefs
//
typedef LPDIRECTSOUND *LPLPDIRECTSOUND;
typedef LPDIRECTSOUNDBUFFER *LPLPDIRECTSOUNDBUFFER;
typedef LPDIRECTSOUND3DLISTENER *LPLPDIRECTSOUND3DLISTENER;
typedef LPDIRECTSOUND3DBUFFER *LPLPDIRECTSOUND3DBUFFER;
typedef LPDIRECTSOUNDCAPTURE *LPLPDIRECTSOUNDCAPTURE;
typedef LPDIRECTSOUNDCAPTUREBUFFER *LPLPDIRECTSOUNDCAPTUREBUFFER;
typedef LPDIRECTSOUNDNOTIFY *LPLPDIRECTSOUNDNOTIFY;
typedef LPVOID *LPLPVOID;
typedef const WAVEFORMATEX *LPCWAVEFORMATEX;
//
// DirectSound API
//
typedef BOOL (CALLBACK *LPDSENUMCALLBACKW)(LPGUID, LPCWSTR, LPCWSTR, LPVOID);
typedef BOOL (CALLBACK *LPDSENUMCALLBACKA)(LPGUID, LPCSTR, LPCSTR, LPVOID);
extern HRESULT WINAPI DirectSoundCreate(LPGUID, LPDIRECTSOUND *, LPUNKNOWN);
extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW, LPVOID);
extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA, LPVOID);
extern HRESULT WINAPI DirectSoundCaptureCreate(LPGUID, LPDIRECTSOUNDCAPTURE *, LPUNKNOWN);
extern HRESULT WINAPI DirectSoundCaptureEnumerateW(LPDSENUMCALLBACKW, LPVOID);
extern HRESULT WINAPI DirectSoundCaptureEnumerateA(LPDSENUMCALLBACKA, LPVOID);
#ifdef UNICODE
#define LPDSENUMCALLBACK LPDSENUMCALLBACKW
#define DirectSoundEnumerate DirectSoundEnumerateW
#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateW
#else // UNICODE
#define LPDSENUMCALLBACK LPDSENUMCALLBACKA
#define DirectSoundEnumerate DirectSoundEnumerateA
#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateA
#endif // UNICODE
//
// IDirectSound
//
DEFINE_GUID(IID_IDirectSound, 0x279AFA83, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60);
#undef INTERFACE
#define INTERFACE IDirectSound
DECLARE_INTERFACE_(IDirectSound, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSound methods
STDMETHOD(CreateSoundBuffer) (THIS_ LPCDSBUFFERDESC, LPDIRECTSOUNDBUFFER *, LPUNKNOWN) PURE;
STDMETHOD(GetCaps) (THIS_ LPDSCAPS) PURE;
STDMETHOD(DuplicateSoundBuffer) (THIS_ LPDIRECTSOUNDBUFFER, LPDIRECTSOUNDBUFFER *) PURE;
STDMETHOD(SetCooperativeLevel) (THIS_ HWND, DWORD) PURE;
STDMETHOD(Compact) (THIS) PURE;
STDMETHOD(GetSpeakerConfig) (THIS_ LPDWORD) PURE;
STDMETHOD(SetSpeakerConfig) (THIS_ DWORD) PURE;
STDMETHOD(Initialize) (THIS_ LPGUID) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSound_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSound_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c)
#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b)
#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b)
#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p)
#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a)
#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b)
#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSound_AddRef(p) (p)->AddRef()
#define IDirectSound_Release(p) (p)->Release()
#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->CreateSoundBuffer(a,b,c)
#define IDirectSound_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->DuplicateSoundBuffer(a,b)
#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b)
#define IDirectSound_Compact(p) (p)->Compact()
#define IDirectSound_GetSpeakerConfig(p,a) (p)->GetSpeakerConfig(a)
#define IDirectSound_SetSpeakerConfig(p,b) (p)->SetSpeakerConfig(b)
#define IDirectSound_Initialize(p,a) (p)->Initialize(a)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSoundBuffer
//
DEFINE_GUID(IID_IDirectSoundBuffer, 0x279AFA85, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60);
#undef INTERFACE
#define INTERFACE IDirectSoundBuffer
DECLARE_INTERFACE_(IDirectSoundBuffer, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundBuffer methods
STDMETHOD(GetCaps) (THIS_ LPDSBCAPS) PURE;
STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD, LPDWORD) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX, DWORD, LPDWORD) PURE;
STDMETHOD(GetVolume) (THIS_ LPLONG) PURE;
STDMETHOD(GetPan) (THIS_ LPLONG) PURE;
STDMETHOD(GetFrequency) (THIS_ LPDWORD) PURE;
STDMETHOD(GetStatus) (THIS_ LPDWORD) PURE;
STDMETHOD(Initialize) (THIS_ LPDIRECTSOUND, LPCDSBUFFERDESC) PURE;
STDMETHOD(Lock) (THIS_ DWORD, DWORD, LPVOID *, LPDWORD, LPVOID *, LPDWORD, DWORD) PURE;
STDMETHOD(Play) (THIS_ DWORD, DWORD, DWORD) PURE;
STDMETHOD(SetCurrentPosition) (THIS_ DWORD) PURE;
STDMETHOD(SetFormat) (THIS_ LPCWAVEFORMATEX) PURE;
STDMETHOD(SetVolume) (THIS_ LONG) PURE;
STDMETHOD(SetPan) (THIS_ LONG) PURE;
STDMETHOD(SetFrequency) (THIS_ DWORD) PURE;
STDMETHOD(Stop) (THIS) PURE;
STDMETHOD(Unlock) (THIS_ LPVOID, DWORD, LPVOID, DWORD) PURE;
STDMETHOD(Restore) (THIS) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundBuffer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b)
#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c)
#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a)
#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a)
#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a)
#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a)
#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b)
#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c)
#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a)
#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a)
#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a)
#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a)
#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a)
#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p)
#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d)
#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSoundBuffer_AddRef(p) (p)->AddRef()
#define IDirectSoundBuffer_Release(p) (p)->Release()
#define IDirectSoundBuffer_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b)
#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c)
#define IDirectSoundBuffer_GetVolume(p,a) (p)->GetVolume(a)
#define IDirectSoundBuffer_GetPan(p,a) (p)->GetPan(a)
#define IDirectSoundBuffer_GetFrequency(p,a) (p)->GetFrequency(a)
#define IDirectSoundBuffer_GetStatus(p,a) (p)->GetStatus(a)
#define IDirectSoundBuffer_Initialize(p,a,b) (p)->Initialize(a,b)
#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g)
#define IDirectSoundBuffer_Play(p,a,b,c) (p)->Play(a,b,c)
#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->SetCurrentPosition(a)
#define IDirectSoundBuffer_SetFormat(p,a) (p)->SetFormat(a)
#define IDirectSoundBuffer_SetVolume(p,a) (p)->SetVolume(a)
#define IDirectSoundBuffer_SetPan(p,a) (p)->SetPan(a)
#define IDirectSoundBuffer_SetFrequency(p,a) (p)->SetFrequency(a)
#define IDirectSoundBuffer_Stop(p) (p)->Stop()
#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d)
#define IDirectSoundBuffer_Restore(p) (p)->Restore()
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSound3DListener
//
DEFINE_GUID(IID_IDirectSound3DListener, 0x279AFA84, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60);
#undef INTERFACE
#define INTERFACE IDirectSound3DListener
DECLARE_INTERFACE_(IDirectSound3DListener, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSound3D methods
STDMETHOD(GetAllParameters) (THIS_ LPDS3DLISTENER) PURE;
STDMETHOD(GetDistanceFactor) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetDopplerFactor) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetOrientation) (THIS_ LPD3DVECTOR, LPD3DVECTOR) PURE;
STDMETHOD(GetPosition) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(GetRolloffFactor) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetVelocity) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(SetAllParameters) (THIS_ LPCDS3DLISTENER, DWORD) PURE;
STDMETHOD(SetDistanceFactor) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetDopplerFactor) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetOrientation) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(SetPosition) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(SetRolloffFactor) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetVelocity) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(CommitDeferredSettings) (THIS) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound3DListener_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSound3DListener_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSound3DListener_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSound3DListener_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->lpVtbl->GetDistanceFactor(p,a)
#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->lpVtbl->GetDopplerFactor(p,a)
#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->lpVtbl->GetOrientation(p,a,b)
#define IDirectSound3DListener_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a)
#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->lpVtbl->GetRolloffFactor(p,a)
#define IDirectSound3DListener_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a)
#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b)
#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->lpVtbl->SetDistanceFactor(p,a,b)
#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->lpVtbl->SetDopplerFactor(p,a,b)
#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g)
#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d)
#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->lpVtbl->SetRolloffFactor(p,a,b)
#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d)
#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->lpVtbl->CommitDeferredSettings(p)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound3DListener_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSound3DListener_AddRef(p) (p)->AddRef()
#define IDirectSound3DListener_Release(p) (p)->Release()
#define IDirectSound3DListener_GetAllParameters(p,a) (p)->GetAllParameters(a)
#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->GetDistanceFactor(a)
#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->GetDopplerFactor(a)
#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->GetOrientation(a,b)
#define IDirectSound3DListener_GetPosition(p,a) (p)->GetPosition(a)
#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->GetRolloffFactor(a)
#define IDirectSound3DListener_GetVelocity(p,a) (p)->GetVelocity(a)
#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b)
#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->SetDistanceFactor(a,b)
#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->SetDopplerFactor(a,b)
#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->SetOrientation(a,b,c,d,e,f,g)
#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d)
#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->SetRolloffFactor(a,b)
#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d)
#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->CommitDeferredSettings()
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSound3DBuffer
//
DEFINE_GUID(IID_IDirectSound3DBuffer, 0x279AFA86, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60);
#undef INTERFACE
#define INTERFACE IDirectSound3DBuffer
DECLARE_INTERFACE_(IDirectSound3DBuffer, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundBuffer3D methods
STDMETHOD(GetAllParameters) (THIS_ LPDS3DBUFFER) PURE;
STDMETHOD(GetConeAngles) (THIS_ LPDWORD, LPDWORD) PURE;
STDMETHOD(GetConeOrientation) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(GetConeOutsideVolume) (THIS_ LPLONG) PURE;
STDMETHOD(GetMaxDistance) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetMinDistance) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetMode) (THIS_ LPDWORD) PURE;
STDMETHOD(GetPosition) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(GetVelocity) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(SetAllParameters) (THIS_ LPCDS3DBUFFER, DWORD) PURE;
STDMETHOD(SetConeAngles) (THIS_ DWORD, DWORD, DWORD) PURE;
STDMETHOD(SetConeOrientation) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(SetConeOutsideVolume) (THIS_ LONG, DWORD) PURE;
STDMETHOD(SetMaxDistance) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetMinDistance) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetMode) (THIS_ DWORD, DWORD) PURE;
STDMETHOD(SetPosition) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(SetVelocity) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound3DBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSound3DBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSound3DBuffer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->lpVtbl->GetConeAngles(p,a,b)
#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->lpVtbl->GetConeOrientation(p,a)
#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->lpVtbl->GetConeOutsideVolume(p,a)
#define IDirectSound3DBuffer_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a)
#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->lpVtbl->GetMinDistance(p,a)
#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->lpVtbl->GetMaxDistance(p,a)
#define IDirectSound3DBuffer_GetMode(p,a) (p)->lpVtbl->GetMode(p,a)
#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a)
#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b)
#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->lpVtbl->SetConeAngles(p,a,b,c)
#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->lpVtbl->SetConeOrientation(p,a,b,c,d)
#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->lpVtbl->SetConeOutsideVolume(p,a,b)
#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d)
#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->lpVtbl->SetMinDistance(p,a,b)
#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->lpVtbl->SetMaxDistance(p,a,b)
#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->lpVtbl->SetMode(p,a,b)
#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound3DBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSound3DBuffer_AddRef(p) (p)->AddRef()
#define IDirectSound3DBuffer_Release(p) (p)->Release()
#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->GetAllParameters(a)
#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->GetConeAngles(a,b)
#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->GetConeOrientation(a)
#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->GetConeOutsideVolume(a)
#define IDirectSound3DBuffer_GetPosition(p,a) (p)->GetPosition(a)
#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->GetMinDistance(a)
#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->GetMaxDistance(a)
#define IDirectSound3DBuffer_GetMode(p,a) (p)->GetMode(a)
#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->GetVelocity(a)
#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b)
#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->SetConeAngles(a,b,c)
#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->SetConeOrientation(a,b,c,d)
#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->SetConeOutsideVolume(a,b)
#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d)
#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->SetMinDistance(a,b)
#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->SetMaxDistance(a,b)
#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->SetMode(a,b)
#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSoundCapture
//
DEFINE_GUID(IID_IDirectSoundCapture, 0xb0210781, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);
#undef INTERFACE
#define INTERFACE IDirectSoundCapture
DECLARE_INTERFACE_(IDirectSoundCapture, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundCapture methods
STDMETHOD(CreateCaptureBuffer) (THIS_ LPCDSCBUFFERDESC, LPDIRECTSOUNDCAPTUREBUFFER *, LPUNKNOWN) PURE;
STDMETHOD(GetCaps) (THIS_ LPDSCCAPS ) PURE;
STDMETHOD(Initialize) (THIS_ LPGUID) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundCapture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundCapture_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundCapture_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->lpVtbl->CreateCaptureBuffer(p,a,b,c)
#define IDirectSoundCapture_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSoundCapture_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundCapture_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSoundCapture_AddRef(p) (p)->AddRef()
#define IDirectSoundCapture_Release(p) (p)->Release()
#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->CreateCaptureBuffer(a,b,c)
#define IDirectSoundCapture_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectSoundCapture_Initialize(p,a) (p)->Initialize(a)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSoundCaptureBuffer
//
DEFINE_GUID(IID_IDirectSoundCaptureBuffer, 0xb0210782, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);
#undef INTERFACE
#define INTERFACE IDirectSoundCaptureBuffer
DECLARE_INTERFACE_(IDirectSoundCaptureBuffer, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundCaptureBuffer methods
STDMETHOD(GetCaps) (THIS_ LPDSCBCAPS ) PURE;
STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD, LPDWORD ) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE;
STDMETHOD(GetStatus) (THIS_ LPDWORD ) PURE;
STDMETHOD(Initialize) (THIS_ LPDIRECTSOUNDCAPTURE, LPCDSCBUFFERDESC) PURE;
STDMETHOD(Lock) (THIS_ DWORD, DWORD, LPVOID *, LPDWORD, LPVOID *, LPDWORD, DWORD) PURE;
STDMETHOD(Start) (THIS_ DWORD) PURE;
STDMETHOD(Stop) (THIS) PURE;
STDMETHOD(Unlock) (THIS_ LPVOID, DWORD, LPVOID, DWORD) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundCaptureBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundCaptureBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundCaptureBuffer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b)
#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c)
#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a)
#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b)
#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
#define IDirectSoundCaptureBuffer_Start(p,a) (p)->lpVtbl->Start(p,a)
#define IDirectSoundCaptureBuffer_Stop(p) (p)->lpVtbl->Stop(p)
#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundCaptureBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSoundCaptureBuffer_AddRef(p) (p)->AddRef()
#define IDirectSoundCaptureBuffer_Release(p) (p)->Release()
#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b)
#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c)
#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->GetStatus(a)
#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->Initialize(a,b)
#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g)
#define IDirectSoundCaptureBuffer_Start(p,a) (p)->Start(a)
#define IDirectSoundCaptureBuffer_Stop(p) (p)->Stop()
#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSoundNotify
//
DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);
#undef INTERFACE
#define INTERFACE IDirectSoundNotify
DECLARE_INTERFACE_(IDirectSoundNotify, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundNotify methods
STDMETHOD(SetNotificationPositions) (THIS_ DWORD, LPCDSBPOSITIONNOTIFY) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundNotify_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundNotify_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundNotify_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->lpVtbl->SetNotificationPositions(p,a,b)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundNotify_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSoundNotify_AddRef(p) (p)->AddRef()
#define IDirectSoundNotify_Release(p) (p)->Release()
#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->SetNotificationPositions(a,b)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IKsPropertySet
//
#ifndef _IKsPropertySet_
#define _IKsPropertySet_
#ifdef __cplusplus
// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined
struct IKsPropertySet;
#endif // __cplusplus
typedef struct IKsPropertySet *LPKSPROPERTYSET;
#define KSPROPERTY_SUPPORT_GET 0x00000001
#define KSPROPERTY_SUPPORT_SET 0x00000002
DEFINE_GUID(IID_IKsPropertySet, 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93);
#undef INTERFACE
#define INTERFACE IKsPropertySet
DECLARE_INTERFACE_(IKsPropertySet, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IKsPropertySet methods
STDMETHOD(Get) (THIS_ REFGUID, ULONG, LPVOID, ULONG, LPVOID, ULONG, PULONG) PURE;
STDMETHOD(Set) (THIS_ REFGUID, ULONG, LPVOID, ULONG, LPVOID, ULONG) PURE;
STDMETHOD(QuerySupport) (THIS_ REFGUID, ULONG, PULONG) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IKsPropertySet_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IKsPropertySet_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IKsPropertySet_Release(p) (p)->lpVtbl->Release(p)
#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->lpVtbl->Get(p,a,b,c,d,e,f,g)
#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->lpVtbl->Set(p,a,b,c,d,e,f)
#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->lpVtbl->QuerySupport(p,a,b,c)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IKsPropertySet_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IKsPropertySet_AddRef(p) (p)->AddRef()
#define IKsPropertySet_Release(p) (p)->Release()
#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->Get(a,b,c,d,e,f,g)
#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->Set(a,b,c,d,e,f)
#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->QuerySupport(a,b,c)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
#endif // _IKsPropertySet_
//
// Return Codes
//
#define DS_OK 0
// The call failed because resources (such as a priority level)
// were already being used by another caller.
#define DSERR_ALLOCATED MAKE_DSHRESULT(10)
// The control (vol,pan,etc.) requested by the caller is not available.
#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT(30)
// An invalid parameter was passed to the returning function
#define DSERR_INVALIDPARAM E_INVALIDARG
// This call is not valid for the current state of this object
#define DSERR_INVALIDCALL MAKE_DSHRESULT(50)
// An undetermined error occured inside the DirectSound subsystem
#define DSERR_GENERIC E_FAIL
// The caller does not have the priority level required for the function to
// succeed.
#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70)
// Not enough free memory is available to complete the operation
#define DSERR_OUTOFMEMORY E_OUTOFMEMORY
// The specified WAVE format is not supported
#define DSERR_BADFORMAT MAKE_DSHRESULT(100)
// The function called is not supported at this time
#define DSERR_UNSUPPORTED E_NOTIMPL
// No sound driver is available for use
#define DSERR_NODRIVER MAKE_DSHRESULT(120)
// This object is already initialized
#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT(130)
// This object does not support aggregation
#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION
// The buffer memory has been lost, and must be restored.
#define DSERR_BUFFERLOST MAKE_DSHRESULT(150)
// Another app has a higher priority level, preventing this call from
// succeeding.
#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT(160)
// This object has not been initialized
#define DSERR_UNINITIALIZED MAKE_DSHRESULT(170)
// The requested COM interface is not available
#define DSERR_NOINTERFACE E_NOINTERFACE
//
// Flags
//
#define DSCAPS_PRIMARYMONO 0x00000001
#define DSCAPS_PRIMARYSTEREO 0x00000002
#define DSCAPS_PRIMARY8BIT 0x00000004
#define DSCAPS_PRIMARY16BIT 0x00000008
#define DSCAPS_CONTINUOUSRATE 0x00000010
#define DSCAPS_EMULDRIVER 0x00000020
#define DSCAPS_CERTIFIED 0x00000040
#define DSCAPS_SECONDARYMONO 0x00000100
#define DSCAPS_SECONDARYSTEREO 0x00000200
#define DSCAPS_SECONDARY8BIT 0x00000400
#define DSCAPS_SECONDARY16BIT 0x00000800
#define DSBPLAY_LOOPING 0x00000001
#define DSBSTATUS_PLAYING 0x00000001
#define DSBSTATUS_BUFFERLOST 0x00000002
#define DSBSTATUS_LOOPING 0x00000004
#define DSBLOCK_FROMWRITECURSOR 0x00000001
#define DSBLOCK_ENTIREBUFFER 0x00000002
#define DSSCL_NORMAL 0x00000001
#define DSSCL_PRIORITY 0x00000002
#define DSSCL_EXCLUSIVE 0x00000003
#define DSSCL_WRITEPRIMARY 0x00000004
#define DS3DMODE_NORMAL 0x00000000
#define DS3DMODE_HEADRELATIVE 0x00000001
#define DS3DMODE_DISABLE 0x00000002
#define DS3D_IMMEDIATE 0x00000000
#define DS3D_DEFERRED 0x00000001
#define DS3D_MINDISTANCEFACTOR 0.0f
#define DS3D_MAXDISTANCEFACTOR 10.0f
#define DS3D_DEFAULTDISTANCEFACTOR 1.0f
#define DS3D_MINROLLOFFFACTOR 0.0f
#define DS3D_MAXROLLOFFFACTOR 10.0f
#define DS3D_DEFAULTROLLOFFFACTOR 1.0f
#define DS3D_MINDOPPLERFACTOR 0.0f
#define DS3D_MAXDOPPLERFACTOR 10.0f
#define DS3D_DEFAULTDOPPLERFACTOR 1.0f
#define DS3D_DEFAULTMINDISTANCE 1.0f
#define DS3D_DEFAULTMAXDISTANCE 1000000000.0f
#define DS3D_MINCONEANGLE 0
#define DS3D_MAXCONEANGLE 360
#define DS3D_DEFAULTCONEANGLE 360
#define DS3D_DEFAULTCONEOUTSIDEVOLUME 0
#define DSBCAPS_PRIMARYBUFFER 0x00000001
#define DSBCAPS_STATIC 0x00000002
#define DSBCAPS_LOCHARDWARE 0x00000004
#define DSBCAPS_LOCSOFTWARE 0x00000008
#define DSBCAPS_CTRL3D 0x00000010
#define DSBCAPS_CTRLFREQUENCY 0x00000020
#define DSBCAPS_CTRLPAN 0x00000040
#define DSBCAPS_CTRLVOLUME 0x00000080
#define DSBCAPS_CTRLPOSITIONNOTIFY 0x00000100
#define DSBCAPS_CTRLDEFAULT 0x000000E0
#define DSBCAPS_CTRLALL 0x000001F0
#define DSBCAPS_STICKYFOCUS 0x00004000
#define DSBCAPS_GLOBALFOCUS 0x00008000
#define DSBCAPS_GETCURRENTPOSITION2 0x00010000
#define DSBCAPS_MUTE3DATMAXDISTANCE 0x00020000
#define DSCBCAPS_WAVEMAPPED 0x80000000
#define DSSPEAKER_HEADPHONE 0x00000001
#define DSSPEAKER_MONO 0x00000002
#define DSSPEAKER_QUAD 0x00000003
#define DSSPEAKER_STEREO 0x00000004
#define DSSPEAKER_SURROUND 0x00000005
#define DSSPEAKER_GEOMETRY_MIN 0x00000005 // 5 degrees
#define DSSPEAKER_GEOMETRY_NARROW 0x0000000A // 10 degrees
#define DSSPEAKER_GEOMETRY_WIDE 0x00000014 // 20 degrees
#define DSSPEAKER_GEOMETRY_MAX 0x000000B4 // 180 degrees
#define DSSPEAKER_COMBINED(c, g) ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16))
#define DSSPEAKER_CONFIG(a) ((BYTE)(a))
#define DSSPEAKER_GEOMETRY(a) ((BYTE)(((DWORD)(a) >> 16) & 0x00FF))
#define DSCCAPS_EMULDRIVER 0x00000020
#define DSCBLOCK_ENTIREBUFFER 0x00000001
#define DSCBSTATUS_CAPTURING 0x00000001
#define DSCBSTATUS_LOOPING 0x00000002
#define DSCBSTART_LOOPING 0x00000001
#define DSBFREQUENCY_MIN 100
#define DSBFREQUENCY_MAX 100000
#define DSBFREQUENCY_ORIGINAL 0
#define DSBPAN_LEFT -10000
#define DSBPAN_CENTER 0
#define DSBPAN_RIGHT 10000
#define DSBVOLUME_MIN -10000
#define DSBVOLUME_MAX 0
#define DSBSIZE_MIN 4
#define DSBSIZE_MAX 0x0FFFFFFF
#define DSBPN_OFFSETSTOP 0xFFFFFFFF
#ifdef __cplusplus
};
#endif // __cplusplus
#endif // __DSOUND_INCLUDED__
Binary file not shown.
+831
View File
@@ -0,0 +1,831 @@
/*==========================================================================;
*
* Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved.
*
* File: dvp.h
* Content: DirectDrawVideoPort include file
*
***************************************************************************/
#ifndef __DVP_INCLUDED__
#define __DVP_INCLUDED__
#if defined( _WIN32 ) && !defined( _NO_COM )
#define COM_NO_WINDOWS_H
#include <objbase.h>
#else
#define IUnknown void
#undef CO_E_NOTINITIALIZED
#define CO_E_NOTINITIALIZED 0x800401F0L
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* GUIDS used by DirectDrawVideoPort objects
*/
#if defined( _WIN32 ) && !defined( _NO_COM )
DEFINE_GUID( IID_IDDVideoPortContainer, 0x6C142760,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
DEFINE_GUID( IID_IDirectDrawVideoPort, 0xB36D93E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 );
DEFINE_GUID( DDVPTYPE_E_HREFH_VREFH, 0x54F39980L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
DEFINE_GUID( DDVPTYPE_E_HREFH_VREFL, 0x92783220L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
DEFINE_GUID( DDVPTYPE_E_HREFL_VREFH, 0xA07A02E0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
DEFINE_GUID( DDVPTYPE_E_HREFL_VREFL, 0xE09C77E0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
DEFINE_GUID( DDVPTYPE_CCIR656, 0xFCA326A0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
DEFINE_GUID( DDVPTYPE_BROOKTREE, 0x1352A560L,0xDA61,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
DEFINE_GUID( DDVPTYPE_PHILIPS, 0x332CF160L,0xDA61,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
/*
* GUIDS used to describe connections
*/
#endif
/*============================================================================
*
* DirectDraw Structures
*
* Various structures used to invoke DirectDraw.
*
*==========================================================================*/
struct IDirectDraw;
struct IDirectDrawSurface;
struct IDirectDrawPalette;
struct IDirectDrawClipper;
typedef struct IDDVideoPortContainer FAR *LPDDVIDEOPORTCONTAINER;
typedef struct IDirectDrawVideoPort FAR *LPDIRECTDRAWVIDEOPORT;
typedef struct _DDVIDEOPORTCONNECT FAR *LPDDVIDEOPORTCONNECT;
typedef struct _DDVIDEOPORTCAPS FAR *LPDDVIDEOPORTCAPS;
typedef struct _DDVIDEOPORTDESC FAR *LPDDVIDEOPORTDESC;
typedef struct _DDVIDEOPORTINFO FAR *LPDDVIDEOPORTINFO;
typedef struct _DDVIDEOPORTBANDWIDTH FAR *LPDDVIDEOPORTBANDWIDTH;
typedef struct _DDVIDEOPORTSTATUS FAR *LPDDVIDEOPORTSTATUS;
typedef struct IDDVideoPortContainerVtbl DDVIDEOPORTCONTAINERCALLBACKS;
typedef struct IDirectDrawVideoPortVtbl DIRECTDRAWVIDEOPORTCALLBACKS;
/*
* API's
*/
typedef HRESULT (FAR PASCAL * LPDDENUMVIDEOCALLBACK)(LPDDVIDEOPORTCAPS, LPVOID);
/*
* INTERACES FOLLOW:
* IDirectDrawVideoPort
* IVideoPort
*/
/*
* IDirectDrawVideoPortContainer
*/
#if defined( _WIN32 ) && !defined( _NO_COM )
#undef INTERFACE
#define INTERFACE IDDVideoPortContainer
DECLARE_INTERFACE_( IDDVideoPortContainer, IUnknown )
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IDirectDrawVideoPort methods ***/
STDMETHOD(CreateVideoPort)(THIS_ DWORD, LPDDVIDEOPORTDESC, LPDIRECTDRAWVIDEOPORT FAR *, IUnknown FAR *) PURE;
STDMETHOD(EnumVideoPorts)(THIS_ DWORD, LPDDVIDEOPORTCAPS, LPVOID,LPDDENUMVIDEOCALLBACK ) PURE;
STDMETHOD(GetVideoPortConnectInfo)(THIS_ DWORD, LPDWORD, LPDDVIDEOPORTCONNECT ) PURE;
STDMETHOD(QueryVideoPortStatus)(THIS_ DWORD, LPDDVIDEOPORTSTATUS ) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IVideoPortContainer_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IVideoPortContainer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IVideoPortContainer_Release(p) (p)->lpVtbl->Release(p)
#define IVideoPortContainer_CreateVideoPort(p, a, b, c, d) (p)->lpVtbl->CreateVideoPort(p, a, b, c, d)
#define IVideoPortContainer_EnumVideoPorts(p, a, b, c, d) (p)->lpVtbl->EnumVideoPorts(p, a, b, c, d)
#define IVideoPortContainer_GetVideoPortConnectInfo(p, a, b, c) (p)->lpVtbl->GetVideoPortConnectInfo(p, a, b, c)
#define IVideoPortContainer_QueryVideoPortStatus(p, a, b) (p)->lpVtbl->QueryVideoPortStatus(p, a, b)
#else
#define IVideoPortContainer_QueryInterface(p, a, b) (p)->QueryInterface(a, b)
#define IVideoPortContainer_AddRef(p) (p)->AddRef()
#define IVideoPortContainer_Release(p) (p)->Release()
#define IVideoPortContainer_CreateVideoPort(p, a, b, c, d) (p)->CreateVideoPort(a, b, c, d)
#define IVideoPortContainer_EnumVideoPorts(p, a, b, c, d) (p)->EnumVideoPorts(a, b, c, d)
#define IVideoPortContainer_GetVideoPortConnectInfo(p, a, b, c) (p)->GetVideoPortConnectInfo(a, b, c)
#define IVideoPortContainer_QueryVideoPortStatus(p, a, b) (p)->QueryVideoPortStatus(a, b)
#endif
#endif
/*
* IDirectDrawVideoPort
*/
#if defined( _WIN32 ) && !defined( _NO_COM )
#undef INTERFACE
#define INTERFACE IDirectDrawVideoPort
DECLARE_INTERFACE_( IDirectDrawVideoPort, IUnknown )
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IVideoPort methods ***/
STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE;
STDMETHOD(GetBandwidthInfo)(THIS_ LPDDPIXELFORMAT, DWORD, DWORD, DWORD, LPDDVIDEOPORTBANDWIDTH) PURE;
STDMETHOD(GetColorControls)(THIS_ LPDDCOLORCONTROL) PURE;
STDMETHOD(GetInputFormats)(THIS_ LPDWORD, LPDDPIXELFORMAT, DWORD) PURE;
STDMETHOD(GetOutputFormats)(THIS_ LPDDPIXELFORMAT, LPDWORD, LPDDPIXELFORMAT, DWORD) PURE;
STDMETHOD(GetFieldPolarity)(THIS_ LPBOOL) PURE;
STDMETHOD(GetVideoLine)(THIS_ LPDWORD) PURE;
STDMETHOD(GetVideoSignalStatus)(THIS_ LPDWORD) PURE;
STDMETHOD(SetColorControls)(THIS_ LPDDCOLORCONTROL) PURE;
STDMETHOD(SetTargetSurface)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE;
STDMETHOD(StartVideo)(THIS_ LPDDVIDEOPORTINFO) PURE;
STDMETHOD(StopVideo)(THIS) PURE;
STDMETHOD(UpdateVideo)(THIS_ LPDDVIDEOPORTINFO) PURE;
STDMETHOD(WaitForSync)(THIS_ DWORD, DWORD, DWORD) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IVideoPort_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IVideoPort_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IVideoPort_Release(p) (p)->lpVtbl->Release(p)
#define IVideoPort_SetTargetSurface(p,a,b) (p)->lpVtbl->SetTargetSurface(p,a,b)
#define IVideoPort_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b)
#define IVideoPort_GetBandwidthInfo(p,a,b,c,d,e) (p)->lpVtbl->GetBandwidthInfo(p,a,b,c,d,e)
#define IVideoPort_GetColorControls(p,a) (p)->lpVtbl->GetColorControls(p,a)
#define IVideoPort_GetInputFormats(p,a,b,c) (p)->lpVtbl->GetInputFormats(p,a,b,c)
#define IVideoPort_GetOutputFormats(p,a,b,c,d) (p)->lpVtbl->GetOutputFormats(p,a,b,c,d)
#define IVideoPort_GetFieldPolarity(p,a) (p)->lpVtbl->GetFieldPolarity(p,a)
#define IVideoPort_GetVideoLine(p,a) (p)->lpVtbl->GetVideoLine(p,a)
#define IVideoPort_GetVideoSignalStatus(p,a) (p)->lpVtbl->GetVideoSignalStatus(p,a)
#define IVideoPort_SetColorControls(p,a) (p)->lpVtbl->SetColorControls(p,a)
#define IVideoPort_StartVideo(p,a) (p)->lpVtbl->StartVideo(p,a)
#define IVideoPort_StopVideo(p) (p)->lpVtbl->StopVideo(p)
#define IVideoPort_UpdateVideo(p,a) (p)->lpVtbl->UpdateVideo(p,a)
#define IVideoPort_WaitForSync(p,a,b,c) (p)->lpVtbl->WaitForSync(p,a,b,c)
#else
#define IVideoPort_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IVideoPort_AddRef(p) (p)->AddRef()
#define IVideoPort_Release(p) (p)->Release()
#define IVideoPort_SetTargetSurface(p,a,b) (p)->SetTargetSurface(a,b)
#define IVideoPort_Flip(p,a,b) (p)->Flip(a,b)
#define IVideoPort_GetBandwidthInfo(p,a,b,c,d,e) (p)->GetBandwidthInfo(a,b,c,d,e)
#define IVideoPort_GetColorControls(p,a) (p)->GetColorControls(a)
#define IVideoPort_GetInputFormats(p,a,b,c) (p)->GetInputFormats(a,b,c)
#define IVideoPort_GetOutputFormats(p,a,b,c,d) (p)->GetOutputFormats(a,b,c,d)
#define IVideoPort_GetFieldPolarity(p,a) (p)->GetFieldPolarity(a)
#define IVideoPort_GetVideoLine(p,a) (p)->GetVideoLine(a)
#define IVideoPort_GetVideoSignalStatus(p,a) (p)->GetVideoSignalStatus(a)
#define IVideoPort_SetColorControls(p,a) (p)->SetColorControls(a)
#define IVideoPort_StartVideo(p,a) (p)->StartVideo(a)
#define IVideoPort_StopVideo(p) (p)->StopVideo()
#define IVideoPort_UpdateVideo(p,a) (p)->UpdateVideo(a)
#define IVideoPort_WaitForSync(p,a,b,c) (p)->WaitForSync(a,b,c)
#endif
#endif
/*
* DDVIDEOPORTCONNECT
*/
typedef struct _DDVIDEOPORTCONNECT
{
DWORD dwSize; // size of the DDVIDEOPORTCONNECT structure
DWORD dwPortWidth; // Width of the video port
GUID guidTypeID; // Description of video port connection
DWORD dwFlags; // Connection flags
DWORD dwReserved1; // Reserved, set to zero.
} DDVIDEOPORTCONNECT;
/*
* DDVIDEOPORTCAPS
*/
typedef struct _DDVIDEOPORTCAPS
{
DWORD dwSize; // size of the DDVIDEOPORTCAPS structure
DWORD dwFlags; // indicates which fields contain data
DWORD dwMaxWidth; // max width of the video port field
DWORD dwMaxVBIWidth; // max width of the VBI data
DWORD dwMaxHeight; // max height of the video port field
DWORD dwVideoPortID; // Video port ID (0 - (dwMaxVideoPorts -1))
DWORD dwCaps; // Video port capabilities
DWORD dwFX; // More video port capabilities
DWORD dwNumAutoFlipSurfaces; // Number of autoflippable surfaces
DWORD dwAlignVideoPortBoundary; // Byte restriction of placement within the surface
DWORD dwAlignVideoPortPrescaleWidth;// Byte restriction of width after prescaling
DWORD dwAlignVideoPortCropBoundary; // Byte restriction of left cropping
DWORD dwAlignVideoPortCropWidth; // Byte restriction of cropping width
DWORD dwPreshrinkXStep; // Width can be shrunk in steps of 1/x
DWORD dwPreshrinkYStep; // Height can be shrunk in steps of 1/x
DWORD dwNumVBIAutoFlipSurfaces; // Number of VBI autoflippable surfaces
DWORD dwReserved1; // Reserved for future use
DWORD dwReserved2; // Reserved for future use
} DDVIDEOPORTCAPS;
/*
* The dwMaxWidth and dwMaxVBIWidth members are valid
*/
#define DDVPD_WIDTH 0x00000001l
/*
* The dwMaxHeight member is valid
*/
#define DDVPD_HEIGHT 0x00000002l
/*
* The dwVideoPortID member is valid
*/
#define DDVPD_ID 0x00000004l
/*
* The dwCaps member is valid
*/
#define DDVPD_CAPS 0x00000008l
/*
* The dwFX member is valid
*/
#define DDVPD_FX 0x00000010l
/*
* The dwNumAutoFlipSurfaces member is valid
*/
#define DDVPD_AUTOFLIP 0x00000020l
/*
* All of the alignment members are valid
*/
#define DDVPD_ALIGN 0x00000040l
/*
* DDVIDEOPORTDESC
*/
typedef struct _DDVIDEOPORTDESC
{
DWORD dwSize; // size of the DDVIDEOPORTDESC structure
DWORD dwFieldWidth; // width of the video port field
DWORD dwVBIWidth; // width of the VBI data
DWORD dwFieldHeight; // height of the video port field
DWORD dwMicrosecondsPerField; // Microseconds per video field
DWORD dwMaxPixelsPerSecond; // Maximum pixel rate per second
DWORD dwVideoPortID; // Video port ID (0 - (dwMaxVideoPorts -1))
DWORD dwReserved1; // Reserved for future use - set to zero
DDVIDEOPORTCONNECT VideoPortType; // Description of video port connection
DWORD dwReserved2; // Reserved for future use - set to zero
DWORD dwReserved3; // Reserved for future use - set to zero
} DDVIDEOPORTDESC;
/*
* DDVIDEOPORTINFO
*/
typedef struct _DDVIDEOPORTINFO
{
DWORD dwSize; // Size of the structure
DWORD dwOriginX; // Placement of the video data within the surface.
DWORD dwOriginY; // Placement of the video data within the surface.
DWORD dwVPFlags; // Video port options
RECT rCrop; // Cropping rectangle (optional).
DWORD dwPrescaleWidth; // Determines pre-scaling/zooming in the X direction (optional).
DWORD dwPrescaleHeight; // Determines pre-scaling/zooming in the Y direction (optional).
LPDDPIXELFORMAT lpddpfInputFormat; // Video format written to the video port
LPDDPIXELFORMAT lpddpfVBIInputFormat; // Input format of the VBI data
LPDDPIXELFORMAT lpddpfVBIOutputFormat;// Output format of the data
DWORD dwVBIHeight; // Specifies the number of lines of data within the vertical blanking interval.
DWORD dwReserved1; // Reserved for future use - set to zero
DWORD dwReserved2; // Reserved for future use - set to zero
} DDVIDEOPORTINFO;
/*
* DDVIDEOPORTBANDWIDTH
*/
typedef struct _DDVIDEOPORTBANDWIDTH
{
DWORD dwSize; // Size of the structure
DWORD dwCaps;
DWORD dwOverlay; // Zoom factor at which overlay is supported
DWORD dwColorkey; // Zoom factor at which overlay w/ colorkey is supported
DWORD dwYInterpolate; // Zoom factor at which overlay w/ Y interpolation is supported
DWORD dwYInterpAndColorkey; // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported
DWORD dwReserved1; // Reserved for future use - set to zero
DWORD dwReserved2; // Reserved for future use - set to zero
} DDVIDEOPORTBANDWIDTH;
/*
* DDVIDEOPORTSTATUS
*/
typedef struct _DDVIDEOPORTSTATUS
{
DWORD dwSize; // Size of the structure
BOOL bInUse; // TRUE if video port is currently being used
DWORD dwFlags; // Currently not used
DWORD dwReserved1; // Reserved for future use
DDVIDEOPORTCONNECT VideoPortType; // Information about the connection
DWORD dwReserved2; // Reserved for future use
DWORD dwReserved3; // Reserved for future use
} DDVIDEOPORTSTATUS;
/*============================================================================
*
* Video Port Flags
*
* All flags are bit flags.
*
*==========================================================================*/
/****************************************************************************
*
* VIDEOPORT DDVIDEOPORTCONNECT FLAGS
*
****************************************************************************/
/*
* When this is set by the driver and passed to the client, this
* indicates that the video port is capable of double clocking the data.
* When this is set by the client, this indicates that the video port
* should enable double clocking. This flag is only valid with external
* syncs.
*/
#define DDVPCONNECT_DOUBLECLOCK 0x00000001l
/*
* When this is set by the driver and passed to the client, this
* indicates that the video port is capable of using an external VACT
* signal. When this is set by the client, this indicates that the
* video port should use the external VACT signal.
*/
#define DDVPCONNECT_VACT 0x00000002l
/*
* When this is set by the driver and passed to the client, this
* indicates that the video port is capable of treating even fields
* like odd fields and visa versa. When this is set by the client,
* this indicates that the video port should treat even fields like odd
* fields.
*/
#define DDVPCONNECT_INVERTPOLARITY 0x00000004l
/*
* Indicates that any data written to the video port during the VREF
* period will not be written into the frame buffer. This flag is read only.
*/
#define DDVPCONNECT_DISCARDSVREFDATA 0x00000008l
/*
* Device will write half lines into the frame buffer, sometimes causing
* the data to not be displayed correctly.
*/
#define DDVPCONNECT_HALFLINE 0x00000010l
/*
* Indicates that the signal is interlaced. This flag is only
* set by the client.
*/
#define DDVPCONNECT_INTERLACED 0x00000020l
/*
* Indicates that video port is shareable and that this video port
* will use the even fields. This flag is only set by the client.
*/
#define DDVPCONNECT_SHAREEVEN 0x00000040l
/*
* Indicates that video port is shareable and that this video port
* will use the odd fields. This flag is only set by the client.
*/
#define DDVPCONNECT_SHAREODD 0x00000080l
/****************************************************************************
*
* VIDEOPORT DDVIDEOPORTDESC CAPS
*
****************************************************************************/
/*
* Flip can be performed automatically to avoid tearing.
*/
#define DDVPCAPS_AUTOFLIP 0x00000001l
/*
* Supports interlaced video
*/
#define DDVPCAPS_INTERLACED 0x00000002l
/*
* Supports non-interlaced video
*/
#define DDVPCAPS_NONINTERLACED 0x00000004l
/*
* Indicates that the device can return whether the current field
* of an interlaced signal is even or odd.
*/
#define DDVPCAPS_READBACKFIELD 0x00000008l
/*
* Indicates that the device can return the current line of video
* being written into the frame buffer.
*/
#define DDVPCAPS_READBACKLINE 0x00000010l
/*
* Allows two gen-locked video streams to share a single video port,
* where one stream uses the even fields and the other uses the odd
* fields. Separate parameters (including address, scaling,
* cropping, etc.) are maintained for both fields.)
*/
#define DDVPCAPS_SHAREABLE 0x00000020l
/*
* Even fields of video can be automatically discarded.
*/
#define DDVPCAPS_SKIPEVENFIELDS 0x00000040l
/*
* Odd fields of video can be automatically discarded.
*/
#define DDVPCAPS_SKIPODDFIELDS 0x00000080l
/*
* Indicates that the device is capable of driving the graphics
* VSYNC with the video port VSYNC.
*/
#define DDVPCAPS_SYNCMASTER 0x00000100l
/*
* Indicates that data within the vertical blanking interval can
* be written to a different surface.
*/
#define DDVPCAPS_VBISURFACE 0x00000200l
/*
* Indicates that the video port can perform color operations
* on the incoming data before it is written to the frame buffer.
*/
#define DDVPCAPS_COLORCONTROL 0x00000400l
/*
* Indicates that the video port can accept VBI data in a different
* width or format than the regular video data.
*/
#define DDVPCAPS_OVERSAMPLEDVBI 0x00000800l
/*
* Indicates that the video port can write data directly to system memory
*/
#define DDVPCAPS_SYSTEMMEMORY 0x00001000l
/****************************************************************************
*
* VIDEOPORT DDVIDEOPORTDESC FX
*
****************************************************************************/
/*
* Limited cropping is available to crop out the vertical interval data.
*/
#define DDVPFX_CROPTOPDATA 0x00000001l
/*
* Incoming data can be cropped in the X direction before it is written
* to the surface.
*/
#define DDVPFX_CROPX 0x00000002l
/*
* Incoming data can be cropped in the Y direction before it is written
* to the surface.
*/
#define DDVPFX_CROPY 0x00000004l
/*
* Supports interleaving interlaced fields in memory.
*/
#define DDVPFX_INTERLEAVE 0x00000008l
/*
* Supports mirroring left to right as the video data is written
* into the frame buffer.
*/
#define DDVPFX_MIRRORLEFTRIGHT 0x00000010l
/*
* Supports mirroring top to bottom as the video data is written
* into the frame buffer.
*/
#define DDVPFX_MIRRORUPDOWN 0x00000020l
/*
* Data can be arbitrarily shrunk in the X direction before it
* is written to the surface.
*/
#define DDVPFX_PRESHRINKX 0x00000040l
/*
* Data can be arbitrarily shrunk in the Y direction before it
* is written to the surface.
*/
#define DDVPFX_PRESHRINKY 0x00000080l
/*
* Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X
* direction before it is written to the surface.
*/
#define DDVPFX_PRESHRINKXB 0x00000100l
/*
* Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y
* direction before it is written to the surface.
*/
#define DDVPFX_PRESHRINKYB 0x00000200l
/*
* Data can be shrunk in increments of 1/x in the X direction
* (where X is specified in the DDVIDEOPORTCAPS.dwPreshrinkXStep)
* before it is written to the surface.
*/
#define DDVPFX_PRESHRINKXS 0x00000400l
/*
* Data can be shrunk in increments of 1/x in the Y direction
* (where X is specified in the DDVIDEOPORTCAPS.dwPreshrinkYStep)
* before it is written to the surface.
*/
#define DDVPFX_PRESHRINKYS 0x00000800l
/*
* Data can be arbitrarily stretched in the X direction before
* it is written to the surface.
*/
#define DDVPFX_PRESTRETCHX 0x00001000l
/*
* Data can be arbitrarily stretched in the Y direction before
* it is written to the surface.
*/
#define DDVPFX_PRESTRETCHY 0x00002000l
/*
* Data can be integer stretched in the X direction before it is
* written to the surface.
*/
#define DDVPFX_PRESTRETCHXN 0x00004000l
/*
* Data can be integer stretched in the Y direction before it is
* written to the surface.
*/
#define DDVPFX_PRESTRETCHYN 0x00008000l
/*
* Indicates that data within the vertical blanking interval can
* be converted independently of the remaining video data.
*/
#define DDVPFX_VBICONVERT 0x00010000l
/*
* Indicates that scaling can be disabled for data within the
* vertical blanking interval.
*/
#define DDVPFX_VBINOSCALE 0x00020000l
/*
* Indicates that the video data can ignore the left and right
* cropping coordinates when cropping oversampled VBI data.
*/
#define DDVPFX_IGNOREVBIXCROP 0x00040000l
/****************************************************************************
*
* VIDEOPORT DDVIDEOPORTINFO FLAGS
*
****************************************************************************/
/*
* Perform automatic flipping. Auto-flipping is performed between
* the overlay surface that was attached to the video port using
* IDirectDrawVideoPort::AttachSurface and the overlay surfaces that
* are attached to the surface via the IDirectDrawSurface::AttachSurface
* method. The flip order is the order in which the overlay surfaces
* were. attached.
*/
#define DDVP_AUTOFLIP 0x00000001l
/*
* Perform conversion using the ddpfOutputFormat information.
*/
#define DDVP_CONVERT 0x00000002l
/*
* Perform cropping using the specified rectangle.
*/
#define DDVP_CROP 0x00000004l
/*
* Indicates that interlaced fields should be interleaved in memory.
*/
#define DDVP_INTERLEAVE 0x00000008l
/*
* Indicates that the data should be mirrored left to right as it's
* written into the frame buffer.
*/
#define DDVP_MIRRORLEFTRIGHT 0x00000010l
/*
* Indicates that the data should be mirrored top to bottom as it's
* written into the frame buffer.
*/
#define DDVP_MIRRORUPDOWN 0x00000020l
/*
* Perform pre-scaling/zooming based on the pre-scale parameters.
*/
#define DDVP_PRESCALE 0x00000040l
/*
* Ignore input of even fields.
*/
#define DDVP_SKIPEVENFIELDS 0x00000080l
/*
* Ignore input of odd fields.
*/
#define DDVP_SKIPODDFIELDS 0x00000100l
/*
* Drive the graphics VSYNCs using the video port VYSNCs.
*/
#define DDVP_SYNCMASTER 0x00000200l
/*
* The ddpfVBIOutputFormatFormat member contains data that should be used
* to convert the data within the vertical blanking interval.
*/
#define DDVP_VBICONVERT 0x00000400l
/*
* Indicates that data within the vertical blanking interval
* should not be scaled.
*/
#define DDVP_VBINOSCALE 0x00000800l
/*
* Indicates that these bob/weave decisions should not be
* overriden by other interfaces.
*/
#define DDVP_OVERRIDEBOBWEAVE 0x00001000l
/*
* Indicates that the video data should ignore the left and right
* cropping coordinates when cropping the VBI data.
*/
#define DDVP_IGNOREVBIXCROP 0x00002000l
/****************************************************************************
*
* DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS
*
****************************************************************************/
/*
* Return formats for the video data
*/
#define DDVPFORMAT_VIDEO 0x00000001l
/*
* Return formats for the VBI data
*/
#define DDVPFORMAT_VBI 0x00000002l
/****************************************************************************
*
* DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS
*
****************************************************************************/
/*
* Surface should receive video data (and VBI data if a surface
* is not explicitly attached for that purpose)
*/
#define DDVPTARGET_VIDEO 0x00000001l
/*
* Surface should receive VBI data
*/
#define DDVPTARGET_VBI 0x00000002l
/****************************************************************************
*
* DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS
*
****************************************************************************/
/*
* Waits until the beginning of the next VSYNC
*/
#define DDVPWAIT_BEGIN 0x00000001l
/*
* Waits until the end of the next/current VSYNC
*/
#define DDVPWAIT_END 0x00000002l
/*
* Waits until the beginning of the specified line
*/
#define DDVPWAIT_LINE 0x00000003l
/****************************************************************************
*
* DIRECTDRAWVIDEOPORT FLIP FLAGS
*
****************************************************************************/
/*
* Flips the normal video surface
*/
#define DDVPFLIP_VIDEO 0x00000001l
/*
* Flips the VBI surface
*/
#define DDVPFLIP_VBI 0x00000002l
/****************************************************************************
*
* DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES
*
****************************************************************************/
/*
* No video signal is present at the video port
*/
#define DDVPSQ_NOSIGNAL 0x00000001l
/*
* A valid video signal is present at the video port
*/
#define DDVPSQ_SIGNALOK 0x00000002l
/****************************************************************************
*
* VIDEOPORTBANDWIDTH Flags
*
****************************************************************************/
/*
* The specified height/width refer to the size of the video port data
* written into memory, after prescaling has occured.
*/
#define DDVPB_VIDEOPORT 0x00000001l
/*
* The specified height/width refer to the source size of the overlay.
*/
#define DDVPB_OVERLAY 0x00000002l
/*
* This is a query for the device to return which caps this device requires.
*/
#define DDVPB_TYPE 0x00000004l
/****************************************************************************
*
* VIDEOPORTBANDWIDTH Caps
*
****************************************************************************/
/*
* The bandwidth for this device is dependant on the overlay source size.
*/
#define DDVPBCAPS_SOURCE 0x00000001l
/*
* The bandwidth for this device is dependant on the overlay destination
* size.
*/
#define DDVPBCAPS_DESTINATION 0x00000002l
#ifdef __cplusplus
};
#endif
#endif
Binary file not shown.
@@ -0,0 +1,511 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/ExceptionHandler/ExceptionHandler.cpp $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:22 $
* $Author: penguin $
*
* Main file for dealing with exception handling
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2002/05/02 18:03:05 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 1 6/29/99 7:42p Dave
*
* 3 1/19/99 9:07a Allender
* removed compiler warning pragma's since we are already ignoring them in
* vtypes.h
*
* 2 1/18/99 4:34p Allender
* added the exception handler routines from Game Developer for structured
* exception handling in vsdk code
*
* $NoKeywords: $
*/
// Copyright © 1998 Bruce Dawson.
/*
This source file contains the exception handler for recording error
information after crashes. See exceptionhandler.h for information
on how to hook it in.
*/
#include <windows.h>
// --------------------
//
// Defines
//
// --------------------
#define ONEK 1024
#define SIXTYFOURK (64*ONEK)
#define ONEM (ONEK*ONEK)
#define ONEG (ONEK*ONEK*ONEK)
// --------------------
//
// Enumerated Types
//
// --------------------
// --------------------
//
// Structures
//
// --------------------
// --------------------
//
// Classes
//
// --------------------
// --------------------
//
// Global Variables
//
// --------------------
// --------------------
//
// Local Variables
//
// --------------------
const int NumCodeBytes = 16; // Number of code bytes to record.
const int MaxStackDump = 2048; // Maximum number of DWORDS in stack dumps.
const int StackColumns = 8; // Number of columns in stack dump.
// --------------------
//
// Internal Functions
//
// --------------------
// hprintf behaves similarly to printf, with a few vital differences.
// It uses wvsprintf to do the formatting, which is a system routine,
// thus avoiding C run time interactions. For similar reasons it
// uses WriteFile rather than fwrite.
// The one limitation that this imposes is that wvsprintf, and
// therefore hprintf, cannot handle floating point numbers.
static void hprintf(HANDLE LogFile, char* Format, ...)
{
char buffer[2000]; // wvsprintf never prints more than one K.
va_list arglist;
va_start( arglist, Format);
wvsprintf(buffer, Format, arglist);
va_end( arglist);
DWORD NumBytes;
WriteFile(LogFile, buffer, lstrlen(buffer), &NumBytes, 0);
}
// Print the specified FILETIME to output in a human readable format,
// without using the C run time.
static void PrintTime(char *output, FILETIME TimeToPrint)
{
WORD Date, Time;
if (FileTimeToLocalFileTime(&TimeToPrint, &TimeToPrint) &&
FileTimeToDosDateTime(&TimeToPrint, &Date, &Time))
{
// What a silly way to print out the file date/time. Oh well,
// it works, and I'm not aware of a cleaner way to do it.
wsprintf(output, "%d/%d/%d %02d:%02d:%02d",
(Date / 32) & 15, Date & 31, (Date / 512) + 1980,
(Time / 2048), (Time / 32) & 63, (Time & 31) * 2);
} else {
output[0] = 0;
}
}
// Print information about a code module (DLL or EXE) such as its size,
// location, time stamp, etc.
static void ShowModuleInfo(HANDLE LogFile, HINSTANCE ModuleHandle)
{
char ModName[MAX_PATH];
__try {
if (GetModuleFileName(ModuleHandle, ModName, sizeof(ModName)) > 0) {
// If GetModuleFileName returns greater than zero then this must
// be a valid code module address. Therefore we can try to walk
// our way through its structures to find the link time stamp.
IMAGE_DOS_HEADER *DosHeader = (IMAGE_DOS_HEADER*)ModuleHandle;
if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic) {
return;
}
IMAGE_NT_HEADERS *NTHeader = (IMAGE_NT_HEADERS*)((char *)DosHeader + DosHeader->e_lfanew);
if (IMAGE_NT_SIGNATURE != NTHeader->Signature) {
return;
}
// Open the code module file so that we can get its file date
// and size.
HANDLE ModuleFile = CreateFile(ModName, GENERIC_READ,
FILE_SHARE_READ, 0, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
char TimeBuffer[100] = "";
DWORD FileSize = 0;
if (ModuleFile != INVALID_HANDLE_VALUE) {
FileSize = GetFileSize(ModuleFile, 0);
FILETIME LastWriteTime;
if (GetFileTime(ModuleFile, 0, 0, &LastWriteTime)) {
wsprintf(TimeBuffer, " - file date is ");
PrintTime(TimeBuffer + lstrlen(TimeBuffer), LastWriteTime);
}
CloseHandle(ModuleFile);
}
hprintf(LogFile, "%s, loaded at 0x%08x - %d bytes - %08x%s\r\n",
ModName, ModuleHandle, FileSize,
NTHeader->FileHeader.TimeDateStamp, TimeBuffer);
}
}
// Handle any exceptions by continuing from this point.
__except(EXCEPTION_EXECUTE_HANDLER)
{
}
}
// Scan memory looking for code modules (DLLs or EXEs). VirtualQuery is used
// to find all the blocks of address space that were reserved or committed,
// and ShowModuleInfo will display module information if they are code
// modules.
static void RecordModuleList(HANDLE LogFile)
{
hprintf(LogFile, "\r\n"
"\tModule list: names, addresses, sizes, time stamps "
"and file times:\r\n");
SYSTEM_INFO SystemInfo;
GetSystemInfo(&SystemInfo);
const size_t PageSize = SystemInfo.dwPageSize;
// Set NumPages to the number of pages in the 4GByte address space,
// while being careful to avoid overflowing ints.
const size_t NumPages = 4 * size_t(ONEG / PageSize);
size_t pageNum = 0;
void *LastAllocationBase = 0;
while (pageNum < NumPages) {
MEMORY_BASIC_INFORMATION MemInfo;
if (VirtualQuery((void *)(pageNum * PageSize), &MemInfo, sizeof(MemInfo))) {
if (MemInfo.RegionSize > 0) {
// Adjust the page number to skip over this block of memory.
pageNum += MemInfo.RegionSize / PageSize;
if (MemInfo.State == MEM_COMMIT && MemInfo.AllocationBase > LastAllocationBase) {
// Look for new blocks of committed memory, and try
// recording their module names - this will fail
// gracefully if they aren't code modules.
LastAllocationBase = MemInfo.AllocationBase;
ShowModuleInfo(LogFile, (HINSTANCE)LastAllocationBase);
}
} else {
pageNum += SIXTYFOURK / PageSize;
}
} else {
// If VirtualQuery fails we advance by 64K because that is the
// granularity of address space doled out by VirtualAlloc().
pageNum += SIXTYFOURK / PageSize;
}
}
}
// Record information about the user's system, such as processor type, amount
// of memory, etc.
static void RecordSystemInformation(HANDLE LogFile)
{
FILETIME CurrentTime;
GetSystemTimeAsFileTime(&CurrentTime);
char TimeBuffer[100];
PrintTime(TimeBuffer, CurrentTime);
hprintf(LogFile, "Error occurred at %s.\r\n", TimeBuffer);
char ModuleName[MAX_PATH];
if (GetModuleFileName(0, ModuleName, sizeof(ModuleName)) <= 0) {
lstrcpy(ModuleName, "Unknown");
}
char UserName[200];
DWORD UserNameSize = sizeof(UserName);
if (!GetUserName(UserName, &UserNameSize)) {
lstrcpy(UserName, "Unknown");
}
hprintf(LogFile, "%s, run by %s.\r\n", ModuleName, UserName);
SYSTEM_INFO SystemInfo;
GetSystemInfo(&SystemInfo);
hprintf(LogFile, "%d processor(s), type %d.\r\n",
SystemInfo.dwNumberOfProcessors, SystemInfo.dwProcessorType);
MEMORYSTATUS MemInfo;
MemInfo.dwLength = sizeof(MemInfo);
GlobalMemoryStatus(&MemInfo);
// Print out the amount of physical memory, rounded up.
hprintf(LogFile, "%d MBytes physical memory.\r\n", (MemInfo.dwTotalPhys +
ONEM - 1) / ONEM);
}
// Translate the exception code into something human readable.
static const char *GetExceptionDescription(DWORD ExceptionCode)
{
struct ExceptionNames
{
DWORD ExceptionCode;
char* ExceptionName;
};
ExceptionNames ExceptionMap[] =
{
{0x40010005, "a Control-C"},
{0x40010008, "a Control-Break"},
{0x80000002, "a Datatype Misalignment"},
{0x80000003, "a Breakpoint"},
{0xc0000005, "an Access Violation"},
{0xc0000006, "an In Page Error"},
{0xc0000017, "a No Memory"},
{0xc000001d, "an Illegal Instruction"},
{0xc0000025, "a Noncontinuable Exception"},
{0xc0000026, "an Invalid Disposition"},
{0xc000008c, "a Array Bounds Exceeded"},
{0xc000008d, "a Float Denormal Operand"},
{0xc000008e, "a Float Divide by Zero"},
{0xc000008f, "a Float Inexact Result"},
{0xc0000090, "a Float Invalid Operation"},
{0xc0000091, "a Float Overflow"},
{0xc0000092, "a Float Stack Check"},
{0xc0000093, "a Float Underflow"},
{0xc0000094, "an Integer Divide by Zero"},
{0xc0000095, "an Integer Overflow"},
{0xc0000096, "a Privileged Instruction"},
{0xc00000fD, "a Stack Overflow"},
{0xc0000142, "a DLL Initialization Failed"},
{0xe06d7363, "a Microsoft C++ Exception"},
};
for (int i = 0; i < sizeof(ExceptionMap) / sizeof(ExceptionMap[0]); i++) {
if (ExceptionCode == ExceptionMap[i].ExceptionCode) {
return ExceptionMap[i].ExceptionName;
}
}
return "Unknown exception type";
}
static char* GetFilePart(char *source)
{
char *result = strrchr(source, '\\');
if (result) {
result++;
} else {
result = source;
}
return result;
}
// --------------------
//
// External Functions
//
// --------------------
// Entry point into the main exception handling routine. This routine is put into an except()
// statment at the beginning of a thread and is called anytime that there is a program exception
// The data is stored in a file called ErrorLog.txt in the data directory.
//
// data: pointer to the exception data
// Message: Any message that should be printed out in the error log file
//
// returns:
//
int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message)
{
static bool BeenHere = false;
// Going recursive! That must mean this routine crashed!
if (BeenHere) {
return EXCEPTION_CONTINUE_SEARCH;
}
BeenHere = true;
char ModuleName[MAX_PATH];
char FileName[MAX_PATH] = "Unknown";
// Create a filename to record the error information to.
// Storing it in the executable directory works well.
if (GetModuleFileName(0, ModuleName, sizeof(ModuleName)) <= 0) {
ModuleName[0] = 0;
}
char *FilePart = GetFilePart(ModuleName);
// Extract the file name portion and remove it's file extension. We'll
// use that name shortly.
lstrcpy(FileName, FilePart);
char *lastperiod = strrchr(FileName, '.');
if (lastperiod) {
lastperiod[0] = 0;
}
// Replace the executable filename with our error log file name.
lstrcpy(FilePart, "errorlog.txt");
HANDLE LogFile = CreateFile(ModuleName, GENERIC_WRITE, 0, 0,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, 0);
if (LogFile == INVALID_HANDLE_VALUE) {
OutputDebugString("Error creating exception report");
return EXCEPTION_CONTINUE_SEARCH;
}
// Append to the error log.
SetFilePointer(LogFile, 0, 0, FILE_END);
// Print out some blank lines to separate this error log from any previous ones.
hprintf(LogFile, "\r\n\r\n\r\n\r\n");
PEXCEPTION_RECORD Exception = data->ExceptionRecord;
PCONTEXT Context = data->ContextRecord;
char CrashModulePathName[MAX_PATH];
char *CrashModuleFileName = "Unknown";
MEMORY_BASIC_INFORMATION MemInfo;
// VirtualQuery can be used to get the allocation base associated with a
// code address, which is the same as the ModuleHandle. This can be used
// to get the filename of the module that the crash happened in.
if (VirtualQuery((void*)Context->Eip, &MemInfo, sizeof(MemInfo)) && GetModuleFileName((HINSTANCE)MemInfo.AllocationBase, CrashModulePathName, sizeof(CrashModulePathName)) > 0) {
CrashModuleFileName = GetFilePart(CrashModulePathName);
}
// Print out the beginning of the error log in a Win95 error window
// compatible format.
hprintf(LogFile, "%s caused %s in module %s at %04x:%08x.\r\n",
FileName, GetExceptionDescription(Exception->ExceptionCode),
CrashModuleFileName, Context->SegCs, Context->Eip);
hprintf(LogFile, "Exception handler called in %s.\r\n", Message);
RecordSystemInformation(LogFile);
// If the exception was an access violation, print out some additional
// information, to the error log and the debugger.
if (Exception->ExceptionCode == STATUS_ACCESS_VIOLATION && Exception->NumberParameters >= 2) {
char DebugMessage[1000];
const char* readwrite = "Read from";
if (Exception->ExceptionInformation[0]) {
readwrite = "Write to";
}
wsprintf(DebugMessage, "%s location %08x caused an access violation.\r\n", readwrite, Exception->ExceptionInformation[1]);
#ifdef _DEBUG
// The VisualC++ debugger doesn't actually tell you whether a read
// or a write caused the access violation, nor does it tell what
// address was being read or written. So I fixed that.
OutputDebugString("Exception handler: ");
OutputDebugString(DebugMessage);
#endif
hprintf(LogFile, "%s", DebugMessage);
}
// Print out the register values in a Win95 error window compatible format.
hprintf(LogFile, "\r\n");
hprintf(LogFile, "Registers:\r\n");
hprintf(LogFile, "EAX=%08x CS=%04x EIP=%08x EFLGS=%08x\r\n",
Context->Eax, Context->SegCs, Context->Eip, Context->EFlags);
hprintf(LogFile, "EBX=%08x SS=%04x ESP=%08x EBP=%08x\r\n",
Context->Ebx, Context->SegSs, Context->Esp, Context->Ebp);
hprintf(LogFile, "ECX=%08x DS=%04x ESI=%08x FS=%04x\r\n",
Context->Ecx, Context->SegDs, Context->Esi, Context->SegFs);
hprintf(LogFile, "EDX=%08x ES=%04x EDI=%08x GS=%04x\r\n",
Context->Edx, Context->SegEs, Context->Edi, Context->SegGs);
hprintf(LogFile, "Bytes at CS:EIP:\r\n");
// Print out the bytes of code at the instruction pointer. Since the
// crash may have been caused by an instruction pointer that was bad,
// this code needs to be wrapped in an exception handler, in case there
// is no memory to read. If the dereferencing of code[] fails, the
// exception handler will print '??'.
unsigned char *code = (unsigned char*)Context->Eip;
for (int codebyte = 0; codebyte < NumCodeBytes; codebyte++) {
__try {
hprintf(LogFile, "%02x ", code[codebyte]);
}
__except(EXCEPTION_EXECUTE_HANDLER) {
hprintf(LogFile, "?? ");
}
}
// Time to print part or all of the stack to the error log. This allows
// us to figure out the call stack, parameters, local variables, etc.
hprintf(LogFile, "\r\n"
"Stack dump:\r\n");
__try {
// Esp contains the bottom of the stack, or at least the bottom of
// the currently used area.
DWORD* pStack = (DWORD *)Context->Esp;
DWORD* pStackTop;
__asm
{
// Load the top (highest address) of the stack from the
// thread information block. It will be found there in
// Win9x and Windows NT.
mov eax, fs:[4]
mov pStackTop, eax
}
if (pStackTop > pStack + MaxStackDump) {
pStackTop = pStack + MaxStackDump;
}
int Count = 0;
// Too many calls to WriteFile can take a long time, causing
// confusing delays when programs crash. Therefore I implemented
// simple buffering for the stack dumping code instead of calling
// hprintf directly.
char buffer[1000] = "";
const int safetyzone = 50;
char* nearend = buffer + sizeof(buffer) - safetyzone;
char* output = buffer;
while (pStack + 1 <= pStackTop) {
if ((Count % StackColumns) == 0) {
output += wsprintf(output, "%08x: ", pStack);
}
char *Suffix = " ";
if ((++Count % StackColumns) == 0 || pStack + 2 > pStackTop) {
Suffix = "\r\n";
}
output += wsprintf(output, "%08x%s", *pStack, Suffix);
pStack++;
// Check for when the buffer is almost full, and flush it to disk.
if (output > nearend) {
hprintf(LogFile, "%s", buffer);
buffer[0] = 0;
output = buffer;
}
}
// Print out any final characters from the cache.
hprintf(LogFile, "%s", buffer);
}
__except(EXCEPTION_EXECUTE_HANDLER) {
hprintf(LogFile, "Exception encountered during stack dump.\r\n");
}
RecordModuleList(LogFile);
CloseHandle(LogFile);
// Return the magic value which tells Win32 that this handler didn't
// actually handle the exception - so that things will proceed as per
// normal.
return EXCEPTION_CONTINUE_SEARCH;
}
@@ -0,0 +1,98 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/ExceptionHandler/ExceptionHandler.h $
* $Revision: 2.1 $
* $Date: 2002-07-07 19:55:58 $
* $Author: penguin $
*
* Header file for program exception handling
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/07 02:58:10 mharris
* ifdef around pragma
*
* Revision 1.1 2002/05/02 18:03:05 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 1 6/29/99 7:42p Dave
*
* 2 1/18/99 4:34p Allender
* added the exception handler routines from Game Developer for structured
* exception handling in vsdk code
*
* $NoKeywords: $
*/
#ifdef _MSC_VER
#pragma once // Include this file only once
#endif
#ifndef __EXCEPTION_HANDLER_H
#define __EXCEPTION_HANDLER_H
// --------------------
//
// Defines
//
// --------------------
// --------------------
//
// Enumerated types
//
// --------------------
// --------------------
//
// Structures
//
// --------------------
// this is a forward declaration so we don't need to include windows.h
typedef struct _EXCEPTION_POINTERS EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
// --------------------
//
// Classes
//
// --------------------
// --------------------
//
// Variables
//
// --------------------
// --------------------
//
// Prototypes
//
// --------------------
int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message);
// --------------------
//
// Helper Macros
//
// --------------------
#endif // __EXCEPTION_HANDLER_H
File diff suppressed because it is too large. Load diff
+209
View File
@@ -0,0 +1,209 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Fireball/FireBalls.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Prototypes for fireball functions
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 8 9/13/99 10:09a Andsager
* Add debug console commands to lower model render detail and fireball
* LOD for big ship explosiosns.
*
* 7 9/06/99 6:57p Jamesa
* Cranked down num large fireball explosions.
*
* 6 9/06/99 6:14p Jamesa
* Reduced max fireball types.
*
* 5 8/31/99 10:13p Andsager
* Add Knossos warp effect fireball
*
* 4 4/28/99 11:13p Dave
* Temporary checkin of artillery code.
*
* 3 11/05/98 5:55p Dave
* Big pass at reducing #includes
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 34 5/15/98 3:54p John
* Added code so that only "perishable" fireballs get removed.
*
* 33 4/15/98 9:42a Adam
* added 2 more explosion types (1, actually, but placeholder for 2)
*
* 32 4/12/98 9:56a John
* Made lighting detail flags work. Made explosions cast light on
* highest.
*
* 31 3/30/98 4:02p John
* Made machines with < 32 MB of RAM use every other frame of certain
* bitmaps. Put in code to keep track of how much RAM we've malloc'd.
*
* 30 3/18/98 12:36p John
* Made hardware have nicer looking warp effect
*
* 29 2/26/98 10:07p Hoffoss
* Rewrote state saving and restoring to fix bugs and simplify the code.
*
* 28 2/19/98 4:32p Lawrance
* Add asteroid explosion
*
* 27 1/23/98 5:06p John
* Took L out of vertex structure used B (blue) instead. Took all small
* fireballs out of fireball types and used particles instead. Fixed some
* debris explosion things. Restructured fireball code. Restructured
* some lighting code. Made dynamic lighting on by default. Made groups
* of lasers only cast one light. Made fireballs not cast light.
*
* 26 1/15/98 4:58p John
* Made warp effect use a looping ani. Made the scaling up & down be in
* software.
*
* 25 1/15/98 2:32p John
* Added code to optionally take a velocity for a fireball.
*
* 24 1/02/98 5:04p John
* Several explosion related changes. Made fireballs not be used as
* ani's. Made ship spark system expell particles. Took away impact
* explosion for weapon hitting ship... this needs to get added to weapon
* info and makes shield hit more obvious. Only make sparks when hit
* hull, not shields.
*
* 23 12/08/97 11:15a John
* added parameter to warpout for life.
*
* 22 11/01/97 1:49p John
* added code to page fireballs in during level load. Made player warpout
* use Adam's new camera movement pattern. Make ships docked to warping
* out ships render correctly.
*
* 21 10/24/97 6:24p John
* added code to return the life left of a fireball
*
* 20 9/14/97 4:49p Lawrance
* extern Num_fireballs
*
* 19 9/12/97 4:02p John
* put in ship warp out effect.
* put in dynamic lighting for warp in/out
*
* 18 9/09/97 4:49p John
* Almost done ship warp in code
*
* 17 9/03/97 4:32p John
* changed bmpman to only accept ani and pcx's. made passing .pcx or .ani
* to bm_load functions not needed. Made bmpman keep track of palettes
* for bitmaps not mapped into game palettes.
*
* 16 8/29/97 2:26p John
* first rev of ship warp in effect. Nothing more than a fireball inside
* of freespace, but textest.cpp contains the correct effect code that
* needs to be transferred into the game next.
*
* 15 8/13/97 9:50p Allender
* split *_move into *_process_pre and *_process_post functions.
* process_pre functions called before object is moved. _process_post
* functions called after object is moved. Reordered code in ship_post
* and weapon_post for multiplayer
*
* 14 8/13/97 12:06p Lawrance
* supporting multiple types of fireball explosions
*
* 13 7/21/97 11:41a Lawrance
* clean up fireballs at the end of each level
*
* 12 7/11/97 11:19a Lawrance
* fix mem leaks, move save code from State.cpp here
*
* 11 7/10/97 1:51p Lawrance
* sorting anim fireballs
*
* 10 5/14/97 4:08p Lawrance
* removing my_index from game arrays
*
* 9 3/11/97 10:47p Mike
* Add a slew of secondary weapons.
* Support exhaust blobs.
* Add weapons that spawn weapons.
* Add remotely detonatable weapons.
* Add heat-seeking missiles.
*
* 8 2/17/97 5:18p John
* Added a bunch of RCS headers to a bunch of old files that don't have
* them.
*
* $NoKeywords: $
*/
#ifndef _FIREBALLS_H
#define _FIREBALLS_H
#include "object/object.h"
#include "cfile/cfile.h"
// these values correspond to the fireball.tbl entries
#define FIREBALL_EXPLOSION_MEDIUM 0 // Used for the 4 little explosions before a ship explodes
#define FIREBALL_WARP_EFFECT 1 // Used for the warp in / warp out effect
#define FIREBALL_KNOSSOS_EFFECT 2 // Used for the KNOSSOS warp in / warp out effect
#define FIREBALL_ASTEROID 3
#define FIREBALL_EXPLOSION_LARGE1 4 // Used for the big explosion when a ship breaks into pieces
#define FIREBALL_EXPLOSION_LARGE2 5 // Used for the big explosion when a ship breaks into pieces
// #define FIREBALL_EXPLOSION_LARGE3 6 // Used for the big explosion when a ship breaks into pieces
#define MAX_FIREBALL_TYPES 6 // How many types there are
#define FIREBALL_NUM_LARGE_EXPLOSIONS 2
void fireball_init();
void fireball_render(object * obj);
void fireball_delete( object * obj );
void fireball_process_pre(object * obj, float frame_time);
void fireball_process_post(object * obj, float frame_time);
// reversed is for warp_in/out effects
// Velocity: If not NULL, the fireball will move at a constant velocity.
// warp_lifetime: If warp_lifetime > 0.0f then makes the explosion loop so it lasts this long. Only works for warp effect
int fireball_create(vector *pos, int fireball_type, int parent_obj, float size, int reversed=0, vector *velocity=NULL, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=NULL, int low_res=0);
void fireball_render_plane(int plane);
void fireball_close();
void fireball_level_close();
void fireball_preload(); // page in warpout effect data
// Returns 1 if you can remove this fireball
int fireball_is_perishable(object * obj);
// Returns 1 if this fireball is a warp
int fireball_is_warp(object * obj);
// Returns life left of a fireball in seconds
float fireball_lifeleft( object *obj );
// Returns life left of a fireball in percent
float fireball_lifeleft_percent( object *obj );
// internal function to draw warp grid.
extern void warpin_render(matrix *orient, vector *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius );
extern int Warp_glow_bitmap; // Internal
#endif /* _FIREBALLS_H */
+273
View File
@@ -0,0 +1,273 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Fireball/WarpInEffect.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Code for rendering the warp in effects for ships
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/03 22:07:08 mharris
* got some stuff to compile
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 3 7/22/99 1:22p Dave
* Enable proper zbuffering for warpin glow effect.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 23 4/08/98 8:20p John
* Made "Apex" of warp effect not move.
*
* 22 3/30/98 4:02p John
* Made machines with < 32 MB of RAM use every other frame of certain
* bitmaps. Put in code to keep track of how much RAM we've malloc'd.
*
* 21 3/29/98 12:39p John
* Made warp in glow page in
*
* 20 3/26/98 5:21p John
* Added new code to preload all bitmaps at the start of a level.
* Commented it out, though.
*
* 19 3/18/98 12:36p John
* Made hardware have nicer looking warp effect
*
* 18 3/16/98 4:51p John
* Added low-level code to clip all polygons against an arbritary plane.
* Took out all old model_interp_zclip and used this new method instead.
*
* 17 3/10/98 4:18p John
* Cleaned up graphics lib. Took out most unused gr functions. Made D3D
* & Glide have popups and print screen. Took out all >8bpp software
* support. Made Fred zbuffer. Made zbuffer allocate dynamically to
* support Fred. Made zbuffering key off of functions rather than one
* global variable.
*
* 16 3/04/98 7:07p John
* Added debug code to try to normalize a zerolength vector.
*
* 15 2/26/98 3:28p John
* fixed optimize compiler warning
*
* 14 2/24/98 6:36p John
* Made warp effect draw as a 4 poly cone.
*
* 13 2/22/98 12:19p John
* Externalized some strings
*
* 12 1/15/98 9:07p John
* Added noise to warp effect glow.
*
* 11 1/15/98 4:58p John
* Made warp effect use a looping ani. Made the scaling up & down be in
* software.
*
* 10 12/30/97 6:44p John
* Made g3_Draw_bitmap functions account for aspect of bitmap.
*
* 9 12/08/97 11:15a John
* added parameter to warpout for life.
*
* 8 12/05/97 3:46p John
* made ship thruster glow scale instead of being an animation.
*
* 7 12/02/97 3:59p John
* Added first rev of thruster glow, along with variable levels of
* translucency, which retquired some restructing of palman.
*
* 6 10/24/97 12:18p John
* sped up warp effect by decreasing number of polys with distance.
*
* 5 9/15/97 5:45p John
* took out chunk stuff.
* made pofview display thrusters as blue polies.
*
* 4 9/12/97 4:02p John
* put in ship warp out effect.
* put in dynamic lighting for warp in/out
*
* 3 9/09/97 4:49p John
* Almost done ship warp in code
*
* 2 9/08/97 8:39a John
* added in code structure for grid
*
* 1 9/05/97 10:07a John
*
* $NoKeywords: $
*/
#include "math/vecmat.h"
#include "graphics/tmapper.h"
#include "graphics/2d.h"
#include "render/3d.h"
#include "bmpman/bmpman.h"
#include "model/model.h"
#include "io/key.h"
#include "physics/physics.h"
#include "math/floating.h"
#include "model/model.h"
#include "lighting/lighting.h"
#include "object/object.h"
#include "ship/ship.h"
#include "globalincs/systemvars.h"
#include "anim/animplay.h"
#include "fireball/fireballs.h"
#include "globalincs/linklist.h"
#include "io/timer.h"
DCF(norm,"normalize a zero length vector")
{
if ( Dc_command ) {
vector tmp = vmd_zero_vector;
vm_vec_normalize(&tmp);
}
}
void draw_face( vertex *v1, vertex *v2, vertex *v3 )
{
vector norm;
vertex *vertlist[3];
vm_vec_perp(&norm,(vector *)&v1->x,(vector *)&v2->x,(vector *)&v3->x);
if ( vm_vec_dot(&norm,(vector *)&v1->x ) >= 0.0 ) {
vertlist[0] = v3;
vertlist[1] = v2;
vertlist[2] = v1;
} else {
vertlist[0] = v1;
vertlist[1] = v2;
vertlist[2] = v3;
}
g3_draw_poly( 3, vertlist, TMAP_FLAG_TEXTURED );
}
void warpin_render(matrix *orient, vector *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius )
{
int i;
int saved_gr_zbuffering = gr_zbuffer_get();
// gr_zbuffering = 0;
gr_set_bitmap( texture_bitmap_num, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
float Grid_depth = radius/2.5f;
vector center;
vm_vec_scale_add( &center, pos, &orient->vec.fvec, -(max_radius/2.5f)/3.0f );
vector vecs[5];
vertex verts[5];
vm_vec_scale_add( &vecs[0], &center, &orient->vec.uvec, radius );
vm_vec_scale_add2( &vecs[0], &orient->vec.rvec, -radius );
vm_vec_scale_add2( &vecs[0], &orient->vec.fvec, Grid_depth );
vm_vec_scale_add( &vecs[1], &center, &orient->vec.uvec, radius );
vm_vec_scale_add2( &vecs[1], &orient->vec.rvec, radius );
vm_vec_scale_add2( &vecs[1], &orient->vec.fvec, Grid_depth );
vm_vec_scale_add( &vecs[2], &center, &orient->vec.uvec, -radius );
vm_vec_scale_add2( &vecs[2], &orient->vec.rvec, radius );
vm_vec_scale_add2( &vecs[2], &orient->vec.fvec, Grid_depth );
vm_vec_scale_add( &vecs[3], &center, &orient->vec.uvec, -radius );
vm_vec_scale_add2( &vecs[3], &orient->vec.rvec, -radius );
vm_vec_scale_add2( &vecs[3], &orient->vec.fvec, Grid_depth );
// vm_vec_scale_add( &vecs[4], &center, &orient->vec.fvec, -Grid_depth );
vecs[4] = center;
verts[0].u = 0.01f; verts[0].v = 0.01f;
verts[1].u = 0.99f; verts[1].v = 0.01f;
verts[2].u = 0.99f; verts[2].v = 0.99f;
verts[3].u = 0.01f; verts[3].v = 0.99f;
verts[4].u = 0.5f; verts[4].v = 0.5f;
for (i=0; i<5; i++ ) {
g3_rotate_vertex( &verts[i], &vecs[i] );
}
draw_face( &verts[0], &verts[4], &verts[1] );
draw_face( &verts[1], &verts[4], &verts[2] );
draw_face( &verts[4], &verts[3], &verts[2] );
draw_face( &verts[0], &verts[3], &verts[4] );
if ( Warp_glow_bitmap != -1 ) {
gr_set_bitmap( Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
float r = radius;
int render_it;
#define OUT_PERCENT1 0.80f
#define OUT_PERCENT2 0.90f
#define IN_PERCENT1 0.10f
#define IN_PERCENT2 0.20f
if ( life_percent < IN_PERCENT1 ) {
// do nothing
render_it = 0;
} else if ( life_percent < IN_PERCENT2 ) {
r *= ( life_percent-IN_PERCENT1 ) / (IN_PERCENT2-IN_PERCENT1);
render_it = 1;
} else if ( life_percent < OUT_PERCENT1 ) {
// do nothing
render_it = 1;
} else if ( life_percent < OUT_PERCENT2 ) {
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2-OUT_PERCENT1);
render_it = 1;
} else {
// do nothing
render_it = 0;
}
if (render_it) {
int saved_gr_zbuffering = gr_zbuffer_get();
gr_zbuffer_set(GR_ZBUFF_READ);
// Add in noise
//float Noise[NOISE_NUM_FRAMES] = {
int noise_frame = fl2i(Missiontime/15.0f) % NOISE_NUM_FRAMES;
r *= (0.40f + Noise[noise_frame]*0.30f);
g3_draw_bitmap( &verts[4], 0,r, TMAP_FLAG_TEXTURED );
gr_zbuffer_set(saved_gr_zbuffering);
}
}
gr_zbuffer_set( saved_gr_zbuffering );
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

File diff suppressed because it is too large. Load diff
+357
View File
@@ -0,0 +1,357 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/FREESPACE2/FreeSpace.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* FreeSpace, the game, not the project, header information.
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 24 10/06/99 10:32a Jefff
* oem updates
*
* 23 9/30/99 6:04p Jefff
* OEM changes
*
* 22 9/08/99 3:22p Dave
* Updated builtin mission list.
*
* 21 9/06/99 6:38p Dave
* Improved CD detection code.
*
* 20 9/06/99 1:30a Dave
* Intermediate checkin. Started on enforcing CD-in-drive to play the
* game.
*
* 19 9/06/99 1:16a Dave
* Make sure the user sees the intro movie.
*
* 18 9/05/99 11:19p Dave
* Made d3d texture cache much more safe. Fixed training scoring bug where
* it would backout scores without ever having applied them in the first
* place.
*
* 17 9/03/99 1:32a Dave
* CD checking by act. Added support to play 2 cutscenes in a row
* seamlessly. Fixed super low level cfile bug related to files in the
* root directory of a CD. Added cheat code to set campaign mission # in
* main hall.
*
* 16 8/19/99 10:12a Alanl
* preload mission-specific messages on machines greater than 48MB
*
* 15 5/19/99 4:07p Dave
* Moved versioning code into a nice isolated common place. Fixed up
* updating code on the pxo screen. Fixed several stub problems.
*
* 14 5/09/99 8:57p Dave
* Final E3 build preparations.
*
* 13 5/05/99 10:06a Dave
* Upped beta version to 0.04
*
* 12 4/29/99 3:02p Dave
* New beta version.
*
* 11 4/25/99 3:02p Dave
* Build defines for the E3 build.
*
* 10 4/09/99 2:27p Dave
* Upped version #
*
* 9 4/09/99 2:21p Dave
* Multiplayer beta stuff. CD checking.
*
* 8 4/08/99 2:10a Dave
* Numerous bug fixes for the beta. Added builtin mission info for the
* beta.
*
* 7 3/19/99 9:52a Dave
* Checkin to repair massive source safe crash. Also added support for
* pof-style nebulae, and some new weapons code.
*
* 6 12/03/98 5:22p Dave
* Ported over Freespace 1 multiplayer ships.tbl and weapons.tbl
* checksumming.
*
* 5 10/13/98 9:26a Dave
* Began neatening up freespace.h.
*
* 4 10/09/98 1:35p Dave
* Split off registry stuff into seperate file.
*
* 3 10/07/98 6:27p Dave
* Globalized mission and campaign file extensions. Removed Silent Threat
* special code. Moved \cache \players and \multidata into the \data
* directory.
*
* 2 10/07/98 10:54a Dave
* Initial checkin.
*
* 79 9/13/98 10:51p Dave
* Put in newfangled icons for mission simulator room. New mdisk.vp
* checksum and file length.
*
* 78 9/11/98 6:59p Dave
* First beta/rev thingie to interplay.
*
* 77 9/11/98 4:14p Dave
* Fixed file checksumming of < file_size. Put in more verbose kicking and
* PXO stats store reporting.
*
* 76 9/04/98 3:51p Dave
* Put in validated mission updating and application during stats
* updating.
*
* 75 5/23/98 2:41p Mike
* Make Easy the default skill level and prevent old pilot's skill level
* from carrying into new pilot.
*
* 74 5/19/98 1:19p Allender
* new low level reliable socket reading code. Make all missions/campaign
* load/save to data missions folder (i.e. we are rid of the player
* missions folder)
*
* 73 5/13/98 11:34p Mike
* Model caching system.
*
* 72 5/10/98 10:05p Allender
* only show cutscenes which have been seen before. Made Fred able to
* write missions anywhere, defaulting to player misison folder, not data
* mission folder. Fix FreeSpace code to properly read missions from
* correct locations
*
* 71 5/08/98 7:08p Dave
* Lots of UI tweaking.
*
* 70 5/08/98 5:31p Lawrance
* extern cd checking routines
*
* $NoKeywords: $
*/
#ifndef _FREESPACE_H
#define _FREESPACE_H
#ifndef STAMPER_PROGRAM // because of all the dependancies, I have to do this...yuck!!! MWA 7/21/97
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
#include "graphics/2d.h"
// --------------------------------------------------------------------------------------------------------
// FREESPACE DEFINES/VARS
//
// filename extensions
#define FS_MISSION_FILE_EXT NOX(".fs2")
#define FS_CAMPAIGN_FILE_EXT NOX(".fc2")
// CDROM volume names
#ifdef MULTIPLAYER_BETA_BUILD
#define FS_CDROM_VOLUME_1 NOX("FS2_BETA")
#define FS_CDROM_VOLUME_2 NOX("FS2_BETA")
#elif defined(E3_BUILD)
#define FS_CDROM_VOLUME_1 NOX("FS2_E3DEMO")
#define FS_CDROM_VOLUME_2 NOX("FS2_E3DEMO")
#elif defined(OEM_BUILD)
#define FS_CDROM_VOLUME_1 NOX("FS2_OEM")
#define FS_CDROM_VOLUME_2 NOX("FS2_OEM")
#define FS_CDROM_VOLUME_3 NOX("FS2_OEM")
#else
#define FS_CDROM_VOLUME_1 NOX("FREESPACE2_1")
#define FS_CDROM_VOLUME_2 NOX("FREESPACE2_2")
#define FS_CDROM_VOLUME_3 NOX("FREESPACE2_3")
// old volume names
// #define FS_CDROM_VOLUME_1 NOX("FREESPACE_1")
// #define FS_CDROM_VOLUME_2 NOX("FREESPACE_2")
// #define FS_CDROM_VOLUME_3 NOX("FREESPACE_3")
#endif
// frametime/missiontime variables
extern fix Frametime;
extern float flFrametime;
extern fix Missiontime;
// 0 - 4
extern int Game_skill_level;
// see GM_* defines in systemvars.h
extern int Game_mode;
// if this value is set anywhere within the game_do_state_common() function, the normal do_state() will not be called
// for this frame. Useful for getting out of sticky sequencing situations.
extern int Game_do_state_should_skip;
// time compression
extern fix Game_time_compression;
// Set if subspace is active this level
extern int Game_subspace_effect;
// The current mission being played.
extern char Game_current_mission_filename[MAX_FILENAME_LEN];
// game's CDROM directory
extern char Game_CDROM_dir[MAX_PATH_LEN];
// if the ships.tbl the player has is valid
extern int Game_ships_tbl_valid;
// if the weapons.tbl the player has is valid
extern int Game_weapons_tbl_valid;
// this is a mission actually designed at Volition
#define MAX_BUILTIN_MISSIONS 100
#define FSB_FROM_VOLITION (1<<0) // we made it in-house
#define FSB_MULTI (1<<1) // is a multiplayer mission
#define FSB_TRAINING (1<<2) // is a training mission
#define FSB_CAMPAIGN (1<<3) // is a campaign mission
#define FSB_CAMPAIGN_FILE (1<<4) // is actually a campaign file
typedef struct fs_builtin_mission {
char filename[MAX_FILENAME_LEN];
int flags; // see FSB_* defines above
char cd_volume[MAX_FILENAME_LEN]; // cd volume which this needs
} fs_builtin_mission;
// --------------------------------------------------------------------------------------------------------
// FREESPACE FUNCTIONS
//
// mission management -------------------------------------------------
// loads in the currently selected mission
int game_start_mission();
// shutdown a mission
void game_level_close();
// gameplay stuff -----------------------------------------------------
// stop the game (mission) timer
void game_stop_time();
// start the game (mission) timer
void game_start_time();
// call whenever in a loop or if you need to get a keypress
int game_check_key();
// poll for keypresses
int game_poll();
// function to read keyboard stuff
void game_process_keys();
// call this to set frametime properly (once per frame)
void game_set_frametime(int state);
// Used to halt all looping game sounds
void game_stop_looped_sounds();
// do stuff that may need to be done regardless of state
void game_do_state_common(int state,int no_networking = 0);
// skill level --------------------------------------------------------
// increase the skill level (will wrap around to min skill level)
void game_increase_skill_level();
// get the default game skill level
int game_get_default_skill_level();
// a keypress. See CPP file for more info.
void game_flush();
// running with low-memory (less than 48MB)
bool game_using_low_mem();
// misc ---------------------------------------------------------------
// lookup the specified filename. return an fs_builtin_mission* if found, NULL otherwise
fs_builtin_mission *game_find_builtin_mission(char *filename);
//================================================================
// GAME FLASH STUFF - code in FreeSpace.cpp
// Resets the flash
void game_flash_reset();
// Adds a flash effect. These can be positive or negative.
// The range will get capped at around -1 to 1, so stick
// with a range like that.
void game_flash( float r, float g, float b );
// Adds a flash for Big Ship explosions
// cap range from 0 to 1
void big_explosion_flash(float flash);
// Call once a frame to diminish the
// flash effect to 0.
void game_flash_diminish();
// Loads the best palette for this level, based
// on nebula color and hud color. You could just call palette_load_table with
// the appropriate filename, but who wants to do that.
void game_load_palette();
//================================================================
// Call at the beginning of each frame
void game_whack_reset();
// Call to apply a whack to a the ship. Used for force feedback
void game_whack_apply( float x, float y );
// call to apply a "shudder"
void game_shudder_apply(int time, float intensity);
//===================================================================
// make sure a CD is in the drive before continuing (returns 1 to continue, otherwise 0).
int game_do_cd_check(char *volume_name=NULL);
int game_do_cd_check_specific(char *volume_name, int cdnum);
int find_freespace_cd(char *volume_name=NULL);
int set_cdrom_path(int drive_num);
int game_do_cd_mission_check(char *filename);
// Used to tell the player that a feature isn't available in the demo version of FreeSpace
void game_feature_not_in_demo_popup();
// Return version string for demo or full version, depending on build.
void get_version_string(char *str);
// format the specified time (fixed point) into a nice string
void game_format_time(fix m_time,char *time_str);
// if the game is running using hacked data
int game_hacked_data();
// show the oem upsell screens (end of campaign, or close of game
void oem_upsell_show_screens();
#endif // endif of #ifndef STAMPER_PROGRAM
#endif
+376
View File
@@ -0,0 +1,376 @@
//Microsoft Developer Studio generated resource script.
//
#include "freespaceresource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"FreespaceResource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <windows.h>\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
DEBUG_MENU DIALOG DISCARDABLE 0, 0, 185, 159
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debug Menu"
FONT 8, "MS Sans Serif"
BEGIN
LISTBOX IDC_LIST_DEBUG,7,7,171,121,LBS_OWNERDRAWFIXED |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Ok",IDOK,7,137,171,14
END
FIND_DIALOG DIALOG DISCARDABLE 0, 0, 119, 47
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Find Text"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_TEXT,7,7,105,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "Find",IDOK,7,26,50,14
PUSHBUTTON "Cancel",IDCANCEL,62,26,50,14
END
IDD_CONNECT DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Server"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "# Connections :",IDC_CON_COUNT,7,54,148,10
LISTBOX IDC_CONPING,7,79,148,167,WS_VSCROLL | WS_TABSTOP
LTEXT "Address and Ping",IDC_STATIC,7,66,143,10
PUSHBUTTON "Reset All",IDC_RESET_MULTI,162,174,46,72
PUSHBUTTON "Kick",IDC_KICK_BUTTON,161,80,47,19
CONTROL "",IDC_STATIC,"Static",SS_GRAYRECT,7,48,201,1
EDITTEXT IDC_STD_NAME,64,14,144,14,ES_AUTOHSCROLL
LTEXT "Server Name",IDC_STATIC,7,17,42,8
EDITTEXT IDC_STD_HOST_PASSWD,64,32,144,14,ES_AUTOHSCROLL
LTEXT "Host Password",IDC_STATIC,7,33,48,8
PUSHBUTTON "Refresh Missions",IDC_PXO_REFRESH,161,116,47,36,
BS_MULTILINE
END
IDD_MULTI DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
CAPTION "Multi-Player"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Frame Cap :",10,7,28,43,8
LTEXT "",IDC_FRAMECAP_STATIC,53,29,46,10,SS_SUNKEN
LTEXT "Realized FPS :",IDC_STATIC_A,119,30,49,12
LTEXT "",IDC_STANDALONE_FPS,172,29,34,11,SS_SUNKEN
LTEXT "Mission Time :",IDC_STATIC_A2,13,91,49,12
LTEXT "",IDC_STANDALONE_MTIME,71,90,125,11,SS_SUNKEN
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_SUNKEN,7,43,199,
1
LTEXT "Mission Name :",IDC_STATIC,13,80,52,11
LTEXT "",IDC_MISSION_NAME,71,78,125,11,SS_SUNKEN
LTEXT "Mission Goals",IDC_STATIC,7,140,74,8
LTEXT "Netgame Information",IDC_STATIC,133,140,66,8
LTEXT "Max Players",IDC_STATIC,117,158,42,8
LTEXT "Max Observers",IDC_STATIC,117,184,48,8
LTEXT "Security",IDC_STATIC,117,210,26,8
LTEXT "Respawns",IDC_STATIC,117,236,34,8
LTEXT "",IDC_NG_MAXPLAYERS,178,158,28,8
LTEXT "",IDC_NG_MAXOBSERVERS,178,184,28,8
LTEXT "",IDC_NG_SECURITY,178,210,28,8
LTEXT "",IDC_NG_RESPAWNS,178,236,28,8
END
IDD_PLAYER_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Player Info"
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX IDC_PLAYER_LIST,77,6,112,169,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Ship Type",IDC_STATIC,7,24,38,10
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,104,24,1,54
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,7,77,201,1
LTEXT "",IDC_PSHIP_TYPE,53,24,49,10,SS_SUNKEN
LTEXT "Mission Stats",IDC_STATIC,133,79,44,10
LTEXT "Primary Shots",IDC_STATIC,7,89,45,9
LTEXT "Primary Hits",IDC_STATIC,7,100,40,9
LTEXT "Primary BH Hits",IDC_STATIC,7,112,50,9
LTEXT "Primary Hit %",IDC_STATIC,7,123,43,9
LTEXT "Primary BH Hit %",IDC_STATIC,7,134,55,9
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,104,78,1,168
LTEXT "All Time Stats",IDC_STATIC,33,79,44,10
LTEXT "Primary Shots",IDC_STATIC,107,88,45,9
LTEXT "Primary Hits",IDC_STATIC,107,99,40,9
LTEXT "Primary BH Hits",IDC_STATIC,107,111,50,9
LTEXT "Primary Hit %",IDC_STATIC,107,122,43,9
LTEXT "Primary BH Hit %",IDC_STATIC,107,133,55,9
LTEXT "Secondary Shots",IDC_STATIC,7,145,56,9
LTEXT "Secondary Hits",IDC_STATIC,7,156,49,9
LTEXT "Secondary BH Hits",IDC_STATIC,7,167,63,9
LTEXT "Secondary Hit %",IDC_STATIC,7,177,55,9
LTEXT "Secondary BH Hit %",IDC_STATIC,7,189,65,9
LTEXT "Secondary Shots",IDC_STATIC,107,144,56,9
LTEXT "Secondary Hits",IDC_STATIC,107,155,49,9
LTEXT "Secondary BH Hits",IDC_STATIC,107,166,63,9
LTEXT "Secondary Hit %",IDC_STATIC,107,176,55,9
LTEXT "Secondary BH Hit %",IDC_STATIC,107,187,65,9
LTEXT "",IDC_PSHOTS,75,90,28,8,SS_SUNKEN
LTEXT "",IDC_PHITS,75,101,28,8,SS_SUNKEN
LTEXT "",IDC_PBHHITS,75,112,28,8,SS_SUNKEN
LTEXT "",IDC_PPCT,75,123,28,8,SS_SUNKEN
LTEXT "",IDC_PBHPCT,75,134,28,8,SS_SUNKEN
LTEXT "",IDC_SSHOTS,75,145,28,8,SS_SUNKEN
LTEXT "",IDC_SECHITS,75,156,28,8,SS_SUNKEN
LTEXT "",IDC_SBHHITS,75,166,28,9,SS_SUNKEN
LTEXT "",IDC_SPCT,75,178,28,8,SS_SUNKEN
LTEXT "",IDC_SBHPCT,75,190,28,8,SS_SUNKEN
LTEXT "",IDC_MPSHOTS,180,89,28,8,SS_SUNKEN
LTEXT "",IDC_MPHITS,180,100,28,8,SS_SUNKEN
LTEXT "",IDC_MPBHHITS,180,111,28,8,SS_SUNKEN
LTEXT "",IDC_MPPCT,180,122,28,8,SS_SUNKEN
LTEXT "",IDC_MPBHPCT,180,134,28,8,SS_SUNKEN
LTEXT "",IDC_MSSHOTS,180,145,28,8,SS_SUNKEN
LTEXT "",IDC_MSECHITS,180,156,28,8,SS_SUNKEN
LTEXT "",IDC_MSBHHITS,180,167,28,8,SS_SUNKEN
LTEXT "",IDC_MSPCT,180,178,28,8,SS_SUNKEN
LTEXT "",IDC_MSBHPCT,180,189,28,8,SS_SUNKEN
CONTROL "",IDC_PINFO_PING,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,7,215,201,1
LTEXT "Player",IDC_STATIC,44,6,20,8
LTEXT "",IDC_PING_TIME,53,38,49,10,SS_SUNKEN
LTEXT "Avg Ping",IDC_STATIC,7,38,32,9
LTEXT "Assists",IDC_STATIC,7,200,54,10
LTEXT "Assists",IDC_STATIC,107,200,54,10
LTEXT "",IDC_ASSISTS,75,201,28,9,SS_SUNKEN
LTEXT "",IDC_MASSISTS,180,200,28,9,SS_SUNKEN
END
IDD_GODSTUFF DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "God Stuff"
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX IDC_PLAYER_GOD_LIST,39,7,101,211,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "",IDC_GODSTUFF_FPS,177,7,31,8,SS_SUNKEN
LTEXT "FPS",IDC_STATIC,154,7,16,8
LTEXT "Player ",IDC_STATIC,7,7,20,12
EDITTEXT IDC_GODSTUFF_BROADCAST,7,47,201,12,ES_MULTILINE
LTEXT "Server Message",IDC_STATIC,7,39,54,8
PUSHBUTTON "Send",IDC_GODSTUFF_SENDMESS,7,59,70,13
LISTBOX IDC_GOD_CHAT,7,84,201,162,LBS_NOINTEGRALHEIGHT |
LBS_NOSEL | WS_VSCROLL | WS_TABSTOP
END
IDD_DEBUG_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debug"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Standalone State :",IDC_STATIC,7,7,61,11
LTEXT "",IDC_STANDALONE_STATE,71,7,125,11,SS_SUNKEN
END
IDD_GEN DIALOG DISCARDABLE 0, 0, 186, 95
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
CTEXT "",IDC_FIELD1,27,11,136,8
CTEXT "",IDC_FIELD2,28,30,130,8
CTEXT "",IDC_FIELD3,27,49,138,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"DEBUG_MENU", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 178
TOPMARGIN, 7
BOTTOMMARGIN, 152
END
"FIND_DIALOG", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 112
TOPMARGIN, 7
BOTTOMMARGIN, 40
END
IDD_CONNECT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_MULTI, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 206
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_PLAYER_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 6
BOTTOMMARGIN, 246
END
IDD_GODSTUFF, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_DEBUG_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_GEN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 5
BOTTOMMARGIN, 88
END
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Volition Inc.\0"
VALUE "FileDescription", "FreeSpace\0"
VALUE "FileVersion", "1.03.01\0"
VALUE "InternalName", "FreeSpace\0"
VALUE "LegalCopyright", "Copyright © 1998\0"
VALUE "OriginalFilename", "fs.exe\0"
VALUE "ProductName", "FreeSpace\0"
VALUE "ProductVersion", "1.03.01\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_GOAL_INC BITMAP DISCARDABLE "goal_inc.bmp"
IDB_GOAL_COMP BITMAP DISCARDABLE "goal_com.bmp"
IDB_GOAL_ORD BITMAP DISCARDABLE "goal_ord.bmp"
IDB_GOAL_NONE BITMAP DISCARDABLE "goal_none.bmp"
IDB_GOAL_FAIL BITMAP DISCARDABLE "goal_fail.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APP_ICON ICON DISCARDABLE "app_icon.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,93 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by FreeSpace.rc
//
#define IDD_DEBUG_MENU 101
#define IDD_CONNECT 108
#define IDD_MULTI 109
#define IDC_CURSOR1 111
#define IDC_CURSOR2 112
#define IDD_PLAYER_DIALOG 114
#define IDD_GODSTUFF 115
#define IDD_DEBUG_DIALOG 116
#define IDB_GOAL_INC 118
#define IDB_GOAL_COMP 119
#define IDB_GOAL_ORD 120
#define IDB_GOAL_NONE 121
#define IDB_GOAL_FAIL 122
#define IDI_APP_ICON 124
#define IDD_GEN 127
#define IDC_LIST_DEBUG 1000
#define IDC_DEBUG_TEXT1 1001
#define IDC_DEBUG_TEXT2 1002
#define IDC_TEXT 1003
#define IDC_HOST_IS 1005
#define IDC_CONPING 1007
#define IDC_RESET_MULTI 1011
#define IDC_STANDALONE_STATE 1012
#define IDC_STATIC_A 1013
#define IDC_STANDALONE_FPS 1014
#define IDC_STATIC_A2 1015
#define IDC_STANDALONE_MTIME 1016
#define IDC_PLAYER_LIST 1016
#define IDC_PSHIP_TYPE 1017
#define IDC_NETPLAYER_NUM 1018
#define IDC_PHITS 1019
#define IDC_PBHHITS 1020
#define IDC_PPCT 1021
#define IDC_PBHPCT 1022
#define IDC_SSHOTS 1023
#define IDC_MPSHOTS 1024
#define IDC_PLAYER_GOD_LIST 1026
#define IDC_SECHITS 1028
#define IDC_SBHHITS 1029
#define IDC_SPCT 1030
#define IDC_SBHPCT 1031
#define IDC_MPHITS 1032
#define IDC_MPBHHITS 1033
#define IDC_MPPCT 1034
#define IDC_MPBHPCT 1035
#define IDC_MSSHOTS 1036
#define IDC_MSECHITS 1037
#define IDC_MSBHHITS 1038
#define IDC_MSPCT 1039
#define IDC_MSBHPCT 1040
#define IDC_PSHOTS 1041
#define IDC_PING_TIME 1042
#define IDC_MISSION_NAME 1043
#define IDC_GODSTUFF_BROADCAST 1044
#define IDC_GODSTUFF_SENDMESS 1045
#define IDC_STD_GOALS 1049
#define IDC_PLAYER_MESSAGES 1051
#define IDC_ASSISTS 1052
#define IDC_MASSISTS 1053
#define IDC_KICK_BUTTON 1054
#define IDC_STD_NAME 1055
#define IDC_NG_MAXPLAYERS 1057
#define IDC_NG_MAXOBSERVERS 1058
#define IDC_NG_SECURITY 1059
#define IDC_NG_RESPAWNS 1060
#define IDC_GOD_CHAT 1061
#define IDC_STD_HOST_PASSWD 1062
#define IDC_FIELD1 1064
#define IDC_FIELD2 1065
#define IDC_FIELD3 1066
#define IDC_PXO_REFRESH 1067
#define IDC_CON_COUNT 2000
#define IDC_FRAMECAP_STATIC 2001
#define IDC_GODSTUFF_FPS 2002
#define IDC_PINFO_PING 2003
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 128
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1068
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

+116
View File
@@ -0,0 +1,116 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Freespace2/LevelPaging.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Code to page in all the bitmaps at the beginning of a level.
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 4 8/19/99 10:12a Alanl
* preload mission-specific messages on machines greater than 48MB
*
* 3 8/10/99 6:54p Dave
* Mad optimizations. Added paging to the nebula effect.
*
* 2 10/07/98 10:54a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 6 5/23/98 4:14p John
* Added code to preload textures to video card for AGP. Added in code
* to page in some bitmaps that weren't getting paged in at level start.
*
* 5 4/05/98 4:15p Dave
* Fixed a weapons model paging problem with the standalone server.
*
* 4 4/01/98 5:34p John
* Made only the used POFs page in for a level. Reduced some interp
* arrays. Made custom detail level work differently.
*
* 3 3/29/98 4:05p John
* New paging code that loads everything necessary at level startup.
*
* 2 3/26/98 5:26p John
* added new paging code. nonfunctional.
*
* 1 3/26/98 5:14p John
*
* $NoKeywords: $
*/
#include "freespace2/freespace.h"
#include "bmpman/bmpman.h"
#include "freespace2/levelpaging.h"
// All the page in functions
extern void ship_page_in();
extern void debris_page_in();
extern void particle_page_in();
extern void stars_page_in();
extern void hud_page_in();
extern void radar_page_in();
extern void weapons_page_in();
extern void fireballs_page_in();
extern void shockwave_page_in();
extern void shield_hit_page_in();
extern void asteroid_page_in();
extern void training_mission_page_in();
extern void neb2_page_in();
extern void message_pagein_mission_messages();
// Pages in all the texutures for the currently
// loaded mission. Call game_busy() occasionally...
void level_page_in()
{
mprintf(( "Beginning level bitmap paging...\n" ));
if(!(Game_mode & GM_STANDALONE_SERVER)){
bm_page_in_start();
}
// Most important ones first
ship_page_in();
weapons_page_in();
fireballs_page_in();
particle_page_in();
debris_page_in();
hud_page_in();
radar_page_in();
training_mission_page_in();
stars_page_in();
shockwave_page_in();
shield_hit_page_in();
asteroid_page_in();
neb2_page_in();
// preload mission messages if NOT running low-memory (greater than 48MB)
if (game_using_low_mem() == false) {
message_pagein_mission_messages();
}
if(!(Game_mode & GM_STANDALONE_SERVER)){
bm_page_in_stop();
}
mprintf(( "Ending level bitmap paging...\n" ));
}
+40
View File
@@ -0,0 +1,40 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/FREESPACE2/LevelPaging.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:22 $
* $Author: penguin $
*
* Code to page in all the bitmaps at the beginning of a level.
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 2 10/07/98 10:54a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 1 3/26/98 5:14p John
*
* $NoKeywords: $
*/
#ifndef _LEVELPAGING_H
#define _LEVELPAGING_H
// Call this and it calls the page in code for all the subsystems
void level_page_in();
#endif //_LEVELPAGING_H
+916
View File
@@ -0,0 +1,916 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/GameHelp/ContextHelp.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Functions to drive the context-sensitive help
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/03 22:07:08 mharris
* got some stuff to compile
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 16 8/22/99 4:22p Jefff
* removed 2nd tech room overlay stuff
*
* 15 8/09/99 5:54p Jefff
* tech room overlay changes
*
* 14 7/27/99 7:18p Jefff
* fixed a debug function for adjsuting overlays in-game
*
* 13 7/20/99 1:49p Dave
* Peter Drake build. Fixed some release build warnings.
*
* 12 7/16/99 10:07a Jefff
* Removed legacy bitmap overlay code
*
* 11 7/16/99 10:04a Jefff
*
* 10 7/15/99 9:20a Andsager
* FS2_DEMO initial checkin
*
* 9 7/11/99 6:40p Jefff
*
* 8 7/08/99 6:25p Jefff
* got new help system working
*
* 7 6/03/99 10:15p Dave
* Put in temporary main hall screen.
*
* 6 3/25/99 8:32p Neilk
* temporary barracks help removal
*
* 5 2/15/99 9:37a Dave
* Removed infinite loop from context help parse code.
*
* 4 2/11/99 4:05p Neilk
* Temporary checkin
*
* 3 1/29/99 2:37p Neilk
* foundation for a new help system
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 92 5/06/98 11:49p Lawrance
* Add help overlay for command brief
*
* 91 5/05/98 1:49a Lawrance
* Add in missing help overlays
*
* 90 4/25/98 2:00p Dave
* Installed a bunch of multiplayer context help screens. Reworked ingame
* join ship select screen. Fix places where network timestamps get hosed.
*
* 89 4/20/98 12:03a Lawrance
* make gray help shader lighter
*
* 88 4/11/98 7:59p Lawrance
* Add support for help overlays
*
* 87 3/12/98 5:36p John
* Took out any unused shaders. Made shader code take rgbc instead of
* matrix and vector since noone used it like a matrix and it would have
* been impossible to do in hardware. Made Glide implement a basic
* shader for online help.
*
* 86 3/09/98 9:55p Lawrance
* split off gameplay help, rip out obsolete code
*
* 85 3/05/98 11:15p Hoffoss
* Changed non-game key checking to use game_check_key() instead of
* game_poll().
*
* 84 2/28/98 9:47p Lawrance
* Fix couple of typos
*
* 83 2/28/98 7:02p Lawrance
* overhaul on-line help
*
*/
#include <string.h>
#include <setjmp.h>
#include "gamehelp/contexthelp.h"
#include "gamesequence/gamesequence.h"
#include "freespace2/freespace.h"
#include "menuui/mainhallmenu.h"
#include "io/key.h"
#include "bmpman/bmpman.h"
#include "graphics/2d.h"
#include "io/timer.h"
#include "math.h"
#include "io/mouse.h"
#include "controlconfig/controlsconfig.h"
#include "menuui/techmenu.h"
#include "parse/parselo.h"
#include "localization/localize.h"
#include "globalincs/alphacolors.h"
////////////////////////////////////////////////////////////////////
// private function prototypes / structs
////////////////////////////////////////////////////////////////////
void parse_helptbl();
void help_overlay_blit(int overlay_id);
void help_overlay_init();
typedef struct {
int x_begin, y_begin, x_end, y_end;
} help_line;
typedef struct {
vector vtx[HELP_MAX_PLINE_VERTICES];
vector *pvtx[HELP_MAX_PLINE_VERTICES];
int vtxcount;
} help_pline;
typedef struct {
int x_coord, y_coord;
char* string;
} help_text;
typedef struct {
int x_coord, y_coord;
} help_left_bracket;
typedef struct {
int x_coord, y_coord;
} help_right_bracket;
typedef struct {
help_pline plinelist[GR_NUM_RESOLUTIONS][HELP_MAX_ITEM];
help_text textlist[GR_NUM_RESOLUTIONS][HELP_MAX_ITEM];
help_left_bracket lbracketlist[GR_NUM_RESOLUTIONS][HELP_MAX_ITEM];
help_right_bracket rbracketlist[GR_NUM_RESOLUTIONS][HELP_MAX_ITEM];
int plinecount;
int textcount;
int lbracketcount;
int rbracketcount;
} help_overlay;
// new help.tbl file way
char *help_overlay_section_names[MAX_HELP_OVERLAYS] = {
"$ship", // ship_help
"$weapon", // weapon_help
"$briefing", // briefing
"$main", // main help overlay
"$barracks", // barracks
"$control", // control help
"$debrief", // debrief help
"$multicreate", // multicreate help
"$multistart", // multistart help
"$multijoin", // multijoin help
"$main2", // main help overlay2
"$hotkey", // hotkey help
"$campaign", // campaign help
"$simulator", // simulator help
"$tech", // tech help
"$command" // command help
};
////////////////////////////////////////////////////////////////////
// Game-wide globals
////////////////////////////////////////////////////////////////////
shader Grey_shader;
////////////////////////////////////////////////////////////////////
// Module globals
////////////////////////////////////////////////////////////////////
static int help_left_bracket_bitmap;
static int help_right_bracket_bitmap;
static help_overlay help_overlaylist[MAX_HELP_OVERLAYS];
static int current_helpid = -1; // the currently active overlay_id, only really used for the debug console funxions
int Help_overlay_flags;
static int Source_game_state; // state from where F1 was pressed
////////////////////////////////////////////////////////////////////
// Public Functions
////////////////////////////////////////////////////////////////////
// query whether a help overlay is active (ie being displayed)
int help_overlay_active(int overlay_id)
{
Assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS);
return Help_overlay_flags & (1<<overlay_id);
}
// stop displaying a help overlay
void help_overlay_set_state(int overlay_id, int state)
{
Assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS);
if ( state > 0 ) {
Help_overlay_flags |= (1<<overlay_id);
current_helpid = overlay_id;
} else {
Help_overlay_flags &= ~(1<<overlay_id);
//current_helpid = -1;
}
}
// load in the bitmap for a help overlay
// FIXME - leftover from the old bitmap overlay days - prune this out sometime
void help_overlay_load(int overlay_id)
{
return;
}
// unload a bitmap of a help overlay
// FIXME - leftover from the old bitmap overlay days - prune this out sometime
void help_overlay_unload(int overlay_id)
{
return;
}
// maybe blit a bitmap of a help overlay to the screen
void help_overlay_maybe_blit(int overlay_id)
{
Assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS);
if ( Help_overlay_flags & (1<<overlay_id) ) {
context_help_grey_screen();
help_overlay_blit(overlay_id);
}
}
// reset the flags for the help overlays
void help_overlay_reset_all()
{
Help_overlay_flags = 0;
}
// Set up Grey_shader, which is used game-wide to grey out background when using help overlays
void create_grey_shader()
{
float tmp,c;
tmp = 0.4f/3.0f;
// The c matrix brightens everything a bit.
// c = 0.125f;
c = 0.110f;
gr_create_shader( &Grey_shader, tmp, tmp, tmp, c );
}
// called at game startup to init all help related data
void context_help_init()
{
create_grey_shader();
help_overlay_reset_all();
help_overlay_init();
}
void context_help_grey_screen()
{
gr_set_shader(&Grey_shader);
gr_shade(0,0,gr_screen.clip_width, gr_screen.clip_height);
}
// launch_context_help() will switch to a context sensitive help state
void launch_context_help()
{
// look at the state the game was in when F1 was pressed
Source_game_state = gameseq_get_state();
switch (Source_game_state) {
case GS_STATE_MAIN_MENU:
#if !defined(PRESS_TOUR_BUILD) && !defined(PD_BUILD)
int main_hall_num;
main_hall_num = (main_hall_id() == 0) ? MH_OVERLAY : MH2_OVERLAY;
if ( !help_overlay_active(main_hall_num) ) {
help_overlay_set_state(main_hall_num, 1);
}
else {
help_overlay_set_state(main_hall_num, 0);
}
#endif
break;
case GS_STATE_GAME_PLAY:
case GS_STATE_GAME_PAUSED:
case GS_STATE_TRAINING_PAUSED:
gameseq_post_event(GS_EVENT_GAMEPLAY_HELP);
break;
case GS_STATE_BRIEFING:
if ( !help_overlay_active(BR_OVERLAY) ) {
help_overlay_set_state(BR_OVERLAY, 1);
}
else {
help_overlay_set_state(BR_OVERLAY, 0);
}
break;
case GS_STATE_SHIP_SELECT:
if ( !help_overlay_active(SS_OVERLAY) ) {
help_overlay_set_state(SS_OVERLAY, 1);
}
else {
help_overlay_set_state(SS_OVERLAY, 0);
}
break;
case GS_STATE_WEAPON_SELECT:
if ( !help_overlay_active(WL_OVERLAY) ) {
help_overlay_set_state(WL_OVERLAY, 1);
}
else {
help_overlay_set_state(WL_OVERLAY, 0);
}
break;
case GS_STATE_BARRACKS_MENU:
if ( !help_overlay_active(BARRACKS_OVERLAY) ) {
help_overlay_set_state(BARRACKS_OVERLAY, 1);
}
else {
help_overlay_set_state(BARRACKS_OVERLAY, 0);
}
break;
case GS_STATE_CONTROL_CONFIG:
if ( !help_overlay_active(CONTROL_CONFIG_OVERLAY) ) {
help_overlay_set_state(CONTROL_CONFIG_OVERLAY, 1);
}
else {
help_overlay_set_state(CONTROL_CONFIG_OVERLAY, 0);
}
break;
case GS_STATE_DEBRIEF:
if ( !help_overlay_active(DEBRIEFING_OVERLAY) ) {
help_overlay_set_state(DEBRIEFING_OVERLAY, 1);
}
else {
help_overlay_set_state(DEBRIEFING_OVERLAY, 0);
}
break;
case GS_STATE_MULTI_HOST_SETUP:
if ( !help_overlay_active(MULTI_CREATE_OVERLAY) ) {
help_overlay_set_state(MULTI_CREATE_OVERLAY, 1);
}
else {
help_overlay_set_state(MULTI_CREATE_OVERLAY, 0);
}
break;
case GS_STATE_MULTI_START_GAME:
if ( !help_overlay_active(MULTI_START_OVERLAY) ) {
help_overlay_set_state(MULTI_START_OVERLAY, 1);
}
else {
help_overlay_set_state(MULTI_START_OVERLAY, 0);
}
break;
case GS_STATE_MULTI_JOIN_GAME:
if ( !help_overlay_active(MULTI_JOIN_OVERLAY) ) {
help_overlay_set_state(MULTI_JOIN_OVERLAY, 1);
}
else {
help_overlay_set_state(MULTI_JOIN_OVERLAY, 0);
}
break;
case GS_STATE_HOTKEY_SCREEN:
if ( !help_overlay_active(HOTKEY_OVERLAY) ) {
help_overlay_set_state(HOTKEY_OVERLAY, 1);
}
else {
help_overlay_set_state(HOTKEY_OVERLAY, 0);
}
break;
case GS_STATE_CAMPAIGN_ROOM:
if ( !help_overlay_active(CAMPAIGN_ROOM_OVERLAY) ) {
help_overlay_set_state(CAMPAIGN_ROOM_OVERLAY, 1);
}
else {
help_overlay_set_state(CAMPAIGN_ROOM_OVERLAY, 0);
}
break;
case GS_STATE_SIMULATOR_ROOM:
if ( !help_overlay_active(SIM_ROOM_OVERLAY) ) {
help_overlay_set_state(SIM_ROOM_OVERLAY, 1);
}
else {
help_overlay_set_state(SIM_ROOM_OVERLAY, 0);
}
break;
case GS_STATE_TECH_MENU: {
if ( !help_overlay_active(TECH_ROOM_OVERLAY) ) {
help_overlay_set_state(TECH_ROOM_OVERLAY, 1);
}
else {
help_overlay_set_state(TECH_ROOM_OVERLAY, 0);
}
break;
}
case GS_STATE_CMD_BRIEF:
if ( !help_overlay_active(CMD_BRIEF_OVERLAY) ) {
help_overlay_set_state(CMD_BRIEF_OVERLAY, 1);
}
else {
help_overlay_set_state(CMD_BRIEF_OVERLAY, 0);
}
break;
default:
nprintf(("Warning","WARNING ==> There is no context help available for state %s\n", GS_state_text[Source_game_state-1]));
break;
} // end switch
}
// Called once at the beginning of the game to load help bitmaps & data
void help_overlay_init()
{
// load right_bracket bitmap
help_right_bracket_bitmap = bm_load("right_bracket");
if(help_right_bracket_bitmap < 0){
// we failed to load the bitmap - this is very bad
Int3();
}
// load left_bracket bitmap
help_left_bracket_bitmap = bm_load("left_bracket");
if(help_left_bracket_bitmap < 0){
// we failed to load the bitmap - this is very bad
Int3();
}
// parse help.tbl
parse_helptbl();
}
// parses help.tbl and populates help_overlaylist[]
void parse_helptbl()
{
int overlay_id, currcount;
char buf[HELP_MAX_STRING_LENGTH + 1];
int i;
// open localization
lcl_ext_open();
read_file_text(HELP_OVERLAY_FILENAME);
// for each overlay...
for (overlay_id=0; overlay_id<MAX_HELP_OVERLAYS; overlay_id++) {
reset_parse();
skip_to_string(help_overlay_section_names[overlay_id]);
// clear out counters in the overlay struct
help_overlaylist[overlay_id].plinecount = 0;
help_overlaylist[overlay_id].textcount = 0;
help_overlaylist[overlay_id].rbracketcount = 0;
help_overlaylist[overlay_id].lbracketcount = 0;
// read in all elements for this overlay
while (!(check_for_string("$end"))) {
if (optional_string("+pline")) {
currcount = help_overlaylist[overlay_id].plinecount;
int a, b; // temp vars to read in int before cast to float;
if (currcount < HELP_MAX_ITEM) {
// read number of pline vertices
stuff_int(&help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtxcount); // note that it is read into GR_640
// help_overlaylist[overlay_id].plinelist[GR_1024][currcount].vtxcount = help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtxcount; // set equal to 1024 version vertex count to prevent bugs
Assert(help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtxcount <= HELP_MAX_PLINE_VERTICES);
// get 640x480 vertex coordinates
for (i=0; i<help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtxcount; i++) {
stuff_int(&a);
stuff_int(&b);
help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtx[i].xyz.x = (float)a;
help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtx[i].xyz.y = (float)b;
help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtx[i].xyz.z = 0.0f;
help_overlaylist[overlay_id].plinelist[GR_640][currcount].pvtx[i] = &help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtx[i];
}
// get 1024x768 vertex coordinates
for (i=0; i<help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtxcount; i++) {
stuff_int(&a);
stuff_int(&b);
help_overlaylist[overlay_id].plinelist[GR_1024][currcount].vtx[i].xyz.x = (float)a;
help_overlaylist[overlay_id].plinelist[GR_1024][currcount].vtx[i].xyz.y = (float)b;
help_overlaylist[overlay_id].plinelist[GR_1024][currcount].vtx[i].xyz.z = 0.0f;
help_overlaylist[overlay_id].plinelist[GR_1024][currcount].pvtx[i] = &help_overlaylist[overlay_id].plinelist[GR_1024][currcount].vtx[i];
}
}
//mprintf(("Found pline - start location (%f,%f), end location (%f,%f)\n", help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtx[0].xyz.x, help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtx[0].xyz.y, help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtx[2].xyz.x, help_overlaylist[overlay_id].plinelist[GR_640][currcount].vtx[2].xyz.y));
help_overlaylist[overlay_id].plinecount++;
} else if (optional_string("+text")) {
currcount = help_overlaylist[overlay_id].textcount;
if (currcount < HELP_MAX_ITEM) {
// get 640x480 coordinates
stuff_int(&(help_overlaylist[overlay_id].textlist[GR_640][currcount].x_coord));
stuff_int(&(help_overlaylist[overlay_id].textlist[GR_640][currcount].y_coord));
// get 1024x768 coordinates
stuff_int(&(help_overlaylist[overlay_id].textlist[GR_1024][currcount].x_coord));
stuff_int(&(help_overlaylist[overlay_id].textlist[GR_1024][currcount].y_coord));
// get string (always use the GR_640 one)
stuff_string(buf, F_MESSAGE, NULL);
help_overlaylist[overlay_id].textlist[GR_640][currcount].string = strdup(buf);
//mprintf(("Found text %d on overlay %d - location (%d,%d) @ 640x480 :: location (%d,%d) @ 1024x768\n", currcount, overlay_id, help_overlaylist[overlay_id].textlist[GR_640][currcount].x_coord, help_overlaylist[overlay_id].textlist[GR_640][currcount].y_coord, help_overlaylist[overlay_id].textlist[GR_1024][currcount].x_coord, help_overlaylist[overlay_id].textlist[GR_1024][currcount].x_coord));
help_overlaylist[overlay_id].textcount++;
}
} else if (optional_string("+right_bracket")) {
currcount = help_overlaylist[overlay_id].rbracketcount;
if (currcount < HELP_MAX_ITEM) {
// get 640x480 coordinates
stuff_int(&(help_overlaylist[overlay_id].rbracketlist[GR_640][currcount].x_coord));
stuff_int(&(help_overlaylist[overlay_id].rbracketlist[GR_640][currcount].y_coord));
// get 1024x768 coordinates
stuff_int(&(help_overlaylist[overlay_id].rbracketlist[GR_1024][currcount].x_coord));
stuff_int(&(help_overlaylist[overlay_id].rbracketlist[GR_1024][currcount].y_coord));
//mprintf(("Found rbracket %d on overlay %d - location (%d,%d) @ 640x480 :: location (%d,%d) @ 1024x768\n", currcount, overlay_id, help_overlaylist[overlay_id].rbracketlist[GR_640][currcount].x_coord, help_overlaylist[overlay_id].rbracketlist[GR_640][currcount].y_coord, help_overlaylist[overlay_id].rbracketlist[GR_1024][currcount].x_coord, help_overlaylist[overlay_id].rbracketlist[GR_1024][currcount].y_coord));
help_overlaylist[overlay_id].rbracketcount++;
}
} else if (optional_string("+left_bracket")) {
currcount = help_overlaylist[overlay_id].lbracketcount;
if (currcount < HELP_MAX_ITEM) {
// get 640x480 coordinates
stuff_int(&(help_overlaylist[overlay_id].lbracketlist[GR_640][currcount].x_coord));
stuff_int(&(help_overlaylist[overlay_id].lbracketlist[GR_640][currcount].y_coord));
// get 1024x768 coordinates
stuff_int(&(help_overlaylist[overlay_id].lbracketlist[GR_1024][currcount].x_coord));
stuff_int(&(help_overlaylist[overlay_id].lbracketlist[GR_1024][currcount].y_coord));
//mprintf(("Found lbracket %d on overlay %d - location (%d,%d) @ 640x480 :: location (%d,%d) @ 1024x768\n", currcount, overlay_id, help_overlaylist[overlay_id].lbracketlist[GR_640][currcount].x_coord, help_overlaylist[overlay_id].lbracketlist[GR_640][currcount].y_coord, help_overlaylist[overlay_id].lbracketlist[GR_1024][currcount].x_coord, help_overlaylist[overlay_id].lbracketlist[GR_1024][currcount].y_coord));
help_overlaylist[overlay_id].lbracketcount++;
}
} else {
// help.tbl is corrupt
Assert(0);
} // end if
} // end while
} // end for
// close localization
lcl_ext_close();
}
// draw overlay on the screen
void help_overlay_blit(int overlay_id)
{
int idx, width, height;
int plinecount = help_overlaylist[overlay_id].plinecount;
int textcount = help_overlaylist[overlay_id].textcount;
int rbracketcount = help_overlaylist[overlay_id].rbracketcount;
int lbracketcount = help_overlaylist[overlay_id].lbracketcount;
Assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS);
// this draws each line of help text with white on black text (use the GR_640 index for the string)
for (idx = 0; idx < textcount; idx++) {
gr_set_color_fast(&Color_black);
gr_get_string_size(&width, &height, help_overlaylist[overlay_id].textlist[GR_640][idx].string, strlen(help_overlaylist[overlay_id].textlist[GR_640][idx].string));
gr_rect(help_overlaylist[overlay_id].textlist[gr_screen.res][idx].x_coord-2*HELP_PADDING, help_overlaylist[overlay_id].textlist[gr_screen.res][idx].y_coord-3*HELP_PADDING, width+4*HELP_PADDING, height+4*HELP_PADDING);
gr_set_color_fast(&Color_bright_white);
gr_printf(help_overlaylist[overlay_id].textlist[gr_screen.res][idx].x_coord, help_overlaylist[overlay_id].textlist[gr_screen.res][idx].y_coord, help_overlaylist[overlay_id].textlist[GR_640][idx].string);
}
// this draws each right bracket
for (idx = 0; idx < rbracketcount; idx++) {
gr_set_bitmap(help_right_bracket_bitmap);
gr_bitmap(help_overlaylist[overlay_id].rbracketlist[gr_screen.res][idx].x_coord, help_overlaylist[overlay_id].rbracketlist[gr_screen.res][idx].y_coord);
}
// this draws each left bracket
for (idx = 0; idx < lbracketcount; idx++) {
gr_set_bitmap(help_left_bracket_bitmap);
gr_bitmap(help_overlaylist[overlay_id].lbracketlist[gr_screen.res][idx].x_coord, help_overlaylist[overlay_id].lbracketlist[gr_screen.res][idx].y_coord);
}
// this draws each 2d line for the help screen
//gr_set_color_fast(&Color_yellow);
gr_set_color(255, 255, 0);
for (idx = 0; idx<plinecount; idx++) {
gr_pline_special(help_overlaylist[overlay_id].plinelist[gr_screen.res][idx].pvtx , help_overlaylist[overlay_id].plinelist[GR_640][idx].vtxcount, HELP_PLINE_THICKNESS);
}
}
// --------------------------------------------------
// DEBUGGING STUFF
// --------------------------------------------------
DCF(help_reload, "Reloads help overlay data from help.tbl")
{
if (Dc_command) {
parse_helptbl();
}
if (Dc_help) {
dc_printf( "Usage: sample\nCrashes your machine.\n" );
}
if (Dc_status) {
dc_printf( "Yes, my master." );
}
}
int h_textnum=0, h_amt=0, h_vtx = 0;
void nudgetext_x(int textnum, int amount)
{
help_overlaylist[current_helpid].textlist[gr_screen.res][textnum].x_coord += amount;
}
void nudgetext_y(int textnum, int amount)
{
help_overlaylist[current_helpid].textlist[gr_screen.res][textnum].y_coord += amount;
}
void nudgepline_x(int plinenum, int plinevert, int amount)
{
help_overlaylist[current_helpid].plinelist[gr_screen.res][plinenum].vtx[plinevert].xyz.x += amount;
}
void nudgepline_y(int plinenum, int plinevert, int amount)
{
help_overlaylist[current_helpid].plinelist[gr_screen.res][plinenum].vtx[plinevert].xyz.y += amount;
}
void nudgerbracket_x(int num, int amount)
{
help_overlaylist[current_helpid].rbracketlist[gr_screen.res][num].x_coord += amount;
}
void nudgerbracket_y(int num, int amount)
{
help_overlaylist[current_helpid].rbracketlist[gr_screen.res][num].y_coord += amount;
}
void nudgelbracket_x(int num, int amount)
{
help_overlaylist[current_helpid].lbracketlist[gr_screen.res][num].x_coord += amount;
}
void nudgelbracket_y(int num, int amount)
{
help_overlaylist[current_helpid].lbracketlist[gr_screen.res][num].y_coord += amount;
}
void showtextpos(int textnum)
{
dc_printf("text %d is now located at (%d, %d)", textnum, help_overlaylist[current_helpid].textlist[gr_screen.res][textnum].x_coord, help_overlaylist[current_helpid].textlist[gr_screen.res][textnum].y_coord );
}
void showrbracketpos(int num)
{
dc_printf("rbracket %d is now located at (%d, %d)", num, help_overlaylist[current_helpid].rbracketlist[gr_screen.res][num].x_coord, help_overlaylist[current_helpid].rbracketlist[gr_screen.res][num].y_coord );
}
void showlbracketpos(int num)
{
dc_printf("lbracket %d on overlay %d is now located at (%d, %d)", num, current_helpid, help_overlaylist[current_helpid].lbracketlist[gr_screen.res][num].x_coord, help_overlaylist[current_helpid].lbracketlist[gr_screen.res][num].y_coord );
}
void showplinepos(int plinenum)
{
int i;
dc_printf("pline %d on overlay %d vertices are now ", plinenum, current_helpid, help_overlaylist[current_helpid].textlist[gr_screen.res][plinenum].y_coord );
for (i=0; i<help_overlaylist[current_helpid].plinelist[GR_640][plinenum].vtxcount; i++)
{
dc_printf("(%3.0f %3.0f) ", help_overlaylist[current_helpid].plinelist[gr_screen.res][plinenum].vtx[i].xyz.x, help_overlaylist[current_helpid].plinelist[gr_screen.res][plinenum].vtx[i].xyz.y);
}
}
DCF(help_nudgetext_x, "Use to visually position overlay text.")
{
if (Dc_command) {
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_textnum = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_amt = Dc_arg_int;
}
nudgetext_x(h_textnum, h_amt);
}
if (Dc_help) {
dc_printf( "Usage: sample\nCrashes your machine.\n" );
}
if (Dc_status) {
showtextpos(h_textnum);
}
}
DCF(help_nudgetext_y, "Use to visually position overlay text.")
{
if (Dc_command) {
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_textnum = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_amt = Dc_arg_int;
}
nudgetext_y(h_textnum, h_amt);
}
if (Dc_help) {
dc_printf( "Usage: sample\nCrashes your machine.\n" );
}
if (Dc_status) {
showtextpos(h_textnum);
}
}
DCF(help_nudgepline_x, "Use to visually position overlay polylines.")
{
if (Dc_command) {
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_textnum = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_vtx = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_amt = Dc_arg_int;
}
nudgepline_x(h_textnum, h_vtx, h_amt);
}
if (Dc_help) {
dc_printf( "Usage: help_nudgepline [pline_number] [vertex_number] [distance]\n" );
}
if (Dc_status) {
showplinepos(h_textnum);
}
}
DCF(help_nudgepline_y, "Use to visually position overlay polylines.")
{
if (Dc_command) {
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_textnum = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_vtx = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_amt = Dc_arg_int;
}
nudgepline_y(h_textnum, h_vtx, h_amt);
}
if (Dc_help) {
dc_printf( "Usage: help_nudgepline [pline_number] [vertex_number] [distance]\n" );
}
if (Dc_status) {
showplinepos(h_textnum);
}
}
DCF(help_nudgerbracket_x, "Use to visually position overlay right bracket.")
{
if (Dc_command) {
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_textnum = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_amt = Dc_arg_int;
}
nudgerbracket_x(h_textnum, h_amt);
}
if (Dc_help) {
dc_printf( "Usage: help_nudgerbracket_x [num] [amount]\n" );
}
if (Dc_status) {
showrbracketpos(h_textnum);
}
}
DCF(help_nudgerbracket_y, "Use to visually position overlay right bracket.")
{
if (Dc_command) {
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_textnum = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_amt = Dc_arg_int;
}
nudgerbracket_y(h_textnum, h_amt);
}
if (Dc_help) {
dc_printf( "Usage: help_nudgerbracket_y [num] [amount]\n" );
}
if (Dc_status) {
showrbracketpos(h_textnum);
}
}
DCF(help_nudgelbracket_x, "Use to visually position overlay left bracket.")
{
if (Dc_command) {
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_textnum = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_amt = Dc_arg_int;
}
nudgelbracket_x(h_textnum, h_amt);
}
if (Dc_help) {
dc_printf( "Usage: help_nudgelbracket_x [num] [amount]\n" );
}
if (Dc_status) {
showlbracketpos(h_textnum);
}
}
DCF(help_nudgelbracket_y, "Use to visually position overlay left bracket.")
{
if (Dc_command) {
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_textnum = Dc_arg_int;
}
dc_get_arg(ARG_INT);
if(Dc_arg_type & ARG_INT){
h_amt = Dc_arg_int;
}
nudgelbracket_y(h_textnum, h_amt);
}
if (Dc_help) {
dc_printf( "Usage: help_nudgelbracket_y [num] [amount]\n" );
}
if (Dc_status) {
showlbracketpos(h_textnum);
}
}
+63
View File
@@ -0,0 +1,63 @@
/*
* 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.
*
*/
// ContextHelp.h
//
//
#ifndef __CONTEXTHELP_H__
#define __CONTEXTHELP_H__
// Help overlays
//
// Adding a help overlay: 1) Add a #define that uniquely identifies your help overlay
// 2) Increment MAX_HELP_OVERLAYS
// 3) Add the filename for the help overlay to Help_overlays[] array in ContextHelp.cpp
//
#define MAX_HELP_OVERLAYS 16 // Must be kept current
#define SS_OVERLAY 0 // ship selection help
#define WL_OVERLAY 1 // weapons loadout help
#define BR_OVERLAY 2 // briefing help
#define MH_OVERLAY 3 // main hall help
#define BARRACKS_OVERLAY 4 // barracks help
#define CONTROL_CONFIG_OVERLAY 5 // control config help
#define DEBRIEFING_OVERLAY 6 // debriefing help
#define MULTI_CREATE_OVERLAY 7 // multi create game help
#define MULTI_START_OVERLAY 8 // multi start game help overlay
#define MULTI_JOIN_OVERLAY 9 // join game help overlay
#define MH2_OVERLAY 10 // main hall 2 help overlay
#define HOTKEY_OVERLAY 11 // hotkey assignment help overlay
#define CAMPAIGN_ROOM_OVERLAY 12 // campaign room help overlay
#define SIM_ROOM_OVERLAY 13 // sim room help overlay
#define TECH_ROOM_OVERLAY 14 // tech room (general) help overlay
#define CMD_BRIEF_OVERLAY 15 // command briefing help overlay
// other help overlay constants
#define HELP_MAX_ITEM 50 // max number of screen elements per element type per overlay
#define HELP_PADDING 1 //
#define HELP_MAX_STRING_LENGTH 128 // max string length for text overlay element
#define HELP_MAX_PLINE_VERTICES 21 // good for 20 segments, can prolly reduce this (FIXME)
#define HELP_PLINE_THICKNESS 2
#define HELP_OVERLAY_FILENAME "help.tbl"
// help overlay calls
int help_overlay_active(int overlay_id);
void help_overlay_set_state(int overlay_id, int state);
void help_overlay_load(int overlay_id);
void help_overlay_unload(int overlay_id);
void help_overlay_maybe_blit(int overlay_id);
void context_help_init(); // called once at game startup
void context_help_grey_screen(); // call to grey out a screen (normally when applying a help overlay)
void launch_context_help();
#endif /* __CONTEXTHELP_H__ */
+954
View File
@@ -0,0 +1,954 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/GameHelp/GameplayHelp.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Module for displaying in-game help
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 8 9/08/99 2:38p Jefff
* sound pausing going to menu from game
*
* 7 9/01/99 2:56p Jefff
* a few control key description changes
*
* 6 7/29/99 4:43p Jefff
* updated for fs2 -- fixed buttons, added "press esc" text, hi-res
* support, the works.
*
* 5 7/15/99 9:20a Andsager
* FS2_DEMO initial checkin
*
* 4 1/30/99 5:08p Dave
* More new hi-res stuff.Support for nice D3D textures.
*
* 3 10/13/98 9:28a Dave
* Started neatening up freespace.h. Many variables renamed and
* reorganized. Added AlphaColors.[h,cpp]
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 21 6/17/98 11:01a Lawrance
* ensure translated descriptions appear in the online help
*
* 20 6/09/98 10:31a Hoffoss
* Created index numbers for all xstr() references. Any new xstr() stuff
* added from here on out should be added to the end if the list. The
* current list count can be found in FreeSpace.cpp (search for
* XSTR_SIZE).
*
* 19 5/17/98 3:33p Lawrance
* Add 'target last ship to send transmission' key to online help
*
* 18 5/15/98 8:36p Lawrance
* Add 'target ship that last sent transmission' target key
*
* 17 5/09/98 4:52p Lawrance
* Implement padlock view (up/rear/left/right)
*
* 16 4/27/98 10:11a Lawrance
* Add in disabled beep for missing buttons
*
* 15 4/25/98 1:25p Lawrance
* Change screen shot key to Print Scrn
*
* 14 4/22/98 2:50p John
* Made PrintScreen actually be Shift+PrintScreen.
*
* 13 4/18/98 9:21p Lawrance
* show correct key binding for screen shots
*
* 12 4/11/98 7:59p Lawrance
* Allow space, tab and enter to cycle through pages
*
* 11 4/05/98 7:44p Lawrance
* remove obsolete 'show goals' binding
*
* 10 4/02/98 11:40a Lawrance
* check for #ifdef DEMO instead of #ifdef DEMO_RELEASE
*
* 9 4/01/98 2:22p Lawrance
* remove hotkey references in on-line help for demo builds
*
* 8 3/31/98 4:57p Lawrance
* update text for taking a screen shot
*
* 7 3/30/98 1:31p Lawrance
* Take out debug key help
*
* 6 3/25/98 5:34p Dave
* First rev of multiplayer online key help.
*
* 5 3/25/98 2:16p Dave
* Select random default image for newly created pilots. Fixed several
* multi-pause messaging bugs. Begin work on online help for multiplayer
* keys.
*
* 4 3/18/98 12:03p John
* Marked all the new strings as externalized or not.
*
* 3 3/16/98 5:53p Lawrance
* Fix bug that was causing joystick only bindings to mess up
*
* 2 3/09/98 9:54p Lawrance
* integrate new art for gameplay help
*
* 1 3/09/98 5:05p Lawrance
*
* $NoKeywords: $
*/
#include "gamehelp/contexthelp.h"
#include "gamesequence/gamesequence.h"
#include "freespace2/freespace.h"
#include "io/key.h"
#include "bmpman/bmpman.h"
#include "graphics/2d.h"
#include "io/timer.h"
#include "math.h"
#include "io/mouse.h"
#include "controlconfig/controlsconfig.h"
#include "ui/ui.h"
#include "gamesnd/gamesnd.h"
#include "missionui/missionscreencommon.h"
#include "globalincs/alphacolors.h"
#include "weapon/beam.h"
#include "sound/audiostr.h"
// text positioning constats
#define TITLE_Y 35
#define Y_START 70
#define X_OFFSET_1 70
// pixel offset for description of key from where key binding starts
#define KEY_DESCRIPTION_OFFSET 193
// different gameplay help pages
#define GP_FIRST_SCREEN 0 // keep up to date
#define GP_HELP_BASIC_KEYS 0
#define GP_HELP_MOVEMENT_KEYS 1
#define GP_HELP_COMMON_TARGET_KEYS 2
#define GP_HELP_ADVANCED_TARGET_KEYS 3
#define GP_HELP_MESSAGING 4
#define GP_HELP_WEAPON_KEYS 5
#define GP_HELP_THROTTLE_AND_ETS_KEYS 6
#define GP_HELP_VIEW_KEYS 7
#define GP_HELP_MISC_KEYS 8
#define GP_HELP_MULTI_KEYS 9
#define GP_LAST_SCREEN_SINGLE 8 // keep up to date
#define GP_LAST_SCREEN_MULTI 9 // keep up to date
// set this to GP_LAST_SCREEN_SINGLE or GP_LAST_SCREEN_MULTI based upon what game mode we're in
int Gp_last_screen;
#define NUM_BUTTONS 3
#define PREVIOUS_PAGE_BUTTON 0
#define NEXT_PAGE_BUTTON 1
#define CONTINUE_BUTTON 2
struct gameplay_help_buttons {
char *filename;
int x, y;
int hotspot;
int tab;
int flags;
UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
gameplay_help_buttons(char *name, int x1, int y1, int h) : filename(name), x(x1), y(y1), hotspot(h) {}
};
static gameplay_help_buttons Buttons[GR_NUM_RESOLUTIONS][NUM_BUTTONS] = {
//XSTR:OFF
{
gameplay_help_buttons("F1B_00", 15, 389, 0),
gameplay_help_buttons("F1B_01", 60, 389, 1),
gameplay_help_buttons("F1B_02", 574, 431, 2)
},
{
gameplay_help_buttons("2_F1B_00", 24, 622, 0),
gameplay_help_buttons("2_F1B_01", 96, 622, 1),
gameplay_help_buttons("2_F1B_02", 919, 689, 2)
},
//XSTR:ON
};
#define GAME_HELP_NUM_TEXT 2
static UI_XSTR Game_help_text[GR_NUM_RESOLUTIONS][GAME_HELP_NUM_TEXT] = {
{ // GR_640
{ "Press ESC to return to the game", 1441, 263, 389, UI_XSTR_COLOR_GREEN, -1, NULL },
{ "Continue", 1069, 571, 413, UI_XSTR_COLOR_GREEN, -1, &Buttons[gr_screen.res][CONTINUE_BUTTON].button }
},
{ // GR_1024
{ "Press ESC to return to the game", 1441, 421, 622, UI_XSTR_COLOR_GREEN, -1, NULL },
{ "Continue", 1069, 928, 663, UI_XSTR_COLOR_GREEN, -1, &Buttons[gr_screen.res][CONTINUE_BUTTON].button }
}
};
static char *Game_help_filename[GR_NUM_RESOLUTIONS] = {
"F1",
"2_F1"
};
static char *Game_help_mask_filename[GR_NUM_RESOLUTIONS] = {
"F1-m",
"2_F1-m"
};
static UI_WINDOW Ui_window;
static int Background_bitmap;
static int Gameplay_help_inited = 0;
static int Current_help_page;
// generate a line for the on-line help for a control item with specified id
// input: id => index for control item within Control_config[]
// buf => buffer with enough space to hold ouput string
char *gameplay_help_control_text(int id, char *buf)
{
int has_key=0, has_joy=0;
config_item *ci;
ci = &Control_config[id];
if ( ci->key_id >= 0 ) {
sprintf(buf, textify_scancode(ci->key_id));
has_key=1;
}
if ( ci->joy_id >= 0 ) {
if ( has_key ) {
strcat(buf, XSTR( ", ", 129));
}
strcat(buf, Joy_button_text[ci->joy_id]);
has_joy=1;
}
if ( !has_key && !has_joy ) {
strcpy(buf, XSTR( "no binding", 130));
}
strcat(buf, XSTR( " - ", 131));
strcat(buf, ci->text);
return buf;
}
void gameplay_help_blit_control_line(int x, int y, int id)
{
int has_key=0, has_joy=0;
char buf[256];
config_item *ci;
ci = &Control_config[id];
buf[0] = 0;
if ( ci->key_id >= 0 ) {
sprintf(buf, textify_scancode(ci->key_id));
has_key=1;
}
if ( ci->joy_id >= 0 ) {
if ( has_key ) {
strcat(buf, XSTR( ", ", 129));
}
strcat(buf, Joy_button_text[ci->joy_id]);
has_joy=1;
}
if ( !has_key && !has_joy ) {
strcpy(buf, XSTR( "no binding", 130));
}
gr_string(x,y,buf);
// gr_string(x+KEY_DESCRIPTION_OFFSET,y,ci->text);
gr_string(x+KEY_DESCRIPTION_OFFSET, y, XSTR(ci->text, CONTROL_CONFIG_XSTR + id));
}
void gameplay_help_blit_control_line_raw(int x, int y, char *control_text, char *control_description)
{
gr_string(x,y,control_text);
gr_string(x+KEY_DESCRIPTION_OFFSET,y,control_description);
}
// game_play_help_set_title() will display the title for the help screen and
// set the font for the rest of the screen
void gameplay_help_set_title(char *title)
{
int sy=TITLE_Y;
char buf[128];
gr_set_color_fast(&Color_bright);
gr_printf(0x8000,sy,title);
sprintf(buf, XSTR( "Page %d of %d", 132), Current_help_page+1, Gp_last_screen+1);
gr_printf(0x8000,sy+gr_get_font_height()+2,buf);
gr_set_color_fast(&Color_normal);
}
// called once when the gameplay help state is entered
void gameplay_help_init()
{
int i;
gameplay_help_buttons *b;
if ( Gameplay_help_inited ) {
return;
}
common_set_interface_palette("InterfacePalette"); // set the interface palette
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Ui_window.set_mask_bmap(Game_help_mask_filename[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[gr_screen.res][i];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, 0, 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// add all xstrs
for (i=0; i<GAME_HELP_NUM_TEXT; i++)
{
Ui_window.add_XSTR(&Game_help_text[gr_screen.res][i]);
}
// set the proper last screen # based upon game mode
if(Game_mode & GM_MULTIPLAYER){
Gp_last_screen = GP_LAST_SCREEN_MULTI;
} else {
Gp_last_screen = GP_LAST_SCREEN_SINGLE;
}
// setup hotkeys so lights flash when keys are pressed
Buttons[gr_screen.res][CONTINUE_BUTTON].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
Buttons[gr_screen.res][PREVIOUS_PAGE_BUTTON].button.set_hotkey(KEY_LEFT);
Buttons[gr_screen.res][NEXT_PAGE_BUTTON].button.set_hotkey(KEY_RIGHT);
Background_bitmap = bm_load(Game_help_filename[gr_screen.res]);
Current_help_page = GP_HELP_BASIC_KEYS;
Gameplay_help_inited = 1;
}
// called when moving to the previous help page
void gameplay_help_goto_prev_screen()
{
Current_help_page--;
if (Current_help_page < GP_FIRST_SCREEN) {
Current_help_page = Gp_last_screen;
}
gamesnd_play_iface(SND_SWITCH_SCREENS);
}
// called when proceeding to the next help page
void gameplay_help_goto_next_screen()
{
Current_help_page++;
if (Current_help_page > Gp_last_screen) {
Current_help_page = GP_FIRST_SCREEN;
}
gamesnd_play_iface(SND_SWITCH_SCREENS);
}
// called when the screen is exited
void gameplay_help_leave()
{
// unpause all game sounds
beam_unpause_sounds();
audiostream_unpause_all();
gameseq_post_event(GS_EVENT_PREVIOUS_STATE);
game_flush();
}
// deal with a keypress on the gameplay help screen
void gameplay_help_process_key(int k)
{
switch ( k ) {
case KEY_ESC:
gameplay_help_leave();
break;
case KEY_ENTER:
case KEY_SPACEBAR:
case KEY_TAB:
//gameplay_help_goto_next_screen();
Buttons[gr_screen.res][NEXT_PAGE_BUTTON].button.press_button();
break;
case KEY_SHIFTED | KEY_TAB:
Buttons[gr_screen.res][PREVIOUS_PAGE_BUTTON].button.press_button();
// gameplay_help_goto_prev_screen();
break;
default:
break;
} // end switch
}
// deal with buttons being pressed on the gameplay help screen
void gameplay_help_button_pressed(int n)
{
switch (n) {
case PREVIOUS_PAGE_BUTTON:
gameplay_help_goto_prev_screen();
break;
case NEXT_PAGE_BUTTON:
gameplay_help_goto_next_screen();
break;
case CONTINUE_BUTTON:
gameplay_help_leave();
gamesnd_play_iface(SND_COMMIT_PRESSED);
break;
default:
Int3();
break;
}
}
// Draw the help text onto the screen
void gameplay_help_draw_text()
{
int x_offset, y_offset, separation;
separation = gr_get_font_height() + 3;
switch ( Current_help_page ) {
case GP_HELP_BASIC_KEYS:
gameplay_help_set_title(XSTR( "Basic Keys", 133));
x_offset=X_OFFSET_1;
y_offset=Y_START;
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,END_MISSION);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,FIRE_PRIMARY);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,MAX_THROTTLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,ZERO_THROTTLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TOGGLE_AUTO_TARGETING);
y_offset += separation;
y_offset += separation;
gr_set_color_fast(&Color_bright);
gr_printf(0x8000,y_offset,XSTR( "Function Keys", 134));
gr_set_color_fast(&Color_normal);
y_offset += separation;
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F1", 135), XSTR( "context-sensitive help", 136));
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F2", 137), XSTR( "options screen (available anywhere in game)", 138));
#ifndef FS2_DEMO
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F3", 139), XSTR( "hotkey assignment", 140));
#endif
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F4", 141), XSTR( "HUD message scroll-back", 142));
#ifndef FS2_DEMO
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F5...F12", 143), XSTR( "hotkeys", 144));
#endif
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "Shift-Esc", 145), XSTR( "quit FreeSpace 2 immediately", 146));
break;
case GP_HELP_MOVEMENT_KEYS:
gameplay_help_set_title(XSTR( "Movement Keys", 147));
x_offset=X_OFFSET_1;
y_offset=Y_START;
gameplay_help_blit_control_line(x_offset, y_offset,FORWARD_THRUST);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,MAX_THROTTLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,ONE_THIRD_THROTTLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TWO_THIRDS_THROTTLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,MINUS_5_PERCENT_THROTTLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,PLUS_5_PERCENT_THROTTLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,ZERO_THROTTLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,AFTERBURNER);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,REVERSE_THRUST);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,PITCH_FORWARD);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,PITCH_BACK);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,YAW_LEFT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,YAW_RIGHT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,BANK_LEFT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,BANK_RIGHT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,BANK_WHEN_PRESSED);
break;
case GP_HELP_COMMON_TARGET_KEYS:
gameplay_help_set_title(XSTR( "Basic Targeting Keys", 148));
x_offset=X_OFFSET_1;
y_offset=Y_START;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TOGGLE_AUTO_TARGETING);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_SHIP_IN_RETICLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_CLOSEST_HOSTILE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_CLOSEST_HOSTILE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_CLOSEST_FRIENDLY);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_CLOSEST_FRIENDLY);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_SUBOBJECT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_SUBOBJECT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_SUBOBJECT_IN_RETICLE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,MATCH_TARGET_SPEED);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TOGGLE_AUTO_MATCH_TARGET_SPEED);
break;
case GP_HELP_ADVANCED_TARGET_KEYS:
gameplay_help_set_title(XSTR( "Advanced Targeting Keys", 149));
x_offset=X_OFFSET_1;
y_offset=Y_START;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_CLOSEST_SHIP_ATTACKING_SELF);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_CLOSEST_SHIP_ATTACKING_TARGET);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_LAST_TRANMISSION_SENDER);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_TARGETS_TARGET);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_ESCORT_SHIP);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_CLOSEST_REPAIR_SHIP);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_UNINSPECTED_CARGO);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_UNINSPECTED_CARGO);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEWEST_SHIP);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_BOMB);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_BOMB);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,STOP_TARGETING_SHIP);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_LIVE_TURRET);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_LIVE_TURRET);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,STOP_TARGETING_SUBSYSTEM);
#ifndef FS2_DEMO
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset, y_offset, XSTR( "F5...F12", 143), XSTR( "Select target assigned to that hotkey", 150));
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset, y_offset, XSTR( "Shift-F5...F12", 151), XSTR( "Add/remove target from that hotkey", 152));
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset, y_offset, XSTR( "Alt-Shift-F5...F12", 153), XSTR( "Clear that hotkey", 154));
#endif
break;
case GP_HELP_MESSAGING:
gameplay_help_set_title(XSTR( "Messaging Keys", 155));
x_offset=X_OFFSET_1;
y_offset=Y_START;
gameplay_help_blit_control_line(x_offset, y_offset,SQUADMSG_MENU);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,REARM_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,ATTACK_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,DISARM_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,DISABLE_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,CAPTURE_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,ENGAGE_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,FORM_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,IGNORE_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,PROTECT_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,COVER_MESSAGE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,WARP_MESSAGE);
#ifndef FS2_DEMO
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset, y_offset, XSTR( "F5...F12", 143), XSTR( "send specified order to these target(s)", 156));
#endif
break;
case GP_HELP_WEAPON_KEYS:
gameplay_help_set_title(XSTR( "Weapon Keys", 157));
x_offset=X_OFFSET_1;
y_offset=Y_START;
gameplay_help_blit_control_line(x_offset, y_offset,FIRE_PRIMARY);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,FIRE_SECONDARY);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,CYCLE_NEXT_PRIMARY);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,CYCLE_PREV_PRIMARY);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,CYCLE_SECONDARY);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,CYCLE_NUM_MISSLES);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,LAUNCH_COUNTERMEASURE);
break;
case GP_HELP_THROTTLE_AND_ETS_KEYS:
gameplay_help_set_title(XSTR( "Energy Management Keys", 158));
x_offset=X_OFFSET_1;
y_offset=Y_START;
gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_EQUALIZE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_XFER_TOP);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_XFER_BOTTOM);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_XFER_LEFT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_XFER_RIGHT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,INCREASE_WEAPON);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,DECREASE_WEAPON);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,INCREASE_SHIELD);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,DECREASE_SHIELD);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,INCREASE_ENGINE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,DECREASE_ENGINE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,ETS_EQUALIZE);
/*
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,XFER_LASER);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,XFER_SHIELD);
*/
break;
case GP_HELP_MISC_KEYS:
gameplay_help_set_title(XSTR( "Miscellaneous Keys", 159));
x_offset=X_OFFSET_1;
y_offset=Y_START;
// ending mission
//
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,END_MISSION);
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "ESC", 160), XSTR( "invoke abort mission popup", 161));
// time compression
//
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TIME_SPEED_UP);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,TIME_SLOW_DOWN);
// radar keys
//
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,RADAR_RANGE_CYCLE);
// escort view keys
//
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,ADD_REMOVE_ESCORT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,ESCORT_CLEAR);
// Pause, Print Screenshot
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "Pause", 162), XSTR( "pause game", 163));
y_offset += separation;
gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "Print Scrn", 164), XSTR( "take screen shot", 165));
break;
case GP_HELP_VIEW_KEYS:
gameplay_help_set_title(XSTR( "View Keys", 166));
x_offset=X_OFFSET_1;
y_offset=Y_START;
gameplay_help_blit_control_line(x_offset, y_offset,PADLOCK_UP);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,PADLOCK_DOWN);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,PADLOCK_LEFT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,PADLOCK_RIGHT);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,VIEW_CHASE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,VIEW_EXTERNAL);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,VIEW_SLEW);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,VIEW_DIST_INCREASE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,VIEW_DIST_DECREASE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,VIEW_CENTER);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,VIEW_OTHER_SHIP);
break;
case GP_HELP_MULTI_KEYS:
gameplay_help_set_title(XSTR( "Multiplayer Keys", 167));
x_offset=X_OFFSET_1;
y_offset=Y_START;
// ingame messaging
gr_set_color_fast(&Color_bright);
gr_printf(0x8000,y_offset,XSTR( "Ingame messaging keys (tap for text, hold for voice)", 168));
gr_set_color_fast(&Color_normal);
y_offset += separation;
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,MULTI_MESSAGE_ALL);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,MULTI_MESSAGE_FRIENDLY);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,MULTI_MESSAGE_HOSTILE);
y_offset += separation;
gameplay_help_blit_control_line(x_offset, y_offset,MULTI_MESSAGE_TARGET);
break;
} // end switch
}
// gameplay_help_do_frame() is the function that displays help when acutally playing the game
void gameplay_help_do_frame(float frametime)
{
int i, k;
// ensure the gameplay help interface has been initialized
if (!Gameplay_help_inited) {
Int3();
return;
}
// make sure game sounds are paused
beam_pause_sounds();
audiostream_pause_all();
k = Ui_window.process() & ~KEY_DEBUGGED;
gameplay_help_process_key(k);
for (i=0; i<NUM_BUTTONS; i++){
if (Buttons[gr_screen.res][i].button.pressed()){
gameplay_help_button_pressed(i);
}
}
GR_MAYBE_CLEAR_RES(Background_bitmap);
if (Background_bitmap >= 0) {
gr_set_bitmap(Background_bitmap);
gr_bitmap(0, 0);
}
Ui_window.draw();
gameplay_help_draw_text();
gr_flip();
}
// called once when leaving the gameplay help state
void gameplay_help_close()
{
if ( Gameplay_help_inited ) {
if (Background_bitmap >= 0) {
bm_unload(Background_bitmap);
}
Ui_window.destroy();
common_free_interface_palette(); // restore game palette
game_flush();
}
Gameplay_help_inited = 0;
}
+43
View File
@@ -0,0 +1,43 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/GameHelp/GameplayHelp.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:22 $
* $Author: penguin $
*
* Header for displaying in-game help
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 2 3/09/98 9:54p Lawrance
* integrate new art for gameplay help
*
* 1 3/09/98 5:05p Lawrance
*
* $NoKeywords: $
*/
#ifndef __GAMEPLAY_HELP_H__
#define __GAMEPLAY_HELP_H__
void gameplay_help_init();
void gameplay_help_close();
void gameplay_help_do_frame(float frametime);
#endif
+626
View File
@@ -0,0 +1,626 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/GameSequence/GameSequence.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* File to control Game Sequencing
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 3 2/23/99 2:29p Dave
* First run of oldschool dogfight mode.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 65 5/15/98 12:09a Dave
* New tracker api code. New game tracker code. Finished up first run of
* the PXO screen. Fixed a few game server list exceptions.
*
* 64 5/12/98 2:46a Dave
* Rudimentary communication between Parallax Online and freespace. Can
* get and store channel lists.
*
* 63 5/06/98 1:12a Allender
* fix sequencing names, added nprintf to help respawn debugging
*
* 62 4/25/98 7:39p Allender
* fixd some small hotkey stuff. Worked on turret orientation being
* correct for multiplayer. new sexpression called end-campaign will will
* end the main campaign
*
* 61 4/23/98 7:08p John
* Removed some obsoleted states.
*
* 60 4/16/98 4:31p Hoffoss
* Changed demo screen referenced to view cutscenes screen, which is now
* what it's called.
*
* 59 4/02/98 5:40p Hoffoss
* Added the Load Mission screen to FreeSpace.
*
* 58 3/11/98 5:32p Lawrance
* Fix up text arrays for events/states
*
* 57 3/09/98 12:13a Lawrance
* Add support for Red Alert missions
*
* 56 3/05/98 4:12p John
* Made Debug+F4 switch Glide and windowed.
*
* 55 3/03/98 1:00p Hoffoss
* Added new command briefing event and state.
*
* 54 3/02/98 4:23p Hoffoss
* Forgot to add state label.
*
* 53 3/02/98 3:44p Hoffoss
* Added new Campaign Room state and event.
*
* 52 2/21/98 11:58a John
* Put in some stuff to externalize strings
*
* 51 2/19/98 6:26p Dave
* Fixed a few file xfer bugs. Tweaked mp team select screen. Put in
* initial support for player data uploading.
*
* 50 2/18/98 10:21p Dave
* Ripped out old file xfer system. Put in brand new xfer system.
*
* 49 2/08/98 5:07p Dave
* Put in support for multiplayer furball mode.
*
* 48 1/28/98 6:21p Dave
* Made the standalone use ~8 megs less memory. Fixed multiplayer submenu
* endgame problem.
*
* 47 1/23/98 5:43p Dave
* Finished bringing standalone up to speed. Coded in new host options
* screen.
*
* 46 1/22/98 5:25p Dave
* Modified some pregame sequencing packets. Starting to repair broken
* standalone stuff.
*
* 45 1/22/98 4:15p Hoffoss
* Added code to allow popup to tell player he needs to bind a key for the
* training mission.
*
* 44 1/20/98 5:42p Dave
* Moved ingame join to its own module. Improved it a bit.
*
* 43 1/19/98 12:57p Allender
* removed confusing comment
*
* 42 1/19/98 12:56p Allender
* fix problem of freespace_start_misison possibly failing due to mission
* not properly loading (for single player only right now).
*
* 41 1/15/98 6:12p Dave
* Fixed weapons loadout bugs with multiplayer respawning. Added
* multiplayer start screen. Fixed a few chatbox bugs.
*
* 40 1/15/98 6:00p Hoffoss
* Added option to quit menu (in game) to restart the mission. Doesn't
* seem to quite work, though. Checking code in so someone else can look
* into it.
*
* 39 1/05/98 10:05a Dave
* Big re-sequencing of server transfer. Centralized _all_ server transfer
* code to one module.
*
* 38 12/30/97 4:28p Lawrance
* Give text descriptions for events, change debug output to give text
* desciption of event/state
*
* 37 12/24/97 8:56p Lawrance
* took out obsolete state used for non-existant sound config screen
*
* 36 11/19/97 8:28p Dave
* Hooked in Main Hall screen. Put in Anim support for ping ponging
* animations as well as general reversal of anim direction.
*
* 35 11/15/97 2:36p Dave
* Added more multiplayer campaign support.
*
* 34 11/13/97 7:01p Hoffoss
* Fixed GS_state_text[], which didn't match the current states we have
* available.
*
* 33 11/10/97 6:02p Hoffoss
* Added new debug paused state.
*
* 32 11/03/97 10:12p Hoffoss
* Finished up work on the hud message/mission log scrollback screen.
*
* 31 10/22/97 11:00p Lawrance
* modify pop_and_discard() to allow discarding of all states on the stack
*
* 30 10/22/97 5:08p John
* fixed a whole slew of bugs and clean up a bunch of stuff dealing with
* end of mission stuff.
*
* 29 10/02/97 9:49p Hoffoss
* Added event evaluation analysis debug screen so we can determine the
* state of events and their sexp trees to track down logic problems and
* such.
*
* 28 9/23/97 11:53p Lawrance
* add state do perform multiplayer on-line help
*
* 27 9/22/97 4:55p Hoffoss
* Added a training message window display thingy.
*
* 26 9/19/97 4:24p Allender
* added team selection state -- initialze player* variable in
* player_level_init
*
* 25 9/18/97 10:17p Lawrance
* add help state for briefing
*
* 24 9/18/97 10:15p Lawrance
* add help state for briefing
*
* 23 7/14/97 12:03a Lawrance
* added navmap state
*
* 22 6/13/97 2:30p Lawrance
* Added debriefings
*
* 21 5/20/97 10:02a Lawrance
* added view medals screen
*
* 20 4/28/97 2:17p Lawrance
* added help state for hotkey assignment screen
*
* 19 4/25/97 3:41p Lawrance
* added support for hotkey assignment screen
*
* 18 4/23/97 9:54a Lawrance
* made show goals screen a separate state
*
* 17 4/22/97 11:06a Lawrance
* added credits state
*
* 16 4/17/97 9:01p Allender
* start of campaign stuff. Campaigns now stored in external file (no
* filenames in code). Continuing campaign won't work at this point
*
* 15 4/03/97 8:40p Lawrance
* add new player death states to GS_state_text[]
*
* 14 3/05/97 5:04p Lawrance
* added new states for different context help
*
* 13 1/09/97 12:41a Lawrance
* added function to pop a state without restoring that state
*
* 12 12/22/96 3:41p Lawrance
* integrating energy transfer system
*
* 11 12/09/96 2:35p Allender
* modifed game sequencing so that game_leave_state and game_enter_state
* are *always* called.
*
* 10 12/08/96 1:54a Lawrance
* put check in to see if a state change request is invalid (ie already in
* that state)
*
* 9 11/18/96 5:07p John
* Changed sequencing code to call entry,leave functions for each state
* change. Added Shift+Pause debug pause thing.
*
* 8 11/13/96 4:02p Lawrance
* complete over-haul of the menu system and the states associated with
* them
*
* 7 10/23/96 9:08a Allender
* Removed primary and secondary goal complete states -- to be implemented
* later.
*
*/
/*
* All states for game sequencing are defined in GameSequence.h.
* States should always be referred to using the macros.
*/
#include "freespace2/freespace.h"
#include "gamesequence/gamesequence.h"
// local defines
#define MAX_GAMESEQ_EVENTS 20 // maximum number of events on the game sequencing queue
#define GS_STACK_SIZE 10 // maximum number of stacked states
// local variables
typedef struct state_stack {
int current_state;
int event_queue[MAX_GAMESEQ_EVENTS];
int queue_tail, queue_head;
} state_stack;
// DO NOT MAKE THIS NON-STATIC!!!!
LOCAL state_stack gs[GS_STACK_SIZE];
LOCAL int gs_current_stack = -1; // index of top state on stack.
static int state_reentry = 0; // set if we are already in state processing
static int state_processing_event_post = 0; // set if we are already processing an event to switch states
static int state_in_event_processer = 0;
// Text of state, corresponding to #define values for GS_STATE_*
//XSTR:OFF
char *GS_event_text[] =
{
"GS_EVENT_MAIN_MENU",
"GS_EVENT_START_GAME",
"GS_EVENT_ENTER_GAME",
"GS_EVENT_START_GAME_QUICK",
"GS_EVENT_END_GAME",
"GS_EVENT_QUIT_GAME", // 5
"GS_EVENT_PAUSE_GAME",
"GS_EVENT_PREVIOUS_STATE",
"GS_EVENT_OPTIONS_MENU",
"GS_EVENT_BARRACKS_MENU",
"GS_EVENT_TRAINING_MENU", // 10
"GS_EVENT_TECH_MENU",
"GS_EVENT_LOAD_MISSION_MENU",
"GS_EVENT_SHIP_SELECTION",
"GS_EVENT_TOGGLE_FULLSCREEN",
"GS_EVENT_WEAPON_SELECT_HELP", // 15
"GS_EVENT_START_BRIEFING",
"GS_EVENT_DEBUG_PAUSE_GAME",
"GS_EVENT_HUD_CONFIG",
"GS_EVENT_MULTI_SETUP",
"GS_EVENT_MULTI_JOIN_GAME", // 20
"GS_EVENT_CONTROL_CONFIG",
"GS_EVENT_EVENT_DEBUG",
"GS_EVENT_MULTI_PROTO_CHOICE",
"GS_EVENT_SAVE_RESTORE",
"GS_EVENT_CHOOSE_SAVE_OR_RESTORE", // 25
"GS_EVENT_WEAPON_SELECTION",
"GS_EVENT_MISSION_LOG_SCROLLBACK",
"GS_EVENT_MAIN_MENU_HELP",
"GS_EVENT_GAMEPLAY_HELP",
"GS_EVENT_SHIP_SELECT_HELP", // 30
"GS_EVENT_DEATH_DIED",
"GS_EVENT_DEATH_BLEW_UP",
"GS_EVENT_NEW_CAMPAIGN",
"GS_EVENT_CREDITS",
"GS_EVENT_SHOW_GOALS", // 35
"GS_EVENT_HOTKEY_SCREEN",
"GS_EVENT_HOTKEY_SCREEN_HELP",
"GS_EVENT_VIEW_MEDALS",
"GS_EVENT_MULTI_HOST_SETUP",
"GS_EVENT_MULTI_CLIENT_SETUP", // 40
"GS_EVENT_DEBRIEF",
"GS_EVENT_NAVMAP",
"GS_EVENT_MULTI_JOIN_TRACKER",
"GS_EVENT_GOTO_VIEW_CUTSCENES_SCREEN",
"GS_EVENT_MULTI_STD_WAIT", // 45
"GS_EVENT_STANDALONE_MAIN",
"GS_EVENT_MULTI_PAUSE",
"GS_EVENT_BRIEFING_HELP",
"GS_EVENT_TEAM_SELECT",
"GS_EVENT_TRAINING_PAUSE", // 50
"GS_EVENT_MULTI_HELP",
"GS_EVENT_INGAME_PRE_JOIN",
"GS_EVENT_PLAYER_WARPOUT_START",
"GS_EVENT_PLAYER_WARPOUT_START_FORCED",
"GS_EVENT_PLAYER_WARPOUT_STOP", // 55
"GS_EVENT_PLAYER_WARPOUT_DONE_STAGE1",
"GS_EVENT_PLAYER_WARPOUT_DONE_STAGE2",
"GS_EVENT_PLAYER_WARPOUT_DONE",
"GS_EVENT_STANDALONE_POSTGAME",
"GS_EVENT_INITIAL_PLAYER_SELECT", // 60
"GS_EVENT_GAME_INIT",
"GS_EVENT_MULTI_MISSION_SYNC",
"GS_EVENT_MULTI_CAMPAIGN_SELECT",
"GS_EVENT_MULTI_SERVER_TRANSFER",
"GS_EVENT_MULTI_START_GAME", // 65
"GS_EVENT_MULTI_HOST_OPTIONS",
"GS_EVENT_MULTI_DOGFIGHT_DEBRIEF",
"GS_EVENT_CAMPAIGN_ROOM",
"GS_EVENT_CMD_BRIEF",
"GS_EVENT_TOGGLE_GLIDE", // 70
"GS_EVENT_RED_ALERT",
"GS_EVENT_SIMULATOR_ROOM",
"GS_EVENT_EMD_CAMPAIGN",
};
//XSTR:ON
// Text of state, corresponding to #define values for GS_STATE_*
//XSTR:OFF
char *GS_state_text[] =
{
"NOT A VALID STATE",
"GS_STATE_MAIN_MENU", // 1
"GS_STATE_GAME_PLAY",
"GS_STATE_GAME_PAUSED",
"GS_STATE_QUIT_GAME",
"GS_STATE_OPTIONS_MENU", // 5
"GS_EVENT_WEAPON_SELECT_HELP",
"GS_STATE_BARRACKS_MENU",
"GS_STATE_TECH_MENU",
"GS_STATE_TRAINING_MENU",
"GS_STATE_LOAD_MISSION_MENU", // 10
"GS_STATE_BRIEFING",
"GS_STATE_SHIP_SELECT",
"GS_STATE_DEBUG_PAUSED",
"GS_STATE_HUD_CONFIG",
"GS_STATE_MULTI_SETUP", // 15
"GS_STATE_MULTI_JOIN_GAME",
"GS_STATE_CONTROL_CONFIG",
"GS_STATE_MULTI_PROTO_CHOICE",
"GS_STATE_SAVE_RESTORE",
"GS_STATE_WEAPON_SELECT", // 20
"GS_STATE_MISSION_LOG_SCROLLBACK",
"GS_STATE_MAIN_MENU_HELP",
"GS_STATE_GAMEPLAY_HELP",
"GS_STATE_SHIP_SELECT_HELP",
"GS_STATE_DEATH_DIED", // 25
"GS_STATE_DEATH_BLEW_UP",
"GS_STATE_SIMULATOR_ROOM",
"GS_STATE_CREDITS",
"GS_STATE_SHOW_GOALS",
"GS_STATE_HOTKEY_SCREEN", // 30
"GS_STATE_HOTKEY_SCREEN_HELP",
"GS_STATE_VIEW_MEDALS",
"GS_STATE_MULTI_HOST_SETUP",
"GS_STATE_MULTI_CLIENT_SETUP",
"GS_STATE_DEBRIEF", // 35
"GS_STATE_NAVMAP",
"GS_STATE_MULTI_JOIN_TRACKER",
"GS_STATE_VIEW_CUTSCENES",
"GS_STATE_MULTI_STD_WAIT",
"GS_STATE_STANDALONE_MAIN", // 40
"GS_STATE_MULTI_PAUSED",
"GS_STATE_BRIEFING_HELP",
"GS_STATE_TEAM_SELECT",
"GS_STATE_TRAINING_PAUSED",
"GS_STATE_MULTI_HELP", // 45
"GS_STATE_INGAME_PRE_JOIN",
"GS_STATE_EVENT_DEBUG",
"GS_STATE_STANDALONE_POSTGAME",
"GS_STATE_INITIAL_PLAYER_SELECT",
"GS_STATE_MULTI_MISSION_SYNC", // 50
"GS_STATE_MULTI_SERVER_TRANSFER",
"GS_STATE_MULTI_START_GAME",
"GS_STATE_MULTI_HOST_OPTIONS",
"GS_STATE_MULTI_DOGFIGHT_DEBRIEF",
"GS_STATE_CAMPAIGN_ROOM", // 55
"GS_STATE_CMD_BRIEF",
"GS_STATE_RED_ALERT",
"GS_STATE_END_OF_CAMPAIGN",
};
//XSTR:ON
void gameseq_init()
{
int i;
for (i=0; i<GS_STACK_SIZE; i++ ) {
// gs[i].current_state = GS_STATE_MAIN_MENU;
gs[i].current_state = 0;
gs[i].queue_tail=0;
gs[i].queue_head=0;
}
gs_current_stack = 0;
state_reentry = 0;
state_processing_event_post = 0;
state_in_event_processer = 0;
}
// gameseq_post_event posts a new game sequencing event onto the gameseq
// event queue
void gameseq_post_event( int event )
{
if (state_processing_event_post) {
nprintf(("Warning", "Received post for event %s during state transtition. Find Allender if you are unsure if this is bad.\n", GS_event_text[event] ));
}
Assert(gs[gs_current_stack].queue_tail < MAX_GAMESEQ_EVENTS);
gs[gs_current_stack].event_queue[gs[gs_current_stack].queue_tail++] = event;
if ( gs[gs_current_stack].queue_tail == MAX_GAMESEQ_EVENTS )
gs[gs_current_stack].queue_tail = 0;
}
// returns one of the GS_EVENT_ id's on the game sequencing queue
int gameseq_get_event()
{
int event;
if ( gs[gs_current_stack].queue_head == gs[gs_current_stack].queue_tail )
return -1;
event = gs[gs_current_stack].event_queue[gs[gs_current_stack].queue_head++];
if ( gs[gs_current_stack].queue_head == MAX_GAMESEQ_EVENTS )
gs[gs_current_stack].queue_head = 0;
return event;
}
// returns one of the GS_STATE_ macros
int gameseq_get_state(int depth)
{
Assert(depth <= gs_current_stack);
return gs[gs_current_stack - depth].current_state;
}
int gameseq_get_depth()
{
return gs_current_stack;
}
void gameseq_set_state(int new_state, int override)
{
int event, old_state;
if ( (new_state == gs[gs_current_stack].current_state) && !override )
return;
old_state = gs[gs_current_stack].current_state;
// Flush all events!!
while ( (event = gameseq_get_event()) != -1 ) {
mprintf(( "Throwing out event %d because of state set from %d to %d\n", event, old_state, new_state ));
}
Assert( state_reentry == 1 ); // Get John! (Invalid state sequencing!)
Assert( state_in_event_processer == 1 ); // can only call from game_process_event
state_processing_event_post++;
state_reentry++;
game_leave_state(gs[gs_current_stack].current_state,new_state);
gs[gs_current_stack].current_state = new_state;
game_enter_state(old_state,gs[gs_current_stack].current_state);
state_reentry--;
state_processing_event_post--;
}
void gameseq_push_state( int new_state )
{
if ( new_state == gs[gs_current_stack].current_state )
return;
int old_state = gs[gs_current_stack].current_state;
// Flush all events!!
// I commented out because I'm not sure if we should throw out events when pushing or not.
// int event;
// while( (event = gameseq_get_event()) != -1 ) {
// mprintf(( "Throwing out event %d because of state push from %d to %d\n", event, old_state, new_state ));
// }
Assert( state_reentry == 1 ); // Get John! (Invalid state sequencing!)
Assert( state_in_event_processer == 1 ); // can only call from game_process_event
gs_current_stack++;
Assert(gs_current_stack < GS_STACK_SIZE);
state_processing_event_post++;
state_reentry++;
game_leave_state(old_state,new_state);
gs[gs_current_stack].current_state = new_state;
gs[gs_current_stack].queue_tail = 0;
gs[gs_current_stack].queue_head = 0;
game_enter_state(old_state,gs[gs_current_stack].current_state);
state_reentry--;
state_processing_event_post--;
}
void gameseq_pop_state()
{
int popped_state = 0;
Assert(state_reentry == 1); // Get John! (Invalid state sequencing!)
if (gs_current_stack >= 1) {
int old_state;
// set the old state to be the state which is about to be popped off the queue
old_state = gs[gs_current_stack].current_state;
// set the popped_state to be the state which is going to be moved into
popped_state = gs[gs_current_stack-1].current_state;
// leave the current state
state_reentry++;
game_leave_state(gs[gs_current_stack].current_state,popped_state);
// set the popped_state to be the one we moved into
gs_current_stack--;
popped_state = gs[gs_current_stack].current_state;
// swap all remaining events from the state which just got popped to this new state
while(gs[gs_current_stack+1].queue_head != gs[gs_current_stack+1].queue_tail){
gameseq_post_event(gs[gs_current_stack+1].event_queue[gs[gs_current_stack+1].queue_head++]);
}
game_enter_state(old_state, gs[gs_current_stack].current_state);
state_reentry--;
}
}
// gameseq_pop_and_discard_state() is used to remove a state that was pushed onto the stack, but
// will never need to be popped. An example of this is entering a state that may require returning
// to the previous state (then you would call gameseq_pop_state). Or you may simply continue to
// another part of the game, to avoid filling up the stack with states that may never be popped, you
// call this function to discard the top of the gs.
//
void gameseq_pop_and_discard_state()
{
if (gs_current_stack > 0 ) {
gs_current_stack--;
}
}
// Returns the last state pushed on stack
int gameseq_get_pushed_state()
{
if (gs_current_stack >= 1) {
return gs[gs_current_stack-1].current_state;
} else
return -1;
}
// gameseq_process_events gets called every time through high level loops
// (i.e. game loops, main menu loop). Function is responsible for pulling
// game sequence events off the queue and changing the state when necessary.
// Returns the current state.
// pull events game sequence events off of the queue. Process one at a time
// based on the current state and the new event.
int gameseq_process_events()
{
int event, old_state;
old_state = gs[gs_current_stack].current_state;
Assert(state_reentry == 0); // Get John! (Invalid state sequencing!)
while ( (event = gameseq_get_event()) != -1 ) {
state_reentry++;
state_in_event_processer++;
game_process_event(gs[gs_current_stack].current_state, event);
state_in_event_processer--;
state_reentry--;
// break when state changes so that code will get called at
// least one frame for each state.
if (old_state != gs[gs_current_stack].current_state)
break;
}
state_reentry++;
game_do_state(gs[gs_current_stack].current_state);
state_reentry--;
return gs[gs_current_stack].current_state;
}
+494
View File
@@ -0,0 +1,494 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/GameSequence/GameSequence.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Header file for Game Sequencing items
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 8 9/03/99 1:31a Dave
* CD checking by act. Added support to play 2 cutscenes in a row
* seamlessly. Fixed super low level cfile bug related to files in the
* root directory of a CD. Added cheat code to set campaign mission # in
* main hall.
*
* 7 8/27/99 12:04a Dave
* Campaign loop screen.
*
* 6 8/04/99 5:36p Andsager
* Show upsell screens at end of demo campaign before returning to main
* hall.
*
* 5 2/23/99 2:29p Dave
* First run of oldschool dogfight mode.
*
* 4 11/05/98 5:55p Dave
* Big pass at reducing #includes
*
* 3 11/05/98 4:18p Dave
* First run nebula support. Beefed up localization a bit. Removed all
* conditional compiles for foreign versions. Modified mission file
* format.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 83 5/15/98 12:09a Dave
* New tracker api code. New game tracker code. Finished up first run of
* the PXO screen. Fixed a few game server list exceptions.
*
* 82 5/12/98 2:46a Dave
* Rudimentary communication between Parallax Online and freespace. Can
* get and store channel lists.
*
* 81 4/25/98 7:39p Allender
* fixd some small hotkey stuff. Worked on turret orientation being
* correct for multiplayer. new sexpression called end-campaign will will
* end the main campaign
*
* 80 4/23/98 7:08p John
* Removed some obsoleted states.
*
* 79 4/16/98 4:31p Hoffoss
* Changed demo screen referenced to view cutscenes screen, which is now
* what it's called.
*
* 78 4/02/98 5:40p Hoffoss
* Added the Load Mission screen to FreeSpace.
*
* 77 3/11/98 5:32p Lawrance
* Fix up text arrays for events/states
*
* 76 3/09/98 12:13a Lawrance
* Add support for Red Alert missions
*
* 75 3/07/98 5:44p Dave
* Finished player info popup. Ironed out a few todo bugs.
*
* 74 3/05/98 4:12p John
* Made Debug+F4 switch Glide and windowed.
*
* 73 3/03/98 1:00p Hoffoss
* Added new command briefing event and state.
*
* 72 3/02/98 3:44p Hoffoss
* Added new Campaign Room state and event.
*
* 71 2/19/98 6:26p Dave
* Fixed a few file xfer bugs. Tweaked mp team select screen. Put in
* initial support for player data uploading.
*
* 70 2/18/98 10:21p Dave
* Ripped out old file xfer system. Put in brand new xfer system.
*
* 69 2/08/98 5:07p Dave
* Put in support for multiplayer furball mode.
*
* 68 1/28/98 6:22p Dave
* Made standalone use ~8 megs less memory. Fixed multiplayer submenu
* sequencing bug.
*
* 67 1/23/98 5:43p Dave
* Finished bringing standalone up to speed. Coded in new host options
* screen.
*
* 66 1/22/98 5:25p Dave
* Modified some pregame sequencing packets. Starting to repair broken
* standalone stuff.
*
* 65 1/20/98 5:42p Dave
* Moved ingame join to its own module. Improved it a bit.
*
* 64 1/15/98 6:12p Dave
* Fixed weapons loadout bugs with multiplayer respawning. Added
* multiplayer start screen. Fixed a few chatbox bugs.
*
* 63 1/15/98 6:00p Hoffoss
* Added option to quit menu (in game) to restart the mission. Doesn't
* seem to quite work, though. Checking code in so someone else can look
* into it.
*
* 62 1/05/98 10:05a Dave
* Big re-sequencing of server transfer. Centralized _all_ server transfer
* code to one module.
*
* 61 12/30/97 4:28p Lawrance
* Give text descriptions for events, change debug output to give text
* desciption of event/state
*
* 60 12/24/97 8:56p Lawrance
* took out obsolete state used for non-existant sound config screen
*
* 59 12/17/97 8:44p John
* added code to warp the player out of mission no matter what; no
* cancelling, no max speed check.
*
* 58 11/15/97 2:37p Dave
* More multiplayer campaign support.
*
* 57 11/13/97 7:01p Hoffoss
* Fixed GS_state_text[], which didn't match the current states we have
* available.
*
* 56 11/11/97 4:57p Dave
* Put in support for single vs. multiplayer pilots. Began work on
* multiplayer campaign saving. Put in initial player select screen
*
* 55 11/10/97 6:02p Hoffoss
* Added new debug paused state.
*
* 54 11/03/97 10:12p Hoffoss
* Finished up work on the hud message/mission log scrollback screen.
*
* 53 10/27/97 6:11p Dave
* Changed host/server transfer around. Added some multiplayer data to
* state save/restore. Made multiplayer quitting more intelligent.
*
* 52 10/27/97 8:33a John
* added code for new player warpout sequence
*
* 51 10/24/97 6:19p Dave
* More standalone testing/fixing. Added reliable endgame sequencing.
* Added reliable ingame joining. Added reliable stats transfer (endgame).
* Added support for dropping players in debriefing. Removed a lot of old
* unused code.
*
* 50 10/18/97 7:47p Hoffoss
* Changed state workings for controls config screen.
*
* 49 10/02/97 9:53p Hoffoss
* Added event evaluation analysis debug screen so we can determine the
* state of events and their sexp trees to track down logic problems and
* such.
*
* 48 10/02/97 4:52p Dave
* Added event to move to the multi wait state with a post_event
*
* 47 10/01/97 4:52p Dave
* Got ingame join and observer mode to correctly work under the new
* player_obj system.
*
* 46 9/30/97 5:08p Dave
* Began work on ingame join ship selection screen/state.
*
* 45 9/23/97 11:53p Lawrance
* add state do perform multiplayer on-line help
*
* 44 9/22/97 4:55p Hoffoss
* Added a training message window display thingy.
*
* 43 9/19/97 4:24p Allender
* added team selection state -- initialze player* variable in
* player_level_init
*
* 42 9/18/97 10:17p Lawrance
* add help state for briefing
*
* 41 9/18/97 9:21a Dave
* Added view medals state. Changed pilot scoring struct to reflect.
*
* 40 8/29/97 4:51p Dave
* Added a state and even for multiplayer pausing.
*
* 39 8/15/97 5:15p Dave
* Added a file xfer state.
*
* 38 8/15/97 9:29a Dave
* Removed standalone server briefing wait state.
*
* 37 8/04/97 4:39p Dave
* Added first 3 standalone state handlers
*
* 36 7/30/97 5:24p Dave
* Added in demo system state.
*
* 35 7/24/97 2:17p Dave
* Added show statistics state.
*
* 34 7/23/97 4:51p Dave
* Added join tracker state
*
* 33 7/14/97 12:03a Lawrance
* added navmap state
*
* 32 6/13/97 2:30p Lawrance
* Added debriefings
*
* 31 6/12/97 9:13a Allender
* added sequencing state to the end of ship selection. Changed some
* packet names and host sequencing
*
* 30 6/10/97 9:56p Allender
* get multiplayer mission selection working. Host can select mission and
* have himself and clients load the mission -- no sequencing past this
* point however
*
* 29 6/06/97 10:40a Allender
* added 'type' to mission (single/multi/etc). Added a couple of new game
* states for allowing to choose mission for multiplayer game
*
* 28 5/20/97 10:02a Lawrance
* added view medals screen
*
* 27 4/28/97 2:17p Lawrance
* added help state for hotkey assignment screen
*
* 26 4/25/97 3:41p Lawrance
* added support for hotkey assignment screen
*
* 25 4/23/97 9:54a Lawrance
* made show goals screen a separate state
*
* 24 4/22/97 11:06a Lawrance
* added credits state
*
* 23 4/17/97 9:01p Allender
* start of campaign stuff. Campaigns now stored in external file (no
* filenames in code). Continuing campaign won't work at this point
*
* 22 4/03/97 8:40p Lawrance
* give GS_STATE's for player death correct numbering
*
* 21 4/02/97 6:03p Mike
* Make dying work through event driven code.
*
* 20 3/05/97 5:04p Lawrance
* added new states for different context help
*
* 19 3/03/97 1:21p Allender
* mission log stuff -- display the log during/after game. Enhanced
* structure
*
* 18 3/02/97 4:43p Lawrance
* Added in state for sound/music sound config
*
* 17 2/25/97 11:07a Lawrance
* Added support for weapon loadout state
*
* 16 1/09/97 12:57p Lawrance
* supporting a new state where the player picks to either save or restore
*
* 15 1/09/97 12:41a Lawrance
* added function to pop a state without restoring that state
*
* 14 1/06/97 10:44p Lawrance
* Changes to make save/restore functional
*
* 13 1/01/97 6:44p Lawrance
* added new state for protocol choice in a net game
*
* 12 12/03/96 3:45p Lawrance
* supporting control configuration
*
* 11 12/01/96 3:49a Lawrance
* adding support for various multiplayer states
*
* 10 11/29/96 6:09p Lawrance
* added a state for HUD configuration
*
* 9 11/27/96 3:21p Lawrance
* added state for when player is examining message scroll-back
*
* 8 11/19/96 1:22p Lawrance
* added event to start a briefing
*
* 7 11/18/96 8:12p John
* Changed some briefing and sequencing stuff around.
*
* 6 11/18/96 5:07p John
* Changed sequencing code to call entry,leave functions for each state
* change. Added Shift+Pause debug pause thing.
*
* 5 11/13/96 4:02p Lawrance
* complete over-haul of the menu system and the states associated with
* them
*
* 4 10/23/96 9:08a Allender
* Removed primary and secondary goal complete states -- to be implemented
* later.
*
*/
// defines for game sequencing
#ifndef __GAMESEQUENCE_H__
#define __GAMESEQUENCE_H__
#include "globalincs/pstypes.h"
// defines for game sequencing events
//
#define GS_EVENT_MAIN_MENU 0 // first event to move to first state
#define GS_EVENT_START_GAME 1 // start a new game (Loads a mission then goes to briefing state)
#define GS_EVENT_ENTER_GAME 2 // switches into game state, probably after mission briefing or ship selection.
#define GS_EVENT_START_GAME_QUICK 3 // start a new game (Loads a mission then goes to directly to game state)
#define GS_EVENT_END_GAME 4 // end the current game (i.e. back to main menu)
#define GS_EVENT_QUIT_GAME 5 // quit the entire game
#define GS_EVENT_PAUSE_GAME 6 // pause the current game
#define GS_EVENT_PREVIOUS_STATE 7 // return to the previous state
#define GS_EVENT_OPTIONS_MENU 8 // go to the options menu
#define GS_EVENT_BARRACKS_MENU 9 // go to the barracks menu
#define GS_EVENT_TRAINING_MENU 10 // go to the training menu
#define GS_EVENT_TECH_MENU 11 // go to the tech room menu
#define GS_EVENT_LOAD_MISSION_MENU 12 // go to the load mission menu
#define GS_EVENT_SHIP_SELECTION 13 // Show ship selection menu
#define GS_EVENT_TOGGLE_FULLSCREEN 14 // toggle fullscreen mode
#define GS_EVENT_START_BRIEFING 15 // go to the briefing for the current mission
#define GS_EVENT_DEBUG_PAUSE_GAME 16
#define GS_EVENT_HUD_CONFIG 17 // start the HUD configuration screen
#define GS_EVENT_MULTI_JOIN_GAME 18 // start multiplayer join game screen
#define GS_EVENT_CONTROL_CONFIG 19 // get user to choose what type of controller to config
#define GS_EVENT_EVENT_DEBUG 20 // an event debug trace scroll list display screen
#define GS_EVENT_WEAPON_SELECTION 21 // Do weapon loadout
#define GS_EVENT_MISSION_LOG_SCROLLBACK 22 // scrollback screen for message log entries
#define GS_EVENT_GAMEPLAY_HELP 23 // show help for the gameplay
#define GS_EVENT_DEATH_DIED 24 // Player just died
#define GS_EVENT_DEATH_BLEW_UP 25 // Saw ship explode.
#define GS_EVENT_NEW_CAMPAIGN 26
#define GS_EVENT_CREDITS 27 // Got to the credits
#define GS_EVENT_SHOW_GOALS 28 // Show the goal status screen
#define GS_EVENT_HOTKEY_SCREEN 29 // Show the hotkey assignment screen
#define GS_EVENT_VIEW_MEDALS 30 // Go to the View Medals screen
#define GS_EVENT_MULTI_HOST_SETUP 31 // host setup for multiplayer
#define GS_EVENT_MULTI_CLIENT_SETUP 32 // client setup for multiplayer
#define GS_EVENT_DEBRIEF 33 // go to debriefing
#define GS_EVENT_GOTO_VIEW_CUTSCENES_SCREEN 34 // go to the demo management screen
#define GS_EVENT_MULTI_STD_WAIT 35 // standalone wait state
#define GS_EVENT_STANDALONE_MAIN 36 // the main do-nothing state of the standalone
#define GS_EVENT_MULTI_PAUSE 37 // pause your multiplayer game
#define GS_EVENT_TEAM_SELECT 38 // team selection for multiplayer
#define GS_EVENT_TRAINING_PAUSE 39 // pause game while training message is displayed
#define GS_EVENT_INGAME_PRE_JOIN 40 // go to ship selection screen for ingame join
#define GS_EVENT_PLAYER_WARPOUT_START 41 // player hit 'j' to warp out
#define GS_EVENT_PLAYER_WARPOUT_START_FORCED 42 // player is being forced out of mission no matter what
#define GS_EVENT_PLAYER_WARPOUT_STOP 43 // player hit 'esc' or something to cancel warp out
#define GS_EVENT_PLAYER_WARPOUT_DONE_STAGE1 44 // player ship got up to speed
#define GS_EVENT_PLAYER_WARPOUT_DONE_STAGE2 45 // player ship got through the warp effect
#define GS_EVENT_PLAYER_WARPOUT_DONE 46 // warp effect went away
#define GS_EVENT_STANDALONE_POSTGAME 47 // debriefing, etc
#define GS_EVENT_INITIAL_PLAYER_SELECT 48 // initial screen where player selects from multi/single player pilots
#define GS_EVENT_GAME_INIT 49
#define GS_EVENT_MULTI_MISSION_SYNC 50 // sychronize/transfer/load any mission specific data in multiplayer
#define GS_EVENT_MULTI_START_GAME 51 // immediately before the create game screen for the host to set the game variables
#define GS_EVENT_MULTI_HOST_OPTIONS 52 // options the host can set while in the create game scree
#define GS_EVENT_MULTI_DOGFIGHT_DEBRIEF 53 // multiplayer furball debriefing screen (replaces normal debriefing)
#define GS_EVENT_CAMPAIGN_ROOM 54
#define GS_EVENT_CMD_BRIEF 55 // switch to command briefing screen
#define GS_EVENT_TOGGLE_GLIDE 56 // GS_EVENT_TOGGLE_GLIDE
#define GS_EVENT_RED_ALERT 57 // go to red alert screen
#define GS_EVENT_SIMULATOR_ROOM 58
#define GS_EVENT_END_CAMPAIGN 59 // end of the whole thang.
#define GS_EVENT_END_DEMO 60 // end of demo campaign
#define GS_EVENT_LOOP_BRIEF 61 // campaign loop brief
#define GS_EVENT_CAMPAIGN_CHEAT 62 // skip to a mission in a campaign
// IMPORTANT: When you add a new event, update the initialization for GS_event_text[]
// which is done in GameSequence.cpp
//
extern char *GS_event_text[]; // text description for the GS_EVENT_* #defines above
// defines for game sequencing states
//
// IMPORTANT: When you add a new state, update the initialization for GS_state_text[]
// which is done in GameSequence.cpp
#define GS_STATE_MAIN_MENU 1
#define GS_STATE_GAME_PLAY 2
#define GS_STATE_GAME_PAUSED 3
#define GS_STATE_QUIT_GAME 4
#define GS_STATE_OPTIONS_MENU 5
#define GS_STATE_BARRACKS_MENU 7
#define GS_STATE_TECH_MENU 8
#define GS_STATE_TRAINING_MENU 9
#define GS_STATE_LOAD_MISSION_MENU 10
#define GS_STATE_BRIEFING 11
#define GS_STATE_SHIP_SELECT 12
#define GS_STATE_DEBUG_PAUSED 13
#define GS_STATE_HUD_CONFIG 14
#define GS_STATE_MULTI_JOIN_GAME 15
#define GS_STATE_CONTROL_CONFIG 16
#define GS_STATE_WEAPON_SELECT 17
#define GS_STATE_MISSION_LOG_SCROLLBACK 18
#define GS_STATE_DEATH_DIED 19 // Player just died
#define GS_STATE_DEATH_BLEW_UP 20 // Saw ship explode.
#define GS_STATE_SIMULATOR_ROOM 21
#define GS_STATE_CREDITS 22
#define GS_STATE_SHOW_GOALS 23
#define GS_STATE_HOTKEY_SCREEN 24
#define GS_STATE_VIEW_MEDALS 25 // Go to the View Medals screen
#define GS_STATE_MULTI_HOST_SETUP 26 // state where host sets up multiplayer game
#define GS_STATE_MULTI_CLIENT_SETUP 27 // client setup for multiplayer game
#define GS_STATE_DEBRIEF 28
#define GS_STATE_VIEW_CUTSCENES 29
#define GS_STATE_MULTI_STD_WAIT 30
#define GS_STATE_STANDALONE_MAIN 31
#define GS_STATE_MULTI_PAUSED 32
#define GS_STATE_TEAM_SELECT 33
#define GS_STATE_TRAINING_PAUSED 34 // game is paused while training msg is being read.
#define GS_STATE_INGAME_PRE_JOIN 35 // go to ship selection screen for ingame join
#define GS_STATE_EVENT_DEBUG 36 // an event debug trace scroll list display screen
#define GS_STATE_STANDALONE_POSTGAME 37 // debriefing, etc.
#define GS_STATE_INITIAL_PLAYER_SELECT 38
#define GS_STATE_MULTI_MISSION_SYNC 39
#define GS_STATE_MULTI_START_GAME 40
#define GS_STATE_MULTI_HOST_OPTIONS 41
#define GS_STATE_MULTI_DOGFIGHT_DEBRIEF 42
#define GS_STATE_CAMPAIGN_ROOM 43
#define GS_STATE_CMD_BRIEF 44 // command briefing screen
#define GS_STATE_RED_ALERT 45 // red alert screen
#define GS_STATE_END_OF_CAMPAIGN 46 // end of main campaign -- only applicable in single player
#define GS_STATE_GAMEPLAY_HELP 47
#define GS_STATE_END_DEMO 48 // end of demo campaign (upsell then main menu)
#define GS_STATE_LOOP_BRIEF 49
// IMPORTANT: When you add a new state, update the initialization for GS_state_text[]
// which is done in GameSequence.cpp
//
extern char *GS_state_text[]; // text description for the GS_STATE_* #defines above
// function prototypes
//
void gameseq_init();
int gameseq_process_events( void ); // returns current game state
int gameseq_get_state( int depth = 0 );
void gameseq_post_event( int event );
int gameseq_get_event( void );
void gameseq_set_state(int new_state, int override = 0);
void gameseq_push_state( int new_state );
void gameseq_pop_state( void );
int gameseq_get_pushed_state();
int gameseq_get_depth();
void gameseq_pop_and_discard_state(void);
// Called by the sequencing code when things happen.
void game_process_event(int current_state, int event);
void game_leave_state(int old_state,int new_state);
void game_enter_state(int old_state,int new_state);
void game_do_state(int current_state);
#endif /* __GAMESEQUENCE_H__ */
File diff suppressed because it is too large. Load diff
+271
View File
@@ -0,0 +1,271 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Gamesnd/EventMusic.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Header file for high-level control of event driven music
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/10 06:08:08 mharris
* Porting... added ifndef NO_SOUND
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 5 8/11/99 5:33p Jefff
* added 3rd debrief music track
*
* 4 6/20/99 12:06a Alanl
* new event music changes
*
* 3 11/20/98 4:08p Dave
* Fixed flak effect in multiplayer.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 27 9/18/98 1:22p Dave
* Added new event music stuff defines.
*
* 26 5/18/98 5:22p Lawrance
* Support new briefing music
*
* 25 5/03/98 1:54a Lawrance
* Fix event music problems related to respawning
*
* 24 12/30/97 11:46a Lawrance
* Support a success debriefing music.
*
* 23 12/28/97 5:52p Lawrance
* Add support for debriefing success/fail music.
*
* 22 12/26/97 10:01p Lawrance
* Add goal failure music... remove unused arrival music patterns
*
* 21 9/19/97 5:13p Lawrance
* add support for specifying music in the mission file
*
* 20 9/09/97 5:24p Lawrance
* added ability to switch soundtracks, gave soundtracks real names
*
* 19 9/06/97 2:13p Mike
* Replace support for TEAM_NEUTRAL
*
* 18 5/14/97 9:54a Lawrance
* supporting mission-specific briefing music
*
* 17 4/21/97 5:36p Lawrance
* add in hooks to play death music when pilot dies
*
* 16 4/17/97 3:28p Lawrance
* documented functions
*
* 15 4/14/97 1:52p Lawrance
* making transitions happen on measure boundries
*
* 14 4/07/97 1:39p Lawrance
* added event_music_first_pattern();
*
* 13 4/03/97 4:26p Lawrance
* getting digital event music working
*
* 12 3/07/97 8:53a Lawrance
* Read event at time 0 when music first starts
*
* 11 2/25/97 11:10a Lawrance
* using text of the mission name to match up which midi file gets played
* for which mission
*
* 10 2/18/97 9:43a Lawrance
* make BTTL_2 play after 2 enemy arrivals in battle mode. Then switch
* back to default BTTL_1 until 2 more.
*
* 9 2/14/97 11:50a Lawrance
* added BTTL_2 track
*
* 8 2/11/97 4:22p Lawrance
* adding song switching request to the event music level
*
* 7 2/11/97 9:15a Lawrance
* taking out BTTL_2 and BTTL_3
*
* 6 2/10/97 9:26a Lawrance
*
* 5 2/05/97 3:12p Lawrance
* supporting changes in MIDI system that remove any high-level
* dependencies
*
* 4 2/04/97 11:58p Lawrance
* volume change code, and fixing some bugs
*
* 3 2/04/97 12:02p Lawrance
* fixed temp bug, integrating music.tbl
*
* 2 2/03/97 6:49p Lawrance
* Event Music interface working
*
* $NoKeywords: $
*/
#ifndef __EVENT_MUSIC_H__
#define __EVENT_MUSIC_H__
#include "parse/parselo.h"
// Identifies songs in the Soundtrack_filenames[] structure. The order matches up with
// what is in music.tbl. Do not modify without synching music.tbl.
#define SONG_NRML_1 0 // Normal Song 1
#define SONG_AARV_1 1 // Allied Arrival 1
#define SONG_EARV_1 2 // Enemy Arrival 1
#define SONG_BTTL_1 3 // Battle Song 1
#define SONG_BTTL_2 4 // Battle Song 2
#define SONG_BTTL_3 5 // Battle Song 3
#define SONG_AARV_2 6 // Allied Arrival 2
#define SONG_EARV_2 7 // Enemy Arrival 2
#define SONG_VICT_1 8 // Victory Song 1
#define SONG_VICT_2 9 // Victory Song 2
#define SONG_FAIL_1 10 // Goal Failed
#define SONG_DEAD_1 11 // Death Song 1
#define MAX_PATTERNS 12
// if player targets a hostile ship at less than this range, switch to battle track
#define BATTLE_START_MIN_TARGET_DIST 500
extern int Event_Music_battle_started; // flag that will tell us if we've started a battle in the current mission
extern int Event_music_enabled;
extern float Master_event_music_volume; // range is 0->1
/////////////////////////////////////////////////////////////////////////////
// Used to track what briefing and debriefing music is played for the mission
/////////////////////////////////////////////////////////////////////////////
#define NUM_SCORES 4
#define SCORE_BRIEFING 0
#define SCORE_DEBRIEF_SUCCESS 1
#define SCORE_DEBRIEF_AVERAGE 2
#define SCORE_DEBRIEF_FAIL 3
extern int Mission_music[NUM_SCORES]; // indicies into Spooled_music[]
/////////////////////////////////////////////////////////////////////////////
extern int Current_soundtrack_num; // index into Soundtracks[]
// menu music storage
typedef struct menu_music {
char name[NAME_LENGTH]; // name music is known by
char filename[MAX_FILENAME_LEN]; // name music is stored on disk as
} menu_music;
#define MAX_SPOOLED_MUSIC 20
extern menu_music Spooled_music[MAX_SPOOLED_MUSIC];
extern int Num_music_files;
// event music soundtrack storage
typedef struct tagSOUNDTRACK_INFO {
int num_patterns;
char name[NAME_LENGTH];
char pattern_fnames[MAX_PATTERNS][MAX_FILENAME_LEN];
} SOUNDTRACK_INFO;
#define MAX_SOUNDTRACKS 10
extern SOUNDTRACK_INFO Soundtracks[MAX_SOUNDTRACKS];
extern int Num_soundtracks;
#ifndef NO_SOUND
void event_music_init();
void event_music_close();
void event_music_level_init(int force_soundtrack = -1);
void event_music_level_close();
void event_music_do_frame();
void event_music_disable();
void event_music_enable();
void event_music_pause();
void event_music_unpause();
void event_music_set_volume_all(float volume);
void event_music_parse_musictbl();
void event_music_change_pattern(int new_pattern);
int event_music_return_current_pattern();
void event_music_first_pattern();
int event_music_battle_start();
int event_music_enemy_arrival();
int event_music_friendly_arrival();
void event_music_arrival(int team);
int event_music_primary_goals_met();
int event_music_primary_goal_failed();
int event_music_player_death();
void event_music_start_default();
void event_music_get_info(char *outbuf);
void event_music_get_soundtrack_name(char *outbuf);
int event_music_next_soundtrack(int delta);
void event_music_set_soundtrack(char *name);
void event_music_set_score(int score_index, char *name);
int event_music_get_spooled_music_index(char *name);
void event_music_reset_choices();
int event_music_player_respawn();
int event_music_player_respawn_as_observer();
void event_music_hostile_ship_destroyed();
#else
#define event_music_init()
#define event_music_close()
#define event_music_level_init(force_soundtrack) ((void)(force_soundtrack))
#define event_music_level_close()
#define event_music_do_frame()
#define event_music_disable()
#define event_music_enable()
#define event_music_pause()
#define event_music_unpause()
#define event_music_set_volume_all(volume) ((void)(volume))
#define event_music_parse_musictbl()
#define event_music_change_pattern(new_pattern) ((void)(new_pattern))
#define event_music_return_current_pattern() (0)
#define event_music_first_pattern()
#define event_music_battle_start() (0)
#define event_music_enemy_arrival() (0)
#define event_music_friendly_arrival() (0)
#define event_music_arrival(team) ((void)(team))
#define event_music_primary_goals_met() (0)
#define event_music_primary_goal_failed() (0)
#define event_music_player_death() (0)
#define event_music_start_default()
inline void event_music_get_info(char *outbuf)
{
if (outbuf) *outbuf = '\0';
}
inline void event_music_get_soundtrack_name(char *outbuf)
{
if (outbuf) *outbuf = '\0';
}
#define event_music_next_soundtrack(delta) (0)
#define event_music_set_soundtrack(name) ((void)(name))
#define event_music_set_score(score_index, name) ((void)((score_index), (name)))
#define event_music_get_spooled_music_index(name) (-1)
#define event_music_reset_choices()
#define event_music_player_respawn() (0)
#define event_music_player_respawn_as_observer() (0)
#define event_music_hostile_ship_destroyed()
#endif // ifndef NO_SOUND
#endif /* __EVENT_MUSIC_H__ */
+426
View File
@@ -0,0 +1,426 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Gamesnd/GameSnd.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Routines to keep track of which sound files go where
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 6 7/01/99 11:44a Dave
* Updated object sound system to allow multiple obj sounds per ship.
* Added hit-by-beam sound. Added killed by beam sound.
*
* 5 6/25/99 3:08p Dave
* Multiple flyby sounds.
*
* 4 5/23/99 8:11p Alanl
* Added support for EAX
*
* 3 10/23/98 3:51p Dave
* Full support for tstrings.tbl and foreign languages. All that remains
* is to make it active in Fred.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 39 5/05/98 4:49p Lawrance
* Put in code to authenticate A3D, improve A3D support
*
* 38 4/25/98 1:25p Lawrance
* Make function for playing generic error beep
*
* 37 4/18/98 9:12p Lawrance
* Added Aureal support.
*
* 36 3/29/98 12:56a Lawrance
* preload the warp in and explosions sounds before a mission.
*
* 35 3/25/98 6:10p Lawrance
* Work on DirectSound3D
*
* 34 2/22/98 2:48p John
* More String Externalization Classification
*
* 33 1/17/98 12:33p John
* Made the game_busy function be called a constant amount of times per
* level load, making the bar prediction easier.
*
* 32 1/17/98 12:14p John
* Added loading... bar to freespace.
*
* 31 1/11/98 11:14p Lawrance
* Preload sounds that we expect will get played.
*
* 30 12/24/97 8:54p Lawrance
* Integrating new popup code
*
* 29 12/19/97 3:44p Mike
* Fix parse code. Would improperly read a number through a comma. Lots
* of ships.tbl problems.
*
* 28 12/01/97 5:25p Hoffoss
* Routed interface sound playing through a special function that will
* only allow one instance of the sound to play at a time, avoiding
* over-mixing problems.
*
* 27 11/20/97 1:06a Lawrance
* Add Master_voice_volume, make voices play back at correctly scaled
* volumes
*
* 26 10/17/97 1:36p Lawrance
* load/unload interface sounds
*
* 25 10/14/97 11:35p Lawrance
* change snd_load parameters
*
* 24 7/05/97 1:46p Lawrance
* improve robustness of gameplay and interface sound loading/unloading
*
* 23 6/09/97 11:50p Lawrance
* integrating DirectSound3D
*
* 22 6/08/97 5:59p Lawrance
* flag sounds as 3D
*
* 21 6/05/97 11:25a Lawrance
* use sound signatures to ensure correct sound is loaded
*
* 20 6/05/97 1:07a Lawrance
* changes to support sound interface
*
* 19 6/04/97 1:18p Lawrance
* added hooks for shield impacts
*
* 18 6/02/97 1:50p Lawrance
* supporting new format of sounds in table
*
* 17 5/14/97 9:54a Lawrance
* supporting mission-specific briefing music
*
* 16 5/08/97 1:56p Lawrance
* supporting ship-specific engine sounds
*
* 15 5/06/97 9:36a Lawrance
* added support for min and max distances for 3d sounds
*
* 14 4/23/97 5:19p Lawrance
* split up misc sounds into: gamewide, ingame, and interface
*
* 13 4/20/97 11:48a Lawrance
* added array of filenames for misc sounds. Will be useful if we want to
* unload then re-load sounds
*
* 12 4/20/97 11:19a Lawrance
* sndman_ interface obsolete. Using snd_ functions to load, play, and
* manage static sound fx
*
* 11 4/18/97 4:31p Mike
* Add support for default volume levels.
*
* 10 3/20/97 11:04a Lawrance
* using incorrect constant when loading music filenames
*
* 9 3/19/97 5:53p Lawrance
* integrating new Misc_sounds[] array (replaces old Game_sounds
* structure)
*
* 8 3/17/97 3:47p Mike
* Homing missile lock sound.
* More on AI ships firing missiles.
*
* 7 3/10/97 8:54a Lawrance
* added gamesnd_init_looping_sounds()
*
* 6 2/28/97 8:41a Lawrance
* added afterburner engage and burn sounds
*
* 5 2/14/97 12:37a Lawrance
* added hooks to play docking/undocking sounds
*
* 4 2/13/97 12:03p Lawrance
* hooked in throttle sounds
*
* 3 2/05/97 10:35a Lawrance
* supporting spooled music at menus, briefings, credits etc.
*
* 2 1/20/97 7:58p John
* Fixed some link errors with testcode.
*
* 1 1/20/97 7:08p John
*
* $NoKeywords: $
*/
#include "globalincs/pstypes.h"
#include "gamesnd/gamesnd.h"
#include "sound/sound.h"
#include "parse/parselo.h"
#include "localization/localize.h"
// Global array that holds data about the gameplay sound effects.
game_snd Snds[MAX_GAME_SOUNDS];
// Global array that holds data about the interface sound effects.
game_snd Snds_iface[MAX_INTERFACE_SOUNDS];
int Snds_iface_handle[MAX_INTERFACE_SOUNDS];
// flyby sounds - 2 for each species (fighter and bomber flybys)
game_snd Snds_flyby[MAX_SPECIES_NAMES][2];
void gamesnd_play_iface(int n)
{
if (Snds_iface_handle[n] >= 0)
snd_stop(Snds_iface_handle[n]);
Snds_iface_handle[n] = snd_play(&Snds_iface[n]);
}
// load in sounds that we expect will get played
//
// The method currently used is to load all those sounds that have the hardware flag
// set. This works well since we don't want to try and load hardware sounds in on the
// fly (too slow).
void gamesnd_preload_common_sounds()
{
int i;
game_snd *gs;
for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) {
gs = &Snds[i];
if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) {
if ( gs->preload ) {
gs->id = snd_load(gs);
}
}
game_busy(); // Animate loading cursor... does nothing if loading screen not active.
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_load_gameplay_sounds()
//
// Load the ingame sounds into memory
//
void gamesnd_load_gameplay_sounds()
{
int i;
game_snd *gs;
for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) {
gs = &Snds[i];
if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) {
gs->id = snd_load(gs);
}
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_unload_gameplay_sounds()
//
// Unload the ingame sounds from memory
//
void gamesnd_unload_gameplay_sounds()
{
int i;
game_snd *gs;
for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) {
gs = &Snds[i];
if ( gs->id != -1 ) {
snd_unload( gs->id );
gs->id = -1;
}
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_load_interface_sounds()
//
// Load the interface sounds into memory
//
void gamesnd_load_interface_sounds()
{
int i;
game_snd *gs;
for ( i = 0; i < MAX_INTERFACE_SOUNDS; i++ ) {
gs = &Snds_iface[i];
if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) {
gs->id = snd_load(gs);
}
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_unload_interface_sounds()
//
// Unload the interface sounds from memory
//
void gamesnd_unload_interface_sounds()
{
int i;
game_snd *gs;
for ( i = 0; i < MAX_INTERFACE_SOUNDS; i++ ) {
gs = &Snds_iface[i];
if ( gs->id != -1 ) {
snd_unload( gs->id );
gs->id = -1;
gs->id_sig = -1;
}
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_parse_line()
//
// Parse a sound effect line
//
void gamesnd_parse_line(game_snd *gs, char *tag)
{
int is_3d;
required_string(tag);
stuff_int(&gs->sig);
stuff_string(gs->filename, F_NAME, ",");
if ( !stricmp(gs->filename,NOX("empty")) ) {
gs->filename[0] = 0;
advance_to_eoln(NULL);
return;
}
Mp++;
stuff_int(&gs->preload);
stuff_float(&gs->default_volume);
stuff_int(&is_3d);
if ( is_3d ) {
gs->flags |= GAME_SND_USE_DS3D;
stuff_int(&gs->min);
stuff_int(&gs->max);
}
advance_to_eoln(NULL);
}
// -------------------------------------------------------------------------------------------------
// gamesnd_parse_soundstbl() will parse the sounds.tbl file, and load the specified sounds.
//
//
void gamesnd_parse_soundstbl()
{
int rval;
int num_game_sounds = 0;
int num_iface_sounds = 0;
// open localization
lcl_ext_open();
gamesnd_init_sounds();
if ((rval = setjmp(parse_abort)) != 0) {
Error(LOCATION, "Unable to parse sounds.tbl! Code = %i.\n", rval);
}
else {
read_file_text("sounds.tbl");
reset_parse();
}
// Parse the gameplay sounds section
required_string("#Game Sounds Start");
while (required_string_either("#Game Sounds End","$Name:")) {
Assert( num_game_sounds < MAX_GAME_SOUNDS);
gamesnd_parse_line( &Snds[num_game_sounds], "$Name:" );
num_game_sounds++;
}
required_string("#Game Sounds End");
// Parse the interface sounds section
required_string("#Interface Sounds Start");
while (required_string_either("#Interface Sounds End","$Name:")) {
Assert( num_iface_sounds < MAX_INTERFACE_SOUNDS);
gamesnd_parse_line(&Snds_iface[num_iface_sounds], "$Name:");
num_iface_sounds++;
}
required_string("#Interface Sounds End");
// parse flyby sound section
required_string("#Flyby Sounds Start");
// read 2 terran sounds
gamesnd_parse_line(&Snds_flyby[SPECIES_TERRAN][0], "$Terran:");
gamesnd_parse_line(&Snds_flyby[SPECIES_TERRAN][1], "$Terran:");
// 2 vasudan sounds
gamesnd_parse_line(&Snds_flyby[SPECIES_VASUDAN][0], "$Vasudan:");
gamesnd_parse_line(&Snds_flyby[SPECIES_VASUDAN][1], "$Vasudan:");
gamesnd_parse_line(&Snds_flyby[SPECIES_SHIVAN][0], "$Shivan:");
gamesnd_parse_line(&Snds_flyby[SPECIES_SHIVAN][1], "$Shivan:");
required_string("#Flyby Sounds End");
// close localization
lcl_ext_close();
}
// -------------------------------------------------------------------------------------------------
// gamesnd_init_struct()
//
void gamesnd_init_struct(game_snd *gs)
{
gs->filename[0] = 0;
gs->id = -1;
gs->id_sig = -1;
// gs->is_3d = 0;
// gs->use_ds3d = 0;
gs->flags = 0;
}
// -------------------------------------------------------------------------------------------------
// gamesnd_init_sounds() will initialize the Snds[] and Snds_iface[] arrays
//
void gamesnd_init_sounds()
{
int i;
// init the gameplay sounds
for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) {
gamesnd_init_struct(&Snds[i]);
}
// init the interface sounds
for ( i = 0; i < MAX_INTERFACE_SOUNDS; i++ ) {
gamesnd_init_struct(&Snds_iface[i]);
Snds_iface_handle[i] = -1;
}
}
// callback function for the UI code to call when the mouse first goes over a button.
void common_play_highlight_sound()
{
gamesnd_play_iface(SND_USER_OVER);
}
void gamesnd_play_error_beep()
{
gamesnd_play_iface(SND_GENERAL_FAIL);
}
+600
View File
@@ -0,0 +1,600 @@
/*
* 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.
*
*/
/*
* $Logfile: /Freespace2/code/Gamesnd/GameSnd.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
*
* Routines to keep track of which sound files go where
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/10 06:08:08 mharris
* Porting... added ifndef NO_SOUND
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 15 9/12/99 8:09p Dave
* Fixed problem where skip-training button would cause mission messages
* not to get paged out for the current mission.
*
* 14 9/09/99 11:40p Dave
* Handle an Assert() in beam code. Added supernova sounds. Play the right
* 2 end movies properly, based upon what the player did in the mission.
*
* 13 8/27/99 11:59a Jefff
* changed some sound names to better reflect new uses
*
* 12 8/26/99 9:45a Dave
* First pass at easter eggs and cheats.
*
* 11 7/19/99 11:47a Jefff
* Added sound hook for countermeasure success
*
* 10 7/02/99 4:31p Dave
* Much more sophisticated lightning support.
*
* 9 7/01/99 11:44a Dave
* Updated object sound system to allow multiple obj sounds per ship.
* Added hit-by-beam sound. Added killed by beam sound.
*
* 8 6/25/99 3:08p Dave
* Multiple flyby sounds.
*
* 7 6/18/99 5:16p Dave
* Added real beam weapon lighting. Fixed beam weapon sounds. Added MOTD
* dialog to PXO screen.
*
* 6 4/19/99 11:01p Dave
* More sophisticated targeting laser support. Temporary checkin.
*
* 5 2/04/99 6:29p Dave
* First full working rev of FS2 PXO support. Fixed Glide lighting
* problems.
*
* 4 1/29/99 12:47a Dave
* Put in sounds for beam weapon. A bunch of interface screens (tech
* database stuff).
*
* 3 10/26/98 9:42a Dave
* Early flak gun support.
*
* 2 10/07/98 10:52a Dave
* Initial checkin.
*
* 1 10/07/98 10:48a Dave
*
* 76 5/18/98 12:59a Lawrance
* Replace shockwave impact sound with a new "whoosh" sound that
* originates from the shockwave center
*
* 75 5/06/98 10:29a Dave
* Put in support for panning sounds. Put in new sound hooks for main hall
* 2 intercom sounds.
*
* 74 4/27/98 3:36p Dave
*
* 73 4/25/98 1:25p Lawrance
* Make function for playing generic error beep
*
* 72 4/19/98 9:33p Lawrance
* Added sound hooks for Shivan flyby sound, subspace ambient effect
*
* 71 3/23/98 4:13p Lawrance
* Add hooks for captial ship specific warp sounds
*
* 70 3/21/98 3:34p Lawrance
* Added highlight icon sound, added static sound for briefing cut
*
* 69 3/17/98 5:55p Lawrance
* Support object-linked sounds for asteroids.
*
* 68 3/17/98 3:53p Lawrance
* First pass at weapon flyby sounds
*
* 67 3/16/98 5:54p Lawrance
* Play cargo scanning sound
*
* 66 3/05/98 10:18p Lawrance
* Play voice cue sound when there is no voice file present
*
* 65 2/19/98 4:33p Lawrance
* add asteroid sound hooks
*
* 64 2/12/98 4:59p Lawrance
* Add new sound hooks for subsystem explosions, and subsystems getting
* destroyed
*
* 63 2/11/98 5:32p Dave
* Put in hooks for 3 random intercom sounds in the main hall.
*
* 62 2/06/98 11:33a Dave
* Made sounds customizable through sounds.tbl
*
* 61 2/04/98 6:08p Lawrance
* Add a light collision sound, overlay a shield collide sound if
* applicable.
*
* 60 1/30/98 11:48a John
* Made debris arcs cast light. Added sound effects for them.
*
* 59 1/11/98 11:14p Lawrance
* Preload sounds that we expect will get played.
*
* 58 1/07/98 11:10a Lawrance
* Add new several new sound hooks.
*
* 57 12/24/97 8:54p Lawrance
* Integrating new popup code
*
* 56 12/09/97 11:31a Lawrance
* add missile launch warnings, re-work proximity beep
*
* 55 12/05/97 2:39p Lawrance
* added some different sounds to main hall, add support for looping
* ambient sounds
*
* 54 12/03/97 4:58p Hoffoss
*
* 53 12/03/97 4:16p Hoffoss
* Changed sound stuff used in interface screens for interface purposes.
*
* 52 12/01/97 5:25p Hoffoss
* Routed interface sound playing through a special function that will
* only allow one instance of the sound to play at a time, avoiding
* over-mixing problems.
*
* 51 11/20/97 5:36p Dave
* Hooked in a bunch of main hall changes (including sound). Made it
* possible to reposition (rewind/ffwd)
* sound buffer pointers. Fixed animation direction change framerate
* problem.
*
* 50 11/11/97 10:25p Lawrance
* add sound hook for when missile threat flashes
*
* 49 11/03/97 11:08p Lawrance
* Add sound for collisions with shields.
*
* 48 11/03/97 2:07p Lawrance
* add ship-to-ship collision sound
*
* 47 10/28/97 4:49p Lawrance
* add sound hook that gets played when player warps out
*
* 46 10/27/97 10:48p Lawrance
* add second explosion sound
*
* 45 10/11/97 6:39p Lawrance
* added sound hooks for static sound
*
* 44 10/10/97 7:45p Lawrance
* add warp fail sound
*
* 43 9/19/97 2:45p Lawrance
* add hook for weapon animation sound
*
* 42 9/12/97 4:02p John
* put in ship warp out effect.
* put in dynamic lighting for warp in/out
*
* 41 9/07/97 10:01p Lawrance
* add some interface hooks
*
* 40 9/05/97 4:59p Lawrance
* added warp sound hook
*
* 39 9/03/97 5:05p Lawrance
* add support for ship flyby sound
*
* 38 8/25/97 12:25a Lawrance
* added sound for when shield energy is transferred between quadrants
*
* 37 8/18/97 5:28p Lawrance
* added some new interface sounds
*
* 36 8/12/97 5:52p Lawrance
* added hook for lock warning from aspect missile
*
* 35 8/11/97 9:48p Lawrance
* add sound hook for swarm missile
*
* 34 8/06/97 10:27a Lawrance
* added hook for shockwave create sound
*
* 33 7/17/97 10:50a Lawrance
* create a Shivan light laser so sound can be assigned
*
* 32 6/24/97 11:47p Lawrance
* add briefing sound fx
*
* 31 6/24/97 3:14p Lawrance
* add briefing sounds
*
* 30 6/13/97 4:44p Lawrance
* added another sound hook in ship selection
*
* 29 6/12/97 5:15p Lawrance
* added hook for ambient sound in briefing/ship select
*
* 28 6/05/97 11:25a Lawrance
* use sound signatures to ensure correct sound is loaded
*
* 27 6/05/97 1:07a Lawrance
* changes to support sound interface
*
* 26 6/04/97 1:18p Lawrance
* added hooks for shield impacts
*
* 25 5/23/97 11:20a Lawrance
* counter measure sounds specified in weapons.tbl
*
* 24 5/22/97 12:04p Lawrance
* added soundhook for cmeasure cycle
*
* 23 5/16/97 11:33a Lawrance
* add countermeasures and rearm sounds
*
* 22 5/14/97 11:24a Lawrance
* break up docking sound effect into an approach/depart and attach/detach
*
* 21 5/14/97 11:09a Lawrance
* add hooks for sounds played when player is hit by lasers or missiles
*
* 20 5/14/97 9:54a Lawrance
* supporting mission-specific briefing music
*
* 19 5/13/97 3:09p Lawrance
* added repair/rearm sound
*
* 18 5/13/97 10:44a Lawrance
* add several new sound effects
*
* 17 5/12/97 11:58a Lawrance
* removed obsolete sound
*
* 16 5/06/97 2:12p Lawrance
* rearrange order of sounds
*
* 15 5/06/97 9:36a Lawrance
* added support for min and max distances for 3d sounds
*
* 14 4/23/97 5:19p Lawrance
* split up misc sounds into: gamewide, ingame, and interface
*
* 13 4/20/97 11:48a Lawrance
* added array of filenames for misc sounds. Will be useful if we want to
* unload then re-load sounds
*
* 12 4/18/97 2:54p Lawrance
* sounds now have a default volume, when playing, pass a scaling factor
* not the actual volume
*
* 11 4/15/97 2:49p Lawrance
* add new sounds
*
* 10 3/26/97 11:27a Lawrance
* added hooks for sounds to be played when trying to fire missles when
* none left / trying to fire lasers with no energy
*
* 9 3/19/97 5:53p Lawrance
* integrating new Misc_sounds[] array (replaces old Game_sounds
* structure)
*
* 8 3/17/97 3:47p Mike
* Homing missile lock sound.
* More on AI ships firing missiles.
*
* 7 3/10/97 8:54a Lawrance
* added gamesnd_init_looping_sounds()
*
* 6 2/28/97 8:41a Lawrance
* added afterburner engage and burn sounds
*
* 5 2/14/97 12:37a Lawrance
* added hooks to play docking/undocking sounds
*
* 4 2/13/97 12:03p Lawrance
* hooked in throttle sounds
*
* 3 2/05/97 10:35a Lawrance
* supporting spooled music at menus, briefings, credits etc.
*
* 2 1/20/97 7:58p John
* Fixed some link errors with testcode.
*
* 1 1/20/97 7:08p John
*
* $NoKeywords: $
*/
#ifndef __GAMESND_H__
#define __GAMESND_H__
#include "sound/sound.h"
#include "mission/missionparse.h"
#ifndef NO_SOUND
void gamesnd_parse_soundstbl(); // Loads in general game sounds from sounds.tbl
void gamesnd_init_sounds(); // initializes the Snds[] and Snds_iface[] array
void gamesnd_load_gameplay_sounds();
void gamesnd_unload_gameplay_sounds();
void gamesnd_load_interface_sounds();
void gamesnd_unload_interface_sounds();
void gamesnd_preload_common_sounds();
void gamesnd_play_iface(int n);
void gamesnd_play_error_beep();
void common_play_highlight_sound(); // called from interface code
#else
#define gamesnd_parse_soundstbl()
#define gamesnd_init_sounds()
#define gamesnd_load_gameplay_sounds()
#define gamesnd_unload_gameplay_sounds()
#define gamesnd_load_interface_sounds()
#define gamesnd_unload_interface_sounds()
#define gamesnd_preload_common_sounds()
#define gamesnd_play_iface(n) ((void)(n))
#define gamesnd_play_error_beep()
// this is a callback, so it needs to be a real function
void common_play_highlight_sound();
#endif // ifndef NO_SOUND
// Misc_sounds[] holds handles for misc sounds in the game (list appears in sounds.tbl)
#define MAX_GAME_SOUNDS 200
#define MAX_INTERFACE_SOUNDS 70
#define MAX_SPECIES_FLYBY_SOUNDS 4 // 4 different possible flybys for species
extern game_snd Snds[MAX_GAME_SOUNDS];
extern game_snd Snds_iface[MAX_INTERFACE_SOUNDS];
// flyby sounds - 2 for each species (fighter and bomber flybys)
extern game_snd Snds_flyby[MAX_SPECIES_NAMES][2];
// symbolic names for misc. game sounds. The order here must match the order in
// sounds.tbl
//
// INSTRUCTIONS FOR ADDING A NEW SOUND:
//
// Add interface (ie non-gameplay) sounds to the end of the interface list of sounds.
// Add gameplay sounds to the correct portion of the gameplay sounds section (ie Misc,
// Weapons, or Ship).
//
// Then add a symbolic name to the appropriate position in the #define list below
// and add an entry to sounds.tbl. If there is no .wav file for the sound yet,
// specify sound_hook.wav in sounds.tbl.
//
//
//---------------------------------------------------
// Misc Sounds
//---------------------------------------------------
#define SND_MISSILE_TRACKING 0
#define SND_MISSILE_LOCK 1
#define SND_PRIMARY_CYCLE 2
#define SND_SECONDARY_CYCLE 3
#define SND_ENGINE 4
#define SND_CARGO_REVEAL 5
#define SND_DEATH_ROLL 6
#define SND_SHIP_EXPLODE_1 7
#define SND_TARGET_ACQUIRE 8
#define SND_ENERGY_ADJUST 9
#define SND_ENERGY_ADJUST_FAIL 10
#define SND_ENERGY_TRANS 11
#define SND_ENERGY_TRANS_FAIL 12
#define SND_FULL_THROTTLE 13
#define SND_ZERO_THROTTLE 14
#define SND_THROTTLE_UP 15
#define SND_THROTTLE_DOWN 16
#define SND_DOCK_APPROACH 17
#define SND_DOCK_ATTACH 18
#define SND_DOCK_DETACH 19
#define SND_DOCK_DEPART 20
#define SND_ABURN_ENGAGE 21
#define SND_ABURN_LOOP 22
#define SND_VAPORIZED 23
#define SND_ABURN_FAIL 24
#define SND_HEATLOCK_WARN 25
#define SND_OUT_OF_MISSLES 26
#define SND_OUT_OF_WEAPON_ENERGY 27
#define SND_TARGET_FAIL 28
#define SND_SQUADMSGING_ON 29
#define SND_SQUADMSGING_OFF 30
#define SND_DEBRIS 31
#define SND_SUBSYS_DIE_1 32
#define SND_MISSILE_START_LOAD 33
#define SND_MISSILE_LOAD 34
#define SND_SHIP_REPAIR 35
#define SND_PLAYER_HIT_LASER 36
#define SND_PLAYER_HIT_MISSILE 37
#define SND_CMEASURE_CYCLE 38
#define SND_SHIELD_HIT 39
#define SND_SHIELD_HIT_YOU 40
#define SND_GAME_MOUSE_CLICK 41
#define SND_ASPECTLOCK_WARN 42
#define SND_SHIELD_XFER_OK 43
#define SND_ENGINE_WASH 44
#define SND_WARP_IN 45
#define SND_WARP_OUT 46 // Same as warp in for now
#define SND_PLAYER_WARP_FAIL 47
#define SND_STATIC 48
#define SND_SHIP_EXPLODE_2 49
#define SND_PLAYER_WARP_OUT 50
#define SND_SHIP_SHIP_HEAVY 51
#define SND_SHIP_SHIP_LIGHT 52
#define SND_SHIP_SHIP_SHIELD 53
#define SND_THREAT_FLASH 54
#define SND_PROXIMITY_WARNING 55
#define SND_PROXIMITY_ASPECT_WARNING 56
#define SND_DIRECTIVE_COMPLETE 57
#define SND_SUBSYS_EXPLODE 58
#define SND_CAPSHIP_EXPLODE 59
#define SND_CAPSHIP_SUBSYS_EXPLODE 60
#define SND_LARGESHIP_WARPOUT 61
#define SND_ASTEROID_EXPLODE_BIG 62
#define SND_ASTEROID_EXPLODE_SMALL 63
#define SND_CUE_VOICE 64
#define SND_END_VOICE 65
#define SND_CARGO_SCAN 66
#define SND_WEAPON_FLYBY 67
#define SND_ASTEROID 68
#define SND_CAPITAL_WARP_IN 69
#define SND_CAPITAL_WARP_OUT 70
#define SND_ENGINE_LOOP_LARGE 71
#define SND_SUBSPACE_LEFT_CHANNEL 72
#define SND_SUBSPACE_RIGHT_CHANNEL 73
#define SND_MISSILE_EVADED_POPUP 74
#define SND_ENGINE_LOOP_HUGE 75
// Weapon sounds
#define SND_LIGHT_LASER_FIRE 76
#define SND_LIGHT_LASER_IMPACT 77
#define SND_HVY_LASER_FIRE 78
#define SND_HVY_LASER_IMPACT 79
#define SND_MASSDRV_FIRED 80
#define SND_MASSDRV_IMPACT 81
#define SND_FLAIL_FIRED 82
#define SND_FLAIL_IMPACT 83
#define SND_NEUTRON_FLUX_FIRED 84
#define SND_NEUTRON_FLUX_IMPACT 85
#define SND_DEBUG_LASER_FIRED 86
#define SND_ROCKEYE_FIRED 87
#define SND_MISSILE_IMPACT1 88
#define SND_MAG_MISSILE_LAUNCH 89
#define SND_FURY_MISSILE_LAUNCH 90
#define SND_SHRIKE_MISSILE_LAUNCH 91
#define SND_ANGEL_MISSILE_LAUNCH 92
#define SND_CLUSTER_MISSILE_LAUNCH 93
#define SND_CLUSTERB_MISSILE_LAUNCH 94
#define SND_STILETTO_MISSILE_LAUNCH 95
#define SND_TSUNAMI_MISSILE_LAUNCH 96
#define SND_HARBINGER_MISSILE_LAUNCH 97
#define SND_MEGAWOKKA_MISSILE_LAUNCH 98
#define SND_CMEASURE1_LAUNCH 99
#define SND_SHIVAN_LIGHT_LASER_FIRE 100
#define SND_SHOCKWAVE_EXPLODE 101
#define SND_SWARM_MISSILE_LAUNCH 102
#define SND_SHOCKWAVE_IMPACT 109
#define SND_TARG_LASER_LOOP 115
#define SND_FLAK_FIRE 116
#define SND_SHIELD_BREAKER 117
#define SND_EMP_MISSILE 118
#define SND_AUTOCANNON_LOOP 119
#define SND_AUTOCANNON_SHOT 120
#define SND_BEAM_LOOP 121
#define SND_BEAM_UP 122
#define SND_BEAM_DOWN 123
#define SND_BEAM_SHOT 124
#define SND_BEAM_VAPORIZE 125
// Ship engine sounds
#define SND_TERRAN_FIGHTER_ENG 126
#define SND_TERRAN_BOMBER_ENG 127
#define SND_TERRAN_CAPITAL_ENG 128
#define SND_SPECIESB_FIGHTER_ENG 129
#define SND_SPECIESB_BOMBER_ENG 130
#define SND_SPECIESB_CAPITAL_ENG 131
#define SND_SHIVAN_FIGHTER_ENG 132
#define SND_SHIVAN_BOMBER_ENG 133
#define SND_SHIVAN_CAPITAL_ENG 134
#define SND_REPAIR_SHIP_ENG 135
// Debris electric arcing sounds
#define SND_DEBRIS_ARC_01 139 // 0.10 second spark sound effect (3d sound)
#define SND_DEBRIS_ARC_02 140 // 0.25 second spark sound effect (3d sound)
#define SND_DEBRIS_ARC_03 141 // 0.50 second spark sound effect (3d sound)
#define SND_DEBRIS_ARC_04 142 // 0.75 second spark sound effect (3d sound)
#define SND_DEBRIS_ARC_05 143 // 1.00 second spark sound effect (3d sound)
// copilot
#define SND_COPILOT 162
// supernova 1 and supernova 2
#define SND_SUPERNOVA_1 173
#define SND_SUPERNOVA_2 174
// lightning sounds
#define SND_LIGHTNING_1 180
#define SND_LIGHTNING_2 181
//---------------------------------------------------
// Interface sounds
//---------------------------------------------------
#define SND_IFACE_MOUSE_CLICK 0
#define SND_ICON_PICKUP 1
#define SND_ICON_DROP_ON_WING 2
#define SND_ICON_DROP 3
#define SND_SCREEN_MODE_PRESSED 4
#define SND_SWITCH_SCREENS 5
#define SND_HELP_PRESSED 6
#define SND_COMMIT_PRESSED 7
#define SND_PREV_NEXT_PRESSED 8
#define SND_SCROLL 9
#define SND_GENERAL_FAIL 10
#define SND_SHIP_ICON_CHANGE 11
#define SND_MAIN_HALL_AMBIENT 12
#define SND_BTN_SLIDE 13
#define SND_BRIEF_STAGE_CHG 14
#define SND_BRIEF_STAGE_CHG_FAIL 15
#define SND_BRIEF_ICON_SELECT 16
#define SND_USER_OVER 17
#define SND_USER_SELECT 18
#define SND_RESET_PRESSED 19
#define SND_BRIEF_TEXT_WIPE 20
#define SND_VASUDAN_PA_1 21 // vasudan pa 1
#define SND_WEAPON_ANIM_START 22
#define SND_MAIN_HALL_DOOR_OPEN 23
#define SND_MAIN_HALL_DOOR_CLOSE 24
#define SND_GLOW_OPEN 25
#define SND_VASUDAN_PA_2 26 // vasudan pa 2
#define SND_AMBIENT_MENU 27
#define SND_POPUP_APPEAR 28
#define SND_POPUP_DISAPPEAR 29
#define SND_VOICE_SLIDER_CLIP 30
#define SND_VASUDAN_PA_3 31 // vasudan pa 3
#define SND_MAIN_HALL_GET_PEPSI 32
#define SND_MAIN_HALL_LIFT_UP 33
#define SND_MAIN_HALL_WELD1 34
#define SND_MAIN_HALL_WELD2 35
#define SND_MAIN_HALL_WELD3 36
#define SND_MAIN_HALL_WELD4 37
#define SND_MAIN_HALL_INT1 38 // random intercom message 1
#define SND_MAIN_HALL_INT2 39 // random intercom message 2
#define SND_MAIN_HALL_INT3 40 // random intercom message 3
#define SND_ICON_HIGHLIGHT 41
#define SND_BRIEFING_STATIC 42
#define SND_MAIN_HALL2_CRANE1_1 43
#define SND_MAIN_HALL2_CRANE1_2 44
#define SND_MAIN_HALL2_CRANE2_1 45
#define SND_MAIN_HALL2_CRANE2_2 46
#define SND_MAIN_HALL2_CAR1 47
#define SND_MAIN_HALL2_CAR2 48
#define SND_MAIN_HALL2_INT1 49
#define SND_MAIN_HALL2_INT2 50
#define SND_MAIN_HALL2_INT3 51
#define SND_VASUDAN_BUP 61
#endif /* __GAMESND_H__ */
+97
View File
@@ -0,0 +1,97 @@
/*
** Copyright (c) 1995, 3Dfx Interactive, Inc.
** All Rights Reserved.
**
*/
#ifndef __3DFX_H__
#define __3DFX_H__
/*
** basic data types
*/
typedef unsigned char FxU8;
typedef signed char FxI8;
typedef unsigned short FxU16;
typedef signed short FxI16;
typedef signed long FxI32;
typedef unsigned long FxU32;
typedef int FxBool;
typedef float FxFloat;
typedef double FxDouble;
/*
** color types
*/
typedef unsigned long FxColor_t;
typedef struct { float r, g, b, a; } FxColor4;
/*
** fundamental types
*/
#define FXTRUE 1
#define FXFALSE 0
/*
** helper macros
*/
#define FXUNUSED( a ) ( (a) = (a) )
#define FXBIT( i ) ( 1L << (i) )
/*
** export macros
*/
#if defined(_MSC_VER)
#if defined (MSVC16)
#define FX_ENTRY
#define FX_CALL
#else
#define FX_ENTRY extern
#define FX_CALL __stdcall
#endif
#elif defined(__WATCOMC__)
#define FX_ENTRY extern
#define FX_CALL __stdcall
#elif defined (__IBMC__) || defined (__IBMCPP__)
/* IBM Visual Age C/C++: */
#define FX_ENTRY extern
#define FX_CALL __stdcall
#elif defined(__DJGPP__)
#define FX_ENTRY extern
#define FX_CALL
#elif defined(__unix__)
#define FX_ENTRY extern
#define FX_CALL
#else
#warning define FX_ENTRY & FX_CALL for your compiler
#define FX_ENTRY extern
#define FX_CALL
#endif
/*
** x86 compiler specific stuff
*/
#if defined(__BORLANDC_)
# define REALMODE
# define REGW( a, b ) ((a).x.b)
# define REGB( a, b ) ((a).h.b)
# define INT86( a, b, c ) int86(a,b,c)
# define INT86X( a, b, c, d ) int86x(a,b,c,d)
# define RM_SEG( a ) FP_SEG( a )
# define RM_OFF( a ) FP_OFF( a )
#elif defined(__WATCOMC__)
# undef FP_SEG
# undef FP_OFF
# define REGW( a, b ) ((a).w.b)
# define REGB( a, b ) ((a).h.b)
# define INT86( a, b, c ) int386(a,b,c)
# define INT86X( a, b, c, d ) int386x(a,b,c,d)
# define RM_SEG( a ) ( ( ( ( FxU32 ) (a) ) & 0x000F0000 ) >> 4 )
# define RM_OFF( a ) ( ( FxU16 ) (a) )
#endif
#endif /* !__3DFX_H__ */
+111
View File
@@ -0,0 +1,111 @@
/*
** Copyright (c) 1995, 1996, 3Dfx Interactive, Inc.
** All Rights Reserved.
**
*/
/* preprocessor defines for libraries to support DLL creation */
/* in header file, use FX_ENTRY return-type FX_CALL function-name ( ... ) */
/* in source file, use FX_EXPORT return-type FX_CSTYLE function-name (... ) */
/* in source file, set FX_DLL_DEFINITION, include this file, then include
header file for library. */
/* we need to use two macros per declaration/definition because MSVC
requires __stdcall and __declspec( dllexport ) be in different parts
of the prototype! */
/* I use two sets in case we need to control declarations and definitions
differently. If it turns out we don't, it should be easy to do a search
and replace to eliminate one set */
/* NOTE: this header file may be included more than once, and FX_DLL_DEFINITION
may have changed, so we do not protect this with an #fndef __FXDLL_H__
statement like we normally would. */
#ifdef FX_ENTRY
#undef FX_ENTRY
#endif
#ifdef FX_CALL
#undef FX_CALL
#endif
#ifdef FX_EXPORT
#undef FX_EXPORT
#endif
#ifdef FX_CSTYLE
#undef FX_CSTYLE
#endif
#if defined(FX_DLL_DEFINITION)
#if defined(FX_DLL_ENABLE)
#if defined(_MSC_VER)
#ifndef KERNEL
#define FX_ENTRY __declspec( dllexport )
#define FX_EXPORT __declspec( dllexport )
#else
#define FX_ENTRY
#define FX_EXPORT
#endif /* #ifndef KERNEL */
#define FX_CALL __stdcall
#define FX_CSTYLE __stdcall
#elif defined(__WATCOMC__)
#define FX_ENTRY
#define FX_CALL __stdcall __export
#define FX_EXPORT
#define FX_CSTYLE __stdcall __export
#else /* compiler */
#error define FX_ENTRY,FX_CALL & FX_EXPORT,FX_CSTYLE for your compiler
#endif /* compiler */
#else /* FX_DLL_ENABLE */
#define FX_ENTRY
#define FX_CALL __stdcall
#define FX_EXPORT
#define FX_CSTYLE __stdcall
#endif /* FX_DLL_ENABLE */
#else /* FX_DLL_DEFINITION */
#define FX_ENTRY extern
#define FX_CALL __stdcall
#endif /* FX_DLL_DEFINITION */
/*
* We don't want any of this DLL junk for DJGPP or UNIX
* so undo what is done above.
*/
#if defined(__DJGPP__) || defined(__unix__)
#ifdef FX_CALL
#undef FX_CALL
#endif
#ifdef FX_CSTYLE
#undef FX_CSTYLE
#endif
#ifdef FX_EXPORT
#undef FX_EXPORT
#endif
#ifdef FX_ENTRY
#undef FX_ENTRY
#endif
#define FX_CALL
#define FX_CSTYLE
#define FX_EXPORT
#define FX_ENTRY
#endif
#if defined (MSVC16)
#undef FX_CALL
#define FX_CALL
#endif
Loaded 100 of 552 files, more files were not shown because too many files have changed in this diff. Show more