Compare commits

..
126 Commits
Author SHA1 Message Date
karajorma f475ae983e Sync with Trunk (Part IV) 2010-09-20 08:21:41 +00:00
karajorma 3be57f609e Sync with Trunk (Part III) 2010-09-20 08:06:39 +00:00
karajorma fc66e2f78b Sync with Trunk (Part II) - I knew I'd miss something. 2010-09-20 07:17:50 +00:00
karajorma 1afadaa142 Sync with Trunk (Part I) 2010-09-20 05:49:34 +00:00
karajorma 1583b74c9d Missed that somehow. 2010-03-04 09:53:05 +00:00
karajorma e8ba07ee43 Sync with trunk 2010-03-02 05:25:56 +00:00
karajorma 7f706d398f Revert the Toggle Behaviour When Crippled flag as it's not good enough really. I'll add a better solution later. 2010-03-01 14:57:43 +00:00
karajorma 7b50be4afb Sync with trunk 2010-02-24 03:27:01 +00:00
karajorma f690e124d0 These should have been removed. 2010-02-23 13:50:27 +00:00
karajorma df6e87f552 As promised, a much better fix for the issue of ships losing orders/getting protected as soon as something has disarm/disable orders. 2010-02-23 13:49:15 +00:00
karajorma 45305bf78f Sync with trunk 2010-02-19 04:44:25 +00:00
karajorma e6f640c53d Sync with trunk 2009-11-02 07:12:36 +00:00
karajorma 4f1d39ed0e Sync with trunk 2009-07-19 09:42:46 +00:00
karajorma a7570926c9 Some minor changes which appear to have slipped into one codebase but not the other. 2009-07-18 17:48:22 +00:00
karajorma aa481d7463 Sync with trunk 2009-07-18 17:26:06 +00:00
karajorma e79afa5b65 Fix a couple of typos other people made. One minor, one not so minor. 2009-07-15 21:50:23 +00:00
karajorma b69a80db90 Sync with trunk 2009-07-15 21:29:08 +00:00
karajorma 5f64b680f5 Sync with trunk 2009-07-10 17:20:11 +00:00
karajorma a3508be54a Sync with the right branch this time! 2009-07-05 20:55:42 +00:00
karajorma 0fede5f475 Revert last sync 2009-07-05 20:47:25 +00:00
karajorma a8c36b9654 Sync with trunk 2009-07-05 20:30:57 +00:00
karajorma 8c98287b39 Sync with trunk 2009-07-02 17:21:49 +00:00
karajorma 345fa9c3ac Sync with trunk again 2009-06-30 22:09:08 +00:00
karajorma cf483e0237 Sync with trunk 2009-06-30 07:20:30 +00:00
karajorma f40710f500 Mark Selected Ships via information in FRED too as this is more likely to still be used rather than the slow wireframe marking. 2009-06-27 12:34:25 +00:00
karajorma 9f162d813f Sync with trunk 2009-06-22 20:17:00 +00:00
karajorma 3edee14eea Sync with trunk 2009-06-14 16:09:49 +00:00
karajorma 82757763e6 Sync with trunk 2009-06-06 10:51:02 +00:00
karajorma 91346a814d Sync with trunk 2009-05-24 22:01:10 +00:00
karajorma 5f013ad41d Allow lua to send variable changes from client to server. 2009-05-24 15:42:19 +00:00
karajorma 00cd5490c4 Sync with trunk 2009-05-21 14:59:36 +00:00
karajorma a4542cf71b Fix a newline issue with skybox flags. 2009-05-21 14:02:40 +00:00
karajorma f4521da771 Sync with trunk 2009-05-21 13:50:06 +00:00
karajorma 6ba0f3622a Fix Mantis 1926 (Piranha submunitions home in on the ship that fired them in dogfight mode) 2009-05-18 21:41:20 +00:00
karajorma e3765e24e1 Sync with trunk 2009-05-17 12:08:06 +00:00
karajorma 7171bf1005 Sync with trunk 2009-05-16 12:36:06 +00:00
karajorma b85ee3217d A couple of minor corrections. 2009-05-15 20:31:01 +00:00
karajorma 12f137c645 Version Bump 2009-05-10 09:54:14 +00:00
karajorma f0eb798f7e Add the High Praise and Primaries Low builtin message types 2009-05-09 18:37:18 +00:00
karajorma 5c60351288 Sync with Trunk 2009-05-09 17:40:14 +00:00
karajorma 5895aca2c5 Warning level bump 2009-05-09 09:34:05 +00:00
karajorma cfd2469f8b Fix some minor warnings 2009-05-09 09:30:34 +00:00
karajorma 0094a5dba4 Sync with trunk 2009-05-08 17:19:10 +00:00
karajorma 94e84fc9b8 Switch a couple of Asserts to Assertions. 2009-05-08 17:18:46 +00:00
karajorma 35ad2c5cdc Add support for multiple builtins of the same type. 2009-05-08 17:17:40 +00:00
karajorma af7e0a700b Add support for new builtin message types 2009-05-08 17:08:01 +00:00
karajorma 8943449825 Switch network variables over to the SEXP packet except for when called from lua 2009-05-08 17:05:43 +00:00
karajorma 555488e0bb Add the Assertion Macro as an alternative to Assert. 2009-05-05 10:09:15 +00:00
karajorma c6cf9da861 Add the set-ambient-light SEXP 2009-05-05 10:07:00 +00:00
karajorma f11e9253b2 Allow multi-docking in multiplayer. 2009-05-04 12:19:34 +00:00
karajorma fac68e4838 Maybe fix a crash with voice recognition. 2009-05-01 17:01:29 +00:00
karajorma 17d8105c38 Fix an issue with calling up the options menu while waiting for popupdead to appear. 2009-05-01 09:54:26 +00:00
karajorma a31eed376c This one too. 2009-04-30 11:22:01 +00:00
karajorma e8abd881d2 Forgot to commit that. 2009-04-30 10:43:57 +00:00
karajorma 136b5c936d Add a ship and parse flag to lock all turrets initially. Fix the Lock Primary/Secondary checkboxes to work for multi-selection. Add a checkbox for lock afterburner. 2009-04-28 13:13:47 +00:00
karajorma 34855d000e Break up the status SEXPs into sub-categories. 2009-04-26 22:13:03 +00:00
karajorma b6eed01e41 Auto-expand branches after pasting, add-pasting or replacing SEXPs. I really don't know why someone didn't get rid of that petty annoyance years ago. 2009-04-26 21:56:59 +00:00
karajorma 9616fb4cd7 Fix an assertion that crops up when you have no selected message but click on delete message. Has the side effect of making the message editor much less annoying too. 2009-04-26 21:51:53 +00:00
karajorma 344d8ba217 Fix a bug where the order of SEXP arguments was reversed. 2009-04-25 18:21:28 +00:00
karajorma 7e5239aff0 An ounce of prevention with the multiplayer SEXP packet code. 2009-04-24 21:56:09 +00:00
karajorma 09d5225883 Fix Mantis 1371 (Can target target's target even if it is stealthed or hidden from sensors). 2009-04-24 21:54:12 +00:00
karajorma 7f3ba14cec Fix Mantis 1538 (special hitpoints not updated properly on deletion) 2009-04-24 21:17:10 +00:00
karajorma 850414b358 Fix Mantis 1909 (Can't paste variables in FRED) 2009-04-24 19:58:29 +00:00
karajorma f18fa672f2 Fix (part of) Mantis 1677 (cap-subsys-cargo-known-delay doesn't list the correct ships) 2009-04-24 16:43:09 +00:00
karajorma fcb62348b9 Fix Mantis 1813 (Negative number constants could be added in FRED for SEXPs which expected OPF_POSITIVE, often resulting in crashes). 2009-04-24 15:54:44 +00:00
karajorma fbbb31bc49 Previous fix makes this code unnecessary so it might as well be removed. 2009-04-24 13:08:29 +00:00
karajorma 4d0e574ba4 Fix Mantis 1911 (Add Data doesn't show the <argument> option) 2009-04-24 13:05:24 +00:00
karajorma ce5b56fdf7 Don't need to set that flag. 2009-04-24 10:33:17 +00:00
karajorma 04de7f7498 Fix Mantis 1913 (Characters after # are visible in the wings and reinforcements comms menu) 2009-04-23 18:46:29 +00:00
karajorma 46b2165312 Sync with trunk 2009-04-23 18:43:02 +00:00
karajorma 4182951b19 Fix Mantis 1884 (Entering the name of an invalid operator in any dialog other than events editor would crash FRED)
Fix a typo in disable-builtin-messages
2009-04-22 20:39:32 +00:00
karajorma cbd6f247d9 Fix Mantis 1916 (Can't change the dockpoint a ship is initial docked to without undocking it) 2009-04-21 18:00:03 +00:00
karajorma 73facc313e Fix Mantis 1907 (Error in the get-damage-caused description) 2009-04-21 08:18:02 +00:00
karajorma d2e3094544 Add SEXPs to set weapon, shield and afterburner energy. 2009-04-15 19:34:12 +00:00
karajorma 61512d5b8f First commit of the SEXP packet code. 2009-04-15 19:32:56 +00:00
karajorma 2b42038c09 Fix Mantis 1910 (Assist Percentage resets itself when ships are multi selected) 2009-04-09 14:36:48 +00:00
karajorma ad8f6ccda3 Some minor changes to the way the game uses the scoring features I added earlier. 2009-04-08 15:56:22 +00:00
karajorma a201c9b3f3 Move the repair penalty to an AI profile setting. 2009-04-05 16:55:08 +00:00
karajorma 7edde650a1 Add the validate-argument SEXP.
Fix a minor initialisation error with the ship-tag SEXP.
2009-04-05 16:48:07 +00:00
karajorma ae3b88f23b Sync with trunk 2009-04-02 17:37:42 +00:00
karajorma c86e58e5e8 Fix Mantis 1883 (spaces at the end of ship and wing names can cause errors) 2009-04-02 17:33:29 +00:00
karajorma f441432d57 Fix a bug which was causing FRED to choke on the ; and " replacement fix. 2009-04-02 17:30:10 +00:00
karajorma 417982862e Fix an issue with homing capship missiles not tracking correctly. 2009-04-01 11:17:48 +00:00
karajorma 158733df8f Apparently even the null terminator needs to be coloured. 2009-03-31 18:38:13 +00:00
karajorma 4b75870857 Sync with trunk 2009-03-29 21:31:50 +00:00
karajorma dbfe86f018 Allow wireframe for the targetbox to be set from hud_gauges.tbl. 2009-03-29 21:03:24 +00:00
karajorma f7d95acec8 Fix Mantis 1753 (Using " or ; in briefings and messages causes them to either vanish or truncate the message)
Fix a bug that prevented lcl_replace_stuff() working properly when a message had two or more replacements of the same type.
2009-03-29 17:56:32 +00:00
karajorma 506686cfb7 Fix Mantis 1859 (FRED crashes if an unknown ship type is detected in the loadout.) 2009-03-29 12:39:01 +00:00
karajorma 8415a591e1 Allow the boilerplate traitor debrief to be turned off even if the player did turn traitor. 2009-03-24 15:22:57 +00:00
karajorma 1f8644f059 Fix Mantis 1620 (Replace Number/String don't work in FRED) 2009-03-21 21:48:20 +00:00
karajorma f32f947b62 Sync with trunk 2009-03-20 14:01:12 +00:00
karajorma 99ce717f7e Allow beams on any player ship to count for kills. Not just fighters and bombers. 2009-03-20 13:49:14 +00:00
karajorma 28f32a2f6d Fix the FictionViewer truncating anything with more than 70 lines. 2009-03-17 18:01:59 +00:00
karajorma 3d5d730306 Sync with trunk. 2009-03-05 22:19:24 +00:00
karajorma 96426de56f Fix Mantis 1661 (Ships leaving via the fighter bay don't disappear on multiplayer clients). 2009-03-05 22:12:34 +00:00
karajorma b14b5e3622 Fix multiplayer for Inferno builds. 2009-03-02 09:28:08 +00:00
karajorma 35cd6ea336 Various fixes needed to allow multiplayer to use over 255 weapons. 2009-02-27 20:04:44 +00:00
karajorma 3332870e9e Bobboau's Skybox flags code (via Wanderer then me) 2009-02-27 11:53:20 +00:00
karajorma 944c4bb2f2 Add new sexps to determine the amount of afterburner and weapon energy remaining. Add a missing resource file. 2009-02-26 13:17:00 +00:00
karajorma 705faf4a78 Sync up project files with Trunk 2009-02-25 20:02:18 +00:00
karajorma 614eda3b08 Sync with Trunk 2009-02-25 19:56:10 +00:00
karajorma 593cf6a533 Sync with trunk 2009-02-14 23:38:11 +00:00
karajorma 17ddae5db4 Fix Mantis 1486 (Pressing F4 locks multiplayer). Since this fix breaks compatibility I'll save up a few similar breaks and commit them all to trunk at the same time. 2009-02-14 21:47:53 +00:00
karajorma d1b1eb65b6 Add Wanderer's Salvo Mode. Sync the 2008 project files up with Trunk. 2009-01-27 20:25:00 +00:00
karajorma 43ee74a2e0 Patch in Wanderer's subsystem flag 2009-01-13 17:43:09 +00:00
karajorma 20d33ac699 Sync with trunk 2009-01-09 18:29:01 +00:00
karajorma 1609e9211f Sync with Trunk 2008-12-15 19:08:07 +00:00
karajorma c8c05e9d0b Add support for cutscenes before the various briefing and debriefing sections (FRED support for this feature will come later.) 2008-12-15 18:43:43 +00:00
karajorma 35130122e4 Sync up with trunk 2008-12-14 18:44:06 +00:00
karajorma c1b549867a Sync with Trunk. 2008-11-17 18:27:02 +00:00
karajorma efea823ef1 Fix a bug where the log displays incorrect percentages for kills. 2008-11-17 15:12:41 +00:00
karajorma 91e375693c Sync with Trunk. 2008-10-15 19:28:40 +00:00
karajorma 022aa38ad1 KeldorKatarn's afterburner lock SEXPs 2008-09-12 21:54:57 +00:00
karajorma 40419fb891 Allow players to filter who they send messages to when using the chatbox 2008-09-10 17:36:09 +00:00
karajorma 25d4a3b439 Update branch to latest SVN 2008-09-10 15:10:32 +00:00
karajorma 968e8d3d66 Sync with trunk 2008-08-20 20:58:15 +00:00
karajorma 6610938b80 Sync with trunk 2008-08-04 19:18:47 +00:00
karajorma 4b2691f572 Might as well update the project files too 2008-07-25 17:43:21 +00:00
karajorma 0ac2532fe5 Metge branch with trunk 2008-07-25 17:40:17 +00:00
karajorma e42892cb90 Change the project file to add the new alt classes file. 2008-06-17 19:39:02 +00:00
karajorma 0d14a559eb FRED changes for team loadout. 2008-06-17 19:36:16 +00:00
karajorma 2a65fcb388 Commit the actual team loadout code. 2008-06-17 19:20:34 +00:00
karajorma a02b9d953a Get-Damage-Caused SEXP and a couple of functions for counting the number of variables of a certain type. 2008-06-17 19:17:55 +00:00
karajorma 53f8c36587 Changes to allow more data to be used from exited_ship. Make ship_exited dynamic too. 2008-06-17 19:10:28 +00:00
karajorma 8323f5b4ad A couple of new parsing functions for dealing with variables in fields that previously only accepted integers or strings. 2008-06-17 18:49:11 +00:00
Goober5000 6ef349a6d4 made a copy 2008-06-17 02:52:56 +00:00
226 changed files with 32503 additions and 24898 deletions

No files matched your search

-175
View File
@@ -712,178 +712,3 @@ int main ()
AC_SUBST(THEORA_LIBS)
rm -f conf.theoratest
])
dnl AM_PATH_OPENAL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for OpenAL, and define OPENAL_CFLAGS and OPENAL_LIBS
dnl
AC_DEFUN([AM_PATH_OPENAL],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(openal,[ --with-openal=PFX Prefix where OpenAL is installed (optional)], openal_prefix="$withval", openal_prefix="")
AC_ARG_WITH(openal-libraries,[ --with-openal-libraries=DIR Directory where OpenAL library is installed (optional)], openal_libraries="$withval", openal_libraries="")
AC_ARG_WITH(openal-includes,[ --with-openal-includes=DIR Directory where OpenAL header files are installed (optional)], openal_includes="$withval", openal_includes="")
AC_ARG_ENABLE(openaltest, [ --disable-openaltest Do not try to compile and run a test OpenAL program],, enable_openaltest=yes)
if test "x$openal_libraries" != "x" ; then
OPENAL_LIBS="-L$openal_libraries"
elif test "x$openal_prefix" != "x" ; then
OPENAL_LIBS="-L$openal_prefix/lib"
elif test "x$prefix" != "xNONE"; then
OPENAL_LIBS="-L$libdir"
fi
OPENAL_LIBS="$OPENAL_LIBS -lopenal"
if test "x$openal_includes" != "x" ; then
OPENAL_CFLAGS="-I$openal_includes"
elif test "x$openal_prefix" != "x" ; then
OPENAL_CFLAGS="-I$openal_prefix/include"
elif test "x$prefix" != "xNONE"; then
OPENAL_CFLAGS=""
fi
AC_MSG_CHECKING(for OpenAL)
no_openal=""
if test "x$enable_openaltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $OPENAL_CFLAGS"
LIBS="$LIBS $OPENAL_LIBS"
dnl
dnl Now check if the installed OpenAL is sufficiently new.
dnl
rm -f conf.openaltest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <AL/al.h>
#include <AL/alc.h>
int main ()
{
#ifdef AL_VERSION_1_1
alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT");
system("touch conf.openaltest");
return 0;
#else
printf("\n*** OpenAL version 1.1 or greater is required.\n");
return 1;
#endif
}
],, no_openal=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_openal" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.openaltest ; then
:
else
echo "*** Could not run OpenAL test program, checking why..."
CFLAGS="$CFLAGS $OPENAL_CFLAGS"
LIBS="$LIBS $OPENAL_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <AL/al.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding OpenAL or finding the wrong"
echo "*** version of OpenAL. If it is not finding OpenAL, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means OpenAL was incorrectly installed"
echo "*** or that you have moved OpenAL since it was installed." ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
OPENAL_CFLAGS=""
OPENAL_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(OPENAL_CFLAGS)
AC_SUBST(OPENAL_LIBS)
rm -f conf.openaltest
])
dnl AM_PATH_OPENGL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for OpenGL, and define OPENGL_CFLAGS and OPENGL_LIBS
dnl
AC_DEFUN([AM_PATH_OPENGL],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(opengl,[ --with-opengl=PFX Prefix where OpenGL is installed (optional)], opengl_prefix="$withval", opengl_prefix="")
AC_ARG_WITH(opengl-libraries,[ --with-opengl-libraries=DIR Directory where OpenGL library is installed (optional)], opengl_libraries="$withval", opengl_libraries="")
AC_ARG_WITH(opengl-includes,[ --with-opengl-includes=DIR Directory where OpenGL header files are installed (optional)], opengl_includes="$withval", opengl_includes="")
AC_ARG_ENABLE(opengltest, [ --disable-opengltest Do not try to compile and run a test OpenGL program],, enable_opengltest=yes)
if test "x$opengl_libraries" != "x" ; then
OPENGL_LIBS="-L$opengl_libraries"
elif test "x$opengl_prefix" != "x" ; then
OPENGL_LIBS="-L$opengl_prefix/lib"
elif test "x$prefix" != "xNONE"; then
OPENGL_LIBS="-L$libdir"
fi
OPENGL_LIBS="$OPENGL_LIBS -lGL -lGLU"
if test "x$opengl_includes" != "x" ; then
OPENGL_CFLAGS="-I$opengl_includes"
elif test "x$opengl_prefix" != "x" ; then
OPENGL_CFLAGS="-I$opengl_prefix/include"
elif test "x$prefix" != "xNONE"; then
OPENGL_CFLAGS=""
fi
no_opengl=""
if test "x$enable_opengltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $OPENGL_CFLAGS"
LIBS="$LIBS $OPENGL_LIBS"
AC_CHECK_LIB(GL, glPushMatrix,
[AC_CHECK_HEADER(GL/gl.h,
[AC_CHECK_LIB(GLU, gluPerspective,
[AC_CHECK_HEADER(GL/glu.h, ,
dnl NOTE: this is a failure
no_opengl=yes
)]
)]
)]
)
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_opengl" = "x" ; then
ifelse([$1], , :, [$1])
else
OPENGL_CFLAGS=""
OPENGL_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(OPENGL_CFLAGS)
AC_SUBST(OPENGL_LIBS)
])
+2 -2
View File
@@ -258,6 +258,8 @@ FS2_SOURCES = \
debugconsole/dbugfile.h \
debugconsole/timerbar.cpp \
debugconsole/timerbar.h \
decals/decals.cpp \
decals/decals.h \
demo/demo.cpp \
demo/demo.h \
exceptionhandler/exceptionhandler.cpp \
@@ -291,8 +293,6 @@ FS2_SOURCES = \
globalincs/crypt.h \
globalincs/def_files.cpp \
globalincs/def_files.h \
globalincs/fsmemory.cpp \
globalincs/fsmemory.h \
globalincs/globals.h \
globalincs/linklist.h \
globalincs/pstypes.h \
-4
View File
@@ -393,10 +393,6 @@ void parse_ai_profiles_tbl(char *filename)
set_flag(profile, "$perform less checks for death screams:", AIPF2_PERFORM_LESS_SCREAM_CHECKS, AIP_FLAG2);
set_flag(profile, "$advanced turret fov edge checks:", AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS, AIP_FLAG2);
set_flag(profile, "$require turrets to have target in fov:", AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV, AIP_FLAG2);
set_flag(profile, "$all ships manage shields:", AIPF2_ALL_SHIPS_MANAGE_SHIELDS, AIP_FLAG2);
// if we've been through once already and are at the same place, force a move
+1 -4
View File
@@ -54,10 +54,7 @@
#define AIPF2_TURRETS_IGNORE_TARGET_RADIUS (1 << 0)
#define AIPF2_NO_SPECIAL_PLAYER_AVOID (1 << 1)
#define AIPF2_PERFORM_LESS_SCREAM_CHECKS (1 << 2)
#define AIPF2_ALL_SHIPS_MANAGE_SHIELDS (1 << 3)
#define AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS (1 << 4)
#define AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV (1 << 5)
#define AIPF2_ALL_SHIPS_MANAGE_SHIELDS (1 << 3)
#define MAX_AI_PROFILES 5
+2 -7
View File
@@ -376,12 +376,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
float dist;
pm = model_get( Ship_info[Ships[Pl_objp->instance].ship_info_index].model_num );
//Necessary sanity check
polymodel *pm_t;
pm_t = model_get(Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].model_num);
Assertion(aip->targeted_subsys->system_info->path_num <= pm_t->n_paths, "Invalid Path number %d for subsystem %s on ship %s (Model: %s)\n", aip->targeted_subsys->system_info->path_num, aip->targeted_subsys->system_info->name, Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].name, pm_t->filename );
if (aip->targeted_subsys->system_info->path_num > pm_t->n_paths)
return 0;
// If attacking a subsystem, ensure that we have an unobstructed line of sight... if not, then move
// towards path linked to subsystem
subsys_in_sight = 0; // assume Pl_objp doesn't have line of sight to subys
@@ -425,7 +420,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
aip->path_goal_dist = 5;
subsys_path_num = aip->targeted_subsys->system_info->path_num;
if ( ((aip->path_start) == -1 || (aip->mp_index != subsys_path_num)) && subsys_path_num <= pm->n_paths ) {
if ( (aip->path_start) == -1 || (aip->mp_index != subsys_path_num) ) {
// maybe create a new path
if ( subsys_path_num >= 0 ) {
Assert(aip->target_objnum >= 0);
+11 -17
View File
@@ -2900,7 +2900,7 @@ void ai_find_path(object *pl_objp, int objnum, int path_num, int exit_flag, int
if(pm->n_paths <= path_num)
Error(LOCATION,"ai_find_path tring to find a path (%d) that doesn't exist, on ship %s", path_num, shipp->ship_name);
// Assert(pm->n_paths > path_num);
aip->goal_objnum = objnum;
aip->goal_objnum = objp-Objects;
aip->goal_signature = objp->signature;
if (exit_flag)
create_model_exit_path(pl_objp, objp, path_num);
@@ -6507,14 +6507,8 @@ void do_random_sidethrust(ai_info *aip, ship_info *sip)
//This means that we get the same random values for a little bit.
//Using static_rand(shipnum) as a crude hash function to make sure that the seed is different for each ship and direction
//The *2 ensures that y and x stay separate.
if (strafeHoldDirAmount > 0) { //This may look unnecessary, but we're apparently still getting div by zero errors on Macs here.
side_vec.x = static_randf_range((((Missiontime + static_rand(aip->shipnum)) >> 16) / strafeHoldDirAmount) , -1.0f, 1.0f);
side_vec.y = static_randf_range((((Missiontime + static_rand(aip->shipnum)) >> 16) / strafeHoldDirAmount) * 2, -1.0f, 1.0f);
} else {
Warning(LOCATION, "Division by zero in do_random_sidethrust averted. Please tell a coder.\n");
side_vec.x = 1.0f;
side_vec.y = 1.0f;
}
side_vec.x = static_randf_range((((Missiontime + static_rand(aip->shipnum)) >> 16) / strafeHoldDirAmount) , -1.0f, 1.0f);
side_vec.y = static_randf_range((((Missiontime + static_rand(aip->shipnum)) >> 16) / strafeHoldDirAmount) * 2, -1.0f, 1.0f);
//Scale it up so that the longest dimension is length 1.0. This ensures we are always getting as much use out of sidethrust as possible.
vm_vec_boxscale(&side_vec, 1.0f);
@@ -6579,13 +6573,13 @@ void attack_set_accel(ai_info *aip, ship_info *sip, float dist_to_enemy, float d
if (!( Pl_objp->phys_info.flags & PF_AFTERBURNER_ON )) {
float percent_left;
ship *shipp;
ship_info *sip_local;
ship_info *sip;
shipp = &Ships[Pl_objp->instance];
sip_local = &Ship_info[shipp->ship_info_index];
sip = &Ship_info[shipp->ship_info_index];
if (sip_local->afterburner_fuel_capacity > 0.0f) {
percent_left = 100.0f * shipp->afterburner_fuel / sip_local->afterburner_fuel_capacity;
if (sip->afterburner_fuel_capacity > 0.0f) {
percent_left = 100.0f * shipp->afterburner_fuel / sip->afterburner_fuel_capacity;
if (percent_left > 30.0f + ((Pl_objp-Objects) & 0x0f)) {
afterburners_start(Pl_objp);
if (aip->ai_profile_flags & AIPF_SMART_AFTERBURNER_MANAGEMENT) {
@@ -6595,11 +6589,11 @@ void attack_set_accel(ai_info *aip, ship_info *sip, float dist_to_enemy, float d
float ab_time;
// Max afterburner speed - make sure we don't devide by 0 later
max_ab_vel = sip_local->afterburner_max_vel.xyz.z > 0.0f ? sip_local->afterburner_max_vel.xyz.z : sip_local->max_vel.xyz.z;
max_ab_vel = sip->afterburner_max_vel.xyz.z > 0.0f ? sip->afterburner_max_vel.xyz.z : sip->max_vel.xyz.z;
max_ab_vel = max_ab_vel > 0.0f ? max_ab_vel : 0.0001f;
// Time to exhaust 25% of the remaining fuel
time_to_exhaust_25pct_fuel = shipp->afterburner_fuel * 0.25f / sip_local->afterburner_burn_rate;
time_to_exhaust_25pct_fuel = shipp->afterburner_fuel * 0.25f / sip->afterburner_burn_rate;
// Time to fly 75% of the distance to the target
time_to_fly_75pct_of_distance = dist_to_enemy * 0.75f / max_ab_vel;
@@ -10685,6 +10679,8 @@ void ai_dock()
// model_anim_start_type(shipp, TRIGGER_TYPE_DOCKED, aip->dockee_index, 1);
// model_anim_start_type(shipp, TRIGGER_TYPE_DOCKED, 1);
snd_play_3d( &Snds[SND_DOCK_ATTACH], &Pl_objp->pos, &View_position );
hud_maybe_flash_docking_text(Pl_objp);
hud_maybe_flash_docking_text(goal_objp);
// ai_dock_shake(Pl_objp, goal_objp);
if ((Pl_objp == Player_obj) || (goal_objp == Player_obj))
@@ -13296,8 +13292,6 @@ void ai_warp_out(object *objp)
// flag us as trying to warp so that this function keeps getting called
// (in other words, if we can't warp just yet, we want to warp at the first
// opportunity)
if (aip->mode != AIM_WARP_OUT)
aip->mode = AIM_WARP_OUT;
aip->submode = AIS_WARP_1;
aip->ai_flags |= AIF_TRYING_UNSUCCESSFULLY_TO_WARP;
+9 -156
View File
@@ -100,101 +100,6 @@ int object_in_turret_fov(object *objp, ship_subsys *ss, vec3d *tvec, vec3d *tpos
return 0;
}
bool is_object_radius_in_turret_fov(object *objp, ship_subsys *ss, vec3d *tvec, vec3d *tpos, vec3d *v2e, vec3d *predicted_pos, float distance)
{
float target_dist = distance;
if (distance == 0.0f)
target_dist = vm_vec_dist(predicted_pos,tpos);
if (object_in_turret_fov(objp, ss, tvec, tpos, target_dist + objp->radius)) {
// so the targeted spot in not in fov but the enemy + radius is
// lets align the darn gun and try shooting there
vec3d temp_vec;
float multiplier = 0;
model_subsystem *tp = ss->system_info;
// project v2e_from_turret to turret normal
// substract resultant vector from the temp_vec (v2e_from_turret)
// adjust z component as necessary
// calculate multiplier for the resultant vector
// use multiplier and the z component and compose a new vector
float dot = vm_vec_dot(v2e, tvec);
vm_vec_scale_add(&temp_vec, v2e, tvec, -dot);
if (IS_VEC_NULL_SQ_SAFE(&temp_vec)) {
// return false, target is perfectly aligned over or below the turret
// safe bet is to allow turret to reacquire better target
return false;
}
// normalize the vec, it needs to be done regardless
vm_vec_normalize(&temp_vec);
bool fix_elevation = false;
bool fix_base_rot = false;
if (dot < tp->turret_fov) {
dot = tp->turret_fov;
fix_elevation = true;
}
if (dot > tp->turret_max_fov) {
dot = tp->turret_max_fov;
fix_elevation = true;
}
if (tp->flags & MSS_FLAG_TURRET_ALT_MATH) {
vec3d temp_vec2;
vm_vec_rotate(&temp_vec2, &temp_vec, &ss->world_to_turret_matrix);
// now in turrets frame of reference
// check if math is actually possible
if (!((temp_vec2.xyz.x == 0) && (temp_vec2.xyz.y == 0))) {
float temp_z = temp_vec2.xyz.z;
temp_vec2.xyz.z = 0.0f;
// make sure null vecs wont happen
if (!IS_VEC_NULL_SQ_SAFE(&temp_vec2)) {
vm_vec_normalize(&temp_vec2);
// only do this if it actually is required
if (-temp_vec2.xyz.y < tp->turret_y_fov) {
float check_pos = 1;
fix_base_rot = true;
temp_vec2.xyz.y = -tp->turret_y_fov;
if (temp_vec2.xyz.x < 0)
check_pos = -1;
temp_vec2.xyz.x = check_pos * sqrtf(1 - (temp_vec2.xyz.y*temp_vec2.xyz.y));
// restore z component
float scaler = sqrtf(1 - (temp_z*temp_z));
vm_vec_scale(&temp_vec2,scaler);
temp_vec2.xyz.z = temp_z;
// back to world frame
vm_vec_unrotate(&temp_vec, &temp_vec2, &ss->world_to_turret_matrix);
}
}
}
}
if (fix_elevation || fix_base_rot) {
if (fix_elevation) {
multiplier = sqrtf(1 - (dot*dot));
// keep the temp_vec scaled with the tweaked vector
vm_vec_scale(&temp_vec, multiplier);
}
vm_vec_scale_add(v2e, &temp_vec, tvec, dot);
// and we are done with v2e...
vm_vec_scale_add(predicted_pos, tpos, v2e, target_dist);
// and we are done with predicted position
return true;
} else {
mprintf(("Warning: Function 'is_object_radius_in_turret_fov' was called\nwithout need to fix turret alignments\n"));
return false;
}
}
// outside of the expanded radii, unable to align, return false
return false;
}
// return 1 if bomb_objp is headed towards ship_objp
int bomb_headed_towards_ship(object *bomb_objp, object *ship_objp)
{
@@ -452,10 +357,9 @@ extern int Player_attacking_enabled;
void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
{
object *turret_parent_obj = &Objects[eeo->turret_parent_objnum];
ship *shipp;
ship *shipp;
ship_subsys *ss = eeo->turret_subsys;
float dist, dist_comp;
bool turret_has_no_target = false;
// Don't look for bombs when weapon system is not ok
if (objp->type == OBJ_WEAPON && !eeo->weapon_system_ok) {
@@ -572,10 +476,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
if ((objp->type == OBJ_WEAPON) && check_weapon) {
if ( Weapons[objp->instance].homing_object == &Objects[eeo->turret_parent_objnum] ) {
if ( dist_comp < eeo->nearest_homing_bomb_dist ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
eeo->nearest_homing_bomb_dist = dist_comp;
eeo->nearest_homing_bomb_objnum = OBJ_INDEX(objp);
}
@@ -583,10 +484,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
// if not homing, check if bomb is flying towards ship
} else if ( bomb_headed_towards_ship(objp, &Objects[eeo->turret_parent_objnum]) ) {
if ( dist_comp < eeo->nearest_bomb_dist ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
eeo->nearest_bomb_dist = dist_comp;
eeo->nearest_bomb_objnum = OBJ_INDEX(objp);
}
@@ -642,10 +540,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
// maybe update nearest attacker
if ( dist_comp < eeo->nearest_attacker_dist ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
// nprintf(("AI", "Nearest enemy = %s, dist = %7.3f, dot = %6.3f, fov = %6.3f\n", Ships[objp->instance].ship_name, dist, vm_vec_dot(&v2e, tvec), tp->turret_fov));
eeo->nearest_attacker_dist = dist_comp;
eeo->nearest_attacker_objnum = OBJ_INDEX(objp);
@@ -660,10 +555,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
dist_comp *= 0.9f + (0.01f * asteroid_time_to_impact(objp));
if (dist_comp < eeo->nearest_dist ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
eeo->nearest_dist = dist_comp;
eeo->nearest_objnum = OBJ_INDEX(objp);
}
@@ -1053,13 +945,7 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
dist = vm_vec_normalized_dir(&v2e, &Objects[aip->target_objnum].pos, tpos);
in_fov = turret_fov_test(turret_subsys, tvec, &v2e);
if (turret_subsys->flags & SSF_FOV_EDGE_CHECK) {
if (in_fov == false)
if (object_in_turret_fov(&Objects[aip->target_objnum], turret_subsys, tvec, tpos, dist + Objects[aip->target_objnum].radius))
in_fov = true;
}
// MODIFY FOR ATTACKING BIG SHIP
// MODIFY FOR ATTACKING BIG SHIP
// dot += (0.5f * Objects[aip->target_objnum].radius / dist);
if (in_fov) {
return aip->target_objnum;
@@ -1220,11 +1106,6 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
in_fov = turret_fov_test(ss, gvec, &v2e);
if (ss->flags & SSF_FOV_EDGE_CHECK) {
if (in_fov == false)
in_fov = is_object_radius_in_turret_fov(&Objects[ss->turret_enemy_objnum], ss, gvec, &gun_pos, &v2e, predicted_enemy_pos, 0.0f);
}
if (in_fov) {
ret_val = model_rotate_gun(Ship_info[shipp->ship_info_index].model_num,
tp, &Objects[parent_objnum].orient,
@@ -1500,9 +1381,6 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
wait *= frand_range(0.9f, 1.1f);
}
if(turret->rof_scaler != 1.0f)
wait /= get_adjusted_turret_rof(turret);
(*fs_dest) = timestamp((int)wait);
}
@@ -2328,7 +2206,7 @@ bool turret_std_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mo
{
model_subsystem *tp = ss->system_info;
float dot = vm_vec_dot(v2e, gvec);
if (((dot + size_mod) >= tp->turret_fov) && ((dot - size_mod) <= tp->turret_max_fov))
if (((dot + size_mod) > tp->turret_fov) && ((dot - size_mod) <= tp->turret_max_fov))
return true;
return false;
@@ -2338,7 +2216,7 @@ bool turret_adv_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mo
{
model_subsystem *tp = ss->system_info;
float dot = vm_vec_dot(v2e, gvec);
if (((dot + size_mod) >= tp->turret_fov) && ((dot - size_mod) <= tp->turret_max_fov)) {
if (((dot + size_mod) > tp->turret_fov) && ((dot - size_mod) <= tp->turret_max_fov)) {
vec3d of_dst;
vm_vec_rotate( &of_dst, v2e, &ss->world_to_turret_matrix );
if ((of_dst.xyz.x == 0) && (of_dst.xyz.y == 0)) {
@@ -2348,7 +2226,7 @@ bool turret_adv_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mo
if (!IS_VEC_NULL_SQ_SAFE(&of_dst)) {
vm_vec_normalize(&of_dst);
// now we have 2d vector with lenght of 1 that points at the targets direction after being rotated to turrets FOR
if ((-of_dst.xyz.y + size_mod) >= tp->turret_y_fov)
if ((-of_dst.xyz.y + size_mod) > tp->turret_y_fov)
return true;
}
}
@@ -2366,28 +2244,3 @@ bool turret_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mod)
return in_fov;
}
float get_adjusted_turret_rof(ship_subsys *ss)
{
float tempf = ss->rof_scaler;
// optional reset switch (negative value)
if (tempf < 0) {
ss->rof_scaler = 1.0f;
return 1.0f;
}
if (tempf == 0) {
// special case returning the number of firingpoints
ss->rof_scaler = (float) ss->system_info->turret_num_firing_points;
tempf = ss->rof_scaler;
// safety check to avoid div/0 issues
if (tempf == 0) {
ss->rof_scaler = 1.0f;
return 1.0f;
}
}
return tempf;
}
+1 -15
View File
@@ -112,13 +112,11 @@ MONITOR(NumANIPlayed)
// Setup an anim_play_struct for passing into anim_play(). Will fill in default values, which you
// can then change before calling anim_play().
//
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y, int base_w, int base_h)
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y)
{
aps->anim_info = a_info;
aps->x = x;
aps->y = y;
aps->base_w = base_w;
aps->base_h = base_h;
aps->start_at = 0;
aps->stop_at = a_info->total_frames - 1;
aps->screen_id = 0;
@@ -221,14 +219,6 @@ anim_instance *anim_play(anim_play_struct *aps)
instance->xlate_pal = 0;
}
if(aps->base_w < 0 || aps->base_h < 0) {
instance->base_w = gr_screen.max_w_unscaled;
instance->base_h = gr_screen.max_h_unscaled;
} else {
instance->base_w = aps->base_w;
instance->base_h = aps->base_h;
}
// determining the start_at frame is more complicated, since it must be a key-frame.
// Futhermore, need to subtract 1 from key-frame number, since frame number is always
// incremented the first time anim_show_next_frame() is called
@@ -531,8 +521,6 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
// determine x,y to display the bitmap at
if ( instance->world_pos == NULL ) {
gr_set_screen_scale(instance->base_w, instance->base_h);
gr_set_clip(0, 0, instance->base_w, instance->base_h, false);
if ( instance->aa_color == NULL ) {
gr_bitmap(instance->x, instance->y);
}
@@ -540,8 +528,6 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
gr_set_color_fast( (color*)instance->aa_color );
gr_aabitmap(instance->x, instance->y);
}
gr_reset_screen_scale();
gr_reset_clip();
}
else {
g3_rotate_vertex(&image_vertex,instance->world_pos);
+1 -3
View File
@@ -24,8 +24,6 @@ typedef struct {
anim *anim_info;
int x;
int y;
int base_w;
int base_h;
int start_at;
int stop_at;
int screen_id;
@@ -52,7 +50,7 @@ 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, int max_x = -1, int max_y = -1);
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);
-1
View File
@@ -71,7 +71,6 @@ typedef struct anim {
typedef struct anim_instance {
anim_instance *next, *prev;
int x,y; // coordinates anim is played at (top left corner of anim)
int base_w, base_h; // coordinate scale this anim is played in.
vec3d *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)
+17 -4
View File
@@ -1935,10 +1935,23 @@ void asteroid_show_brackets()
g3_rotate_vertex(&asteroid_vertex,&asteroid_objp->pos);
g3_project_vertex(&asteroid_vertex);
if ( Cmdline_targetinfo ) {
hud_target_add_display_list(asteroid_objp, &asteroid_vertex, &asteroid_objp->pos, 0, NULL, NULL, TARGET_DISPLAY_DIST | TARGET_DISPLAY_LEAD);
} else {
hud_target_add_display_list(asteroid_objp, &asteroid_vertex, &asteroid_objp->pos, 0, NULL, NULL, TARGET_DISPLAY_DIST);
if (!(asteroid_vertex.flags & PF_OVERFLOW)) {
gr_set_color_fast(iff_get_color(IFF_COLOR_SELECTION, 1));
hud_show_brackets(asteroid_objp, &asteroid_vertex);
if ( Cmdline_targetinfo ) {
hud_show_lead_indicator_quick(&asteroid_objp->pos, asteroid_objp);
}
}
// if asteroid is not on screen, draw an offscreen indicator
if ( hud_gauge_active(HUD_OFFSCREEN_INDICATOR) ) {
if (asteroid_vertex.codes != 0) {
float dist;
// dist = vm_vec_dist_quick(&Player_obj->pos, &asteroid_objp->pos);
dist = hud_find_target_distance( asteroid_objp, Player_obj );
gr_set_color_fast(iff_get_color(IFF_COLOR_SELECTION, 1));
hud_draw_offscreen_indicator(&asteroid_vertex, &asteroid_objp->pos, dist);
}
}
}
}
+1 -1
View File
@@ -78,7 +78,7 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
{ CF_TYPE_SQUAD_IMAGES, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "squads", ".pcx .png .dds", CF_TYPE_PLAYERS },
{ CF_TYPE_SINGLE_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "single", ".pl2 .cs2 .plr .csg .css", CF_TYPE_PLAYERS },
{ CF_TYPE_MULTI_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "multi", ".plr", CF_TYPE_PLAYERS },
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .bx", CF_TYPE_DATA }, //clr=cached color
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx .tsb", CF_TYPE_DATA }, //clr=cached color
{ CF_TYPE_MULTI_CACHE, "data" DIR_SEPARATOR_STR "multidata", ".pcx .png .dds .fs2 .txt", CF_TYPE_DATA },
{ CF_TYPE_MISSIONS, "data" DIR_SEPARATOR_STR "missions", ".fs2 .fc2 .ntl .ssv", CF_TYPE_DATA },
{ CF_TYPE_CONFIG, "data" DIR_SEPARATOR_STR "config", ".cfg", CF_TYPE_DATA },
+15 -24
View File
@@ -79,8 +79,6 @@ enum
#define BUILD_CAP_NO_D3D (1<<1)
#define BUILD_CAP_NEW_SND (1<<2)
#define PARSE_COMMAND_LINE_STRING "-parse_cmdline_only"
typedef struct
{
// DO NOT CHANGE THE SIZE OF THIS STRING!
@@ -166,7 +164,6 @@ Flag exe_params[] =
{ "-no_glsl", "Disable GLSL (shader) support", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-ati_swap", "Fix Color issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://scp.indiegames.us/mantis/view.php?id=1669", },
{ "-no_3d_sound", "Use only 2D/stereo for sound effects", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-disable_glsl_model","Don't use shaders for model rendering", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-ingame_join", "Allows ingame joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
{ "-voicer", "Voice recognition", true, 0, EASY_DEFAULT, "Experimental", "", },
@@ -253,6 +250,7 @@ cmdline_parm spec_point_arg("-spec_point", NULL);
cmdline_parm spec_tube_arg("-spec_tube", NULL);
cmdline_parm ambient_factor_arg("-ambient_factor", NULL); // Cmdline_ambient_factor
cmdline_parm cell_arg("-cell", NULL); // Cmdline_cell
cmdline_parm decals("-decals", NULL); // Cmdline_decals
cmdline_parm env("-env", NULL); // Cmdline_env
cmdline_parm mipmap_arg("-mipmap", NULL); // Cmdline_mipmap
cmdline_parm missile_lighting_arg("-missile_lighting", NULL); // Cmdline_missile_lighting
@@ -272,6 +270,7 @@ float Cmdline_fov = 0.75f;
float Cmdline_ogl_spec = 80.0f;
int Cmdline_ambient_factor = 128;
int Cmdline_cell = 0;
int Cmdline_decals = 0;
int Cmdline_env = 0;
int Cmdline_mipmap = 0;
int Cmdline_missile_lighting = 0;
@@ -365,7 +364,6 @@ cmdline_parm no_fbo_arg("-disable_fbo", NULL); // Cmdline_no_fbo
cmdline_parm noglsl_arg("-no_glsl", NULL); // Cmdline_noglsl -- disable GLSL support in OpenGL
cmdline_parm atiswap_arg("-ati_swap", NULL); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
cmdline_parm no3dsound_arg("-no_3d_sound", NULL); // Cmdline_no_3d_sound - Disable use of full 3D sounds
cmdline_parm no_glsl_models_arg("-disable_glsl_model", NULL); // Cmdline_no_glsl_model_rendering -- switches model rendering to fixed pipeline
int Cmdline_d3d_lesstmem = 0;
int Cmdline_load_all_weapons = 0;
@@ -379,7 +377,6 @@ int Cmdline_no_fbo = 0;
int Cmdline_noglsl = 0;
int Cmdline_ati_color_swap = 0;
int Cmdline_no_3d_sound = 0;
int Cmdline_no_glsl_model_rendering = 0;
// Developer/Testing related
cmdline_parm start_mission_arg("-start_mission", NULL); // Cmdline_start_mission
@@ -399,7 +396,6 @@ cmdline_parm window_arg("-window", NULL); // Cmdline_window
cmdline_parm fullscreen_window_arg("-fullscreen_window",NULL);
cmdline_parm res_arg("-res", NULL); // Cmdline_lores
cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps -- spew VP crcs to vp_crcs.txt
cmdline_parm parse_cmdline_only(PARSE_COMMAND_LINE_STRING, NULL);
#ifdef SCP_UNIX
cmdline_parm no_grab("-nograb", NULL); // Cmdline_no_grab
#endif
@@ -608,8 +604,8 @@ void os_validate_parms(char *cmdline)
char *token;
int parm_found;
token = strtok(cmdline, seps);
while(token != NULL) {
token = strtok(cmdline, seps);
while(token != NULL) {
if (token[0] == '-') {
parm_found = 0;
@@ -682,12 +678,6 @@ void os_init_cmdline(char *cmdline)
{
FILE *fp;
bool parse_config = true;
if (strstr(cmdline, PARSE_COMMAND_LINE_STRING) != NULL) {
parse_config = false;
}
// 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
@@ -712,7 +702,7 @@ void os_init_cmdline(char *cmdline)
#endif
// if the file exists, get a single line, and deal with it
if ( fp && parse_config ) {
if ( fp ) {
char *buf, *p;
size_t len = filelength( fileno(fp) ) + 2;
@@ -949,11 +939,9 @@ bool SetCmdlineParams()
}
}
if (!Fred_running) { //There is no standalone FRED
// is this a standalone server??
if (standalone_arg.found()) {
Is_standalone = 1;
}
// is this a standalone server??
if (standalone_arg.found()) {
Is_standalone = 1;
}
// object update control
@@ -1264,10 +1252,6 @@ bool SetCmdlineParams()
Cmdline_noglsl = 1;
}
if (no_glsl_models_arg.found() ) {
Cmdline_no_glsl_model_rendering = 1;
}
if ( img2dds_arg.found() )
Cmdline_img2dds = 1;
@@ -1364,6 +1348,13 @@ bool SetCmdlineParams()
Cmdline_env = 1;
}
if ( decals.found() ) {
#ifdef WIN32
MessageBox(NULL, "Decals have been disabled in builds after May 4, 2006. Please remove the \"-decals\" command line from the launcher to prevent this message from appearing the the future.", "", MB_OK | MB_ICONINFORMATION);
#endif
}
if ( ballistic_gauge.found() ) {
Cmdline_ballistic_gauge = 1;
}
+1 -1
View File
@@ -63,6 +63,7 @@ extern float static_point_factor;
extern float static_tube_factor;
extern int Cmdline_ambient_factor;
extern int Cmdline_cell;
extern int Cmdline_decals;
extern int Cmdline_env;
extern int Cmdline_mipmap;
extern int Cmdline_missile_lighting;
@@ -124,7 +125,6 @@ extern int Cmdline_no_fbo;
extern int Cmdline_noglsl;
extern int Cmdline_ati_color_swap;
extern int Cmdline_no_3d_sound;
extern int Cmdline_no_glsl_model_rendering;
// Developer/Testing related
extern char *Cmdline_start_mission;
+11 -6
View File
@@ -167,6 +167,7 @@ void cutscene_mark_viewable(char *filename)
#define PLAY_BUTTON 6
#define EXIT_BUTTON 7
static int Num_files;
static SCP_vector<int> Cutscene_list;
//static int Stats_scroll_offset; // not used - taylor
static int Selected_line = 0; // line that is currently selected for binding
@@ -330,7 +331,7 @@ void cutscenes_screen_play()
char name[MAX_FILENAME_LEN]; // *full_name
int which_cutscene;
Assert( (Selected_line >= 0) && (Selected_line < (int)Cutscene_list.size()) );
Assert( (Selected_line >= 0) && (Selected_line < Num_files) );
which_cutscene = Cutscene_list[Selected_line];
strcpy_s(name, Cutscenes[which_cutscene].filename );
@@ -371,7 +372,7 @@ void cutscenes_screen_scroll_line_down()
{
int h;
if (Selected_line < (int)Cutscene_list.size() - 1) {
if (Selected_line < Num_files - 1) {
Selected_line++;
gamesnd_play_iface(SND_SCROLL);
@@ -408,7 +409,7 @@ void cutscenes_screen_scroll_screen_down()
int h;
h = Cutscene_list_coords[gr_screen.res][3] / gr_get_font_height();
if (Scroll_offset + h < (int)Cutscene_list.size()) {
if (Scroll_offset + h < Num_files) {
Scroll_offset++;
if (Selected_line < Scroll_offset){
Selected_line = Scroll_offset;
@@ -506,10 +507,12 @@ void cutscenes_screen_init()
// if (All_movies_enabled)
// Cutscenes_viewable = 0xffffffff; // Cheat code enables all movies.
Num_files = 0;
Cutscene_list.clear();
for (size_t j = 0; j < Cutscenes.size(); j++ ) {
if ( Cutscenes_viewable & (1<<j) ) {
Cutscene_list.push_back((int)j);
Num_files++;
}
}
}
@@ -567,9 +570,11 @@ void cutscenes_screen_do_frame()
// the "show-all" hotkey
case KEY_CTRLED | KEY_SHIFTED | KEY_S:
{
Num_files = 0;
Cutscene_list.clear();
for (size_t t = 0; t < Cutscenes.size(); t++) {
Cutscene_list.push_back((int)t);
Num_files++;
}
break;
@@ -587,14 +592,14 @@ void cutscenes_screen_do_frame()
if (List_region.button_down()) {
List_region.get_mouse_pos(NULL, &y);
z = Scroll_offset + y / font_height;
if ((z >= 0) && (z < (int)Cutscene_list.size()))
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 < (int)Cutscene_list.size()))
if ((z >= 0) && (z < Num_files))
Selected_line = z;
}
@@ -619,7 +624,7 @@ void cutscenes_screen_do_frame()
y = 0;
z = Scroll_offset;
while (y + font_height <= Cutscene_list_coords[gr_screen.res][3]) {
if (z >= (int)Cutscene_list.size()){
if (z >= Num_files){
break;
}
+2 -4
View File
@@ -668,10 +668,8 @@ int mve_video_init(ubyte *data)
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
+2 -4
View File
@@ -360,10 +360,8 @@ static void OGG_video_init(theora_info *tinfo)
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB8, wp2, hp2, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
+1 -1
View File
@@ -42,7 +42,7 @@ typedef struct debris {
vec3d 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
int parent_alt_name;
char parent_alt_name;
float damage_mult;
} debris;
File diff suppressed because it is too large. Load diff
+129
View File
@@ -0,0 +1,129 @@
//header file for making decals-Bobboau
#ifndef _DECAL_H
#define _DECAL_H
#include "object/object.h"
#include "globalincs/pstypes.h"
//#include "ship/ship.h"
#ifdef ENABLE_DECALS
#define MAX_DECAL_POLY 40
#define MAX_DECAL_POLY_POINT 10
#define MAX_DECAL_DEFPOINTS 10000
#define MAX_DECAL_POINT 10
#define MAX_SHIP_DECALS 25
#define MAX_GLOBAL_DECAL_POLYS 11000
#define QUICKFIND_SUBDIVISION 100
#define QUICKFIND_SEGMENT_LENGTH (MAX_GLOBAL_DECAL_POLYS/QUICKFIND_SUBDIVISION)
#define MAX_GLOBAL_DECALS 5000
#define DP_EOF 0
#define DP_DEFPOINTS 1
#define DP_FLATPOLY 2
#define DP_TMAPPOLY 3
#define DP_SORTNORM 4
#define DP_BOUNDBOX 5
#endif // ENABLE_DECALS
struct decal;
struct decal_list;
struct decal_list_controle;
struct decal_poly{
vec3d norm[3];
vertex point[3];
decal_poly *next;
decal* parent;
int idx;
};
struct decal{
int n_poly;
int timestamp; //when this decal was created
int burn_time; //how long it takes for the glow texture to fade
int vertex_buffer_start; //were is the start of this decal's polys in the vertex buffer
decal_poly* poly;
decal_poly* add_poly();
decal_poly* get_last_poly();
void remove_last_poly();
decal_list_controle *parent;
};
struct decal_list{
decal dec;
decal_list *next;
};
struct decal_item{
decal_list dec;
bool used;
};
struct decal_list_controle{
int n_decals;
int buffer;
int texture;
int n_poly;
int burn_texture;
int glow_texture;
bool modifyed;
decal_list *d_list;
decal_list *end;
decal_list *add_new();
void trim();
void clear();
~decal_list_controle();
decal_list_controle();
};
struct decal_system{
decal_list_controle *decals;
int n_decal_textures;
bool decals_modified;
int max_decals;
decal_system():decals(NULL),n_decal_textures(0),decals_modified(false){};
};
//this is used to give all the data to the generation data to the functions that make them
struct decal_point{
vec3d pnt;
matrix orient;
float radius;
};
#ifdef ENABLE_DECALS
int decal_create(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture = -1, int glow_texture = -1, int burn_texture = -1, int burn_time = 1000);//makes the decal
int decal_create_simple(object * obj, decal_point *point, int texture);//makes a simple non-clipped decal
void decal_render_all(object * obj); //renders all decals
int decal_create_sub(void *model_ptr);
void clear_decals(decal_system *system);
void init_decals();
#else // ENABLE_DECALS
inline int decal_create(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture = -1, int glow_texture = -1, int burn_texture = -1, int burn_time = 1000)
{
return 0;
}
#define decal_create_simple(a, b, c) (0)
#define decal_render_all(a)
#define decal_create_sub(a) (0);
#define clear_decals(a)
#define init_decals()
#endif // ENABLE_DECALS
#endif // _DECAL_H
+1
View File
@@ -14,6 +14,7 @@
#include "ship/ship.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -8,6 +8,7 @@
#include "gamesnd/eventmusic.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -16,6 +16,7 @@
#include "parse/sexp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -15,6 +15,7 @@
#include "mission/missiongrid.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -19,6 +19,7 @@
#include "species_defs/species_defs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -7,6 +7,7 @@
#include "ship/ship.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -26,6 +26,7 @@
#include "mission/missionparse.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -30,6 +30,7 @@
#include "localization/localize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -23,6 +23,7 @@
#include "mission/missiongoals.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -19,6 +19,7 @@
#include "mission/missionparse.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -18,6 +18,7 @@
#include "mission/missionparse.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -22,6 +22,7 @@
#include "mission/missionparse.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -17,6 +17,7 @@
#include "localization/localize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -20,6 +20,7 @@
#include "iff_defs/iff_defs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -7,6 +7,7 @@
#include "ship/ship.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -20,6 +20,7 @@
#include "localization/localize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -14,6 +14,7 @@
#include "dialog1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -27,6 +27,7 @@
#include "weapon/weapon.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+9 -11
View File
@@ -22,6 +22,7 @@
#include "localization/localize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -81,17 +82,15 @@ void event_editor::DoDataExchange(CDataExchange* pDX)
DDX_CBString(pDX, IDC_WAVE_FILENAME, m_wave_filename);
DDX_LBIndex(pDX, IDC_MESSAGE_LIST, m_cur_msg);
// m_team == -1 maps to 2
if(m_team == -1){
m_team = MAX_TVT_TEAMS;
m_team = 2;
}
DDX_CBIndex(pDX, IDC_EVENT_TEAM, m_team);
// m_message_team == -1 maps to 2
if(m_message_team == -1){
m_message_team = MAX_TVT_TEAMS;
m_message_team = 2;
}
DDX_CBIndex(pDX, IDC_MESSAGE_TEAM, m_message_team);
//}}AFX_DATA_MAP
@@ -571,7 +570,7 @@ void event_editor::update_cur_message()
m_persona = 0;
}
if(m_messages[m_cur_msg].multi_team >= MAX_TVT_TEAMS){
if(m_messages[m_cur_msg].multi_team >= 2){
m_message_team = -1;
m_messages[m_cur_msg].multi_team = -1;
} else {
@@ -716,7 +715,6 @@ void event_editor::reset_event(int num, HTREEITEM after)
m_events[num].chain_delay = -1;
m_events[num].objective_text = NULL;
m_events[num].objective_key_text = NULL;
m_events[num].team = -1;
m_sig[num] = -1;
m_event_tree.item_index = -1;
@@ -1176,7 +1174,7 @@ int event_editor::save_message(int num)
// box list.
m_messages[num].persona_index = m_persona - 1;
if(m_message_team >= MAX_TVT_TEAMS){
if(m_message_team >= 2){
m_messages[num].multi_team = -1;
m_message_team = -1;
} else {
@@ -1411,8 +1409,8 @@ void event_editor::OnSelchangeTeam()
UpdateData(TRUE);
// If the team isn't valid mark it as such.
if((m_team >= MAX_TVT_TEAMS) || (m_team < -1) ){
// team == 2, means no team
if(m_team == 2){
m_team = -1;
}
@@ -1428,8 +1426,8 @@ void event_editor::OnSelchangeMessageTeam()
UpdateData(TRUE);
// If the team isn't valid mark it as such.
if((m_message_team>= MAX_TVT_TEAMS) || (m_message_team < -1) ) {
// team == 2, means no team
if(m_message_team == 2){
m_message_team = -1;
}
+2 -1
View File
@@ -37,6 +37,7 @@
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -126,7 +127,7 @@ BOOL CFREDApp::InitInstance()
// disable the debug memory stuff
// _CrtSetDbgFlag(~(_CRTDBG_ALLOC_MEM_DF) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
_CrtSetDbgFlag(~(_CRTDBG_ALLOC_MEM_DF) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
// Standard initialization
// If you are not using these features and wish to reduce the size
+4 -3
View File
@@ -50,6 +50,7 @@
extern int Num_objects;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -426,7 +427,7 @@ int CFREDDoc::load_mission(char *pathname, int flags)
generate_weaponry_usage_list(i, used_pool);
for (j=0; j<Team_data[i].num_weapon_choices; j++) {
// The amount used in wings is always set by a static loadout entry so skip any that were set by Sexp variables
if ( (!strlen(Team_data[i].weaponry_pool_variable[j])) && (!strlen(Team_data[i].weaponry_amount_variable[j])) ) {
if ((Team_data[i].weaponry_pool_variable[j] == -1) && (Team_data[i].weaponry_amount_variable[j] == -1) ) {
// convert weaponry_pool to be extras available beyond the current ships weapons
Team_data[i].weaponry_count[j] -= used_pool[Team_data[i].weaponry_pool[j]];
if (Team_data[i].weaponry_count[j] < 0) {
@@ -445,8 +446,8 @@ int CFREDDoc::load_mission(char *pathname, int flags)
// add the weapon as a new entry
Team_data[i].weaponry_pool[Team_data[i].num_weapon_choices] = j;
Team_data[i].weaponry_count[Team_data[i].num_weapon_choices] = used_pool[j];
strcpy_s(Team_data[i].weaponry_amount_variable[Team_data[i].num_weapon_choices], "");
strcpy_s(Team_data[i].weaponry_pool_variable[Team_data[i].num_weapon_choices++], "");
Team_data[i].weaponry_amount_variable[Team_data[i].num_weapon_choices] = -1;
Team_data[i].weaponry_pool_variable[Team_data[i].num_weapon_choices++] = -1;
}
}
}
+1
View File
@@ -58,6 +58,7 @@ extern float flFrametime;
extern subsys_to_render Render_subsys;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -65,6 +65,7 @@
#include "gl/glu.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -18,6 +18,7 @@
#include "editor.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -16,6 +16,7 @@
#include "globalincs/linklist.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -18,6 +18,7 @@
#include "weapon/weapon.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -19,6 +19,7 @@
#include "object/objectdock.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -26,6 +26,7 @@
#include "iff_defs/iff_defs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+4 -4
View File
@@ -999,9 +999,9 @@ void clear_mission()
for ( j = 0; j < MAX_SHIP_CLASSES; j++ ) {
if (Ship_info[j].flags & SIF_DEFAULT_PLAYER_SHIP) {
Team_data[i].ship_list[count] = j;
strcpy_s(Team_data[i].ship_list_variables[count], "");
Team_data[i].ship_list_variables[count] = -1;
Team_data[i].ship_count[count] = 5;
strcpy_s(Team_data[i].ship_count_variables[count++], "");
Team_data[i].ship_count_variables[count++] = -1;
}
}
Team_data[i].num_ship_choices = count;
@@ -1015,8 +1015,8 @@ void clear_mission()
Team_data[i].weaponry_count[count] = 500;
}
Team_data[i].weaponry_pool[count] = j;
strcpy_s(Team_data[i].weaponry_pool_variable[count], "");
strcpy_s(Team_data[i].weaponry_amount_variable[count++], "");
Team_data[i].weaponry_pool_variable[count] = -1;
Team_data[i].weaponry_amount_variable[count++] = -1;
}
}
Team_data[i].num_weapon_choices = count;
+1
View File
@@ -19,6 +19,7 @@
#include "mission/missionmessage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -25,6 +25,7 @@
#define ID_REPLACE_WINGS 15000
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -22,6 +22,7 @@
#include "mission/missionmessage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+13 -18
View File
@@ -1135,7 +1135,6 @@ int CFred_mission_save::save_variables()
int CFred_mission_save::save_players()
{
int i, j;
int var_idx;
int used_pool[MAX_WEAPON_TYPES];
// write out alternate name list
@@ -1180,22 +1179,20 @@ int CFred_mission_save::save_players()
for (j=0; j<Team_data[i].num_ship_choices; j++) {
// Check to see if a variable name should be written for the class rather than a number
if (strlen(Team_data[i].ship_list_variables[j])) {
var_idx = get_index_sexp_variable_name(Team_data[i].ship_list_variables[j]);
Assert (var_idx > -1 && var_idx < MAX_SEXP_VARIABLES);
if (Team_data[i].ship_list_variables[j] != -1) {
Assert (Team_data[i].ship_list_variables[j] > -1 && Team_data[i].ship_list_variables[j] < MAX_SEXP_VARIABLES);
fout("\t@%s\t", Sexp_variables[var_idx].variable_name);
fout("\t@%s\t", Sexp_variables[Team_data[i].ship_list_variables[j]].variable_name);
}
else {
fout("\t\"%s\"\t", Ship_info[Team_data[i].ship_list[j]].name);
}
// Now check if we should write a variable or a number for the amount of ships available
if (strlen(Team_data[i].ship_count_variables[j])) {
var_idx = get_index_sexp_variable_name(Team_data[i].ship_count_variables[j]);
Assert (var_idx > -1 && var_idx < MAX_SEXP_VARIABLES);
if (Team_data[i].ship_count_variables[j] != -1) {
Assert (Team_data[i].ship_count_variables[j] > -1 && Team_data[i].ship_count_variables[j] < MAX_SEXP_VARIABLES);
fout("@%s\n", Sexp_variables[var_idx].variable_name);
fout("@%s\n", Sexp_variables[Team_data[i].ship_count_variables[j]].variable_name);
}
else {
fout("%d\n", Team_data[i].ship_count[j]);
@@ -1214,11 +1211,10 @@ int CFred_mission_save::save_players()
generate_weaponry_usage_list(i, used_pool);
for (j=0; j<Team_data[i].num_weapon_choices; j++) {
// first output the weapon name or a variable that sets it
if (strlen(Team_data[i].weaponry_pool_variable[j])) {
var_idx = get_index_sexp_variable_name(Team_data[i].weaponry_pool_variable[j]);
Assert (var_idx > -1 && var_idx < MAX_SEXP_VARIABLES);
if (Team_data[i].weaponry_pool_variable[j] != -1) {
Assert (Team_data[i].weaponry_pool_variable[j] > -1 && Team_data[i].weaponry_pool_variable[j] < MAX_SEXP_VARIABLES);
fout("\t@%s\t", Sexp_variables[var_idx].variable_name);
fout("\t@%s\t", Sexp_variables[Team_data[i].weaponry_pool_variable[j]].variable_name);
}
else {
fout("\t\"%s\"\t", Weapon_info[Team_data[i].weaponry_pool[j]].name);
@@ -1227,14 +1223,13 @@ int CFred_mission_save::save_players()
// now output the amount of this weapon or a variable that sets it. If this weapon is in the used pool and isn't
// set by a variable we should add the amount of weapons used by the wings to it and zero the entry so we know
// that we have dealt with it
if (strlen(Team_data[i].weaponry_amount_variable[j])) {
var_idx = get_index_sexp_variable_name(Team_data[i].weaponry_amount_variable[j]);
Assert (var_idx > -1 && var_idx < MAX_SEXP_VARIABLES);
if (Team_data[i].weaponry_amount_variable[j] != -1) {
Assert (Team_data[i].weaponry_amount_variable[j] > -1 && Team_data[i].weaponry_amount_variable[j] < MAX_SEXP_VARIABLES);
fout ("@%s\n", Sexp_variables[var_idx].variable_name);
fout ("@%s\n", Sexp_variables[Team_data[i].weaponry_amount_variable[j]].variable_name);
}
else {
if (strlen(Team_data[i].weaponry_pool_variable[j])) {
if (Team_data[i].weaponry_pool_variable[j] != -1) {
fout ("%d\n", Team_data[i].weaponry_count[j]);
}
else {
+1
View File
@@ -16,6 +16,7 @@
#include "parse/sexp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -14,6 +14,7 @@
#include "OperatorArgTypeSelect.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -17,6 +17,7 @@
#include "FREDView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+21 -46
View File
@@ -19,6 +19,7 @@
#include "weapon/weapon.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -94,32 +95,22 @@ BOOL player_start_editor::OnInitDialog()
for(idx=0; idx<Team_data[i].num_ship_choices; idx++)
{
// do we have a variable for this entry? if we don't....
if (!strlen(Team_data[i].ship_list_variables[idx]))
if (Team_data[i].ship_list_variables[idx] == -1)
{
// This pool is set to hold the number of ships available at an index corresponding to the Ship_info array.
static_ship_pool[i][Team_data[i].ship_list[idx]] = Team_data[i].ship_count[idx];
// This pool is set to hold whether a ship at a Ship_info index has been set by a variable (and the
// variables index in Sexp_variables) if it has).
if (strlen(Team_data[i].ship_count_variables[idx])) {
static_ship_variable_pool[i][Team_data[i].ship_list[idx]] = get_index_sexp_variable_name(Team_data[i].ship_count_variables[idx]);
}
else {
static_ship_variable_pool[i][Team_data[i].ship_list[idx]] = -1;
}
static_ship_variable_pool[i][Team_data[i].ship_list[idx]] = Team_data[i].ship_count_variables[idx];
}
// if we do....
else
{
// This pool is set to hold the number of ships available at an index corresponding to the Sexp_variables array
dynamic_ship_pool[i][get_index_sexp_variable_name(Team_data[i].ship_list_variables[idx])] = Team_data[i].ship_count[idx];
dynamic_ship_pool[i][Team_data[i].ship_list_variables[idx]] = Team_data[i].ship_count[idx];
// This pool is set to hold whether a ship at a Ship_info index has been set by a variable (and the
// variables index in Sexp_variables) if it has).
if (strlen(Team_data[i].ship_count_variables[idx])) {
dynamic_ship_variable_pool[i][get_index_sexp_variable_name(Team_data[i].ship_list_variables[idx])] = get_index_sexp_variable_name(Team_data[i].ship_count_variables[idx]);
}
else {
dynamic_ship_variable_pool[i][get_index_sexp_variable_name(Team_data[i].ship_list_variables[idx])] = -1;
}
dynamic_ship_variable_pool[i][Team_data[i].ship_list_variables[idx]] = Team_data[i].ship_count_variables[idx];
}
}
}
@@ -134,26 +125,16 @@ BOOL player_start_editor::OnInitDialog()
for(idx=0; idx<Team_data[i].num_weapon_choices; idx++)
{
// do we have a variable for this entry?
if (!strlen(Team_data[i].weaponry_pool_variable[idx]))
if (Team_data[i].weaponry_pool_variable[idx] == -1)
{
static_weapon_pool[i][Team_data[i].weaponry_pool[idx]] = Team_data[i].weaponry_count[idx];
if (strlen(Team_data[i].weaponry_amount_variable[idx])) {
static_weapon_variable_pool[i][Team_data[i].weaponry_pool[idx]] = get_index_sexp_variable_name(Team_data[i].weaponry_amount_variable[idx]);
}
else {
static_weapon_variable_pool[i][Team_data[i].weaponry_pool[idx]] = -1;
}
static_weapon_variable_pool[i][Team_data[i].weaponry_pool[idx]] = Team_data[i].weaponry_amount_variable[idx];
}
// if we do....
else
{
dynamic_weapon_pool[i][get_index_sexp_variable_name(Team_data[i].weaponry_pool_variable[idx])] = Team_data[i].weaponry_count[idx];
if (strlen(Team_data[i].weaponry_amount_variable[idx])) {
dynamic_weapon_variable_pool[i][get_index_sexp_variable_name(Team_data[i].weaponry_pool_variable[idx])] = get_index_sexp_variable_name(Team_data[i].weaponry_amount_variable[idx]);
}
else {
dynamic_weapon_variable_pool[i][get_index_sexp_variable_name(Team_data[i].weaponry_pool_variable[idx])] = -1;
}
dynamic_weapon_pool[i][Team_data[i].weaponry_pool_variable[idx]] = Team_data[i].weaponry_count[idx];
dynamic_weapon_variable_pool[i][Team_data[i].weaponry_pool_variable[idx]] = Team_data[i].weaponry_amount_variable[idx];
}
}
}
@@ -779,24 +760,18 @@ void player_start_editor::OnOK()
// Copy the variable to Team_data
if (idx != -1) {
Assert (idx < MAX_SEXP_VARIABLES);
strcpy_s(Team_data[i].ship_list_variables[num_choices], Sexp_variables[idx].variable_name);
}
else {
strcpy_s(Team_data[i].ship_list_variables[num_choices], "");
}
Team_data[i].ship_list_variables[num_choices] = idx;
Team_data[i].ship_list[num_choices] = -1;
// Now we need to set the number of this type available
if (dynamic_ship_variable_pool[i][idx] == -1) {
Team_data[i].ship_count[num_choices] = dynamic_ship_pool[i][idx];
strcpy_s(Team_data[i].ship_count_variables[num_choices], "");
Team_data[i].ship_count_variables[num_choices] = -1;
}
else {
Assert (Sexp_variables[dynamic_ship_variable_pool[i][idx]].type & SEXP_VARIABLE_NUMBER);
strcpy_s(Team_data[i].ship_count_variables[num_choices], Sexp_variables[dynamic_ship_variable_pool[i][idx]].variable_name);
Team_data[i].ship_count_variables[num_choices] = dynamic_ship_variable_pool[i][idx];
Team_data[i].ship_count[num_choices] = atoi(Sexp_variables[dynamic_ship_variable_pool[i][idx]].text);
}
@@ -810,17 +785,17 @@ void player_start_editor::OnOK()
// if we have ships here
if(static_ship_pool[i][idx] > 0 || static_ship_variable_pool[i][idx] > -1) {
Team_data[i].ship_list[num_choices] = idx;
strcpy_s(Team_data[i].ship_list_variables[num_choices], "");
Team_data[i].ship_list_variables[num_choices] = -1;
// Now set the number of this class available
if (static_ship_variable_pool[i][idx] == -1) {
Team_data[i].ship_count[num_choices] = static_ship_pool[i][idx];
strcpy_s(Team_data[i].ship_count_variables[num_choices], "");
Team_data[i].ship_count_variables[num_choices] = -1;
}
else {
Assert (Sexp_variables[static_ship_variable_pool[i][idx]].type & SEXP_VARIABLE_NUMBER);
strcpy_s(Team_data[i].ship_count_variables[num_choices], Sexp_variables[static_ship_variable_pool[i][idx]].variable_name);
Team_data[i].ship_count_variables[num_choices] = static_ship_variable_pool[i][idx];
Team_data[i].ship_count[num_choices] = atoi(Sexp_variables[static_ship_variable_pool[i][idx]].text);
}
@@ -855,20 +830,20 @@ void player_start_editor::OnOK()
}
// Copy the variable to Team_data
strcpy_s(Team_data[i].weaponry_pool_variable[num_choices], Sexp_variables[idx].variable_name);
Team_data[i].weaponry_pool_variable[num_choices] = idx;
Team_data[i].weaponry_pool[num_choices] = -1;
// Now we need to set the number of this class available
if (dynamic_weapon_variable_pool[i][idx] == -1)
{
Team_data[i].weaponry_count[num_choices] = dynamic_weapon_pool[i][idx];
strcpy_s(Team_data[i].weaponry_amount_variable[num_choices], "");
Team_data[i].weaponry_amount_variable[num_choices] = -1;
}
else
{
Assert (Sexp_variables[dynamic_weapon_variable_pool[i][idx]].type & SEXP_VARIABLE_NUMBER);
strcpy_s(Team_data[i].weaponry_amount_variable[num_choices], Sexp_variables[dynamic_weapon_variable_pool[i][idx]].variable_name);
Team_data[i].weaponry_amount_variable[num_choices] = dynamic_weapon_variable_pool[i][idx];
Team_data[i].weaponry_count[num_choices] = atoi(Sexp_variables[dynamic_weapon_variable_pool[i][idx]].text);
}
@@ -884,19 +859,19 @@ void player_start_editor::OnOK()
if(static_weapon_pool[i][idx] > 0 || static_weapon_variable_pool[i][idx] > -1)
{
Team_data[i].weaponry_pool[num_choices] = idx;
strcpy_s(Team_data[i].weaponry_pool_variable[num_choices], "");
Team_data[i].weaponry_pool_variable[num_choices] = -1;
// Now set the number of this class available
if (static_weapon_variable_pool[i][idx] == -1)
{
Team_data[i].weaponry_count[num_choices] = static_weapon_pool[i][idx];
strcpy_s(Team_data[i].weaponry_amount_variable[num_choices], "");
Team_data[i].weaponry_amount_variable[num_choices] = -1;
}
else
{
Assert (Sexp_variables[static_weapon_variable_pool[i][idx]].type & SEXP_VARIABLE_NUMBER);
strcpy_s(Team_data[i].weaponry_amount_variable[num_choices], Sexp_variables[static_weapon_variable_pool[i][idx]].variable_name);
Team_data[i].weaponry_amount_variable[num_choices] = static_weapon_variable_pool[i][idx];
Team_data[i].weaponry_count[num_choices] = atoi(Sexp_variables[static_weapon_variable_pool[i][idx]].text);
}
+1
View File
@@ -16,6 +16,7 @@
#include "FREDView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -22,6 +22,7 @@
#define ID_WING_DATA 9000
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -13,6 +13,7 @@
#include "model/model.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -6,6 +6,7 @@
#include "SetGlobalShipFlags.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+10 -12
View File
@@ -43,7 +43,6 @@
#include "iff_defs/iff_defs.h"
#include "mission/missionmessage.h"
#include "graphics/gropenglshader.h"
#include "graphics/gropenglpostprocessing.h"
#include "sound/ds.h"
#define TREE_NODE_INCREMENT 100
@@ -57,6 +56,7 @@
// note: stay below 0xe000 so we don't collide with MFC defines..
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -5235,7 +5235,7 @@ sexp_list_item *sexp_tree::get_listing_opf_sound_environment()
sexp_list_item head;
head.add_data(SEXP_NONE_STRING);
for (int i = 0; i < (int)EFX_presets.size(); i++) {
for (int i = 0; i < EFX_presets.size(); i++) {
// ugh
char *text = const_cast<char*>(EFX_presets[i].name.c_str());
head.add_data(text);
@@ -5732,11 +5732,9 @@ sexp_list_item *sexp_tree::get_listing_opf_post_effect()
{
unsigned int i;
sexp_list_item head;
SCP_vector<SCP_string> ppe_names;
get_post_process_effect_names(ppe_names);
for (i=0; i < ppe_names.size(); i++) {
head.add_data(const_cast<char*>(ppe_names[i].c_str()));
}
SCP_vector<opengl::post_effect> &ppe_names = opengl::post_shader::get_effects();
for (i=0; i < ppe_names.size(); i++)
head.add_data(const_cast<char*>(ppe_names[i].name.c_str()));
return head.next;
}
@@ -5921,20 +5919,20 @@ int sexp_tree::get_loadout_variable_count(int var_index)
for (int i=0; i < MAX_TVT_TEAMS; i++) {
for(idx=0; idx<Team_data[i].num_ship_choices; idx++) {
if (!strcmp(Team_data[i].ship_list_variables[idx], Sexp_variables[var_index].variable_name)) {
if (var_index == Team_data[i].ship_list_variables[idx]) {
count++;
}
if (!strcmp(Team_data[i].ship_count_variables[idx], Sexp_variables[var_index].variable_name)) {
count++;
if (var_index == Team_data[i].ship_count_variables[idx]) {
count++;
}
}
for (idx=0; idx<Team_data[i].num_weapon_choices; idx++) {
if (!strcmp(Team_data[i].weaponry_pool_variable[idx], Sexp_variables[var_index].variable_name)) {
if (var_index == Team_data[i].weaponry_pool_variable[idx]) {
count++;
}
if (!strcmp(Team_data[i].weaponry_amount_variable[idx], Sexp_variables[var_index].variable_name)) {
if (var_index == Team_data[i].weaponry_amount_variable[idx]) {
count++;
}
}
+1
View File
@@ -17,6 +17,7 @@
#include "iff_defs/iff_defs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -22,6 +22,7 @@
#define ACTIVITY_WING 2
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -14,6 +14,7 @@
#include "ShipClassEditorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -47,6 +47,7 @@
#define NO_PERSONA_INDEX 999
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -16,6 +16,7 @@
#include "globalincs/linklist.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -28,6 +28,7 @@
#define DATA_MASK 0x0fff
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -18,6 +18,7 @@
#include "FREDDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -9,6 +9,7 @@
#include "FREDDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -8,6 +8,7 @@
#include "bmpman/bmpman.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -10,6 +10,7 @@
#include "cfile/cfile.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -16,6 +16,7 @@
#include "FREDDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -16,6 +16,7 @@
#include "cfile/cfile.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -17,6 +17,7 @@
#include <math.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -27,6 +27,7 @@
#define ID_WAYPOINT_MENU 9000
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -20,6 +20,7 @@
#define BLANK_FIELD -99
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -30,6 +30,7 @@
#define MULTI_WING 999999
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+1
View File
@@ -27,6 +27,7 @@
#define ID_WING_MENU 9000
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+75 -37
View File
@@ -308,6 +308,10 @@ char Game_current_mission_filename[MAX_FILENAME_LEN];
int game_single_step = 0;
int last_single_step=0;
extern int MSG_WINDOW_X_START; // used to position mission_time and shields output
extern int MSG_WINDOW_Y_START;
extern int MSG_WINDOW_HEIGHT;
int game_zbuffer = 1;
//static int Game_music_paused;
static int Game_paused;
@@ -990,7 +994,6 @@ void game_level_close()
cam_close();
subtitles_close();
trail_level_close();
hud_level_close();
// be sure to not only reset the time but the lock as well
set_time_compression(1.0f, 0.0f);
@@ -1085,6 +1088,7 @@ void game_level_init(int seed)
mission_brief_common_init(); // Free all existing briefing/debriefing text
weapon_level_init();
init_decals();
NavSystem_Init(); // zero out the nav system
@@ -1099,6 +1103,9 @@ void game_level_init(int seed)
// cmeasure_init(); //WMC - cmeasures are now weapons
shield_hit_init(); // Initialize system for showing shield hits
if ( !Is_standalone )
radar_mission_init();
mission_init_goals();
mission_log_init();
messages_init();
@@ -1539,7 +1546,11 @@ int game_start_mission()
mprintf(( "=================== STARTING LEVEL LOAD ==================\n" ));
// clear post processing settings
gr_post_process_set_defaults();
if(!Is_standalone)
gr_screen.gf_set_default_post_process();
// clear shader manager cache
gr_clear_shaders_cache();
get_mission_info(Game_current_mission_filename, &The_mission, false);
@@ -2133,6 +2144,9 @@ void game_init()
bm_set_low_mem(0); // Use all frames of bitmaps
}
if(!Is_standalone)
gr_screen.gf_post_process_init();
//WMC - Initialize my new GUI system
//This may seem scary, but it should take up 0 processing time and very little memory
//as long as it's not being used.
@@ -2170,6 +2184,8 @@ void game_init()
mouse_init();
gamesnd_parse_soundstbl();
select_radar_mode(Cmdline_orb_radar);
gameseq_init();
multi_init();
@@ -3831,7 +3847,7 @@ void game_render_frame( camid cid )
}
gr_zbuffer_clear(TRUE);
gr_post_process_begin();
gr_screen.gf_post_process_before();
clip_frame_view();
@@ -3884,7 +3900,7 @@ void game_render_frame( camid cid )
//This is so we can change the minimum clipping distance without messing everything up.
if(draw_viewer_last && Viewer_obj)
{
gr_post_process_save_zbuffer();
gr_screen.gf_save_zbuffer();
gr_zbuffer_clear(TRUE);
ship_render(Viewer_obj);
}
@@ -3912,13 +3928,13 @@ void game_render_frame( camid cid )
//Draw viewer cockpit
if(Viewer_obj != NULL && Viewer_mode != VM_TOPDOWN)
{
gr_post_process_save_zbuffer();
gr_screen.gf_save_zbuffer();
gr_zbuffer_clear(TRUE);
ship_render_cockpit(Viewer_obj);
}
//================ END OF 3D RENDERING STUFF ====================
gr_post_process_end();
gr_screen.gf_post_process_after();
extern int Multi_display_netinfo;
if(Multi_display_netinfo){
@@ -4256,7 +4272,7 @@ void game_simulation_frame()
// process some stuff every frame (before frame is rendered)
emp_process_local();
hud_update_frame(flFrametime); // update hud systems
hud_update_frame(); // update hud systems
if (!physics_paused) {
// Move particle system
@@ -4387,24 +4403,34 @@ int game_actually_playing()
return 1;
}
void game_render_hud(camid cid)
// Draw the 2D HUD gauges
void game_render_hud_2d()
{
gr_reset_clip();
if(cid.isValid()) {
g3_start_frame(0); // 0 = turn zbuffering off
g3_set_view( cid.getCamera() );
hud_render_preprocess(flFrametime);
g3_end_frame();
if ( !(Game_detail_flags & DETAIL_FLAG_HUD) ) {
return;
}
HUD_render_2d(flFrametime);
gr_reset_clip();
}
// main HUD rendering function
hud_render_all();
// Draw the 3D-dependant HUD gauges
void game_render_hud_3d(camid cid)
{
if(!cid.isValid())
return;
g3_start_frame(0); // 0 = turn zbuffering off
g3_set_view( cid.getCamera() );
if ( (Game_detail_flags & DETAIL_FLAG_HUD) && (supernova_active() < 3)/* && !(Game_mode & GM_MULTIPLAYER) || ( (Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_OBSERVER) )*/ ) {
HUD_render_3d(flFrametime);
}
// Diminish the palette effect
game_flash_diminish(flFrametime);
g3_end_frame();
}
//100% blackness
@@ -4686,23 +4712,22 @@ void game_frame(int paused)
Scripting_didnt_draw_hud = 0;
Script_system.RemHookVar("Self");
if(Scripting_didnt_draw_hud) {
game_render_hud(cid);
if(Scripting_didnt_draw_hud)
{
hud_show_target_model();
}
if(Scripting_didnt_draw_hud)
{
hud_show_radar();
}
HUD_reset_clip();
if( (Game_detail_flags & DETAIL_FLAG_HUD) && (!(Game_mode & GM_MULTIPLAYER) || ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_OBSERVER))) ) {
hud_maybe_clear_head_area();
anim_render_all(0, flFrametime);
}
Script_system.SetHookObject("Self", Viewer_obj);
if (!hud_disabled_except_messages() && !(Viewer_mode & (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY)))
{
Script_system.RunBytecode(Script_hudhook);
Script_system.RunCondition(CHA_HUDDRAW, '\0', NULL, Viewer_obj);
}
Script_system.RemHookVar("Self");
// check to see if we should display the death died popup
if(Game_mode & GM_DEAD_BLEW_UP){
if(Game_mode & GM_MULTIPLAYER){
@@ -4732,6 +4757,26 @@ void game_frame(int paused)
game_show_time_left();
// Draw the 2D HUD gauges
if(Scripting_didnt_draw_hud)
{
if(supernova_active() < 3){
game_render_hud_2d();
}
// Draw 3D HUD gauges
game_render_hud_3d(cid);
}
Script_system.SetHookObject("Self", Viewer_obj);
if (!hud_disabled_except_messages() && !(Viewer_mode & (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY)))
{
Script_system.RunBytecode(Script_hudhook);
Script_system.RunCondition(CHA_HUDDRAW, '\0', NULL, Viewer_obj);
}
Script_system.RemHookVar("Self");
gr_reset_clip();
game_render_post_frame();
@@ -6475,12 +6520,6 @@ void game_enter_state( int old_state, int new_state )
}
player_restore_target_and_weapon_link_prefs();
if ( !Is_standalone )
radar_mission_init();
//Set the current hud
set_current_hud();
Game_mode |= GM_IN_MISSION;
#ifndef NDEBUG
@@ -7657,7 +7696,6 @@ void game_shutdown(void)
// load up common multiplayer icons
multi_unload_common_icons();
hud_close();
shockwave_close(); // release any memory used by shockwave system
fireball_close(); // free fireball system
particle_close(); // close out the particle system
+2
View File
@@ -19,6 +19,7 @@ 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();
@@ -53,6 +54,7 @@ void level_page_in()
particle_page_in();
debris_page_in();
hud_page_in();
radar_page_in();
training_mission_page_in();
stars_page_in();
shockwave_page_in();
+1 -1
View File
@@ -66,7 +66,7 @@ typedef struct menu_music {
char filename[MAX_FILENAME_LEN]; // name music is stored on disk as
} menu_music;
#define MAX_SPOOLED_MUSIC 50 // max number of briefing/mainhall/credits tracks
#define MAX_SPOOLED_MUSIC 30 // max number of briefing/mainhall/credits tracks
// Goober5000 - spooled music flags
#define SMF_VALID (1 << 0)
-57
View File
@@ -1,57 +0,0 @@
#include "globalincs/pstypes.h"
// throw
void * operator new (size_t size) throw (std::bad_alloc)
{
void *p = vm_malloc_q(size);
if ( !p ) {
throw std::bad_alloc();
}
return p;
}
void operator delete (void *p) throw()
{
vm_free(p);
}
void * operator new [] (size_t size) throw (std::bad_alloc)
{
void *p = vm_malloc_q(size);
if ( !p ) {
throw std::bad_alloc();
}
return p;
}
void operator delete [] (void *p) throw()
{
vm_free(p);
}
// no-throw
void * operator new (size_t size, const std::nothrow_t&) throw()
{
return vm_malloc_q(size);
}
void operator delete (void *p, const std::nothrow_t&) throw()
{
vm_free(p);
}
void * operator new [] (size_t size, const std::nothrow_t&) throw()
{
return vm_malloc_q(size);
}
void operator delete [] (void *p, const std::nothrow_t&) throw()
{
vm_free(p);
}
-25
View File
@@ -1,25 +0,0 @@
#ifndef _FSMEMORY_H
#define _FSMEMORY_H
#include <new>
// throw
extern void * operator new (size_t size) throw (std::bad_alloc);
extern void operator delete (void *p) throw();
extern void * operator new [] (size_t size) throw (std::bad_alloc);
extern void operator delete [] (void *p) throw();
// no-throw
extern void * operator new (size_t size, const std::nothrow_t&) throw();
extern void operator delete (void *p, const std::nothrow_t&) throw();
extern void * operator new [] (size_t size, const std::nothrow_t&) throw();
extern void operator delete [] (void *p, const std::nothrow_t&) throw();
#endif // _FSMEMORY_H
+3 -32
View File
@@ -104,15 +104,8 @@ typedef struct vec3d {
};
inline void operator= (vertex&vert);
inline void set_screen_vert(vertex&vert);
bool operator == (const vec3d &other);
} vec3d;
inline bool vec3d::operator == (const vec3d &other)
{
return ( (a1d[0] == other.a1d[0]) && (a1d[1] == other.a1d[1]) && (a1d[2] == other.a1d[2]) );
}
/*
// A vector referenced as an array
typedef struct vectora {
@@ -154,28 +147,18 @@ typedef struct uv_pair {
typedef struct vertex {
float x, y, z; // world space position
float sx, sy, sw; // screen space position (sw == 1/z)
float u, v; // texture position
// float u2, v2, u3, v3, u4, v4; // texture position
// vec3d real_pos; // _real_ world position
float u, v, u2, v2, u3, v3, u4, v4; // texture position
vec3d real_pos; // _real_ world position
ubyte spec_a, spec_r, spec_b, spec_g; //specular highlights -Bobboau
ubyte r, g, b, a; // color. Use b for darkening;
ubyte spec_r, spec_g, spec_b, spec_a; //specular highlights -Bobboau
ubyte codes; // what sides of view pyramid this point is on/off. 0 = Inside view pyramid.
ubyte flags; // Projection flags. Indicates whether it is projected or not or if projection overflowed.
ubyte pad[2]; // pad structure to be 4 byte aligned.
void operator=(vec3d&vec){
memcpy(&x,&vec, sizeof(vec3d));
}
bool operator == (const vertex &other);
} vertex;
inline bool vertex::operator == (const vertex &other)
{
// NOTE: this is checking position and uv only!
return ( (x == other.x) && (y == other.y) && (z == other.z)
&& (u == other.u) && (v == other.v) );
}
inline void vec3d::operator= (vertex&vert){
memcpy(this,&vert.x,sizeof(vec3d));
}
@@ -261,16 +244,6 @@ extern int Global_error_count;
// Goober5000 - define Verify for use in both release and debug mode
#define Verify(x) do { if (!(x)){ Error(LOCATION, "Verify failure: %s\n", #x); } ASSUME(x); } while(0)
// VerifyEx
#ifndef _MSC_VER // non MS compilers
# define VerifyEx(x, y, ...) do { if (!(x)) { Error(LOCATION, "Verify failure: %s with help text " #y "\n", #x, ##__VA_ARGS__); } ASSUME(x); } while(0)
#else
# if _MSC_VER >= 1400 // VC 2005 or greater
# define VerifyEx(x, y, ...) do { if (!(x)) { Error(LOCATION, "Verify failure: %s with help text " #y "\n", #x, __VA_ARGS__); } ASSUME(x); } while(0)
# else // everything else
# define VerifyEx(x, y) Verify(x)
# endif
#endif
//#define Int3() _asm { int 3 }
@@ -694,8 +667,6 @@ void vm_free_all();
#endif
#include "globalincs/fsmemory.h"
//=========================================================
// Scripting
//=========================================================
-1
View File
@@ -72,7 +72,6 @@ bool Normalmap_override = false;
bool Heightmap_override = false;
bool Glowpoint_override = false;
bool GLSL_override = false;
bool PostProcessing_override = false;
// Values used for noise for thruster animations
float Noise[NOISE_NUM_FRAMES] = {
-1
View File
@@ -138,7 +138,6 @@ extern bool Normalmap_override;
extern bool Heightmap_override;
extern bool Glowpoint_override;
extern bool GLSL_override;
extern bool PostProcessing_override;
// game skill levels
#define NUM_SKILL_LEVELS 5
+62 -154
View File
@@ -85,26 +85,6 @@ float Max_draw_distance = Default_max_draw_distance;
static float Gr_resize_X = 1.0f, Gr_resize_Y = 1.0f;
static float Gr_unsize_X = 1.0f, Gr_unsize_Y = 1.0f;
float Gr_save_resize_X = 1.0f, Gr_save_resize_Y = 1.0f;
float Gr_save_unsize_X = 1.0f, Gr_save_unsize_Y = 1.0f;
void gr_set_screen_scale(int w, int h)
{
Gr_resize_X = (float)gr_screen.max_w / (float)w;
Gr_resize_Y = (float)gr_screen.max_h / (float)h;
Gr_unsize_X = (float)w / (float)gr_screen.max_w;
Gr_unsize_Y = (float)h / (float)gr_screen.max_h;
}
void gr_reset_screen_scale()
{
Gr_resize_X = Gr_save_resize_X;
Gr_resize_Y = Gr_save_resize_Y;
Gr_unsize_X = Gr_save_unsize_X;
Gr_unsize_Y = Gr_save_unsize_Y;
}
/**
* This function is to be called if you wish to scale GR_1024 or GR_640 x and y positions or
@@ -410,11 +390,11 @@ static bool gr_init_sub(int mode, int width, int height, int depth)
mode = GR_OPENGL;
}
Gr_save_resize_X = Gr_resize_X = (float)width / ((res == GR_1024) ? 1024.0f : 640.0f);
Gr_save_resize_Y = Gr_resize_Y = (float)height / ((res == GR_1024) ? 768.0f : 480.0f);
Gr_resize_X = (float)width / ((res == GR_1024) ? 1024.0f : 640.0f);
Gr_resize_Y = (float)height / ((res == GR_1024) ? 768.0f : 480.0f);
Gr_save_unsize_X = Gr_unsize_X = ((res == GR_1024) ? 1024.0f : 640.0f) / (float)width;
Gr_save_unsize_Y = Gr_unsize_Y = ((res == GR_1024) ? 768.0f : 480.0f) / (float)height;
Gr_unsize_X = ((res == GR_1024) ? 1024.0f : 640.0f) / (float)width;
Gr_unsize_Y = ((res == GR_1024) ? 768.0f : 480.0f) / (float)height;
gr_screen.signature = Gr_signature++;
@@ -849,7 +829,6 @@ void gr_bitmap(int _x, int _y, bool allow_scaling)
{
int _w, _h;
float x, y, w, h;
vertex verts[4];
if (gr_screen.mode == GR_STUB) {
return;
@@ -868,86 +847,8 @@ void gr_bitmap(int _x, int _y, bool allow_scaling)
gr_resize_screen_posf(&w, &h);
}
memset(verts, 0, sizeof(verts));
verts[0].sx = x;
verts[0].sy = y;
verts[0].u = 0.0f;
verts[0].v = 0.0f;
verts[1].sx = x + w;
verts[1].sy = y;
verts[1].u = 1.0f;
verts[1].v = 0.0f;
verts[2].sx = x + w;
verts[2].sy = y + h;
verts[2].u = 1.0f;
verts[2].v = 1.0f;
verts[3].sx = x;
verts[3].sy = y + h;
verts[3].u = 0.0f;
verts[3].v = 1.0f;
// turn off zbuffering
int saved_zbuffer_mode = gr_zbuffer_get();
gr_zbuffer_set(GR_ZBUFF_NONE);
gr_render(4, verts, TMAP_FLAG_TEXTURED | TMAP_FLAG_INTERFACE);
gr_zbuffer_set(saved_zbuffer_mode);
}
void gr_bitmap_uv(int _x, int _y, int _w, int _h, float _u0, float _v0, float _u1, float _v1, bool allow_scaling)
{
float x, y, w, h;
vertex verts[4];
if (gr_screen.mode == GR_STUB) {
return;
}
x = i2fl(_x);
y = i2fl(_y);
w = i2fl(_w);
h = i2fl(_h);
// I will tidy this up later - RT
if ( allow_scaling && (gr_screen.custom_size || (gr_screen.rendering_to_texture != -1)) ) {
gr_resize_screen_posf(&x, &y);
gr_resize_screen_posf(&w, &h);
}
memset(verts, 0, sizeof(verts));
verts[0].sx = x;
verts[0].sy = y;
verts[0].u = _u0;
verts[0].v = _v0;
verts[1].sx = x + w;
verts[1].sy = y;
verts[1].u = _u1;
verts[1].v = _v0;
verts[2].sx = x + w;
verts[2].sy = y + h;
verts[2].u = _u1;
verts[2].v = _v1;
verts[3].sx = x;
verts[3].sy = y + h;
verts[3].u = _u0;
verts[3].v = _v1;
// turn off zbuffering
int saved_zbuffer_mode = gr_zbuffer_get();
gr_zbuffer_set(GR_ZBUFF_NONE);
gr_render(4, verts, TMAP_FLAG_TEXTURED | TMAP_FLAG_INTERFACE);
gr_zbuffer_set(saved_zbuffer_mode);
// RT draws all hall interface stuff
g3_draw_2d_poly_bitmap(x, y, w, h, TMAP_FLAG_INTERFACE);
}
// NEW new bitmap functions -Bobboau
@@ -1175,47 +1076,66 @@ void gr_pline_special(vec3d **pts, int num_pts, int thickness,bool resize)
gr_set_cull(cull);
}
int poly_list::find_first_vertex(int idx)
inline bool same_vert(vertex *v1, vertex *v2, vec3d *n1, vec3d *n2)
{
vec3d *o_norm = &norm[idx];
vertex *o_vert = &vert[idx];
vec3d *p_norm = &norm[0];
vertex *p_vert = &vert[0];
return (
(v1->x == v2->x) &&
(v1->y == v2->y) &&
(v1->z == v2->z) &&
(v1->u == v2->u) &&
(v1->v == v2->v) &&
(n1->xyz.x == n2->xyz.x) &&
(n1->xyz.y == n2->xyz.y) &&
(n1->xyz.z == n2->xyz.z)
);
}
//finds the first occorence of a vertex within a poly list
int find_first_index(poly_list *plist, int idx)
{
vec3d *p_norm = &plist->norm[0];
vertex *p_vert = &plist->vert[0];
vec3d *norm = &plist->norm[idx];
vertex *vert = &plist->vert[idx];
int i;
// we should always equal ourselves, so just use that as the stopping point
for (int i = 0; i < idx; i++) {
if ( (*p_norm == *o_norm) && (*p_vert == *o_vert) ) {
for (i = 0; i < idx; i++) {
if ( same_vert(p_vert, vert, p_norm, norm) ) {
return i;
}
++p_norm;
++p_vert;
p_norm++;
p_vert++;
}
return idx;
}
//given a list (plist) find the index within the indexed list that the vert at position idx within list is at
int poly_list::find_index(poly_list *plist, int idx)
//given a list (plist) and an indexed list (v) find the index within the indexed list that the vert at position idx within list is at
int find_first_index_vb(poly_list *plist, int idx, poly_list *v)
{
vec3d *o_norm = &plist->norm[idx];
vertex *o_vert = &plist->vert[idx];
vec3d *p_norm = &norm[0];
vertex *p_vert = &vert[0];
vec3d *p_norm = &plist->norm[idx];
vertex *p_vert = &plist->vert[idx];
vec3d *norm = &v->norm[0];
vertex *vert = &v->vert[0];
int i;
for (int i = 0; i < n_verts; i++) {
if ( (*p_norm == *o_norm) && (*p_vert == *o_vert) ) {
for (i = 0; i < v->n_verts; i++) {
if ( same_vert(vert, p_vert, norm, p_norm) ) {
return i;
}
++p_vert;
++p_norm;
vert++;
norm++;
}
return -1;
}
void poly_list::allocate(int _verts)
{
if (_verts <= currently_allocated)
@@ -1243,9 +1163,11 @@ void poly_list::allocate(int _verts)
if (Cmdline_normal) {
tsb = (tsb_t*)vm_malloc(sizeof(tsb_t) * _verts);
}
}
n_verts = 0;
n_prim = 0;
currently_allocated = _verts;
}
@@ -1277,9 +1199,6 @@ void poly_list::calculate_tangent()
vec3d tangent, binormal, cross;
float magg, scale;
if ( !Cmdline_normal ) {
return;
}
Assert( !(n_verts % 3) );
@@ -1359,16 +1278,17 @@ void poly_list::calculate_tangent()
}
}
static poly_list buffer_list_internal;
poly_list poly_list_index_buffer_internal_list;
void poly_list::make_index_buffer(SCP_vector<int> &vertex_list)
void poly_list::make_index_buffer()
{
int nverts = 0;
int j, z = 0;
ubyte *nverts_good = NULL;
// calculate tangent space data (must be done early)
calculate_tangent();
if (Cmdline_normal) {
calculate_tangent();
}
// using vm_malloc() here rather than 'new' so we get the extra out-of-memory check
nverts_good = (ubyte *) vm_malloc(n_verts);
@@ -1376,54 +1296,41 @@ void poly_list::make_index_buffer(SCP_vector<int> &vertex_list)
Assert( nverts_good != NULL );
memset( nverts_good, 0, n_verts );
vertex_list.reserve(n_verts);
for (j = 0; j < n_verts; j++) {
if (find_first_vertex(j) == j) {
if ( (find_first_index(this, j)) == j ) {
nverts++;
nverts_good[j] = 1;
vertex_list.push_back(j);
}
}
// if there is nothig to change then bail
if (n_verts == nverts) {
if (nverts_good != NULL) {
vm_free(nverts_good);
}
return;
}
buffer_list_internal.n_verts = 0;
buffer_list_internal.allocate(nverts);
poly_list_index_buffer_internal_list.n_verts = 0;
poly_list_index_buffer_internal_list.allocate(nverts);
for (j = 0; j < n_verts; j++) {
if ( !nverts_good[j] ) {
continue;
}
buffer_list_internal.vert[z] = vert[j];
buffer_list_internal.norm[z] = norm[j];
poly_list_index_buffer_internal_list.vert[z] = vert[j];
poly_list_index_buffer_internal_list.norm[z] = norm[j];
if (Cmdline_normal) {
buffer_list_internal.tsb[z] = tsb[j];
poly_list_index_buffer_internal_list.tsb[z] = tsb[j];
}
buffer_list_internal.n_verts++;
poly_list_index_buffer_internal_list.n_verts++;
// Assert( find_first_index(&buffer_list_internal, z) == z );
// Assert( find_first_index(&poly_list_index_buffer_internal_list, z) == z );
z++;
}
Assert(nverts == buffer_list_internal.n_verts);
Assert(nverts == poly_list_index_buffer_internal_list.n_verts);
if (nverts_good != NULL) {
vm_free(nverts_good);
}
(*this) = buffer_list_internal;
(*this) = poly_list_index_buffer_internal_list;
}
poly_list& poly_list::operator = (poly_list &other_list)
@@ -1438,6 +1345,7 @@ poly_list& poly_list::operator = (poly_list &other_list)
}
n_verts = other_list.n_verts;
n_prim = other_list.n_prim;
return *this;
}
+33 -106
View File
@@ -105,23 +105,21 @@ typedef struct tsb_t {
// this should be basicly just like it is in the VB
// a list of triangles and their associated normals
struct poly_list {
poly_list(): n_verts(0), vert(NULL), norm(NULL), tsb(NULL), currently_allocated(0) {}
poly_list(): n_prim(0), n_verts(0), vert(NULL), norm(NULL), tsb(NULL), currently_allocated(0) {}
~poly_list();
poly_list& operator = (poly_list&);
void allocate(int size);
void make_index_buffer(SCP_vector<int> &vertex_list);
void make_index_buffer();
void calculate_tangent();
int n_prim;
int n_verts;
vertex *vert;
vec3d *norm;
tsb_t *tsb;
int find_index(poly_list *plist, int idx);
private:
int currently_allocated;
int find_first_vertex(int idx);
};
@@ -132,75 +130,20 @@ struct colored_vector {
ubyte color[4];
};
bool same_vert(vertex *v1, vertex *v2, vec3d *n1, vec3d *n2);
//finds the first occorence of a vertex within a poly list
int find_first_index(poly_list *plist, int idx);
//given a list (plist) and an indexed list (v) find the index within the indexed list that the vert at position idx within list is at
int find_first_index_vb(poly_list *plist, int idx, poly_list *v);
struct line_list {
int n_line;
vertex *vert;
};
struct buffer_data {
int flags;
int texture; // this is the texture the vertex buffer will use
int n_verts;
size_t index_offset;
uint *index;
void release()
{
if (index) {
delete [] index;
index = NULL;
}
}
buffer_data() :
flags(0), texture(-1), n_verts(0), index_offset(0), index(NULL)
{
}
};
struct vertex_buffer {
int flags;
uint stride;
size_t vertex_offset;
poly_list *model_list;
SCP_vector<buffer_data> tex_buf;
vertex_buffer() :
flags(0), stride(0), vertex_offset(0), model_list(NULL)
{
}
~vertex_buffer()
{
clear();
}
void release()
{
if (model_list) {
delete model_list;
model_list = NULL;
}
for (size_t i = 0; i < tex_buf.size(); i++) {
tex_buf[i].release();
}
}
void clear()
{
release();
tex_buf.clear();
}
};
struct light;
@@ -353,9 +296,6 @@ typedef struct screen {
// Texture maps the current bitmap. See TMAP_FLAG_?? defines for flag values
void (*gf_tmapper)(int nv, vertex *verts[], uint flags );
// Texture maps the current bitmap. See TMAP_FLAG_?? defines for flag values
void (*gf_render)(int nv, vertex *verts, uint flags);
// dumps the current screen to a file
void (*gf_print_screen)(char * filename);
@@ -439,13 +379,10 @@ typedef struct screen {
void (*gf_set_texture_addressing)(int);
int (*gf_create_buffer)();
bool (*gf_pack_buffer)(const int buffer_id, vertex_buffer *vb);
bool (*gf_config_buffer)(const int buffer_id, vertex_buffer *vb);
int (*gf_make_buffer)(poly_list*, uint flags);
void (*gf_destroy_buffer)(int);
void (*gf_set_buffer)(int);
void (*gf_render_buffer)(int, const vertex_buffer*, int, int);
void (*gf_render_buffer)(int, int, ushort*, uint*, int);
int (*gf_make_flat_buffer)(poly_list*);
int (*gf_make_line_buffer)(line_list*);
@@ -472,12 +409,13 @@ typedef struct screen {
void (*gf_set_ambient_light)(int,int,int);
// postprocessing effects
void (*gf_post_process_set_effect)(const char*, int);
void (*gf_post_process_set_defaults)();
void (*gf_set_post_effect)(SCP_string&, int);
void (*gf_set_default_post_process)();
void (*gf_post_process_begin)();
void (*gf_post_process_end)();
void (*gf_post_process_save_zbuffer)();
void (*gf_post_process_init)();
void (*gf_post_process_before)();
void (*gf_post_process_after)();
void (*gf_save_zbuffer)();
void (*gf_lighting)(bool,bool);
void (*gf_center_alpha)(int);
@@ -540,8 +478,6 @@ extern screen gr_screen;
#define GR_ZBUFF_READ (1<<1)
#define GR_ZBUFF_FULL (GR_ZBUFF_WRITE|GR_ZBUFF_READ)
void gr_set_screen_scale(int x, int y);
void gr_reset_screen_scale();
bool gr_unsize_screen_pos(int *x, int *y);
bool gr_resize_screen_pos(int *x, int *y);
bool gr_unsize_screen_posf(float *x, float *y);
@@ -662,7 +598,6 @@ __inline void gr_pixel(int x, int y, bool resize = true)
#define gr_scaler GR_CALL(gr_screen.gf_scaler)
#define gr_aascaler GR_CALL(gr_screen.gf_aascaler)
#define gr_tmapper GR_CALL(gr_screen.gf_tmapper)
#define gr_render GR_CALL(gr_screen.gf_render)
//#define gr_gradient GR_CALL(gr_screen.gf_gradient)
__inline void gr_gradient(int x1, int y1, int x2, int y2, bool resize = true)
@@ -737,13 +672,11 @@ __inline int gr_bm_set_render_target(int n, int face = -1)
#define gr_set_texture_addressing GR_CALL(*gr_screen.gf_set_texture_addressing)
#define gr_create_buffer GR_CALL(*gr_screen.gf_create_buffer)
#define gr_pack_buffer GR_CALL(*gr_screen.gf_pack_buffer)
#define gr_config_buffer GR_CALL(*gr_screen.gf_config_buffer)
#define gr_make_buffer GR_CALL(*gr_screen.gf_make_buffer)
#define gr_destroy_buffer GR_CALL(*gr_screen.gf_destroy_buffer)
__inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags = TMAP_FLAG_TEXTURED)
__inline void gr_render_buffer(int start, int n_prim, ushort *sbuffer, uint *ibuffer = NULL, int flags = TMAP_FLAG_TEXTURED)
{
(*gr_screen.gf_render_buffer)(start, bufferp, texi, flags);
(*gr_screen.gf_render_buffer)(start, n_prim, sbuffer, ibuffer, flags);
}
#define gr_set_buffer GR_CALL(*gr_screen.gf_set_buffer)
@@ -768,11 +701,7 @@ __inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi
#define gr_reset_lighting GR_CALL(*gr_screen.gf_reset_lighting)
#define gr_set_ambient_light GR_CALL(*gr_screen.gf_set_ambient_light)
#define gr_post_process_set_effect GR_CALL(*gr_screen.gf_post_process_set_effect)
#define gr_post_process_set_defaults GR_CALL(*gr_screen.gf_post_process_set_defaults)
#define gr_post_process_begin GR_CALL(*gr_screen.gf_post_process_begin)
#define gr_post_process_end GR_CALL(*gr_screen.gf_post_process_end)
#define gr_post_process_save_zbuffer GR_CALL(*gr_screen.gf_post_process_save_zbuffer)
#define gr_set_post_effect GR_CALL(*gr_screen.gf_set_post_effect)
#define gr_set_lighting GR_CALL(*gr_screen.gf_lighting)
#define gr_center_alpha GR_CALL(*gr_screen.gf_center_alpha)
@@ -819,7 +748,6 @@ void gr_set_shader(shader *shade);
// new bitmap functions
void gr_bitmap(int x, int y, bool resize = true);
void gr_bitmap_uv(int _x, int _y, int _w, int _h, float _u0, float _v0, float _u1, float _v1, bool resize = true);
void gr_bitmap_list(bitmap_2d_list* list, int n_bm, bool allow_scaling);
void gr_bitmap_list(bitmap_rect_list* list, int n_bm, bool allow_scaling);
@@ -828,17 +756,16 @@ void gr_bitmap_list(bitmap_rect_list* list, int n_bm, bool allow_scaling);
// Moreover, it is _really_ intended for use with 45 degree angles.
void gr_pline_special(vec3d **pts, int num_pts, int thickness,bool resize=true);
#define VB_FLAG_POSITION (1<<0)
#define VB_FLAG_RHW (1<<1) //incompatable with the next normal
#define VB_FLAG_NORMAL (1<<2)
#define VB_FLAG_DIFUSE (1<<3)
#define VB_FLAG_SPECULAR (1<<4)
#define VB_FLAG_UV1 (1<<5) //how many UV coords, only use one of these
#define VB_FLAG_UV2 (1<<6)
#define VB_FLAG_UV3 (1<<7)
#define VB_FLAG_UV4 (1<<8)
#define VB_FLAG_TANGENT (1<<9)
#define VB_FLAG_LARGE_INDEX (1<<10)
#define VERTEX_FLAG_POSITION (1<<0)
#define VERTEX_FLAG_RHW (1<<1) //incompatable with the next normal
#define VERTEX_FLAG_NORMAL (1<<2)
#define VERTEX_FLAG_DIFUSE (1<<3)
#define VERTEX_FLAG_SPECULAR (1<<4)
#define VERTEX_FLAG_UV1 (1<<5) //how many UV coords, only use one of these
#define VERTEX_FLAG_UV2 (1<<6)
#define VERTEX_FLAG_UV3 (1<<7)
#define VERTEX_FLAG_UV4 (1<<8)
#define VERTEX_FLAG_TANGENT (1<<9)
void gr_clear_shaders_cache();
+3 -3
View File
@@ -656,9 +656,9 @@ int gr_create_font(char * typeface)
int i,x,y;
x = y = 0;
for (i=0; i<fnt->num_chars; i++ ) {
ubyte * ubp;
ubyte * fp;
int x1, y1;
ubp = &fnt->pixel_data[fnt->char_data[i].offset];
fp = &fnt->pixel_data[fnt->char_data[i].offset];
if ( x + fnt->char_data[i].byte_width >= fnt->bm_w ) {
x = 0;
y += fnt->h;
@@ -671,7 +671,7 @@ int gr_create_font(char * typeface)
for( y1=0; y1<fnt->h; y1++ ) {
for (x1=0; x1<fnt->char_data[i].byte_width; x1++ ) {
uint c = *ubp++;
uint c = *fp++;
if ( c > 14 ) c = 14;
fnt->bm_data[(x+x1)+(y+y1)*fnt->bm_w] = (unsigned char)(c);
}
+34 -5
View File
@@ -19,6 +19,11 @@ geometry_batcher::~geometry_batcher()
vm_free(vert);
vert = NULL;
}
if (vert_list != NULL) {
vm_free(vert_list);
vert_list = NULL;
}
}
void geometry_batcher::allocate_internal(int n_verts)
@@ -32,9 +37,18 @@ void geometry_batcher::allocate_internal(int n_verts)
vert = NULL;
}
vert = (vertex *) vm_malloc( sizeof(vertex) * n_verts );
if (vert_list != NULL) {
vm_free(vert_list);
vert_list = NULL;
}
Verify( (vert != NULL) );
vert = (vertex *) vm_malloc( sizeof(vertex) * n_verts );
vert_list = (vertex **) vm_malloc( sizeof(vertex*) * n_verts );
Verify( (vert != NULL) && (vert_list != NULL) );
for (int i = 0; i < n_verts; i++)
vert_list[i] = &vert[i];
memset( vert, 0, sizeof(vertex) * n_verts );
n_allocated = n_verts;
@@ -77,9 +91,18 @@ void geometry_batcher::add_allocate(int quad, int n_tri)
vertex *old_vert = vert;
if (to_alloc > n_allocated) {
vert = (vertex *) vm_malloc( sizeof(vertex) * to_alloc );
if (vert_list != NULL) {
vm_free(vert_list);
vert_list = NULL;
}
Verify( (vert != NULL) );
vert = (vertex *) vm_malloc( sizeof(vertex) * to_alloc );
vert_list = (vertex **) vm_malloc( sizeof(vertex*) * to_alloc );
Verify( (vert != NULL) && (vert_list != NULL) );
for (int i = 0; i < to_alloc; i++)
vert_list[i] = &vert[i];
memset( vert, 0, sizeof(vertex) * to_alloc );
@@ -99,10 +122,16 @@ void geometry_batcher::clone(const geometry_batcher &geo)
if (n_allocated > 0) {
vert = (vertex *) vm_malloc( sizeof(vertex) * n_allocated );
vert_list = (vertex **) vm_malloc( sizeof(vertex*) * n_allocated );
memcpy( vert, geo.vert, sizeof(vertex) * n_allocated );
for (int i = 0; i < n_allocated; i++) {
vert_list[i] = &vert[i];
}
} else {
vert = NULL;
vert_list = NULL;
}
}
@@ -517,7 +546,7 @@ float geometry_batcher::draw_laser(vec3d *p0, float width1, vec3d *p1, float wid
void geometry_batcher::render(int flags)
{
if (n_to_render) {
gr_render(n_to_render * 3, vert, flags | TMAP_FLAG_TRILIST);
g3_draw_poly( n_to_render * 3, vert_list, flags | TMAP_FLAG_TRILIST);
n_to_render = 0;
}
}
+2 -1
View File
@@ -16,6 +16,7 @@ private:
int n_to_render; // the number of primitives to render
int n_allocated; // the number of verts allocated
vertex *vert;
vertex **vert_list; // V's stupid rendering functions need this
// makes sure we have enough space in the memory buffer for the geometry we are about to put into it
// you need to figure out how many verts are going to be required
@@ -24,7 +25,7 @@ private:
void clone(const geometry_batcher &geo);
public:
geometry_batcher(): n_to_render(0), n_allocated(0), vert(NULL) {};
geometry_batcher(): n_to_render(0), n_allocated(0), vert(NULL), vert_list(NULL) {};
~geometry_batcher();
geometry_batcher(const geometry_batcher &geo) { clone(geo); }
+43 -53
View File
@@ -33,7 +33,6 @@
#include "graphics/gropengldraw.h"
#include "graphics/gropenglshader.h"
#include "graphics/gropenglstate.h"
#include "graphics/gropenglpostprocessing.h"
#if defined(_WIN32)
@@ -53,10 +52,14 @@ typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
#pragma comment (lib, "glu32")
#endif
// minimum GL version we can reliably support is 1.2
static const int MIN_REQUIRED_GL_VERSION = 12;
int GL_version = 0;
#define REQUIRED_GL_MAJOR_VERSION 1
#ifdef __APPLE__ // the Apple GL version is more advanced than the version number lets on
#define REQUIRED_GL_MINOR_VERSION 1
#else
#define REQUIRED_GL_MINOR_VERSION 2
#endif
bool GL_initted = 0;
@@ -770,7 +773,7 @@ void gr_opengl_zbuffer_clear(int mode)
// I feel dirty...
static void opengl_make_gamma_ramp(float gamma, ushort *ramp)
{
ushort x, y;
int x, y;
ushort base_ramp[256];
Assert( ramp != NULL );
@@ -801,12 +804,12 @@ static void opengl_make_gamma_ramp(float gamma, ushort *ramp)
// for everything else we need to actually figure it up
else {
double g = 1.0 / (double)gamma;
double val;
int val;
Assert( GL_original_gamma_ramp != NULL );
for (x = 0; x < 256; x++) {
val = (pow(x/255.0, g) * 65535.0 + 0.5);
val = (int) (pow(x/255.0, g) * 65535.0 + 0.5);
CLAMP( val, 0, 65535 );
base_ramp[x] = (ushort)val;
@@ -1358,6 +1361,8 @@ void opengl_setup_viewport()
// NOTE: This should only ever be called through os_cleanup(), or when switching video APIs
void gr_opengl_shutdown()
{
gr_opengl_post_process_release();
if (GL_cursor_pbo) {
vglDeleteBuffersARB(1, &GL_cursor_pbo);
GL_cursor_pbo = 0;
@@ -1371,8 +1376,7 @@ void gr_opengl_shutdown()
opengl_tcache_shutdown();
opengl_light_shutdown();
opengl_tnl_shutdown();
opengl_post_process_shutdown();
opengl_shader_shutdown();
opengl::shader_manager::destroy();
GL_initted = false;
@@ -1523,7 +1527,7 @@ int opengl_init_display_device()
Cmdline_no_set_gamma = 1;
} else {
// assume identity ramp by default, to be overwritten by true ramp later
for (ushort x = 0; x < 256; x++) {
for (int x = 0; x < 256; x++) {
GL_original_gamma_ramp[x] = GL_original_gamma_ramp[x + 256] = GL_original_gamma_ramp[x + 512] = (x << 8) | x;
}
}
@@ -1720,7 +1724,6 @@ void opengl_setup_function_pointers()
gr_screen.gf_pixel = gr_opengl_pixel;
gr_screen.gf_scaler = gr_opengl_scaler;
gr_screen.gf_tmapper = gr_opengl_tmapper;
gr_screen.gf_render = gr_opengl_render;
gr_screen.gf_gradient = gr_opengl_gradient;
@@ -1780,9 +1783,7 @@ void opengl_setup_function_pointers()
gr_screen.gf_set_fill_mode = gr_opengl_set_fill_mode;
gr_screen.gf_set_texture_panning = gr_opengl_set_texture_panning;
gr_screen.gf_create_buffer = gr_opengl_create_buffer;
gr_screen.gf_config_buffer = gr_opengl_config_buffer;
gr_screen.gf_pack_buffer = gr_opengl_pack_buffer;
gr_screen.gf_make_buffer = gr_opengl_make_buffer;
gr_screen.gf_destroy_buffer = gr_opengl_destroy_buffer;
gr_screen.gf_render_buffer = gr_opengl_render_buffer;
gr_screen.gf_set_buffer = gr_opengl_set_buffer;
@@ -1798,12 +1799,13 @@ void opengl_setup_function_pointers()
gr_screen.gf_reset_lighting = gr_opengl_reset_lighting;
gr_screen.gf_set_ambient_light = gr_opengl_set_ambient_light;
gr_screen.gf_post_process_set_effect = gr_opengl_post_process_set_effect;
gr_screen.gf_post_process_set_defaults = gr_opengl_post_process_set_defaults;
gr_screen.gf_set_post_effect = gr_opengl_set_post_effect;
gr_screen.gf_set_default_post_process = gr_opengl_set_default_post_process;
gr_screen.gf_post_process_begin = gr_opengl_post_process_begin;
gr_screen.gf_post_process_end = gr_opengl_post_process_end;
gr_screen.gf_post_process_save_zbuffer = gr_opengl_post_process_save_zbuffer;
gr_screen.gf_post_process_init = gr_opengl_post_process_init;
gr_screen.gf_post_process_before = gr_opengl_post_process_before;
gr_screen.gf_post_process_after = gr_opengl_post_process_after;
gr_screen.gf_save_zbuffer = gr_opengl_save_zbuffer;
gr_screen.gf_start_clip_plane = gr_opengl_start_clip_plane;
gr_screen.gf_end_clip_plane = gr_opengl_end_clip_plane;
@@ -1862,10 +1864,8 @@ bool gr_opengl_init()
ver = (char *)glGetString(GL_VERSION);
sscanf(ver, "%d.%d", &major, &minor);
GL_version = (major * 10) + minor;
if (GL_version < MIN_REQUIRED_GL_VERSION) {
Error(LOCATION, "Current GL Version of %d.%d is less than the required version of %d.%d.\nSwitch video modes or update your drivers.", major, minor, (MIN_REQUIRED_GL_VERSION / 10), (MIN_REQUIRED_GL_VERSION % 10));
if ( (major < REQUIRED_GL_MAJOR_VERSION) || ((major <= REQUIRED_GL_MAJOR_VERSION) && (minor < REQUIRED_GL_MINOR_VERSION)) ) {
Error(LOCATION, "Current GL Version of %i.%i is less than the required version of %i.%i.\nSwitch video modes or update your drivers.", major, minor, REQUIRED_GL_MAJOR_VERSION, REQUIRED_GL_MINOR_VERSION);
}
GL_initted = true;
@@ -1873,9 +1873,9 @@ bool gr_opengl_init()
// this MUST be done before any other gr_opengl_* or opengl_* funcion calls!!
opengl_setup_function_pointers();
mprintf(( " OpenGL Vendor : %s\n", glGetString(GL_VENDOR) ));
mprintf(( " OpenGL Renderer : %s\n", glGetString(GL_RENDERER) ));
mprintf(( " OpenGL Version : %s\n", ver ));
mprintf(( " OpenGL Vendor : %s\n", glGetString(GL_VENDOR) ));
mprintf(( " OpenGL Renderer : %s\n", glGetString(GL_RENDERER) ));
mprintf(( " OpenGL Version : %s\n", ver ));
mprintf(( "\n" ));
if (Cmdline_fullscreen_window || Cmdline_window) {
@@ -1893,6 +1893,18 @@ bool gr_opengl_init()
// init state system (must come AFTER light is set up)
GL_state.init();
// ready the texture system
opengl_tcache_init();
extern void opengl_tnl_init();
opengl_tnl_init();
// setup default shaders, and shader related items
opengl::shader_manager::create();
// must be called after extensions are setup
opengl_set_vsync( !Cmdline_no_vsync );
GLint max_texture_units = GL_supported_texture_units;
if (Use_GLSL) {
@@ -1905,22 +1917,9 @@ bool gr_opengl_init()
GL_state.Texture.SetActiveUnit(0);
GL_state.Texture.SetTarget(GL_TEXTURE_2D);
GL_state.Texture.Enable();
// ready the texture system
opengl_tcache_init();
extern void opengl_tnl_init();
opengl_tnl_init();
// setup default shaders, and shader related items
opengl_shader_init();
// post processing effects, after shaders are initialized
opengl_post_process_init();
// must be called after extensions are setup
opengl_set_vsync( !Cmdline_no_vsync );
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapR(GL_CLAMP_TO_EDGE);
opengl_setup_viewport();
@@ -1961,22 +1960,13 @@ bool gr_opengl_init()
mprintf(( " Max elements vertices: %i\n", GL_max_elements_vertices ));
mprintf(( " Max elements indices: %i\n", GL_max_elements_indices ));
mprintf(( " Max texture size: %ix%i\n", GL_max_texture_width, GL_max_texture_height ));
if ( Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
mprintf(( " Max render buffer size: %ix%i\n", GL_max_renderbuffer_size, GL_max_renderbuffer_size ));
}
mprintf(( " Can use compressed textures: %s\n", Use_compressed_textures ? NOX("YES") : NOX("NO") ));
mprintf(( " Texture compression available: %s\n", Texture_compression_available ? NOX("YES") : NOX("NO") ));
mprintf(( " Post-processing enabled: %s\n", (Cmdline_postprocess) ? "YES" : "NO"));
mprintf(( " Using %s texture filter.\n", (GL_mipmap_filter) ? NOX("trilinear") : NOX("bilinear") ));
if (Use_GLSL) {
if (Use_GLSL > 1) {
mprintf(( " Using GLSL for model rendering.\n" ));
}
mprintf(( " OpenGL Shader Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION_ARB) ));
mprintf(( " Using GLSL for model rendering.\n" ));
mprintf(( " Shader Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION_ARB) ));
}
// This stops fred crashing if no textures are set
-2
View File
@@ -648,8 +648,6 @@ int opengl_check_for_errors(char *err_at = NULL);
#define GL_CHECK_FOR_ERRORS(s)
#endif
extern int GL_version;
extern int Use_VBOs;
extern int Use_PBOs;
extern int Use_GLSL;
+1 -156
View File
@@ -1103,164 +1103,9 @@ void gr_opengl_tmapper(int nverts, vertex **verts, uint flags)
} else {
opengl_tmapper_internal(nverts, verts, flags);
}
}
void opengl_render_internal(int nverts, vertex *verts, uint flags)
{
int alpha, tmap_type, r, g, b;
float u_scale = 1.0f, v_scale = 1.0f;
GLenum gl_mode = GL_TRIANGLE_FAN;
bool texture_matrix_set = false;
GL_CHECK_FOR_ERRORS("start of render()");
opengl_setup_render_states(r, g, b, alpha, tmap_type, flags);
if (flags & TMAP_FLAG_TRILIST) {
gl_mode = GL_TRIANGLES;
} else if (flags & TMAP_FLAG_TRISTRIP) {
gl_mode = GL_TRIANGLE_STRIP;
} else if (flags & TMAP_FLAG_QUADLIST) {
gl_mode = GL_QUADS;
} else if (flags & TMAP_FLAG_QUADSTRIP) {
gl_mode = GL_QUAD_STRIP;
}
if (flags & TMAP_FLAG_TEXTURED) {
if ( !gr_opengl_tcache_set(gr_screen.current_bitmap, tmap_type, &u_scale, &v_scale) ) {
return;
}
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeof(vertex), &verts[0].u);
// adjust texture coords if needed
if ( (u_scale != 1.0f) || (v_scale != 1.0f) ) {
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glScalef(u_scale, v_scale, 1.0f);
// switch back to the default modelview mode
glMatrixMode(GL_MODELVIEW);
texture_matrix_set = true;
}
}
if ( (flags & TMAP_FLAG_RGB) && (flags & TMAP_FLAG_GOURAUD) ) {
glEnableClientState(GL_COLOR_ARRAY);
if (flags & TMAP_FLAG_ALPHA) {
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(vertex), &verts[0].r);
} else {
glColor4ub( (ubyte)r, (ubyte)g, (ubyte)b, (ubyte)alpha );
glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(vertex), &verts[0].r);
}
}
// use what opengl_setup_render_states() gives us since this works much better for nebula and transparency
else {
glColor4ub( (ubyte)r, (ubyte)g, (ubyte)b, (ubyte)alpha );
}
float offset_z = -0.99f;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef((float)gr_screen.offset_x, (float)gr_screen.offset_y, offset_z);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, sizeof(vertex), &verts[0].sx);
gr_opengl_set_2d_matrix();
glDrawArrays(gl_mode, 0, nverts);
gr_opengl_end_2d_matrix();
GL_state.Texture.DisableAll();
if (texture_matrix_set) {
glMatrixMode(GL_TEXTURE);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
}
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
GL_CHECK_FOR_ERRORS("end of render()");
}
void opengl_render_internal3d(int nverts, vertex *verts, uint flags)
{
int alpha, tmap_type, r, g, b;
float u_scale = 1.0f, v_scale = 1.0f;
GLenum gl_mode = GL_TRIANGLE_FAN;
GL_CHECK_FOR_ERRORS("start of render3d()");
opengl_setup_render_states(r, g, b, alpha, tmap_type, flags);
if (flags & TMAP_FLAG_TEXTURED) {
if ( !gr_opengl_tcache_set(gr_screen.current_bitmap, tmap_type, &u_scale, &v_scale) ) {
return;
}
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeof(vertex), &verts[0].u);
}
GLboolean cull_face = GL_state.CullFace(GL_FALSE);
GLboolean lighting = GL_state.Lighting(GL_FALSE);
if (flags & TMAP_FLAG_TRILIST) {
gl_mode = GL_TRIANGLES;
} else if (flags & TMAP_FLAG_TRISTRIP) {
gl_mode = GL_TRIANGLE_STRIP;
} else if (flags & TMAP_FLAG_QUADLIST) {
gl_mode = GL_QUADS;
} else if (flags & TMAP_FLAG_QUADSTRIP) {
gl_mode = GL_QUAD_STRIP;
}
if ( (flags & TMAP_FLAG_RGB) && (flags & TMAP_FLAG_GOURAUD) ) {
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(vertex), &verts[0].r);
}
// use what opengl_setup_render_states() gives us since this works much better for nebula and transparency
else {
glColor4ub( (ubyte)r, (ubyte)g, (ubyte)b, (ubyte)alpha );
}
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(vertex), &verts[0].x);
glDrawArrays(gl_mode, 0, nverts);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
GL_state.CullFace(cull_face);
GL_state.Lighting(lighting);
GL_CHECK_FOR_ERRORS("end of render3d()");
}
void gr_opengl_render(int nverts, vertex *verts, uint flags)
{
if ( !Cmdline_nohtl && (flags & TMAP_HTL_3D_UNLIT) ) {
opengl_render_internal3d(nverts, verts, flags);
} else {
opengl_render_internal(nverts, verts, flags);
}
}
#define FIND_SCALED_NUM(x, x0, x1, y0, y1) ( ((((x) - (x0)) * ((y1) - (y0))) / ((x1) - (x0))) + (y0) )
void gr_opengl_scaler(vertex *va, vertex *vb, bool bw_bitmap = false)
+11 -1
View File
@@ -11,6 +11,17 @@
#ifndef GR_OPENGLDRAW_H
#define GR_OPENGLDRAW_H
typedef struct glvertexc {
float x, y, z;
float u, v;
ubyte r, g, b, a;
} glvertexc;
extern glvertexc *GLVertex_c;
void gr_opengl_aabitmap_ex(int x, int y, int w, int h, int sx, int sy, bool resize, bool mirror);
void gr_opengl_aabitmap(int x, int y, bool resize, bool mirror);
void gr_opengl_string(int sx, int sy, char *s, bool resize = true);
@@ -29,7 +40,6 @@ void gr_opengl_flash_alpha(int r, int g, int b, int a);
void gr_opengl_fade_in(int instantaneous);
void gr_opengl_fade_out(int instantaneous);
void gr_opengl_tmapper(int nverts, vertex **verts, uint flags);
void gr_opengl_render(int nverts, vertex *verts, uint flags);
void gr_opengl_bitmap_ex(int x, int y, int w, int h, int sx, int sy, bool resize);
void opengl_render_timer_bar(int colour, float x, float y, float w, float h);
+17 -34
View File
@@ -98,6 +98,9 @@ ogl_extension GL_Extensions[NUM_OGL_EXTENSIONS] =
"glBindBufferARB", "glDeleteBuffersARB", "glGenBuffersARB", "glBufferDataARB",
"glBufferSubDataARB", "glMapBufferARB", "glUnmapBufferARB" } },
// Mac-only extension that allows use of system copy of texture to avoid an additional API copy
// { false, 0, 1, { "GL_APPLE_client_storage" }, 0, { NULL } },
// make me some mipmaps!
{ false, false, 1, { "GL_SGIS_generate_mipmap" }, 0, { NULL } },
@@ -144,7 +147,7 @@ ogl_extension GL_Extensions[NUM_OGL_EXTENSIONS] =
{ false, false, 1, { "GL_ARB_fragment_shader" }, 0, { NULL } },
// shader version 3.0 detection extensions (if any of these extensions exist then we should have a SM3.0 compatible card, hopefully)
{ false, false, 3, { "GL_ARB_shader_texture_lod", "GL_NV_vertex_program3", "GL_ATI_shader_texture_lod" }, 0, { NULL } }
{ false, false, 2, { "GL_ARB_shader_texture_lod", "GL_NV_vertex_program" }, 0, { NULL } }
};
// ogl_funcion is:
@@ -367,30 +370,9 @@ void opengl_extensions_init()
// }
if ( !Cmdline_noglsl && Is_Extension_Enabled(OGL_ARB_SHADER_OBJECTS) && Is_Extension_Enabled(OGL_ARB_FRAGMENT_SHADER)
&& Is_Extension_Enabled(OGL_ARB_VERTEX_SHADER) )
&& Is_Extension_Enabled(OGL_ARB_VERTEX_SHADER) /*&& Is_Extension_Enabled(OGL_SM30)*/ )
{
int ver = 0, major = 0, minor = 0;
const char *glsl_ver = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION_ARB);
sscanf(glsl_ver, "%d.%d", &major, &minor);
ver = (major + 100) + minor;
// SM 4.0 compatible or better
if (ver >= 130) {
Use_GLSL = 4;
}
// SM 3.0 compatible
else if ( Is_Extension_Enabled(OGL_SM30) ) {
Use_GLSL = 3;
}
// SM 2.0 compatible
else if (ver >= 120) {
Use_GLSL = 2;
}
// we require GLSL 1.20 or higher
else {
Use_GLSL = 0;
}
Use_GLSL = 1;
}
// setup the best fog function found
@@ -411,7 +393,6 @@ void opengl_extensions_init()
if ( !Use_GLSL ) {
Cmdline_normal = 0;
Cmdline_height = 0;
Cmdline_postprocess = 0;
}
if (Use_GLSL) {
@@ -419,17 +400,19 @@ void opengl_extensions_init()
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &max_texture_units);
// we need enough texture slots for this stuff to work
if (max_texture_units < 6) {
mprintf(( "Not enough texture units for height map support. We need at least 6, we found %d.\n", max_texture_units ));
Cmdline_height = 0;
} else if (max_texture_units < 5) {
mprintf(( "Not enough texture units for height and normal map support. We need at least 5, we found %d.\n", max_texture_units ));
if (max_texture_units < 4) {
Int3();
Use_GLSL = 0;
}
if (max_texture_units < 5) {
Cmdline_normal = 0;
Cmdline_height = 0;
} else if (max_texture_units < 4) {
mprintf(( "Not enough texture units found for GLSL support. We need at least 4, we found %d.\n", max_texture_units ));
Use_GLSL = 0;
}
if (max_texture_units < 6) {
Cmdline_height = 0;
}
}
}
+8 -7
View File
@@ -47,20 +47,21 @@ extern ogl_function GL_EXT_Special[];
// Extensions
#define OGL_EXT_FOG_COORD 0
#define OGL_ARB_MULTITEXTURE 1
#define OGL_ARB_TEXTURE_ENV_ADD 2
#define OGL_ARB_TEXTURE_COMPRESSION 3
#define OGL_ARB_TEXTURE_ENV_ADD 2
#define OGL_ARB_TEXTURE_COMPRESSION 3
#define OGL_EXT_TEXTURE_COMPRESSION_S3TC 4
#define OGL_EXT_TEXTURE_FILTER_ANISOTROPIC 5
//#define OGL_NV_FOG_DISTANCE 6
//#define OGL_EXT_SECONDARY_COLOR 7
#define OGL_ARB_TEXTURE_ENV_COMBINE 6
#define OGL_ARB_TEXTURE_ENV_COMBINE 6
#define OGL_EXT_COMPILED_VERTEX_ARRAY 7
//#define OGL_ARB_TRANSPOSE_MATRIX 10
#define OGL_EXT_DRAW_RANGE_ELEMENTS 8
#define OGL_ARB_TEXTURE_MIRRORED_REPEAT 9
//#define OGL_ARB_TRANSPOSE_MATRIX 10
#define OGL_EXT_DRAW_RANGE_ELEMENTS 8
#define OGL_ARB_TEXTURE_MIRRORED_REPEAT 9
#define OGL_ARB_TEXTURE_NON_POWER_OF_TWO 10
#define OGL_ARB_VERTEX_BUFFER_OBJECT 11
#define OGL_ARB_PIXEL_BUFFER_OBJECT 12
#define OGL_ARB_PIXEL_BUFFER_OBJECT 12
//#define OGL_APPLE_CLIENT_STORAGE 13
#define OGL_SGIS_GENERATE_MIPMAP 13
#define OGL_EXT_FRAMEBUFFER_OBJECT 14
#define OGL_ARB_TEXTURE_RECTANGLE 15
+1 -1
View File
@@ -424,7 +424,7 @@ void gr_opengl_reset_lighting()
if (Cmdline_nohtl)
return;
// memset( opengl_lights, 0, sizeof(opengl_light) * MAX_LIGHTS );
memset( opengl_lights, 0, sizeof(opengl_light) * MAX_LIGHTS );
for (i = 0; i < GL_max_lights; i++) {
GL_state.Light(i, GL_FALSE);
File diff suppressed because it is too large. Load diff
Loaded 100 of 226 files, more files were not shown because too many files have changed in this diff. Show more