Compare commits

...
Author SHA1 Message Date
taylor fe88ab1396 gah, revert that since it was never going to work (not sure what I was drinking that day) 2005-09-18 23:06:17 +00:00
wmcoolmon 4179e85caf Fixed silly i variable placement mistake 2005-09-18 20:41:10 +00:00
Goober5000 b73dcd739b a small fix
--Goober5000
2005-09-18 02:28:18 +00:00
phreak c1a82b09d6 radar bitmap should render the correct color using -orbradar 2005-09-17 19:12:37 +00:00
Goober5000 75e8b56828 better tweak 2005-09-17 01:41:49 +00:00
Goober5000 205fc23b91 tweak 2005-09-17 01:37:02 +00:00
Goober5000 49a65b4ea8 It is a strange fate that we should suffer so much fear and doubt over so small a thing.
Such a little thing...
2005-09-17 01:36:29 +00:00
Goober5000 d8351b5cb9 roll back taylor's loadout fix and do it this way: it saves memory
(but thanks to taylor for drawing attention to the difference between wing slots and wss slots!)
--Goober5000
2005-09-16 17:02:50 +00:00
taylor 50306334bc fix afterburner bug 2005-09-16 08:11:39 +00:00
taylor 7e3012fec1 when a wing is departing to a bay have ships break formation when playing follow-the-leader 2005-09-16 02:59:55 +00:00
taylor 28b190122d when changing a campaign in the campaign room make sure that the mainhall is properly set without having to play a mission first 2005-09-16 02:51:54 +00:00
taylor caa37d9b86 didn't mean to leave that in there 2005-09-16 00:03:51 +00:00
Kazan 8a36ebd73e comment out superfluous debug message 2005-09-15 23:54:58 +00:00
taylor 8890cec34b gah, I still messed that up. Add a NULL check and have register_malloc() actually handle the correct pointer 2005-09-15 05:19:25 +00:00
taylor d2bcd90e9e some vm_* fixage for Windows 2005-09-14 20:38:12 +00:00
taylor 017d7b1cb8 fix ace badges not getting displayed in debriefing 2005-09-14 20:03:40 +00:00
phreak fccb7eaf69 fix to a minor annoyance where the hud weapons gauge wouldnt render properly if there were no secondary weapons. 2005-09-14 02:55:04 +00:00
taylor 6b94ed3308 fix out-of-bounds crash when apply_to_all button is hit 2005-09-13 04:32:11 +00:00
phreak cee0940c17 sort_weapons_by_type() now also subsorts primaries by whether its supposed to only
be used on big ships or not.
2005-09-11 03:50:42 +00:00
taylor 5663c4933a make sure smart shields can't send the strength of a quadrant over the max 2005-09-10 21:10:19 +00:00
Goober5000 1292005d71 "no briefing" flag now works for red-alert missions too
--Goober5000
2005-09-09 05:12:44 +00:00
Goober5000 598598d26c braces for clarity 2005-09-09 05:11:20 +00:00
phreak 4d6d45dd76 sort_weapons_by_type() now subsorts missiles and places fighter-sized weapons ahead of capital weapons and child weapons
its also alot less memory intensive too.
2005-09-08 23:20:54 +00:00
taylor efe030c058 make it actually compile under WIN32
bump version to 0.5 since little else is going to be done to this thing
2005-09-08 05:04:15 +00:00
taylor 8b4b35be0a fix building/linking of command line tools under Linux/OSX
add tools as targets to OSX project file
2005-09-08 00:09:32 +00:00
taylor f51a10c546 fix mouse position setting in non-standard resolutions 2005-09-06 17:26:39 +00:00
taylor c1acb96dc6 use exit(EXIT_FAILURE) rather than abort() so that all atexit() calls will actually get executed 2005-09-06 05:32:12 +00:00
taylor 0952771b72 fix for -pcx32 on big-endian 2005-09-06 02:40:24 +00:00
Kazan f116ff4f58 fixed a bug related to multiplayer table validation and modular tables 2005-09-06 00:32:20 +00:00
taylor f6c794bd85 merge of OSX tree
a lot of byte swaps were still missing, will hopefully be fully network compatible now
2005-09-05 09:38:19 +00:00
taylor cc72eb1d2a merge of OSX tree
fix OGL fullscreen switch for SDL since the old way only worked under Linux and not OSX or Windows
fix OGL version check, it would allow a required major version to be higher if the required minor version was lower than current
2005-09-05 09:36:41 +00:00
taylor 68265ecfc9 a little more cross-platform friendly this way 2005-09-05 09:34:06 +00:00
taylor adb71b42b6 merge of OSX tree
update cmdline stuff for Linux to be less stupid and provide better feedback to the user
2005-09-05 09:33:08 +00:00
taylor bd372c46ec merging of project files for OSX 2005-09-05 09:23:26 +00:00
taylor a62183fd64 merging of new files from OSX tree 2005-09-05 09:21:15 +00:00
wmcoolmon 74f451ab2e Fix the ship vanishing in TOPDOWN mode error 2005-09-05 09:02:08 +00:00
phreak f98a3ba721 don't wrap the U_offset variable since it causes the beam to jump once it gets reset. 2005-09-03 17:48:21 +00:00
taylor 33e28ed71e various weapon_range cap fixes for primary, secondary weapons and hud targetting info 2005-09-01 04:14:04 +00:00
Goober5000 2518d7d7a9 hm, typo
--Goober5000
2005-08-31 08:11:58 +00:00
Goober5000 391ae75979 All wings will now form on their respective leaders, not just certain starting wings.
If this breaks anything, the old code is commented out.  You know who to yell at. ;)
--Goober5000
2005-08-31 08:09:51 +00:00
Goober5000 fa1270f62d Wings will now form on their leader, not necessarily the player. This is to
account for cases where the player is not the leader of his wing.  It has the
side effect of causing wings that arrive later in the mission to form on *their*
leader rather than the player, but this is probably the preferred behavior (at
least judging from Mike Kulas's comment of 5/9/98).  This does create a
difference from retail AI, but it should be only cosmetic, since ships only form
on a wing until they are ordered (via comm or sexp) to do something else.
--Goober5000
2005-08-31 07:54:33 +00:00
Goober5000 7e583ad5d6 removed two unused functions
--Goober5000
2005-08-31 07:17:43 +00:00
Goober5000 46386e5ee0 remove a redundant function
--Goober5000
2005-08-31 07:01:40 +00:00
Goober5000 40442a6cc4 fix a function prototype to match its counterpart in vecmat.h
--Goober5000
2005-08-31 06:25:27 +00:00
Goober5000 b783360750 roll back and recommit the minimally invasive version of phreak's fix...
this removes a bit of redundant code
--Goober5000
2005-08-31 06:12:41 +00:00
phreak 5507bf9c95 real spawn angle fix. The problem stemmed from the matrix argument in vm_vec_random_cone()
being objp->orient and should have been the matrix formed by vm_vector_2_matrix(&m, &objp->orient.vec.fvec, NULL, NULL);
2005-08-31 05:47:02 +00:00
Goober5000 dcb66b4ce6 fixed yet another docking bug, based on taylor's original fix :p
--Goober5000
2005-08-31 00:59:35 +00:00
Goober5000 d13386b02b made spawning missiles work like retail when appropriate
--Goober5000
2005-08-31 00:48:22 +00:00
phreak 9f64817f7d Get rid of alpha blending when using the htl drawing fuctions for lines and spheres.
Right now, gr_opengl_draw_htl_line and gr_opengl_draw_htl_sphere are only used in fred, so
it shouldn't change anything critical
2005-08-29 02:23:04 +00:00
phreak 80a248e214 Record state changes in gr_opengl_set_state() 2005-08-29 02:20:56 +00:00
Kazan 6e816fc2d3 potential fix for mantis bug 237 2005-08-27 00:21:27 +00:00
taylor 0357abd27d fix strange static issue experienced with TBP briefing voices 2005-08-26 17:05:13 +00:00
taylor 98ab82451e send out multi pings during level load to prevent timeouts on slower computers (does not break network compatibility with older, or retail, clients/servers) 2005-08-26 00:56:17 +00:00
taylor ae0211df31 basic cleaning, removing old/useless code, sanity stuff, etc:
- very minor performance boost from not doing stupid things :)
 - minor change to 3d shockwave sizing to better approximate 2d effect movements
 - for shields, Gobal_tris was only holding half as many as the game can/will use, buffer is now set to full size to avoid possible rendering issues
 - removed extra tcache_set on OGL spec map code, not sure how that slipped in
2005-08-25 22:40:04 +00:00
taylor a71dd6e5c5 fix crash from oversized buffer data requests with OGGs 2005-08-25 22:33:48 +00:00
taylor f3d6636fb9 since the geomtry_batcher can send more verts than non-HTL code can handle, avoid drawing in that case to avoid crashing 2005-08-25 22:32:55 +00:00
taylor 499bfccdf3 fix Int3() when we are an OGG and need silence data 2005-08-25 06:32:42 +00:00
taylor 10b4d8ef73 don't let ai keep firing primary and secondary weapons for fighters and bombers if they are dying (fixes player deathroll too) 2005-08-25 00:48:19 +00:00
Goober5000 f7db8ee7d1 tweaky optimization based on the current version of stristr and
the current version of the expanded music.tbl
--Goober5000
2005-08-24 07:20:36 +00:00
Goober5000 20de684fcd faster version of stristr
--Goober5000
2005-08-24 07:14:52 +00:00
matt 0b285d1ce5 Changed rect_size_y - 1 to rect_size_y. Not really that important, but much more correct. I'll stop barraging cvs now :) 2005-08-23 17:06:28 +00:00
matt 85e806405c Fixed another screen save bug relating to having your window positioned offscreen. Still isn't great for when the window is offscreen top left 2005-08-23 16:57:28 +00:00
matt 94d2d6da1d Fixed screen save crash when a popup is called 2005-08-23 15:59:51 +00:00
Goober5000 6d83162a72 ensure init/reset of goals works cleanly
--Goober5000
2005-08-23 09:18:08 +00:00
Goober5000 995961bd93 fix for bug 519
--Goober5000
2005-08-23 09:03:56 +00:00
Goober5000 f9e97e03dc removed a thing I apparently forgot to remove on 2005/07/12
--Goober5000
2005-08-23 07:49:24 +00:00
taylor 87363eba75 fix navpoint hud brackets and text display in non-standard resolutions 2005-08-23 07:37:14 +00:00
Goober5000 9f2bf811be some tweaks to parselo, plus ensure that Unicode files don't crash
--Goober5000
2005-08-22 22:24:22 +00:00
Goober5000 49735a9631 one more change
--Goober5000
2005-08-22 04:59:13 +00:00
Goober5000 7d7d365d9c final changes to projects and workspace; everything should work now
(in MSVC 6 anyway)
--Goober5000
2005-08-22 04:58:38 +00:00
Goober5000 eff4e44151 these ogg libs are needed also
--Goober5000
2005-08-22 04:55:38 +00:00
Goober5000 ce5aa8edfb add dx8 libs and headers missing in the dx9 sdk
--Goober5000
2005-08-22 04:53:41 +00:00
Goober5000 e28c203461 add ogg libs and headers
--Goober5000
2005-08-22 03:11:32 +00:00
taylor 87d2843cfc fix stats display in debriefing with non-standard resolutions 2005-08-21 21:05:53 +00:00
Goober5000 09e9dbec4d clarified the comment on my original move of the wing departure information assignment
--Goober5000
2005-08-21 06:19:31 +00:00
taylor 35309cc15a more unix->SCP_UNIX define fixing 2005-08-20 20:38:08 +00:00
taylor f851a3190b some bmpman and render_target function name changes so that they make sense
always use bm_set_render_target() rather than the gr_ version so that the graphics state is set properly
save the original gamma ramp on OGL init so that it can be restored on exit
2005-08-20 20:34:51 +00:00
taylor a646e617ff Make sure to always use world pos for shockwaves in HTL mode, avoids the distance check Error()
(if someone can find a better explanation of why this one thing was different please make a better fix)
2005-08-20 20:32:28 +00:00
taylor 9872bd0bc3 Fix an old unix define, should be SCP_UNIX 2005-08-20 20:29:47 +00:00
Goober5000 e01b990494 made AwacsMultiplier more user-friendly
--Goober5000
2005-08-20 18:23:02 +00:00
matt 1000c46fe9 Fix for D3D white squares issue 2005-08-20 16:00:03 +00:00
taylor 73c9b0e749 Address a couple of pilot code issues
- make the same MAX_PILOTS in the barracks that the playerselect screen has since it's a problem here too
 - add a -1 check for ship/weapon name lookups to avoid bounds issues.  NOTE: this can empty the techroom of entries if ithits this check, but it won't crash :)
2005-08-18 01:15:41 +00:00
Kazan 421fc46b42 # FEATURE BREAK # This breaks a feature in pilot files temporarily to correct a [reproducable] crash - it is merely commenting out the trouble lines - bug report in mantis and assigned to taylor 2005-08-18 00:19:53 +00:00
Kazan 66fd939231 [hopefully] Fix the bug i introduced in the show memory usage code, and the convergence bug during autopilot [also saves cpu cycles - MANY of them] 2005-08-16 20:06:24 +00:00
Kazan 725bfc17df i introduced a bug in _vm_realloc.. fixed it 2005-08-14 23:05:27 +00:00
Kazan 2cde2c8e46 I'm stupid, sorry - fixed release-build-crash 2005-08-14 21:01:59 +00:00
Kazan 9e9b151960 diabled NEW_MALLOC on windows - it was causing crashing - must have been corrupting it's own heap 2005-08-14 17:20:56 +00:00
taylor 5c563c5cb8 don't do any ambient sound or music stuff in game_pause()/unpause() on options screens when in mission so we can
avoid having mainhall ambient sounds and music start playing and then not stop until you exit the mission
2005-08-11 12:22:26 +00:00
taylor b8818d6cfc handle rare cases where anims would get freaky if one happened to still be playing or otherwise queued 2005-08-11 12:18:53 +00:00
taylor a081773563 little safety check, a couple of strange cases allow this to happen so we should look for it 2005-08-11 12:16:23 +00:00
taylor cb3401e03a well that was rather stupid of me, this would crash if old + new pilots went over MAX_PILOTS 2005-08-09 10:06:47 +00:00
taylor 222b984cc3 be sure to remove ships from a wing when that ship gets vanished 2005-08-08 03:13:53 +00:00
taylor 0fda3d1fbd hopefully fix the problem that was causing geometry issues in just OGL when using VBOs 2005-08-08 01:19:50 +00:00
taylor 4e3fb69600 some minor cleanup
don't load the default 2d shockwave graphics if we have a default 3d shockwave, they won't get used and only take up memory
2005-08-07 09:25:55 +00:00
taylor 0ee8aac766 forgot to commit this before, did this gui code actually compile for anyone? 2005-08-07 09:24:22 +00:00
taylor ca91178cbe fix 3-D shockwave frame detection so that it will use the proper number of frames for the animation (not less, not more) 2005-08-05 15:33:45 +00:00
Goober5000 c619247b02 made "stealth" tag more user-friendly, and fixed a bit of punctuation
--Goober5000
2005-08-03 22:02:38 +00:00
taylor 3708fb1de7 allow for both gamedir and userdir cmdline config files 2005-08-01 10:00:39 +00:00
taylor 4602e63dc1 never could get Ai_class_names to realloc properly but this does the job just as well 2005-08-01 09:57:52 +00:00
wmcoolmon d9cf3916f4 MR_NO_FOGGING for shockwaves 2005-07-31 20:31:41 +00:00
taylor 2c6bc53193 we only care about fmt and data tags so once we have them bail out, fixes some really bad seek errors in crappy wav files 2005-07-31 01:35:43 +00:00
taylor 61ccec1abd fix a NULL pointer reference if there are no secondary banks on a ship 2005-07-31 01:34:03 +00:00
taylor c8bc719c4c few data type fixes, was only a problem for big-endian systems as little-endian doesn't really care about this 2005-07-31 01:32:21 +00:00
taylor 3817a704ff print file and line info for Int3() calls to the logfile so that they are easier to debug with basic error reports 2005-07-31 01:30:48 +00:00
taylor 1a62ef0b68 Temporarily add an empty AIM_GET_BEHIND case to ai_execute_behavior() to avoid hitting Int3() in TBP 2005-07-31 01:29:21 +00:00
wmcoolmon d37906f041 Removed turret thing, added some more armor type calculations 2005-07-30 22:34:42 +00:00
taylor d77c090eaf safety check for TYPE_D beam weapons, the +Shots: count needs to be at least 1 to avoid various errors 2005-07-29 10:18:26 +00:00
Goober5000 8a5dc41e2e verified that submode_start_time is updated whenever submode is changed
--Goober5000
2005-07-27 18:27:49 +00:00
Goober5000 2dd43251ec more tweaks to the dock code
--Goober5000
2005-07-27 17:22:22 +00:00
taylor 9719b83766 Add ability to use specific refresh rate, needs a soon to be updated Launcher to have set via GUI
but this can go in already.  Defaults to, and falls back on, previous behavior and adds some
  error checking that wasn't there previously.
2005-07-26 08:46:48 +00:00
Goober5000 9fb769900b more bugs and tweaks
--Goober5000
2005-07-25 08:22:00 +00:00
Goober5000 9b12500fe1 forgot this
--Goober5000
2005-07-25 05:55:40 +00:00
Goober5000 2d0bde22e4 cleaned up some command line and mission flag stuff
--Goober5000
2005-07-25 05:24:17 +00:00
Goober5000 f0b3d37762 whoops
--Goober5000
2005-07-25 05:23:33 +00:00
Goober5000 2f1745b9c8 various code cleanups, tweaks, and fixes; most notably the MISSION_FLAG_USE_NEW_AI
should now be added to all places where it is needed (except the turret code, which I still
have to to review)
--Goober5000
2005-07-25 03:13:26 +00:00
Goober5000 db06ce05c1 cleaned up some rotating submodel code
--Goober5000
2005-07-24 20:12:55 +00:00
Goober5000 9e830fd82d fixed a minor docking bug
--Goober5000
2005-07-24 19:59:24 +00:00
taylor e4dfa534f6 proper multi support for fighter beams, already has code to break protocol commented out if we need it,
decided to skip and beam type checks and let beam_fire() reassign it (should work ok)
2005-07-24 18:35:44 +00:00
taylor 9ad5b3686f hehehe, fix the check to allow fighter beams to count for kills 2005-07-24 18:33:47 +00:00
taylor 2bb5300132 various incarnations of freaky and stupid, need to do this everywhere eventually 2005-07-24 18:32:58 +00:00
taylor ed4f880369 address possible div-by-0 problem 2005-07-24 18:31:59 +00:00
taylor 01f6ac2148 little 64-bit strangeness (longs are 64-bit here rather than 32) 2005-07-24 18:31:17 +00:00
wmcoolmon 253e12878c Multiple shockwaves support. 2005-07-24 06:01:37 +00:00
wmcoolmon 7b18d839ca Synced 3D shockwaves' glowmaps with the model, tossed in some medals.tbl
support for the demo/FS1
2005-07-24 00:32:45 +00:00
wmcoolmon b1f5390f90 Fixed formatting FTW 2005-07-23 22:52:44 +00:00
wmcoolmon c85ed21a50 Fixx0red description for show-subtitle 2005-07-23 22:48:28 +00:00
Goober5000 a8daa191bf bah - fixed subsystem comparison
--Goober5000
2005-07-23 21:47:46 +00:00
Goober5000 95f0ce016e fixed ai issue where some ships would never call for rearm
--Goober5000
2005-07-23 21:06:24 +00:00
Goober5000 6328625e63 fixed a rare but ugly (though amusing) bug
--Goober5000
2005-07-23 18:38:47 +00:00
wmcoolmon 2f84efb076 Fixed bug where camera reset when rotation complete 2005-07-23 18:25:42 +00:00
Goober5000 1c19a2bfa5 remove Bobboau's extra warp thing
--Goober5000
2005-07-23 17:27:50 +00:00
Goober5000 9a494bb545 remove an extraneous extern
--Goober5000
2005-07-23 16:25:32 +00:00
Goober5000 f7cc6399c4 fix the support ship bug; taylor should be happy now ;)
--Goober5000
2005-07-23 11:42:54 +00:00
wmcoolmon f996cbb2c0 Another try at fixing gun turrets sticking straight up 2005-07-23 08:17:04 +00:00
Goober5000 d4e507ad41 CVS header tweaks
--Goober5000
2005-07-22 10:18:41 +00:00
Goober5000 25d1addbed unhide null vector bug
--Goober5000
2005-07-22 09:59:30 +00:00
wmcoolmon 295a57cc65 Dynamic AI Class number commit. KNOWN BUG: When AI_CLASS_INCREMENT is hit and vm_realloc is called, memory corruption seems to
result. Not at all sure what causes this; if this can't be resolved soon, we can always treat _INCREMENT like _MAX
2005-07-22 09:19:40 +00:00
Goober5000 c54410f177 fixed another bug when changing ship classes
--Goober5000
2005-07-22 04:31:12 +00:00
taylor 1ffb472245 better error checking/handling for when you fire primary/beam weapons without a target selected 2005-07-22 03:54:46 +00:00
taylor db538a19d7 fix crash on commit in the multi ship selection screen
mask_data in the UI code is always cast to ubyte so why it was a ushort type I'll never know
fix unsized text in input boxes (fixed the real problem earlier but forgot to remove this old fix)
2005-07-22 03:53:32 +00:00
taylor ba26e4690f forgot to remove PreProcDefines.h from here too 2005-07-22 03:51:13 +00:00
wmcoolmon 478543cd73 Changed $Hull Repair Rate and $Subsystem Repair Rate to be percentages,
as well as making them accept all values between -1 and 1
2005-07-21 07:53:14 +00:00
taylor e21deb998a fix problem loading compressed DDS created by DX9 utils 2005-07-20 14:55:12 +00:00
taylor 7cc52df168 move the "none.wav" init to event_music_init() so it only runs through once (fixes no mission music when modular tbls are used) 2005-07-20 02:37:32 +00:00
taylor 32304b128a better UV offsets when using non-standard resolutions (for text mostly), copied from D3D code 2005-07-20 02:35:51 +00:00
taylor fe0b2855ee fix resize fixes 2005-07-19 04:52:56 +00:00
taylor 5398dc8206 better "is_640x480" detection, 800x600 res was using GR_1024 where it should have used GR_640 2005-07-18 14:09:03 +00:00
taylor f0b509911a errant unsize was still messing up h-sliders in non-standard resolutions 2005-07-18 12:42:10 +00:00
taylor a13064936a more non-standard res fixing
- I think everything should default to resize now (much easier than having to figure that crap out)
 - new mouse_get_pos_unscaled() function to return 1024x768/640x480 relative values so we don't have to do it later
 - lots of little cleanups which fix several strange offset/size problems
 - fix gr_resize/unsize_screen_pos() so that it won't wrap on int (took too long to track this down)
2005-07-18 03:45:10 +00:00
taylor a14b57d6f5 cleanup hudtargetbox rendering from that total hack job that had been done on it (fixes wireframe view as well)
more non-standard res fixing
 - I think everything should default to resize now (much easier than having to figure that crap out)
 - new mouse_get_pos_unscaled() function to return 1024x768/640x480 relative values so we don't have to do it later
 - lots of little cleanups which fix several strange offset/size problems
 - fix gr_resize/unsize_screen_pos() so that it won't wrap on int (took too long to track this down)
2005-07-18 03:44:01 +00:00
taylor 23d5e01508 PreProcDefines.h has to be removed from here as well so that "make dist" will work 2005-07-18 03:37:35 +00:00
wmcoolmon b48172ce1b Unlike my previous commit, this one does not cause a segmentation
fault. :)
2005-07-16 07:03:49 +00:00
wmcoolmon 64721e4407 Commented out lines 554 and 555 so the code would compile 2005-07-16 06:33:16 +00:00
Goober5000 6a2a61287d cleanup and clarification of phreak's fix of a bug propagated by me and penguin
--Goober5000
2005-07-16 04:41:04 +00:00
wmcoolmon 08db59549f I can't compile the source to test this, but this should switch the
hi-res check to "2_ChoosePilot-m" rather than sparky_hi_fs2.
2005-07-15 23:19:10 +00:00
Goober5000 6a02b099da fixed a typo of Kazan's dating all the way back to October 15, 2003 (!!) that
created a nasty stealth bug
--Goober5000
2005-07-15 03:48:40 +00:00
Goober5000 e49cd4edb8 remove PreProcDefines.h from project file; tweak #define's
--Goober5000
2005-07-14 23:46:57 +00:00
mrduckman 919bd0d434 Restored messages to on-focus channel. If it doesn't work, we'll work around with a pseudo-cmd. 2005-07-14 13:25:03 +00:00
phreak d9c643bb41 If the web cursor bitmap isn't found, tell the user to move the executable to the main FS2 directory. 2005-07-13 15:15:54 +00:00
Goober5000 1004ffcb54 remove PreProcDefine #includes in FS2
--Goober5000
2005-07-13 03:35:36 +00:00
Goober5000 d62d659bf4 remove PreProcDefine #includes in FS2
--Goober5000
2005-07-13 03:26:00 +00:00
Goober5000 81833122b8 remove PreProcDefine #includes in FS2
--Goober5000
2005-07-13 03:15:53 +00:00
Goober5000 a3ee32e28d remove PreProcDefine #includes in FS2
--Goober5000
2005-07-13 02:50:53 +00:00
Goober5000 851732e3e1 remove preprocdefines, yay!
--Goober5000
2005-07-13 02:39:17 +00:00
Goober5000 485e7fcf7e this seems like it should be handled by the code already...
let's remove it and see what happens :p
--Goober5000
2005-07-13 02:32:22 +00:00
Goober5000 c14a21e332 removed autopilot #define
--Goober5000
2005-07-13 02:30:54 +00:00
Goober5000 55e04969c9 move inferno vs. network check here for the time being
--Goober5000
2005-07-13 02:08:26 +00:00
Goober5000 b8db2eb59f fixed a bunch of "issues" caused by me with the species stuff
--Goober5000
2005-07-13 02:01:30 +00:00
Goober5000 47edc76b69 rolled this back because it causes a syntax error in MSVC
--Goober5000
2005-07-13 02:00:44 +00:00
Goober5000 84b8fe77d7 improved species support and removed need for #define
--Goober5000
2005-07-13 00:44:24 +00:00
Goober5000 28fdeb4a28 removed DECALS_ENABLED
--Goober5000
2005-07-12 22:14:40 +00:00
Goober5000 197a041da5 removed NO_LINKED_PRIMARY_PENALTY as it's better suited for difficulty.tbl or something similar
--Goober5000
2005-07-12 21:58:45 +00:00
Goober5000 9b657a529b fixed "warpout sequence aborted" bug
--Goober5000
2005-07-12 21:10:57 +00:00
Goober5000 3008602982 properly fixed beam_apply_whack()
--Goober5000
2005-07-12 21:01:40 +00:00
mrduckman 1259c46d3c Better SDL Headers checking for MacOSX 2005-07-12 18:14:53 +00:00
Goober5000 67a5183ad6 remove all restrictions on which ship types can dock with each other
--Goober5000
2005-07-12 07:03:18 +00:00
mrduckman 61162cfd67 Fixed SDL linking for MacOSX 2005-07-11 14:26:30 +00:00
wmcoolmon 6a2b0110b9 Bumped Fs2_open version to 3.6.7 2005-07-11 10:13:09 +00:00
wmcoolmon 43d061d4f3 Bumped version for Linux makefile to 3.6.7 2005-07-11 10:12:06 +00:00
wmcoolmon 344c50572a Fixed the bug where sending an ignore command to "All fighters" would
apply to all ships
2005-07-11 10:01:06 +00:00
taylor 2175a959db make sure to tack on a / on the dot dir so that recursive directory making will work properly (code thought it was a file rather than a dir) 2005-07-09 04:34:43 +00:00
wmcoolmon ccd760994b Added fixes for custom gauges discussed in the recent thread 2005-07-09 03:02:07 +00:00
taylor 775c86a894 various compiler warning fixes (some of these from dizzy) 2005-07-07 16:36:58 +00:00
taylor 449f1e2fe5 make double sure that we actually need to render thruster glows instead of doing it regardless 2005-07-07 16:35:11 +00:00
taylor dc7a2d08db add value of GL_vertex_data_in to OGL card memory usage 2005-07-07 16:33:39 +00:00
taylor 88d08df966 compiler warning fixes
add -noibx troubleshooting cmdline option to disable use of IBX files
don't try to set thuster object number is only one thruster bank is specified (default method should go into affect)
2005-07-07 16:32:33 +00:00
phreak 5e8c31dadd fixed an afterburner bug where AI ships would have infinite AB fuel if NO_NETWORK
was defined.
2005-07-05 17:04:08 +00:00
taylor ea7c3255fc bah, forgot to ever check debriefings 2005-07-02 20:57:48 +00:00
taylor e2bc4ff920 ton of non-standard resolution fixes 2005-07-02 19:45:02 +00:00
taylor 7500378696 ton of non-standard resolution fixes
make gr_cross_fade() work properly in OGL
2005-07-02 19:40:48 +00:00
taylor 3921b2b079 fix compiler warnings introduced by recent stub changes (defining an empty stub as something is wrong, it should be nothing)
assuming that GetStatus thing wasn't tested since it would never have worked
2005-07-02 19:39:23 +00:00
taylor 15c5c06c7f some supernova fixing 2005-07-02 19:36:04 +00:00
taylor 0270ac2c0b compiler warning fixes 2005-07-02 19:33:18 +00:00
phreak 8842fb64db remove the BEAM_NO_WHACK flag in beam_apply_whack() 2005-07-01 17:19:43 +00:00
Goober5000 578d70b7cd the message queue now waits for simulated speech to finish
--Goober5000
2005-06-30 02:36:16 +00:00
Goober5000 ea73c417ff added functions to check if speech is playing
--Goober5000
2005-06-30 02:35:17 +00:00
Goober5000 cbf7b33393 * NOX'd none.wav
* changed comparisons on none.wav to only look at the first four letters in case
  we don't have an extension or in case some weirdo decides to put none.ogg
* simulated speech pre-empts "beeps" in in-game messages
--Goober5000
2005-06-30 01:48:52 +00:00
Goober5000 84e6492488 tweaked the stubs and added a function
--Goober5000
2005-06-30 01:35:52 +00:00
Goober5000 d24b80f395 if game_busy() is in gamesnd_preload_common_sounds() then it should
also be in gamesnd_load_gameplay_sounds() I would expect
--Goober5000
2005-06-30 00:48:02 +00:00
Goober5000 ef175e9271 Removed "beam no whack" as setting the beam's mass to 0 achieves the same effect.
--Goober5000
2005-06-30 00:36:10 +00:00
taylor 304a1f77a1 set-skybox-model only takes one argument so don't advertise more
add set-skybox-model help text for FRED2
2005-06-29 18:54:59 +00:00
taylor 83012fe0e9 should fix perpetually damaged subsystems on ships for multi clients 2005-06-29 18:54:02 +00:00
taylor 4df1fd48c4 FRED2 does special stuff for jumpnode handling so don't try and delete the obj ourselves when FRED is running 2005-06-29 18:53:07 +00:00
taylor 81480ebcbc extra checks to make sure we don't end up targetting a sensor-invisible ship 2005-06-29 18:52:02 +00:00
taylor 15628c5f8b revert OGL init changes since ATI drivers suck and don't like it 2005-06-29 18:51:05 +00:00
taylor 5427e73ffa little cleanup and error checking 2005-06-29 18:50:13 +00:00
taylor 97982c52d7 various FS2NetD fixes:
- replace timer stuff with something that more accurately works cross-platform and without being affected by load
 - better sanity checking for the server list
 - working Linux compatibility that's not dog slow
 - when calling DataReady() make sure that the data is properly valid
 - fix messed up cvs merge cleanup from the Linux merge which did nasty things
2005-06-29 18:49:37 +00:00
taylor 892fb2ea93 add option to not scale up movies to fit window/screen, default is to scale
(arguably not a bug but I said I would get it in before 3.6.5 and forgot)
2005-06-29 18:46:13 +00:00
taylor 4de6d09b64 we only want to have m_data_offset be 0 for oggs since the seeking callback will account for the true offset
only extern the one int we need for the -nosound speech fix rather than including the entire header
2005-06-24 19:36:49 +00:00
taylor 52d9eccb72 compiler warning fix (dizzy) and make sure that it's safe to continue after that switch statement 2005-06-22 15:25:41 +00:00
taylor abed73b3c6 make sure that _mkdir() will return an error if the path is invalid 2005-06-22 15:18:58 +00:00
taylor 5f9b7064c9 objnum check when targetinfo is used, fixes message brackets having random text as info 2005-06-22 15:17:53 +00:00
taylor 148ba14b56 make sure we only have one extension on mission names 2005-06-22 15:16:40 +00:00
taylor 3abc9fc0f8 probably be a good idea to make the valid objnum check here too 2005-06-21 00:25:34 +00:00
taylor 0de8af2602 in the model _render functions change "light_ignore_id" to "objnum" since that's what it really is
and this makes it so much easier to realize that
properly deal with the fact that objnum can be -1 in  model_really_render()
add NULL check to neb2_get_fog_values() so that it can just send back defaults if objp is NULL
small compiler warning fix for neb code
2005-06-21 00:20:24 +00:00
taylor 7f48891579 unbreak network compatibility with 3.6.5 and earlier builds
fix crashing with turret weapons
2005-06-21 00:15:06 +00:00
taylor 375bad91e6 add some better error checking/handling for when GetServerList messes up 2005-06-21 00:13:47 +00:00
taylor 887aa98e05 add virtual destructor so that GCC4 can shut up 2005-06-21 00:12:11 +00:00
phreak 8862debae8 added cmdline.h include so the compiler would see the no sound command line option
also added CVS header information.
2005-06-20 15:54:58 +00:00
taylor d1b28d6c7e little cleaner ship_get_random_targetable_ship(), for Goober's sake ;) 2005-06-20 04:10:35 +00:00
taylor b4cf700de6 arch and GCC4 compatibility 2005-06-20 04:09:46 +00:00
taylor cb9c2520bd make sure to reset size to 0 on texture free 2005-06-19 09:04:40 +00:00
taylor e2c5b17775 check_values() shouldn't be inline anymore
remove useless neb2_get_fog_intensity() call
s/alocate/allocate/g
2005-06-19 09:03:05 +00:00
taylor 4a1fa4ce38 minor sanity checking for geometry_batcher
make particle batchers allocate dynamically
handle cases where a particle graphic couldn't be loaded
2005-06-19 09:00:09 +00:00
taylor ad6698346f disable speech when -nosound is used 2005-06-19 08:56:23 +00:00
taylor 5db635395d woorps! 2005-06-19 04:59:04 +00:00
taylor 960d41a0d5 remove xmouse.cpp since it's pretty much useless 2005-06-19 02:48:14 +00:00
taylor 457f351954 never "promote" to a lower rank than current 2005-06-19 02:47:00 +00:00
taylor ed3eeb59e4 OGG streaming fixes to get data reading right and avoid skipping
properly handle seeking in OGG streams
compiler warning fix in OpenAL builds
2005-06-19 02:45:56 +00:00
taylor 7bb2d44d29 WMC's build fix, part deux 2005-06-19 02:43:49 +00:00
taylor c774be5da9 jumpnodes can get deleted outside of FRED now so allow for that 2005-06-19 02:43:14 +00:00
taylor b213b72e04 really needed to mention those two things as well given the types of changes those are 2005-06-19 02:42:21 +00:00
taylor 1f3ed28920 fix possible crash from popups, especially in multi 2005-06-19 02:38:33 +00:00
taylor 7df06d9b99 model_free_all() will unload textures so don't bother doing it twice 2005-06-19 02:37:43 +00:00
taylor 2b4dd24535 general cleanup, remove some old code
speed up gr_opengl_flip() just a tad
inverted gamma slider fix that Sticks made to D3D
possible fix for ATI green screens
move opengl_check_for_errors() out of gropentnl so we can use it everywhere
fix logged OGL info from debug builds to be a little more readable
if an extension is found but required function is not then fail
try to optimize glDrawRangeElements so we are not rendering more than the card is optimized for
some 2d matrix usage checks
2005-06-19 02:37:02 +00:00
taylor 2807196e1e allow screenshots and backsaves in windowed mode
account for D3D_textures_in size so that it doesn't hit negative values
2005-06-19 02:31:51 +00:00
taylor 1665521590 MIN Num_iface_sounds fix 2005-06-19 02:29:54 +00:00
taylor 0051f2b19f add a _fast version of bm_unload() to be used in modelinterp and future graphics API code
clean up some modelinterp code to not use memcpy() everywhere so it's more platform compatible and matches old code (Jens Granseuer)
NaN check to catch shards-of-death and prevent hitting an Assert() (Jens Granseuer)
fix jumpnode code to catch model errors and close a memory leak
make the call to bm_unload_all() after model_free_all() since we will get bmpman screwups otherwise
don't show hardware sound RAM when using OpenAL build, it will always be 0
print top-right memory figures in debug builds slighly further over when 1024+ res
2005-06-19 02:28:56 +00:00
Goober5000 8f0d5d7024 fixed a CVS log spelling error, plus fixed a tricky sexp allocation bug
--Goober5000
2005-06-16 05:17:32 +00:00
mrduckman e3883f2426 Added LIST command and added comment about PRIVMSG for Channels 2005-06-09 14:57:38 +00:00
wmcoolmon f006692c72 Hopefully this fixes something :) 2005-06-07 06:34:30 +00:00
wmcoolmon 98870cab35 This may stop targeting not-targetable ships in EMP 2005-06-07 06:10:51 +00:00
taylor 7ffbec56f3 add wxwidgets macro so that the dev package doesn't have to be installed to compile regular builds 2005-06-04 20:03:37 +00:00
wmcoolmon 28979a738d I *think* this should fix bool lists 2005-06-03 22:36:57 +00:00
taylor 5977a382dd some IBX debugging info to help determine if an IBX is corrupt post-mortem 2005-06-03 18:18:02 +00:00
matt 125f341f10 D3D gamma now no longer works backwards --Sticks 2005-06-03 16:42:30 +00:00
taylor 597668dd88 the problem this tried to fix should be properly fixed now but I keep forgetting to remove this block 2005-06-03 06:51:50 +00:00
taylor 7b1cf8dd59 cleanup of gr_bitmap since it's the same for D3D and OGL, skip if GR_STUB though
fix resize/rendering issue when detail culling is used with optimized opengl_create_texture_sub()
2005-06-03 06:44:17 +00:00
taylor c71c1ab1f9 eek... fix wrong description of changes 2005-06-03 06:41:37 +00:00
taylor 85a0250f11 better audio pause/unpause support when game window loses focus or is minimized 2005-06-03 06:39:27 +00:00
wmcoolmon dc0d63e1c0 Small extern fix 2005-06-03 02:28:54 +00:00
Goober5000 1c229c15d0 ugh... reverting taylor's change for now; I'll have to take another look at this
--Goober5000
2005-06-02 03:20:20 +00:00
wmcoolmon 32dd6aafd5 Protected ships are safe from spawning weapons. :) 2005-06-02 02:41:52 +00:00
wmcoolmon 1500870bfa Removed OF_DESTROYED, replacing it with a deletion cache 2005-06-02 02:09:43 +00:00
wmcoolmon 063342c36b Cast to quiet error 2005-06-02 01:56:32 +00:00
wmcoolmon f034cb48a1 Better missing model handling Pt. 2 2005-06-01 22:54:23 +00:00
wmcoolmon 12fc5a9a32 Better missing model handling 2005-06-01 22:52:56 +00:00
phreak 2db4db928e clarified error messages to say that the files listed on asserts/warnings/errors
are located on the computers that built the exe.
2005-06-01 15:10:26 +00:00
taylor e03d62eeb7 bit of cleanup for audiostr-openal and fix a Windows-only enum error
bunch of OGG related fixes for Linux and Windows (DirectSound and OpenAL), fixes audio related TBP 3.2 crashes
gracefully handle OGG logical bitstream changes, shouldn't even load if there is more than 1
2005-06-01 09:41:14 +00:00
taylor 59c1d7a01e little cleanup
optimize opengl_create_texture_sub() by not doing any extra image processing if we don't have to
  if an image is already power-of-2 or we don't need power-of-2 then avoid the extra time and memory usage
2005-06-01 09:37:44 +00:00
taylor e24d75cf94 make sure that newly created entries are properly initialized 2005-06-01 09:35:42 +00:00
taylor 8d1c0cd5b2 newline fix 2005-06-01 09:34:59 +00:00
taylor bb89ede9a2 well that previous docking fix wasn't quite enough, this makes sure that code will actually get exec'd
(Goober: might want to double check that this isn't stupid, does appear abort properly though)
2005-06-01 09:34:36 +00:00
wmcoolmon 8ffc7d031f This should fix redmenace's Assert...I'm not sure why it hasn't been triggering every time a shield is at full strength. 2005-05-30 23:41:36 +00:00
taylor 49318711ab if a briefing does have any stages (no text) then don't carry over text from a previous mission
some generic cleanup to V code that isn't a real problem now but could easily have been a memleak
2005-05-30 05:33:11 +00:00
taylor 5e415f7bd4 make sure we don't show various offscreen indicators and info when hud-disabled-except-messages is used 2005-05-30 05:31:19 +00:00
taylor abb7c260b4 make sure we stop mission in the redalert case too 2005-05-30 05:30:02 +00:00
taylor 622f835598 as soon as the first frame gets released the rest are unreachable in the loop
this was basically became a memory leak as additional frames never got released
2005-05-30 05:29:17 +00:00
taylor 039f3a26af me is a moron, this broke audio streaming 2005-05-30 05:27:30 +00:00
Goober5000 7cfdb91770 Taylor's the real SCP leader; I just play one on the Internet
--Goober5000
2005-05-30 04:38:33 +00:00
taylor f0b9910163 haven't got a clue what I was thinking with that crap 2005-05-28 19:44:17 +00:00
taylor 1f730b9284 debug message fixing
a little bit of code clarity
2005-05-28 19:43:28 +00:00
taylor 90005e98fe add a NULL check to model_get() for better error detection over an outright CTD 2005-05-28 19:41:56 +00:00
taylor 28fbeef528 fix ani corruption detection so that certain streaming anis don't hit it (check was wrong anyway) 2005-05-28 19:40:59 +00:00
Goober5000 ba24fb1aee moved some prototypes that WMC put in the header file back to the implementation file
--Goober5000
2005-05-27 03:37:53 +00:00
Goober5000 a4f4184fe0 hmm, rolled back to 2.3
--Goober5000
2005-05-27 03:36:20 +00:00
Goober5000 17b8798fbe removed some old unnecessary prototypes WMC had added
--Goober5000
2005-05-27 02:37:29 +00:00
tbird 133e98a434 no message 2005-05-26 20:59:59 +00:00
tbird 583024a8fa no message 2005-05-26 20:59:58 +00:00
tbird 9bea5c63e6 Removed due to problems with getting the correct file in place 2005-05-26 20:57:33 +00:00
tbird 437733a98e Updated based on VC6 projects 2005-05-26 20:56:10 +00:00
taylor 366980ab4a forgot to take into account F1_0 on timer_get_fixed_seconds(), remove those stupid CRs too 2005-05-26 09:21:28 +00:00
Goober5000 8fa5d63cb0 some bracket happiness, plus fixed the traning message version of the crazy semicolon bug
(thanks to taylor for fixing the regular message version)
--Goober500
2005-05-26 05:07:19 +00:00
taylor 82d7c503d8 the Loki extensions are Linux only so don't even bother checking under Windows, the
new spec has a cross-platform way of getting the same thing so this isn't a big deal
2005-05-26 04:32:31 +00:00
taylor 7aec8d2a42 don't page out textures in ship_delete() since it causes some slowdown which can make
the explosion effects skip/stutter
2005-05-26 04:30:48 +00:00
taylor edc7a3da00 those crazy semi-colons 2005-05-26 04:29:23 +00:00
taylor e722d89389 if we switch to a pilot who has a campaign that isn't available then abort the read and
deselect all pilots, should prevent data loss or crashes due to the missing safety check
2005-05-26 04:28:45 +00:00
taylor 6f481a3472 timer changes to fix game_busy() on the loading screen and 100% incorrect values on some machines,
don't know if this is going to work that great but it's more like the Linux SDL code now which
  has worked for years without major problems
2005-05-26 04:27:11 +00:00
taylor 7c5d87a506 make sure batch rendering of lasers happens after fog is disabled in nebula missions 2005-05-24 20:55:21 +00:00
taylor ae398ffe8b couple of extra checks to make sure that we can't enter the barracks or the techroom
if the currently selected campaign isn't available, fixes several pilot crash bugs
2005-05-24 20:54:06 +00:00
taylor 644f1120ed make sure that we recursively create directories for Linux/OSX
replace older recursive mkdir method in cfileextractor with new method
2005-05-24 20:52:10 +00:00
wmcoolmon edc4c33208 Commented out -fixbugs and -nocrash in preparation for 3.6.7 2005-05-24 07:05:49 +00:00
taylor 1c55a120b8 extra check to make sure that RLE reading never goes over frame size in new ANI formats 2005-05-24 03:13:36 +00:00
taylor 49f283f030 get command sanity check right, fixes lowercase on extract too 2005-05-24 03:12:27 +00:00
taylor c96527a320 an extra bounds check in sound.cpp
fix audiostr error when filename is !NULL but 0 in len might hit on SDL debug code
2005-05-24 03:11:38 +00:00
taylor d363f55686 quick catch for some corrupted anis, only a partial fix but it will do until something
a bit more heavy duty comes along in the near future
2005-05-23 05:58:31 +00:00
taylor 0610b5e051 Jens, again:
- compiler warning fixes
 - sanity and readability fixes for bmpman
2005-05-23 05:56:26 +00:00
taylor e02157b394 more from Jens...
- make sure that a frame number doesn't get carried over to non-animated weapon glows
 - move the line splitting code in missiontraining.cpp so that we don't have to worry about EOS chars
2005-05-23 05:55:13 +00:00
phreak 1aafce7240 fix out of bounds error 2005-05-23 04:58:43 +00:00
phreak a73e6686d0 compile warning fixage. 2005-05-22 22:47:19 +00:00
taylor 75ecd13e2c a medals crash fix that isn't influenced by the evil Java empire (Jens Granseuer) 2005-05-18 14:03:27 +00:00
taylor b3235d9998 some basic Polish language support from the icculus.org version (Janusz Dziemidowicz) 2005-05-18 14:01:31 +00:00
taylor 71cb920cab a few help text adjustments and fix some compiler warnings 2005-05-18 01:57:54 +00:00
taylor f0f3990738 Initial import of cfileextractor, still needs some work but does what it needs to 2005-05-17 21:00:57 +00:00
taylor a432fd8699 add building for cfileextractor 2005-05-17 20:59:23 +00:00
taylor f66759eac1 more autogen goodness from Jens
- remove old/unneeded checks (ie. we don't use libtool so don't check for it)
 - use --foreign rather than --gnu on automake so we can get rid of things like NEWS, etc.
2005-05-17 20:58:46 +00:00
taylor 4c8003fb8c more missed stuff from the vm_* macro change (thanks Alpha0) 2005-05-17 20:57:05 +00:00
phreak 4a8d5d19d3 reverted a tagged only commit, it wasn't needed 2005-05-16 15:40:43 +00:00
phreak 97778bd8ce custom loading screen fixage. 2005-05-15 21:40:31 +00:00
taylor 560ee745ea don't let the ogg callbacks close the file handle on us, let us do it ourselves to keep things straight 2005-05-15 06:47:57 +00:00
phreak c44cb63459 another tagged only turret fix 2005-05-14 21:48:22 +00:00
phreak f9cad9acb4 stop turrets from targeting non-bombs. also some tagged-only fixes. 2005-05-14 21:35:04 +00:00
phreak c225d664a2 fixed an out-of-bounds array bug 2005-05-14 21:34:17 +00:00
phreak 78d4b21830 medal_stuff needed a copy constructor and an overloaded assignment operator. 2005-05-14 16:16:48 +00:00
taylor 349a0cda5f unbreak joining (when forming, not in-game) (Jens Granseuer) 2005-05-13 23:10:17 +00:00
taylor ff36b6aa7b Ooops! Added the wrong version of the streaming patch from Jens 2005-05-13 23:09:28 +00:00
taylor fdb372e5a3 properly support multiple versions of automake (Jens Granseuer) 2005-05-13 23:08:39 +00:00
phreak 7089596664 possible fix for seeing suns through ships. shouldn't break anything. 2005-05-13 20:55:19 +00:00
taylor 9ff37eb37e more malloc->vm_malloc, free->vm_free, strdup->vm_strdup fixage 2005-05-13 02:56:34 +00:00
phreak dca9ba1202 fixed another minimum range bug that prevented the Colossus and the Beast from
properly engaging one another in the mission: Their Finest Hour (SM3-08)
2005-05-13 02:50:47 +00:00
taylor 359485654f missed a strdup to vm_strdup conversion 2005-05-13 02:47:58 +00:00
phreak 0a858b7b05 forgot a vm_strdup in place of a strdup 2005-05-13 02:41:24 +00:00
taylor e4131e25e4 use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
fixes various problems and is past time to make the switch
2005-05-12 17:49:18 +00:00
taylor b4cc142d08 use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
fixes various problems and is past time to make the switch
fix a few streaming errors in OpenAL code (Jens Granseuer)
temporary change to help deal with missing music in OpenAL Windows builds
don't assert when si->data is NULL unless we really need to check (OpenAL only)
2005-05-12 17:47:57 +00:00
taylor 7dbcf77914 use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
fixes various problems and is past time to make the switch
reallocate sp->triggers with the real vm_realloc() rather than that manual method
2005-05-12 17:45:53 +00:00
taylor 23176b03dd use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
fixes various problems and is past time to make the switch
fix crash with Warning() message getting the wrong string
2005-05-12 17:44:02 +00:00
taylor ff31561484 use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
fixes various problems and is past time to make the switch
try and keep up with how much VBO data is in memory too since that takes away from texture memory
2005-05-12 17:43:20 +00:00
taylor 6f55648495 use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
fixes various problems and is past time to make the switch
set byte_mult to 2 for TCACHE_TYPE_AABITMAP to get the memory size right for Debug builds
2005-05-12 17:42:13 +00:00
taylor 122ddc2134 use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
fixes various problems and is past time to make the switch
use correct GL VRAM texture number in OGL mode rather than the D3D number
2005-05-12 17:40:48 +00:00
taylor a110e19177 use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
fixes various problems and is past time to make the switch
change system->decals allocation to use real vm_realloc() rather than that manual method
2005-05-12 17:39:13 +00:00
taylor c2700b4b9e add an extra gr_flip() after gr_clear() to make sure the change is made active 2005-05-12 17:37:48 +00:00
taylor 6a9f82eac5 use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
fixes various problems and is past time to make the switch
for the game_busy() text during page in add a "BmpMan" so we know better what's going on
2005-05-12 17:36:59 +00:00
Goober5000 ee91e844ef added dialogs to the project file
--Goober5000
2005-05-12 14:02:57 +00:00
Goober5000 5fbc8f7e23 added a bunch of dialogs to wxFRED... thanks, taylor, for the GUI development :)
--Goober5000
2005-05-12 14:00:15 +00:00
Goober5000 62cfe8b61b whoops
--Goober5000
2005-05-12 03:51:17 +00:00
Goober5000 ef6b1a12f4 repeating messages with variables should work properly now
--Goober5000
2005-05-12 03:50:10 +00:00
Goober5000 f2d38d2f13 removed variables in messages for now
--Goober5000
2005-05-12 01:34:50 +00:00
phreak 76d763cd8e added mission flag that will not show enemy wing names, just the ship class. 2005-05-11 22:15:49 +00:00
Goober5000 35c25efdc7 fixed a docking bug
--Goober5000
2005-05-11 11:38:03 +00:00
Goober5000 8eea5e3446 grr
--Goober5000
2005-05-11 09:32:03 +00:00
Goober5000 1563378777 fixed a few of karajorma's bugs
--Goober5000
2005-05-11 09:28:32 +00:00
Goober5000 03137abad6 changed an Assert() to an Error()
--Goober5000
2005-05-11 09:27:35 +00:00
Goober5000 48af4d28a9 variables should now work properly in messages that are sent multiple times
--Goober5000
2005-05-11 08:10:20 +00:00
phreak bc45b7c1d8 clean out some old code 2005-05-11 02:16:17 +00:00
phreak 8f8afd10ff fix the problem where the fade in/out doesn't work if looking at a sun. 2005-05-11 02:15:07 +00:00
phreak 428dde26e4 reverted a change that WMC made. It made Goober mad and delayed the release of
3.6.6 by two months.
2005-05-11 00:25:42 +00:00
phreak 2b8b24f78a fixed a minimum weapon range bug that was causing turrets to fire at ships beyond
the actual range of a weapon.
2005-05-10 15:49:04 +00:00
phreak 33b64ccd98 if you're using all_turret_weapons_have_flags() with a WIF2_** flag, use
all_turret_weapons_have_flags_wif2().

Corrected some logic that would dump a valid target for turrets if its objnum is 0, as
opposed to -1.
2005-05-10 02:44:40 +00:00
phreak 7fa4c0f215 when finding valid weapons, set i to MAX_SHIP_PRIMARY_BANKS - 1 since i
is incremented at the top of the loop.  otherwise, we would pass over the first secondary
weapon in the bank.
2005-05-10 01:47:34 +00:00
wmcoolmon ee3624ccdb Code betterness 2005-05-08 20:39:10 +00:00
wmcoolmon 4631e6f31a Dynamically allocated medals 2005-05-08 20:38:32 +00:00
wmcoolmon 3232327c9d Various turret code changes in a vain attempt to make things more readable/work properly 2005-05-08 20:35:26 +00:00
wmcoolmon f3bc4e0425 Turret debugging code; Medals stuff; GUI_system change 2005-05-08 20:33:42 +00:00
wmcoolmon 790810ada9 Dynamically allocated medals 2005-05-08 20:28:57 +00:00
wmcoolmon 994f25cdf0 Change to GUI_system; this will probably break the lab, but is necessary for things to compile properly. 2005-05-08 20:27:51 +00:00
wmcoolmon c70c6005b3 Change to GUI_system (to prevent memory leaks and allow for auto-deconstruction) 2005-05-08 20:26:46 +00:00
wmcoolmon 63d1922367 "backspace" function 2005-05-08 20:23:28 +00:00
wmcoolmon 0c7adec15c armor.tbl revamp 2005-05-08 20:21:48 +00:00
tbird 3230a9eca9 Added project files for VC.NET 7.0 (the 2005 project files do not work in 7.0) 2005-05-04 00:30:56 +00:00
wmcoolmon 313d75276e Added variables to permanent location 2005-05-03 07:55:44 +00:00
wmcoolmon 045e29ae29 Removed variables files 2005-05-03 07:54:49 +00:00
wmcoolmon d0bace2c57 Added Bobb's variable system (with some minor compiler-warning fixes) 2005-05-03 06:33:07 +00:00
wmcoolmon aa61590ad3 Bah, stupid externs. :P 2005-05-02 22:36:54 +00:00
mrduckman a1569ff1c2 Added /NAMES command (Very needed to know who's in a channel :P) 2005-05-02 15:33:17 +00:00
phreak 39ea734595 bumped MAX_SPAWN_WEAPONS to 30 for inferno builds 2005-05-01 23:40:44 +00:00
phreak 471ed14f14 added CVS info to top of file. 2005-05-01 23:23:18 +00:00
phreak 2ce65069fb when creating the window take into account the top border 2005-05-01 23:17:46 +00:00
phreak 1270b04c97 fix the window from shrinking if a cutscene is played in windowed mode 2005-05-01 23:16:12 +00:00
phreak 0b959888c7 don't confine the cursor in d3d 2005-05-01 23:13:19 +00:00
wmcoolmon bd620e76dd -output_sexps command line 2005-05-01 07:13:59 +00:00
wmcoolmon 6f2fc71a7c Added (up-to-date) SEXP description info. 2005-05-01 06:18:58 +00:00
phreak 24774cf9cc buckets in sort_weapons_by_type() allocated on the heap instead of the stack. 2005-04-30 18:20:57 +00:00
phreak 79d41f9a59 ABbitmap should default to -1 2005-04-30 18:18:46 +00:00
phreak 6e69f08e65 bm_page_in_textures() should return if bitmap_num is any negative value, instead of just -1 2005-04-30 18:17:17 +00:00
wmcoolmon 529e3c47bd Removed FS2_DEMO defines that looked like they wouldn't cause the universe to collapse 2005-04-28 05:29:30 +00:00
wmcoolmon e01a6293d5 Cleared up some ambiguity that made MSVC 2003 go on strike 2005-04-28 05:12:26 +00:00
wmcoolmon e63b108e61 stuff_byte to stuff_ubyte 2005-04-28 01:39:14 +00:00
wmcoolmon 744a53ddf0 parse_ship uses stuff_bool_list; stuff_byte to stuff_ubyte 2005-04-28 01:38:32 +00:00
wmcoolmon ff0d52b1a4 More parsing flexibility 2005-04-28 01:36:46 +00:00
wmcoolmon fbc24176cd stuff_byte to stuff_ubyte; does the same thing, but with a better name. 2005-04-28 01:36:09 +00:00
wmcoolmon a7987b89be Switch stuff_string_white to stuff_string (I don't see why _white was used in the first place) 2005-04-28 01:32:57 +00:00
wmcoolmon 448027d119 Added stuff_bool_list; Internationalized stuff_boolean. 2005-04-28 01:12:19 +00:00
Goober5000 ec269425fd -made the XRC file parsed on load instead of embedded
-migrated wxFRED to wxWidgets 2.6.0
--Goober5000
2005-04-25 12:14:21 +00:00
taylor 7543e00581 newline fix 2005-04-25 06:36:25 +00:00
taylor 593ff86eeb use full size of Campaign_missions[] for simroom filtering, fixes the problem of campaign
missions still showing up in the single list even after filtering
2005-04-25 06:36:01 +00:00
taylor 46acd73b0b little cleanup so that debug and release build files don't have to be listed twice
add newer wxFRED2 files
2005-04-25 06:33:56 +00:00
wmcoolmon 7ed4e8985d Use parse_sound instead of code chunks 2005-04-25 00:34:00 +00:00
wmcoolmon 151c188018 Dynamically allocated engine washes; subsystem sounds; armor fixes. Line 4268 of ship.cpp, apparently, works properly; bears further looking into. 2005-04-25 00:31:14 +00:00
wmcoolmon 97cb2f5933 subsystem sounds 2005-04-25 00:28:58 +00:00
wmcoolmon a4d6350db0 MAX_SHIP_TYPES > Num_ship_types 2005-04-25 00:28:17 +00:00
wmcoolmon d0d7f35c76 Commented out unneeded array (Glide) 2005-04-25 00:27:32 +00:00
wmcoolmon 44f837acf8 Dynamically allocated engine washes; subsystem sounds 2005-04-25 00:26:53 +00:00
wmcoolmon 68ded37681 Windows have minimum size according to caption; made lab use another tree level so all ships can be seen 2005-04-25 00:24:34 +00:00
wmcoolmon f959265a74 Added parse_sound; replaced Assert() with an if() (The latter may not be a good idea, but it keeps missions from being un-debuggable) 2005-04-25 00:22:34 +00:00
wmcoolmon 01791870bc Center title screen, removal of unnecessary #ifdefs 2005-04-25 00:21:30 +00:00
wmcoolmon 365c12e99f Bumped console printing buffer size so people can play with the neb2 command 2005-04-25 00:07:22 +00:00
wmcoolmon d2eaea9a85 MAX_SHIP_TYPES -> Num_ship_types 2005-04-25 00:04:30 +00:00
Goober5000 18606cfb46 updated the project file
--Goober5000
2005-04-24 14:45:17 +00:00
Goober5000 658730bb4b wxFRED now uses XRC-based resources
--Goober5000
2005-04-24 14:42:27 +00:00
taylor 732d7f5561 really are too many changes here:
- remove all bitmap section support and fix problems with previous attempt
 ( code/bmpman/bmpman.cpp, code/bmpman/bmpman.h, code/globalincs/pstypes.h,
   code/graphics/2d.cpp, code/graphics/2d.h code/graphics/grd3dbmpman.cpp,
   code/graphics/grd3dinternal.h, code/graphics/grd3drender.cpp, code/graphics/grd3dtexture.cpp,
   code/graphics/grinternal.h, code/graphics/gropengl.cpp, code/graphics/gropengl.h,
   code/graphics/gropengllight.cpp, code/graphics/gropengltexture.cpp, code/graphics/gropengltexture.h,
   code/graphics/tmapper.h, code/network/multi_pinfo.cpp, code/radar/radarorb.cpp
   code/render/3ddraw.cpp )
 - use CLAMP() define in gropengl.h for gropengllight instead of single clamp() function
 - remove some old/outdated code from gropengl.cpp and gropengltexture.cpp
2005-04-24 12:56:43 +00:00
taylor 592899a5f5 little cleanup of laser rendering
- fix animated glows
 - proper alpha modification (still messed up somewhere though, shows in neb missions)
 - remove excess batch_render()
2005-04-24 12:47:36 +00:00
taylor a99518e88d possible dev/0 bug fix (Jens Granseuer) 2005-04-24 12:45:14 +00:00
taylor e3c8004429 make sure we don't build with speech support under Linux unless we specify it as a configure option 2005-04-24 12:44:25 +00:00
Goober5000 343e2537de fix0red the CVS log
--Goober5000
2005-04-24 08:27:17 +00:00
Goober5000 995ce3e17f made swarm/corkscrew/flak conflict more friendly
--Goober5000
2005-04-24 07:31:34 +00:00
wmcoolmon f630e1799e Enabled movies in windowed mode; if this causes problems for people, they can always use -dnoshowvid 2005-04-24 06:52:23 +00:00
Goober5000 ae8c507d37 eh, stupid quotes
--Goober5000
2005-04-24 05:53:15 +00:00
Goober5000 605b490d17 actually, I think this way works better
--Goober5000
2005-04-24 05:15:24 +00:00
Goober5000 ea491e3bed added FS2PATH environment variable and removed custom build stuff
--Goober5000
2005-04-24 04:47:58 +00:00
phreak 159c0affaf centered the window on the desktop if the -window command line is used. 2005-04-24 03:06:29 +00:00
wmcoolmon 2d7f231f47 Added resizing option to gr_shade. We can probably merge gr_shade and gr_rect; they do the same thing. 2005-04-24 03:02:43 +00:00
wmcoolmon 1417a0236a Might as well fix trainer messages too. 2005-04-24 03:01:56 +00:00
wmcoolmon f7e389eec4 Lowlevel (ie vertex buffer-mapping) functions for _rect and _shade 2005-04-24 02:40:40 +00:00
wmcoolmon 4f94da464d Context help fixing goodness 2005-04-24 02:39:36 +00:00
wmcoolmon 2e35d7571c Moved gr_rect and gr_shade to be API-nonspecific as the OGL/D3D functions were virtually identical 2005-04-24 02:38:31 +00:00
Goober5000 3575982079 subsystem fix
--Goober5000
2005-04-24 02:10:53 +00:00
wmcoolmon 6f93eb7ca8 Removed GL_SECTIONS 2005-04-23 01:17:09 +00:00
taylor 4dc7881df8 wurrps 2005-04-22 02:32:18 +00:00
wmcoolmon 131bac2b53 Minor updates to the GUI, and added some code that will (hopefully) resize HUD images in nonstandard resolutions. I couldn't test it; got an out of memory error. 2005-04-22 00:34:55 +00:00
taylor e030989f59 sexp to swap the skybox in mission, not tested in FRED, hopefully I didn't mess this up too much 2005-04-21 15:59:42 +00:00
taylor 51cc8377d2 initial changes to mission loading and status in debug builds
- move bmpman page in init to an earlier stage to avoid unloading sexp loaded images
 - small changes to progress reports in debug builds so that it's easier to tell what's slow
 - initialize the loading screen before mission_parse() so that we'll be about to get a more accurate load time
fix memory leak in gamesnd (yes, I made a mistake ;))
make sure we unload models on game shutdown too
2005-04-21 15:58:08 +00:00
taylor 5a75bba686 make sure we don't try to process chatbox_close() more than once 2005-04-21 15:53:24 +00:00
taylor d0ad20c79d stupid little comment fix, no big deal 2005-04-21 15:52:24 +00:00
taylor 1fe7c55885 fix source/dest memory overwrite that Valgrind was complaining about 2005-04-21 15:51:40 +00:00
taylor f63d3a01f1 we can't resize compressed textures so... don't, fixes rendering problems when not at max texture detail 2005-04-21 15:50:47 +00:00
taylor 981c2e4601 update of bmpman and model bitmap management, well tested but things may get a bit bumpy
- use VM_* macros for bmpman since it didn't seem to register the memory correctly (temporary)
 - a little "stupid" fix for dds bitmap reading
 - fix it so that memory is released properly on bitmap read errors
 - some cleanup to model texture loading
 - allow model textures to get released rather than just unloaded, saves bitmap slots
 - bump MAX_BITMAPS to 4750, should be able to decrease after public testing of new code
2005-04-21 15:49:21 +00:00
wmcoolmon fe81f39299 Nonstandard res fix. 2005-04-20 08:32:01 +00:00
wmcoolmon 3460e06701 Fix silly armor.tbl parse error. 2005-04-20 08:26:49 +00:00
phreak dd41824dc5 NMONO should not interfere with the debug window 2005-04-20 04:34:42 +00:00
phreak 72f1bb21ab get the cheat keys for "force weapon" working again 2005-04-20 04:34:01 +00:00
phreak 95db195410 CVS file header. take 1 2005-04-20 04:29:50 +00:00
phreak dc2e5a8ef9 fix for the slow firing turret problem 2005-04-20 04:27:56 +00:00
wmcoolmon 31f7d6dd34 Lock time compression when autopilot is engaged 2005-04-19 23:03:42 +00:00
taylor 904a63b7e5 try not to buffer output to the speech dev so that the text doesn't just show up some time in the future 2005-04-19 06:29:28 +00:00
taylor a8713687ae we might actually be needing to load a model here ;) 2005-04-19 06:27:54 +00:00
taylor 5f7ce77177 small compiler warning fixes, more 'always true' stuff 2005-04-19 06:26:56 +00:00
taylor 75f276cff4 don't try to allocate 0 bytes of memory when there are no shield tris, weird memory stuff frightens me 2005-04-19 06:25:23 +00:00
taylor a35470e783 8 months I've been meaning to put this in the Linux tree, me == moron 2005-04-19 06:22:20 +00:00
Goober5000 48959c177c model and class changes should be all set now
--Goober5000
2005-04-18 08:35:28 +00:00
Goober5000 a0e945bf21 better subsystem comparison
--Goober5000
2005-04-18 06:59:16 +00:00
Goober5000 a0305a1fc6 removed ship->alt_modelnum as it was essentially duplicates of ship->modelnum; changed the alt modelnum stuff accordingly
fixes for ship_model_change and change_ship_type
--Goober5000
2005-04-18 05:27:26 +00:00
taylor 78f22aea2f some extra checks to make sure we don't act on invalid gamesnds (fix for WCS) 2005-04-18 03:31:27 +00:00
taylor 777a5dbab0 more accurate play position for OpenAL when AL_BYTE_LOKI is used (Jens Granseuer) 2005-04-18 03:30:05 +00:00
Goober5000 0a72f49270 more sexp goodness
--Goober5000
2005-04-18 03:16:57 +00:00
taylor d4799821f8 updated Linux joystick code that's a bit less insane speed wise
remove ability to build without joystick support, no reason to keep it around
fix unusable warning flag with libjpeg building
2005-04-17 05:38:29 +00:00
phreak b87907a3be fixed lasers drawing backwards 2005-04-16 18:43:17 +00:00
wmcoolmon d950a6d8da Fixed the lab; Made the storybook look less grotesque without skins. 2005-04-16 08:13:34 +00:00
wmcoolmon af4ce5c886 Eh, what the hey. Maybe I should've taken the breathalyzer test. :) 2005-04-16 04:19:21 +00:00
wmcoolmon 7fd2b592b4 More optional tag-making for ships.tbl 2005-04-16 04:16:57 +00:00
wmcoolmon 1e4e53bf80 Minor changes; made even more fields in ships.tbl optional. 2005-04-16 03:36:13 +00:00
wmcoolmon 1745959ed7 Removed an unneeded semicolon 2005-04-16 03:05:05 +00:00
wmcoolmon 255570da57 Added type "exponential base"; equation is 'final_damage = (x^damage)' 2005-04-15 23:19:13 +00:00
taylor b24cd07398 fix ambient light 2005-04-15 11:42:27 +00:00
taylor 085db31507 stupid <expletive-delete> terminal, I <expletive-deleted> <expletive-deleted>!!! 2005-04-15 11:41:28 +00:00
taylor 092315362e new GCC = new warning messages, yippeeeecvs commit code/parse/encrypt.h code/parse/encrypt.cpp code/scramble/scramble.cpp 2005-04-15 11:36:55 +00:00
taylor 6a655dc469 add scramble port
support both FS1 (8bit and 7bit) and FS2 style encryption
2005-04-15 11:35:18 +00:00
taylor b217d73a44 proposes that WMC be subject to a breathalyzer test before commit ;) 2005-04-15 11:32:26 +00:00
taylor d78b715166 div-by-zero fix for snd_time_remaining() 2005-04-15 11:28:41 +00:00
taylor d55e7cc900 some cleanup to prevent utilities linking all game libs 2005-04-15 11:27:53 +00:00
wmcoolmon 443c49cbf9 It's amazing how many possible bugs you can catch simply by doing something completely different than coding 2005-04-15 07:19:29 +00:00
wmcoolmon 0cbd23c615 One final oops (hopefully). 2005-04-15 06:59:05 +00:00
wmcoolmon 55f7fdc264 Another oops. 2005-04-15 06:56:02 +00:00
wmcoolmon 7241244f70 Er, oops 2005-04-15 06:40:54 +00:00
wmcoolmon d0ed305d43 Local codebase commit; adds armor system. 2005-04-15 06:23:18 +00:00
Goober5000 b3e0314930 bumped sexp limit
--Goober5000
2005-04-14 20:03:16 +00:00
phreak 41fdb1da08 Updated the message of a required extension that hasn't been found.
It was referencing the old Glide engine.
2005-04-13 23:24:21 +00:00
Goober5000 3b2eee464a fixed the compile errors (thanks Phreak)
--Goober5000
2005-04-13 22:31:53 +00:00
Goober5000 b6980737f0 removed spurious folder
--Goober5000
2005-04-13 22:17:27 +00:00
taylor 039e34ffaa I totally blame that on the keyboard 2005-04-12 19:53:44 +00:00
taylor 99136873c0 more demo support (Jens Granseuer) 2005-04-12 19:22:48 +00:00
taylor 7516eae124 not sure what that file was doing there... 2005-04-12 19:22:00 +00:00
taylor 84a3455035 many, many compiler warning and header fixes (Jens Granseuer)
fix free on possible NULL in modelinterp.cpp (Jens Granseuer)
2005-04-12 05:26:38 +00:00
taylor 9b86e6966b more support for 'make dist' (Jens Granseuer) 2005-04-12 05:24:48 +00:00
phreak 8388a394c1 ambient light is set in mission 2005-04-12 02:10:09 +00:00
phreak 120c01f735 ambient_light_level added to the mission structure 2005-04-12 02:07:00 +00:00
phreak 189e5fe678 gr_set_ambient_light() function for the ambient light sliders in FRED 2005-04-12 02:04:56 +00:00
taylor fc35ceeffc changes to facilitate 'make dist' 2005-04-11 10:16:26 +00:00
taylor 8698cece32 un-revert previous revert since it does apparently affect MinGW (Alpha0) 2005-04-11 10:15:11 +00:00
taylor 30fc4cc19f some limits.h fixes to make GCC happier
revert timer asm change since it doesn't even get used with Linux and couldn't have been the slowdown problem
2005-04-11 05:50:36 +00:00
taylor 17ac979ae7 make sure use an insensitive case check for Messages[] names (Jens Granseuer)
little clarification of if-else block in message_training_que()
2005-04-11 05:48:34 +00:00
taylor e37bdddb71 _endthread() doesn't take an argument so do support one (Jens Granseuer)
debug variable fixes in freespace.cpp (Jens Granseuer)
as a safety catch we should Assert() on future usage of things we don't yet support in *nix _splitpath()
2005-04-11 05:45:38 +00:00
taylor be7f62118c some demo related fixes (Jens Granseuer) 2005-04-11 05:42:02 +00:00
taylor 7079b22535 add version checks for autoconf and automake
fix wacky wxFRED2 check (Jens Granseuer)
2005-04-11 05:40:21 +00:00
wmcoolmon 8b414664c5 Fixed some paths stuff. 2005-04-09 07:50:41 +00:00
wmcoolmon 0b89fec44c *crosses fingers* 2005-04-08 20:03:59 +00:00
wmcoolmon fb90a4caaf Did things in a somewhat less hackish manner; note that 'Update project' will only update the anjuta directory; you will have to update file, and then manually select the fs2_open/ directory to update *everything* 2005-04-06 18:47:02 +00:00
wmcoolmon 3e633a7021 Presumeably, I fixed building in anjuta for anyone who can run
autogen.sh
2005-04-06 18:22:49 +00:00
wmcoolmon 4f7a1a73c7 Fixed anjuta project file so it would run from projects subdirectory. 2005-04-06 18:12:17 +00:00
wmcoolmon 4dd746e46d Added some comments to the new turret helper functions. 2005-04-06 18:10:40 +00:00
taylor a89a6f6186 add audio files for OpenAL, build with USE_OPENAL define to use OpenAL 2005-04-05 12:03:03 +00:00
taylor 6c822c7993 fix memory error from GL extension list that occurs in certain circumstances 2005-04-05 11:50:57 +00:00
taylor 67eb07aae2 update what sound files get used 2005-04-05 11:49:37 +00:00
taylor 5a34ecf947 remove acm-unix.cpp, replaced by acm-openal.cpp since it's properly cross-platform now
better error handling for OpenAL functions
Windows can now build properly with OpenAL
extra check to make sure we don't try and use too many hardware bases sources
fix memory error from OpenAL extension list in certain instances
2005-04-05 11:48:23 +00:00
taylor 4df7becbea handle iostream problems on GCC pre-3.x
fix spacing on wxFRED stuff (yes, I'm that anal)
2005-04-05 11:41:33 +00:00
taylor 586190fb8e s/vector/vec3d/g, better support for different compilers (Jens Granseuer) 2005-04-05 05:53:25 +00:00
Goober5000 2059ed3528 tweaks
--Goober5000
2005-04-03 11:47:01 +00:00
Goober5000 fc42a097eb brought weapon loadout banks into agreement with ship info banks
improved error reporting on apply-to-all
--Goober5000
2005-04-03 08:48:31 +00:00
phreak ba27712ccd put First_secondary_index back in so FRED can compile.
The weapons list is also sorted whenever all loading is done so lasers and beams always
come before missiles.  FRED's loadout code needs this behavior to stick.
2005-04-02 21:34:08 +00:00
Goober5000 02fb161187 fixed a few errors in apply-to-all
--Goober5000
2005-04-01 08:50:25 +00:00
taylor 826be871bc fix hanging on exit with OpenAL
some better error handling on OpenAL init and make it more Windows friendly too
basic 3d sound stuff for OpenAL, not working right yet
2005-04-01 07:33:08 +00:00
taylor 6958a3be52 *that blasted Enter key*, just fixing the log... nothing to see here... 2005-04-01 07:31:10 +00:00
taylor 6576b9bf69 some minor Linux fixage 2005-04-01 07:29:40 +00:00
taylor 77a4348695 code/ship 2005-04-01 07:27:32 +00:00
taylor f1f9396d4f go back to 24-bit depth, 32 didn't help any with ATI bugs 2005-04-01 07:25:54 +00:00
mrduckman a550f19877 Made a change for wxWidget checks, checking for 2.4.2 version. 2005-03-31 21:12:23 +00:00
Goober5000 aea447768f whoops
--Goober5000
2005-03-31 12:45:22 +00:00
Goober5000 68c7b774e6 implemented the apply-to-all wing loadout button
--Goober5000
2005-03-31 12:43:51 +00:00
Goober5000 ce89e0d560 fix type mismatch
--Goober5000
2005-03-31 12:38:24 +00:00
Goober5000 111fa9a728 changed a bunch of literal constants to their #define'd keywords
--Goober5000
2005-03-31 11:11:56 +00:00
taylor 001f85c695 forget the swaps for OSX 2005-03-30 16:06:52 +00:00
taylor 23ab20680a a little Linux happiness 2005-03-30 16:06:26 +00:00
taylor aff41f6382 basic wxFRED2 building, only works on Linux for now 2005-03-30 16:05:42 +00:00
wmcoolmon cdfbe82f07 Whoops. 2005-03-30 05:37:22 +00:00
wmcoolmon 8316e86843 Made it so *Snd fields in ships.tbl and weapons.tbl take the sound name
as well as its index (ie "L_sidearm.wav" instead of "76")
2005-03-30 02:32:41 +00:00
Goober5000 591a76e0bd fixed version log
--Goober5000
2005-03-30 01:27:49 +00:00
Goober5000 a9ba9ccea8 added header back in, with a small tweak for the .cpp
--Goober5000
2005-03-30 01:23:32 +00:00
Goober5000 9d30ba0210 removed mixed-case header file
--Goober5000
2005-03-30 01:20:05 +00:00
Goober5000 5f32fc582f set up the main menu options
--Goober5000
2005-03-29 13:35:53 +00:00
Goober5000 c519d635f1 fixed browse info error
--Goober5000
2005-03-29 09:57:02 +00:00
Goober5000 272627527b wxFRED is now dependent on code.lib
--Goober5000
2005-03-29 08:15:44 +00:00
Goober5000 1406ef90ec whew... bare-bones "hello world" wxFRED base finally implemented!
--Goober5000
2005-03-29 07:55:19 +00:00
wmcoolmon fbad2dcdc0 Removed some warnings under Linux/GCC 2005-03-29 07:03:16 +00:00
wmcoolmon b24d6815bc Added some comments to #defines to make reading easier 2005-03-29 06:36:37 +00:00
wmcoolmon a28a052ac6 Fixed extern to compile under Linux 2005-03-29 06:28:52 +00:00
phreak 71c2ae7fca global variable "Jump_nodes" needs external linkage for FRED 2005-03-29 03:42:07 +00:00
phreak fb1d118622 get_num_elements() method, probably coded incorrectly, but its needed for FRED 2005-03-29 03:40:15 +00:00
Goober5000 1dbfce5ea7 added storybook to the MSVC6 project
--Goober5000
2005-03-29 02:50:48 +00:00
mrduckman b4e502737c Added OpenGL include dir parameters 2005-03-28 13:25:18 +00:00
taylor bbefc0b90e fix to snd_time_remaining() to make sure we are getting the correct index into Sounds[] 2005-03-28 00:40:09 +00:00
mrduckman fe8a8cc8e7 Syntax correction 2005-03-27 21:13:05 +00:00
mrduckman dbacdf939b Added /kill IRC Command 2005-03-27 21:06:31 +00:00
wmcoolmon 728ee7e21f Forgot to replace 'ship' with 'ai' after copy-paste 2005-03-27 17:33:51 +00:00
Goober5000 0f94de5dd8 bah 2005-03-27 13:37:15 +00:00
Goober5000 6351a5becf rewrote the weapon cheat cycle functions to avoid recursion
--Goober5000
2005-03-27 13:23:05 +00:00
Goober5000 881f1c6077 two new sexps
--Goober5000
2005-03-27 13:00:40 +00:00
Goober5000 2dfa5cdd45 clarified max hull/shield strength names and added ship guardian thresholds
--Goober5000
2005-03-27 12:28:35 +00:00
taylor 413cdab6b7 will hopefully fix the slowdown from mission to mission (thanks Alpha0) 2005-03-27 08:57:52 +00:00
taylor e4827d8110 this is what coding on an empty stomach will get you 2005-03-27 08:51:25 +00:00
wmcoolmon 7fe64c20b0 Bizarre combo of fopen() and close() 2005-03-27 08:12:53 +00:00
taylor 4dfb7611ed fill in some stuff for timer and mmio calls, not 100% but it works ok 2005-03-27 06:17:54 +00:00
taylor 233a8c3134 don't use a platform specific ifdef since the OpenAL code may work under Windows now too 2005-03-27 06:16:46 +00:00
taylor 885ab83dba mmio callbacks work on Linux now and fix problem where system ogg.h would get used rather than the local one 2005-03-27 06:15:31 +00:00
taylor 4df106d0e6 update for streaming support and platform independance 2005-03-27 06:14:30 +00:00
taylor 54707bc916 some pilot file fixing when going between multi and single (partial fix) 2005-03-27 06:12:38 +00:00
taylor 0d4ab080a9 make use of new OpenAL define since it's not platform specific anymore 2005-03-27 06:08:42 +00:00
taylor 3b3aafd920 weapon_num can be 0 so let that through 2005-03-27 06:07:54 +00:00
taylor a1509554e7 update with current files 2005-03-27 06:07:00 +00:00
taylor 3dd13913da initial import of OpenAL streaming (many thanks to Pierre Willenbrock for the missing parts) 2005-03-27 05:48:58 +00:00
taylor 6581a79466 unix specific version is obsolete 2005-03-27 05:47:31 +00:00
wmcoolmon f8b4ba66bc Fixed possible infinite loop problem
----------------------------------------------------------------------
2005-03-27 04:16:19 +00:00
wmcoolmon ab323f6b2a Fixed missing/invalid variables 2005-03-27 03:04:09 +00:00
wmcoolmon 535f8fc3d6 Forgot to define 'i' outside of for scope...ironically, in the OGL code. 2005-03-27 02:59:27 +00:00
wmcoolmon 8cba1f3939 Some fixes 2005-03-26 07:53:32 +00:00
wmcoolmon 18ddb1f6ad Cleaned out old code + fixed min problem 2005-03-26 01:49:46 +00:00
wmcoolmon dc3d359393 Added the storybook 2005-03-26 00:26:06 +00:00
Goober5000 31b5327765 removed unreferenced variable
--Goober5000
2005-03-25 22:36:01 +00:00
wmcoolmon 622ac05c63 Small change now that the storybook is in CVS 2005-03-25 07:35:22 +00:00
wmcoolmon 6319d41ab6 Updated MSVC6 project file for AI move 2005-03-25 07:12:05 +00:00
wmcoolmon 19ea0c5b11 Removed old AI files from CVS 2005-03-25 07:03:12 +00:00
wmcoolmon 9471ebced4 Added taylor's old-weapon code fix 2005-03-25 07:01:53 +00:00
wmcoolmon fbf776164b Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase) 2005-03-25 06:57:38 +00:00
wmcoolmon feee088277 Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem. 2005-03-25 06:45:13 +00:00
taylor 1630965ce8 I think I deserve a medal or something for that one :) 2005-03-25 01:10:51 +00:00
taylor bb556e9c7f s/gr_ogl_/gr_opengl_/g
add empty gr_opengl_draw_line_list() so that it's not a NULL pointer
make gr_opengl_draw_htl_sphere() just use GLU so we don't need yet another friggin API
2005-03-24 23:42:21 +00:00
taylor b0ec8041de make sure we don't go one over the number of message avis 2005-03-24 23:38:49 +00:00
taylor 9e329634b3 fix GCC building 2005-03-24 23:37:25 +00:00
taylor 7843ed8770 fix compiler warnings with mismatched types and unused variables
cleanup some debug messages so they can be turned off if needed
get rid of extra strstr() check for thrusters since it should never get that far anyway
page_in/page_out of model glows should be better now
removed a bunch of unneeded casts and get type specific math functions right
2005-03-24 23:36:14 +00:00
taylor 008582fce5 make sounds.tbl dynamic
"filename" will never be larger than 33 chars so having it 260 is a waste (freespace.cpp)
2005-03-24 23:31:46 +00:00
taylor 8ecfbed208 (re)move some uneeded variables to fix compiler warnings 2005-03-24 23:29:33 +00:00
taylor 851fc877d0 make sounds.tbl dynamic
have snd_time_remaining() be less stupid
some OpenAL error fixerage
be able to turn off some typically useless debug messages
2005-03-24 23:27:26 +00:00
taylor 3ff8fff6af use SWARM_MISSILE_DELAY again so that it's easier to keep up with
fix compiler warnings
2005-03-24 23:24:01 +00:00
taylor 74ae69a49b make sure we will get the right error message 2005-03-24 23:22:59 +00:00
wmcoolmon 3df75bed77 no more MSVC compiler warning 2005-03-24 05:50:07 +00:00
phreak 37034092d4 Starfield bitmaps should now draw in non-htl mode 2005-03-23 20:09:23 +00:00
phreak 8e98e16796 Some specular values in g3_draw_perspective_bitmap() were being incorrectly set. fixed that 2005-03-23 20:08:33 +00:00
taylor 1c2d7163c1 fix version check for drivers that support OpenGL 2.0+ 2005-03-22 00:36:48 +00:00
phreak 0e2d83529b Orb correctly displays in 640x480 2005-03-21 23:19:55 +00:00
phreak c1bc6871c3 Add a function to check whether any duplicate jumpnode names exist 2005-03-20 21:07:10 +00:00
phreak 12c6e04b17 export the functions that deal with the creation and destruction of the starfield buffer.
FRED needs them
2005-03-20 20:02:29 +00:00
phreak d2912daaac draw paths and docking points using HTL 2005-03-20 20:01:15 +00:00
phreak 983881e398 lol forgot to commit the function pointer stuff 2005-03-20 18:05:04 +00:00
phreak 822b4d9c01 high-level implementation for gr_draw_htl_line and gr_draw_htl_sphere 2005-03-20 00:11:27 +00:00
phreak 8074a129cd Added gr_draw_htl_line and gr_draw_htl sphere
There still needs to be D3D versions implemented, but OGL is done.
Follow that or ask phreak about how its implemented/
2005-03-20 00:09:07 +00:00
wmcoolmon 844ac565ef OpenGL display lists 2005-03-19 21:03:54 +00:00
Goober5000 40eeea76d8 corrected misinformation in comment about surface shields (implicit surface
shields were removed for meshed ships)
--Goober5000
2005-03-19 20:45:23 +00:00
wmcoolmon c7b5a70830 small bool fix 2005-03-19 20:35:45 +00:00
bobboau 4972df4cdf adding d3d state block files 2005-03-19 18:18:04 +00:00
bobboau 028fd5c930 added new graphic functions for state blocks
also added a class formanageing a new effect
2005-03-19 18:02:35 +00:00
bobboau 1397a84db7 added a geometry batcher and implemented it in sevral places
namely: lasers, thrusters, and particles,
these have been the primary botle necks for some time,
and this seems to have smoothed them out quite a bit.
2005-03-16 01:35:59 +00:00
phreak 9523481fe2 properly handle using the old method of selecting primary weapons.
i forgot a return statement so the new method was used instead
2005-03-16 00:37:42 +00:00
wmcoolmon 00a413d3b0 Commited placeholder turret funcs. 2005-03-16 00:18:31 +00:00
taylor dd6d061488 make sure w,h,bpp are useable before trying to assign values to them 2005-03-15 17:10:58 +00:00
Goober5000 038cb865be *fixed some sexp declaration formatting
*implemented string comparison sexps
*simplified numeric comparison sexps
*fixed numeric comparison (especially equals) sexps to actually work on all their arguments like they were designed to
--Goober5000
2005-03-15 07:26:52 +00:00
phreak f46914eab9 Awesome 2-for-1 deal!!!
Firstly, the Colossus should now warp out correctly.  No more warphole forming inside of it
Secondly, muzzleflashes now are generated at the gunmounts of the firing ship.
2005-03-15 01:40:07 +00:00
Goober5000 a71305bdc3 properly fixed the out-of-bounds error, as well as a few other errors of the same kind
--Goober5000
2005-03-14 23:34:59 +00:00
Goober5000 9ef30029aa rolled back Phreak's commit
--Goober5000
2005-03-14 23:33:22 +00:00
wmcoolmon 69231d79ff Hopefully this will fixx0r Num_sounds 2005-03-14 23:31:54 +00:00
wmcoolmon 22a4cfc835 Whoops, this isn't needed. 2005-03-14 06:38:31 +00:00
wmcoolmon db1c760a3c Commented out now-unneccessary Int3() 2005-03-14 06:38:06 +00:00
wmcoolmon 70f831bc22 Added memory display thingy to loading screen, if command line is specified and build is a debug build. Also made screenshots go up to 9999 2005-03-14 06:36:30 +00:00
wmcoolmon c20117ef22 Made sounds dynamically allocated 2005-03-14 06:33:38 +00:00
taylor 0e92b61ebf fix for mouse cursor problem when running in a window 2005-03-14 03:38:54 +00:00
taylor f36b06ee40 speedup grow/shrink time for the warp to avoid the big size skips 2005-03-14 03:24:25 +00:00
phreak 5739cfb2d0 Got rid of the stealth check that only applied to cloaked ships. This should
fix some errorneous behavior that caused the ai to target the player
2005-03-14 02:52:58 +00:00
taylor 7b8ff3d087 enable 32-bit to 16-bit TGA conversion with -tga16 cmdline option (experimental)
fix crash when upgrading from original campaign stats file to current
2005-03-13 23:07:36 +00:00
wmcoolmon 087c0be980 Squashed compiler warnings 2005-03-13 08:44:10 +00:00
wmcoolmon 1f1153bc57 Commented out unneeded variables 2005-03-13 08:38:05 +00:00
wmcoolmon c54e4875bd Might as well sync this 2005-03-13 08:37:01 +00:00
taylor 06dc37d064 gotta use MIN/MAX and not min/max now 2005-03-13 08:33:55 +00:00
wmcoolmon c32522129b Hud fixing goodness. I also removed some obsolete code for displaying HUD weapons. 2005-03-13 08:32:28 +00:00
taylor 0f50203063 fix various compiler warning messages
make sure screenshot count doesn't get too high
fix movies playing twice in redalert missions
reset time compression for redalert missions and cmdbriefings, just in case
2005-03-13 08:04:43 +00:00
phreak 50b2cd65fa extra checks in find_parent_rotating_submodel() 2005-03-12 23:53:27 +00:00
phreak a036fc3bea doubled default spawn angle from 180 to 360 since it seems to track better 2005-03-12 21:08:01 +00:00
phreak b2c098ee44 the code for the damaged-escort-priority-all sexp started
overwriting outside ofarray bounds.  goodbye call stack... erm goodbye bug.
2005-03-12 20:48:33 +00:00
taylor 1f92bafc8f helps to get the stupid check right 2005-03-12 19:28:47 +00:00
taylor 50baf2c401 forgot this one, jpeg stuff 2005-03-12 07:42:05 +00:00
phreak 440b39a3ee Fixed a bug where the orb would incorrectly render under alternate FOVs.
Updated the functions that scramble the contacts so the blips show up
somewhat near where they should be.
2005-03-12 06:03:07 +00:00
wmcoolmon ed45cfb078 whee! 2005-03-12 05:21:36 +00:00
taylor 249bfeb9fe absolute header location for jpeglib.h in jpgutils.cpp (thanks WMC)
update VC6 project files to correct versions that work properly with internal libjpeg
2005-03-12 04:59:15 +00:00
wmcoolmon 68ec71efad Fixx0red odd drag problems 2005-03-12 04:44:24 +00:00
wmcoolmon a42a4ec0f0 New commandline option "-noparseerrors" 2005-03-12 03:09:55 +00:00
taylor 4504bea340 was causing strange hangs due to really large values, don't know if this will help but SDL should take care of error checking this way 2005-03-11 14:16:02 +00:00
taylor d395341b1c forgot to remove this with the MIN/MAX change 2005-03-11 14:14:05 +00:00
taylor a3f509766a apparently this change never got in 2005-03-11 14:11:53 +00:00
taylor 69130eb9fe ignore the typical build specific files 2005-03-11 14:00:01 +00:00
wmcoolmon bac63f2faf Isn't the extern needed too? causes linking errors on my system w/o it, although it compiles fine. 2005-03-11 01:37:35 +00:00
wmcoolmon bedf8a6157 Not really. I've got lib files in my main VC.NET libs directory, and include files in grouped subdirectories under my VC.NET include directory. it keeps my HD free of scattered SDK directories and helps keep conflicts down. 2005-03-11 01:34:19 +00:00
wmcoolmon 947e8b16fb Oops, gotta remember to commit main codebase stuff when fixing FRED 2005-03-11 01:28:23 +00:00
wmcoolmon fd9f14053a I like comments 2005-03-11 01:27:17 +00:00
taylor 4821082a53 fix screwed up stars coloring in OGL 2005-03-10 21:16:16 +00:00
taylor 56774f66d0 maybe WMC can leave the include alone now ;) 2005-03-10 16:16:52 +00:00
taylor 76b12d5465 build file updates to use the internal jpeglib now 2005-03-10 16:15:18 +00:00
taylor fcac6d58c2 internal libjpeg files 2005-03-10 16:13:54 +00:00
taylor f3dcea6db1 initial libjpeg project file 2005-03-10 16:10:47 +00:00
bobboau 030267adf3 fixed a local/global conflict 2005-03-10 15:35:21 +00:00
taylor 119a28190f change min/max to MIN/MAX to fix GCC problems
add lab stuff to Makefile
build unbreakage for everything that's not MSVC++ 6
lots of warning fixes
fix OpenGL rendering problem with ship insignias
no Warnings() in non-debug mode for Linux (like Windows)
some campaign savefile fixage to stop reverting everyones data
2005-03-10 08:00:18 +00:00
wmcoolmon dfcf412627 Commit for Bobboau. This causes the lab to crash in some circumstances. 2005-03-09 23:45:18 +00:00
bobboau 386efe7325 added a new interface render funtion 2005-03-09 03:23:32 +00:00
Goober5000 d63f7075a9 whoops 2005-03-08 04:41:39 +00:00
Goober5000 a24fde6280 edited for language ;)
--Goober5000
2005-03-08 03:50:25 +00:00
bobboau c78c8c0a43 minor change to high level render target code 2005-03-08 02:31:51 +00:00
Goober5000 1fdfc4bca8 rolled back my original code on the support ship CTD; thanks taylor :)
--Goober5000
2005-03-07 20:12:36 +00:00
bobboau bf878a6322 commit of render target code, d3d should be totaly functional,
OGL still needs implementation.
2005-03-07 13:10:22 +00:00
taylor a77e725968 can't believe I missed something that obvious. *hides in shame* 2005-03-06 17:16:08 +00:00
taylor e69a6f945b don't Assert() when repair_objp is NULL (support ship object is invalid until it's done with warpin) 2005-03-06 16:43:40 +00:00
wmcoolmon c6e589c31a Whoops! 2005-03-06 11:32:40 +00:00
wmcoolmon cc62873cb3 RE-fixed stuff. Ogg support. Briefings. 2005-03-06 11:23:45 +00:00
wmcoolmon e27299e03b Switched out model_unload with model_page_out_textures, as it was causing crashes in release mode. 2005-03-06 08:30:22 +00:00
wmcoolmon c2d671deac fix0r for negative values in textboxes, and ubytes 2005-03-05 20:46:12 +00:00
taylor 70d2885e0b make sure we don't scale the restore_screen bitmap, it's already the correct size 2005-03-05 19:11:07 +00:00
taylor ff7451ccc0 don't let hud messages walk off screen when res is GR_640 2005-03-05 18:59:28 +00:00
bobboau a09aba049c made all the gr_d3d_tmapper variants use dynamic a vertex buffer rather
than drawprimitiveup, this also means that these functions can now
handle as much poly data as you might want to through at them
2005-03-04 03:24:44 +00:00
taylor 6be13dc50b animated beam muzzle glows 2005-03-03 16:40:29 +00:00
taylor 6b54aa9784 lockup fixes, and it's Linux friendly too :) 2005-03-03 16:18:19 +00:00
taylor b5381eb23e support for TMAP_FLAG_TRILIST
extra check to make sure OGL closes down right under Windows
increased depth buffer, it was too small to compare when 32bpp was used
2005-03-03 16:16:55 +00:00
bobboau a600ceca96 fixed a small error from my earlier commit. 2005-03-03 14:29:39 +00:00
Kazan f4296903ce !Om_tracker_flag = non-pxo 2005-03-03 12:58:25 +00:00
Goober5000 abeaab1602 AUGH! Stupid hidden bugs... this one is V's fault
--Goober5000
2005-03-03 08:41:53 +00:00
wmcoolmon 00211ea1f0 Added new files to the project. Hopefully this works; I have no way to test it. 2005-03-03 08:16:26 +00:00
wmcoolmon ca97992985 Oops 2005-03-03 07:32:55 +00:00
wmcoolmon 8850cbcb38 Removed my Assert(true)s :p 2005-03-03 07:30:15 +00:00
wmcoolmon 382e540086 Made HUD shield icon auto-generation off unless "generate icon" ship flag is specified for the ship. 2005-03-03 07:13:17 +00:00
Goober5000 b9d5898908 removed the "error" in the new docking code
--Goober5000
2005-03-03 06:41:40 +00:00
wmcoolmon 20c60b021f Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure" 2005-03-03 06:05:32 +00:00
taylor f81a818afa well that was good and wrong 2005-03-03 05:32:11 +00:00
wmcoolmon 58b5bae0cb Turret AI code optimizations. If freaky stuff happens, call WMC() 2005-03-03 03:55:03 +00:00
wmcoolmon 69e5efdd91 This should really be like this to prevent crashing 2005-03-03 03:53:18 +00:00
bobboau 811c572cf8 added trilist suport to the poly rendering functions
and a gr_bitmap_list function that uses it
2005-03-03 02:39:14 +00:00
taylor 0c6f8bbefd use the back buffer for screen saves, this didn't work on Windows at one
point but I'm out of things to try and it may be ok after other fixes
2005-03-03 00:33:41 +00:00
taylor a58856e0d5 more NO_NETWORK/INF_BUILD goodness for Windows, takes care of a few warnings too 2005-03-02 21:24:48 +00:00
taylor 9ce18ac6e5 better support for Inferno builds (in PreProcDefines.h now, no networking support)
make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
revert a timeout in Client.h back to the original value before Linux merge
2005-03-02 21:18:20 +00:00
taylor 5bdb318371 that one should never have slipped passed me (Linux specific) 2005-03-02 03:13:00 +00:00
taylor 3659d10464 make sure starfield bitmaps render when not in HTL mode
slight header fix for osapi.h
add some string overflow protection to modelread and bmpman
s/NO_NETWORKING/NO_NETWORK/g  (Inferno builds)
2005-03-01 23:08:24 +00:00
taylor bf26a96691 unbreak Linux build (not valid C/C++ anyway, block scope) 2005-03-01 23:05:38 +00:00
bobboau 4625702437 oh, hey look I've commited something :D
animation system, weapon models detail box alt-tab bug, probly other stuff
2005-03-01 06:55:45 +00:00
taylor 438f9360e1 uugh, missed the initial tree move (WMC: probable locking problem) 2005-02-28 01:24:02 +00:00
wmcoolmon d54288be7f Removed unneccessary variable 2005-02-28 00:29:52 +00:00
wmcoolmon 3f2266581c Added a white component to lightning so it isn't just a big blue block 2005-02-27 23:42:07 +00:00
wmcoolmon 5085b17246 Some HUD work 2005-02-27 23:27:50 +00:00
Goober5000 ecd3f09e74 First stage of "apply to all ships in this wing" weapon loadout button code.
Button hooks only, pending interface art.  The "apply-to-all" code itself
still has to be written.
--Goober5000
2005-02-27 14:09:27 +00:00
wmcoolmon aa8a4447ef Nonstandard res stuff 2005-02-27 10:38:06 +00:00
wmcoolmon 0ea465d45f More nonstandard res stuff 2005-02-27 07:08:22 +00:00
wmcoolmon 6c1468d59d nonstandard res HUD stuff 2005-02-27 07:07:47 +00:00
taylor 345a4b396d few more compiler warning fixes (didn't mean to commit iostream.h change)
lower warning level to 3 to stop MSVC6 from complaining about C++ headers
2005-02-23 13:17:05 +00:00
taylor ed21106256 more consolidation of various graphics variables
some header cleaning
only one tmapper_internal for OGL, don't use more than two tex/pass now
seperate out 2d matrix mode to allow -2d_poof in OGL and maybe fix missing
   interface when set 3d matrix stuff doesn't have corresponding end
add dump_frame stuff for OGL, mostly useless but allows trailer recording
2005-02-23 05:11:13 +00:00
taylor 5b28717fec compiler warning fixes (for MSVC++ 6)
have the warp effect only load as many LODs as will get used
head off strange bug in release when corrupt soundtrack number gets used
   (will still Assert in debug)
don't ever try and save a campaign savefile in multi or standalone modes
first try at 32bit->16bit color conversion for TGA code (for TGA only ship textures)
2005-02-23 05:05:39 +00:00
taylor 85ff0f7030 even more bm_unload() -> bm_release() changes 2005-02-23 04:57:29 +00:00
taylor df2d335539 more bm_unload() -> bm_release() changes 2005-02-23 04:55:09 +00:00
taylor 144429e984 some bm_unload() -> bm_release() changes to save bmpman slots 2005-02-23 04:51:56 +00:00
wmcoolmon 9cf34e208c Multi-res support 2005-02-21 09:00:58 +00:00
Goober5000 f64849dc72 restored release version of some cheat codes; removed a cheat for cloaking
--Goober5000
2005-02-21 05:40:16 +00:00
wmcoolmon 853b8e79f3 Camera code updates (subtitles) 2005-02-20 23:14:00 +00:00
wmcoolmon 6a6069354d Trails stuff, moved ship docking func declaration so FRED could get to it. 2005-02-20 23:13:01 +00:00
wmcoolmon d66b99c9f4 Fix0r3d trails 2005-02-20 23:11:51 +00:00
wmcoolmon c195c0aaf2 More trails updating goodness 2005-02-20 08:24:19 +00:00
wmcoolmon d7f483708a Smartified shipcontrails 2005-02-20 08:22:48 +00:00
wmcoolmon 333c370d71 Trails update: Better, faster, stronger, but not much more reliable 2005-02-20 07:39:34 +00:00
Goober5000 c5222f828c restored original behavior for cheat code time dilation
--Goober5000
2005-02-20 05:22:44 +00:00
wmcoolmon a828e0e934 Removed trails limit 2005-02-19 07:57:03 +00:00
wmcoolmon 9c87d92c91 linklist isn't needed for this 2005-02-19 07:52:56 +00:00
wmcoolmon 833e99e6a7 OpenGL gradient fix for nonstandard resolutions 2005-02-19 07:50:15 +00:00
wmcoolmon af3332d595 Fixes for debriefing window in nonstandard res 2005-02-18 21:14:03 +00:00
wmcoolmon 97119e182a Fixed line misalignment at nonstandard res in the campaign room 2005-02-18 20:50:40 +00:00
wmcoolmon a504a33138 More nonstandard res fixing 2005-02-18 09:58:40 +00:00
wmcoolmon cd741318d3 Since the screen can be wider than 1200 px now, don't auto-cull brackets if they're that big. 2005-02-18 09:54:41 +00:00
wmcoolmon d0f50e30e4 Updates for better nonstandard res support, as well as a fix to the Perseus crash bug I've been experiencing. Bobb, you might want to take a look at my change to grd3d.cpp 2005-02-18 09:51:07 +00:00
Goober5000 2ab0a4a032 really fixed the build warning
--Goober5000
2005-02-18 09:03:34 +00:00
wmcoolmon f73d8075c6 If a vertex buffer fails to be made, don't crash. 2005-02-18 08:05:16 +00:00
wmcoolmon fc8e4a077e Attempt to get rid of compiler warnings 2005-02-18 05:24:26 +00:00
wmcoolmon 83272bbd2f Added $Tech Model (after +Tech Description) 2005-02-18 04:54:44 +00:00
wmcoolmon 153526208d "-ingame" command line option 2005-02-16 10:00:40 +00:00
taylor d553a0d2c5 fix cleanup to avoid breaking the slider when it's still needed 2005-02-15 02:15:04 +00:00
taylor 5732d2f126 clean up some model related globals
code to disable individual thruster glows
fix issue where 1 extra OGL light pass didn't render
2005-02-15 00:06:27 +00:00
taylor 88950ad717 don't try and draw starfield bitmaps if they aren't valid
make AB thruster stuff in ship_create() a little less weird
replace an Int3() with debug warning and fix crash in docking code
make D3D Textures[] allocate on use like OGL does, can only use one anyway
2005-02-15 00:03:36 +00:00
taylor 60d1234579 make hudparse GCC 3.4 friendly (WMCoolmon way want to check this with tbl)
fix OSX compile problem
debug message in weapons_page_in() should have been real debug message
2005-02-14 23:59:23 +00:00
taylor 74f77cf920 fix mouse click issues in weapon/ship select screen
skip real VCR controls for Closeup check rather than using hardcoded values
2005-02-14 23:56:51 +00:00
taylor 7192f32409 make loading screen shader a bit taller
add i.o to credits for Linux and OSX code
add libjpeg and ogg stuff to credits for license compliance
replace an Int3() with a debug message in the hud code
2005-02-14 23:54:11 +00:00
wmcoolmon b1d397e91b More explicit calculation handling 2005-02-13 08:42:41 +00:00
wmcoolmon 42cbf081d0 3D models in weapons selection screen and nonstandard resolution fixes for ship selection screen. 2005-02-13 08:41:25 +00:00
wmcoolmon ddc47ef2f2 nonstandard resolution-friendly function updates 2005-02-13 08:38:54 +00:00
wmcoolmon 931f4f2df6 Made messages display properly in nonstandard resolutions 2005-02-13 08:37:57 +00:00
wmcoolmon 97c87a6bf8 Lockon should now work properly in nonstandard resolutions 2005-02-13 08:36:51 +00:00
wmcoolmon 85386190d2 while loops are dangerous things... 2005-02-12 22:49:24 +00:00
taylor 0ffcef0fc8 fix Error() check so that it doesn't hit on MAX_BUFFERS_PER_SUBMODEL-1 2005-02-12 12:17:54 +00:00
taylor 96645bff74 fix possible crash in bm_get_section_size()
get jpeg_read_header() working properly
VBO fixes and minor optimizations
2005-02-12 10:44:11 +00:00
taylor 9bd125e1de fix an issue with bm_set_components()
abs is for ints fabsf is for floats (camera.cpp)
make the in-cockpit stuff OGL friendly
2005-02-10 14:38:50 +00:00
wmcoolmon 5b549c7d4a Got rid of a couple annoying compiler warnings 2005-02-10 04:05:42 +00:00
wmcoolmon 550ef67140 Addition of the -clipdist argument. 2005-02-10 04:02:37 +00:00
wmcoolmon 7be677573e Low-level code for better hi-res support; better error reporting for vertex errors on model load. 2005-02-10 04:01:43 +00:00
taylor 65bea0960c update/add .cvsignore files for project file changes
silence warning about depreciated strings.h stuff for MSVC 2005
final model_unload() stuff for WMCoolmon, put in missionweaponchoice.cpp
remove really old project files
2005-02-08 23:49:59 +00:00
taylor 0ddb694d5c moved to projects 2005-02-08 05:19:34 +00:00
taylor de6cadea7d moved to projects directory 2005-02-08 05:18:02 +00:00
taylor fd8c41243e add something to the README about projects 2005-02-08 05:14:17 +00:00
taylor 40193dcfa7 new projects directory and files 2005-02-08 05:11:19 +00:00
taylor 75d63a8bb5 should fix linker error in libjpeg 2005-02-07 08:33:14 +00:00
wmcoolmon 5d1ca5e7c6 Updated camera code 2005-02-06 22:21:25 +00:00
taylor a685b68033 more post merge happiness 2005-02-05 04:15:36 +00:00
taylor 36da5e1a16 add libjpeg and ogg stuff 2005-02-05 00:52:51 +00:00
taylor ab78ba209c fix a few things post merge 2005-02-05 00:30:49 +00:00
taylor 4ae7263242 merge with Linux/OSX tree - p0204-3 2005-02-04 23:29:32 +00:00
taylor b1128630e4 merge with Linux/OSX tree - p0204-2 2005-02-04 20:06:10 +00:00
taylor b906b0fcce merge with Linux/OSX tree - p0204 2005-02-04 10:12:33 +00:00
phreak b723200206 revert to default d-missile behavior if the electroinics parameters aren't specified.
added an option to customize the old-style disruption calculation as well.
2005-02-03 01:26:45 +00:00
taylor 81d967eab5 only model_load() if we using a ship other than the current one 2005-02-02 15:09:06 +00:00
taylor 2673720ce8 merge with Linux/OSX tree - p0202 2005-02-02 10:36:23 +00:00
taylor 03bb0c45a4 OGG fix for streams 2005-02-01 06:54:20 +00:00
taylor 8eef49b990 merge with Linux/OSX tree - p0131-2 2005-01-31 23:27:55 +00:00
taylor 40516e52a4 merge with Linux/OSX tree - p0131 2005-01-31 10:34:40 +00:00
taylor 7a31d39759 merge with Linux/OSX tree - p0130
remove extra brace in cfile.cpp
2005-01-30 18:32:42 +00:00
taylor 2407f4f0d9 it's -nosound not -noaudio 2005-01-30 14:09:29 +00:00
taylor fa0172afb0 merge with Linux/OSX tree - p0130 2005-01-30 12:50:08 +00:00
Goober5000 2952838d64 bah - rolled back the HTL fix that doesn't really work
--Goober5000
2005-01-30 10:49:26 +00:00
Goober5000 f9db9a5810 optional flags default to false I should think
--Goober5000
2005-01-30 09:36:19 +00:00
Goober5000 a26e7a0a49 nitpicked some boolean tests, and fixed two small bugs
--Goober5000
2005-01-30 09:27:41 +00:00
wmcoolmon 8400768e9a Make sure hudnavigation uses the correct draw_brackets_Square 2005-01-30 03:28:17 +00:00
wmcoolmon a51ff7379b This isn't needed anymore 2005-01-30 03:27:09 +00:00
wmcoolmon be4fa8cef9 HUD updates 2005-01-30 03:26:11 +00:00
wmcoolmon 8b4df0aaff Don't try and create a vertex buffer with no vertices (Seems to cause CTD) and fix to brackets in nonstandard res 2005-01-30 03:24:39 +00:00
wmcoolmon 85bd57fb74 Improved user-friendliness - give an Error instead of a CTD 2005-01-30 03:23:22 +00:00
wmcoolmon 3dba61c334 If a required string doesn't exist, give an error instead of a warning...doi. 2005-01-30 01:38:26 +00:00
wmcoolmon 84d991e191 Made a bunch of ship.tbl variables optional 2005-01-30 01:34:39 +00:00
phreak e4fd785fbd smart shield stuff. enabled by command line for now, but this will be changed in the future, i just want people to test it.
-phreak
2005-01-29 16:31:55 +00:00
phreak 54a3a76774 smart shield command line stuff. this will be changed in the future, but i want people to test it.
-phreak
2005-01-29 16:30:47 +00:00
phreak 8a20ab1088 fixed error message again :)
-p
2005-01-29 15:40:22 +00:00
argv 2d41918dae Fixed compile errors due to several source files not having been updated to
reference "Min/Max_draw_distance" instead of "MIN/MAX_DRAW_DISTANCE".

-- _argv[-1]
2005-01-29 09:19:45 +00:00
wmcoolmon dae81d157b Clipping stuff 2005-01-29 08:12:20 +00:00
wmcoolmon a014e5227c When drawing the viewer_obj, temporarily clip less close up for in-cockpit models. 2005-01-29 08:11:41 +00:00
wmcoolmon 633bca17d9 Various updates; shader, clipping 2005-01-29 08:09:47 +00:00
wmcoolmon e19e89b20f Various updates; shader, assert, and clipping 2005-01-29 08:08:24 +00:00
wmcoolmon 9eba78035a Update to work with optimized shader func 2005-01-29 08:06:54 +00:00
wmcoolmon 68a26cf7d5 Ahh, the sweet smell of optimized code 2005-01-29 08:04:15 +00:00
Goober5000 e3077951ca docking fixes for FRED
--Goober5000
2005-01-29 05:34:30 +00:00
Goober5000 9d79b2e8d5 updated Freespace2 project
--Goober5000
2005-01-29 00:58:01 +00:00
Goober5000 ecd3cddeca added bitarray.h to the code project
--Goober5000
2005-01-29 00:37:10 +00:00
wmcoolmon 38de54f03a Added better too-many-textures error message 2005-01-28 23:45:23 +00:00
taylor 49d25dce7c less hacky and faster version... *hopes no one noticed the stupid mistake* 2005-01-28 13:26:14 +00:00
Goober5000 e4d74ff3cb fixed Bobboau's spelling of 'relative'
--Goober5000
2005-01-28 11:57:36 +00:00
Goober5000 c789bf7509 cleaned up some build warnings
--Goober5000
2005-01-28 11:39:18 +00:00
Goober5000 ee26a8a8f6 changed a bunch of transpose-rotate sequences to use unrotate instead
--Goober5000
2005-01-28 11:06:23 +00:00
taylor 06540c61b3 little cleanup to get rid of compiler warnings
add some memory management to help keep size of techroom down
new hotkey Ctrl-Shift-S to show all ships rather than just viewable
make Weapon_list allocate on load just like Ship_list
unload all textures and models on techroom_close()
2005-01-28 10:00:59 +00:00
taylor 72a5f1fa53 add model_page_out_textures() for use in techroom
make model_page_in_textures() load more textures
2005-01-28 09:56:44 +00:00
Goober5000 ba13b76ffe finished implementing docking to a rotating submodel
--Goober5000
2005-01-28 09:01:04 +00:00
phreak a70d0b3144 shockwave weapons now work properly with the electronics (d-missible) tag
added in a "randomness factor" for electronics parameters.  This adds or subtracts
a random value between 0 and this factor to the disruption time.  This was hard coded
to be 4 seconds in retail.
2005-01-28 04:05:05 +00:00
wmcoolmon a853432699 Better debrief memory handling 2005-01-28 03:00:56 +00:00
wmcoolmon afa8c96236 Fixed crash bug in techroom 2005-01-28 02:57:59 +00:00
Goober5000 88c4e9880b dock points on rotating submodels is *almost* working
--Goober5000
2005-01-27 11:26:23 +00:00
Goober5000 4ffaf24ab8 added a useful bit of information to vm_vec_rotate and vm_vec_unrotate
--Goober5000
2005-01-27 05:26:07 +00:00
wmcoolmon c2c4c1a4ea Ship autorepair, requested by TBP 2005-01-27 04:23:18 +00:00
wmcoolmon c09b89127b Camera code 2005-01-27 04:16:28 +00:00
Goober5000 291215d6a9 important bugfix
--Goober5000
2005-01-26 21:42:19 +00:00
phreak 23e73f2b0d added ogg and objectdock files to project 2005-01-26 14:57:19 +00:00
Goober5000 6f7f3296e0 hm... added a necessary bugfix for something very badly designed
--Goober5000
2005-01-26 06:58:37 +00:00
Goober5000 6c89a3310c whoops... need to free variable blocks for special hitpoints
--Goober5000
2005-01-26 06:49:50 +00:00
Goober5000 579972dd62 AHA... squashed another bug
--Goober5000
2005-01-26 05:44:10 +00:00
Goober5000 c7916f4483 fixed a nitpicky thing
--Goober5000
2005-01-26 05:42:37 +00:00
argv 3dff6606f2 Removed the implicit surface shield on mesh-shielded ships.
-- _argv[-1]
2005-01-26 03:40:43 +00:00
Goober5000 69ab027ecf Bah - I am a moron. :) I see the reason why rand shouldn't work
multiple times.  It's been fixed thus.

I also added a rand-multiple sexp for any times when people do
want multiple random numbers.

--Goober5000
2005-01-26 01:52:21 +00:00
Goober5000 ee175fcfd3 dockpoints now rotate with rotating subobjects
--Goober5000
2005-01-26 01:26:09 +00:00
Goober5000 bf2a2cf7cc species will now load from a default table instead of being initialized via code
--Goober5000
2005-01-25 23:32:46 +00:00
Goober5000 0094f97f3c more cool parsing stuff
--Goober5000
2005-01-25 22:47:37 +00:00
Goober5000 77cc78e5e7 separated one parsing function into two
--Goober5000
2005-01-25 22:21:45 +00:00
Goober5000 6f1eed006f streamlined some redundant stuff
--Goober5000
2005-01-25 21:28:58 +00:00
wmcoolmon 5b09ed5b78 Instead of trying to allocate a ridiculously large buffer if the file is defined but doesn't exist, give a warning. Someone with nebula-code experience should probably double-check this; also added jpg and TGA support. 2005-01-22 22:53:07 +00:00
wmcoolmon 86ad73d71b Nitpick - can be NULL by default 2005-01-22 22:02:28 +00:00
wmcoolmon 5017882299 Fix0red the ext error. Always make sure you have room for the string terminator. :) 2005-01-22 20:29:05 +00:00
taylor 7d6f0afc73 crap 2005-01-21 21:12:52 +00:00
taylor 8989ee4abf cleanup debug messages for texture loading making the output more readable and useful 2005-01-21 08:58:32 +00:00
taylor c85f1bfa4e make Subsys_status dynamic but allocate in blocks for speed and to help prevent memory fragmentation 2005-01-21 08:56:50 +00:00
taylor 0fe03690f8 slightly better memory management 2005-01-21 08:54:53 +00:00
taylor 227298f10b add -rlm cmdline option to switch to local viewpoint lighting calculations (OGL only for now) 2005-01-21 08:29:04 +00:00
taylor 388fa7ac45 fill in gr_opengl_set_texture_addressing()
add support for non-power-of-two textures for cards that have it
temporary crash fix from multiple mipmap levels in uncompressed formats
2005-01-21 08:25:15 +00:00
taylor 926c12c560 make sure we can still use TGAs (16-bit) when Cmdline_jpgtga is not set, PCX still takes precedence per retail 2005-01-21 08:20:44 +00:00
Goober5000 8cafc52ff3 fixed a crazy error
--Goober5000
2005-01-18 06:15:33 +00:00
Goober5000 6483947732 fixed a silly error
--Goober5000
2005-01-18 06:14:29 +00:00
Goober5000 8b6dab73be variables can be specified in training messages too now
--Goober5000
2005-01-18 01:20:03 +00:00
wmcoolmon 0d8d459deb OGG fixes, ship selection fixes 2005-01-18 01:14:17 +00:00
Goober5000 5f9778d505 clarified a bunch of sexp stuff and fixed a bug
--Goober5000
2005-01-18 00:14:37 +00:00
argv a023302cbb Surface shields.
See forum thread:
http://dynamic4.gamespy.com/~freespace/forums/showthread.php?s=&threadid=29643

-- _argv[-1]
2005-01-17 23:35:45 +00:00
Goober5000 5937327c44 variables can now be displayed in messages
--Goober5000
2005-01-17 22:46:32 +00:00
wmcoolmon f29529494c Attempt to fix the crash when a player ship's subsystems receives damage, and it has a lot (ie player ship is a capital ship).This seems to be controlled by SUBSYSTEM_MAX, which also controls the number of subsystems saved in red alert missions. 2005-01-17 06:35:35 +00:00
wmcoolmon a1d0a19ec5 Added "show ship" ship flag 2005-01-16 23:18:04 +00:00
wmcoolmon 55635a499e Added VM_TOPDOWN view; Added 2D mission mode, add 16384 to mission +Flags to use. 2005-01-16 22:39:10 +00:00
wmcoolmon 582b4ea365 Current version of the new techroom code -C 2005-01-15 05:53:18 +00:00
argv 718e2a71ec Revision 2.42 (Goober's fixes) broke "no pierce shields". Fixed.
-- _argv[-1]
2005-01-14 23:08:17 +00:00
wmcoolmon 97c909de30 gr_curve 2005-01-14 05:28:58 +00:00
taylor 0a49604e83 plug leak from VBO crash fix 2005-01-13 04:55:57 +00:00
Goober5000 7a2c197144 hmm, rolled back one of my clarifications since it caused things to get messed up
--Goober5000
2005-01-13 03:33:07 +00:00
phreak 82a82b2bae difficulty table changes. this lets modders specify how the difficulty level affect
how the AI behaves and controls advantages given to the player based on the
skill level.

--phreak
2005-01-13 02:25:52 +00:00
Goober5000 9aa9bfaaf1 forgot to remove a comment
--Goober5000
2005-01-13 01:10:33 +00:00
Goober5000 134a3668ae fixed another nasty bug
--Goober5000
2005-01-12 23:38:42 +00:00
Goober5000 00b0a8d148 fixed a nasty bug where dock pointers would run off a cliff and crash
--Goober5000
2005-01-12 04:45:33 +00:00
Goober5000 6111162808 two minor but important bugfixes to the multiple ship docking
--Goober5000
2005-01-12 00:52:42 +00:00
phreak 63d43fbfb0 new hud is deault off now. this should fix the disappearing gauges problem. 2005-01-12 00:20:27 +00:00
phreak 6f2275c4ab nude hud? was this some kind of freudian slip of a sort or what? 2005-01-12 00:18:00 +00:00
phreak 55b3af43e8 fixed hud offsets bug 2005-01-12 00:17:09 +00:00
Goober5000 144f8f3a4b multiple ship docking :)
don't tell anyone yet... check the SCP internal
--Goober500
2005-01-11 21:38:51 +00:00
Goober5000 0b5a25446a made a capitalization thing consistent
--Goober500
2005-01-11 21:28:24 +00:00
Goober5000 1ddc459df6 fixed two small things with physics
--Goober500
2005-01-11 21:25:58 +00:00
taylor cfe8a03ff3 fully working (??) -loadonlyused, allocate used_weapons[] and ship_class_used[] only when needed 2005-01-11 04:05:23 +00:00
wmcoolmon 3e4f71fe29 Bug-guard 2005-01-10 06:58:12 +00:00
wmcoolmon f236be7241 Debriefing screen updated to only use memory while open 2005-01-10 04:45:09 +00:00
wmcoolmon 18ac53bb5d Small fix, so we don't try to delete the same thing twice 2005-01-10 04:44:03 +00:00
wmcoolmon ebd866660e Techroom and Barracks now allocate memory only when open, and only for the number of ships currently loaded 2005-01-09 22:27:38 +00:00
wmcoolmon 4a4e834199 Fix for music directory parent 2005-01-09 21:40:07 +00:00
wmcoolmon eee1d07cf5 Sound quality in Freespace 2 is now controlled by SoundSampleBits, and SoundSampleRate. Also, some sounds will use hardware rather than software buffers if available. 2005-01-08 10:00:59 +00:00
wmcoolmon 6539724237 Function pointers to inline functions is a no-no... 2005-01-08 09:57:27 +00:00
phreak 21bb39d102 fixed the bug where the player couldn't use the target hud in reticle key. 2005-01-07 23:15:44 +00:00
argv 4a93077ddf Added missing #include.
-- _argv[-1]
2005-01-07 14:00:04 +00:00
Goober5000 30c6e6582b gah
--Goober5000
2005-01-06 00:39:34 +00:00
Goober5000 b8e4e24434 changed argument from dist to dist_squared
--Goober5000
2005-01-06 00:37:32 +00:00
Goober5000 926b788fc9 added vm_vec_dist_squared_to_line
--Goober5000
2005-01-06 00:27:34 +00:00
Goober5000 c425a9c12b small speedup in shpere_tri_edge (spelling should be fixed...); now distance is only calculated once
--Goober5000
2005-01-06 00:22:01 +00:00
taylor 15e395f6a4 make sure we're not loading weapons that are left over from larger missions 2005-01-05 23:17:38 +00:00
taylor cf35f79402 more -loadonlyused fixes 2005-01-03 18:47:06 +00:00
taylor 431812cd6d stupid mistake 2005-01-03 18:46:03 +00:00
taylor d0cf0ced4a dynamic allocation of num supported OpenGL lights
add config option for more realistic light settings
don't render spec maps in nebula to address lighting issue
2005-01-03 18:45:22 +00:00
phreak a6dbf2facd made custom loading screens work if only one resolution has been specified. 2005-01-03 01:05:08 +00:00
Goober5000 56da3a6bf6 got rid of a nasty nasty bug in the beam collision function, and cleaned up some of Bobboau's old comments
--Goober5000
2005-01-02 23:22:22 +00:00
taylor 55323b32f1 make use of MR_NO_FOGGING to render models without fog 2005-01-01 19:47:26 +00:00
taylor 49c005525e add MR_NO_FOGGING flag to easily render models without fog (warp model, targetbox models) 2005-01-01 19:45:32 +00:00
wmcoolmon fafb5bd1e8 Erg, always make sure CVS is completely up-to-date. 2005-01-01 19:37:05 +00:00
argv 075fdeaa5c Since Taylor's asteroid targeting code does not use the
TURRETS_SHOOT_ASTEROIDS #define, remove it from preprocdefines.h. We can
put it back from an old rev if people decide to use my code instead of his,
which seems unlikely.

-- _argv[-1]
2005-01-01 13:14:19 +00:00
taylor 065ec54a46 good OpenGL spec mapping
fix VBO crash with multitexture using same uv coord data
little speedup of opengl_tcache_frame()
error message to make sure hardware supports the minimum texture size
move OpenGL version check out of the extention printout code
disable 2d_poof with OpenGL
2005-01-01 11:24:23 +00:00
taylor e7eb31a0df asteroid targetting code for capships, enabled by default, matches FS1 behavior 2005-01-01 10:38:23 +00:00
wmcoolmon d340b8da04 NEW_HUD stuff, turned off this time. :) It's in a state of disrepair at the moment, doesn't show anything. 2005-01-01 07:18:48 +00:00
Goober5000 a17eca915c CVS checkin of bitarray.h; use this for large arrays of boolean values
--Goober5000
2004-12-31 03:48:12 +00:00
argv 149629e1e2 I've just been informed that turrets do not shoot asteroids in the retail
game, and that this implementation causes them to shoot at the parent ship,
too. I'll deal with this later; in the mean time, use
"#define TURRETS_SHOOT_ASTEROIDS" to cause turrets to shoot asteroids.

-- _argv[-1]
2004-12-31 03:13:08 +00:00
Goober5000 05948719b1 stupid parenthesis fix
--Goober5000
2004-12-30 21:41:24 +00:00
taylor c2e4c526d0 don't use cfopen() for upgrade check, it was giving strange results 2004-12-30 16:25:22 +00:00
taylor 4da2a92335 make sure swprintf() doesn't think szFile is already a wide-character string 2004-12-30 16:23:39 +00:00
argv 65b1250353 * For some reason, turret AI wasn't shooting at asteroids. It never has,
but it did in the retail game, and it should. The code to target asteroids
  was apparently missing, so I reimplemented it, and turrets shoot at
  asteroids again.
2004-12-30 08:07:52 +00:00
argv 562cf1e47a Quick hack to remove the 50% rate-of-fire penalty when primary weapons are
linked. "#define NO_LINKED_PRIMARY_PENALTY" to enable this change; it's
disabled by default.

-- _argv[-1]
2004-12-30 07:26:21 +00:00
taylor 7ae710ace6 make sure the file gets closed in pilot_file_upgrade_check() 2004-12-28 16:20:33 +00:00
taylor 611ce79893 fix some hud stuff getting drawn multiple times, don't show target data if HUD_disabled_except_messages is set 2004-12-26 22:45:58 +00:00
Goober5000 5ceb4a2291 hud-disable-except-messages now resets after each mission
--Goober5000
2004-12-26 20:46:34 +00:00
wmcoolmon 4f719b2c4d Fixed text not displaying for single-weapon sips. 2004-12-25 19:17:23 +00:00
wmcoolmon 4b5f47441b Quick update to tempfix possible bug. 2004-12-25 17:45:38 +00:00
wmcoolmon 6b3c4a3bbe Fixed a couple of blonde moments. 2004-12-25 17:02:18 +00:00
wmcoolmon 2f8c97d99d Fix to modular tables workaround with Fs2NetD 2004-12-25 16:42:59 +00:00
wmcoolmon 3d527efc50 Sync to current NEW_HUD code 2004-12-25 09:28:41 +00:00
wmcoolmon 7dd62135a3 Fix to modular tables workaround with Fs2NetD + Sync to current NEW_HUD code 2004-12-25 09:27:41 +00:00
wmcoolmon 4071a37ef4 Fix to modular tables workaround with Fs2NetD 2004-12-25 09:25:41 +00:00
wmcoolmon dd6eea5406 Ogg support for WIN32 2004-12-25 00:23:46 +00:00
wmcoolmon 840a2b37b5 Added .ogg in proper directories 2004-12-25 00:22:54 +00:00
Goober5000 762d41f41c resorted command-line options and added an option for WMC's ballistic gauge
--Goober5000
2004-12-24 19:36:12 +00:00
wmcoolmon e0b48bec6f NEW_HUD compiles now. :) 2004-12-24 05:07:05 +00:00
wmcoolmon 28b3a8cffa Proposed HUD system stuffs - within NEW_HUD defines. 2004-12-24 01:07:19 +00:00
wmcoolmon 431335b27d Ballistic primary ammo-gauge to the right of the HUD, support for weapon images in list. 2004-12-24 00:41:23 +00:00
wmcoolmon 237ae621a4 Removed unneccessary function call (.0000001 ms speed increase!) 2004-12-23 23:36:30 +00:00
wmcoolmon f959999594 Added +Hud Image: for weapons, which replaces the weapon name in the list with an image. 2004-12-23 23:35:02 +00:00
wmcoolmon 997d57faae Proposed HUD system stuffs - within NEW_HUD defines. 2004-12-23 23:30:45 +00:00
wmcoolmon 1f2a891c7a Proposed HUD system stuffs - within NEW_HUD defines. 2004-12-23 23:08:21 +00:00
phreak 911528b6d7 commits for scramble-messages and unscramble-messages
-phreak
2004-12-23 15:58:55 +00:00
phreak 9b6620e21c added a pragma message if DevIL isn't compiled into the build 2004-12-22 23:05:48 +00:00
taylor 17fc45faba add a popup to make sure people know about pilot upgrade 2004-12-22 21:49:05 +00:00
taylor 59add586e3 safety check against very large missions 2004-12-22 21:48:21 +00:00
taylor bb472f8669 version bump to 3.6.5 2004-12-22 21:47:37 +00:00
wmcoolmon 2f807f5793 Quick fix to hudparse.cpp; If this causes any problems, roll it back and I'll take another look at it. 2004-12-22 09:09:38 +00:00
fryday a770aeab31 Fixed a tiny error in bob's code in d3d_init_environment (which seems to be called even
if there's no -env command-line) which created the cube-map and didn't check
if the creation of it failed. Added the same sanity check to d3d_render_to_env
2004-12-20 20:28:15 +00:00
fryday afa8e9b947 Commented out ATL dependencies (And changed one macro to an swprintf instead)
Tiny change in animplay ( pow(2.0, ...) instead of pow(2, ...)) because VS2K5
throws an ambiguity error over that.
2004-12-20 20:18:30 +00:00
taylor 6c733d9f7b fix crash from dynamically allocated Personas 2004-12-17 06:43:01 +00:00
Goober5000 4474d26e5b move wing name initialization to ship_level_init
--Goober5000
2004-12-15 17:32:19 +00:00
Goober5000 9ca91d3518 commented dumbfire lead indicator back in, because you need to know where your missiles are going
--Goober5000
2004-12-15 15:22:23 +00:00
Goober5000 d4823f735a added Verify, an error checking macro that works in both release and debug modes
--Goober5000
2004-12-15 15:14:03 +00:00
Goober5000 4f87d063b8 new version of stristr that doesn't need to allocate memory
--Goober5000
2004-12-14 17:23:52 +00:00
Goober5000 eaae1243e6 allow different wing names than ABGDEZ
--Goober5000
2004-12-14 14:46:13 +00:00
wmcoolmon 3ce44dcdfa Apparently I never commited -mpnoreturn... 2004-12-11 09:37:50 +00:00
wmcoolmon 17f4291b70 Changed music modular table ending to *-mus.tbm, in case a miscellaneous modular table is needed. 2004-12-11 09:03:08 +00:00
taylor 31019d38a2 dymanic allocation of Personas 2004-12-10 17:21:00 +00:00
taylor bca69ce180 fix old V bug when cancelling the pilot select screen 2004-12-05 23:47:18 +00:00
bobboau f56c5d230e sevral feature additions that WCS wanted,
and the foundations of a submodel animation system,
the calls to the animation triggering code (exept the procesing code,
wich shouldn't do anything without the triggering code)
have been commented out.
2004-12-05 22:01:12 +00:00
taylor 45caba7c72 support uncompressed DDS images
use TexSubImage2D for video anis
2004-12-05 01:28:39 +00:00
taylor 0fc13dfa87 text of -no_set_gamma cmdline option shouldn't specify D3D since it works in OGL too 2004-12-02 11:20:33 +00:00
taylor f5b60aa156 make OGL use same gamma reg setting as D3D since it's the same ramp
have OGL respect the -no_set_gamma cmdline option
reset gamma to default on OGL exit to make sure the desktop doesn't stay wrong
2004-12-02 11:18:15 +00:00
taylor 023d5ffab0 not used at the moment but that code was stupid 2004-12-02 11:14:29 +00:00
taylor a4760e9c70 little reorg to flags so Experimental won't show up twice
add/update the wiki links since none of them worked before
remove all options that require an argument since they won't work
2004-11-29 18:04:53 +00:00
taylor a58587d3a5 make sure we are checking the right bitmap_id 2004-11-29 18:02:01 +00:00
taylor 3b35a4f9c1 more EFF fixes - can't believe I forgot all this crap 2004-11-27 22:08:21 +00:00
taylor 6ddaabcead Linux tree merge 2004-11-27 10:51:01 +00:00
taylor d706747bd1 correct positions for default graphics with no table
compiler warning fix
2004-11-27 10:50:32 +00:00
taylor 503ea74554 make sure the old behavior still applies to everything that's not a beam 2004-11-27 10:49:14 +00:00
taylor 128a6d840f some fixes for position problems on the HUD in non-standard resolutions
few compiler warning fixes
2004-11-27 10:48:03 +00:00
taylor a0b4747c57 this should get movies working again in D3D and help OGL too 2004-11-27 10:42:18 +00:00
taylor e237b9d8ba couple of LAN game vs. FS2NetD fixes 2004-11-26 08:41:11 +00:00
taylor 0bd342af4a fix briefing related crash(es) (forgot I had this) 2004-11-24 20:12:25 +00:00
taylor 1c8018a5ab fix 2d warp in D3D, add cmdline option for 3d warp 2004-11-23 19:29:13 +00:00
taylor 5760eaf5fc try and protect the bitmap_entry stuff a bit better
fix the transparent support ship, again, but correctly this time
2004-11-23 00:10:06 +00:00
taylor ea4341a938 make sure species_defs.tbl can be found outside of root[0] and in VPs 2004-11-22 06:17:57 +00:00
Kazan a410c7f132 dumbbugfix 2004-11-21 16:07:22 +00:00
Kazan 83f954520c conflict res 2004-11-21 15:59:45 +00:00
taylor 29963bfe39 support for animated beam sections
various weapon-only-used fixes
remove the -1 frame fix since it was fixed elsewhere
2004-11-21 11:38:17 +00:00
taylor 163b45fdab some weapon-only-used loading fixes and general page-in cleanup
page in all ship textures from one function rather than two
2004-11-21 11:35:17 +00:00
taylor 73eda1ee69 page in all frames at once rather than separately (old code that wasn't updated) 2004-11-21 11:33:23 +00:00
taylor 2ea42c0928 newline fix (got tired of seeing this) 2004-11-21 11:31:46 +00:00
taylor af3afff65c move warning fixes from il_func.cpp to irc.cpp since that's where they are coming from 2004-11-21 11:31:02 +00:00
taylor 1651717c41 make hud_disabled_except_messages() do everything at once, add it to hud_show_radar() and hud_show_target_model() so those don't show up (bug #271) 2004-11-21 11:29:53 +00:00
taylor 71b718a3b9 some 64-bit OS comaptibility fixes 2004-11-21 11:27:31 +00:00
taylor c619e7b3b7 split bm_load_sub() into fast (memory only) and slow (disk only) versions
EFF bug fix for fps and much better error handling
2004-11-21 11:26:39 +00:00
Goober5000 6e5ee3312d #pragma'd a bunch of warnings
--Goober5000
2004-11-18 00:05:37 +00:00
Goober5000 14b29354bb added two new sexps
--Goober5000
2004-11-17 22:23:13 +00:00
taylor 9460f0c613 don't set gamma ramp while running FRED 2004-11-04 22:49:13 +00:00
taylor ff083e9600 note to self: copy is down pat, now just learn how to paste, moron 2004-11-04 08:33:44 +00:00
taylor 008a450cfd animate weapon glow/bitmaps properly while in flight, make sure
we don't exceed bitmap frame numbers, don't try to calculate
frame for particle spew animations since particle_render_all()
does that for us already
2004-11-02 08:32:38 +00:00
Goober5000 1e5edb91a7 tweaked some project settings
--Goober5000
2004-11-02 01:48:20 +00:00
taylor 863475d8d0 make use of Knossos_warp_ani_used flag - thanks Goober5000 2004-11-01 20:57:04 +00:00
taylor 5194bb5f80 new pilot code 2004-10-31 22:07:27 +00:00
taylor 2c6f07a416 compiler warning fixes, maybe fix issue that would cause cap ships to not fire beam weapons 2004-10-31 22:06:42 +00:00
taylor 664c3bf797 s/OGL_inited/OGL_enabled/g 2004-10-31 22:05:30 +00:00
taylor 031b923385 be sure to initialize splodeing_texture, fix issue that would cause loading problems for glows 2004-10-31 22:04:33 +00:00
taylor db75f373b3 little cleanup 2004-10-31 22:02:47 +00:00
taylor d2badfc49e new bmpman merge support, add PreProcDefines.h a few new places 2004-10-31 22:00:57 +00:00
taylor 200588c3b0 support external parsing sources without hurting currently parsing file (for EFF code) 2004-10-31 21:57:30 +00:00
taylor 5511c94080 new bmpman support, new OGL fixes don't need the freaky neb lighting fix anymore 2004-10-31 21:56:09 +00:00
taylor e4460b46f3 s/fisrt/first/g 2004-10-31 21:55:00 +00:00
taylor bd3855b315 new pilot code support, no-multiplayer and compiler warning fixes, center mouse cursor for redalert missions 2004-10-31 21:53:24 +00:00
taylor 00f6a2ee32 fix math error that was hitting Assert()'s and making OGL models flip around for no reason 2004-10-31 21:49:49 +00:00
taylor 4594df128c faster setting of 0 spec values (Kazan), comment out second (dumbfire?) lead indicator since it just looked wierd constantly being offset 2004-10-31 21:48:42 +00:00
taylor a3b330bdf5 bmpman merge 2004-10-31 21:46:38 +00:00
taylor 01a1403f67 Linux tree merge, better DDS support, texture panning 2004-10-31 21:46:10 +00:00
taylor a09c6beb5c Linux tree merge, single array for VBOs/HTL 2004-10-31 21:45:13 +00:00
taylor d589bcd911 Linux tree merge, use linear mag filter, small FRED fix, AA lines (disabled), use rgba colors for 3dunlit, proper gamma adjustment, bmpman merge 2004-10-31 21:42:31 +00:00
taylor 401dbfc523 move some otherwise bmpman stuff into grd3dbmpman.cpp 2004-10-31 21:40:11 +00:00
taylor 6cc7c6fcbd bmpman merge 2004-10-31 21:39:24 +00:00
taylor 7e37fee039 reinit device if lost - one of the D3D people should make sure this isn't stupid 2004-10-31 21:38:25 +00:00
taylor 0e2d84c60e s/fisrt/first/g, bmpman merge 2004-10-31 21:36:39 +00:00
taylor 647a03d53c OGL_enabled, s/fisrt/first/g 2004-10-31 21:35:53 +00:00
taylor 97e7b62860 rename __ASSERT check to _ASSERT to fix constant warning message - why did no one else fix this? 2004-10-31 21:34:39 +00:00
taylor da03d81df6 rename OGL_inited to OGL_enabled to match D3D version 2004-10-31 21:33:05 +00:00
taylor 194717b0c8 no networking with Inferno builds, basic 64-bit OS support 2004-10-31 21:32:27 +00:00
taylor ccf5d144b5 bump COUNT_ESTIMATE, reset time compression at the start of a mission, new pilot file support, add feature_disabled popup 2004-10-31 21:31:34 +00:00
taylor 87552b959c lots of cleanup with support for bmpman changes, full Linux/OSX support 2004-10-31 21:30:01 +00:00
taylor 1a384df3ce EFF animation support 2004-10-31 21:29:00 +00:00
taylor bf0a46d3f6 support new pilot code, Linux code tree merge, don't use same pilot directory for Inferno builds 2004-10-31 21:28:38 +00:00
taylor e0570a7677 bmpman merge, EFF animation support, better page in stuff, dozen or so smaller fixes and cleanup 2004-10-31 21:26:27 +00:00
taylor 738c92e036 change case of opengl files so I can stop worrying, add gropenglbmpman files 2004-10-31 21:24:11 +00:00
taylor 56e60218b3 #define if !#defined, add USE_DEVIL and FS2_SPEECH commented out 2004-10-31 21:23:08 +00:00
taylor 0dad90aa7f initial import from bmpman merge 2004-10-31 21:21:11 +00:00
Goober5000 9abdc3e9ae whoops
--Goober5000
2004-10-31 02:26:15 +00:00
Goober5000 35e62e4777 added Knossos_warp_ani_used flag for taylor
--Goober5000
2004-10-31 02:04:34 +00:00
taylor aa5d98a918 make sure all spec colors are set to 0 in hud_tri() 2004-10-18 17:13:36 +00:00
Goober5000 6e0f31092e fixed FRED bug that changed special arguments to (null)
--Goober5000
2004-10-18 09:27:47 +00:00
phreak 1c98f5954d Made WMCoolmon's hud target info brackets recognize alt-names
--phreak
2004-10-15 13:10:06 +00:00
Goober5000 19b5126542 added change-alt-name
--Goober5000
2004-10-15 10:03:09 +00:00
Goober5000 b5fa66428c cleaned up some sexp stuff and added wing capability to kamikaze sexp
--Goober5000
2004-10-15 09:21:55 +00:00
Goober5000 6a0d138a08 extra coding insurance
--Goober5000
2004-10-15 08:14:07 +00:00
Goober5000 14804a1396 tweakage
--Goober5000
2004-10-14 23:03:37 +00:00
Goober5000 38dbeab543 added ability for variable names to be used as special arguments
--Goober5000
2004-10-14 22:28:27 +00:00
Goober5000 41fdb82dd1 more ubersexp bugfixing
--Goober5000
2004-10-14 01:19:17 +00:00
Goober5000 91af9dbfc0 fixed a few when-argument bugs
--Goober5000
2004-10-13 10:46:49 +00:00
Goober5000 c3cc9f8e21 added toggle-subsystem-scanning ship flag
--Goober5000
2004-10-12 22:47:15 +00:00
Goober5000 1429123da4 added contrail speed threshold
--Goober5000
2004-10-12 07:34:45 +00:00
Goober5000 93973d4a49 added the no-bank ship flag (which works) and the affected-by-gravity flag
(which won't work until I implement gravity points)
--Goober5000
2004-10-11 22:29:25 +00:00
taylor df028f3714 make sure windowed mode gets the correct size 2004-10-10 22:15:10 +00:00
taylor 6937a4d1e2 warp mouse to center screen on mission start 2004-10-10 22:12:57 +00:00
taylor 19680f4ebd holy crap at the copy-paste error 2004-10-10 16:59:37 +00:00
taylor 8a450c6b4d almost forgot this for the IBX stuff 2004-10-09 18:08:33 +00:00
taylor dacc345814 one more try to fix the memory leak and end-of-mission crash for talking head anis 2004-10-09 17:58:48 +00:00
taylor 349459c502 better debugging for g3_end_frame() - mostly for FRED2 2004-10-09 17:54:32 +00:00
taylor fc9655bde3 safer handling of missing shield ani 2004-10-09 17:51:23 +00:00
taylor faac91b3be da simple IBX code, back to old line rendering for models since it should be faster for OGL now 2004-10-09 17:48:58 +00:00
taylor eaa75f0a3f da simple IBX code 2004-10-09 17:45:45 +00:00
taylor 6ca850fbe6 don't use DevIL to read the header, slightly more sane error checking 2004-10-09 17:44:10 +00:00
Kazan f035fff922 interface corruption fix - thanks taylor (MAX_BITMAPS upped to 7000) 2004-10-06 22:02:54 +00:00
Kazan 625220a856 Autopilot convergence collision fix for ai_fly_to_ship() and ai_waypoints() -- mathematically expensive, only usable by autopilot 2004-10-03 21:41:11 +00:00
Kazan 134aeb0085 fix autopilot formation bug 2004-09-28 22:51:41 +00:00
Kazan 7d51c61184 | is binary or, || is boolean or - please use the right one
autopilot velocity ramping biasing
made debugged+k kill guardianed ships
2004-09-28 19:54:32 +00:00
taylor ec523fdf0b fix logic error, may be support ship rearm fix 2004-09-26 20:58:29 +00:00
taylor 849e22dfff handle lost devices better, fix movie crash 2004-09-26 16:24:51 +00:00
taylor d334ab504a proper OGL line drawing in HTL... hopefully 2004-09-24 22:40:23 +00:00
Goober5000 09f3d78d1c some ubersexp fixes
--Goober5000
2004-09-24 02:13:00 +00:00
Goober5000 363313ee59 fixed two bugs... still more bugs to be found :p
--Goober5000
2004-09-23 23:52:58 +00:00
Goober5000 48371badfc ubersexp implementation complete
--Goober5000
2004-09-23 22:51:07 +00:00
Goober5000 cd3bb82030 a bunch of work on the actual implementation of when-argument
--Goober5000
2004-09-23 05:53:00 +00:00
Goober5000 2f0a9985de further work on ubersexp framework
--Goober5000
2004-09-22 21:52:22 +00:00
Goober5000 83887ad91b fixed some small problems in the framework - should be working nicely now;
next step is the actual sexp implementation :-P
--Goober5000
2004-09-22 08:32:05 +00:00
Goober5000 7c6bde8551 checking in framework for when-argument special ubersexp
--Goober5000
2004-09-22 06:56:45 +00:00
tbird d355d6be5c Modified the image loading to accept 24 and 32 bit images 2004-09-22 03:50:13 +00:00
Goober5000 35441575e7 a bit of reordering
--Goober5000
2004-09-17 08:07:52 +00:00
Goober5000 92424ee0e3 changed around the logic for the 3D warp effect
--Goober5000
2004-09-17 07:12:23 +00:00
Goober5000 bb4974a467 moved ssm stuff to header file so it would work in FRED
--Goober5000
2004-09-17 07:11:02 +00:00
Goober5000 d5cc98338e removed player-not-use-ai and changed player-use-ai to take an argument
--Goober5000
2004-09-17 00:28:32 +00:00
Goober5000 ea30714b53 changed toggle-hud to hud-disable; added hud-disable-except-messages
--Goober5000
2004-09-17 00:18:18 +00:00
et1 12ce22b1a4 Use yellow warp anim when doing exit jump with "-tbpwarpeffects" 2004-09-10 13:55:49 +00:00
et1 e2865c4576 Implemented "+WeaponMinRange" token. Fixed a crash issue with fighter launch checks 2004-09-10 13:54:21 +00:00
et1 14cbcbf2ac Command line option for TBP for warp stuff, "-tbpwarpeffects" 2004-09-10 13:51:45 +00:00
et1 c71f96710f Implemented "+WeaponMinRange" token 2004-09-10 13:50:09 +00:00
Goober5000 f787dd331d fix0red something weird
--Goober5000
2004-09-05 20:05:16 +00:00
Goober5000 33b42b554e whoops, fixed this for debug mode
--Goober5000
2004-09-05 19:41:31 +00:00
Goober5000 5ac6b0a787 we definitely want browse info... and Sticks wants a mapfile too
--Goober5000
2004-09-05 19:25:02 +00:00
Goober5000 11ae968eb6 fixed a few warnings
--Goober5000
2004-09-05 19:23:24 +00:00
Goober5000 48a882755e MultiUi.cpp should not be in the "Freespace2" project
--Goober5000
2004-09-05 18:42:31 +00:00
Goober5000 a179aa698b fixed a warning
--Goober5000
2004-09-02 04:02:44 +00:00
phreak a69435baa1 MISSION_FLAG_USE_NEW_AI fixes for bomber+ missile selection, rapid dumbfire
firing and primary weapons selection
2004-09-01 01:26:20 +00:00
phreak 2f4ff28011 created the mission flag MISSION_FLAG_USE_NEW_AI
this lets old missions use the retail AI so they are balanced.  new missions would
be able to select this in fred so designers can take advantage of it.
2004-09-01 00:58:46 +00:00
Goober5000 6cef921092 fixed a small bug in the custom hitpoints mod
--Goober5000
2004-09-01 00:22:36 +00:00
Goober5000 4c53554eae when calculating damage for scoring, don't count beams unless they're fired by a fighter or bomber
--Goober5000
2004-08-31 23:36:28 +00:00
Kazan ec7681b75d small standalone-related multibug fix
prohibited execution of process_debug_keys(int) while Game_mode & GM_MULTIPLAYER
2004-08-26 18:19:36 +00:00
Goober5000 0d46b06833 fix0red some warnings
--Goober5000
2004-08-23 07:48:09 +00:00
Goober5000 6316b4a4e4 warp effect is back to FS2 default
--Goober5000
2004-08-23 04:32:40 +00:00
Goober5000 85d7186bf6 ship-tag and ship-untag sexps
--Goober5000
2004-08-23 04:32:06 +00:00
Goober5000 b5ae16e463 ship-tag and ship-untag
--Goober5000
2004-08-23 04:00:15 +00:00
Goober5000 acbb64b9b4 modularized tag stuff in preparation for sexp
--Goober5000
2004-08-23 03:34:34 +00:00
Kazan 63af0632df wakka wakka - fix minor booboo 2004-08-20 05:13:08 +00:00
Kazan 60d31003cf added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this 2004-08-11 05:06:36 +00:00
phreak cb22efe237 fixed the -orbradar launcher string 2004-08-08 02:56:54 +00:00
phreak 3a7f5f7320 added radarorb.cpp and radarorb.h to project 2004-08-05 02:18:17 +00:00
phreak bf2870d53b forgot to commit orb change 2004-08-05 02:15:27 +00:00
phreak 5024413d68 orb radar rendering style 2004-08-02 22:54:07 +00:00
phreak e418257394 orb radar rendering style 2004-08-02 22:43:03 +00:00
phreak 4640a5eea4 added -orbradar to enable orb rendering for the radar 2004-08-02 22:40:59 +00:00
phreak c55568852b -phreak command line changed to -dualscanlines 2004-08-01 02:31:18 +00:00
et1 21448785ec Implemented "+SwarmWait:"-token and fixed weapon glow tails 2004-07-31 08:58:07 +00:00
et1 4acd808412 Implemented "+SwarmWait:"-token 2004-07-31 08:57:22 +00:00
et1 806e9eefd1 Fixed inaccuracy problems with non-homing swarmers 2004-07-31 08:54:38 +00:00
et1 4634470897 Make missing briefing icon message to tell the icon missing 2004-07-31 08:53:46 +00:00
et1 670d6a9078 If weapon loadout anim is missing, warn instead of int3 2004-07-31 08:52:45 +00:00
et1 1bf056b5ca Disabled ship shield load check for TBP 2004-07-31 08:51:47 +00:00
Kazan 3aae4e73f2 bugfixes 2004-07-29 23:41:22 +00:00
Kazan bd64ca2cb9 unbug the JS bug i caused --- kazan 2004-07-29 19:37:50 +00:00
taylor 1c6ef1c02c fix NULL pointer and try to prevent in future, remove excess commands in opengl_cleanup() 2004-07-29 09:35:29 +00:00
Kazan 1119146fcd fs2_open.exe was suffering the same problem as fred2 -- it was just a little less obvious 2004-07-29 03:49:44 +00:00
taylor 45d5f46063 plug memory leaks 2004-07-29 03:41:46 +00:00
Kazan a5407aff0a making another bug a little bit more dead inside :D 2004-07-27 20:09:12 +00:00
Kazan be1fba0b34 squished another 2004-07-27 18:52:11 +00:00
Kazan d1186a73ab i love it when bugs go crunch (autopilot ai fixup) 2004-07-27 18:04:09 +00:00
Goober5000 cb8f3dd3e2 outline of ship-tag and ship-untag sexps
--Goober5000
2004-07-26 21:26:45 +00:00
Goober5000 33144fdad4 updated launcher link
--Goober5000
2004-07-26 21:19:05 +00:00
Kazan 89e6af4fb5 remove MCD complete 2004-07-26 20:47:56 +00:00
Kazan a1c0d95647 remove MCD 2004-07-26 20:19:04 +00:00
Kazan a4dbb0ee88 add conditional compilation directive 2004-07-26 19:39:49 +00:00
Kazan a4e1bcfd2d Autopilot system completed -- i am dropping plans for GUI nav map
All builds should have ENABLE_AUTO_PILOT defined from now on (.dsp's i am committing reflect this) the system will only be noticed if the mission designer brings it online by defining a nav point
Fixed FPS counter during time compression
2004-07-26 17:54:05 +00:00
Goober5000 3ad5ea54fb last bit of Unix fixorage
--Goober5000
2004-07-26 17:50:02 +00:00
Goober5000 2b9cdc2689 more #ifndef fixorage
--Goober5000
2004-07-26 17:39:20 +00:00
Goober5000 5a9eee5a12 fixored a problem when using the command-line compiler to compile everything under Windows
--Goober5000
2004-07-26 16:11:41 +00:00
Kazan ff8edc4adc only disable afterburning during AIM_WAYPOINTS and AIM_FLY_TO_SHIP while AutoPilotEngaged 2004-07-25 19:27:51 +00:00
Kazan d83dbd88c4 -fred_no_warn has become -no_warn and applies to both fred and fs2
added new ai directive (last commit) and disabled afterburners while performing AIM_WAYPOINTS or AIM_FLY_TO_SHIP
fixed player ship speed bug w/ player-use-ai, now stays in formation correctly and manages speed
made -radar_reduce ignore itself if no parameter is given (ignoring launcher bug)
2004-07-25 18:46:30 +00:00
Kazan 7af6e41fa1 i have absolutely nothing to say about that subject 2004-07-25 00:31:31 +00:00
taylor b3c084db06 fix problem with sectioned menu bitmaps in OGL 2004-07-21 00:03:46 +00:00
wmcoolmon 37cdc6a4fe Fixed ifdef, was missing ship_decal_system otherwise 2004-07-20 04:03:21 +00:00
Kazan e9a29ac2e6 nothing major 2004-07-18 04:07:26 +00:00
taylor f7ffb89690 stupid braces... 2004-07-17 19:01:15 +00:00
taylor 77fcc86c14 fix set_*_matrix overcompensation, makes OGL work again 2004-07-17 18:59:01 +00:00
taylor f0dddf2854 oops, I can't spell 2004-07-17 18:49:57 +00:00
taylor d23c3a6e4d various OGL and memory leak fixes 2004-07-17 18:46:09 +00:00
taylor 26726238b5 don't use bitmap sections by default, openil_close() 2004-07-17 18:43:46 +00:00
taylor 51d8809a22 Bob say we fix OGL, so me fix OGL <grunt> 2004-07-17 18:40:40 +00:00
taylor 92e696a6ea force image orientation in DevIL 2004-07-17 18:38:04 +00:00
taylor cae2b33d34 make old warpmap and new glow bitmap 3D unlit to render right in OGL 2004-07-17 09:29:13 +00:00
taylor e1ab4e4532 add CF_SORT_REVERSE to real sort routine, makes CF_SORT_TIME work again 2004-07-17 09:26:00 +00:00
taylor 21fe0590ed make sure avi and mpg movies get added to file cache 2004-07-17 09:03:29 +00:00
taylor 0d76068eb8 add .deps directory to ignored entries 2004-07-17 09:00:38 +00:00
taylor f6faea6f81 misspelled filename 2004-07-17 08:59:25 +00:00
wmcoolmon 72c34be6f9 I though I fixed this... 2004-07-15 00:16:46 +00:00
wmcoolmon 65da0763f7 Better -load_only_used handling; added mark_weapon_used(weapon ID), which does check for IDs of -1. 2004-07-14 01:27:01 +00:00
wmcoolmon baed9715df Better -load_only_used handling 2004-07-14 01:26:10 +00:00
Kazan 8d2fa0418a adding mcd 2004-07-12 16:37:01 +00:00
Kazan f7dd512ba8 MCD - define _MCD_CHECK to use memory tracking 2004-07-12 16:33:09 +00:00
Kazan 9c9006f55e fix a small multibug in tables validation (I had added this once before.. where did it go) 2004-07-12 14:38:13 +00:00
wmcoolmon 177698e014 More in-game stuff, mostly for restricted games 2004-07-12 03:34:55 +00:00
wmcoolmon 70834437dd Only send ships on the player's team 2004-07-12 03:26:03 +00:00
Kazan a501d4b688 removed a couple pointless useless messages from the debug console 2004-07-12 03:19:17 +00:00
wmcoolmon cb0360016d ... 2004-07-12 03:04:33 +00:00
wmcoolmon 55f179db5c Oops. :p 2004-07-12 03:04:03 +00:00
wmcoolmon e8c844b32a Ingame joining stuff - use -rt to enabled/disable 2004-07-12 02:50:48 +00:00
bobboau b8fb999660 added the working decal code 2004-07-11 03:22:54 +00:00
wmcoolmon 93964edfed Fixed bug with the base ship flag I unwittingly introduced. 2004-07-10 08:03:13 +00:00
Kazan 3a89eeffc9 minor bugfixes - oh yeah reenabling a rule for multistats :P 2004-07-10 03:18:23 +00:00
Kazan 72ac50ca24 fs2netd 1.0 RC5 full support - Rank and Medal updates 2004-07-09 22:05:32 +00:00
wmcoolmon 6f8e5b4447 Fixed conditional. 2004-07-09 07:32:55 +00:00
wmcoolmon 64efe3e91c Fixed HUD escort list for dogfight mode, and for any usage. 2004-07-09 05:53:05 +00:00
wmcoolmon eda444a92b Re-implemented nomotiondebris, as Bobb overwrote it when he commited his changes. 2004-07-09 05:52:19 +00:00
wmcoolmon 7999173fc7 Moved set_current_hud, as well as added a conditional to hud_positions_it; it shouldn't and won't be executed on a standalone server. 2004-07-08 22:08:21 +00:00
wmcoolmon a4c2329316 Moving set_current_hud, to ensure compatibility with multiplayer. 2004-07-08 22:06:56 +00:00
Kazan e2b8ce4d5d fixed a typo in one of the fs2netd strings
played with WMCoolmon's hacked up escort list
2004-07-07 23:34:08 +00:00
Kazan 13ee198069 FS2NetD: C2S Ping/Pong, C2S Ping/Pong, Global IP Banlist, Global Network Messages 2004-07-07 21:00:08 +00:00
Kazan 84e74a8abf minor multi fix 2004-07-06 23:45:34 +00:00
Kazan a1903268ad small multifix 2004-07-06 19:59:37 +00:00
bobboau f36d1802df FVF code, only the data that is needed is sent off to the card,,
OGL can take advantage of this if they want but it won't break
anything if they don't. also state block code has been implemented,
that's totaly internal to D3D no high level code is involved.
2004-07-05 05:09:21 +00:00
wmcoolmon a8beea705e Replaced some more Int3s with Warnings and Errors. 2004-07-03 08:23:00 +00:00
wmcoolmon 0e60209a24 Error handling for fire_beam instead of just calling Int3() 2004-07-03 07:55:22 +00:00
wmcoolmon 5187223a76 Removed function pointer w/ default arguments for compatibility with .NET Sorry, you'll just have to add that "0" by hand. :p 2004-07-03 06:08:54 +00:00
Kazan d99263ed75 working on autonav 2004-07-01 16:38:19 +00:00
phreak eb489320e1 function pointer radar update.
will enable us to make different radar styles that we can switch between
2004-07-01 02:07:54 +00:00
phreak 1b906e0369 function pointer radar update.
will enable us to make different radar styles that we can switch between
2004-07-01 01:54:59 +00:00
bobboau 5019375c1f implemented index buffered background bitmaps,
OGL people you realy should get this implemented
2004-07-01 01:12:33 +00:00
wmcoolmon 3f1f149312 Support as well as the extern for "-load_only_used"; this way everything that includes cmdline.h doesn't have to be recompiled. 2004-06-29 06:02:34 +00:00
wmcoolmon 698f4e0e16 Added "-load_only_used", which makes FS2 load only used weapon data 2004-06-29 06:00:45 +00:00
wmcoolmon c089510571 Fixed weapon miniinfo display 2004-06-28 10:00:33 +00:00
bobboau e2bb83fbdb high level index buffer suport and d3d implementation,
OGL people need to get this working on your end as it's broke now
2004-06-28 02:13:08 +00:00
wmcoolmon 16b030459f Bad return 2004-06-27 01:48:17 +00:00
wmcoolmon 2fbdb960f6 Unneccessary warning removed, small change for VC6. 2004-06-27 01:47:16 +00:00
wmcoolmon e80f8b391d Commented out ogg header 2004-06-27 01:45:23 +00:00
wmcoolmon 231f9a0246 Minor optimizations and removal of an errant !stricmp 2004-06-26 19:24:24 +00:00
wmcoolmon eb26a123cf Minor optimizations 2004-06-26 19:23:54 +00:00
wmcoolmon 2b8c618b27 Displayed escorts now settable up to MAX_COMPLETE_ESCORT_LIST via "$Max Escort Ships:" in hud_gauges.tbl
Escort list is now hud_gauges.tbl compatible.
2004-06-26 03:19:53 +00:00
wmcoolmon 7d0c23b02b Added "-targetinfo" to toggle info next to targeted object. 2004-06-26 00:28:05 +00:00
wmcoolmon 1fc27844ce Basic target info next to targeted object. 2004-06-26 00:27:20 +00:00
wmcoolmon d6d0be0a3c Added teh FS2 ogg support files. Not in the project so you still don't need the SDK. 2004-06-22 23:15:17 +00:00
wmcoolmon 94b5611023 Nonworking OGG support for sound (not music) added, disabled load-only-used-weapons code, modification to sound system registry code.
OGG code has been commented out, so you don't need the SDK yet.
2004-06-22 23:14:10 +00:00
wmcoolmon 5142d17030 Added support for -nomotiondebris 2004-06-19 22:16:20 +00:00
wmcoolmon 6bcd42f543 Added -nomotion debris command line option; also re-ordered categories. 2004-06-19 22:15:48 +00:00
randomtiger d00f29b663 Changed startup code to catch D3D9 request from launcher.
No actual startup code has been implemented.
2004-06-19 12:45:47 +00:00
wmcoolmon 633d2c58e2 Only used weapons paged in instead of all, fixed music box in FRED, sound quality settable with SoundSampleRate and SoundSampleBits registry values 2004-06-18 04:59:55 +00:00
wmcoolmon 55d46b3801 Bumped MAX_MISSION_MESSAGES to 500 2004-06-15 21:05:30 +00:00
wmcoolmon d329ae66ae Bumped MAX_SEXP_NODES to 3500 2004-06-15 21:04:18 +00:00
wmcoolmon 54d0d3bd2c Added hud-set-color and get-current-speed 2004-06-15 20:49:22 +00:00
wmcoolmon 9a50e83dce hud-set-color SEXP 2004-06-09 00:18:50 +00:00
wmcoolmon a98bc2643a Fix0red the current target's hud info appearing in the corner of the screen. 2004-06-08 01:12:58 +00:00
wmcoolmon 3bf411f705 Added +Color: option for custom gauges. 2004-06-08 00:35:43 +00:00
wmcoolmon 2d0dc11c64 Warpout failure bug fixingness 2004-06-07 07:36:08 +00:00
randomtiger 30c3556abc Commented out mprintf, it was swamping debug console.
Uncommented some code which I hope has plugged the memory leak.
2004-06-06 20:04:28 +00:00
randomtiger 6a3569280a Added new compression option -pcx32dds, build posted in RSB forum.
Changed flag because of launcher bug, have fixed launcher bug, will distribute later.
Also removed experimental flag from launcher flag list, stupid people were reporting bugs on unfinished code.
2004-06-06 12:25:20 +00:00
randomtiger 76215199f1 Added pcx compression option -pcx32dds, build posted in RSB forum.
Also removed experimental flag from launcher flag list, stupid people were reporting bugs on unfinished code.
2004-06-06 11:16:42 +00:00
wmcoolmon 3d8b7de265 More HUD update stuff. Coordinates are now floats, addparent is now obsolete. 2004-06-05 23:31:12 +00:00
phreak 4bc768fc32 spawn weapons can now be specified to be spawned at different angles other than
the sphere thats used in retail
2004-06-05 19:15:39 +00:00
phreak e34938c8dc added static_random_cone which is used for spawn angle features in multi 2004-06-05 19:14:42 +00:00
wmcoolmon 254efe0d53 Lotsa stuff. Custom gauges w/ ANIs support added, SEXPs to set gauge text, gauge image frames, and gauge coords. These SEXPs and toggle-hud reside in the Hud/change category. 2004-06-01 07:31:57 +00:00
wmcoolmon cdfd1299f0 Update to make images (not animations) work 2004-05-31 08:54:13 +00:00
wmcoolmon c005dc7dad Custom HUD support, better loading, etc etc. 2004-05-31 08:32:25 +00:00
wmcoolmon 9193af0210 Final draft of the HUD parsing system structure. May change how individual coord positions are specified in the TBL. -C 2004-05-30 08:04:49 +00:00
wmcoolmon 12eef3702d First bugfix in this!: Don't want Freespace exiting if it can't load a hud_gauge file. 2004-05-29 04:09:04 +00:00
wmcoolmon 480175df7d Added HUD gauges placement table, "hud_gauges.tbl" or "*-hdg.tbm" table module 2004-05-29 03:02:53 +00:00
wmcoolmon 8ae9aaebf8 Spotted something that might be a problem. 2004-05-29 03:01:00 +00:00
wmcoolmon e7ac8a5d12 Added stuff_float_list 2004-05-29 02:52:17 +00:00
wmcoolmon 6710e15c5c Modular music tables 2004-05-28 23:37:30 +00:00
wmcoolmon f5c586edaf Made HUD.tbl obsolete. Info is now taken directly from $Shield_icon in ships.tbl
Now this table can be used for something more useful...say, hud gauge positions?
2004-05-27 00:49:26 +00:00
wmcoolmon 16163aad45 Fixed cf_matches_spec; small bug was introduced. 2004-05-26 22:02:36 +00:00
wmcoolmon 1cb372a8e7 Added weapons_expl modular table, updated cfilesystem to work with modular tables, fixed loading order, fixed ship loading error messages 2004-05-26 21:02:27 +00:00
wmcoolmon e22820c475 Ship & weapon modular table files 2004-05-26 03:52:08 +00:00
wmcoolmon 9469dee1b8 Modular ship table support. Uses *-shp.tbm , with the same structure as a normal ships.tbl. Individual sections are optional and entries with the same name will override previous settings. -C 2004-05-26 02:31:39 +00:00
wmcoolmon 71aecd3927 Scratch that - .tbm is a better extension 2004-05-26 02:29:44 +00:00
wmcoolmon a8f2fb5c24 Added table chunk extension 2004-05-26 02:26:14 +00:00
wmcoolmon 5a4a0f9710 Updated function calls for VC7 use 2004-05-25 00:38:11 +00:00
wmcoolmon f5bbbff05b cleared up an ambiguous call for VC7 2004-05-25 00:26:25 +00:00
wmcoolmon fc0251d305 Updated to use <fstream> instead of <fstream.h> and fixed an un/signed disagreement 2004-05-25 00:24:00 +00:00
wmcoolmon 7129774def Updated to use <iostream> instead of <iostream.h> 2004-05-25 00:21:39 +00:00
taylor fc71fe2c0e filename case change 2004-05-24 07:25:32 +00:00
taylor de55362fe1 filename case change 2004-05-24 07:14:13 +00:00
taylor 4df953f3bd The Great Linux Merge 2004-05-24 07:04:25 +00:00
taylor a867b1979c add .cvsingore files 2004-05-24 04:12:07 +00:00
taylor 8acb0872ac autoconf/automake cleanup 2004-05-24 04:10:47 +00:00
703 changed files with 139639 additions and 44804 deletions

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
Makefile
Makefile.in
configure
FS2_Open.prj
FS2_Open.prj.bak
FS2_Open.pws
.tm_project.cache
config.guess
config.cache
config.log
config.status
config.sub
depcomp
install-sh
missing
mkinstalldirs
autom4te*
aclocal.m4
Freespace2.dsp
Freespace2.dsw
Freespace2.ncb
Freespace2.opt
Freespace2.plg
Release
Debug
+64 -1
View File
@@ -2,4 +2,67 @@
#
# This file uses GNU Automake to generate makefiles
SUBDIRS = code
SUBDIRS = libjpeg code
EXTRA_DIST = \
FS2OpenSCPReadMe.doc \
projects/MSVC_2005/Freespace2.sln \
projects/MSVC_2005/Freespace2.vcproj \
projects/MSVC_2005/code.vcproj \
projects/MSVC_6/Freespace2.dsp \
projects/MSVC_6/Freespace2.dsw \
projects/MSVC_6/code.dsp \
projects/MSVC_6/libjpeg.dsp \
projects/MSVC_6/wxFRED2.dsp \
projects/anjuta1/FS2_Open.prj \
projects/anjuta1/README
# D_ variants are defaults and should always be used
AM_CXXFLAGS = -I./code @D_CFLAGS@
AM_LDFLAGS = @D_LDFLAGS@
EXTRA_PROGRAMS = cfilearchiver cfileextractor cryptstring scramble
###############################################################################
##
## Begin utilitites
##
# cfilearchiver -- to create VPs
cfilearchiver_SOURCES = \
code/cfilearchiver/cfilearchiver.cpp
# cfileextractor -- to extract files from VPs
cfileextractor_SOURCES = \
code/cfileextractor/cfileextractor.cpp
# cryptstring -- to encrypt strings that are used as cheat codes
cryptstring_SOURCES = \
code/cryptstring/cryptstring.cpp
# scramble -- to encrypt tables
scramble_SOURCES = \
code/parse/encrypt.cpp \
code/scramble/scramble.cpp \
code/scramble/scramble.h
# catch all to build utilitites
tools: cfilearchiver cfileextractor cryptstring scramble
# cleaning
clean-tools:
-test -z "$(EXTRA_PROGRAMS)" || rm -f $(EXTRA_PROGRAMS)
##
## End utilitites
##
###############################################################################
# make sure we get this stuff cleaned up
clean-generic: clean-tools
-506
View File
@@ -1,506 +0,0 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am for fs2_open (top level)
#
# This file uses GNU Automake to generate makefiles
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DX8_INCLUDE = @DX8_INCLUDE@
DX8_LIB = @DX8_LIB@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
FS2_GRSOFT_FALSE = @FS2_GRSOFT_FALSE@
FS2_GRSOFT_TRUE = @FS2_GRSOFT_TRUE@
FS2_JOYSTICK_FALSE = @FS2_JOYSTICK_FALSE@
FS2_JOYSTICK_TRUE = @FS2_JOYSTICK_TRUE@
FS2_NETWORKING_FALSE = @FS2_NETWORKING_FALSE@
FS2_NETWORKING_TRUE = @FS2_NETWORKING_TRUE@
FS2_OS_UNIX_FALSE = @FS2_OS_UNIX_FALSE@
FS2_OS_UNIX_TRUE = @FS2_OS_UNIX_TRUE@
FS2_OS_WIN32_FALSE = @FS2_OS_WIN32_FALSE@
FS2_OS_WIN32_TRUE = @FS2_OS_WIN32_TRUE@
FS2_SOUND_FALSE = @FS2_SOUND_FALSE@
FS2_SOUND_TRUE = @FS2_SOUND_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = code
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
DIST_SOURCES =
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in NEWS aclocal.m4 config.guess config.sub configure \
configure.in depcomp install-sh missing mkinstalldirs
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
.SUFFIXES:
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): configure.in
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = .
distdir = $(PACKAGE)-$(VERSION)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist dist-all: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck:
cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf autom4te.cache
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-recursive ctags ctags-recursive dist \
dist-all dist-gzip distcheck distclean distclean-generic \
distclean-recursive distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am dvi-recursive info info-am \
info-recursive install install-am install-data install-data-am \
install-data-recursive install-exec install-exec-am \
install-exec-recursive install-info install-info-am \
install-info-recursive install-man install-recursive \
install-strip installcheck installcheck-am installdirs \
installdirs-am installdirs-recursive maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
mostlyclean-generic mostlyclean-recursive pdf pdf-am \
pdf-recursive ps ps-am ps-recursive tags tags-recursive \
uninstall uninstall-am uninstall-info-am \
uninstall-info-recursive uninstall-recursive
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+5 -1
View File
@@ -1,4 +1,8 @@
This file is required to keep autoconf/automake from complaining.
The "projects" directory contains ready projects for:
Microsoft Visual C++ 6
Microsoft Visual C++ 2005
Anjuta 1 (please see README with project before using)
See the ChangeLog to see what's new.
See the INSTALL file for instructions on how to build fs2_open.
+382
View File
@@ -0,0 +1,382 @@
# Configure paths for SDL
# Sam Lantinga 9/21/99
# stolen from Manish Singh
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
dnl
AC_DEFUN([AM_PATH_SDL],
[dnl
dnl Get the cflags and libraries from the sdl-config script
dnl
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
sdl_prefix="$withval", sdl_prefix="")
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
sdl_exec_prefix="$withval", sdl_exec_prefix="")
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
, enable_sdltest=yes)
if test x$sdl_exec_prefix != x ; then
sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
fi
fi
if test x$sdl_prefix != x ; then
sdl_args="$sdl_args --prefix=$sdl_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_prefix/bin/sdl-config
fi
fi
AC_REQUIRE([AC_CANONICAL_TARGET])
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
min_sdl_version=ifelse([$1], ,0.11.0,$1)
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
no_sdl=""
if test "$SDL_CONFIG" = "no" ; then
no_sdl=yes
else
SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_sdltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
dnl
dnl Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent
dnl
rm -f conf.sdltest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[])
{
int major, minor, micro;
char *tmp_version;
/* This hangs on some systems (?)
system ("touch conf.sdltest");
*/
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_sdl_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_sdl_version");
exit(1);
}
if (($sdl_major_version > major) ||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_sdl" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$SDL_CONFIG" = "no" ; then
echo "*** The sdl-config script installed by SDL could not be found"
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the SDL_CONFIG environment variable to the"
echo "*** full path to sdl-config."
else
if test -f conf.sdltest ; then
:
else
echo "*** Could not run SDL test program, checking why..."
CFLAGS="$CFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include "SDL.h"
int main(int argc, char *argv[])
{ return 0; }
#undef main
#define main K_and_R_C_main
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding SDL or finding the wrong"
echo "*** version of SDL. If it is not finding SDL, 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 SDL was incorrectly installed"
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
SDL_CFLAGS=""
SDL_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
rm -f conf.sdltest
])
dnl ---------------------------------------------------------------------------
dnl Macros for wxWindows detection. Typically used in configure.in as:
dnl
dnl AC_ARG_ENABLE(...)
dnl AC_ARG_WITH(...)
dnl ...
dnl AM_OPTIONS_WXCONFIG
dnl ...
dnl ...
dnl AM_PATH_WXCONFIG(2.3.4, wxWin=1)
dnl if test "$wxWin" != 1; then
dnl AC_MSG_ERROR([
dnl wxWindows must be installed on your system
dnl but wx-config script couldn't be found.
dnl
dnl Please check that wx-config is in path, the directory
dnl where wxWindows libraries are installed (returned by
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
dnl equivalent variable and wxWindows version is 2.3.4 or above.
dnl ])
dnl fi
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
dnl
dnl LDFLAGS="$LDFLAGS $WX_LIBS"
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl AM_OPTIONS_WXCONFIG
dnl
dnl adds support for --wx-prefix, --wx-exec-prefix and --wx-config
dnl command line options
dnl ---------------------------------------------------------------------------
AC_DEFUN([AM_OPTIONS_WXCONFIG],
[
AC_ARG_WITH(wx-prefix, [ --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional)],
wx_config_prefix="$withval", wx_config_prefix="")
AC_ARG_WITH(wx-exec-prefix,[ --with-wx-exec-prefix=PREFIX Exec prefix where wxWindows is installed (optional)],
wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
AC_ARG_WITH(wx-config,[ --with-wx-config=CONFIG wx-config script to use (optional)],
wx_config_name="$withval", wx_config_name="")
])
dnl ---------------------------------------------------------------------------
dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Test for wxWindows, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
dnl (the latter is for static linking against wxWindows). Set WX_CONFIG_NAME
dnl environment variable to override the default name of the wx-config script
dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
dnl case the macro won't even waste time on tests for its existence.
dnl ---------------------------------------------------------------------------
dnl
dnl Get the cflags and libraries from the wx-config script
dnl
AC_DEFUN([AM_PATH_WXCONFIG],
[
dnl do we have wx-config name: it can be wx-config or wxd-config or ...
if test x${WX_CONFIG_NAME+set} != xset ; then
WX_CONFIG_NAME=wx-config
fi
if test "x$wx_config_name" != x ; then
WX_CONFIG_NAME="$wx_config_name"
fi
dnl deal with optional prefixes
if test x$wx_config_exec_prefix != x ; then
wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
fi
if test x$wx_config_prefix != x ; then
wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
fi
dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
if test -x "$WX_CONFIG_NAME" ; then
AC_MSG_CHECKING(for wx-config)
WX_CONFIG_PATH="$WX_CONFIG_NAME"
AC_MSG_RESULT($WX_CONFIG_PATH)
else
AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH")
fi
if test "$WX_CONFIG_PATH" != "no" ; then
WX_VERSION=""
no_wx=""
min_wx_version=ifelse([$1], ,2.2.1,$1)
AC_MSG_CHECKING(for wxWindows version >= $min_wx_version)
WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args"
WX_VERSION=`$WX_CONFIG_WITH_ARGS --version`
wx_config_major_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
wx_config_minor_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
wx_config_micro_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
wx_requested_major_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
wx_requested_minor_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
wx_requested_micro_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
wx_ver_ok=""
if test $wx_config_major_version -gt $wx_requested_major_version; then
wx_ver_ok=yes
else
if test $wx_config_major_version -eq $wx_requested_major_version; then
if test $wx_config_minor_version -gt $wx_requested_minor_version; then
wx_ver_ok=yes
else
if test $wx_config_minor_version -eq $wx_requested_minor_version; then
if test $wx_config_micro_version -ge $wx_requested_micro_version; then
wx_ver_ok=yes
fi
fi
fi
fi
fi
if test "x$wx_ver_ok" = x ; then
no_wx=yes
else
WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs`
WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs`
dnl starting with version 2.2.6 wx-config has --cppflags argument
wx_has_cppflags=""
if test $wx_config_major_version -gt 2; then
wx_has_cppflags=yes
else
if test $wx_config_major_version -eq 2; then
if test $wx_config_minor_version -gt 2; then
wx_has_cppflags=yes
else
if test $wx_config_minor_version -eq 2; then
if test $wx_config_micro_version -ge 6; then
wx_has_cppflags=yes
fi
fi
fi
fi
fi
if test "x$wx_has_cppflags" = x ; then
dnl no choice but to define all flags like CFLAGS
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
WX_CPPFLAGS=$WX_CFLAGS
WX_CXXFLAGS=$WX_CFLAGS
WX_CFLAGS_ONLY=$WX_CFLAGS
WX_CXXFLAGS_ONLY=$WX_CFLAGS
else
dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags`
WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags`
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
fi
fi
if test "x$no_wx" = x ; then
AC_MSG_RESULT(yes (version $WX_VERSION))
ifelse([$2], , :, [$2])
else
if test "x$WX_VERSION" = x; then
dnl no wx-config at all
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
fi
WX_CFLAGS=""
WX_CPPFLAGS=""
WX_CXXFLAGS=""
WX_LIBS=""
WX_LIBS_STATIC=""
ifelse([$3], , :, [$3])
fi
fi
AC_SUBST(WX_CPPFLAGS)
AC_SUBST(WX_CFLAGS)
AC_SUBST(WX_CXXFLAGS)
AC_SUBST(WX_CFLAGS_ONLY)
AC_SUBST(WX_CXXFLAGS_ONLY)
AC_SUBST(WX_LIBS)
AC_SUBST(WX_LIBS_STATIC)
AC_SUBST(WX_VERSION)
])
+137
View File
@@ -0,0 +1,137 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
PKG_NAME="fs2_open"
# check the version of a package
check_version() {
COMMAND=$1
MAJOR=$2
MINOR=$3
MICRO=$4
($COMMAND --version) </dev/null >/dev/null 2>&1 || return 1
ver=`$COMMAND --version|head -n 1|sed 's/^.*) //'|sed 's/ (.*)//'`
major=`echo $ver | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
minor=`echo $ver | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
micro=`echo $ver | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
test -z "$major" && major=0
test -z "$minor" && minor=0
test -z "$micro" && micro=0
fail=0
if [ ! "$major" -gt "$MAJOR" ]; then
if [ "$major" -lt "$MAJOR" ]; then
fail=1
elif [ ! "$minor" -gt "$MINOR" ]; then
if [ "$minor" -lt "$MINOR" ]; then
fail=1
elif [ "$micro" -lt "$MICRO" ]; then
fail=1
fi
fi
fi
return "$fail"
}
AUTOMAKE=
ACLOCAL=
DIE=0
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`autoconf' installed to."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
for AM in automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake; do
(check_version "$AM" 1 6 1) && {
AUTOMAKE="$AM"
break
}
done
if [ -z "$AUTOMAKE" ]; then
echo
echo "**Error**: You must have \`automake' version 1.6.1 or greater"
echo "installed to compile $PKG_NAME. Download the appropriate package"
echo "for your distribution, or get the source tarball at"
echo "ftp://ftp.gnu.org/pub/gnu/"
DIE=1
fi
# if no automake, don't bother testing for aclocal
test -z "$AUTOMAKE" || {
for ACL in aclocal-1.9 aclocal-1.8 aclocal-1.7 aclocal-1.6 aclocal; do
(check_version "$ACL" 1 6 1) && {
ACLOCAL="$ACL"
break
}
done
if [ -z "$ACLOCAL" ]; then
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed seems to be outdated. Get a recent package from"
echo "ftp://ftp.gnu.org/pub/gnu/"
DIE=1
fi
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
for coin in `find $srcdir -name configure.ac -print`
do
dr=`dirname $coin`
if test -f $dr/NO-AUTO-GEN; then
echo skipping $dr -- flagged as no auto-gen
else
echo processing $dr
macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
( cd $dr
aclocalinclude="$ACLOCAL_FLAGS"
for k in $macrodirs; do
if test -d $k; then
aclocalinclude="$aclocalinclude -I $k"
##else
## echo "**Warning**: No such directory \`$k'. Ignored."
fi
done
echo "Running $ACLOCAL $aclocalinclude ..."
"$ACLOCAL" $aclocalinclude
echo "Running $AUTOMAKE --add-missing --copy --foreign $am_opt ..."
"$AUTOMAKE" --add-missing --copy --foreign $am_opt
echo "Running autoconf..."
autoconf
)
fi
done
#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@" \
&& echo Now type \`make\' to compile $PKG_NAME.
else
echo Skipping configure process.
fi
+5
View File
@@ -0,0 +1,5 @@
Makefile
Makefile.in
fs2_open_d
fs2_open_r
.deps
+650 -283
View File
@@ -1,305 +1,672 @@
# code/Makefile.am for fs2_open
#
# $Id: Makefile.am,v 1.2 2003-03-11 19:00:05 penguin Exp $
## code/Makefile.am for fs2_open
##
## $Id: Makefile.am,v 1.20 2005-07-18 03:37:35 taylor Exp $
noinst_PROGRAMS = fs2
fs2_SOURCES = \
anim/animplay.cpp \
anim/packunpack.cpp \
asteroid/asteroid.cpp \
bmpman/bmpman.cpp \
cfile/cfile.cpp \
cfile/cfilearchive.cpp \
cfile/cfilelist.cpp \
cfile/cfilesystem.cpp \
cmdline/cmdline.cpp \
cmeasure/cmeasure.cpp \
controlconfig/controlsconfig.cpp \
controlconfig/controlsconfigcommon.cpp \
cutscene/cutscenes.cpp \
debris/debris.cpp \
debugconsole/console.cpp \
decals/decals.cpp \
demo/demo.cpp \
exceptionhandler/exceptionhandler.cpp \
fireball/fireballs.cpp \
fireball/warpineffect.cpp \
freespace2/freespace.cpp \
freespace2/levelpaging.cpp \
gamehelp/contexthelp.cpp \
gamehelp/gameplayhelp.cpp \
gamesequence/gamesequence.cpp \
globalincs/alphacolors.cpp \
globalincs/crypt.cpp \
globalincs/systemvars.cpp \
globalincs/version.cpp \
graphics/2d.cpp \
graphics/aaline.cpp \
graphics/bitblt.cpp \
graphics/circle.cpp \
graphics/colors.cpp \
graphics/font.cpp \
graphics/gradient.cpp \
graphics/gropengl.cpp \
graphics/grzbuffer.cpp \
graphics/line.cpp \
graphics/pixel.cpp \
graphics/rect.cpp \
graphics/scaler.cpp \
graphics/shade.cpp \
hud/hud.cpp \
hud/hudartillery.cpp \
hud/hudbrackets.cpp \
hud/hudconfig.cpp \
hud/hudescort.cpp \
hud/hudets.cpp \
hud/hudlock.cpp \
hud/hudmessage.cpp \
hud/hudreticle.cpp \
hud/hudshield.cpp \
hud/hudsquadmsg.cpp \
hud/hudtarget.cpp \
hud/hudtargetbox.cpp \
hud/hudwingmanstatus.cpp \
io/key.cpp \
io/keycontrol.cpp \
io/mouse.cpp \
io/timer.cpp \
jumpnode/jumpnode.cpp \
lighting/lighting.cpp \
localization/fhash.cpp \
localization/localize.cpp \
math/fix.cpp \
math/floating.cpp \
math/fvi.cpp \
math/spline.cpp \
math/staticrand.cpp \
math/vecmat.cpp \
menuui/barracks.cpp \
menuui/credits.cpp \
menuui/fishtank.cpp \
menuui/mainhallmenu.cpp \
menuui/mainhalltemp.cpp \
menuui/optionsmenu.cpp \
menuui/playermenu.cpp \
menuui/readyroom.cpp \
menuui/snazzyui.cpp \
menuui/techmenu.cpp \
menuui/trainingmenu.cpp \
mission/missionbriefcommon.cpp \
mission/missioncampaign.cpp \
mission/missiongoals.cpp \
mission/missiongrid.cpp \
mission/missionhotkey.cpp \
mission/missionload.cpp \
mission/missionlog.cpp \
mission/missionmessage.cpp \
mission/missionparse.cpp \
mission/missiontraining.cpp \
missionui/missionbrief.cpp \
missionui/missioncmdbrief.cpp \
missionui/missiondebrief.cpp \
missionui/missionloopbrief.cpp \
missionui/missionpause.cpp \
missionui/missionrecommend.cpp \
missionui/missionscreencommon.cpp \
missionui/missionshipchoice.cpp \
missionui/missionstats.cpp \
missionui/missionweaponchoice.cpp \
missionui/redalert.cpp \
model/modelcollide.cpp \
model/modelinterp.cpp \
model/modeloctant.cpp \
model/modelread.cpp \
nebula/neb.cpp \
nebula/neblightning.cpp \
object/collidedebrisship.cpp \
object/collidedebrisweapon.cpp \
object/collideshipship.cpp \
object/collideshipweapon.cpp \
object/collideweaponweapon.cpp \
object/objcollide.cpp \
object/object.cpp \
object/objectsort.cpp \
observer/observer.cpp \
palman/palman.cpp \
parse/encrypt.cpp \
parse/parselo.cpp \
parse/sexp.cpp \
particle/particle.cpp \
pcxutils/pcxutils.cpp \
physics/physics.cpp \
playerman/managepilot.cpp \
playerman/playercontrol.cpp \
popup/popup.cpp \
popup/popupdead.cpp \
radar/radar.cpp \
render/3dclipper.cpp \
render/3ddraw.cpp \
render/3dlaser.cpp \
render/3dmath.cpp \
render/3dsetup.cpp \
ship/afterburner.cpp \
ship/ai.cpp \
ship/aibig.cpp \
ship/aicode.cpp \
ship/aigoals.cpp \
ship/awacs.cpp \
ship/shield.cpp \
ship/ship.cpp \
ship/shipcontrails.cpp \
ship/shipfx.cpp \
ship/shiphit.cpp \
starfield/nebula.cpp \
starfield/starfield.cpp \
starfield/supernova.cpp \
stats/medals.cpp \
stats/scoring.cpp \
stats/stats.cpp \
tgautils/tgautils.cpp \
ui/button.cpp \
ui/checkbox.cpp \
ui/gadget.cpp \
ui/icon.cpp \
ui/inputbox.cpp \
ui/keytrap.cpp \
ui/listbox.cpp \
ui/radio.cpp \
ui/scroll.cpp \
ui/slider.cpp \
ui/slider2.cpp \
ui/uidraw.cpp \
ui/uimouse.cpp \
ui/window.cpp \
weapon/beam.cpp \
weapon/corkscrew.cpp \
weapon/emp.cpp \
weapon/flak.cpp \
weapon/muzzleflash.cpp \
weapon/shockwave.cpp \
weapon/swarm.cpp \
weapon/trails.cpp \
weapon/weapons.cpp
EXTRA_DIST = \
freespace2/app_icon.ico \
freespace2/freespace.rc \
freespace2/freespaceresource.h \
freespace2/goal_com.bmp \
freespace2/goal_fail.bmp \
freespace2/goal_inc.bmp \
freespace2/goal_none.bmp \
freespace2/goal_ord.bmp \
wxfred2/res/FRED.ico \
wxfred2/wxfred.xrc
# D_ variants are defaults and should always be used
# FS2_ variants are for game building and wxFRED
AM_CXXFLAGS = @D_CFLAGS@ @FS2_CXXFLAGS@
AM_LDFLAGS = @D_LDFLAGS@ @FS2_LDFLAGS@
noinst_LIBRARIES = libcode.a
noinst_PROGRAMS = @FS2_BINARY@
EXTRA_PROGRAMS = fs2_open_r fs2_open_d wxFRED2_r wxFRED2_d
###############################################################################
##
## Begin CORE library
##
FS2_SOURCES = \
ai/ai.cpp \
ai/ai.h \
ai/aibig.cpp \
ai/aibig.h \
ai/aicode.cpp \
ai/aigoals.cpp \
ai/aigoals.h \
ai/aiinternal.h \
ai/ailocal.h \
ai/aiturret.cpp \
anim/animplay.cpp \
anim/animplay.h \
anim/packunpack.cpp \
anim/packunpack.h \
asteroid/asteroid.cpp \
asteroid/asteroid.h \
autopilot/autopilot.cpp \
autopilot/autopilot.h \
bmpman/bm_internal.h \
bmpman/bmpman.cpp \
bmpman/bmpman.h \
camera/camera.cpp \
camera/camera.h \
cfile/cfile.cpp \
cfile/cfile.h \
cfile/cfilearchive.cpp \
cfile/cfilearchive.h \
cfile/cfilelist.cpp \
cfile/cfilesystem.cpp \
cfile/cfilesystem.h \
cmdline/cmdline.cpp \
cmdline/cmdline.h \
cmeasure/cmeasure.cpp \
cmeasure/cmeasure.h \
controlconfig/controlsconfig.cpp \
controlconfig/controlsconfig.h \
controlconfig/controlsconfigcommon.cpp \
cutscene/cutscenes.cpp \
cutscene/cutscenes.h \
cutscene/movie.cpp \
cutscene/movie.h \
ddsutils/ddsutils.cpp \
ddsutils/ddsutils.h \
debris/debris.cpp \
debris/debris.h \
debugconsole/console.cpp \
debugconsole/dbugfile.h \
debugconsole/timerbar.cpp \
debugconsole/timerbar.h \
decals/decals.cpp \
decals/decals.h \
demo/demo.cpp \
demo/demo.h \
exceptionhandler/exceptionhandler.cpp \
exceptionhandler/exceptionhandler.h \
fireball/fireballs.cpp \
fireball/fireballs.h \
fireball/warpineffect.cpp \
fs2open_pxo/Client.cpp \
fs2open_pxo/Client.h \
fs2open_pxo/TCP_Client.cpp \
fs2open_pxo/TCP_Socket.cpp \
fs2open_pxo/TCP_Socket.h \
fs2open_pxo/protocol.h \
fs2open_pxo/udpsocket.cpp \
fs2open_pxo/udpsocket.h \
gamehelp/contexthelp.cpp \
gamehelp/contexthelp.h \
gamehelp/gameplayhelp.cpp \
gamehelp/gameplayhelp.h \
gamesequence/gamesequence.cpp \
gamesequence/gamesequence.h \
globalincs/alphacolors.cpp \
globalincs/alphacolors.h \
globalincs/crypt.cpp \
globalincs/crypt.h \
globalincs/globals.h \
globalincs/linklist.h \
globalincs/pstypes.h \
globalincs/systemvars.cpp \
globalincs/systemvars.h \
globalincs/version.cpp \
globalincs/version.h \
graphics/2d.cpp \
graphics/2d.h \
graphics/font.cpp \
graphics/font.h \
graphics/grbatch.cpp \
graphics/grbatch.h \
graphics/grinternal.h \
graphics/gropengl.cpp \
graphics/gropengl.h \
graphics/gropenglbmpman.cpp \
graphics/gropenglbmpman.h \
graphics/gropenglextension.cpp \
graphics/gropenglextension.h \
graphics/gropengllight.cpp \
graphics/gropengllight.h \
graphics/gropengltexture.cpp \
graphics/gropengltexture.h \
graphics/gropengltnl.cpp \
graphics/gropengltnl.h \
graphics/grstub.h \
graphics/grzbuffer.cpp \
graphics/grzbuffer.h \
graphics/line.h \
graphics/tmapper.h \
hud/hud.cpp \
hud/hud.h \
hud/hudartillery.cpp \
hud/hudartillery.h \
hud/hudbrackets.cpp \
hud/hudbrackets.h \
hud/hudconfig.cpp \
hud/hudconfig.h \
hud/hudescort.cpp \
hud/hudescort.h \
hud/hudets.cpp \
hud/hudets.h \
hud/hudgauges.h \
hud/hudlock.cpp \
hud/hudlock.h \
hud/hudmessage.cpp \
hud/hudmessage.h \
hud/hudnavigation.cpp \
hud/hudnavigation.h \
hud/hudobserver.cpp \
hud/hudobserver.h \
hud/hudparse.cpp \
hud/hudparse.h \
hud/hudresource.h \
hud/hudreticle.cpp \
hud/hudreticle.h \
hud/hudshield.cpp \
hud/hudshield.h \
hud/hudsquadmsg.cpp \
hud/hudsquadmsg.h \
hud/hudtarget.cpp \
hud/hudtarget.h \
hud/hudtargetbox.cpp \
hud/hudtargetbox.h \
hud/hudwingmanstatus.cpp \
hud/hudwingmanstatus.h \
io/key.cpp \
io/key.h \
io/keycontrol.cpp \
io/keycontrol.h \
io/mouse.cpp \
io/mouse.h \
io/timer.cpp \
io/timer.h \
irc/irc.cpp \
irc/irc.h \
jpgutils/jpgutils.cpp \
jpgutils/jpgutils.h \
jumpnode/jumpnode.cpp \
jumpnode/jumpnode.h \
lab/lab.cpp \
lab/lab.h \
lab/wmcgui.cpp \
lab/wmcgui.h \
lighting/lighting.cpp \
lighting/lighting.h \
localization/fhash.cpp \
localization/fhash.h \
localization/localize.cpp \
localization/localize.h \
math/bitarray.h \
math/fix.cpp \
math/fix.h \
math/floating.cpp \
math/floating.h \
math/fvi.cpp \
math/fvi.h \
math/spline.cpp \
math/spline.h \
math/staticrand.cpp \
math/staticrand.h \
math/vecmat.cpp \
math/vecmat.h \
menuui/barracks.cpp \
menuui/barracks.h \
menuui/credits.cpp \
menuui/credits.h \
menuui/fishtank.cpp \
menuui/fishtank.h \
menuui/mainhallmenu.cpp \
menuui/mainhallmenu.h \
menuui/mainhalltemp.cpp \
menuui/mainhalltemp.h \
menuui/optionsmenu.cpp \
menuui/optionsmenu.h \
menuui/optionsmenumulti.cpp \
menuui/optionsmenumulti.h \
menuui/playermenu.cpp \
menuui/playermenu.h \
menuui/readyroom.cpp \
menuui/readyroom.h \
menuui/snazzyui.cpp \
menuui/snazzyui.h \
menuui/storybook.cpp \
menuui/storybook.h \
menuui/techmenu.cpp \
menuui/techmenu.h \
menuui/trainingmenu.cpp \
menuui/trainingmenu.h \
mission/missionbriefcommon.cpp \
mission/missionbriefcommon.h \
mission/missioncampaign.cpp \
mission/missioncampaign.h \
mission/missiongoals.cpp \
mission/missiongoals.h \
mission/missiongrid.cpp \
mission/missiongrid.h \
mission/missionhotkey.cpp \
mission/missionhotkey.h \
mission/missionload.cpp \
mission/missionload.h \
mission/missionlog.cpp \
mission/missionlog.h \
mission/missionmessage.cpp \
mission/missionmessage.h \
mission/missionparse.cpp \
mission/missionparse.h \
mission/missiontraining.cpp \
mission/missiontraining.h \
missionui/chatbox.cpp \
missionui/chatbox.h \
missionui/missionbrief.cpp \
missionui/missionbrief.h \
missionui/missioncmdbrief.cpp \
missionui/missioncmdbrief.h \
missionui/missiondebrief.cpp \
missionui/missiondebrief.h \
missionui/missionloopbrief.cpp \
missionui/missionloopbrief.h \
missionui/missionpause.cpp \
missionui/missionpause.h \
missionui/missionrecommend.cpp \
missionui/missionrecommend.h \
missionui/missionscreencommon.cpp \
missionui/missionscreencommon.h \
missionui/missionshipchoice.cpp \
missionui/missionshipchoice.h \
missionui/missionstats.cpp \
missionui/missionstats.h \
missionui/missionweaponchoice.cpp \
missionui/missionweaponchoice.h \
missionui/redalert.cpp \
missionui/redalert.h \
model/model.h \
model/modelcollide.cpp \
model/modelinterp.cpp \
model/modelsinc.h \
model/modeloctant.cpp \
model/modelread.cpp \
nebula/neb.cpp \
nebula/neb.h \
nebula/neblightning.cpp \
nebula/neblightning.h \
network/fs2ox.cpp \
network/fs2ox.h \
network/multi.cpp \
network/multi.h \
network/multilag.h \
network/multimsgs.cpp \
network/multimsgs.h \
network/multiteamselect.cpp \
network/multiteamselect.h \
network/multiui.cpp \
network/multiui.h \
network/multiutil.cpp \
network/multiutil.h \
network/multi_campaign.cpp \
network/multi_campaign.h \
network/multi_data.cpp \
network/multi_data.h \
network/multi_dogfight.cpp \
network/multi_dogfight.h \
network/multi_endgame.cpp \
network/multi_endgame.h \
network/multi_ingame.cpp \
network/multi_ingame.h \
network/multi_kick.cpp \
network/multi_kick.h \
network/multi_log.cpp \
network/multi_log.h \
network/multi_obj.cpp \
network/multi_obj.h \
network/multi_observer.cpp \
network/multi_observer.h \
network/multi_oo.h \
network/multi_options.cpp \
network/multi_options.h \
network/multi_pause.cpp \
network/multi_pause.h \
network/multi_pinfo.cpp \
network/multi_pinfo.h \
network/multi_ping.cpp \
network/multi_ping.h \
network/multi_pmsg.cpp \
network/multi_pmsg.h \
network/multi_rate.cpp \
network/multi_rate.h \
network/multi_respawn.cpp \
network/multi_respawn.h \
network/multi_team.cpp \
network/multi_team.h \
network/multi_update.h \
network/multi_voice.cpp \
network/multi_voice.h \
network/multi_xfer.cpp \
network/multi_xfer.h \
network/psnet.cpp \
network/psnet.h \
network/psnet2.cpp \
network/psnet2.h \
object/collidedebrisship.cpp \
object/collidedebrisweapon.cpp \
object/collideshipship.cpp \
object/collideshipweapon.cpp \
object/collideweaponweapon.cpp \
object/objcollide.cpp \
object/objcollide.h \
object/objectdock.cpp \
object/objectdock.h \
object/object.cpp \
object/object.h \
object/objectsort.cpp \
observer/observer.cpp \
observer/observer.h \
palman/palman.cpp \
palman/palman.h \
parse/encrypt.cpp \
parse/encrypt.h \
parse/parselo.cpp \
parse/parselo.h \
parse/sexp.cpp \
parse/sexp.h \
particle/particle.cpp \
particle/particle.h \
pcxutils/pcxutils.cpp \
pcxutils/pcxutils.h \
physics/physics.cpp \
physics/physics.h \
playerman/managepilot.cpp \
playerman/managepilot.h \
playerman/player.h \
playerman/playercontrol.cpp \
popup/popup.cpp \
popup/popup.h \
popup/popupdead.cpp \
popup/popupdead.h \
radar/radar.cpp \
radar/radar.h \
radar/radarorb.cpp \
radar/radarorb.h \
radar/radarsetup.cpp \
radar/radarsetup.h \
render/3d.h \
render/3dclipper.cpp \
render/3ddraw.cpp \
render/3dinternal.h \
render/3dlaser.cpp \
render/3dmath.cpp \
render/3dsetup.cpp \
ship/afterburner.cpp \
ship/afterburner.h \
ship/awacs.cpp \
ship/awacs.h \
ship/shield.cpp \
ship/ship.cpp \
ship/ship.h \
ship/shipcontrails.cpp \
ship/shipcontrails.h \
ship/shipfx.cpp \
ship/shipfx.h \
ship/shiphit.cpp \
ship/shiphit.h \
ship/subsysdamage.h \
species_defs/species_defs.cpp \
species_defs/species_defs.h \
starfield/nebula.cpp \
starfield/nebula.h \
starfield/starfield.cpp \
starfield/starfield.h \
starfield/supernova.cpp \
starfield/supernova.h \
stats/medals.cpp \
stats/medals.h \
stats/scoring.cpp \
stats/scoring.h \
stats/stats.cpp \
stats/stats.h \
tgautils/tgautils.cpp \
tgautils/tgautils.h \
ui/button.cpp \
ui/checkbox.cpp \
ui/gadget.cpp \
ui/icon.cpp \
ui/inputbox.cpp \
ui/keytrap.cpp \
ui/listbox.cpp \
ui/radio.cpp \
ui/scroll.cpp \
ui/slider.cpp \
ui/slider2.cpp \
ui/ui.h \
ui/uidefs.h \
ui/uidraw.cpp \
ui/uimouse.cpp \
ui/window.cpp \
weapon/beam.cpp \
weapon/beam.h \
weapon/corkscrew.cpp \
weapon/corkscrew.h \
weapon/emp.cpp \
weapon/emp.h \
weapon/flak.cpp \
weapon/flak.h \
weapon/muzzleflash.cpp \
weapon/muzzleflash.h \
weapon/shockwave.cpp \
weapon/shockwave.h \
weapon/swarm.cpp \
weapon/swarm.h \
weapon/trails.cpp \
weapon/trails.h \
weapon/weapons.cpp \
weapon/weapon.h
## conditional includes follow:
## joystic support sources
if FS2_JOYSTICK
fs2_SOURCES += \
io/joy.cpp \
io/joy_ff.cpp \
io/swff_lib.cpp
endif # FS2_JOYSTICK
if FS2_OS_WIN32
JOY_SOURCES = \
io/joy.cpp \
io/joy.h \
io/joy_ff.cpp \
io/joy_ff.h \
io/sw_error.hpp \
io/sw_force.h \
io/sw_guid.hpp \
io/swff_lib.cpp
endif
if FS2_OS_UNIX
JOY_SOURCES = \
io/joy.h \
io/joy-unix.cpp
endif
## networking support sources
if FS2_NETWORKING
fs2_SOURCES += \
hud/hudobserver.cpp \
network/multi.cpp \
network/multimsgs.cpp \
network/multiteamselect.cpp \
network/multiui.cpp \
network/multiutil.cpp \
network/multi_campaign.cpp \
network/multi_data.cpp \
network/multi_dogfight.cpp \
network/multi_endgame.cpp \
network/multi_ingame.cpp \
network/multi_kick.cpp \
network/multi_log.cpp \
network/multi_obj.cpp \
network/multi_observer.cpp \
network/multi_options.cpp \
network/multi_pause.cpp \
network/multi_pinfo.cpp \
network/multi_ping.cpp \
network/multi_pmsg.cpp \
network/multi_rate.cpp \
network/multi_respawn.cpp \
network/multi_team.cpp \
network/multi_voice.cpp \
network/multi_xfer.cpp \
network/psnet.cpp \
network/psnet2.cpp \
menuui/optionsmenumulti.cpp \
missionui/chatbox.cpp
endif # FS2_NETWORKING
if FS2_OS_WIN32
FS2_SOURCES += \
network/multilag.cpp \
network/stand_gui.cpp \
network/stand_gui.h
endif
if FS2_OS_UNIX
FS2_SOURCES += \
network/stand_gui-unix.cpp \
network/stand_gui.h
endif
## sound support sources
if FS2_SOUND
fs2_SOURCES += \
gamesnd/eventmusic.cpp \
gamesnd/gamesnd.cpp \
object/objectsnd.cpp \
sound/acm.cpp \
sound/audiostr.cpp \
sound/ds.cpp \
sound/ds3d.cpp \
sound/dscap.cpp \
sound/midifile.cpp \
sound/rbaudio.cpp \
sound/rtvoice.cpp \
sound/sound.cpp \
sound/winmidi.cpp \
sound/winmidi_base.cpp \
vcodec/codec1.cpp
endif # FS2_SOUND
SOUND_SOURCES = \
gamesnd/eventmusic.cpp \
gamesnd/eventmusic.h \
gamesnd/gamesnd.cpp \
gamesnd/gamesnd.h \
object/objectsnd.cpp \
object/objectsnd.h \
sound/ogg/ogg.cpp \
sound/ogg/ogg.h \
sound/audiostr-openal.cpp \
sound/audiostr.cpp \
sound/audiostr.h \
sound/acm-openal.cpp \
sound/acm.cpp \
sound/acm.h \
sound/ds.cpp \
sound/ds.h \
sound/ds3d.cpp \
sound/ds3d.h \
sound/midifile.cpp \
sound/midifile.h \
sound/midiseq.h \
sound/rbaudio.cpp \
sound/rbaudio.h \
sound/rtvoice.cpp \
sound/rtvoice.h \
sound/sound.cpp \
sound/sound.h \
sound/winmidi.cpp \
sound/winmidi.h \
sound/winmidi_base.cpp \
vcodec/codec1.cpp \
vcodec/codec1.h \
sound/fsspeech.cpp \
sound/fsspeech.h \
sound/speech.cpp \
sound/speech.h
## software-rendering support sources
if FS2_GRSOFT
fs2_SOURCES += \
graphics/grsoft.cpp \
graphics/tmapper.cpp
endif # FS2_GRSOFT
if FS2_OS_WIN32
SOUND_SOURCES += \
sound/dscap.cpp \
sound/dscap.h
endif
endif
## Win32-specific sources
if FS2_OS_WIN32
fs2_SOURCES += \
cutscene/movie.cpp \
directx/dx8show.cpp \
ddsutils/ddsutils.cpp \
globalincs/windebug.cpp \
glide/glide.cpp \
graphics/grd3d.cpp \
graphics/grd3drender.cpp \
graphics/grd3dtexture.cpp \
graphics/grdirectdraw.cpp \
graphics/grglide.cpp \
graphics/grglidetexture.cpp \
network/stand_gui.cpp \
osapi/osapi.cpp \
osapi/osregistry.cpp \
osapi/outwnd.cpp
endif # FS2_OS_WIN32
WIN32_SOURCES = \
directx/dx8show.cpp \
directx/dx8show.h \
directx/vasync.h \
directx/vd3dtypes.h \
directx/vddraw.h \
directx/vdinput.h \
directx/vdplay.h \
directx/vdplobby.h \
directx/vdsetup.h \
directx/vdsound.h \
directx/vdvp.h \
globalincs/windebug.cpp \
graphics/gl/GLAUX.H \
graphics/gl/GLU.H \
graphics/gl/Gl.h \
graphics/gl/Glext.h \
graphics/gl/wglext.h \
graphics/GrD3DParticle.cpp \
graphics/GrD3DParticle.h \
graphics/GrD3DStateBlock.cpp \
graphics/grd3d.cpp \
graphics/grd3d.h \
graphics/grd3dbatch.cpp \
graphics/grd3dbatch.h \
graphics/grd3dcalls.cpp \
graphics/grd3dbmpman.cpp \
graphics/grd3dbmpman.h \
graphics/grd3dinternal.h \
graphics/grd3dlight.cpp \
graphics/grd3dlight.h \
graphics/grd3drender.cpp \
graphics/grd3dsetup.cpp \
graphics/grd3dsetup.h \
graphics/grd3dtexture.cpp \
osapi/monopub.h \
osapi/osapi.cpp \
osapi/osapi.h \
osapi/osregistry.cpp \
osapi/osregistry.h \
osapi/outwnd.cpp \
osapi/outwnd.h
endif
## Unix-specific sources
if FS2_OS_UNIX
fs2_SOURCES += \
io/xmouse.cpp \
osapi/osapi_unix.cpp \
osapi/osregistry_unix.cpp \
osapi/outwnd_unix.cpp
endif # FS2_OS_UNIX
## compiler flags
# INCLUDES = -I.
AM_CXXFLAGS = -fno-exceptions @DX8_INCLUDE@
AM_LDFLAGS = -L/c/dx8/lib @DX8_LIB@
LDADD =
if FS2_OS_WIN32
## Win32 libraries needed
LDADD += \
-lgdi32 -lole32 -lwsock32 -lwinmm -lmsacm32 -lopengl32 \
-lcomctl32 -lstrmiids -ldxguid -lddraw -ldinput
UNIX_SOURCES = \
osapi/osapi_unix.cpp \
osapi/osapi.h \
osapi/osregistry_unix.cpp \
osapi/osregistry.h \
osapi/outwnd_unix.cpp \
osapi/outwnd.h \
windows_stub/stubs.cpp \
windows_stub/config.h
endif
if FS2_OS_UNIX
## Unix libraries needed
## -- TODO --
endif
## libcode.a
libcode_a_SOURCES = ${FS2_SOURCES} ${JOY_SOURCES} ${SOUND_SOURCES} \
${WIN32_SOURCES} ${UNIX_SOURCES}
##
## End CODE library
##
###############################################################################
###############################################################################
##
## Begin MAIN fs2 binary
##
FS2OPEN_SOURCES = \
freespace2/freespace.cpp \
freespace2/freespace.h \
freespace2/levelpaging.cpp \
freespace2/levelpaging.h
fs2_open_d_SOURCES = \
${FS2OPEN_SOURCES} \
${PLATFORM_SOURCES}
fs2_open_r_SOURCES = \
${FS2OPEN_SOURCES} \
${PLATFORM_SOURCES}
fs2_open_d_LDADD = libcode.a ../libjpeg/libjpeg.a
fs2_open_r_LDADD = libcode.a ../libjpeg/libjpeg.a
##
## End MAIN binary
##
###############################################################################
###############################################################################
##
## Begin wxFRED2 binary
##
wxFRED_SOURCES = \
wxfred2/wxfred2.cpp \
wxfred2/wxfred2.h \
wxfred2/fredframe.cpp \
wxfred2/fredframe.h \
wxfred2/wxfred_xrc.cpp \
wxfred2/wxfred_xrc.h
wxFRED2_d_SOURCES = \
${wxFRED_SOURCES} \
${PLATFORM_SOURCES}
wxFRED2_r_SOURCES = \
${wxFRED_SOURCES} \
${PLATFORM_SOURCES}
wxFRED2_d_LDADD = libcode.a ../libjpeg/libjpeg.a
wxFRED2_r_LDADD = libcode.a ../libjpeg/libjpeg.a
##
## End wxFRED2 binary
##
###############################################################################
File diff suppressed because it is too large. Load diff
@@ -11,10 +11,12 @@
// ai slots and linking them to ships.
// See AiCode.cpp for the actual AI code.
#include "ship/ai.h"
#include "ai/ai.h"
#include "object/object.h"
#include "ship/ship.h"
int Total_goal_ship_names = 0;
char Goal_ship_names[MAX_GOAL_SHIP_NAMES][NAME_LENGTH];
ai_info Ai_info[MAX_AI_INFO];
+139 -80
View File
@@ -9,11 +9,65 @@
/*
* $Logfile: /Freespace2/code/Ship/ai.h $
* $Revision: 2.14 $
* $Date: 2004-03-05 09:01:51 $
* $Revision: 1.7 $
* $Date: 2005-07-27 17:22:22 $
* $Author: Goober5000 $
*
* $Log: not supported by cvs2svn $
* Revision 1.6 2005/07/25 03:13:24 Goober5000
* various code cleanups, tweaks, and fixes; most notably the MISSION_FLAG_USE_NEW_AI
* should now be added to all places where it is needed (except the turret code, which I still
* have to to review)
* --Goober5000
*
* Revision 1.5 2005/07/24 20:12:55 Goober5000
* cleaned up some rotating submodel code
* --Goober5000
*
* Revision 1.4 2005/07/22 09:19:39 wmcoolmon
* Dynamic AI Class number commit. KNOWN BUG: When AI_CLASS_INCREMENT is hit and vm_realloc is called, memory corruption seems to
* result. Not at all sure what causes this; if this can't be resolved soon, we can always treat _INCREMENT like _MAX
*
* Revision 1.3 2005/07/13 02:50:48 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 1.2 2005/04/05 05:53:13 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 1.1 2005/03/25 06:45:12 wmcoolmon
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
*
* Revision 2.21 2005/02/20 23:13:00 wmcoolmon
* Trails stuff, moved ship docking func declaration so FRED could get to it.
*
* Revision 2.20 2005/01/28 09:01:04 Goober5000
* finished implementing docking to a rotating submodel
* --Goober5000
*
* Revision 2.19 2005/01/27 11:26:23 Goober5000
* dock points on rotating submodels is *almost* working
* --Goober5000
*
* Revision 2.18 2005/01/13 03:33:07 Goober5000
* hmm, rolled back one of my clarifications since it caused things to get messed up
* --Goober5000
*
* Revision 2.17 2005/01/11 21:38:48 Goober5000
* multiple ship docking :)
* don't tell anyone yet... check the SCP internal
* --Goober500
*
* Revision 2.16 2004/08/11 05:06:33 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.15 2004/07/25 00:31:30 Kazan
* i have absolutely nothing to say about that subject
*
* Revision 2.14 2004/03/05 09:01:51 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.13 2004/01/26 23:07:43 phreak
* bumped MAX_AI_CLASSES to 30 if INF_BUILD is defined
*
@@ -220,36 +274,35 @@ struct object;
#define AI_DEFAULT_CLASS 3 // default AI class for new ships (Fred)
#define AIF_FORMATION_WING (1 << 0) // Fly in formation as part of wing.
#define AIF_AWAITING_REPAIR (1 << 1) // Awaiting a repair ship.
#define AIF_BEING_REPAIRED (1 << 2) // Currently docked with repair ship.
#define AIF_REPAIRING (1 << 3) // Repairing a ship (or going to repair a ship)
#define AIF_DOCKED (1 << 4) // this object docked with something else
#define AIF_SEEK_LOCK (1 << 5) // set if should focus on gaining aspect lock, not hitting with lasers
#define AIF_FORMATION_OBJECT (1 << 6) // Fly in formation off a specific object.
#define AIF_TEMPORARY_IGNORE (1 << 7) // Means current ignore_objnum is only temporary, not an order from the player.
#define AIF_USE_EXIT_PATH (1 << 8) // Used by path code, to flag path as an exit path
#define AIF_USE_STATIC_PATH (1 << 9) // Used by path code, use fixed path, don't try to recreate
#define AIF_TARGET_COLLISION (1 << 10) // Collided with aip->target_objnum last frame. Avoid that ship for half a second or so.
#define AIF_UNLOAD_SECONDARIES (1 << 11) // Fire secondaries as fast as possible!
#define AIF_ON_SUBSYS_PATH (1 << 12) // Current path leads to a subsystem
#define AIF_AVOID_SHOCKWAVE_SHIP (1 << 13) // Avoid an existing shockwave from a ship.
#define AIF_AVOID_SHOCKWAVE_WEAPON (1 << 14) // Avoid an expected shockwave from a weapon. shockwave_object field contains object index.
#define AIF_AVOID_SHOCKWAVE_STARTED (1 << 15) // Already started avoiding shockwave, don't keep deciding whether to avoid.
#define AIF_ATTACK_SLOWLY (1 << 16) // Move slowly while attacking.
#define AIF_REPAIR_OBSTRUCTED (1 << 17) // Ship wants to be repaired, but path is obstructed.
#define AIF_KAMIKAZE (1 << 18) // Crash into target
#define AIF_NO_DYNAMIC (1 << 19) // Not allowed to get dynamic goals
#define AIF_AVOIDING_SMALL_SHIP (1 << 20) // Avoiding a player ship.
#define AIF_AVOIDING_BIG_SHIP (1 << 21) // Avoiding a large ship.
#define AIF_BIG_SHIP_COLLIDE_RECOVER_1 (1 << 22) // Collided into a big ship. Recovering by flying away.
#define AIF_BIG_SHIP_COLLIDE_RECOVER_2 (1 << 23) // Collided into a big ship. Fly towards big ship sphere perimeter.
#define AIF_STEALTH_PURSUIT (1 << 24) // Ai is trying to fight stealth ship
#define AIF_FORMATION_WING (1 << 0) // Fly in formation as part of wing.
#define AIF_AWAITING_REPAIR (1 << 1) // Awaiting a repair ship.
#define AIF_BEING_REPAIRED (1 << 2) // Currently docked with repair ship.
#define AIF_REPAIRING (1 << 3) // Repairing a ship (or going to repair a ship)
#define AIF_SEEK_LOCK (1 << 4) // set if should focus on gaining aspect lock, not hitting with lasers
#define AIF_FORMATION_OBJECT (1 << 5) // Fly in formation off a specific object.
#define AIF_TEMPORARY_IGNORE (1 << 6) // Means current ignore_objnum is only temporary, not an order from the player.
#define AIF_USE_EXIT_PATH (1 << 7) // Used by path code, to flag path as an exit path
#define AIF_USE_STATIC_PATH (1 << 8) // Used by path code, use fixed path, don't try to recreate
#define AIF_TARGET_COLLISION (1 << 9) // Collided with aip->target_objnum last frame. Avoid that ship for half a second or so.
#define AIF_UNLOAD_SECONDARIES (1 << 10) // Fire secondaries as fast as possible!
#define AIF_ON_SUBSYS_PATH (1 << 11) // Current path leads to a subsystem
#define AIF_AVOID_SHOCKWAVE_SHIP (1 << 12) // Avoid an existing shockwave from a ship.
#define AIF_AVOID_SHOCKWAVE_WEAPON (1 << 13) // Avoid an expected shockwave from a weapon. shockwave_object field contains object index.
#define AIF_AVOID_SHOCKWAVE_STARTED (1 << 14) // Already started avoiding shockwave, don't keep deciding whether to avoid.
#define AIF_ATTACK_SLOWLY (1 << 15) // Move slowly while attacking.
#define AIF_REPAIR_OBSTRUCTED (1 << 16) // Ship wants to be repaired, but path is obstructed.
#define AIF_KAMIKAZE (1 << 17) // Crash into target
#define AIF_NO_DYNAMIC (1 << 18) // Not allowed to get dynamic goals
#define AIF_AVOIDING_SMALL_SHIP (1 << 19) // Avoiding a player ship.
#define AIF_AVOIDING_BIG_SHIP (1 << 20) // Avoiding a large ship.
#define AIF_BIG_SHIP_COLLIDE_RECOVER_1 (1 << 21) // Collided into a big ship. Recovering by flying away.
#define AIF_BIG_SHIP_COLLIDE_RECOVER_2 (1 << 22) // Collided into a big ship. Fly towards big ship sphere perimeter.
#define AIF_STEALTH_PURSUIT (1 << 23) // Ai is trying to fight stealth ship
// Goober5000
#define AIF_UNLOAD_PRIMARIES (1 << 25) // Fire primaries as fast as possible!
#define AIF_UNLOAD_PRIMARIES (1 << 24) // Fire primaries as fast as possible!
#define AIF_AVOID_SHOCKWAVE (AIF_AVOID_SHOCKWAVE_SHIP | AIF_AVOID_SHOCKWAVE_WEAPON)
#define AIF_AVOID_SHOCKWAVE (AIF_AVOID_SHOCKWAVE_SHIP | AIF_AVOID_SHOCKWAVE_WEAPON)
#define AIF_FORMATION (AIF_FORMATION_WING | AIF_FORMATION_OBJECT)
// dock_orient_and_approach() modes.
@@ -284,13 +337,16 @@ struct object;
#define AIG_TYPE_DYNAMIC 5 // created on the fly
// flags for AI_GOALS
#define AIGF_DOCKER_NAME_VALID (1<<0) // when set, name field for docker is valid
#define AIGF_DOCKEE_NAME_VALID (1<<1) // when set, name field for dockee is valid
#define AIGF_DOCKER_INDEX_VALID (1<<0) // when set, index field for docker is valid
#define AIGF_DOCKEE_INDEX_VALID (1<<1) // when set, index field for dockee is valid
#define AIGF_GOAL_ON_HOLD (1<<2) // when set, this goal cannot currently be satisfied, although it could be in the future
#define AIGF_SUBSYS_NAME_VALID (1<<3) // when set, the subsystem name (for a destroy subsystem goal) is valid, and stored in docker.name field!!
#define AIGF_SUBSYS_NEEDS_FIXUP (1<<3) // when set, the subsystem index (for a destroy subsystem goal) is invalid and must be gotten from the subsys name stored in docker.name field!!
#define AIGF_GOAL_OVERRIDE (1<<4) // paired with AIG_TYPE_DYNAMIC to mean this goal overrides any other goal
#define AIGF_PURGE (1<<5) // purge this goal next time we process
#define AIGF_GOALS_PURGED (1<<6) // this goal has already caused other goals to get purged
#define AIGF_DOCK_SOUND_PLAYED (1<<7) // Goober5000 - replacement for AL's hack ;)
#define AIGF_DOCK_INDEXES_VALID (AIGF_DOCKER_INDEX_VALID|AIGF_DOCKEE_INDEX_VALID)
// Flags to ai_turn_towards_vector().
#define AITTV_FAST (1<<0) // Turn fast, not slowed down based on skill level.
@@ -326,6 +382,8 @@ typedef struct ai_goal {
int num_special_objects;
// unions for docking stuff.
// (AIGF_DOCKER_INDEX_VALID and AIGF_DOCKEE_INDEX_VALID tell us to use indexes; otherwise we use names)
// these are the dockpoints used on the docker and dockee ships, not the ships themselves
union {
char *name;
int index;
@@ -338,11 +396,6 @@ typedef struct ai_goal {
} ai_goal;
#ifdef INF_BUILD
#define MAX_AI_CLASSES 30
#else
#define MAX_AI_CLASSES 10
#endif
#define MAX_GOAL_SHIP_NAMES 100
#define AIM_CHASE 0
@@ -366,8 +419,9 @@ typedef struct ai_goal {
#define AIM_BAY_DEPART 18 // Departing to a fighter bay, following path to do so
#define AIM_SENTRYGUN 19 // AI mode for sentry guns only (floating turrets)
#define AIM_WARP_OUT 20 // Commence warp out sequence. Point in legal direction. Then call John's code.
#define AIM_FLY_TO_SHIP 21 // [Kazan] Fly to a ship, doesn't matter if it's hostile or friendly -- for Autopilot usage
#define MAX_AI_BEHAVIORS 21 // Number of AIM_xxxx types
#define MAX_AI_BEHAVIORS 22 // Number of AIM_xxxx types
#define MAX_WAYPOINTS_PER_LIST 20
#define MAX_WAYPOINT_LISTS 32
@@ -380,7 +434,7 @@ typedef struct waypoint_list {
char name[NAME_LENGTH];
int count;
char flags[MAX_WAYPOINTS_PER_LIST];
vector waypoints[MAX_WAYPOINTS_PER_LIST];
vec3d waypoints[MAX_WAYPOINTS_PER_LIST];
} waypoint_list;
#define AI_GOAL_NONE -1
@@ -420,7 +474,7 @@ typedef struct ai_class {
#define AIS_DOCK_1 22
#define AIS_DOCK_2 23
#define AIS_DOCK_3 24
#define AIS_DOCK_3A 25
//#define AIS_DOCK_3A 25
#define AIS_DOCK_4 26 // Only for rearm/repair.
#define AIS_DOCK_4A 27 // Only for not rearm/repair. MK, 7/15/97
#define AIS_UNDOCK_0 30
@@ -464,7 +518,7 @@ typedef struct ai_class {
// This hook is used to extract information on the point such as whether it is
// protected by turrets.
typedef struct pnode {
vector pos;
vec3d pos;
int path_num; // path number from polymodel, ie in polymodel, paths[path_num]
int path_index; // index in original model path of point, ie in model_path, use verts[path_index]
} pnode;
@@ -490,14 +544,15 @@ typedef struct ai_info {
int stealth_last_cheat_visible_stamp; // when within 100m, always update pos and velocity, with error increasing for increasing time from last legal visible
int stealth_last_visible_stamp;
float stealth_sweep_box_size;
vector stealth_last_pos;
vector stealth_velocity;
vec3d stealth_last_pos;
vec3d stealth_velocity;
float previous_dot_to_enemy; // dot(fvec, vec_to_enemy) last frame
float target_time; // Amount of time continuously targeting this ship.
int enemy_wing; // When picking an enemy wing, only allow to be in enemy_wing, unless == -1, in which case don't care.
int attacker_objnum;
int goal_objnum; // mode specific goal. In DOCK, ship to dock with.
int goal_signature;
@@ -526,7 +581,7 @@ typedef struct ai_info {
int path_objnum; // Object of interest. It's model contains the path.
int path_goal_obj_hash; // Hash value of goal object when global path created.
fix path_next_create_time; // Next time at which we'll create a global path.
vector path_create_pos; // Object's position at time of global path creation.
vec3d path_create_pos; // Object's position at time of global path creation.
matrix path_create_orient; // Object's orientation at time of global path creation.
int mp_index; // Model path index. Index in polymodel:model_paths
fix path_next_check_time; // Last time checked to see if would collide with model.
@@ -547,7 +602,7 @@ typedef struct ai_info {
int active_goal; // index of active goal, -1 if none, AI_ACTIVE_GOAL_DYNAMIC if dynamic (runtime-created) goal
int goal_check_time; // timer used for processing goals for this ai object
vector last_predicted_enemy_pos; // Where he thought enemy was last time.
vec3d last_predicted_enemy_pos; // Where he thought enemy was last time.
float time_enemy_in_range; // Amount of time enemy continuously in "sight", near crosshair.
fix last_attack_time; // Missiontime of last time this ship attacked its enemy.
fix last_hit_time; // Missiontime of last time this ship was hit by anyone.
@@ -558,8 +613,8 @@ typedef struct ai_info {
fix resume_goal_time; // Time at which to resume interrupted goal, if nothing else intervenes.
float prev_accel; // Acceleration last frame.
float prev_dot_to_goal; // dot of fvec to goal last frame, used to see if making progress towards goal.
vector goal_point; // Used in AIM_SAFETY, AIM_STILL and in circling.
vector prev_goal_point; // Previous location of goal point, used at least for evading.
vec3d goal_point; // Used in AIM_SAFETY, AIM_STILL and in circling.
vec3d prev_goal_point; // Previous location of goal point, used at least for evading.
float ai_accuracy, ai_evasion, ai_courage, ai_patience;
union {
float lead_scale; // Amount to lead current opponent by.
@@ -574,15 +629,15 @@ typedef struct ai_info {
// ship_subsys *targeted_subobject; // subsystem to attack
// int attack_subsystem_parent; // objnum of the object containing the attack_subsystem
int dock_index; // index of docking point to use when docking.
int dockee_index; // index of dock point on other ship.
int dock_path_index; // index of docking path to use when docking.
int dock_objnum; // objnum of ship we are docked with.
int dock_signature; // Signature of repair object.
// Goober5000
int support_ship_objnum; // objnum of support ship docking with us, or (if we're a support ship) object we're docking to
int support_ship_signature; // signature of the same
int danger_weapon_objnum; // Closest objnum of weapon fired at this ship.
int danger_weapon_signature; // Signature of object danger_weapon_objnum.
vector guard_vec; // vector to object being guarded, only used in AIS_GUARD_STATIC submode
vec3d guard_vec; // vector to object being guarded, only used in AIS_GUARD_STATIC submode
int nearest_locked_object; // Nearest locked object.
float nearest_locked_distance; // Distance to nearest locked object.
@@ -621,19 +676,19 @@ typedef struct ai_info {
int ok_to_target_timestamp; // Time at which this ship can dynamically target.
float kamikaze_damage; // some damage value used to produce a shockwave from a kamikaze ship
vector big_attack_point; // Global point this ship is attacking on a big ship.
vector big_attack_surface_normal; // Surface normal at ship at big_attack_point;
vec3d big_attack_point; // Global point this ship is attacking on a big ship.
vec3d big_attack_surface_normal; // Surface normal at ship at big_attack_point;
int pick_big_attack_point_timestamp; // timestamp at which to pick a new point to attack on a big ship.
// Note: These three avoid_XX terms are shared between the code that avoids small (only player now) and large ships
// The bits in ai_flags determine which is occurring. AIF_AVOID_SMALL_SHIP, AIF_AVOID_BIG_SHIP
int avoid_ship_num; // object index of small ship to avoid
vector avoid_goal_point; // point to aim at when avoiding a ship
vec3d avoid_goal_point; // point to aim at when avoiding a ship
fix avoid_check_timestamp; // timestamp at which to next check for having to avoid ship
vector big_collision_normal; // Global normal of collision with big ship. Helps find direction to fly away from big ship. Set for each collision.
vector big_recover_pos_1; // Global point to fly towards when recovering from collision with a big ship, stage 1.
vector big_recover_pos_2; // Global point to fly towards when recovering from collision with a big ship, stage 2.
vec3d big_collision_normal; // Global normal of collision with big ship. Helps find direction to fly away from big ship. Set for each collision.
vec3d big_recover_pos_1; // Global point to fly towards when recovering from collision with a big ship, stage 1.
vec3d big_recover_pos_2; // Global point to fly towards when recovering from collision with a big ship, stage 2.
int big_recover_timestamp; // timestamp at which it's OK to re-enter stage 1.
int abort_rearm_timestamp; // time at which this rearm should be aborted in a multiplayer game.
@@ -642,7 +697,7 @@ typedef struct ai_info {
int artillery_objnum; // object currently being targeted for artillery lock/attack
int artillery_sig; // artillery object signature
float artillery_lock_time; // how long we've been locked onto this guy
vector artillery_lock_pos; // base position of the lock point on (in model's frame of reference)
vec3d artillery_lock_pos; // base position of the lock point on (in model's frame of reference)
float lethality; // measure of how dangerous ship is to enemy BIG|HUGE ships (likelyhood of targeting)
} ai_info;
@@ -671,8 +726,8 @@ extern ai_info *Player_ai;
extern int Waypoints_created; // externed since needed for save/restore
extern ai_class Ai_classes[];
extern char *Ai_class_names[];
extern ai_class *Ai_classes;
extern char** Ai_class_names;
extern int Num_ai_classes;
extern int Ai_firing_enabled;
@@ -714,14 +769,14 @@ extern void ai_attack_object(object *attacker, object *attacked, int priority, s
extern void ai_evade_object(object *evader, object *evaded, int priority);
extern void ai_ignore_object(object *ignorer, object *ignored, int priority);
extern void ai_ignore_wing(object *ignorer, int wingnum, int priority);
extern void ai_dock_with_object(object *docker, object *dockee, int priority, int dock_type, int docker_index, int dockee_index);
extern void ai_stay_still(object *still_objp, vector *view_pos);
extern void ai_dock_with_object(object *docker, int docker_index, object *dockee, int dockee_index, int priority, int dock_type);
extern void ai_stay_still(object *still_objp, vec3d *view_pos);
extern void ai_set_default_behavior(object *obj, int classnum);
extern void ai_do_default_behavior(object *obj);
extern void ai_start_waypoints(object *objp, int waypoint_list_index, int wp_flags);
extern void ai_ship_hit(object *objp_ship, object *hit_objp, vector *hitpos, int shield_quadrant, vector *hit_normal);
extern void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_quadrant, vec3d *hit_normal);
extern void ai_ship_destroy(int shipnum, int method);
extern void ai_turn_towards_vector(vector *dest, object *objp, float frametime, float turn_time, vector *slide_vec, vector *rel_pos, float bank_override, int flags, vector *rvec = NULL, int sexp_flags = 0);
extern void ai_turn_towards_vector(vec3d *dest, object *objp, float frametime, float turn_time, vec3d *slide_vec, vec3d *rel_pos, float bank_override, int flags, vec3d *rvec = NULL, int sexp_flags = 0);
extern void init_ai_object(int objnum);
extern void ai_init(void); // Call this one to parse ai.tbl.
extern void ai_level_init(void); // Call before each level to reset AI
@@ -730,29 +785,27 @@ extern int ai_set_attack_subsystem(object *objp, int subnum);
extern int ai_issue_rearm_request(object *requester_objp); // Object requests rearm/repair.
extern int ai_abort_rearm_request(object *requester_objp); // Object aborts rearm/repair.
extern void ai_do_repair_frame(object *objp, ai_info *aip, float frametime); // Repair a ship object, player or AI.
extern float dock_orient_and_approach(object *objp, object *dobjp, int dock_mode); // Move to a position relative to a dock bay using thrusters.
extern void ai_update_danger_weapon(int objnum, int weapon_objnum);
// called externally from MissionParse.cpp to position ships in wings upon arrival into the
// mission.
extern void get_absolute_wing_pos( vector *result_pos, object *leader_objp, int wing_index, int formation_object_flag);
extern void get_absolute_wing_pos( vec3d *result_pos, object *leader_objp, int wing_index, int formation_object_flag);
// Interface from goals code to AI. Set ship to guard. *objp guards *other_objp
extern void ai_set_guard_object(object *objp, object *other_objp);
extern void ai_set_evade_object(object *objp, object *other_objp);
extern void ai_set_guard_wing(object *objp, int wingnum);
extern void ai_warp_out(object *objp, vector *vp);
extern void ai_warp_out(object *objp, vec3d *vp);
extern void ai_attack_wing(object *attacker, int wingnum, int priority);
extern void ai_deathroll_start(object *ship_obj);
extern void ai_fly_in_formation(int wing_num); // Force wing to fly in formation.
extern void ai_disband_formation(int wing_num); // Force wing to disband formation flying.
extern object *ai_find_docked_object( object *objp ); // returns object that objp is docked to
extern int set_target_objnum(ai_info *aip, int objnum);
extern void ai_form_on_wing(object *objp, object *goal_objp);
extern void ai_do_stay_near(object *objp, object *other_obj, float dist);
extern ship_subsys *set_targeted_subsys(ai_info *aip, ship_subsys *new_subsys, int parent_objnum);
extern void ai_rearm_repair( object *objp, object *goal_objp, int priority, int docker_index, int dockee_index );
extern void ai_rearm_repair( object *objp, int docker_index, object *goal_objp, int dockee_index, int priority );
extern void ai_add_rearm_goal( object *requester_objp, object *support_objp );
extern void create_model_path(object *pl_objp, object *mobjp, int path_num, int subsys_path=0);
@@ -760,15 +813,15 @@ extern void create_model_path(object *pl_objp, object *mobjp, int path_num, int
extern void ai_do_safety(object *objp);
// used to get path info for fighter bay emerging and departing
int ai_acquire_emerge_path(object *pl_objp, int parent_objnum, vector *pos, vector *fvec);
int ai_acquire_emerge_path(object *pl_objp, int parent_objnum, vec3d *pos, vec3d *fvec);
int ai_acquire_depart_path(object *pl_objp, int parent_objnum);
// used by AiBig.cpp
extern void ai_set_positions(object *pl_objp, object *en_objp, ai_info *aip, vector *player_pos, vector *enemy_pos);
extern void ai_set_positions(object *pl_objp, object *en_objp, ai_info *aip, vec3d *player_pos, vec3d *enemy_pos);
extern void accelerate_ship(ai_info *aip, float accel);
extern void turn_away_from_point(object *objp, vector *point, float bank_override);
extern void turn_away_from_point(object *objp, vec3d *point, float bank_override);
extern float ai_endangered_by_weapon(ai_info *aip);
extern void update_aspect_lock_information(ai_info *aip, vector *vec_to_enemy, float dist_to_enemy, float enemy_radius);
extern void update_aspect_lock_information(ai_info *aip, vec3d *vec_to_enemy, float dist_to_enemy, float enemy_radius);
extern void ai_chase_ct();
extern void ai_find_path(object *pl_objp, int objnum, int path_num, int exit_flag, int subsys_path=0);
extern float ai_path();
@@ -777,22 +830,21 @@ extern int might_collide_with_ship(object *obj1, object *obj2, float dot_to_enem
extern int ai_fire_primary_weapon(object *objp); //changed to return weather it fired-Bobboau
extern int ai_fire_secondary_weapon(object *objp, int priority1 = -1, int priority2 = -1);
extern float ai_get_weapon_dist(ship_weapon *swp);
extern void turn_towards_point(object *objp, vector *point, vector *slide_vec, float bank_override);
extern void turn_towards_point(object *objp, vec3d *point, vec3d *slide_vec, float bank_override);
extern int ai_maybe_fire_afterburner(object *objp, ai_info *aip);
extern void set_predicted_enemy_pos(vector *predicted_enemy_pos, object *pobjp, object *eobjp, ai_info *aip);
extern void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, object *eobjp, ai_info *aip);
extern int is_instructor(object *objp);
extern int find_enemy(int objnum, float range, int max_attackers, int except = 0);
float ai_get_weapon_speed(ship_weapon *swp);
void set_predicted_enemy_pos_turret(vector *predicted_enemy_pos, vector *gun_pos, object *pobjp, vector *enemy_pos, vector *enemy_vel, float weapon_speed, float time_enemy_in_range);
void ai_turret_select_default_weapon(ship_subsys *turret);
void set_predicted_enemy_pos_turret(vec3d *predicted_enemy_pos, vec3d *gun_pos, object *pobjp, vec3d *enemy_pos, vec3d *enemy_vel, float weapon_speed, float time_enemy_in_range);
// function to change rearm status for ai ships (called from sexpression code)
extern void ai_set_rearm_status( int team, int new_status );
extern void ai_good_secondary_time( int team, int weapon_index, int num_weapons, char *shipname );
extern void ai_do_objects_docked_stuff( object *docker, object *dockee );
extern void ai_do_objects_docked_stuff(object *docker, int docker_point, object *dockee, int dockee_point);
extern void ai_do_objects_undocked_stuff( object *docker, object *dockee );
extern void ai_do_objects_repairing_stuff( object *repaired_obj, object *repair_obj, int how );
@@ -806,4 +858,11 @@ int get_nearest_objnum(int objnum, int enemy_team_mask, int enemy_wing, float ra
// moved to header file by Goober5000
void ai_announce_ship_dying(object *dying_objp);
// added by kazan
void ai_start_fly_to_ship(object *objp, int shipnum);
void ai_fly_to_ship();
//Moved declaration here for player ship -WMC
void process_subobjects(int objnum);
#endif
@@ -9,13 +9,55 @@
/*
* $Logfile: /Freespace2/code/Ship/AiBig.cpp $
* $Revision: 2.8 $
* $Date: 2004-03-05 09:01:51 $
* $Author: Goober5000 $
* $Revision: 1.6 $
* $Date: 2005-09-01 04:14:03 $
* $Author: taylor $
*
* C module for AI code related to large ships
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/07/27 18:27:49 Goober5000
* verified that submode_start_time is updated whenever submode is changed
* --Goober5000
*
* Revision 1.4 2005/07/25 05:23:33 Goober5000
* whoops
* --Goober5000
*
* Revision 1.3 2005/07/25 03:13:23 Goober5000
* various code cleanups, tweaks, and fixes; most notably the MISSION_FLAG_USE_NEW_AI
* should now be added to all places where it is needed (except the turret code, which I still
* have to to review)
* --Goober5000
*
* Revision 1.2 2005/04/05 05:53:13 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 1.1 2005/03/25 06:45:12 wmcoolmon
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
*
* Revision 2.12 2005/03/10 08:00:14 taylor
* change min/max to MIN/MAX to fix GCC problems
* add lab stuff to Makefile
* build unbreakage for everything that's not MSVC++ 6
* lots of warning fixes
* fix OpenGL rendering problem with ship insignias
* no Warnings() in non-debug mode for Linux (like Windows)
* some campaign savefile fixage to stop reverting everyones data
*
* Revision 2.11 2004/11/27 10:49:14 taylor
* make sure the old behavior still applies to everything that's not a beam
*
* Revision 2.10 2004/07/26 20:47:50 Kazan
* remove MCD complete
*
* Revision 2.9 2004/07/12 16:33:04 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.8 2004/03/05 09:01:51 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.7 2003/11/11 02:15:40 Goober5000
* ubercommit - basically spelling and language fixes with some additional
* warnings disabled
@@ -364,7 +406,7 @@
* $NoKeywords: $
*/
#include "ship/aibig.h"
#include "ai/aibig.h"
#include "globalincs/linklist.h"
#include "object/object.h"
#include "ship/ship.h"
@@ -374,6 +416,8 @@
#include "io/timer.h"
#include "mission/missionparse.h"
#pragma optimize("", off)
#pragma auto_inline(off)
@@ -405,13 +449,13 @@
// forward declarations
void ai_big_evade_ship();
void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float dist_to_enemy, int modelnum);
void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float dist_to_enemy, int modelnum);
void ai_big_avoid_ship();
int ai_big_maybe_follow_subsys_path(int do_dot_check=1);
extern int model_which_octant_distant_many( vector *pnt, int model_num,matrix *model_orient, vector * model_pos, polymodel **pm, int *octs);
extern void compute_desired_rvec(vector *rvec, vector *goal_pos, vector *cur_pos);
extern void big_ship_collide_recover_start(object *objp, object *big_objp, vector *collide_pos, vector *collision_normal);
extern int model_which_octant_distant_many( vec3d *pnt, int model_num,matrix *model_orient, vec3d * model_pos, polymodel **pm, int *octs);
extern void compute_desired_rvec(vec3d *rvec, vec3d *goal_pos, vec3d *cur_pos);
extern void big_ship_collide_recover_start(object *objp, object *big_objp, vec3d *collide_pos, vec3d *collision_normal);
// Called by ai_big_pick_attack_point.
@@ -419,11 +463,11 @@ extern void big_ship_collide_recover_start(object *objp, object *big_objp, vecto
// If truly_random flag set (haha), then generate a pretty random number. Otherwise, generate a static rand which
// tends to not change from frame to frame.
// Try four times and choose nearest point to increase chance of getting a good point.
void ai_bpap(object *objp, vector *attacker_objp_pos, vector *attacker_objp_fvec, vector *attack_point, vector *local_attack_point, float fov, float weapon_travel_dist, vector *surface_normal)
void ai_bpap(object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec, vec3d *attack_point, vec3d *local_attack_point, float fov, float weapon_travel_dist, vec3d *surface_normal)
{
float nearest_dist;
vector result_point, best_point;
vector rel_point;
vec3d result_point, best_point;
vec3d rel_point;
int num_tries;
model_octant *octp;
polymodel *pm;
@@ -463,7 +507,7 @@ void ai_bpap(object *objp, vector *attacker_objp_pos, vector *attacker_objp_fvec
for (i=0; i<num_tries; i++) {
int index;
float dist, dot;
vector v2p;
vec3d v2p;
index = (int) (frand() * (octp->nverts));
@@ -496,7 +540,7 @@ done_1:
// If no collision, cast to (0,0,0) [center of big ship]** [best_point initialized to 000]
// do in world coords to get attack point, then translate to local for local_attack_point
vector attack_dir, end_point, temp;
vec3d attack_dir, end_point, temp;
float dist;
dist = vm_vec_normalized_dir(&attack_dir, attack_point, attacker_objp_pos);
@@ -537,14 +581,14 @@ done_1:
//
// Note: Default value for fov is 1.0f 1.0f means don't use fov parameter.
// If fov != 1.0f, try up to four times to find a point that's in the field of view.
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vector *gpos, vector *gvec, vector *attack_point, float fov, float weapon_travel_dist)
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float fov, float weapon_travel_dist)
{
if (!timestamp_elapsed(ssp->turret_pick_big_attack_point_timestamp)) {
vector result_point;
vec3d result_point;
vm_vec_unrotate(&result_point, &ssp->turret_big_attack_point, &objp->orient);
vm_vec_add(attack_point, &result_point, &objp->pos);
} else {
vector local_attack_point;
vec3d local_attack_point;
ssp->turret_pick_big_attack_point_timestamp = timestamp(2000 + (int) (frand()*500.0f));
ai_bpap(objp, gpos, gvec, attack_point, &local_attack_point, fov, weapon_travel_dist, NULL);
ssp->turret_big_attack_point = local_attack_point;
@@ -557,19 +601,19 @@ void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vector *gpo
// Note: Default value for fov is 1.0f 1.0f means don't use fov parameter.
// If fov != 1.0f, try up to four times to find a point that's in the field of view.
// Note, attacker_objp can be a ship or a weapon.
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attack_point, float fov)
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov)
{
Assert(objp->instance > -1);
Assert(objp->type == OBJ_SHIP);
vector local_attack_point;
vec3d local_attack_point;
switch (attacker_objp->type) {
case OBJ_SHIP: {
ai_info *attacker_aip;
attacker_aip = &Ai_info[Ships[attacker_objp->instance].ai_index];
if (!timestamp_elapsed(attacker_aip->pick_big_attack_point_timestamp)) {
vector result_point;
vec3d result_point;
vm_vec_unrotate(&result_point, &attacker_aip->big_attack_point, &objp->orient);
vm_vec_add(attack_point, &result_point, &objp->pos);
@@ -584,7 +628,7 @@ void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attac
weapon *wp = &Weapons[attacker_objp->instance];
if (!timestamp_elapsed(wp->pick_big_attack_point_timestamp)) {
vector result_point;
vec3d result_point;
vm_vec_unrotate(&result_point, &wp->big_attack_point, &objp->orient);
vm_vec_add(attack_point, &result_point, &objp->pos);
@@ -598,7 +642,7 @@ void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attac
}
// checks valid line to target
vector surface_normal;
vec3d surface_normal;
ai_bpap(objp, &attacker_objp->pos, &attacker_objp->orient.vec.fvec, attack_point, &local_attack_point, fov, 99999.9f, &surface_normal);
switch (attacker_objp->type) {
@@ -628,11 +672,11 @@ void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attac
// Handler for SM_EVADE submode ( called from ai_big_chase() )
void ai_big_evade_ship()
{
vector player_pos, enemy_pos;
vec3d player_pos, enemy_pos;
float dist;
ship *shipp = &Ships[Pl_objp->instance];
ai_info *aip = &Ai_info[shipp->ai_index];
vector randvec, semi_enemy_pos;
vec3d randvec, semi_enemy_pos;
ai_set_positions(Pl_objp, En_objp, aip, &player_pos, &enemy_pos);
@@ -649,7 +693,7 @@ void ai_big_evade_ship()
turn_away_from_point(Pl_objp, &semi_enemy_pos, 0.0f);
float box_dist;
vector box_vec;
vec3d box_vec;
int is_inside;
box_dist = get_world_closest_box_point_with_delta(&box_vec, En_objp, &player_pos, &is_inside, EVADE_BOX_BASE_DISTANCE);
if (box_dist > EVADE_BOX_BASE_DISTANCE) {
@@ -718,7 +762,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
// only check for subsystem sight every N milliseconds
checked_sight = 0;
if ( timestamp_elapsed(aip->path_subsystem_next_check) ) {
vector geye, gsubpos;
vec3d geye, gsubpos;
eye *ep;
aip->path_subsystem_next_check = timestamp(1500);
@@ -735,7 +779,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
// Calc dot between subsys normal (based on using path info), and subsys_to_eye vector. This is
// useful later when we want to decide whether we have a realistic line-of-sight to the subsystem.
vector subsys_normal, subsys_to_eye;
vec3d subsys_normal, subsys_to_eye;
if ( do_dot_check ) {
if ( !ship_return_subsys_path_normal(&Ships[target_objp->instance], aip->targeted_subsys, &gsubpos, &subsys_normal) ) {
vm_vec_normalized_dir(&subsys_to_eye, &geye, &gsubpos);
@@ -804,6 +848,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
aip->previous_mode = aip->mode;
aip->mode = AIM_NONE;
aip->submode = -1;
aip->submode_start_time = Missiontime;
return 1;
}
ai_path();
@@ -863,7 +908,7 @@ int ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
}
// ATTACK submode handler for chase mode.
void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float dist_to_enemy, int modelnum)
void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float dist_to_enemy, int modelnum)
{
int start_bank;
float dot_to_enemy, time_to_hit;
@@ -881,7 +926,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float
for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
if ((objp->type == OBJ_WEAPON) && (Weapons[objp->instance].team != Ships[Pl_objp->instance].team))
if (Weapon_info[objp->instance].subtype == WP_LASER) {
vector in_vec;
vec3d in_vec;
float dist;
vm_vec_sub(&in_vec, &objp->pos, &Pl_objp->pos);
@@ -920,7 +965,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float
return;
}
vector *rel_pos, vec_to_enemy;
vec3d *rel_pos, vec_to_enemy;
float weapon_travel_dist;
start_bank = Ships[aip->shipnum].weapons.current_primary_bank;
@@ -933,7 +978,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float
dist_to_enemy = vm_vec_normalized_dir(&vec_to_enemy, enemy_pos, &Pl_objp->pos);
dot_to_enemy = vm_vec_dot(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
vector rvec_vec, *rvec = &rvec_vec;
vec3d rvec_vec, *rvec = &rvec_vec;
if (dist_to_enemy > 500.0f)
compute_desired_rvec(rvec, enemy_pos, &Pl_objp->pos);
@@ -950,7 +995,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float
accelerate_ship(aip, 1.0f);
else {
// AL 12-31-97: Move at least as quickly as your target is moving...
accelerate_ship(aip, max(1.0f - dot_to_enemy, Objects[aip->target_objnum].phys_info.fspeed/sip->max_speed));
accelerate_ship(aip, MAX(1.0f - dot_to_enemy, Objects[aip->target_objnum].phys_info.fspeed/sip->max_speed));
}
} else {
@@ -988,7 +1033,7 @@ void ai_big_chase_ct()
extern void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 = -1, int priority2 = -1);
extern float set_secondary_fire_delay(ai_info *aip, ship *shipp, weapon_info *swip);
extern void ai_choose_secondary_weapon(object *objp, ai_info *aip, object *en_objp);
extern int maybe_avoid_big_ship(object *objp, object *ignore_objp, ai_info *aip, vector *goal_point, float delta_time);
extern int maybe_avoid_big_ship(object *objp, object *ignore_objp, ai_info *aip, vec3d *goal_point, float delta_time);
extern void maybe_cheat_fire_synaptic(object *objp, ai_info *aip);
@@ -997,7 +1042,7 @@ extern void maybe_cheat_fire_synaptic(object *objp, ai_info *aip);
// dist_to_enemy => distance (in m) to attack point on current target
// dot_to_enemy => dot product between fvec of Pl_objp and vector from Pl_objp to attack point
//
void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector *firing_pos, vector *enemy_pos, vector *enemy_vel)
void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *firing_pos, vec3d *enemy_pos, vec3d *enemy_vel)
{
ai_info *aip;
ship_weapon *swp;
@@ -1006,12 +1051,12 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector *
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
swp = &Ships[Pl_objp->instance].weapons;
if (dot_to_enemy > 0.95f - 0.5f * En_objp->radius/max(1.0f, En_objp->radius + dist_to_enemy)) {
if (dot_to_enemy > 0.95f - 0.5f * En_objp->radius/MAX(1.0f, En_objp->radius + dist_to_enemy)) {
aip->time_enemy_in_range += flFrametime;
// Chance of hitting ship is based on dot product of firing ship's forward vector with vector to ship
// and also the size of the target relative to distance to target.
if (dot_to_enemy > max(0.5f, 0.90f + aip->ai_accuracy/10.0f - En_objp->radius/max(1.0f,dist_to_enemy))) {
if (dot_to_enemy > MAX(0.5f, 0.90f + aip->ai_accuracy/10.0f - En_objp->radius/MAX(1.0f,dist_to_enemy))) {
ship *temp_shipp;
temp_shipp = &Ships[Pl_objp->instance];
@@ -1021,7 +1066,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector *
Assert(tswp->current_primary_bank < tswp->num_primary_banks);
weapon_info *wip = &Weapon_info[tswp->primary_bank_weapons[tswp->current_primary_bank]];
if (dist_to_enemy < wip->max_speed * wip->lifetime){
if (dist_to_enemy < MIN((wip->max_speed * wip->lifetime), wip->weapon_range)){
has_fired = 1;
if(! ai_fire_primary_weapon(Pl_objp)){
has_fired = -1;
@@ -1060,7 +1105,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector *
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
firing_range=swip->lssm_lock_range;
else
firing_range= swip->max_speed * swip->lifetime;
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
// reduce firing range of secondaries in nebula
extern int Nebula_sec_range;
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
@@ -1110,18 +1155,18 @@ void ai_big_switch_to_chase_mode(ai_info *aip)
aip->submode_start_time = Missiontime;
}
extern int ai_big_strafe_maybe_retreat(float dist, vector *target_pos);
extern int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos);
// Make object Pl_objp chase object En_objp, which is a big ship, not a small ship.
void ai_big_chase()
{
float dist_to_enemy, dot_to_enemy;
vector player_pos, enemy_pos, vec_to_enemy;
vec3d player_pos, enemy_pos, vec_to_enemy;
ship_info *sip = &Ship_info[Ships[Pl_objp->instance].ship_info_index];
ship *shipp = &Ships[Pl_objp->instance];
ai_info *aip = &Ai_info[shipp->ai_index];
int enemy_ship_type;
vector predicted_enemy_pos;
vec3d predicted_enemy_pos;
Assert(aip->mode == AIM_CHASE);
@@ -1152,8 +1197,9 @@ void ai_big_chase()
if (aip->ai_flags & AIF_TARGET_COLLISION) {
if ( ai_big_strafe_maybe_retreat(dist_to_enemy, &enemy_pos) ) {
aip->mode = AIM_STRAFE;
aip->submode = AIS_STRAFE_AVOID;
aip->submode_parm0 = Missiontime; // use parm0 as time strafe mode entered
aip->submode = AIS_STRAFE_AVOID;
aip->submode_start_time = Missiontime;
return;
}
}
@@ -1237,6 +1283,7 @@ void ai_big_chase()
default:
aip->last_attack_time = Missiontime;
aip->submode = SM_ATTACK;
aip->submode_start_time = Missiontime;
break;
}
@@ -1270,9 +1317,9 @@ void ai_big_chase()
// mprintf(("normal dist; %.1f, time: %.1f\n", dist_normal_to_enemy, time_to_enemy));
// }
// since we're not in strafe and we may get a bad normal, cap dist_normal_to_enemy as min(0.3*dist_to_enemy, self)
// since we're not in strafe and we may get a bad normal, cap dist_normal_to_enemy as MIN(0.3*dist_to_enemy, self)
// this will allow us to get closer on a bad normal
dist_normal_to_enemy = max(0.3f*dist_to_enemy, dist_normal_to_enemy);
dist_normal_to_enemy = MAX(0.3f*dist_to_enemy, dist_normal_to_enemy);
if (dist_to_enemy < ATTACK_COLLIDE_BASE_DIST) {
// within 50m or 1sec
@@ -1293,7 +1340,7 @@ void ai_big_chase()
}
}
float speed_dist = max(0.0f, (Pl_objp->phys_info.speed-50) * 2);
float speed_dist = MAX(0.0f, (Pl_objp->phys_info.speed-50) * 2);
if ((dist_normal_to_enemy < ATTACK_COLLIDE_AVOID_DIST + speed_dist) || (time_to_enemy < ATTACK_COLLIDE_AVOID_TIME) ) {
// get away, simulate crsh recovery (don't use avoid)
// accelerate_ship(aip, -1.0f);
@@ -1352,8 +1399,8 @@ void ai_big_chase()
if (box_dist > 300) {
aip->submode = SM_ATTACK;
aip->last_attack_time = Missiontime;
aip->submode_start_time = Missiontime;
aip->last_attack_time = Missiontime;
}
}
break;
@@ -1365,8 +1412,8 @@ void ai_big_chase()
aip->submode_start_time = Missiontime;
} else {
aip->submode = SM_ATTACK;
aip->last_attack_time = Missiontime;
aip->submode_start_time = Missiontime;
aip->last_attack_time = Missiontime;
}
}
@@ -1382,8 +1429,8 @@ void ai_big_chase()
default:
aip->submode = SM_ATTACK;
aip->last_attack_time = Missiontime;
aip->submode_start_time = Missiontime;
aip->last_attack_time = Missiontime;
}
//
@@ -1412,9 +1459,9 @@ void ai_big_ship(object *objp)
// dist => distance from Pl_objp front to attack point
// dot => dot of Pl_objp fvec and vector to attack point
// fire_pos => world pos from which firing
void ai_big_attack_get_data(vector *enemy_pos, float *dist_to_enemy, float *dot_to_enemy)
void ai_big_attack_get_data(vec3d *enemy_pos, float *dist_to_enemy, float *dot_to_enemy)
{
vector player_pos, vec_to_enemy, predicted_enemy_pos;
vec3d player_pos, vec_to_enemy, predicted_enemy_pos;
ship *shipp = &Ships[Pl_objp->instance];
ai_info *aip = &Ai_info[shipp->ai_index];
ship_info *esip = &Ship_info[Ships[En_objp->instance].ship_info_index];
@@ -1449,7 +1496,7 @@ void ai_big_attack_get_data(vector *enemy_pos, float *dist_to_enemy, float *dot_
if ((*dot_to_enemy < 0.25f) || (aip->target_time < 1.0f) || (aip->ai_flags & AIF_SEEK_LOCK)) {
predicted_enemy_pos=*enemy_pos;
} else {
vector gun_pos, pnt;
vec3d gun_pos, pnt;
polymodel *po = model_get( shipp->modelnum );
float weapon_speed;
@@ -1471,12 +1518,12 @@ void ai_big_attack_get_data(vector *enemy_pos, float *dist_to_enemy, float *dot_
// check to see if Pl_objp has gotten too close to attacking point.. if so, break off by entering
// AIS_STRAFE_RETREAT
int ai_big_strafe_maybe_retreat(float dist, vector *target_pos)
int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos)
{
ai_info *aip;
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
vector vec_to_target;
vec3d vec_to_target;
vm_vec_sub(&vec_to_target, target_pos, &Pl_objp->pos);
float dist_to_target, dist_normal_to_target, time_to_target;
@@ -1487,11 +1534,11 @@ int ai_big_strafe_maybe_retreat(float dist, vector *target_pos)
dist_normal_to_target = 0.2f * vm_vec_mag_quick(&vec_to_target);
}
dist_normal_to_target = max(0.2f*dist_to_target, dist_normal_to_target);
dist_normal_to_target = MAX(0.2f*dist_to_target, dist_normal_to_target);
time_to_target = dist_normal_to_target / Pl_objp->phys_info.speed;
// add distance penalty for going too fast
float speed_to_dist_penalty = max(0.0f, (Pl_objp->phys_info.speed-50));
float speed_to_dist_penalty = MAX(0.0f, (Pl_objp->phys_info.speed-50));
//if ((dot_to_enemy > 1.0f - 0.1f * En_objp->radius/(dist_to_enemy + 1.0f)) && (Pl_objp->phys_info.speed > dist_to_enemy/5.0f))
@@ -1509,7 +1556,7 @@ int ai_big_strafe_maybe_retreat(float dist, vector *target_pos)
float box_dist;
int is_inside;
vector goal_point;
vec3d goal_point;
box_dist = get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST);
// set goal point
@@ -1531,8 +1578,8 @@ int ai_big_strafe_maybe_retreat(float dist, vector *target_pos)
void ai_big_strafe_attack()
{
ai_info *aip;
vector target_pos;
vector rand_vec;
vec3d target_pos;
vec3d rand_vec;
float target_dist, target_dot, accel, t;
object *target_objp;
@@ -1634,7 +1681,7 @@ void ai_big_strafe_attack()
void ai_big_strafe_avoid()
{
ai_info *aip;
vector target_pos;
vec3d target_pos;
float target_dist, target_dot;
fix mode_time;
@@ -1661,7 +1708,7 @@ void ai_big_strafe_retreat1()
{
float dist;
ai_info *aip;
vector rand_vec;
vec3d rand_vec;
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
@@ -1907,24 +1954,26 @@ void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp)
return;
}
// Only attack turret if it sits on current target
Assert(weapon_objp->parent >= 0 && weapon_objp->parent < MAX_OBJECTS);
parent_objp = &Objects[weapon_objp->parent];
// UnknownPlayer : Decide whether or not this weapon was a beam, in which case it might be a good
// idea to go after it even if its not on the current target. This is randomized so
// the ai will not always go after different ships firing beams at them.
// Approx 1/4 chance we'll go after the other ship's beam.
if ( Weapon_info[weapon_objp->instance].wi_flags & WIF_BEAM ) {
// Approx 1/4 chance we'll go after the beam
if (frand()*100 > 25.0f) {
if ( (parent_objp->signature != weapon_objp->parent_sig) || (parent_objp->type != OBJ_SHIP) ) {
return;
}
bool attack_turret_on_different_ship = (The_mission.flags & MISSION_FLAG_USE_NEW_AI)
&& (Weapon_info[weapon_objp->instance].wi_flags & WIF_BEAM) && (frand()*100 < 25.0f);
// unless we're making an exception, we should only attack a turret if it sits on the current target
if ( !attack_turret_on_different_ship )
{
if ( (parent_objp->signature != weapon_objp->parent_sig) || (parent_objp->type != OBJ_SHIP) ) {
return;
}
if ( aip->target_objnum != OBJ_INDEX(parent_objp) ) {
return;
}
if ( aip->target_objnum != OBJ_INDEX(parent_objp) ) {
return;
}
}
@@ -9,13 +9,26 @@
/*
* $Logfile: /Freespace2/code/Ship/AiBig.h $
* $Revision: 2.1 $
* $Date: 2004-03-05 09:01:51 $
* $Revision: 1.3 $
* $Date: 2005-07-13 02:50:48 $
* $Author: Goober5000 $
*
* Header file for AI code related to large ships
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/04/05 05:53:13 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 1.1 2005/03/25 06:45:12 wmcoolmon
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
*
* Revision 2.2 2004/08/11 05:06:34 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.1 2004/03/05 09:01:51 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.0 2002/06/03 04:02:28 penguin
* Warpcore CVS sync
*
@@ -70,13 +83,12 @@
* $NoKeywords: $
*/
#ifndef __AIBIG_H__
#define __AIBIG_H__
struct object;
struct ai_info;
struct vector;
struct vec3d;
struct ship_subsys;
void ai_big_ship(object *objp);
@@ -87,8 +99,8 @@ void ai_big_subsys_path_cleanup(ai_info *aip);
void ai_big_strafe();
int ai_big_maybe_enter_strafe_mode(object *objp, int weapon_objnum, int consider_target_only=0);
void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp);
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attack_point, float fov=1.0f);
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vector *gpos, vector *gvec, vector *attack_point, float weapon_travel_dist, float fov=1.0f);
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov=1.0f);
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float weapon_travel_dist, float fov=1.0f);
#endif
File diff suppressed because it is too large. Load diff
@@ -9,13 +9,119 @@
/*
* $Logfile: /Freespace2/code/Ship/AiGoals.cpp $
* $Revision: 2.11 $
* $Date: 2004-03-05 09:01:52 $
* $Revision: 1.12 $
* $Date: 2005-08-31 08:11:58 $
* $Author: Goober5000 $
*
* File to deal with manipulating AI goals, etc.
*
* $Log: not supported by cvs2svn $
* Revision 1.11 2005/08/31 08:09:51 Goober5000
* All wings will now form on their respective leaders, not just certain starting wings.
* If this breaks anything, the old code is commented out. You know who to yell at. ;)
* --Goober5000
*
* Revision 1.10 2005/08/31 07:54:33 Goober5000
* Wings will now form on their leader, not necessarily the player. This is to
* account for cases where the player is not the leader of his wing. It has the
* side effect of causing wings that arrive later in the mission to form on *their*
* leader rather than the player, but this is probably the preferred behavior (at
* least judging from Mike Kulas's comment of 5/9/98). This does create a
* difference from retail AI, but it should be only cosmetic, since ships only form
* on a wing until they are ordered (via comm or sexp) to do something else.
* --Goober5000
*
* Revision 1.9 2005/08/23 09:18:08 Goober5000
* ensure init/reset of goals works cleanly
* --Goober5000
*
* Revision 1.8 2005/08/23 09:03:56 Goober5000
* fix for bug 519
* --Goober5000
*
* Revision 1.7 2005/07/27 18:27:49 Goober5000
* verified that submode_start_time is updated whenever submode is changed
* --Goober5000
*
* Revision 1.6 2005/07/25 03:13:24 Goober5000
* various code cleanups, tweaks, and fixes; most notably the MISSION_FLAG_USE_NEW_AI
* should now be added to all places where it is needed (except the turret code, which I still
* have to to review)
* --Goober5000
*
* Revision 1.5 2005/07/23 18:38:47 Goober5000
* fixed a rare but ugly (though amusing) bug
* --Goober5000
*
* Revision 1.4 2005/07/22 10:18:36 Goober5000
* CVS header tweaks
* --Goober5000
*
* Revision 1.3 2005/07/13 02:50:48 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 1.2 2005/05/11 11:38:03 Goober5000
* fixed a docking bug
* --Goober5000
*
* Revision 1.1 2005/03/25 06:45:13 wmcoolmon
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
*
* Revision 2.24 2005/03/02 21:24:47 taylor
* more network/inferno goodness for Windows, takes care of a few warnings too
*
* Revision 2.23 2005/01/31 10:34:39 taylor
* merge with Linux/OSX tree - p0131
*
* Revision 2.22 2005/01/26 05:44:10 Goober5000
* AHA... squashed another bug
* --Goober5000
*
* Revision 2.21 2005/01/18 00:14:36 Goober5000
* clarified a bunch of sexp stuff and fixed a bug
* --Goober5000
*
* Revision 2.20 2005/01/13 03:33:07 Goober5000
* hmm, rolled back one of my clarifications since it caused things to get messed up
* --Goober5000
*
* Revision 2.19 2005/01/13 01:10:33 Goober5000
* forgot to remove a comment
* --Goober5000
*
* Revision 2.18 2005/01/12 23:38:42 Goober5000
* fixed another nasty bug
* --Goober5000
*
* Revision 2.17 2005/01/11 21:38:48 Goober5000
* multiple ship docking :)
* don't tell anyone yet... check the SCP internal
* --Goober500
*
* Revision 2.16 2004/12/14 14:46:12 Goober5000
* allow different wing names than ABGDEZ
* --Goober5000
*
* Revision 2.15 2004/07/26 20:47:51 Kazan
* remove MCD complete
*
* Revision 2.14 2004/07/25 18:46:30 Kazan
* -fred_no_warn has become -no_warn and applies to both fred and fs2
* added new ai directive (last commit) and disabled afterburners while performing AIM_WAYPOINTS or AIM_FLY_TO_SHIP
* fixed player ship speed bug w/ player-use-ai, now stays in formation correctly and manages speed
* made -radar_reduce ignore itself if no parameter is given (ignoring launcher bug)
*
* Revision 2.13 2004/07/25 00:31:31 Kazan
* i have absolutely nothing to say about that subject
*
* Revision 2.12 2004/07/12 16:33:05 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.11 2004/03/05 09:01:52 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.10 2004/02/04 09:21:36 Goober5000
* more player ai stuff
* --Goober5000
@@ -95,8 +201,8 @@
* subsystem as model_read.
*
* 9 6/03/99 8:58p Andsager
* Fix bug where player's target is lost. Alpha wing had clear wing
* goals, and this was applied to alpha1.
* Fix bug where player's target is lost. Player wing had clear wing
* goals, and this was applied to player.
*
* 8 5/27/99 12:14p Andsager
* Some fixes for live debris when more than one subsys on ship with live
@@ -145,7 +251,7 @@
* 169 5/11/98 11:20a Sandeep
*
* 168 5/10/98 12:02a Mike
* Only Alpha wing will form on player's wing, not any player wing.
* Only player's wing will form on player's wing, not any wing in player's squadron.
*
* 167 4/23/98 1:49a Allender
* major rearm/repair fixes for multiplayer. Fixed respawning of AI ships
@@ -441,7 +547,7 @@
* goal vs. ship type validity
*
* 91 8/12/97 9:58a Hoffoss
* Fixed ai_update_goal_references() and query_referended_in_ai_goals().
* Fixed ai_update_goal_references() and query_referenced_in_ai_goals().
*
* 90 8/12/97 8:01a Allender
* when adding goals to wing structures, replace the oldest entry of the
@@ -510,7 +616,8 @@
* $NoKeywords: $
*/
#include "ship/aigoals.h"
#include "ai/aigoals.h"
#include "parse/sexp.h"
#include "mission/missionlog.h"
#include "mission/missionparse.h"
@@ -521,6 +628,8 @@
#include "network/multi.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
#include "object/objectdock.h"
// all ai goals dealt with in this code are goals that are specified through
// sexpressions in the mission file. They are either specified as part of a
@@ -593,28 +702,37 @@ char *Ai_goal_text(int goal)
// function to maybe add the form on my wing goal for a player's starting wing. Called from below and when a
// player wing arrives.
// Goober5000 - made more generic
void ai_maybe_add_form_goal( wing *wingp )
{
int j;
char *wing_leader;
// Goober5000 - the wing leader is now not necessarily the player
wing_leader = Ships[wingp->ship_index[wingp->special_ship]].ship_name;
// iterate through the ship_index list of this wing and check for orders. We will do
// this for all ships in the wing instead of on a wing only basis in cases some ships
// this for all ships in the wing instead of on a wing only basis in case some ships
// in the wing actually have different orders than others
for ( j = 0; j < wingp->current_count; j++ ) {
ai_info *aip;
Assert( wingp->ship_index[j] != -1 ); // get Allender
// don't process wing leader
if (j == wingp->special_ship)
continue;
aip = &Ai_info[Ships[wingp->ship_index[j]].ai_index];
// don't process Player_ship
if ( aip == Player_ai )
continue;
// it is sufficient enough to check the first goal entry to see if it has a valid
// goal
// it is sufficient enough to check the first goal entry to see if it has a valid goal
if ( aip->goals[0].ai_mode == AI_GOAL_NONE ) {
// need to add a form on my wing goal here. Ships are always forming on the player's wing.
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Player_ship->ship_name, aip );
// need to add a form on my wing goal here
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, wing_leader, aip );
}
}
}
@@ -629,8 +747,16 @@ void ai_post_process_mission()
// (2) if they have an order, they are free to act on it.
//
// So basically, we are checking for (1)
if ( !Fred_running ) {
for ( i = 0; i < 1; i++ ) { // MK, 5/9/98: Used to iterate through MAX_PLAYER_WINGS, but this was too many ships forming on player.
if ( !Fred_running )
{
// Goober5000 - make all wings form on their respective leaders
for ( i = 0; i < num_wings; i++ )
{
ai_maybe_add_form_goal( &Wings[i] );
}
/*
for ( i = 0; i < 1; i++ ) { // MK, 5/9/98: Used to iterate through MAX_STARTING_WINGS, but this was too many ships forming on player.
if ( Starting_wings[i] != -1 ) {
wing *wingp;
@@ -640,6 +766,7 @@ void ai_post_process_mission()
}
}
*/
}
// for every valid ship object, call process_mission_orders to be sure that ships start the
@@ -766,6 +893,7 @@ void ai_remove_ship_goal( ai_info *aip, int index )
aip->goals[index].signature = -1;
aip->goals[index].priority = -1;
aip->goals[index].flags = 0; // must reset the flags since not doing so will screw up goal sorting.
if ( index == aip->active_goal )
aip->active_goal = AI_GOAL_NONE;
@@ -786,7 +914,9 @@ void ai_clear_ship_goals( ai_info *aip )
// next line moved here on 8/5/97 by MWA
// Dont reset player ai (and hence target)
// Goober5000 - account for player ai
if ( !((Player_ship != NULL) && (&Ships[aip->shipnum] == Player_ship)) || Player_use_ai ) {
//if ( !((Player_ship != NULL) && (&Ships[aip->shipnum] == Player_ship)) || Player_use_ai ) {
if ( (Player_ship == NULL) || (&Ships[aip->shipnum] != Player_ship) || Player_use_ai )
{
ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] );
}
}
@@ -811,6 +941,7 @@ void ai_clear_wing_goals( int wingnum )
wingp->ai_goals[i].ai_mode = AI_GOAL_NONE;
wingp->ai_goals[i].signature = -1;
wingp->ai_goals[i].priority = -1;
wingp->ai_goals[i].flags = 0;
}
@@ -870,6 +1001,7 @@ void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp )
wingp->ai_goals[i].ai_mode = AI_GOAL_NONE;
wingp->ai_goals[i].signature = -1;
wingp->ai_goals[i].priority = -1;
wingp->ai_goals[i].flags = 0;
break;
}
}
@@ -1014,13 +1146,61 @@ void ai_goal_purge_all_invalid_goals( ai_goal *aigp )
ai_goal_purge_invalid_goals( aigp, Wings[i].ai_goals );
}
// Goober5000
int ai_goal_find_dockpoint(int shipnum, int dock_type)
{
int dock_index = -1;
int loop_count = 0;
ship *shipp = &Ships[shipnum];
object *objp = &Objects[shipp->objnum];
// only check 100 points for sanity's sake
while (loop_count < 100)
{
dock_index = model_find_dock_index(shipp->modelnum, dock_type, dock_index+1);
// not found?
if (dock_index == -1)
{
if (loop_count == 0)
{
// first time around... there are no slots fitting this description
return -1;
}
else
{
// every slot is full
break;
}
}
// we've found something... check if it's occupied
if (dock_find_object_at_dockpoint(objp, dock_index) == NULL)
{
// not occupied... yay, we've found an index
return dock_index;
}
// keep track
loop_count++;
}
// insanity?
if (loop_count >= 100)
Warning(LOCATION, "Too many iterations while looking for a dockpoint on %s. Either there was a bug or this is an übership.\n", shipp->ship_name);
// if we're here, just return the first dockpoint
return model_find_dock_index(shipp->modelnum, dock_type);
}
// function to fix up dock point references for objects.
// passed are the pointer to goal we are working with. aip if the ai_info pointer
// of the ship with the order. aigp is a pointer to the goal (of aip) of which we are
// fixing up the docking points
void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
{
int shipnum, dockee_index, docker_index;
int shipnum, docker_index, dockee_index;
Assert ( aip->shipnum != -1 );
shipnum = ship_name_lookup( aigp->ship_name );
@@ -1028,24 +1208,23 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
dockee_index = -1;
// look for docking points of the appriopriate type. Use cargo docks for cargo ships.
// use
if ( Ship_info[Ships[shipnum].ship_info_index].flags & SIF_CARGO ) {
docker_index = model_find_dock_index(Ships[aip->shipnum].modelnum, DOCK_TYPE_CARGO );
dockee_index = model_find_dock_index(Ships[shipnum].modelnum, DOCK_TYPE_CARGO );
} else if ( Ship_info[Ships[aip->shipnum].ship_info_index].flags & SIF_SUPPORT ) {
docker_index = model_find_dock_index( Ships[aip->shipnum].modelnum, DOCK_TYPE_REARM );
dockee_index = model_find_dock_index( Ships[shipnum].modelnum, DOCK_TYPE_REARM );
if (Ship_info[Ships[shipnum].ship_info_index].flags & SIF_CARGO) {
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_CARGO);
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_CARGO);
} else if (Ship_info[Ships[aip->shipnum].ship_info_index].flags & SIF_SUPPORT) {
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_REARM);
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_REARM);
}
// if we didn't find dockpoints above, then we should just look for generic docking points
if ( docker_index == -1 )
docker_index = model_find_dock_index(Ships[aip->shipnum].modelnum, DOCK_TYPE_GENERIC );
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_GENERIC);
if ( dockee_index == -1 )
dockee_index = model_find_dock_index(Ships[shipnum].modelnum, DOCK_TYPE_GENERIC );
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_GENERIC);
aigp->docker.index = docker_index;
aigp->dockee.index = dockee_index;
aigp->flags &= ~(AIGF_DOCKER_NAME_VALID | AIGF_DOCKEE_NAME_VALID);
aigp->flags |= AIGF_DOCK_INDEXES_VALID;
}
// these functions deal with adding goals sent from the player. They are slightly different
@@ -1087,27 +1266,36 @@ void ai_add_goal_sub_player(int type, int mode, int submode, char *shipname, ai_
aigp->priority = PLAYER_PRIORITY_SHIP;
}
int ai_goal_find_empty_slot( ai_goal *goals )
// Goober5000 - Modified this function for clarity and to avoid returning the active goal's index
// as the empty slot. This avoids overwriting the active goal while it's being executed. So far
// the only time I've noticed it being a problem is during a rare situation where more than five
// friendlies want to rearm at the same time. The support ship forgets what it's doing and flies
// off to repair somebody while still docked. I reproduced this with retail, so it's not a bug in
// my new docking code. :)
int ai_goal_find_empty_slot( ai_goal *goals, int active_goal )
{
int gindex, empty_index, oldest_index;
int gindex, oldest_index;
empty_index = -1;
oldest_index = 0;
for ( gindex = 0; gindex < MAX_AI_GOALS; gindex++ ) {
if ( goals[gindex].time < goals[oldest_index].time )
oldest_index = -1;
for ( gindex = 0; gindex < MAX_AI_GOALS; gindex++ )
{
// get the index for the first unused goal
if (goals[gindex].ai_mode == AI_GOAL_NONE)
return gindex;
// if this is the active goal, don't consider it for pre-emption!!
if (gindex == active_goal)
continue;
// store the index of the oldest goal
if (oldest_index < 0)
oldest_index = gindex;
else if (goals[gindex].time < goals[oldest_index].time)
oldest_index = gindex;
if ( (empty_index == -1) && (goals[gindex].ai_mode == AI_GOAL_NONE) ) // get the index for this goal
empty_index = gindex;
}
// if we didn't find an empty slot, find the oldest goal and use it's slot
if ( empty_index == -1 )
empty_index = oldest_index;
Assert ( empty_index < MAX_AI_GOALS );
return empty_index;
// if we didn't find an empty slot, use the oldest goal's slot
return oldest_index;
}
// adds a goal from a player to the given ship's ai_info structure. 'type' tells us if goal
@@ -1119,7 +1307,7 @@ void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, a
int empty_index;
ai_goal *aigp;
empty_index = ai_goal_find_empty_slot( aip->goals );
empty_index = ai_goal_find_empty_slot( aip->goals, aip->active_goal );
// get a pointer to the goal structure
aigp = &aip->goals[empty_index];
@@ -1158,13 +1346,13 @@ void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, i
// add the sexpression index into the wing's list of goal sexpressions if
// there are more waves to come. We use the same method here as when adding a goal to
// a ship -- find the first empty entry. If none exists, take the oldest entry and replace it.
empty_index = ai_goal_find_empty_slot( wingp->ai_goals );
empty_index = ai_goal_find_empty_slot( wingp->ai_goals, -1 );
ai_add_goal_sub_player( type, mode, submode, shipname, &wingp->ai_goals[empty_index] );
}
// common routine to add a sexpression mission goal to the appropriate goal structure.
void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
{
int n, node, dummy, op;
char *text;
@@ -1175,11 +1363,12 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
aigp->signature = Ai_goal_signature++;
aigp->ship_name = NULL;
aigp->time = Missiontime;
aigp->type = type;
aigp->flags = 0;
op = find_operator( text );
op = get_operator_const( text );
switch (op) {
@@ -1207,11 +1396,10 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
case OP_AI_DESTROY_SUBSYS:
aigp->ai_mode = AI_GOAL_DESTROY_SUBSYSTEM;
aigp->ship_name = ai_get_goal_ship_name( CTEXT(CDR(node)), &aigp->ship_name_index );
// store the name of the subsystem in the docker_name field for now -- this field must
// get fixed up when the goal is valid since we need to locate the subsystem on the ship's
// model.
// store the name of the subsystem in the docker.name field for now -- this field must get
// fixed up when the goal is valid since we need to locate the subsystem on the ship's model
aigp->docker.name = ai_get_goal_ship_name(CTEXT(CDR(CDR(node))), &dummy);
aigp->flags |= AIGF_SUBSYS_NAME_VALID;
aigp->flags |= AIGF_SUBSYS_NEEDS_FIXUP;
aigp->priority = atoi( CTEXT(CDR(CDR(CDR(node)))) );
break;
@@ -1244,8 +1432,14 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
break;
case OP_AI_UNDOCK:
aigp->ship_name = NULL;
aigp->priority = atoi( CTEXT(CDR(node)) );
// Goober5000 - optional undock with something
if (CDR(CDR(node)) != -1)
aigp->ship_name = ai_get_goal_ship_name( CTEXT(CDR(CDR(node))), &aigp->ship_name_index );
else
aigp->ship_name = NULL;
aigp->ai_mode = AI_GOAL_UNDOCK;
aigp->ai_submode = AIS_UNDOCK_0;
break;
@@ -1260,7 +1454,7 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
aigp->ship_name = ai_get_goal_ship_name( CTEXT(CDR(node)), &aigp->ship_name_index );
aigp->docker.name = ai_add_dock_name(CTEXT(CDR(CDR(node))));
aigp->dockee.name = ai_add_dock_name(CTEXT(CDR(CDR(CDR(node)))));
aigp->flags |= ( AIGF_DOCKER_NAME_VALID | AIGF_DOCKEE_NAME_VALID );
aigp->flags &= ~AIGF_DOCK_INDEXES_VALID;
aigp->priority = atoi( CTEXT(CDR(CDR(CDR(CDR(node))))) );
aigp->ai_mode = AI_GOAL_DOCK;
@@ -1373,6 +1567,18 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
nprintf (("AI", "bashing sexpression priority of goal %s from %d to %d.\n", text, aigp->priority, PLAYER_PRIORITY_MIN-1));
aigp->priority = PLAYER_PRIORITY_MIN-1;
}
// Goober5000 - since none of the goals act on the actor,
// don't assign the goal if the actor's goal target is itself
if (aigp->ship_name != NULL && !strcmp(aigp->ship_name, actor_name))
{
// based on ai_remove_ship_goal, these seem to be the only statements
// necessary to cause this goal to "never have been assigned"
aigp->ai_mode = AI_GOAL_NONE;
aigp->signature = -1;
aigp->priority = -1;
aigp->flags = 0;
}
}
// adds an ai goal for an individual ship
@@ -1381,8 +1587,8 @@ void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip )
{
int gindex;
gindex = ai_goal_find_empty_slot( aip->goals );
ai_add_goal_sub_sexp( sexp, type, &aip->goals[gindex] );
gindex = ai_goal_find_empty_slot( aip->goals, aip->active_goal );
ai_add_goal_sub_sexp( sexp, type, &aip->goals[gindex], Ships[aip->shipnum].ship_name );
}
// code to add ai goals to wings.
@@ -1391,7 +1597,7 @@ void ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
int i;
wing *wingp = &Wings[wingnum];
// add the ai goal for any ship that is currently arrived in the game (only if fred isn't running
// add the ai goal for any ship that is currently arrived in the game (only if fred isn't running)
if ( !Fred_running ) {
for (i = 0; i < wingp->current_count; i++) {
int num = wingp->ship_index[i];
@@ -1406,8 +1612,8 @@ void ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
if ((wingp->num_waves - wingp->current_wave > 0) || Fred_running) {
int gindex;
gindex = ai_goal_find_empty_slot( wingp->ai_goals );
ai_add_goal_sub_sexp( sexp, type, &wingp->ai_goals[gindex] );
gindex = ai_goal_find_empty_slot( wingp->ai_goals, -1 );
ai_add_goal_sub_sexp( sexp, type, &wingp->ai_goals[gindex], wingp->name );
}
}
@@ -1425,9 +1631,18 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int doc
int gindex;
ai_goal *aigp;
// find an empty slot to put this goal in.
gindex = ai_goal_find_empty_slot( aip->goals );
#ifndef NDEBUG
// Goober5000 - none of the goals act on the actor, as in ai_add_goal_sub_sexp
if (!strcmp(name, Ships[aip->shipnum].ship_name))
{
// not good
Int3();
return;
}
#endif
// find an empty slot to put this goal in.
gindex = ai_goal_find_empty_slot( aip->goals, aip->active_goal );
aigp = &(aip->goals[gindex]);
aigp->signature = Ai_goal_signature++;
@@ -1437,6 +1652,8 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int doc
aigp->flags = AIGF_GOAL_OVERRIDE;
switch ( goal_type ) {
/* Goober5000 - this seems to not be used
case AI_GOAL_DOCK:
aigp->ship_name = name;
aigp->docker.index = docker_point;
@@ -1446,19 +1663,24 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int doc
aigp->ai_mode = AI_GOAL_DOCK;
aigp->ai_submode = AIS_DOCK_0; // be sure to set the submode
break;
*/
case AI_GOAL_UNDOCK:
aigp->ship_name = NULL;
aigp->ship_name = name;
aigp->priority = 100;
aigp->ai_mode = AI_GOAL_UNDOCK;
aigp->ai_submode = AIS_UNDOCK_0;
break;
/* Goober5000 - this seems to not be used
case AI_GOAL_GUARD:
aigp->ai_mode = AI_GOAL_GUARD;
if ( wing_name_lookup(name, 1) != -1 )
aigp->ai_mode = AI_GOAL_GUARD_WING;
else
aigp->ai_mode = AI_GOAL_GUARD;
aigp->priority = PLAYER_PRIORITY_MIN-1; // make the priority always less than what the player's is
break;
*/
case AI_GOAL_REARM_REPAIR:
aigp->ai_mode = AI_GOAL_REARM_REPAIR;
@@ -1471,7 +1693,7 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int doc
default:
Int3(); // unsupported internal goal -- see Mike K or Mark A.
break;
return;
}
@@ -1544,7 +1766,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
if (!(shipp->flags2 & SF2_NO_SUBSPACE_DRIVE))
return AI_GOAL_ACHIEVABLE;
// if subspace drive, only valid if there's somewhere to depart to
// if no subspace drive, only valid if there's somewhere to depart to
// locate a capital ship on the same team:
if (ship_get_ship_with_dock_bay(shipp->team) >= 0)
@@ -1614,9 +1836,9 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// destroyed when shipnum is valid
shipnum = ship_name_lookup( aigp->ship_name );
// can't determine the status of this goal if ship not valid or the subsystem
// name *is* still valid (meaning we haven't found a valid index yet).
if ( (shipnum == -1) || (aigp->flags & AIGF_SUBSYS_NAME_VALID) ) {
// can't determine the status of this goal if ship not valid
// or we haven't found a valid subsystem index yet
if ( (shipnum == -1) || (aigp->flags & AIGF_SUBSYS_NEEDS_FIXUP) ) {
status = 0;
break;
}
@@ -1644,7 +1866,8 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
case AI_GOAL_EVADE_SHIP:
case AI_GOAL_CHASE:
case AI_GOAL_STAY_NEAR_SHIP:
case AI_GOAL_REARM_REPAIR: {
case AI_GOAL_REARM_REPAIR:
case AI_GOAL_FLY_TO_SHIP: {
int shipnum;
// MWA -- 4/22/98. Check for the ship actually being in the mission before
@@ -1703,7 +1926,8 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// determine the status of the shipname that this object is acting on. There are a couple of
// special cases to deal with. Both the chase wing and undock commands will return from within
// the if statement.
if ( (aigp->ai_mode == AI_GOAL_CHASE_WING) || (aigp->ai_mode == AI_GOAL_GUARD_WING) ) {
if ( (aigp->ai_mode == AI_GOAL_CHASE_WING) || (aigp->ai_mode == AI_GOAL_GUARD_WING) )
{
int num = wing_name_lookup( aigp->ship_name );
wing *wingp = &Wings[num];
@@ -1713,16 +1937,32 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
return AI_GOAL_NOT_KNOWN;
else
return AI_GOAL_ACHIEVABLE;
} else if ( aigp->ai_mode == AI_GOAL_UNDOCK ) {
}
// Goober5000 - undocking from an unspecified object is always achievable;
// undocking from a specified object is handled below
else if ( (aigp->ai_mode == AI_GOAL_UNDOCK) && (aigp->ship_name == NULL) )
{
return AI_GOAL_ACHIEVABLE;
} else {
}
else
{
// goal ship is currently in mission
if ( ship_name_lookup( aigp->ship_name ) != -1 )
{
status = SHIP_STATUS_ARRIVED;
}
// goal ship is still on the arrival list
else if ( !mission_parse_ship_arrived(aigp->ship_name) )
{
status = SHIP_STATUS_NOT_ARRIVED;
}
// goal ship has left the area
else if ( ship_find_exited_ship_by_name(aigp->ship_name) != -1 )
{
status = SHIP_STATUS_GONE;
else {
}
else
{
Int3(); // get ALLENDER
status = SHIP_STATUS_UNKNOWN;
}
@@ -1740,25 +1980,20 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// this goal will get removed.
if ( (aigp->ai_mode == AI_GOAL_DOCK) && (status == SHIP_STATUS_ARRIVED) ) {
int index, modelnum, shipnum;
char docker_name[NAME_LENGTH], dockee_name[NAME_LENGTH];
// debug code to save off the name of the dockpoints (if they exist).
docker_name[0] = dockee_name[0] = '\0';
if ( aigp->flags & AIGF_DOCKER_NAME_VALID ) {
strcpy(docker_name, aigp->docker.name);
if (!(aigp->flags & AIGF_DOCKER_INDEX_VALID)) {
modelnum = Ships[objp->instance].modelnum;
index = model_find_dock_name_index(modelnum, aigp->docker.name);
aigp->docker.index = index;
aigp->flags &= ~AIGF_DOCKER_NAME_VALID;
aigp->flags |= AIGF_DOCKER_INDEX_VALID;
}
if ( aigp->flags & AIGF_DOCKEE_NAME_VALID ) {
if (!(aigp->flags & AIGF_DOCKEE_INDEX_VALID)) {
shipnum = ship_name_lookup(aigp->ship_name);
if ( shipnum != -1 ) {
strcpy(dockee_name, aigp->dockee.name);
modelnum = Ships[shipnum].modelnum;
index = model_find_dock_name_index(modelnum, aigp->dockee.name);
aigp->dockee.index = index;
aigp->flags &= ~AIGF_DOCKEE_NAME_VALID;
aigp->flags |= AIGF_DOCKEE_INDEX_VALID;
} else
aigp->dockee.index = -1; // this will force code into if statement below making goal not achievable.
}
@@ -1767,56 +2002,78 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
return AI_GOAL_NOT_ACHIEVABLE;
}
// we must also determine if this ship which is supposed to dock with something is currently
// docked with something else. If so, then return the ON_HOLD until it is not docked anymore
shipnum = ship_name_lookup(aigp->ship_name);
Assert( shipnum != -1 );
// if ship is disabled, dont' know if it can dock or not
// if ship is disabled, don't know if it can dock or not
if ( Ships[objp->instance].flags & SF_DISABLED )
return AI_GOAL_NOT_KNOWN;
// if the ship that I am supposed to dock with is docked with something else, then I need to put my
// goal on hold
// we must also determine if we're prevented from docking for any reason
shipnum = ship_name_lookup(aigp->ship_name);
Assert( shipnum != -1 );
object *goal_objp = &Objects[Ships[shipnum].objnum];
// if the ship that I am supposed to dock with is docked with something else, then I need to put my goal on hold
// [MK, 4/23/98: With Mark, we believe this fixes the problem of Comet refusing to warp out after docking with Omega.
// This bug occurred only when mission goals were validated in the frame in which Comet docked, which happened about
// once in 10-20 tries.]
if ( Ai_info[Ships[shipnum].ai_index].ai_flags & AIF_DOCKED )
if (aip->dock_objnum != Ships[shipnum].objnum)
return AI_GOAL_NOT_KNOWN;
// if this ship is docked and needs to get docked with something else, then undock this
// ship
if ( aip->ai_flags & AIF_DOCKED ) {
// if we are trying to dock with a different ship, then force this ship to undock
if ( aip->dock_objnum != Ships[shipnum].objnum ) {
// if this goal isn't on hold yet, then issue the undock goal and return NOT_KNOWN
// which will then place the goal on hold until the undocking is complete.
if ( !(aigp->flags & AIGF_GOAL_ON_HOLD) )
ai_add_goal_ship_internal( aip, AI_GOAL_UNDOCK, NULL, -1, -1, 0 );
return AI_GOAL_NOT_KNOWN;
} else {
// if this ship is already docked with the guy this order tells him to dock with,
// then mark the goal as satisfied.
// MWA 2/23/98 -- don't return anything. Since this item is a goal, the ai_dock code
// should remove the goal!!!!
//return AI_GOAL_SATISFIED;
if ( object_is_docked(goal_objp) )
{
// if the dockpoint I need to dock to is occupied by someone other than me
object *obstacle_objp = dock_find_object_at_dockpoint(goal_objp, aigp->dockee.index);
if (obstacle_objp == NULL)
{
// nobody in the way... we're good
}
else if (obstacle_objp != objp)
{
// return NOT_KNOWN which will place the goal on hold until the dockpoint is clear
return AI_GOAL_NOT_KNOWN;
}
}
// if this ship is docked and needs to get docked with something else, then undock this ship
if ( object_is_docked(objp) )
{
// if the dockpoint I need to dock with is occupied by someone other than the guy I need to dock to
object *obstacle_objp = dock_find_object_at_dockpoint(objp, aigp->docker.index);
if (obstacle_objp == NULL)
{
// nobody in the way... we're good
}
else if (obstacle_objp != goal_objp)
{
// if this goal isn't on hold yet, then issue the undock goal
if ( !(aigp->flags & AIGF_GOAL_ON_HOLD) )
ai_add_goal_ship_internal( aip, AI_GOAL_UNDOCK, Ships[obstacle_objp->instance].ship_name, -1, -1, 0 );
// return NOT_KNOWN which will place the goal on hold until the undocking is complete.
return AI_GOAL_NOT_KNOWN;
}
}
// Goober5000 - necessitated by the multiple ship docking
} else if ( (aigp->ai_mode == AI_GOAL_UNDOCK) && (status == SHIP_STATUS_ARRIVED) ) {
// Put this goal on hold if we're already undocking. Otherwise the new goal will pre-empt
// the current goal and strange things might happen. One is that the object movement code
// forgets the previous undocking and "re-docks" the previous goal's ship. Other problems
// might happen too, so err on the safe side. (Yay for emergent paragraph justification!)
if ((aip->mode == AIM_DOCK) && (aip->submode >= AIS_UNDOCK_0))
{
// only put it on hold if it's someone other than the guy we're undocking from right now!!
if (aip->goal_objnum != Ships[ship_name_lookup(aigp->ship_name)].objnum)
return AI_GOAL_NOT_KNOWN;
}
} else if ( (aigp->ai_mode == AI_GOAL_DESTROY_SUBSYSTEM) && (status == SHIP_STATUS_ARRIVED) ) {
// if the ship has arrived, and the goal is destroy subsystem, then check to see that we
// have fixed up the subsystem name (of the subsystem to destroy) into an index into
// the ship's subsystem list
if ( aigp->flags & AIGF_SUBSYS_NAME_VALID ) {
if ( aigp->flags & AIGF_SUBSYS_NEEDS_FIXUP ) {
int shipnum;
shipnum = ship_name_lookup( aigp->ship_name );
if ( shipnum != -1 ) {
aigp->ai_submode = ship_get_subsys_index( &Ships[shipnum], aigp->docker.name );
aigp->flags &= ~AIGF_SUBSYS_NAME_VALID;
aigp->flags &= ~AIGF_SUBSYS_NEEDS_FIXUP;
} else {
Int3();
return AI_GOAL_NOT_ACHIEVABLE; // force this goal to be invalid
@@ -1847,6 +2104,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
case AI_GOAL_IGNORE:
case AI_GOAL_EVADE_SHIP:
case AI_GOAL_STAY_NEAR_SHIP:
case AI_GOAL_FLY_TO_SHIP:
if ( status == SHIP_STATUS_ARRIVED )
return AI_GOAL_ACHIEVABLE;
else if ( status == SHIP_STATUS_NOT_ARRIVED )
@@ -2022,7 +2280,7 @@ void validate_mission_goals(int objnum, ai_info *aip)
// if the active goal is a rearm/repair goal, the put all other valid goals (which are not repair goals)
// on hold
if ( (aip->goals[0].ai_mode == AI_GOAL_REARM_REPAIR) && (aip->ai_flags & AIF_DOCKED) ) {
if ( (aip->goals[0].ai_mode == AI_GOAL_REARM_REPAIR) && object_is_docked(&Objects[objnum]) ) {
for ( i = 1; i < MAX_AI_GOALS; i++ ) {
if ( (aip->goals[i].ai_mode == AI_GOAL_NONE) || (aip->goals[i].ai_mode == AI_GOAL_REARM_REPAIR) )
continue;
@@ -2032,6 +2290,7 @@ void validate_mission_goals(int objnum, ai_info *aip)
}
//XSTR:OFF
/*
static char *Goal_text[5] = {
"EVENT_SHIP",
"EVENT_WING",
@@ -2039,6 +2298,7 @@ static char *Goal_text[5] = {
"PLAYER_WING",
"DYNAMIC",
};
*/
//XSTR:ON
extern char *Mode_text[MAX_AI_BEHAVIORS];
@@ -2116,10 +2376,13 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
// Goober5000 - we may want to use AI for the player
// AL 3-7-98: If this is a player ship, and the goal is not a formation goal, then do a quick out
if ( !(Player_use_ai) && (objp->flags & OF_PLAYER_SHIP) && (current_goal->ai_mode != AI_GOAL_FORM_ON_WING) ) {
if ( !(Player_use_ai) && (objp->flags & OF_PLAYER_SHIP) && (current_goal->ai_mode != AI_GOAL_FORM_ON_WING) )
{
return;
}
switch ( current_goal->ai_mode ) {
case AI_GOAL_CHASE:
@@ -2173,6 +2436,12 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
break;
}
case AI_GOAL_FLY_TO_SHIP:
shipnum = ship_name_lookup( current_goal->ship_name );
Assert (shipnum != -1 ); // shouldn't get here if this is false!!!!
ai_start_fly_to_ship(objp, shipnum);
break;
case AI_GOAL_DOCK: {
shipnum = ship_name_lookup( current_goal->ship_name );
Assert (shipnum != -1 ); // shouldn't get here if this is false!!!!
@@ -2180,10 +2449,8 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
// be sure that we have indices for docking points here! If we ever had names, they should
// get fixed up in goal_achievable so that the points can be checked there for validity
Assert ( !(current_goal->flags & AIGF_DOCKER_NAME_VALID) );
Assert ( !(current_goal->flags & AIGF_DOCKEE_NAME_VALID) );
ai_dock_with_object( objp, other_obj, current_goal->priority, AIDO_DOCK, current_goal->docker.index, current_goal->dockee.index );
aip->submode_start_time = Missiontime;
Assert (current_goal->flags & AIGF_DOCK_INDEXES_VALID);
ai_dock_with_object( objp, current_goal->docker.index, other_obj, current_goal->dockee.index, current_goal->priority, AIDO_DOCK );
break;
}
@@ -2191,7 +2458,42 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
// try to find the object which which this object is docked with. Use that object as the
// "other object" for the undocking proceedure. If "other object" isn't found, then the undock
// goal cannot continue. Spit out a warning and remove the goal.
other_obj = ai_find_docked_object( objp );
// Goober5000 - do we have a specific ship to undock from?
if ( current_goal->ship_name != NULL )
{
shipnum = ship_name_lookup( current_goal->ship_name );
// hmm, perhaps he was destroyed
if (shipnum == -1)
{
other_obj = NULL;
}
// he exists... let's undock from him
else
{
other_obj = &Objects[Ships[shipnum].objnum];
}
}
// no specific ship
else
{
// are we docked?
if (object_is_docked(objp))
{
// just pick the first guy we're docked to
other_obj = dock_get_first_docked_object( objp );
// and add the ship name so it displays on the HUD
current_goal->ship_name = Ships[other_obj->instance].ship_name;
}
// hmm, nobody exists that we can undock from
else
{
other_obj = NULL;
}
}
if ( other_obj == NULL ) {
//Int3();
// assume that the guy he was docked with doesn't exist anymore. (i.e. a cargo containuer
@@ -2200,8 +2502,18 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
ai_mission_goal_complete( aip ); // mark as complete, so we can remove it and move on!!!
break;
}
ai_dock_with_object( objp, other_obj, current_goal->priority, AIDO_UNDOCK, 0, 0 );
aip->submode_start_time = Missiontime;
// Goober5000 - Sometimes a ship will be assigned a new goal before it can finish undocking. Later,
// when the ship returns to this goal, it will try to resume undocking from a ship it's not attached
// to. If this happens, remove the goal as above.
if (!dock_check_find_direct_docked_object(objp, other_obj))
{
ai_mission_goal_complete( aip );
break;
}
// passing 0, 0 is okay because the undock code will figure out where to undock from
ai_dock_with_object( objp, 0, other_obj, 0, current_goal->priority, AIDO_UNDOCK );
break;
@@ -2274,6 +2586,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
ai_clear_ship_goals( aip );
aip->mode = AIM_PLAY_DEAD;
aip->submode = -1;
aip->submode_start_time = Missiontime;
break;
case AI_GOAL_FORM_ON_WING:
@@ -2307,7 +2620,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
case AI_GOAL_REARM_REPAIR:
shipnum = ship_name_lookup( current_goal->ship_name );
other_obj = &Objects[Ships[shipnum].objnum];
ai_rearm_repair( objp, other_obj, current_goal->priority, current_goal->docker.index, current_goal->dockee.index );
ai_rearm_repair( objp, current_goal->docker.index, other_obj, current_goal->dockee.index, current_goal->priority );
break;
default:
@@ -9,13 +9,26 @@
/*
* $Logfile: /Freespace2/code/Ship/AiGoals.h $
* $Revision: 2.4 $
* $Date: 2004-03-05 09:01:52 $
* $Revision: 1.2 $
* $Date: 2005-07-13 02:50:48 $
* $Author: Goober5000 $
*
* <insert description of file here>
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/03/25 06:45:13 wmcoolmon
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
*
* Revision 2.6 2004/08/11 05:06:34 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.5 2004/07/25 00:31:31 Kazan
* i have absolutely nothing to say about that subject
*
* Revision 2.4 2004/03/05 09:01:52 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.3 2003/01/07 20:06:44 Goober5000
* added ai-chase-any-except sexp
* --Goober5000
@@ -192,6 +205,7 @@ struct ai_goal;
#define AI_GOAL_PLAY_DEAD (1<<21)
#define AI_GOAL_CHASE_WEAPON (1<<22)
// Goober5000: new goals go here
// Goober5000: this new goal is special: it doesn't take the usual kind of argument; it takes
@@ -201,22 +215,24 @@ struct ai_goal;
// can only be specified through a sexp.
#define AI_GOAL_CHASE_ANY_EXCEPT (1<<23) // hey Hoffoss! I added a new goal! :p
#define AI_GOAL_FLY_TO_SHIP (1<<24) // kazan
// now the masks for ship types
// Goober5000: added AI_GOAL_STAY_NEAR_SHIP and AI_GOAL_KEEP_SAFE_DISTANCE as valid for fighters
#define AI_GOAL_ACCEPT_FIGHTER ( AI_GOAL_CHASE | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_DESTROY_SUBSYSTEM | AI_GOAL_CHASE_WING | AI_GOAL_GUARD | AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP | AI_GOAL_CHASE_ANY | AI_GOAL_IGNORE | AI_GOAL_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_CHASE_ANY_EXCEPT )
#define AI_GOAL_ACCEPT_BOMBER ( AI_GOAL_ACCEPT_FIGHTER )
#define AI_GOAL_ACCEPT_STEALTH ( AI_GOAL_ACCEPT_FIGHTER )
#define AI_GOAL_ACCEPT_TRANSPORT ( AI_GOAL_CHASE | AI_GOAL_CHASE_WING | AI_GOAL_DOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_UNDOCK | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
#define AI_GOAL_ACCEPT_FREIGHTER ( AI_GOAL_ACCEPT_TRANSPORT )
#define AI_GOAL_ACCEPT_CRUISER ( AI_GOAL_ACCEPT_FREIGHTER )
#define AI_GOAL_ACCEPT_CORVETTE ( AI_GOAL_ACCEPT_CRUISER )
#define AI_GOAL_ACCEPT_GAS_MINER ( AI_GOAL_ACCEPT_CRUISER )
#define AI_GOAL_ACCEPT_AWACS ( AI_GOAL_ACCEPT_CRUISER )
#define AI_GOAL_ACCEPT_CAPITAL ( AI_GOAL_ACCEPT_CRUISER & ~(AI_GOAL_DOCK | AI_GOAL_UNDOCK) )
#define AI_GOAL_ACCEPT_SUPERCAP ( AI_GOAL_ACCEPT_CAPITAL )
#define AI_GOAL_ACCEPT_SUPPORT ( AI_GOAL_DOCK | AI_GOAL_UNDOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
#define AI_GOAL_ACCEPT_ESCAPEPOD ( AI_GOAL_ACCEPT_TRANSPORT )
#define AI_GOAL_ACCEPT_FIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_DESTROY_SUBSYSTEM | AI_GOAL_CHASE_WING | AI_GOAL_GUARD | AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP | AI_GOAL_CHASE_ANY | AI_GOAL_IGNORE | AI_GOAL_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_CHASE_ANY_EXCEPT )
#define AI_GOAL_ACCEPT_BOMBER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_STEALTH ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_TRANSPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_CHASE_WING | AI_GOAL_DOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_UNDOCK | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD| AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_FREIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_CRUISER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FREIGHTER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_CORVETTE ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_GAS_MINER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_AWACS ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_CAPITAL ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER & ~(AI_GOAL_DOCK | AI_GOAL_UNDOCK) | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_SUPERCAP ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CAPITAL | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_SUPPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_DOCK | AI_GOAL_UNDOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
#define AI_GOAL_ACCEPT_ESCAPEPOD ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT| AI_GOAL_STAY_NEAR_SHIP )
#define MAX_AI_DOCK_NAMES 25
+34
View File
@@ -0,0 +1,34 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef _AIINTERNAL_H
#define _AIINTERNAL_H
//Returns the enemy team mask for the specified subobject
int get_enemy_team_mask(int objnum);
//Returns true if the specified object is a stealth ship, false if not
bool is_object_stealth_ship(object* objp);
//Number of live turrets on the object attacking
int num_turrets_attacking(object *turret_parent, int target_objnum);
//Determine whether an object is targetable within a nebula (checks for stealth)
int object_is_targetable(object *target, ship *viewer);
//Returns the number of enemy fighters within threshold of pos.
int num_nearby_fighters(int enemy_team_mask, vec3d *pos, float threshold);
//Returns true if OK for *aip to fire its current weapon at its current target.
int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip);
//Does all the stuff needed to aim and fire a turret.
void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum);
#endif
File renamed without changes.
File diff suppressed because it is too large. Load diff
+74 -22
View File
@@ -9,13 +9,45 @@
/*
* $Logfile: /Freespace2/code/Anim/AnimPlay.cpp $
* $Revision: 2.8 $
* $Date: 2004-03-05 09:01:52 $
* $Author: Goober5000 $
* $Revision: 2.17 $
* $Date: 2005-05-28 19:40:59 $
* $Author: taylor $
*
* C module for playing back anim files
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2005/05/23 05:58:31 taylor
* quick catch for some corrupted anis, only a partial fix but it will do until something
* a bit more heavy duty comes along in the near future
*
* Revision 2.15 2005/05/12 17:49:10 taylor
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
* fixes various problems and is past time to make the switch
*
* Revision 2.14 2005/01/30 12:50:08 taylor
* merge with Linux/OSX tree - p0130
*
* Revision 2.13 2004/12/20 20:18:30 fryday
* Commented out ATL dependencies (And changed one macro to an swprintf instead)
* Tiny change in animplay ( pow(2.0, ...) instead of pow(2, ...)) because VS2K5
* throws an ambiguity error over that.
*
* Revision 2.12 2004/10/09 17:58:48 taylor
* one more try to fix the memory leak and end-of-mission crash for talking head anis
*
* Revision 2.11 2004/07/26 20:47:23 Kazan
* remove MCD complete
*
* Revision 2.10 2004/07/17 18:46:06 taylor
* various OGL and memory leak fixes
*
* Revision 2.9 2004/07/12 16:32:41 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.8 2004/03/05 09:01:52 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.7 2004/02/16 11:47:31 randomtiger
* Removed a lot of files that we dont need anymore.
* Changed htl to be on by default, command now -nohtl
@@ -249,6 +281,8 @@
#include "cfile/cfile.h"
#include "cmdline/cmdline.h"
static color Color_xparent;
anim *first_anim = NULL;
@@ -420,7 +454,7 @@ anim_instance *anim_play(anim_play_struct *aps)
if ( anim_instance_is_streamed(instance) ) {
instance->file_offset = instance->parent->file_offset;
}
instance->frame = (ubyte *) malloc(instance->parent->width * instance->parent->height * 2);
instance->frame = (ubyte *) vm_malloc(instance->parent->width * instance->parent->height * 2);
Assert( instance->frame != NULL );
instance->time_elapsed = 0.0f;
instance->stop_at = aps->stop_at;
@@ -668,7 +702,7 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
}
ubyte *temp = NULL;
int temp_file_offset = 0;
int temp_file_offset = -1;
// if we're using bitmap polys
BM_SELECT_TEX_FORMAT();
@@ -690,6 +724,14 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
// always go back to screen format
BM_SELECT_SCREEN_FORMAT();
// see if we had an error during decode (corrupted anim stream)
if ( (temp == NULL) && (temp_file_offset < 0) ) {
mprintf(("ANI: Fatal ERROR at frame %i!! Aborting playback of \"%s\"...\n", instance->frame_num, instance->parent->name));
// return -1 to end all playing of this anim instanc
return -1;
}
if(instance->direction == ANIM_DIRECT_FORWARD){
if ( anim_instance_is_streamed(instance) ) {
instance->file_offset = temp_file_offset;
@@ -791,8 +833,10 @@ int anim_stop_playing(anim_instance* instance)
void anim_release_render_instance(anim_instance* instance)
{
Assert( instance != NULL );
Assert(instance->frame);
free(instance->frame);
if (instance->frame != NULL)
vm_free(instance->frame);
instance->frame = NULL;
instance->parent->instance_count--;
@@ -901,7 +945,7 @@ void anim_read_header(anim *ptr, CFILE *fp)
floor_pow++;
}
int floor_size = (int) pow(2, floor_pow);
int floor_size = (int) pow(2.0, floor_pow);
int diff = ptr->height - floor_size;
float waste = 100.0f * float((floor_size - diff))/(2.0f *(float)floor_size);
@@ -914,6 +958,7 @@ void anim_read_header(anim *ptr, CFILE *fp)
ptr->total_frames = cfread_short(fp);
cfread(&ptr->packer_code, 1, 1, fp);
ptr->packer_code = INTEL_SHORT(ptr->packer_code);
cfread(&ptr->palette, 256, 3, fp);
ptr->num_keys = cfread_short(fp);
@@ -974,7 +1019,7 @@ anim *anim_load(char *real_filename, int file_mapped)
if ( !fp )
return NULL;
ptr = (anim *) malloc(sizeof(anim));
ptr = (anim *) vm_malloc(sizeof(anim));
Assert(ptr);
ptr->flags = 0;
@@ -992,7 +1037,7 @@ anim *anim_load(char *real_filename, int file_mapped)
anim_read_header(ptr, fp);
if(ptr->num_keys > 0){
ptr->keys = (key_frame*)malloc(sizeof(key_frame) * ptr->num_keys);
ptr->keys = (key_frame*)vm_malloc(sizeof(key_frame) * ptr->num_keys);
Assert(ptr->keys != NULL);
}
@@ -1003,12 +1048,14 @@ anim *anim_load(char *real_filename, int file_mapped)
ptr->keys[idx].frame_num = 0;
cfread(&ptr->keys[idx].frame_num, 2, 1, fp);
cfread(&ptr->keys[idx].offset, 4, 1, fp);
ptr->keys[idx].frame_num = INTEL_INT( ptr->keys[idx].frame_num );
ptr->keys[idx].offset = INTEL_INT( ptr->keys[idx].offset );
}
/*prev_keyp = &ptr->keys;
count = ptr->num_keys;
while (count--) {
keyp = (key_frame *) malloc(sizeof(key_frame));
keyp = (key_frame *) vm_malloc(sizeof(key_frame));
keyp->next = *prev_keyp;
*prev_keyp = keyp;
prev_keyp = &keyp->next;
@@ -1018,6 +1065,7 @@ anim *anim_load(char *real_filename, int file_mapped)
cfread(&keyp->offset, 4, 1, fp);
}*/
cfread(&count, 4, 1, fp); // size of compressed data
count = INTEL_INT( count );
ptr->cfile_ptr = NULL;
@@ -1048,7 +1096,7 @@ anim *anim_load(char *real_filename, int file_mapped)
if ( ptr->flags & ANF_STREAMED ) {
ptr->data = NULL;
ptr->cache_file_offset = ptr->file_offset;
ptr->cache = (ubyte*)malloc(ANI_STREAM_CACHE_SIZE+2);
ptr->cache = (ubyte*)vm_malloc(ANI_STREAM_CACHE_SIZE+2);
Assert(ptr->cache);
cfseek(ptr->cfile_ptr, offset, CF_SEEK_SET);
cfread(ptr->cache, ANI_STREAM_CACHE_SIZE, 1, ptr->cfile_ptr);
@@ -1059,7 +1107,7 @@ anim *anim_load(char *real_filename, int file_mapped)
// Not a memory mapped file (or streamed)
ptr->flags &= ~ANF_MEM_MAPPED;
ptr->flags &= ~ANF_STREAMED;
ptr->data = (ubyte *) malloc(count);
ptr->data = (ubyte *) vm_malloc(count);
ptr->file_offset = -1;
cfread(ptr->data, count, 1, fp);
}
@@ -1095,7 +1143,7 @@ int anim_free(anim *ptr)
}
if ( !list )
return -1;
return -2;
// only free when ref_count is 0
ptr->ref_count--;
@@ -1107,23 +1155,27 @@ int anim_free(anim *ptr)
return -1;
if(ptr->keys != NULL){
free(ptr->keys);
vm_free(ptr->keys);
ptr->keys = NULL;
}
if ( ptr->flags & (ANF_MEM_MAPPED|ANF_STREAMED) ) {
cfclose(ptr->cfile_ptr);
if ( ptr->cache ) {
free(ptr->cache);
vm_free(ptr->cache);
ptr->cache = NULL;
}
}
else {
Assert(ptr->data);
free(ptr->data);
if ( ptr->data ) {
vm_free(ptr->data);
ptr->data = NULL;
}
}
*prev_anim = ptr->next;
free(ptr);
vm_free(ptr);
return 0;
}
@@ -1191,7 +1243,7 @@ int anim_write_frames_out(char *filename)
ai = init_anim_instance(source_anim, 16);
row_data = (ubyte**)malloc((source_anim->height+1) * 4);
row_data = (ubyte**)vm_malloc((source_anim->height+1) * 4);
for ( i = 0; i < source_anim->total_frames; i++ ) {
anim_get_next_raw_buffer(ai, 0, 0, 16);
@@ -1214,7 +1266,7 @@ int anim_write_frames_out(char *filename)
}
printf("\n");
free(row_data);
vm_free(row_data);
return 0;
}
@@ -1247,7 +1299,7 @@ void anim_display_info(char *real_filename)
anim_read_header(&A, fp);
// read the keyframe frame nums and offsets
key_frame_nums = (int*)malloc(sizeof(int)*A.num_keys);
key_frame_nums = (int*)vm_malloc(sizeof(int)*A.num_keys);
Assert(key_frame_nums != NULL);
for ( i = 0; i < A.num_keys; i++ ) {
key_frame_nums[i] = 0;
@@ -1288,7 +1340,7 @@ void anim_display_info(char *real_filename)
printf("ac version: %d\n", A.version);
if ( key_frame_nums != NULL ) {
free(key_frame_nums);
vm_free(key_frame_nums);
}
cfclose(fp);
+15 -4
View File
@@ -9,13 +9,24 @@
/*
* $Logfile: /Freespace2/code/Anim/AnimPlay.h $
* $Revision: 2.3 $
* $Date: 2003-12-08 22:30:02 $
* $Author: randomtiger $
* $Revision: 2.6 $
* $Date: 2005-07-13 02:50:48 $
* $Author: Goober5000 $
*
* Header file for playing back anim files
*
* $Log: not supported by cvs2svn $
* Revision 2.5 2005/04/05 05:53:14 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.4 2004/08/11 05:06:18 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.3 2003/12/08 22:30:02 randomtiger
* Put render state and other direct D3D calls repetition check back in, provides speed boost.
* Fixed bug that caused fullscreen only crash with DXT textures
* Put dithering back in for tgas and jpgs
*
* Revision 2.2 2003/11/11 02:15:41 Goober5000
* ubercommit - basically spelling and language fixes with some additional
* warnings disabled
@@ -125,7 +136,7 @@ typedef struct {
int start_at;
int stop_at;
int screen_id;
vector *world_pos;
vec3d *world_pos;
float radius;
int framerate_independent;
void *color;
+45 -10
View File
@@ -9,15 +9,33 @@
/*
* $Logfile: /Freespace2/code/Anim/PackUnpack.cpp $
* $Revision: 2.5 $
* $Date: 2004-03-05 09:01:53 $
* $Author: Goober5000 $
* $Revision: 2.10 $
* $Date: 2005-05-24 03:13:36 $
* $Author: taylor $
*
* Code for handling packing and unpacking in Hoffoss's RLE format, used for
* Anim files. Also handles Anim loading, creating Anim instances (for
* utilizing an Anim), and getting getting frames of the Anim.
*
* $Log: not supported by cvs2svn $
* Revision 2.9 2005/05/23 05:58:31 taylor
* quick catch for some corrupted anis, only a partial fix but it will do until something
* a bit more heavy duty comes along in the near future
*
* Revision 2.8 2005/05/12 17:49:10 taylor
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
* fixes various problems and is past time to make the switch
*
* Revision 2.7 2004/07/26 20:47:23 Kazan
* remove MCD complete
*
* Revision 2.6 2004/07/12 16:32:41 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.5 2004/03/05 09:01:53 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.4 2004/02/14 00:18:29 randomtiger
* Please note that from now on OGL will only run with a registry set by Launcher v4. See forum for details.
* OK, these changes effect a lot of file, I suggest everyone updates ASAP:
@@ -194,6 +212,9 @@
#include "graphics/2d.h"
#include "anim/animplay.h"
int packer_code = PACKER_CODE;
int transparent_code = 254;
@@ -226,7 +247,7 @@ anim_instance *init_anim_instance(anim *ptr, int bpp)
}
ptr->instance_count++;
inst = (anim_instance *) malloc(sizeof(anim_instance));
inst = (anim_instance *) vm_malloc(sizeof(anim_instance));
Assert(inst);
inst->frame_num = -1;
inst->last_frame_num = -1;
@@ -237,9 +258,9 @@ anim_instance *init_anim_instance(anim *ptr, int bpp)
inst->aa_color = NULL;
if(bpp == 16){
inst->frame = (ubyte *) malloc(inst->parent->width * inst->parent->height * 2);
inst->frame = (ubyte *) vm_malloc(inst->parent->width * inst->parent->height * 2);
} else {
inst->frame = (ubyte *) malloc(inst->parent->width * inst->parent->height);
inst->frame = (ubyte *) vm_malloc(inst->parent->width * inst->parent->height);
}
return inst;
}
@@ -247,14 +268,14 @@ anim_instance *init_anim_instance(anim *ptr, int bpp)
void free_anim_instance(anim_instance *inst)
{
Assert(inst->frame);
free(inst->frame);
vm_free(inst->frame);
inst->frame = NULL;
inst->parent->instance_count--;
inst->parent = NULL;
inst->data = NULL;
inst->file_offset = -1;
free(inst);
vm_free(inst);
}
int anim_get_next_frame(anim_instance *inst)
@@ -995,6 +1016,9 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte
count = value & (~STD_RLE_CODE);
value = *ptr++;
if (count > size)
count = size;
size -= count;
Assert(size >= 0);
@@ -1081,6 +1105,9 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte
count = value & (~STD_RLE_CODE);
value = *ptr++;
if (count > size)
count = size;
size -= count;
Assert(size >= 0);
@@ -1099,7 +1126,8 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte
}
}
else {
Assert(0); // unknown packing method
// Assert(0); // unknown packing method
return NULL;
}
return ptr;
@@ -1181,6 +1209,9 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal
value = anim_instance_get_byte(ai,offset);
offset++;
if (count > size)
count = size;
size -= count;
Assert(size >= 0);
@@ -1271,6 +1302,9 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal
value = anim_instance_get_byte(ai,offset);
offset++;
if (count > size)
count = size;
size -= count;
Assert(size >= 0);
@@ -1289,7 +1323,8 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal
}
}
else {
Int3(); // unknown packing method
// Int3(); // unknown packing method
return -1;
}
return ai->file_offset + offset;
+13 -3
View File
@@ -9,8 +9,8 @@
/*
* $Logfile: /Freespace2/code/Anim/PackUnpack.h $
* $Revision: 2.2 $
* $Date: 2004-03-05 09:01:53 $
* $Revision: 2.5 $
* $Date: 2005-07-13 02:50:48 $
* $Author: Goober5000 $
*
* Code for handling packing and unpacking in Hoffoss's RLE format, used for
@@ -18,6 +18,16 @@
* utilizing an Anim), and getting getting frames of the Anim.
*
* $Log: not supported by cvs2svn $
* Revision 2.4 2005/04/05 05:53:14 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.3 2004/08/11 05:06:18 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.2 2004/03/05 09:01:53 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.1 2002/08/01 01:41:04 penguin
* The big include file move
*
@@ -213,7 +223,7 @@ typedef struct anim {
typedef struct anim_instance {
anim_instance *next, *prev;
int x,y; // coordinates anim is played at (top left corner of anim)
vector *world_pos; // world (x,y,z) position of explosion
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)
int last_frame_num;// last frame rendered
+89 -192
View File
@@ -9,13 +9,57 @@
/*
* $Logfile: /Freespace2/code/Asteroid/Asteroid.cpp $
* $Revision: 2.7 $
* $Date: 2004-03-31 05:42:25 $
* $Revision: 2.20 $
* $Date: 2005-07-22 10:18:36 $
* $Author: Goober5000 $
*
* C module for asteroid code
*
* $Log: not supported by cvs2svn $
* Revision 2.19 2005/07/13 02:50:48 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 2.18 2005/07/13 02:01:28 Goober5000
* fixed a bunch of "issues" caused by me with the species stuff
* --Goober5000
*
* Revision 2.17 2005/07/13 00:44:20 Goober5000
* improved species support and removed need for #define
* --Goober5000
*
* Revision 2.16 2005/06/01 09:34:59 taylor
* newline fix
*
* Revision 2.15 2005/04/28 05:29:28 wmcoolmon
* Removed FS2_DEMO defines that looked like they wouldn't cause the universe to collapse
*
* Revision 2.14 2005/04/28 01:32:57 wmcoolmon
* Switch stuff_string_white to stuff_string (I don't see why _white was used in the first place)
*
* Revision 2.13 2005/04/15 11:41:28 taylor
* stupid <expletive-delete> terminal, I <expletive-deleted> <expletive-deleted>!!!
*
* Revision 2.12 2005/04/15 11:36:55 taylor
* new GCC = new warning messages, yippeeee!!
*
* Revision 2.11 2005/04/05 05:53:14 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.10 2005/03/02 21:24:43 taylor
* more network/inferno goodness for Windows, takes care of a few warnings too
*
* Revision 2.9 2004/07/26 20:47:23 Kazan
* remove MCD complete
*
* Revision 2.8 2004/07/12 16:32:41 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.7 2004/03/31 05:42:25 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 2.6 2004/03/05 09:01:53 Goober5000
* Uber pass at reducing #includes
* --Goober5000
@@ -294,6 +338,7 @@
* $NoKeywords: $
*/
#include "asteroid/asteroid.h"
#include "object/object.h"
#include "object/objcollide.h"
@@ -325,59 +370,15 @@
#include "network/multi.h"
#endif
#ifndef FS2_DEMO
//WMC - we want asteroid ability with demo!!
//#ifndef FS2_DEMO
#define ASTEROID_OBJ_USED (1<<0) // flag used in asteroid_obj struct
#define MAX_ASTEROID_OBJS MAX_ASTEROIDS // max number of asteroids tracked in asteroid list
asteroid_obj Asteroid_objs[MAX_ASTEROID_OBJS]; // array used to store asteroid object indexes
asteroid_obj Asteroid_obj_list; // head of linked list of asteroid_obj structs
// Asteroid editor requires first set of entries to be "None" and then "Asteroid XXX"
// Any changes to this will require changes to the asteroid editor
debris_struct Field_debris_info[] = {
-1, "None",
ASTEROID_TYPE_SMALL, "Asteroid Small",
ASTEROID_TYPE_MEDIUM, "Asteroid Medium",
ASTEROID_TYPE_BIG, "Asteroid Large",
DEBRIS_TERRAN_SMALL, "Terran Small",
DEBRIS_TERRAN_MEDIUM, "Terran Medium",
DEBRIS_TERRAN_LARGE, "Terran Large",
DEBRIS_VASUDAN_SMALL, "Vasudan Small",
DEBRIS_VASUDAN_MEDIUM, "Vasudan Medium",
DEBRIS_VASUDAN_LARGE, "Vasudan Large",
DEBRIS_SHIVAN_SMALL, "Shivan Small",
DEBRIS_SHIVAN_MEDIUM, "Shivan Medium",
#if !defined(MORE_SPECIES)
DEBRIS_SHIVAN_LARGE, "Shivan Large"
#else
DEBRIS_SHIVAN_LARGE, "Shivan Large",
DEBRIS_ANCIENT_SMALL, "Ancient Small",
DEBRIS_ANCIENT_MEDIUM, "Ancient Medium",
DEBRIS_ANCIENT_LARGE, "Ancient Large",
DEBRIS_USER1_SMALL, "User1 Small",
DEBRIS_USER1_MEDIUM, "User1 Medium",
DEBRIS_USER1_LARGE, "User1 Large",
DEBRIS_USER2_SMALL, "User2 Small",
DEBRIS_USER2_MEDIUM, "User2 Medium",
DEBRIS_USER2_LARGE, "User2 Large",
DEBRIS_USER3_SMALL, "User3 Small",
DEBRIS_USER3_MEDIUM, "User3 Medium",
DEBRIS_USER3_LARGE, "User3 Large",
DEBRIS_USER4_SMALL, "User4 Small",
DEBRIS_USER4_MEDIUM, "User4 Medium",
DEBRIS_USER4_LARGE, "User4 Large",
#endif
};
// used for randomly generating debris type when there are multiple sizes.
#define SMALL_DEBRIS_WEIGHT 8
#define MEDIUM_DEBRIS_WEIGHT 4
@@ -483,7 +484,7 @@ float asteroid_cap_speed(int asteroid_info_index, float speed)
// Returns whether position is inside inner bounding volume
// sum together the following: 1 inside x, 2 inside y, 4 inside z
// inside only when sum = 7
int asteroid_in_inner_bound_with_axes(asteroid_field *asfieldp, vector *pos, float delta)
int asteroid_in_inner_bound_with_axes(asteroid_field *asfieldp, vec3d *pos, float delta)
{
Assert(asfieldp->has_inner_bound);
@@ -505,7 +506,7 @@ int asteroid_in_inner_bound_with_axes(asteroid_field *asfieldp, vector *pos, flo
// check if asteroid is within inner bound
// return 0 if not inside or no inner bound, 1 if inside inner bound
int asteroid_in_inner_bound(asteroid_field *asfieldp, vector *pos, float delta) {
int asteroid_in_inner_bound(asteroid_field *asfieldp, vec3d *pos, float delta) {
if (!asfieldp->has_inner_bound) {
return 0;
@@ -516,7 +517,7 @@ int asteroid_in_inner_bound(asteroid_field *asfieldp, vector *pos, float delta)
// repositions asteroid outside the inner box on all 3 axes
// moves to the other side of the inner box a distance delta from edge of box
void inner_bound_pos_fixup(asteroid_field *asfieldp, vector *pos)
void inner_bound_pos_fixup(asteroid_field *asfieldp, vec3d *pos)
{
if (!asteroid_in_inner_bound(asfieldp, pos, 0)) {
return;
@@ -547,7 +548,7 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
object *objp;
asteroid *asp;
asteroid_info *asip;
vector pos, delta_bound;
vec3d pos, delta_bound;
angles angs;
float radius;
ushort signature;
@@ -662,7 +663,7 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
radius = 1.0f;
}
vector rotvel;
vec3d rotvel;
if ( Game_mode & GM_NORMAL ) {
vm_vec_rand_vec_quick(&rotvel);
vm_vec_scale(&rotvel, frand()/4.0f + 0.1f);
@@ -715,7 +716,7 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
}
// Create asteroids when parent_objp blows up.
void asteroid_sub_create(object *parent_objp, int asteroid_type, vector *relvec)
void asteroid_sub_create(object *parent_objp, int asteroid_type, vec3d *relvec)
{
object *new_objp;
float speed;
@@ -804,8 +805,6 @@ int get_debris_from_same_group(int index) {
// the weight is then used to determine the frequencty of different sizes of ship debris
int get_debris_weight(int ship_debris_index)
{
#if defined(MORE_SPECIES)
if (ship_debris_index % 3 == 0)
return SMALL_DEBRIS_WEIGHT;
@@ -816,32 +815,6 @@ int get_debris_weight(int ship_debris_index)
return LARGE_DEBRIS_WEIGHT;
//Int3();
return 1;
#else
switch (ship_debris_index) {
case DEBRIS_TERRAN_SMALL:
case DEBRIS_VASUDAN_SMALL:
case DEBRIS_SHIVAN_SMALL:
return SMALL_DEBRIS_WEIGHT;
break;
case DEBRIS_TERRAN_MEDIUM:
case DEBRIS_VASUDAN_MEDIUM:
case DEBRIS_SHIVAN_MEDIUM:
return MEDIUM_DEBRIS_WEIGHT;
break;
case DEBRIS_TERRAN_LARGE:
case DEBRIS_VASUDAN_LARGE:
case DEBRIS_SHIVAN_LARGE:
return LARGE_DEBRIS_WEIGHT;
break;
default:
Int3();
return 1;
break;
}
#endif
}
// Create all the asteroids for the mission, called from
@@ -1047,8 +1020,8 @@ int asteroid_is_targeted(object *objp)
// Create an asteroid that will hit object *objp in delta_time seconds
void asteroid_aim_at_target(object *objp, object *asteroid_objp, float delta_time)
{
vector predicted_center_pos;
vector rand_vec;
vec3d predicted_center_pos;
vec3d rand_vec;
float speed;
vm_vec_scale_add(&predicted_center_pos, &objp->pos, &objp->phys_info.vel, delta_time);
@@ -1153,7 +1126,7 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
}
if ( asteroid_should_wrap(objp, asfieldp) ) {
vector vec_to_asteroid, old_asteroid_pos, old_vel;
vec3d vec_to_asteroid, old_asteroid_pos, old_vel;
float dot, dist;
old_asteroid_pos = objp->pos;
@@ -1211,7 +1184,7 @@ void lerp(float *goal, float f1, float f2, float scale)
void asteroid_process_pre( object *objp, float frame_time)
{
if (Asteroids_enabled) {
vector *v, *vv;
vec3d *v, *vv;
v = &objp->phys_info.vel;
vv = &objp->phys_info.desired_vel;
@@ -1227,7 +1200,7 @@ void asteroid_process_pre( object *objp, float frame_time)
#pragma warning ( push )
#pragma warning ( disable : 4701 ) // possible use of variable without initialization
int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpos, collision_info_struct *asteroid_hit_info)
int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos, collision_info_struct *asteroid_hit_info)
{
if (!Asteroids_enabled) {
return 0;
@@ -1271,7 +1244,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
object *heavy_obj = heavy;
object *light_obj = light;
vector zero, p0, p1;
vec3d zero, p0, p1;
vm_vec_zero( &zero );
vm_vec_sub( &p0, &light->last_pos, &heavy->last_pos );
vm_vec_sub( &p1, &light->pos, &heavy->pos );
@@ -1281,7 +1254,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
mc.p1 = &p1; // Point 2 of ray to check
// find the light object's position in the heavy object's reference frame at last frame and also in this frame.
vector p0_temp, p0_rotated;
vec3d p0_temp, p0_rotated;
// Collision detection from rotation enabled if at rotaion is less than 30 degree in frame
// This should account for all ships
@@ -1314,7 +1287,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
// copy important data
int copy_flags = mc.flags; // make a copy of start end positions of sphere in big ship RF
vector copy_p0, copy_p1;
vec3d copy_p0, copy_p1;
copy_p0 = *mc.p0;
copy_p1 = *mc.p1;
@@ -1385,7 +1358,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
}
// find position in submodel RF of light object at collison
vector int_light_pos, diff;
vec3d int_light_pos, diff;
vm_vec_sub(&diff, mc.p1, mc.p0);
vm_vec_scale_add(&int_light_pos, mc.p0, &diff, mc.hit_dist);
model_find_world_point(&asteroid_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_num, mc.hit_submodel, &heavy_obj->orient, &zero);
@@ -1417,7 +1390,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
}
// find position in submodel RF of light object at collison
vector diff;
vec3d diff;
vm_vec_sub(&diff, mc.p1, mc.p0);
vm_vec_scale_add(&asteroid_hit_info->light_collision_cm_pos, mc.p0, &diff, mc.hit_dist);
@@ -1448,7 +1421,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
}
// find position in submodel RF of light object at collison
vector diff;
vec3d diff;
vm_vec_sub(&diff, mc.p1, mc.p0);
vm_vec_scale_add(&asteroid_hit_info->light_collision_cm_pos, mc.p0, &diff, mc.hit_dist);
@@ -1506,9 +1479,9 @@ void asteroid_render(object * obj)
}
// Create a normalized vector generally in the direction from *hitpos to other_obj->pos
void asc_get_relvec(vector *relvec, object *other_obj, vector *hitpos)
void asc_get_relvec(vec3d *relvec, object *other_obj, vec3d *hitpos)
{
vector tvec, rand_vec;
vec3d tvec, rand_vec;
int count = 0;
vm_vec_normalized_dir(&tvec, &other_obj->pos, hitpos);
@@ -1571,7 +1544,6 @@ void asteriod_explode_sound(object *objp, int type, int play_loud)
int sound_index = -1;
float range_factor = 1.0f; // how many times sound should traver farther than normal
#if defined(MORE_SPECIES)
if (type % 3 <= 1)
{
sound_index = SND_ASTEROID_EXPLODE_SMALL;
@@ -1582,33 +1554,7 @@ void asteriod_explode_sound(object *objp, int type, int play_loud)
sound_index = SND_ASTEROID_EXPLODE_BIG;
range_factor = 10.0f;
}
#else
switch (type) {
case ASTEROID_TYPE_SMALL:
case ASTEROID_TYPE_MEDIUM:
case DEBRIS_TERRAN_SMALL:
case DEBRIS_TERRAN_MEDIUM:
case DEBRIS_VASUDAN_SMALL:
case DEBRIS_VASUDAN_MEDIUM:
case DEBRIS_SHIVAN_SMALL:
case DEBRIS_SHIVAN_MEDIUM:
sound_index = SND_ASTEROID_EXPLODE_SMALL;
range_factor = 5.0f;
break;
case ASTEROID_TYPE_BIG:
case DEBRIS_TERRAN_LARGE:
case DEBRIS_VASUDAN_LARGE:
case DEBRIS_SHIVAN_LARGE:
sound_index = SND_ASTEROID_EXPLODE_BIG;
range_factor = 10.0f;
break;
default:
Int3();
return;
}
#endif
Assert(sound_index != -1);
if ( !play_loud ) {
@@ -1660,7 +1606,7 @@ void asteroid_do_area_effect(object *asteroid_objp)
// other_obj => object that hit asteroid, can be NULL if asteroid hit by area effect
// hitpos => world position asteroid was hit, can be NULL if hit by area effect
// damage => amount of damage to apply to asteroid
void asteroid_hit( object * asteroid_obj, object * other_obj, vector * hitpos, float damage )
void asteroid_hit( object * asteroid_obj, object * other_obj, vec3d * hitpos, float damage )
{
float explosion_life;
asteroid *asp;
@@ -1698,7 +1644,7 @@ void asteroid_hit( object * asteroid_obj, object * other_obj, vector * hitpos, f
} else {
asp->death_hit_pos = asteroid_obj->pos;
// randomize hit pos a bit, otherwise we will get a NULL vector when trying to find direction to toss child asteroids
vector rand_vec;
vec3d rand_vec;
vm_vec_rand_vec_quick(&rand_vec);
vm_vec_add2(&asp->death_hit_pos, &rand_vec);
}
@@ -1804,7 +1750,7 @@ void asteroid_maybe_break_up(object *asteroid_obj)
asp = &Asteroids[asteroid_obj->instance];
if ( timestamp_elapsed(asp->final_death_time) ) {
vector relvec, vfh, tvec;
vec3d relvec, vfh, tvec;
asteroid_obj->flags |= OF_SHOULD_BE_DEAD;
@@ -1814,7 +1760,6 @@ void asteroid_maybe_break_up(object *asteroid_obj)
if ( !MULTIPLAYER_CLIENT ) {
#endif
#if defined(MORE_SPECIES)
if (asp->type <= ASTEROID_TYPE_BIG) // 3
// if this isn't true it's just debris, and debris doesn't break up
{
@@ -1841,7 +1786,7 @@ void asteroid_maybe_break_up(object *asteroid_obj)
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &tvec);
while (frand() > 0.6f) {
vector rvec, tvec2;
vec3d rvec, tvec2;
vm_vec_rand_vec_quick(&rvec);
vm_vec_scale_add(&tvec2, &vfh, &rvec, 0.75f);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec2);
@@ -1852,54 +1797,6 @@ void asteroid_maybe_break_up(object *asteroid_obj)
break;
}
}
#else
switch (asp->type) {
case ASTEROID_TYPE_SMALL:
break;
case ASTEROID_TYPE_MEDIUM:
asc_get_relvec(&relvec, asteroid_obj, &asp->death_hit_pos);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &relvec);
vm_vec_normalized_dir(&vfh, &asteroid_obj->pos, &asp->death_hit_pos);
vm_vec_copy_scale(&tvec, &vfh, 2.0f);
vm_vec_sub2(&tvec, &relvec);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec);
break;
case ASTEROID_TYPE_BIG:
asc_get_relvec(&relvec, asteroid_obj, &asp->death_hit_pos);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &relvec);
vm_vec_normalized_dir(&vfh, &asteroid_obj->pos, &asp->death_hit_pos);
vm_vec_copy_scale(&tvec, &vfh, 2.0f);
vm_vec_sub2(&tvec, &relvec);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &tvec);
while (frand() > 0.6f) {
vector rvec, tvec2;
vm_vec_rand_vec_quick(&rvec);
vm_vec_scale_add(&tvec2, &vfh, &rvec, 0.75f);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec2);
}
break;
// ship debris does not break up
case DEBRIS_TERRAN_SMALL:
case DEBRIS_TERRAN_MEDIUM:
case DEBRIS_TERRAN_LARGE:
case DEBRIS_VASUDAN_SMALL:
case DEBRIS_VASUDAN_MEDIUM:
case DEBRIS_VASUDAN_LARGE:
case DEBRIS_SHIVAN_SMALL:
case DEBRIS_SHIVAN_MEDIUM:
case DEBRIS_SHIVAN_LARGE:
break;
default:
Int3();
}
#endif
#ifndef NO_NETWORK
}
#endif
@@ -1908,10 +1805,10 @@ void asteroid_maybe_break_up(object *asteroid_obj)
}
}
int asteroid_get_random_in_cone(vector *pos, vector *dir, float ang, int danger)
int asteroid_get_random_in_cone(vec3d *pos, vec3d *dir, float ang, int danger)
{
int idx;
vector asteroid_dir;
vec3d asteroid_dir;
// just pick the first asteroid which satisfies our condition
for(idx=0; idx<Num_asteroids; idx++){
@@ -1930,7 +1827,7 @@ int asteroid_get_random_in_cone(vector *pos, vector *dir, float ang, int danger)
void asteroid_test_collide(object *asteroid_obj, object *ship_obj, mc_info *mc)
{
float asteroid_ray_dist;
vector asteroid_fvec, terminus;
vec3d asteroid_fvec, terminus;
// See if ray from asteroid intersects bounding box of escort ship
asteroid_ray_dist = vm_vec_mag_quick(&asteroid_obj->phys_info.desired_vel) * ASTEROID_MIN_COLLIDE_TIME;
@@ -2117,14 +2014,14 @@ void asteroid_parse_section()
stuff_string(asip->name, F_NAME, NULL);
required_string( "$POF file1:" );
stuff_string_white( asip->pof_files[0] );
stuff_string(asip->pof_files[0], F_NAME, NULL);
required_string( "$POF file2:" );
stuff_string_white( asip->pof_files[1] );
stuff_string(asip->pof_files[1], F_NAME, NULL);
if ( (strstr(asip->name,"Asteroid") != NULL) || (strstr(asip->name, "asteroid") != NULL) ) {
required_string( "$POF file3:" );
stuff_string_white( asip->pof_files[2] );
stuff_string(asip->pof_files[2], F_NAME, NULL);
}
asip->num_detail_levels = 0;
@@ -2166,8 +2063,11 @@ void asteroid_parse_tbl()
required_string("#Asteroid Types");
// total we're expecting
int Total_asteroid_types = ((True_NumSpecies + 1) * 3);
while (required_string_either("#End","$Name:")) {
Assert( Num_asteroid_types < MAX_DEBRIS_TYPES );
Assert( Num_asteroid_types < Total_asteroid_types );
asteroid_parse_section();
Num_asteroid_types++;
}
@@ -2175,11 +2075,7 @@ void asteroid_parse_tbl()
required_string("#End");
// check all read in
#if defined(MORE_SPECIES)
Assert(Num_asteroid_types == (True_NumSpecies + 1) * 3);//the species + normal asteroids
#else
Assert(Num_asteroid_types == MAX_DEBRIS_TYPES);
#endif
Assert(Num_asteroid_types == Total_asteroid_types);
Asteroid_impact_explosion_ani = -1;
required_string("$Impact Explosion:");
@@ -2402,7 +2298,7 @@ void asteroid_page_in()
}
}
}
/*
#else
// stubbed out functions not used in the demo
@@ -2414,8 +2310,8 @@ void asteroid_render( object *asteroid_objp ) {}
void asteroid_delete( object *asteroid_objp ) {}
void asteroid_process_pre( object *asteroid_objp, float frame_time) {}
void asteroid_process_post( object *asteroid_objp, float frame_time) {}
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vector * hitpos, collision_info_struct *asteroid_hit_info ) {return 0;}
void asteroid_hit( object *asteroid_objp, object *other_objp, vector *hitpos, float damage ) {}
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vec3d * hitpos, collision_info_struct *asteroid_hit_info ) {return 0;}
void asteroid_hit( object *asteroid_objp, object *other_objp, vec3d *hitpos, float damage ) {}
void asteroid_save_restore(CFILE *fp) {}
int asteroid_count() {return 0;}
int asteroid_collide_objnum(object *asteroid_objp) {return 0;}
@@ -2423,8 +2319,9 @@ float asteroid_time_to_impact(object *asteroid_objp) {return 0.0f;}
void asteroid_show_brackets() {}
void asteroid_target_closest_danger() {}
void asteroid_page_in() {}
void asteroid_sub_create(object *parent_objp, int asteroid_type, vector *relvec) {}
void asteroid_sub_create(object *parent_objp, int asteroid_type, vec3d *relvec) {}
void asteroid_frame() {}
#endif
*/
+34 -93
View File
@@ -9,13 +9,31 @@
/*
* $Logfile: /Freespace2/code/Asteroid/Asteroid.h $
* $Revision: 2.4 $
* $Date: 2004-03-05 09:01:53 $
* $Revision: 2.9 $
* $Date: 2005-07-13 02:50:48 $
* $Author: Goober5000 $
*
* Header file for asteroids
*
* $Log: not supported by cvs2svn $
* Revision 2.8 2005/07/13 02:01:28 Goober5000
* fixed a bunch of "issues" caused by me with the species stuff
* --Goober5000
*
* Revision 2.7 2005/07/13 00:44:20 Goober5000
* improved species support and removed need for #define
* --Goober5000
*
* Revision 2.6 2005/04/05 05:53:14 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.5 2004/08/11 05:06:18 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.4 2004/03/05 09:01:53 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.3 2003/10/15 22:03:23 Kazan
* Da Species Update :D
*
@@ -144,79 +162,14 @@ struct collision_info_struct;
#define MAX_ASTEROIDS 256
// DEBRIS TYPES
#if defined(MORE_SPECIES)
#define DEBRIS_NAME_MASK 0x000f
// -----------------------------------
// Kazan Extended Species version
// -----------------------------------
#define MAX_DEBRIS_TYPES 27
#define ASTEROID_TYPE_SMALL 0
#define ASTEROID_TYPE_MEDIUM 1
#define ASTEROID_TYPE_BIG 2
// terran
#define DEBRIS_TERRAN_SMALL 3
#define DEBRIS_TERRAN_MEDIUM 4
#define DEBRIS_TERRAN_LARGE 5
// vasudan
#define DEBRIS_VASUDAN_SMALL 6
#define DEBRIS_VASUDAN_MEDIUM 7
#define DEBRIS_VASUDAN_LARGE 8
// shivan
#define DEBRIS_SHIVAN_SMALL 9
#define DEBRIS_SHIVAN_MEDIUM 10
#define DEBRIS_SHIVAN_LARGE 11
// ancient
#define DEBRIS_ANCIENT_SMALL 12
#define DEBRIS_ANCIENT_MEDIUM 13
#define DEBRIS_ANCIENT_LARGE 14
// user1
#define DEBRIS_USER1_SMALL 15
#define DEBRIS_USER1_MEDIUM 16
#define DEBRIS_USER1_LARGE 17
// user2
#define DEBRIS_USER2_SMALL 18
#define DEBRIS_USER2_MEDIUM 19
#define DEBRIS_USER2_LARGE 20
// user3
#define DEBRIS_USER3_SMALL 21
#define DEBRIS_USER3_MEDIUM 22
#define DEBRIS_USER3_LARGE 23
// user4
#define DEBRIS_USER4_SMALL 24
#define DEBRIS_USER4_MEDIUM 25
#define DEBRIS_USER4_LARGE 26
#else
// -----------------------------------
// Old Volition Version
// -----------------------------------
#define MAX_DEBRIS_TYPES 12
//
#define ASTEROID_TYPE_SMALL 0
#define ASTEROID_TYPE_MEDIUM 1
#define ASTEROID_TYPE_BIG 2
//
#define DEBRIS_TERRAN_SMALL 3
#define DEBRIS_TERRAN_MEDIUM 4
#define DEBRIS_TERRAN_LARGE 5
//
#define DEBRIS_VASUDAN_SMALL 6
#define DEBRIS_VASUDAN_MEDIUM 7
#define DEBRIS_VASUDAN_LARGE 8
//
#define DEBRIS_SHIVAN_SMALL 9
#define DEBRIS_SHIVAN_MEDIUM 10
#define DEBRIS_SHIVAN_LARGE 11
// END DEBRIS TYPES
#endif
typedef struct debris_struct {
int index;
char *name;
} debris_struct;
// This is for the asteroid types plus DEBRIS_X_Y
// (X is each species and Y is SMALL, MEDIUM, and LARGE)
#define MAX_DEBRIS_TYPES ((MAX_SPECIES + 1) * 3)
// Data structure to track the active asteroids
typedef struct asteroid_obj {
@@ -226,8 +179,6 @@ typedef struct asteroid_obj {
extern asteroid_obj Asteroid_obj_list;
extern debris_struct Field_debris_info[];
#define MAX_ASTEROID_POFS 3 // Max number of POFs per asteroid type
#define AF_USED (1<<0) // Set means used.
@@ -260,20 +211,10 @@ typedef struct asteroid {
int final_death_time; // timestamp to swap in new models after explosion starts
int collide_objnum; // set to objnum that asteroid will be impacting soon
int collide_objsig; // object signature corresponding to collide_objnum
vector death_hit_pos; // hit pos that caused death
vec3d death_hit_pos; // hit pos that caused death
int target_objnum; // Yes, hah! Asteroids can have targets. See asteroid_aim_at_target().
} asteroid;
// TYPEDEF FOR SPECIES OF DEBRIS - BITFIELD
#define DS_TERRAN 0x01
#define DS_VASUDAN 0x02
#define DS_SHIVAN 0x04
#define DS_ANCIENT 0x08
#define DS_USER1 0x10
#define DS_USER2 0x20
#define DS_USER3 0x40
#define DS_USER4 0x80
// TYPEDEF FOR DEBRIS TYPE
typedef enum {
DG_ASTEROID,
@@ -289,12 +230,12 @@ typedef enum {
#define MAX_ACTIVE_DEBRIS_TYPES 3
typedef struct asteroid_field {
vector min_bound; // Minimum range of field.
vector max_bound; // Maximum range of field.
vec3d min_bound; // Minimum range of field.
vec3d max_bound; // Maximum range of field.
int has_inner_bound;
vector inner_min_bound;
vector inner_max_bound;
vector vel; // Average asteroid moves at this velocity.
vec3d inner_min_bound;
vec3d inner_max_bound;
vec3d vel; // Average asteroid moves at this velocity.
float speed; // Average speed of field
int num_initial_asteroids; // Number of asteroids at creation.
field_type_t field_type; // active throws and wraps, passive does not
@@ -318,17 +259,17 @@ void asteroid_render( object *asteroid_objp );
void asteroid_delete( object *asteroid_objp );
void asteroid_process_pre( object *asteroid_objp, float frame_time);
void asteroid_process_post( object *asteroid_objp, float frame_time);
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vector * hitpos, collision_info_struct *asteroid_hit_info=NULL );
void asteroid_hit( object *asteroid_objp, object *other_objp, vector *hitpos, float damage );
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vec3d * hitpos, collision_info_struct *asteroid_hit_info=NULL );
void asteroid_hit( object *asteroid_objp, object *other_objp, vec3d *hitpos, float damage );
int asteroid_count();
int asteroid_collide_objnum(object *asteroid_objp);
float asteroid_time_to_impact(object *asteroid_objp);
void asteroid_show_brackets();
void asteroid_target_closest_danger();
int asteroid_get_random_in_cone(vector *pos, vector *dir, float ang, int danger = 0);
int asteroid_get_random_in_cone(vec3d *pos, vec3d *dir, float ang, int danger = 0);
// need to extern for multiplayer
void asteroid_sub_create(object *parent_objp, int asteroid_type, vector *relvec);
void asteroid_sub_create(object *parent_objp, int asteroid_type, vec3d *relvec);
void asteroid_frame();
+839
View File
@@ -0,0 +1,839 @@
// Autopilot.cpp
// Derek Meek
// 4-30-2004
/*
* $Logfile: /Freespace2/code/Autopilot/Autopilot.cpp $
* $Revision: 1.22 $
* $Date: 2005-08-23 09:18:08 $
* $Author: Goober5000 $
*
* $Log: not supported by cvs2svn $
* Revision 1.21 2005/07/23 16:25:32 Goober5000
* remove an extraneous extern
* --Goober5000
*
* Revision 1.20 2005/07/13 02:30:52 Goober5000
* removed autopilot #define
* --Goober5000
*
* Revision 1.19 2005/04/19 23:03:42 wmcoolmon
* Lock time compression when autopilot is engaged
*
* Revision 1.18 2005/04/05 05:53:14 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 1.17 2005/03/25 06:57:32 wmcoolmon
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
*
* Revision 1.16 2005/03/03 06:05:26 wmcoolmon
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
*
* Revision 1.15 2005/01/31 23:27:51 taylor
* merge with Linux/OSX tree - p0131-2
*
* Revision 1.14 2004/10/03 21:41:10 Kazan
* Autopilot convergence collision fix for ai_fly_to_ship() and ai_waypoints() -- mathematically expensive, only usable by autopilot
*
* Revision 1.13 2004/09/28 22:51:41 Kazan
* fix autopilot formation bug
*
* Revision 1.12 2004/09/28 19:54:31 Kazan
* | is binary or, || is boolean or - please use the right one
* autopilot velocity ramping biasing
* made debugged+k kill guardianed ships
*
* Revision 1.11 2004/07/29 23:41:21 Kazan
* bugfixes
*
* Revision 1.10 2004/07/27 18:52:10 Kazan
* squished another
*
* Revision 1.9 2004/07/27 18:04:09 Kazan
* i love it when bugs go crunch (autopilot ai fixup)
*
* Revision 1.8 2004/07/26 20:47:24 Kazan
* remove MCD complete
*
* Revision 1.7 2004/07/26 17:54:04 Kazan
* Autopilot system completed -- i am dropping plans for GUI nav map
* Fixed FPS counter during time compression
*
* Revision 1.6 2004/07/25 19:27:51 Kazan
* only disable afterburning during AIM_WAYPOINTS and AIM_FLY_TO_SHIP while AutoPilotEngaged
*
* Revision 1.5 2004/07/25 18:46:28 Kazan
* -fred_no_warn has become -no_warn and applies to both fred and fs2
* added new ai directive (last commit) and disabled afterburners while performing AIM_WAYPOINTS or AIM_FLY_TO_SHIP
* fixed player ship speed bug w/ player-use-ai, now stays in formation correctly and manages speed
* made -radar_reduce ignore itself if no parameter is given (ignoring launcher bug)
*
* Revision 1.4 2004/07/25 00:31:27 Kazan
* i have absolutely nothing to say about that subject
*
* Revision 1.3 2004/07/12 16:32:42 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 1.2 2004/07/01 16:38:18 Kazan
* working on autonav
*
* Revision 1.1 2004/05/07 23:50:14 Kazan
* Sorry Guys!
*
*
*
*
*/
#include "autopilot/autopilot.h"
#include "ai/ai.h"
#include "ai/aigoals.h"
#include "ship/ship.h"
#include "object/object.h"
#include "parse/sexp.h"
#include "freespace2/freespace.h"
// Extern functions/variables
extern int Player_use_ai;
extern int sexp_distance2(int obj1, char *subj);
// Module variables
bool AutoPilotEngaged;
int CurrentNav;
float ramp_bias;
NavPoint Navs[MAX_NAVPOINTS];
// used for ramping time compression;
int start_dist;
// ********************************************************************************************
void autopilot_ai_waypoint_goal_fixup(ai_goal* aigp)
{
// this function sets wp_index properly;
for (int i = 0; i < Num_waypoint_lists; i++)
{
if (!stricmp(aigp->ship_name, Waypoint_lists[i].name))
{
aigp->wp_index = i;
return;
}
}
}
// ********************************************************************************************
bool Sel_NextNav()
{
if (AutoPilotEngaged)
return false;
int i;
if (CurrentNav == -1)
{
for (i = 0; i < MAX_NAVPOINTS; i++)
{
if (Navs[i].flags & NP_VALIDTYPE && !(Navs[i].flags & NP_NOSELECT))
{
CurrentNav=i;
return true;
}
}
}
else
{
for (i = CurrentNav+1; i < MAX_NAVPOINTS+CurrentNav; i++)
{
if (Navs[i%MAX_NAVPOINTS].flags & NP_VALIDTYPE && !(Navs[i%MAX_NAVPOINTS].flags & NP_NOSELECT))
{
if (i != CurrentNav)
{
CurrentNav=i%MAX_NAVPOINTS;
return true;
}
}
}
}
return false;
}
// ********************************************************************************************
vec3d NavPoint::GetPosition()
{
vec3d position;
if (flags & NP_WAYPOINT)
{
position = ((waypoint_list*)target_obj)->waypoints[waypoint_num-1];
}
else
{
position = Objects[((ship*)target_obj)->objnum].pos;
}
return position;
}
char* NavPoint::GetInteralName()
{
char *NavName;
char strtmp[3];
if (flags & NP_WAYPOINT)
{
NavName = new char[strlen(((waypoint_list*)target_obj)->name)+5];
memset(NavName, 0, strlen(((waypoint_list*)target_obj)->name)+5);
strcpy(NavName, ((waypoint_list*)target_obj)->name);
strcat(NavName, ":");
strcat(NavName, itoa(waypoint_num, strtmp, 10));
}
else
{
NavName = new char[strlen(((ship*)target_obj)->ship_name)+1];
memset(NavName, 0, strlen(((ship*)target_obj)->ship_name)+1);
strcpy(NavName, ((ship*)target_obj)->ship_name);
}
return NavName;
}
// ********************************************************************************************
// Tell us is autopilot is allow
// This needs:
// * Nav point selected
// * No enemies within X distance
// * Destination > 1,000 meters away
bool CanAutopilot()
{
bool CanAuto = true;
CanAuto = CanAuto && CurrentNav != -1;
int dist = sexp_distance2(Player_ship->objnum, "<any hostile>");
CanAuto = CanAuto && (5000 <= dist || dist == SEXP_NAN);
if (CanAuto) // protect against no currentNav
{
char *name = Navs[CurrentNav].GetInteralName();
CanAuto = CanAuto && (1000 <= sexp_distance2(Player_ship->objnum, name));
delete[] name;
}
return CanAuto;
}
// ********************************************************************************************
// Engages autopilot
// This does:
// * Control switched from player to AI
// * Time compression to 32x
// * Lock time compression -WMC
// * Tell AI to fly to targetted Nav Point (for all nav-status wings/ships)
// * Sets max waypoint speed to the best-speed of the slowest ship tagged
void StartAutopilot()
{
if (!CanAutopilot())
return;
AutoPilotEngaged = true;
Player_use_ai = 1;
set_time_compression(1);
lock_time_compression(true);
// determine speed cap
int i,j;
float speed_cap = 1000000.0; // 1m is a safe starting point
for (i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1 &&
(Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)
)
)
{
if (speed_cap > Ship_info[Ships[i].ship_info_index].max_vel.xyz.z)
speed_cap = Ship_info[Ships[i].ship_info_index].max_vel.xyz.z;
}
}
// damp speed_cap to 90% of actual -- to make sure ships stay in formation
speed_cap = 0.90f * speed_cap;
ramp_bias = speed_cap/50.0f;
// assign ship goals
// when assigning goals to individual ships only do so if Ships[shipnum].wingnum != -1
// we will assign wing goals below
for (i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1 &&
(Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)
)
)
{
// clear the ship goals and cap the waypoint speed
ai_clear_ship_goals(&Ai_info[Ships[i].ai_index]);
Ai_info[Ships[i].ai_index].waypoint_speed_cap = (int)speed_cap;
// if they're not part of a wing set their goal
if (Ships[i].wingnum == -1)
{
if (Navs[CurrentNav].flags & NP_WAYPOINT)
{
ai_add_ship_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_WAYPOINTS_ONCE, -1, ((waypoint_list*)Navs[CurrentNav].target_obj)->name, &Ai_info[Ships[i].ai_index] );
//fixup has to wait until after wing goals
}
else
{
ai_add_ship_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_FLY_TO_SHIP, -1, ((ship*)Navs[CurrentNav].target_obj)->ship_name, &Ai_info[Ships[i].ai_index] );
}
}
}
}
// assign wing goals
for (i = 0; i < MAX_WINGS; i++)
{
if (Wings[i].flags & WF_NAV_CARRY )
{
//ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip );
//ai_add_wing_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_STAY_NEAR_SHIP, 0, target_shipname, wingnum );
//ai_add_wing_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_WAYPOINTS_ONCE, 0, target_shipname, wingnum );
//ai_clear_ship_goals( &(Ai_info[Ships[num].ai_index]) );
ai_clear_wing_goals( i );
if (Navs[CurrentNav].flags & NP_WAYPOINT)
{
ai_add_wing_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_WAYPOINTS_ONCE, AIF_FORMATION_WING, ((waypoint_list*)Navs[CurrentNav].target_obj)->name, i );
// "fix up" the goal
for (j = 0; j < MAX_AI_GOALS; j++)
{
if (Wings[i].ai_goals[j].ai_mode == AI_GOAL_WAYPOINTS_ONCE ||
Wings[i].ai_goals[j].ai_mode == AIM_WAYPOINTS )
{
autopilot_ai_waypoint_goal_fixup(&(Wings[i].ai_goals[j]));
}
}
}
else
{
ai_add_wing_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_FLY_TO_SHIP, AIF_FORMATION_WING, ((ship*)Navs[CurrentNav].target_obj)->ship_name, i );
}
}
}
// fixup has to go down here because ships are assigned goals during wing goals as well
for (i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1)
{
if (Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY))
for (j = 0; j < MAX_AI_GOALS; j++)
{
if (Ai_info[Ships[i].ai_index].goals[j].ai_mode == AI_GOAL_WAYPOINTS_ONCE ||
Ai_info[Ships[i].ai_index].goals[j].ai_mode == AIM_WAYPOINTS)
{
autopilot_ai_waypoint_goal_fixup( &(Ai_info[Ships[i].ai_index].goals[j]) );
// formation fixup
//ai_form_on_wing(&Objects[Ships[i].objnum], &Objects[Player_ship->objnum]);
}
}
}
}
start_dist = DistanceTo(CurrentNav);
}
// ********************************************************************************************
// Checks if autopilot should automatically die
// Returns true if:
// * Targetted waypoint < 10,000 meters away
// * Enemy < 10,000 meters
bool Autopilot_AutoDiable()
{
return !CanAutopilot();
}
// ********************************************************************************************
// Disengages autopilot
// this does:
// * Time compression to 1x
// * Delete AI nav goal
// * Control switched from AI to player
void EndAutoPilot()
{
AutoPilotEngaged = false;
set_time_compression(1);
lock_time_compression(false);
Player_use_ai = 0;
//Clear AI Goals
// assign ship goals
// when assigning goals to individual ships only do so if Ships[shipnum].wingnum != -1
// we will assign wing goals below
int i,j;
for (i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1 &&
(
Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY )
)
)
{
Ai_info[Ships[i].ai_index].waypoint_speed_cap = -1; // uncap their speed
// old "dumb" routine
//ai_clear_ship_goals( &(Ai_info[Ships[i].ai_index]) );
for (j = 0; j < MAX_AI_GOALS; j++)
{
if (Ai_info[Ships[i].ai_index].goals[j].ai_mode == AI_GOAL_WAYPOINTS_ONCE ||
Ai_info[Ships[i].ai_index].goals[j].ai_mode == AI_GOAL_FLY_TO_SHIP ||
Ai_info[Ships[i].ai_index].goals[j].ai_mode == AIM_WAYPOINTS ||
Ai_info[Ships[i].ai_index].goals[j].ai_mode == AIM_FLY_TO_SHIP)
{
ai_remove_ship_goal( &(Ai_info[Ships[i].ai_index]), j );
}
}
}
}
// assign wing goals
for (i = 0; i < MAX_WINGS; i++)
{
if (Wings[i].flags & WF_NAV_CARRY )
{
// old "dumb" routine
//ai_clear_wing_goals( i );
for (j = 0; j < MAX_AI_GOALS; j++)
{
if (Wings[i].ai_goals[j].ai_mode == AI_GOAL_WAYPOINTS_ONCE ||
Wings[i].ai_goals[j].ai_mode == AI_GOAL_FLY_TO_SHIP ||
Wings[i].ai_goals[j].ai_mode == AIM_WAYPOINTS ||
Wings[i].ai_goals[j].ai_mode == AIM_FLY_TO_SHIP)
{
Wings[i].ai_goals[j].ai_mode = AI_GOAL_NONE;
Wings[i].ai_goals[j].signature = -1;
Wings[i].ai_goals[j].priority = -1;
Wings[i].ai_goals[j].flags = 0;
}
}
}
}
}
// ********************************************************************************************
// Checks for changes every NPS_TICKRATE milliseconds
// Checks:
// * if we've gotten close enough to a nav point for it to be counted as "Visited"
// * If we're current AutoNavigating it checks if we need to autodisengage
void NavSystem_Do()
{
static unsigned int last_update = 0;
if (clock () - last_update > NPS_TICKRATE)
{
if (AutoPilotEngaged)
if (Autopilot_AutoDiable())
EndAutoPilot();
// check if a NavPoints target has left, delete it if so
int i;
for (i = 0; i < MAX_NAVPOINTS; i++)
{
if ((Navs[i].flags & NP_SHIP) && (Navs[i].target_obj != NULL))
{
if (((ship*)Navs[i].target_obj)->objnum == -1)
DelNavPoint(i);
}
}
// check if we're reached a Node
for (i = 0; i < MAX_NAVPOINTS; i++)
{
if (Navs[i].target_obj != NULL)
{
if (Navs[i].flags & NP_VALIDTYPE && DistanceTo(i) < 1000)
Navs[i].flags |= NP_VISITED;
}
}
}
// ramp time compression
if (AutoPilotEngaged)
{
int dstfrm_start = start_dist - DistanceTo(CurrentNav);
// Ramp UP time compression
if (dstfrm_start < (3500*ramp_bias))
{
if (dstfrm_start >= (3000*ramp_bias) && DistanceTo(CurrentNav) > 30000)
set_time_compression(64);
else if (dstfrm_start >= (2000*ramp_bias))
set_time_compression(32);
else if (dstfrm_start >= (1600*ramp_bias))
set_time_compression(16);
else if (dstfrm_start >= (1200*ramp_bias))
set_time_compression(8);
else if (dstfrm_start >= (800*ramp_bias))
set_time_compression(4);
else if (dstfrm_start >= (400*ramp_bias))
set_time_compression(2);
}
// Ramp DOWN time compression
if (DistanceTo(CurrentNav) <= (7000*ramp_bias))
{
int dist = DistanceTo(CurrentNav);
if (dist >= (5000*ramp_bias))
set_time_compression(32);
else if (dist >= (4000*ramp_bias))
set_time_compression(16);
else if (dist >= (3000*ramp_bias))
set_time_compression(8);
else if (dist >= (2000*ramp_bias))
set_time_compression(4);
else if (dist >= (1000*ramp_bias))
set_time_compression(2);
}
}
}
// ********************************************************************************************
// Inits the Nav System
void NavSystem_Init()
{
memset((char *)&Navs, 0, sizeof(Navs));
AutoPilotEngaged = false;
CurrentNav = -1;
}
// ********************************************************************************************
// Finds a Nav point by name
int FindNav(char *Nav)
{
for (int i = 0; i < MAX_NAVPOINTS; i++)
{
if (!stricmp(Navs[i].NavName, Nav))
return i;
}
return -1;
}
// ********************************************************************************************
// Set A Nav point to "ZERO"
void ZeroNav(int i)
{
memset((char *)&Navs[i], 0, sizeof(NavPoint));
}
// ********************************************************************************************
// Removes a Nav
bool DelNavPoint(char *Nav)
{
int n = FindNav(Nav);
return DelNavPoint(n);
}
bool DelNavPoint(int nav)
{
if (nav != -1)
{
if (nav != MAX_NAVPOINTS-1)
{
for (int i = nav; i < MAX_NAVPOINTS-1; i++)
{
Navs[nav] = Navs[nav+1];
}
}
ZeroNav(MAX_NAVPOINTS-1);
return true;
}
return false;
}
// ********************************************************************************************
// adds a Nav
bool AddNav_Ship(char *Nav, char *TargetName, int flags)
{
// find an empty nav - should be the end
int empty = -1;
int i;
for (i = 0; i < MAX_NAVPOINTS && empty == -1; i++)
{
if (Navs[i].flags == 0)
empty = i;
}
if (empty == -1) // no empty navpoint slots
return false;
// Create the NavPoint struct
NavPoint tnav;
strncpy(tnav.NavName, Nav, 32);
tnav.flags = NP_SHIP | flags;
Assert(!(tnav.flags & NP_WAYPOINT));
for (i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1 && !stricmp(TargetName, Ships[i].ship_name))
{
tnav.target_obj = (void *)&Ships[i];
}
}
tnav.waypoint_num = 0; // unused for NP_SHIP
// copy it into it's location
Navs[empty] = tnav;
return true;
}
bool AddNav_Waypoint(char *Nav, char *WP_Path, int node, int flags)
{
// find an empty nav - should be the end
int empty = -1;
int i;
if (node == 0)
node = 1;
for (i = 0; i < MAX_NAVPOINTS && empty == -1; i++)
{
if (Navs[i].flags == 0)
empty = i;
}
if (empty == -1) // no empty navpoint slots
return false;
// Create the NavPoint struct
NavPoint tnav;
strncpy(tnav.NavName, Nav, 32);
tnav.flags = NP_WAYPOINT | flags;
Assert(!(tnav.flags & NP_SHIP));
for (i = 0; i < Num_waypoint_lists; i++)
{
if (!stricmp(WP_Path, Waypoint_lists[i].name))
{
tnav.target_obj = (void *)&Waypoint_lists[i];
}
}
tnav.waypoint_num = node;
// copy it into it's location
Navs[empty] = tnav;
return true;
}
// ********************************************************************************************
//Change Flags
bool Nav_Alt_Flags(char *Nav, int flags)
{
flags &= ~NP_VALIDTYPE; //clear the NP_SHIP and NP_WAYPOINT bits, make sure they haven't been set
int nav = FindNav(Nav);
if (nav != -1)
{
Navs[nav].flags &= NP_VALIDTYPE; // Clear all bits BUT NP_SHIP or NO_WAYPOINT
Navs[nav].flags |= flags; // merge
}
return (nav != -1);
}
//Get Flags
int Nav_Get_Flags(char *Nav)
{
int flags = 0;
int nav = FindNav(Nav);
if (nav != -1)
flags = Navs[nav].flags;
return flags;
}
// ********************************************************************************************
// Sexp Accessors
//Generic
bool Nav_Set_Flag(char *Nav, int flag)
{
Assert(!(flag & NP_VALIDTYPE));
int nav = FindNav(Nav);
if (nav != -1)
{
Navs[nav].flags |= flag;
return true;
}
return false;
}
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
bool Nav_UnSet_Flag(char *Nav, int flag)
{
Assert(!(flag & NP_VALIDTYPE));
int nav = FindNav(Nav);
if (nav != -1)
{
Navs[nav].flags &= ~flag;
return true;
}
return false;
}
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//Named
bool Nav_Set_Hidden(char *Nav)
{
return Nav_Set_Flag(Nav, NP_HIDDEN);
}
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
bool Nav_Set_NoAccess(char *Nav)
{
return Nav_Set_Flag(Nav, NP_NOACCESS);
}
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
bool Nav_Set_Visited(char *Nav)
{
return Nav_Set_Flag(Nav, NP_VISITED);
}
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
bool Nav_UnSet_Hidden(char *Nav)
{
return Nav_UnSet_Flag(Nav, NP_HIDDEN);
}
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
bool Nav_UnSet_NoAccess(char *Nav)
{
return Nav_UnSet_Flag(Nav, NP_NOACCESS);
}
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
bool Nav_UnSet_Visited(char *Nav)
{
return Nav_UnSet_Flag(Nav, NP_VISITED);
}
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
unsigned int DistanceTo(char *nav)
{
int n = FindNav(nav);
return DistanceTo(n);
}
unsigned int DistanceTo(int nav)
{
if (nav > MAX_NAVPOINTS && nav < 0)
return 0xFFFFFFFF;
char *name = Navs[nav].GetInteralName();
if (name == NULL)
return 0xFFFFFFFF;
int distance = sexp_distance2(Player_ship->objnum, name);
delete[] name;
if (distance == SEXP_NAN)
return 0xFFFFFFFF;
return distance;
}
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
bool IsVisited(char *nav)
{
int n = FindNav(nav);
return IsVisited(n);
}
bool IsVisited(int nav)
{
if (nav > MAX_NAVPOINTS && nav < 0)
return 0;
if (Navs[nav].flags & NP_VISITED)
return 1;
return 0;
}
+152
View File
@@ -0,0 +1,152 @@
// Autopilot.h
// Derek Meek
// 4-30-2004
/*
* $Logfile: /Freespace2/code/Autopilot/Autopilot.h $
* $Revision: 1.8 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
* $Log: not supported by cvs2svn $
* Revision 1.7 2005/04/05 05:53:14 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 1.6 2004/08/11 05:06:18 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 1.5 2004/07/27 18:52:10 Kazan
* squished another
*
* Revision 1.4 2004/07/25 19:27:51 Kazan
* only disable afterburning during AIM_WAYPOINTS and AIM_FLY_TO_SHIP while AutoPilotEngaged
*
* Revision 1.3 2004/07/25 00:31:27 Kazan
* i have absolutely nothing to say about that subject
*
* Revision 1.2 2004/07/01 16:38:18 Kazan
* working on autonav
*
* Revision 1.1 2004/05/07 23:50:14 Kazan
* Sorry Guys!
*
*
*
*
*/
#if !defined(_AUTOPILOT_H_)
#define _AUTOPILOT_H_
#include "globalincs/pstypes.h"
// milliseconds between updates
#define NPS_TICKRATE 250
#define MAX_NAVPOINTS 8
#define NP_WAYPOINT 0x0001 // Nav Point is bound to the poistion of a single node of a waypoint path
#define NP_SHIP 0x0002 // Nav Point is bound to the poisiton of a certain ship
#define NP_HIDDEN 0x0004 // Nav Point doesn't show on map and isn't selectable
#define NP_NOACCESS 0x0008 // Nav Point isn't selectable
#define NP_VISITED 0x0100 // Whether we've been within 1,000 meters of this waypoint
#define NP_NOSELECT ( NP_HIDDEN | NP_NOACCESS )
#define NP_VALIDTYPE ( NP_WAYPOINT | NP_SHIP )
struct NavPoint
{
char NavName[32];
int flags;
void *target_obj;
int waypoint_num; //only used when flags & NP_WAYPOINT
vec3d GetPosition();
char* GetInteralName();
};
extern bool AutoPilotEngaged;
extern int CurrentNav;
extern NavPoint Navs[MAX_NAVPOINTS];
// Cycles through the NavPoint List
bool Sel_NextNav();
// Tell us is autopilot is allow
// This needs:
// * Nav point selected
// * No enemies within 5,000 meters
// * Destination > 1,000 meters away
bool CanAutopilot();
// Engages autopilot
// This does:
// * Control switched from player to AI
// * Time compression to 32x
// * Tell AI to fly to targetted Nav Point (for all nav-status wings/ships)
// * Sets max waypoint speed to the best-speed of the slowest ship tagged
void StartAutopilot();
// Checks if autopilot should automatically die
// Returns true if:
// * Targetted waypoint < 1,000 meters away
// * Enemy < 5,000 meters
bool Autopilot_AutoDiable();
// Disengages autopilot
// this does:
// * Time compression to 1x
// * Delete AI nav goal
// * Control switched from AI to player
void EndAutoPilot();
// Checks for changes every NPS_TICKRATE milliseconds
// Checks:
// * if we've gotten close enough to a nav point for it to be counted as "Visited"
// * If we're current AutoNavigating it checks if we need to autodisengage
void NavSystem_Do();
// Inits the Nav System
void NavSystem_Init();
// Finds a Nav point by name
int FindNav(char *Nav);
// Set A Nav point to "ZERO"
void ZeroNav(int i);
// Removes a Nav
bool DelNavPoint(char *Nav);
bool DelNavPoint(int nav);
// adds a Nav
bool AddNav_Ship(char *Nav, char *TargetName, int flags);
bool AddNav_Waypoint(char *Nav, char *WP_Path, int node, int flags);
//Change Flags
bool Nav_Alt_Flags(char *Nav, int flags);
// Sexp Accessors
bool Nav_Set_Flag(char *Nav, int flag);
bool Nav_UnSet_Flag(char *Nav, int flag);
bool Nav_Set_Hidden(char *Nav);
bool Nav_Set_NoAccess(char *Nav);
bool Nav_Set_Visited(char *Nav);
bool Nav_UnSet_Hidden(char *Nav);
bool Nav_UnSet_NoAccess(char *Nav);
bool Nav_UnSet_Visited(char *Nav);
// Useful functions
unsigned int DistanceTo(char *nav);
unsigned int DistanceTo(int nav);
bool IsVisited(char *nav);
bool IsVisited(int nav);
#endif
+140
View File
@@ -0,0 +1,140 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
/*
* $Logfile: /Freespace2/code/bmpman/bm_internal.h $
* $Revision: 2.3 $
* $Date: 2005-04-21 15:49:20 $
* $Author: taylor $
*
* bmpman info that's internal to bmpman related files only
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2005/03/03 14:29:37 bobboau
* fixed a small error from my earlier commit.
*
* Revision 2.1 2004/11/23 00:10:06 taylor
* try and protect the bitmap_entry stuff a bit better
* fix the transparent support ship, again, but correctly this time
*
*
* $NoKeywords: $
*/
#ifndef __BM_INTERNAL_H__
#define __BM_INTERNAL_H__
// extra check to make sure this stuff doesn't end up in normal files
// don't use any of this unless BMPMAN_INTERNAL is defined
#ifdef BMPMAN_INTERNAL
#include "globalincs/pstypes.h"
#include "bmpman/bmpman.h"
// keep this defined to use per-ship nondarkening pixels
#define BMPMAN_SPECIAL_NONDARK
#define BM_TYPE_NONE 0
#define BM_TYPE_PCX 1
#define BM_TYPE_USER 2
#define BM_TYPE_ANI 3 // in-house ANI format
#define BM_TYPE_EFF 4 // specifies any type of animated image, the EFF itself is just text
#define BM_TYPE_32_BIT_FORMATS 5 // everything after this could/should be 24/32-bit
#define BM_TYPE_TGA 6 // 16 or 32 bit targa
#define BM_TYPE_DDS 7 // generic identifier for DDS
#define BM_TYPE_DXT1 8 // 24 bit with switchable alpha (compressed)
#define BM_TYPE_DXT3 9 // 32 bit with 4 bit alpha (compressed)
#define BM_TYPE_DXT5 10 // 32 bit with 8 bit alpha (compressed)
#define BM_TYPE_JPG 11 // 32 bit jpeg
#define BM_TYPE_RENDER_TARGET 12 // 32 bit setup internaly as a render target
/// Moved from cpp file ///////////////////
// Consider these 'protected' structures and functions that should only be used by special bitmap functions
typedef struct bm_extra_info {
struct {
// Stuff needed for animations
int first_frame; // used for animations -- points to index of first frame
ubyte num_frames; // used for animation -- number of frames in the animation
ubyte fps; // used for animation -- frames per second
} ani;
struct {
// Stuff needed for user bitmaps
void *data; // For user bitmaps, this is where the data comes from
ubyte bpp; // For user bitmaps, this is what format the data is
ubyte flags; // Flags passed to bm_create
} user;
struct {
// Stuff for static animations
ubyte type; // type for individual images
char filename[MAX_FILENAME_LEN]; // filename for individual images
} eff;
} bm_extra_info;
typedef struct bitmap_entry {
// identification
char filename[MAX_FILENAME_LEN]; // filename for this bitmap
uint signature; // a unique signature identifying the data
uint palette_checksum; // checksum used to be sure bitmap is in current palette
int handle; // Handle = id*MAX_BITMAPS + bitmapnum
int last_used; // When this bitmap was last used
ubyte type; // PCX, USER, ANI, etc
signed char ref_count; // Number of locks on bitmap. Can't unload unless ref_count is 0.
int dir_type; // which directory this was loaded from (to skip other locations with same name)
// compressed bitmap stuff (.dds) - RT please take a look at this and tell me if we really need it
int mem_taken; // How much memory does this bitmap use? - UnknownPlayer
int num_mipmaps; // number of mipmap levels, we need to read all of them
// Stuff to keep track of usage
ubyte preloaded; // If set, then this was loaded from the lst file
int preload_count; // how many times this gets used in game, for unlocking
ubyte used_flags; // What flags it was accessed thru
int load_count;
// Bitmap info
bitmap bm;
// Data for animations and user bitmaps
bm_extra_info info;
#ifdef BMPMAN_NDEBUG
// bookeeping
ubyte used_last_frame; // If set, then it was used last frame
ubyte used_this_frame; // If set, then it was used this frame
int data_size; // How much data this bitmap uses
int used_count; // How many times it was accessed
#endif
} bitmap_entry;
extern bitmap_entry bm_bitmaps[MAX_BITMAPS];
// image specific lock functions
void bm_lock_ani( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
void bm_lock_dds( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
void bm_lock_jpg( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
void bm_lock_pcx( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
void bm_lock_user( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
#endif // BMPMAN_INTERNAL
#endif // __BM_INTERNAL_H__
File diff suppressed because it is too large. Load diff
+124 -93
View File
@@ -10,13 +10,76 @@
/*
* $Logfile: /Freespace2/code/Bmpman/BmpMan.h $
*
* $Revision: 2.13 $
* $Date: 2004-05-06 22:35:26 $
* $Revision: 2.25 $
* $Date: 2005-08-20 20:34:49 $
* $Author: taylor $
*
* Prototypes for Bitmap Manager functions
*
* $Log: not supported by cvs2svn $
* Revision 2.24 2005/07/13 02:50:49 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 2.23 2005/06/19 02:28:55 taylor
* add a _fast version of bm_unload() to be used in modelinterp and future graphics API code
* clean up some modelinterp code to not use memcpy() everywhere so it's more platform compatible and matches old code (Jens Granseuer)
* NaN check to catch shards-of-death and prevent hitting an Assert() (Jens Granseuer)
* fix jumpnode code to catch model errors and close a memory leak
* make the call to bm_unload_all() after model_free_all() since we will get bmpman screwups otherwise
* don't show hardware sound RAM when using OpenAL build, it will always be 0
* print top-right memory figures in debug builds slighly further over when 1024+ res
*
* Revision 2.22 2005/04/24 12:56:42 taylor
* really are too many changes here:
* - remove all bitmap section support and fix problems with previous attempt
* ( code/bmpman/bmpman.cpp, code/bmpman/bmpman.h, code/globalincs/pstypes.h,
* code/graphics/2d.cpp, code/graphics/2d.h code/graphics/grd3dbmpman.cpp,
* code/graphics/grd3dinternal.h, code/graphics/grd3drender.cpp, code/graphics/grd3dtexture.cpp,
* code/graphics/grinternal.h, code/graphics/gropengl.cpp, code/graphics/gropengl.h,
* code/graphics/gropengllight.cpp, code/graphics/gropengltexture.cpp, code/graphics/gropengltexture.h,
* code/graphics/tmapper.h, code/network/multi_pinfo.cpp, code/radar/radarorb.cpp
* code/render/3ddraw.cpp )
* - use CLAMP() define in gropengl.h for gropengllight instead of single clamp() function
* - remove some old/outdated code from gropengl.cpp and gropengltexture.cpp
*
* Revision 2.21 2005/04/21 15:49:20 taylor
* update of bmpman and model bitmap management, well tested but things may get a bit bumpy
* - use VM_* macros for bmpman since it didn't seem to register the memory correctly (temporary)
* - a little "stupid" fix for dds bitmap reading
* - fix it so that memory is released properly on bitmap read errors
* - some cleanup to model texture loading
* - allow model textures to get released rather than just unloaded, saves bitmap slots
* - bump MAX_BITMAPS to 4750, should be able to decrease after public testing of new code
*
* Revision 2.20 2005/03/07 13:10:19 bobboau
* commit of render target code, d3d should be totaly functional,
* OGL still needs implementation.
*
* Revision 2.19 2005/02/10 14:38:50 taylor
* fix an issue with bm_set_components()
* abs is for ints fabsf is for floats (camera.cpp)
* make the in-cockpit stuff OGL friendly
*
* Revision 2.18 2004/11/23 00:10:06 taylor
* try and protect the bitmap_entry stuff a bit better
* fix the transparent support ship, again, but correctly this time
*
* Revision 2.17 2004/11/21 15:59:45 Kazan
* conflict res
*
* Revision 2.16 2004/10/31 21:26:27 taylor
* bmpman merge, EFF animation support, better page in stuff, dozen or so smaller fixes and cleanup
*
* Revision 2.15 2004/10/06 22:02:54 Kazan
* interface corruption fix - thanks taylor (MAX_BITMAPS upped to 7000)
*
* Revision 2.14 2004/08/11 05:06:18 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.13 2004/05/06 22:35:26 taylor
* DDS mipmap reading, remove unneeded bm_unlock() during page in
*
* Revision 2.12 2004/04/01 15:31:20 taylor
* don't use interface anis as ship textures
*
@@ -290,85 +353,46 @@
#define BMPMAN_NDEBUG
#endif
#define MAX_BITMAPS 3500 // How many bitmaps the game can handle
// this is causing problems - let's UP IT -- Kazan
// bumped from 3500 to 4500 2004/09/21 - taylor
// bumped to 4750 2005/02/03 - taylor
//#define MAX_BITMAPS 3500 // How many bitmaps the game can handle
#define MAX_BITMAPS 4750 // How many bitmaps the game can handle
// NOTE: MAX_BITMAPS shouldn't need to be bumped again. With the fixed bm_release() and it's
// proper use even the largest missions should stay under this number. With the largest retail
// missions and wasteful content we should still have about 20% of the slots free. If it still
// goes over then it's something the artists need to fix. For instance the Terran Mara fighter,
// with -spec and -glow and using the Shinepack, needs 117 bitmap slots alone. 111 of those is
// just for the glowmaps. This number can be greatly reduced if the number of ani frames for
// another LOD than LOD0 has fewer or no ani frames. A 37 frame glow ani for LOD2 is little
// more than a waste of resources. Future reports of texture corruption should be initially
// approached with content as the cause and not code. If anything we could/should reduce
// MAX_BITMAPS in the future. Where it's at now should accomidate even the largest mods.
// -- Taylor
// 16 bit pixel formats
#define BM_PIXEL_FORMAT_ARGB 0 // for glide - can assume certain things, like 1555 LFB writes, whee!
#define BM_PIXEL_FORMAT_D3D 1 // d3d - card dependant. booo!
#define BM_PIXEL_FORMAT_ARGB_D3D 2 // this card has nice 1555 textures like Glide - ahhhhh!
enum
{
BM_TYPE_NONE,
BM_TYPE_PCX, // 16 bit PCX
BM_TYPE_USER, // Data created at run time
BM_TYPE_ANI, // In-house ANI format
// Only list 32 bit formats after this flag please
BM_TYPE_32_BIT_FORMATS,
BM_TYPE_TGA,
BM_TYPE_JPG,
BM_TYPE_DDS,
};
/// Moved from cpp file ///////////////////
// Consider these 'protected' structures and functions that should only be used by special bitmap functions
extern int bm_inited;
typedef union bm_extra_info {
struct {
// Stuff needed for animations
int first_frame; // used for animations -- points to index of first frame
ubyte num_frames; // used for animation -- number of frames in the animation
ubyte fps; // used for animation -- frames per second
} ani;
struct {
// Stuff needed for user bitmaps
void *data; // For user bitmaps, this is where the data comes from
ubyte bpp; // For user bitmaps, this is what format the data is
ubyte flags; // Flags passed to bm_create
} user;
} bm_extra_info;
extern int Bm_paging;
typedef struct bitmap_entry {
// identification
char filename[MAX_FILENAME_LEN]; // filename for this bitmap
void bm_init();
uint signature; // a unique signature identifying the data
uint palette_checksum; // checksum used to be sure bitmap is in current palette
int handle; // Handle = id*MAX_BITMAPS + bitmapnum
int last_used; // When this bitmap was last used
void bm_close();
ubyte type; // PCX, USER, ANI, etc
signed char ref_count; // Number of locks on bitmap. Can't unload unless ref_count is 0.
int bm_get_cache_slot( int bitmap_id, int separate_ani_frames );
// compressed bitmap stuff (.dds) - RT please take a look at this and tell me if we really need it
int mem_taken; // How much memory does this bitmap use? - UnknownPlayer
int num_mipmaps; // number of mipmap levels, we need to read all of them
int bm_get_next_handle();
// Stuff to keep track of usage
ubyte preloaded; // If set, then this was loaded from the lst file
ubyte used_flags; // What flags it was accessed thru
void *bm_malloc(int n, int size);
// Bitmap info
bitmap bm;
// Data for animations and user bitmaps
bm_extra_info info;
#ifdef BMPMAN_NDEBUG
// bookeeping
ubyte used_last_frame; // If set, then it was used last frame
ubyte used_this_frame; // If set, then it was used this frame
int data_size; // How much data this bitmap uses
int used_count; // How many times it was accessed
#endif
} bitmap_entry;
void bm_gfx_init();
void bm_gfx_close();
int bm_gfx_get_cache_slot( int bitmap_id, int separate_ani_frames );
int bm_gfx_get_next_handle();
void bm_update_memory_used(int n, int size);
// 16 bit pixel formats
extern int Bm_pixel_format;
@@ -382,12 +406,12 @@ extern int bm_texture_ram;
// It returns a negative number if it couldn't load
// the bitmap. On success, it returns the bitmap
// number.
int bm_gfx_load(char * filename);
int bm_load(char * filename);
// special load function. basically allows you to load a bitmap which already exists (by filename).
// this is useful because in some cases we need to have a bitmap which is locked in screen format
// _and_ texture format, such as pilot pics and squad logos
int bm_gfx_load_duplicate(char *filename);
int bm_load_duplicate(char *filename);
// Creates a bitmap that exists in RAM somewhere, instead
// of coming from a disk file. You pass in a pointer to a
@@ -397,29 +421,33 @@ int bm_gfx_load_duplicate(char *filename);
// On success, it returns the bitmap number. You cannot
// free that RAM until bm_release is called on that bitmap.
// See example at bottom of this file
int bm_gfx_create( int bpp, int w, int h, void * data, int flags = 0);
int bm_create( int bpp, int w, int h, void * data, int flags = 0);
// Frees up a bitmap's data, but bitmap number 'n' can
// still be used, it will just have to be paged in next
// time it is locked.
int bm_gfx_unload( int n );
int bm_unload( int n, bool = false );
// like bm_unload() except that it's safe to use to free data without worrying about
// load_count so it's safe to use in relation to bm_release() and in gr_*_texture functions
int bm_unload_fast( int n, bool = false );
// Frees up a bitmap's data, and it's slot, so bitmap
// number 'n' cannot be used anymore, and bm_load or
// bm_create might reuse the slot.
void bm_gfx_release(int n);
void bm_release(int n);
// This loads a bitmap sequence so we can draw with it later.
// It returns a negative number if it couldn't load
// the bitmap. On success, it returns the bitmap
// number of the first frame and nframes is set.
extern int bm_gfx_load_animation( char * filename, int * nframes, int *fps = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY );
extern int bm_load_animation( char * filename, int * nframes, int *fps = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY );
// This locks down a bitmap and returns a pointer to a bitmap
// that can be accessed until you call bm_unlock. Only lock
// a bitmap when you need it! This will convert it into the
// appropriate format also.
extern bitmap * bm_gfx_lock( int bitmapnum, ubyte bpp, ubyte flags );
extern bitmap * bm_lock( int bitmapnum, ubyte bpp, ubyte flags );
// The signature is a field that gets filled in with
// a unique signature for each bitmap. The signature for each bitmap
@@ -427,10 +455,10 @@ extern bitmap * bm_gfx_lock( int bitmapnum, ubyte bpp, ubyte flags );
extern uint bm_get_signature( int bitmapnum);
// Unlocks a bitmap
extern void bm_gfx_unlock( int bitmapnum );
extern void bm_unlock( int bitmapnum );
// Gets info. w,h,or flags,nframes or fps can be NULL if you don't care.
extern void bm_gfx_get_info( int bitmapnum, int *w=NULL, int * h=NULL, ubyte * flags=NULL, int *nframes=NULL, int *fps=NULL, bitmap_section_info **sections = NULL );
extern void bm_get_info( int bitmapnum, int *w=NULL, int * h=NULL, ubyte * flags=NULL, int *nframes=NULL, int *fps=NULL );
// get filename
extern void bm_get_filename(int bitmapnum, char *filename);
@@ -440,10 +468,10 @@ extern void bm_update();
// call to load all data for all bitmaps that have been requested to be loaded
extern void bm_gfx_load_all();
extern void bm_gfx_unload_all();
extern void bm_unload_all();
// call to get the palette for a bitmap
void bm_gfx_get_palette(int n, ubyte *pal, char *name);
void bm_get_palette(int n, ubyte *pal, char *name);
// Hacked function to get a pixel from a bitmap.
// Only works good in 8bpp mode.
@@ -452,7 +480,7 @@ void bm_gfx_get_pixel( int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *
// Returns number of bytes of bitmaps locked this frame
// ntotal = number of bytes of bitmaps locked this frame
// nnew = number of bytes of bitmaps locked this frame that weren't locked last frame
void bm_gfx_get_frame_usage(int *ntotal, int *nnew);
void bm_get_frame_usage(int *ntotal, int *nnew);
/*
* Example on using bm_create
@@ -499,28 +527,31 @@ void bm_gfx_get_frame_usage(int *ntotal, int *nnew);
// Paging stuff
//============================================================================
void bm_gfx_page_in_start();
void bm_gfx_page_in_stop();
void bm_page_in_start();
void bm_page_in_stop();
// Paging code in a library should call these functions
// in its page in function.
// Marks a texture as being used for this level
// If num_frames is passed, assume this is an animation
void bm_gfx_page_in_texture( int bitmapnum, int num_frames=1 );
void bm_page_in_texture( int bitmapnum, int num_frames=1 );
// Marks a texture as being used for this level
// If num_frames is passed, assume this is an animation
void bm_gfx_page_in_nondarkening_texture( int bitmap, int num_frames=1 );
void bm_page_in_nondarkening_texture( int bitmap, int num_frames=1 );
// marks a texture as being a transparent textyre used for this level
// Marks a texture as being used for this level
// If num_frames is passed, assume this is an animation
void bm_gfx_page_in_xparent_texture( int bitmapnum, int num_frames=1 );
void bm_page_in_xparent_texture( int bitmapnum, int num_frames=1 );
// Marks an aabitmap as being used for this level
// If num_frames is passed, assume this is an animation
void bm_gfx_page_in_aabitmap( int bitmapnum, int num_frames=1 );
void bm_page_in_aabitmap( int bitmapnum, int num_frames=1 );
// unload a texture that was paged in
int bm_page_out( int handle );
//
// Mode: 0 = High memory
@@ -536,6 +567,7 @@ void BM_SELECT_ALPHA_TEX_FORMAT();
// set the rgba components of a pixel, any of the parameters can be NULL
extern void (*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
extern void (*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_d3d(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb_d3d_16_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
@@ -544,21 +576,20 @@ void bm_set_components_argb_d3d_16_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *
void bm_set_components_argb_d3d_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
// get the rgba components of a pixel, any of the parameters can be NULL
void bm_gfx_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
//============================================================================
// section info stuff
//============================================================================
// given a bitmap and a section, return the size (w, h)
void bm_gfx_get_section_size(int bitmapnum, int sx, int sy, int *w, int *h);
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
extern int GLOWMAP; //this holds a reference to a map that is a fully lit version of it's index -Bobboau
extern int SPECMAP; //this holds a reference to a map that is for specular mapping -Bobboau
extern int ENVMAP; //this holds a reference to a map that is for environment mapping -Bobboau
int bm_is_compressed(int num);
int bm_get_tcache_type(int num);
int bm_get_size(int num);
int bm_get_num_mipmaps(int num);
void bm_print_bitmaps();
int bm_make_render_target( int &x_res, int &y_res, int flags );
bool bm_is_render_target(int bitmap_id);
bool bm_set_render_target(int handle, int face = -1);
#endif
+485
View File
@@ -0,0 +1,485 @@
#include "camera/camera.h"
#include "math/vecmat.h"
#include "graphics/2d.h"
#include "globalincs/alphacolors.h"
#include "parse/parselo.h"
//Some global vars
std::vector<subtitle> Subtitles;
std::vector<camera> Cameras;
//Preset cameras
camera* Free_camera = NULL;
//This is where the camera class beings! :D
camera::camera()
{
//These are our two pointers, new'd and delete'd only by this class
desired_position = NULL;
desired_orientation = NULL;
reset();
}
camera::~camera()
{
//Cleanup
if(desired_position != NULL)
delete desired_position;
if(desired_orientation != NULL)
delete desired_orientation;
}
void camera::reset()
{
position = vmd_zero_vector;
if(desired_position != NULL)
{
delete desired_position;
desired_position = NULL;
}
translation_velocity = translation_vel_limit = translation_acc_limit = vmd_zero_vector;
vm_set_identity(&orientation);
if(desired_orientation != NULL)
{
delete desired_orientation;
desired_orientation = NULL;
}
rotation_rate = rotation_vel_limit = rotation_acc_limit = vmd_zero_vector;
}
void camera::set_position(vec3d *in_position, float in_translation_time, float in_translation_acceleration_time)
{
position = *in_position;
}
void camera::set_translation_velocity(vec3d *in_velocity)
{
if(in_velocity == NULL)
translation_velocity = *in_velocity;
else
vm_vec_zero(&translation_velocity);
}
#define square(a) (a*a)
void camera::set_rotation(matrix *in_orientation, float in_rotation_time, float in_rotation_acceleration_time)
{
if(in_rotation_time > 0.0f || in_rotation_acceleration_time > 0.0f)
{
//Safeties
if(in_rotation_acceleration_time <= 0.0f)
in_rotation_acceleration_time = 1.0f;
if(in_rotation_time <= 0.0f)
in_rotation_time = 3.0f;
if(in_rotation_acceleration_time*2.0f > in_rotation_time)
in_rotation_acceleration_time = in_rotation_time/2.0f;
//Get the angles in radians
angles curr_orientation, new_orientation;
vm_extract_angles_matrix(&curr_orientation, &orientation);
vm_extract_angles_matrix(&new_orientation, in_orientation);
//Find the distance
angles d;
d.p = new_orientation.p - curr_orientation.p;
d.b = new_orientation.b - curr_orientation.b;
d.h = new_orientation.h - curr_orientation.h;
/*d.p = curr_orientation.p - new_orientation.p;
d.b = curr_orientation.b - new_orientation.b;
d.h = curr_orientation.h - new_orientation.h;*/
/*ad_dist = -(V/At)square((At));
((Xf - Xo) - ad_dist)/V*/
/*v.p = (-(in_rotation_time - 2.0f*(in_rotation_acceleration_time)) + sqrt(square(in_rotation_time-2.0f*(in_rotation_acceleration_time))) + 4.0f*(curr_orientation.p - new_orientation.p))/2;
v.b = (-(in_rotation_time - 2.0f*(in_rotation_acceleration_time)) + sqrt(square(in_rotation_time-2.0f*(in_rotation_acceleration_time))) + 4.0f*(curr_orientation.b - new_orientation.b))/2;
v.h = (-(in_rotation_time - 2.0f*(in_rotation_acceleration_time)) + sqrt(square(in_rotation_time-2.0f*(in_rotation_acceleration_time))) + 4.0f*(curr_orientation.h - new_orientation.h))/2;*/
/*v.p = (new_orientation.p - curr_orientation.p)/(in_rotation_time - in_rotation_acceleration_time);
v.b = (new_orientation.p - curr_orientation.p)/(in_rotation_time - in_rotation_acceleration_time);
v.h = (new_orientation.p - curr_orientation.p)/(in_rotation_time - in_rotation_acceleration_time);*/
/*
angles *U = &rotation_rate;
float At = in_rotation_acceleration_time;
float t = in_rotation_time; //- 2.0f*At*/
/*v.p = ((d.p/At - U->p)/t);
v.b = ((d.b/At - U->b)/t);
v.h = ((d.h/At - U->h)/t);*/
/*v.p = ((d.p - U->p*At)/t);
v.b = ((d.b - U->b*At)/t);
v.h = ((d.h - U->h*At)/t);*/
//Set the desired orientation
if(desired_orientation == NULL)
desired_orientation = new matrix;
if(in_orientation != NULL)
*desired_orientation = *in_orientation;
else
vm_set_identity(desired_orientation);
//Calculate the maximum acceleration speed
rotation_acc_limit.xyz.z = fabsf(d.p / ((in_rotation_time * in_rotation_acceleration_time) - square(in_rotation_acceleration_time)));
rotation_acc_limit.xyz.x = fabsf(d.b / ((in_rotation_time * in_rotation_acceleration_time) - square(in_rotation_acceleration_time)));
rotation_acc_limit.xyz.y = fabsf(d.h / ((in_rotation_time * in_rotation_acceleration_time) - square(in_rotation_acceleration_time)));
//Calculate the maximum velocity
rotation_vel_limit.xyz.x = fabsf(rotation_acc_limit.xyz.x * in_rotation_acceleration_time);
rotation_vel_limit.xyz.y = fabsf(rotation_acc_limit.xyz.y * in_rotation_acceleration_time);
rotation_vel_limit.xyz.z = fabsf(rotation_acc_limit.xyz.z * in_rotation_acceleration_time);
//rotation_rate_delta_time = rotation_rate_delta_time_left = in_rotation_acceleration_time;
//rotation_rate_decel_time_til = in_rotation_time - in_rotation_acceleration_time;
//set_rotation_rate(&v, in_rotation_acceleration_time);
//rotation_rate_decel_time_til = in_rotation_time - in_rotation_acceleration_time;
}
else
{
if(in_orientation != NULL)
orientation = *in_orientation;
else
vm_set_identity(&orientation);
set_rotation_velocity(NULL);
}
}
void camera::set_rotation(angles *in_angles, float in_rotation_time, float in_rotation_acceleration_time)
{
matrix temp_matrix = IDENTITY_MATRIX;
if(in_angles != NULL)
vm_angles_2_matrix(&temp_matrix, in_angles);
set_rotation(&temp_matrix, in_rotation_time, in_rotation_acceleration_time);
}
void camera::set_rotation_facing(vec3d *in_target, float in_rotation_time, float in_rotation_acceleration_time)
{
matrix temp_matrix = IDENTITY_MATRIX;
if(in_target != NULL)
{
vec3d targetvec;
vm_vec_normalized_dir(&targetvec, in_target, &position);
vm_vector_2_matrix(&temp_matrix, &targetvec, NULL, NULL);
}
set_rotation(&temp_matrix, in_rotation_time, in_rotation_acceleration_time);
}
void camera::set_rotation_velocity(vec3d *in_rotation_rate)
{
if(in_rotation_rate != NULL)
rotation_rate = *in_rotation_rate;
else
vm_vec_zero(&rotation_rate);
/*if(in_rotation_rate == NULL)
{
rotation_rate.p = rotation_rate.b = rotation_rate.h = 0.0f;
rotation_rate_delta_time = rotation_rate_delta_time_left = in_rotation_acceleration_time = 0.0f;
rotation_rate_decel_time_til = -1.0f;
return;
}
rotation_rate_delta_time = rotation_rate_delta_time_left = in_rotation_acceleration_time;
rotation_rate_decel_time_til = -1.0f;
rotation_rate_delta.p = in_rotation_rate->p / in_rotation_acceleration_time;
rotation_rate_delta.b = in_rotation_rate->b / in_rotation_acceleration_time;
rotation_rate_delta.h = in_rotation_rate->h / in_rotation_acceleration_time;*/
}
void camera::do_frame(float in_frametime)
{
//float frametime, rot_frametime, trans_frametime;
//DO ROTATION STUFF
if(desired_orientation != NULL)
{
matrix ori_out;
vec3d vel_out;
vm_matrix_interpolate(desired_orientation, &orientation, &rotation_rate, in_frametime, &ori_out, &vel_out, &rotation_vel_limit, &rotation_acc_limit, 1);
orientation = ori_out;
rotation_rate = vel_out;
//TODO: Make this "if(*desired_orienation == orientation)"
//Note that this means we are finished rotating
if(vel_out.xyz.x == 0.0f && vel_out.xyz.y == 0.0f && vel_out.xyz.z == 0.0f)
{
delete desired_orientation;
desired_orientation = NULL;
rotation_rate = rotation_vel_limit = rotation_acc_limit = vmd_zero_vector;
}
}
else if(rotation_rate.xyz.x || rotation_rate.xyz.y || rotation_rate.xyz.z)
{
//TODO: Make this right.
angles new_orientation;
vm_angles_2_matrix(&orientation, &new_orientation);
new_orientation.p += rotation_rate.xyz.z;
new_orientation.b += rotation_rate.xyz.x;
new_orientation.h += rotation_rate.xyz.y;
vm_angles_2_matrix(&orientation, &new_orientation);
}
/* rot_frametime = trans_frametime = in_frametime;
do
{
frametime = rot_frametime;
if(rotation_rate_delta_time_left || rotation_rate_decel_time_til > 0.0f)
{
if(frametime > rotation_rate_delta_time_left && rotation_rate_delta_time_left)
frametime = rotation_rate_delta_time_left;
if(frametime > rotation_rate_decel_time_til && rotation_rate_decel_time_til > 0.0f)
frametime = rotation_rate_decel_time_til;
if(rotation_rate_delta_time_left)
{
rotation_rate.p += (rotation_rate_delta.p) * frametime;
rotation_rate.b += (rotation_rate_delta.b) * frametime;
rotation_rate.h += (rotation_rate_delta.h) * frametime;
}
//mprintf(("DX:%f DY:%f DZ:%f",rotation_rate_delta.p,rotation_rate_delta.b,rotation_rate_delta.h));
//mprintf(( " X:%f", rotation_rate.p));
//mprintf(( " Y:%f", rotation_rate.b));
//mprintf(( " Z:%f\n", rotation_rate.h));
if(rotation_rate_delta_time_left)
{
rotation_rate_delta_time_left -= frametime;
}
if(rotation_rate_decel_time_til > 0.0f)
{
rotation_rate_decel_time_til -= frametime;
if(rotation_rate_decel_time_til == 0.0f)
{
rotation_rate_delta.p *= -1.0f;
rotation_rate_delta.b *= -1.0f;
rotation_rate_delta.h *= -1.0f;
rotation_rate_delta_time_left = rotation_rate_delta_time;
rotation_rate_decel_time_til = -1.0f;
}
}
}
rot_frametime -= frametime;
} while(rot_frametime);*/
//DO TRANSLATION STUFF
// float frametime = in_frametime;
/*if(translation_time_left)
{
if(in_frametime > translation_time_left)
frametime = translation_time_left;
else
frametime = in_frametime;
vm_vec_scale_add2(&translation_velocity, &translation_velocity_delta, frametime);
translation_time_left -= frametime;
}*/
vm_vec_scale_add2(&position, &translation_velocity, in_frametime);
}
#define MAX_SUBTITLE_LINES 10
subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, float in_display_time, char* in_imageanim, float in_fade_time, color *in_text_color, bool center_x, bool center_y, int in_width)
{
//Setup text
int len = strlen(in_text);
if(len == 0)
return;
int num_text_lines;
char *text_line_ptrs[MAX_SUBTITLE_LINES];
int text_line_lens[MAX_SUBTITLE_LINES];
num_text_lines = split_str(in_text, in_width, text_line_lens, text_line_ptrs, MAX_SUBTITLE_LINES);
std::string temp_str;
for(int i = 0; i < num_text_lines; i++)
{
temp_str.assign(text_line_ptrs[i], text_line_lens[i]);
text_lines.push_back(temp_str);
}
//Setup text color
if(in_text_color)
text_color = *in_text_color;
else
gr_init_alphacolor(&text_color, 255, 255, 255, 255);
//Setup display and fade time
display_time = fl_abs(in_display_time);
fade_time = fl_abs(in_fade_time);
//Setup image
image_id = -1;
if(in_imageanim != NULL)
{
len = strlen(in_imageanim);
if(len != 0 && len < MAX_FILENAME_LEN)
{
image_id = bm_load(in_imageanim);
if(image_id != -1)
strcpy(imageanim, in_imageanim);
}
}
//Setup pos
int w=0, h=0, tw=0, th=0;
image_pos[0] = 0;
image_pos[1] = 0;
if(center_x || center_y)
{
//Get text size
for(int i = 0; i < num_text_lines; i++)
{
gr_get_string_size(&w, &h, text_line_ptrs[i], text_line_lens[i]);
if(w > tw)
tw = w;
th += h;
}
//Get image size
if(image_id != -1)
{
bm_get_info(image_id, &w, &h);
tw += w;
if(h > th)
th = h;
}
//Center it?
if(center_x)
image_pos[0] = (gr_screen.max_w - tw)/2;
if(center_y)
image_pos[0] = (gr_screen.max_h - th)/2;
}
if(in_x_pos < 0 && !center_x)
image_pos[0] += gr_screen.max_w + in_x_pos;
else
image_pos[0] += in_x_pos;
if(in_y_pos < 0 && !center_y)
image_pos[1] += gr_screen.max_h + in_y_pos;
else
image_pos[1] += in_y_pos;
if(image_id != -1)
text_pos[0] = image_pos[0] + w; //Still set from bm_get_info call
else
text_pos[0] = image_pos[0];
text_pos[1] = image_pos[1];
time_displayed = 0.0f;
time_displayed_end = 2.0f*fade_time + display_time;
}
void subtitle::do_frame(float frametime)
{
//Figure out how much alpha
if(time_displayed < fade_time)
{
text_color.alpha = (ubyte)fl2i(255.0f*(time_displayed/fade_time));
}
else if(time_displayed > time_displayed_end)
{
//We're finished
if(image_id != -1)
{
bm_unload(image_id);
image_id = -1;
}
return;
}
else if((time_displayed - fade_time) > display_time)
{
text_color.alpha = (ubyte)fl2i(255.0f*(1-(time_displayed - fade_time - display_time)/fade_time));
}
else
{
text_color.alpha = 255;
}
gr_set_color_fast(&text_color);
int font_height = gr_get_font_height();
int y = text_pos[1];
for(unsigned int i = 0; i < text_lines.size(); i++)
{
gr_string(text_pos[0], y, (char*)text_lines[i].c_str(), false);
y += font_height;
}
if(image_id != -1)
{
gr_set_bitmap(image_id, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, text_color.alpha/255.0f);
gr_bitmap(image_pos[0], image_pos[1], false);
}
time_displayed += frametime;
}
subtitle::~subtitle()
{
if(image_id != -1)
bm_unload(image_id);
}
void cameras_init()
{
camera handy_camera;
//Preset cameras
Cameras.push_back(handy_camera);
Free_camera = &Cameras[Cameras.size()-1];
}
void cameras_close()
{
Cameras.clear();
//Preset cameras
Free_camera = NULL;
}
void cameras_do_frame(float frametime)
{
unsigned int i,size=Cameras.size();
for(i = 0; i < size; i++)
{
Cameras[i].do_frame(frametime);
}
}
void subtitles_init()
{
//Do nothing!!
}
void subtitles_close()
{
Subtitles.clear();
}
void subtitles_do_frame(float frametime)
{
unsigned int i,size=Subtitles.size();
for(i = 0; i < size; i++)
{
Subtitles[i].do_frame(frametime);
}
}
+88
View File
@@ -0,0 +1,88 @@
#ifndef _CAMERA_H
#define _CAMERA_H
#include <string>
#include <vector>
#include "globalincs/pstypes.h"
#include "graphics/2d.h"
class camera
{
private:
vec3d position;
vec3d *desired_position; //NULL unless we're trying to move somewhere
vec3d translation_velocity;
vec3d translation_vel_limit;
vec3d translation_acc_limit;
matrix orientation;
matrix *desired_orientation; //NULL unless we're trying to point somewhere
vec3d rotation_rate;
vec3d rotation_vel_limit;
vec3d rotation_acc_limit;
public:
camera();
~camera();
void reset();
//Set
void set_position(vec3d *in_position, float in_translation_time = 0.0f, float in_translation_acceleration_time = 0.0f);
void set_translation_velocity(vec3d *in_velocity);
void set_rotation(matrix *in_orientation, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
void set_rotation(angles *in_angles, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
void set_rotation_facing(vec3d *in_target, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
void set_rotation_velocity(vec3d *in_rotation_rate);
//Get
//These return values should never ever be changed, I do this in the interest of speed.
vec3d *get_position() {return &position;}
matrix *get_orientation() {return &orientation;}
//Do
void do_frame(float in_frametime);
};
class subtitle
{
private:
std::vector<std::string> text_lines;
int text_pos[2];
float display_time;
float fade_time;
color text_color;
//Done with set
char imageanim[MAX_FILENAME_LEN];
int image_id;
int image_pos[2];
//Time this has been displayed
float time_displayed;
//When to end it
float time_displayed_end;
public:
subtitle(int in_x_pos, int in_y_pos, char* in_text, float in_display_time, char* in_imageanim = NULL, float in_fade_time = 0.0f, color *in_text_color = NULL, bool center_x = false, bool center_y = false, int in_width = 200);
~subtitle();
void do_frame(float frametime);
};
//Some global stuff
extern std::vector<subtitle> Subtitles;
extern std::vector<camera> Cameras;
//Preset cameras
extern camera* Free_camera;
//Helpful functions
void cameras_init();
void cameras_close();
void cameras_do_frame(float frametime);
void subtitles_init();
void subtitles_close();
void subtitles_do_frame(float frametime);
#endif // _CAMERA_H
+106 -50
View File
@@ -9,13 +9,60 @@
/*
* $Logfile: /Freespace2/code/CFile/cfile.cpp $
* $Revision: 2.15 $
* $Date: 2004-05-06 22:12:14 $
* $Revision: 2.30 $
* $Date: 2005-04-19 06:22:20 $
* $Author: taylor $
*
* Utilities for operating on files
*
* $Log: not supported by cvs2svn $
* Revision 2.29 2005/04/05 05:53:14 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.28 2005/03/02 03:13:00 taylor
* that one should never have slipped passed me (Linux specific)
*
* Revision 2.27 2005/01/30 18:32:41 taylor
* merge with Linux/OSX tree - p0130
* remove extra brace in cfile.cpp
*
* Revision 2.26 2005/01/30 12:50:08 taylor
* merge with Linux/OSX tree - p0130
*
* Revision 2.25 2005/01/09 21:40:07 wmcoolmon
* Fix for music directory parent
*
* Revision 2.24 2004/12/25 00:22:54 wmcoolmon
* Added .ogg in proper directories
*
* Revision 2.23 2004/10/31 21:29:00 taylor
* EFF animation support
*
* Revision 2.22 2004/10/09 18:08:33 taylor
* almost forgot this for the IBX stuff
*
* Revision 2.21 2004/07/26 20:47:25 Kazan
* remove MCD complete
*
* Revision 2.20 2004/07/17 09:03:29 taylor
* make sure avi and mpg movies get added to file cache
*
* Revision 2.19 2004/07/12 16:32:42 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.18 2004/06/22 23:14:09 wmcoolmon
* Nonworking OGG support for sound (not music) added, disabled load-only-used-weapons code, modification to sound system registry code.
* OGG code has been commented out, so you don't need the SDK yet.
*
* Revision 2.17 2004/05/26 02:29:44 wmcoolmon
* Scratch that - .tbm is a better extension
*
* Revision 2.16 2004/05/26 02:26:14 wmcoolmon
* Added table chunk extension
*
* Revision 2.15 2004/05/06 22:12:14 taylor
* make sure JPG and DDS files are added to the file cache for maps and effects
*
* Revision 2.14 2004/03/05 09:01:54 Goober5000
* Uber pass at reducing #includes
* --Goober5000
@@ -249,7 +296,7 @@
#include <winbase.h> /* needed for memory mapping of file functions */
#endif
#ifdef unix
#ifdef SCP_UNIX
#include <sys/stat.h>
#include <glob.h>
#include <sys/mman.h>
@@ -259,8 +306,14 @@
#include "parse/encrypt.h"
#include "cfile/cfilesystem.h"
#include "cfile/cfilearchive.h"
#include "osapi/osapi.h"
char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
#ifdef SCP_UNIX
char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
#endif
// During cfile_init, verify that Pathtypes[n].index == n for each item
// Each path must have a valid parent that can be tracable all the way back to the root
@@ -272,34 +325,34 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
// What type this is Path Extensions Parent type
{ CF_TYPE_INVALID, NULL, NULL, CF_TYPE_INVALID },
// Root must be index 1!!
{ CF_TYPE_ROOT, "", ".mve", CF_TYPE_ROOT },
{ CF_TYPE_ROOT, "", ".mve .avi .mpg", CF_TYPE_ROOT },
{ CF_TYPE_DATA, "data", ".cfg .log .txt", CF_TYPE_ROOT },
{ CF_TYPE_MAPS, "data" DIR_SEPARATOR_STR "maps", ".pcx .ani .tga .jpg .dds", CF_TYPE_DATA },
{ CF_TYPE_MAPS, "data" DIR_SEPARATOR_STR "maps", ".pcx .ani .eff .tga .jpg .dds", CF_TYPE_DATA },
{ CF_TYPE_TEXT, "data" DIR_SEPARATOR_STR "text", ".txt .net", CF_TYPE_DATA },
{ CF_TYPE_MISSIONS, "data" DIR_SEPARATOR_STR "missions", ".fs2 .fc2 .ntl .ssv", CF_TYPE_DATA },
{ CF_TYPE_MODELS, "data" DIR_SEPARATOR_STR "models", ".pof", CF_TYPE_DATA },
{ CF_TYPE_TABLES, "data" DIR_SEPARATOR_STR "tables", ".tbl", CF_TYPE_DATA },
{ CF_TYPE_SOUNDS, "data" DIR_SEPARATOR_STR "sounds", ".wav", CF_TYPE_DATA },
{ CF_TYPE_SOUNDS_8B22K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "8b22k", ".wav", CF_TYPE_SOUNDS },
{ CF_TYPE_SOUNDS_16B11K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "16b11k", ".wav", CF_TYPE_SOUNDS },
{ CF_TYPE_TABLES, "data" DIR_SEPARATOR_STR "tables", ".tbl .tbm", CF_TYPE_DATA },
{ CF_TYPE_SOUNDS, "data" DIR_SEPARATOR_STR "sounds", ".wav .ogg", CF_TYPE_DATA },
{ CF_TYPE_SOUNDS_8B22K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "8b22k", ".wav .ogg", CF_TYPE_SOUNDS },
{ CF_TYPE_SOUNDS_16B11K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "16b11k", ".wav .ogg", CF_TYPE_SOUNDS },
{ CF_TYPE_VOICE, "data" DIR_SEPARATOR_STR "voice", "", CF_TYPE_DATA },
{ CF_TYPE_VOICE_BRIEFINGS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "briefing", ".wav", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_CMD_BRIEF, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "command_briefings", ".wav", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_DEBRIEFINGS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "debriefing", ".wav", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_PERSONAS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "personas", ".wav", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_SPECIAL, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "special", ".wav", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_TRAINING, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "training", ".wav", CF_TYPE_VOICE },
{ CF_TYPE_MUSIC, "data" DIR_SEPARATOR_STR "music", ".wav", CF_TYPE_VOICE },
{ CF_TYPE_MOVIES, "data" DIR_SEPARATOR_STR "movies", ".mve .msb", CF_TYPE_DATA },
{ CF_TYPE_VOICE_BRIEFINGS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "briefing", ".wav .ogg", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_CMD_BRIEF, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "command_briefings", ".wav .ogg", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_DEBRIEFINGS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "debriefing", ".wav .ogg", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_PERSONAS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "personas", ".wav .ogg", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_SPECIAL, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "special", ".wav .ogg", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_TRAINING, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "training", ".wav .ogg", CF_TYPE_VOICE },
{ CF_TYPE_MUSIC, "data" DIR_SEPARATOR_STR "music", ".wav .ogg", CF_TYPE_DATA },
{ CF_TYPE_MOVIES, "data" DIR_SEPARATOR_STR "movies", ".mve .msb .avi .mpg", CF_TYPE_DATA },
{ CF_TYPE_INTERFACE, "data" DIR_SEPARATOR_STR "interface", ".pcx .ani .tga", CF_TYPE_DATA },
{ CF_TYPE_FONT, "data" DIR_SEPARATOR_STR "fonts", ".vf", CF_TYPE_DATA },
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .pcx .neb .tga .jpg .dds", CF_TYPE_DATA },
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .eff .pcx .neb .tga .jpg .dds", CF_TYPE_DATA },
{ CF_TYPE_HUD, "data" DIR_SEPARATOR_STR "hud", ".ani .pcx .tga", CF_TYPE_DATA },
{ CF_TYPE_PLAYER_MAIN, "data" DIR_SEPARATOR_STR "players", "", CF_TYPE_DATA },
{ CF_TYPE_PLAYER_IMAGES_MAIN, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "images", ".pcx", CF_TYPE_PLAYER_MAIN },
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp", CF_TYPE_DATA }, //clr=cached color
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx", CF_TYPE_DATA }, //clr=cached color
{ CF_TYPE_PLAYERS, "data" DIR_SEPARATOR_STR "players", ".hcf", CF_TYPE_DATA },
{ CF_TYPE_SINGLE_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "single", ".plr .csg .css", 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_DATA },
{ CF_TYPE_MULTI_CACHE, "data" DIR_SEPARATOR_STR "multidata", ".pcx .fs2", CF_TYPE_DATA },
{ CF_TYPE_CONFIG, "data" DIR_SEPARATOR_STR "config", ".cfg", CF_TYPE_DATA },
@@ -331,7 +384,7 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size);
#if defined _WIN32
CFILE *cf_open_mapped_fill_cfblock(HANDLE hFile, int type);
#elif defined unix
#elif defined SCP_UNIX
CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type);
#endif
@@ -399,11 +452,7 @@ int cfile_init(char *exe_dir, char *cdrom_dir)
// are we in a root directory?
if(cfile_in_root_dir(buf)){
#if defined _WIN32
MessageBox((HWND)NULL, "Freespace2/Fred2 cannot be run from a drive root directory!", "Error", MB_OK);
#elif defined unix
fprintf(stderr, "Error: Freespace2/Fred2 cannot be run from a drive root directory!\n");
#endif
return 1;
}
@@ -417,16 +466,15 @@ int cfile_init(char *exe_dir, char *cdrom_dir)
buf[i] = 0;
cfile_chdir(buf);
} else {
#if defined _WIN32
MessageBox((HWND)NULL, "Error trying to determine executable root directory!", "Error", MB_OK);
#elif defined unix
fprintf(stderr, "Error trying to determine executable root directory!\n");
#endif
return 1;
}
// set root directory
strncpy(Cfile_root_dir, buf, CFILE_ROOT_DIRECTORY_LEN-1);
#ifdef SCP_UNIX
snprintf(Cfile_user_dir, MAX_PATH, "%s/%s/", detect_home(), Osreg_user_dir);
#endif
for ( i = 0; i < MAX_CFILE_BLOCKS; i++ ) {
Cfile_block_list[i].type = CFILE_BLOCK_UNUSED;
@@ -486,7 +534,7 @@ int cfile_push_chdir(int type)
int e;
char dir[128];
char OriginalDirectory[128];
char *Drive, *Path;
char *Drive = NULL, *Path = NULL;
char NoDir[] = "\\.";
_getcwd(OriginalDirectory, 127);
@@ -530,7 +578,7 @@ int cfile_chdir(char *dir)
{
int e;
char OriginalDirectory[128];
char *Drive, *Path;
char *Drive = NULL, *Path = NULL;
char NoDir[] = "\\.";
_getcwd(OriginalDirectory, 127);
@@ -575,7 +623,6 @@ int cfile_pop_dir()
// NOTE : WILL NOT DELETE READ-ONLY FILES
int cfile_flush_dir(int dir_type)
{
int find_handle;
int del_count;
Assert( CF_TYPE_SPECIFIED(dir_type) );
@@ -588,6 +635,7 @@ int cfile_flush_dir(int dir_type)
// proceed to delete the files
del_count = 0;
#if defined _WIN32
int find_handle;
_finddata_t find;
find_handle = _findfirst( "*", &find );
if (find_handle != -1) {
@@ -602,7 +650,7 @@ int cfile_flush_dir(int dir_type)
} while (!_findnext(find_handle, &find));
_findclose( find_handle );
}
#elif defined unix
#elif defined SCP_UNIX
glob_t globinfo;
memset(&globinfo, 0, sizeof(globinfo));
int status = glob("*", 0, NULL, &globinfo);
@@ -842,7 +890,11 @@ CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize
if ( strchr(mode,'w') ) {
// For write-only files, require a full path or a path type
if ( strpbrk(file_path,"/\\:") ) {
#ifdef SCP_UNIX
if ( strpbrk(file_path, "/") ) {
#else
if ( strpbrk(file_path,"/\\:") ) {
#endif
// Full path given?
strcpy(longname, file_path );
} else {
@@ -890,7 +942,7 @@ CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize
if (hFile != INVALID_HANDLE_VALUE) {
return cf_open_mapped_fill_cfblock(hFile, dir_type);
}
#elif defined unix
#elif defined SCP_UNIX
FILE *fp = fopen( longname, "rb" );
if (fp) {
return cf_open_mapped_fill_cfblock(fp, dir_type);
@@ -993,9 +1045,13 @@ int cfclose( CFILE * cfile )
result = CloseHandle(cb->hMapFile);
Assert(result); // Ensure file handle is closed properly
result = 0;
#elif defined unix
result = munmap(cb->data, cb->data_length);
Assert(result);
#elif defined SCP_UNIX
// FIXME: result is wrong after munmap() but it is successful
//result = munmap(cb->data, cb->data_length);
//Assert(result);
munmap(cb->data, cb->data_length);
if ( cb->fp != NULL)
result = fclose(cb->fp);
#endif
} else if ( cb->fp != NULL ) {
@@ -1024,6 +1080,7 @@ CFILE *cf_open_fill_cfblock(FILE *fp, int type)
cfile_block_index = cfget_cfile_block();
if ( cfile_block_index == -1 ) {
fclose(fp);
return NULL;
} else {
CFILE *cfp;
@@ -1036,13 +1093,7 @@ CFILE *cf_open_fill_cfblock(FILE *fp, int type)
cfbp->fp = fp;
cfbp->dir_type = type;
#if defined _WIN32
cf_init_lowlevel_read_code(cfp,0,filelength(fileno(fp)) );
#elif defined unix
struct stat statbuf;
fstat(fileno(fp), &statbuf);
cf_init_lowlevel_read_code(cfp, 0, statbuf.st_size );
#endif
return cfp;
}
@@ -1062,6 +1113,7 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
cfile_block_index = cfget_cfile_block();
if ( cfile_block_index == -1 ) {
fclose(fp);
return NULL;
} else {
CFILE *cfp;
@@ -1091,7 +1143,7 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
//
#if defined _WIN32
CFILE *cf_open_mapped_fill_cfblock(HANDLE hFile, int type)
#elif defined unix
#elif defined SCP_UNIX
CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
#endif
{
@@ -1099,6 +1151,9 @@ CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
cfile_block_index = cfget_cfile_block();
if ( cfile_block_index == -1 ) {
#ifdef SCP_UNIX
fclose(fp);
#endif
return NULL;
}
else {
@@ -1124,8 +1179,9 @@ CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
cfbp->data = (ubyte*)MapViewOfFile(cfbp->hMapFile, FILE_MAP_READ, 0, 0, 0);
Assert( cfbp->data != NULL );
#elif defined unix
#elif defined SCP_UNIX
cfbp->fp = fp;
cfbp->data_length = filelength( fileno(fp) );
cfbp->data = mmap(NULL, // start
cfbp->data_length, // length
PROT_READ, // prot
@@ -1183,7 +1239,7 @@ float cfread_float(CFILE *file, int ver, float deflt)
if (cfread( &f, sizeof(f), 1, file) != 1)
return deflt;
// i = INTEL_INT(i); // hmm, not sure what to do here
f = INTEL_FLOAT(&f);
return f;
}
@@ -1256,7 +1312,7 @@ ubyte cfread_ubyte(CFILE *file, int ver, ubyte deflt)
return b;
}
void cfread_vector(vector *vec, CFILE *file, int ver, vector *deflt)
void cfread_vector(vec3d *vec, CFILE *file, int ver, vec3d *deflt)
{
if (file->version < ver) {
if (deflt)
@@ -1329,7 +1385,7 @@ void cfread_string_len(char *buf,int n, CFILE *file)
int cfwrite_float(float f, CFILE *file)
{
// i = INTEL_INT(i); // hmm, not sure what to do here
f = INTEL_FLOAT(&f);
return cfwrite(&f, sizeof(f), 1, file);
}
@@ -1362,7 +1418,7 @@ int cfwrite_ubyte(ubyte b, CFILE *file)
return cfwrite(&b, sizeof(b), 1, file);
}
int cfwrite_vector(vector *vec, CFILE *file)
int cfwrite_vector(vec3d *vec, CFILE *file)
{
if(!cfwrite_float(vec->xyz.x, file)){
return 0;
+26 -6
View File
@@ -9,13 +9,28 @@
/*
* $Logfile: /Freespace2/code/CFile/cfile.h $
* $Revision: 2.7 $
* $Date: 2003-08-20 08:12:08 $
* $Author: wmcoolmon $
* $Revision: 2.12 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
* <insert description of file here>
*
* $Log: not supported by cvs2svn $
* Revision 2.11 2005/04/05 05:53:14 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.10 2005/01/30 12:50:08 taylor
* merge with Linux/OSX tree - p0130
*
* Revision 2.9 2004/08/11 05:06:19 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.8 2004/05/26 21:02:26 wmcoolmon
* Added weapons_expl modular table, updated cfilesystem to work with modular tables, fixed loading order, fixed ship loading error messages
*
* Revision 2.7 2003/08/20 08:12:08 wmcoolmon
* Made cfile_delete return 0 on failure, 1 on success
*
* Revision 2.6 2002/11/10 16:29:53 DTP
* -DTP reworked mod support,
*
@@ -359,13 +374,14 @@
#ifndef __CFILE_H__
#define __CFILE_H__
#include <time.h>
#include "globalincs/pstypes.h"
#if defined _WIN32
#define DIR_SEPARATOR_CHAR '\\'
#define DIR_SEPARATOR_STR "\\"
#elif defined unix
#elif defined SCP_UNIX
#define DIR_SEPARATOR_CHAR '/'
#define DIR_SEPARATOR_STR "/"
#else
@@ -444,6 +460,7 @@ typedef struct {
#define CF_SORT_NONE 0
#define CF_SORT_NAME 1
#define CF_SORT_TIME 2
#define CF_SORT_REVERSE 3
#define cfread_fix(file) (fix)cfread_int(file)
#define cfwrite_fix(i,file) cfwrite_int(i,file)
@@ -455,6 +472,9 @@ extern int (*Get_file_list_filter)(char *filename);
// cfile directory. valid after cfile_init() returns successfully
#define CFILE_ROOT_DIRECTORY_LEN 256
extern char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN];
#ifdef SCP_UNIX
extern char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN];
#endif
//================= LOW-LEVEL FUNCTIONS ==================
// Call this once at the beginning of the program
@@ -586,7 +606,7 @@ ushort cfread_ushort(CFILE *file, int ver = 0, ushort deflt = 0);
int cfread_int(CFILE *file, int ver = 0, int deflt = 0);
uint cfread_uint(CFILE *file, int ver = 0, uint deflt = 0);
float cfread_float(CFILE *file, int ver = 0, float deflt = 0.0f);
void cfread_vector(vector *vec, CFILE *file, int ver = 0, vector *deflt = NULL);
void cfread_vector(vec3d *vec, CFILE *file, int ver = 0, vec3d *deflt = NULL);
void cfread_angles(angles *ang, CFILE *file, int ver = 0, angles *deflt = NULL);
// Reads variable length, null-termined string. Will only read up
@@ -604,7 +624,7 @@ int cfwrite_uint(uint i, CFILE *file);
int cfwrite_short(short s, CFILE *file);
int cfwrite_ushort(ushort s, CFILE *file);
int cfwrite_ubyte(ubyte u, CFILE *file);
int cfwrite_vector(vector *vec, CFILE *file);
int cfwrite_vector(vec3d *vec, CFILE *file);
int cfwrite_angles(angles *ang, CFILE *file);
// writes variable length, null-termined string.
+16 -4
View File
@@ -9,14 +9,24 @@
/*
* $Logfile: /Freespace2/code/CFile/CfileArchive.cpp $
* $Revision: 2.4 $
* $Date: 2004-03-05 09:01:54 $
* $Author: Goober5000 $
* $Revision: 2.7 $
* $Date: 2005-07-24 18:31:17 $
* $Author: taylor $
*
* Low-level code for reading data out of large archive files or normal files. All
* reads/seeks come through here.
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2004/07/26 20:47:25 Kazan
* remove MCD complete
*
* Revision 2.5 2004/07/12 16:32:42 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.4 2004/03/05 09:01:54 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.3 2003/03/19 09:05:25 Goober5000
* more housecleaning, this time for debug warnings
* --Goober5000
@@ -103,6 +113,8 @@
#include "cfile/cfile.h"
#include "cfile/cfilearchive.h"
#define CHECK_POSITION
// Called once to setup the low-level reading code.
@@ -241,7 +253,7 @@ int cfseek( CFILE *cfile, int offset, int where )
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int tmp_offset;
tmp_offset = ftell(cb->fp) - cb->lib_offset;
tmp_offset = (int)ftell(cb->fp) - cb->lib_offset;
Assert(tmp_offset==cb->raw_position);
#endif
+9 -3
View File
@@ -9,14 +9,20 @@
/*
* $Logfile: /Freespace2/code/CFile/CfileArchive.h $
* $Revision: 2.1 $
* $Date: 2002-07-07 19:55:58 $
* $Author: penguin $
* $Revision: 2.3 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
* External def's for CfileArchive.cpp. This should only be used
* internally by cfile stuff.
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2004/08/11 05:06:19 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.1 2002/07/07 19:55:58 penguin
* Back-port to MSVC
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
+38 -3
View File
@@ -9,13 +9,25 @@
/*
* $Logfile: /Freespace2/code/CFile/CfileList.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.6 $
* $Date: 2005-01-31 23:27:51 $
* $Author: taylor $
*
* Code for doing directory lists and sorts
*
* $Log: not supported by cvs2svn $
* Revision 2.5 2004/07/26 20:47:25 Kazan
* remove MCD complete
*
* Revision 2.4 2004/07/17 09:26:00 taylor
* add CF_SORT_REVERSE to real sort routine, makes CF_SORT_TIME work again
*
* Revision 2.3 2004/07/12 16:32:42 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.2 2002/08/01 01:41:04 penguin
* The big include file move
*
* Revision 2.1 2002/07/29 19:37:21 penguin
* added #ifdef _WIN32 around windows-specific system headers
*
@@ -74,6 +86,9 @@
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
// Sorts a list of filenames using the specified sorting method (CF_SORT_*).
// n = number of filenames in list to sort
// list = list of filenames to be sorted
@@ -141,6 +156,22 @@ void cf_sort_filenames( int n, char **list, int sort, file_list_info *info )
incr /= 2;
}
return;
} else if (sort == CF_SORT_REVERSE) {
incr = n / 2;
char buffer[MAX_FILENAME_LEN];
for (i = 0; i < incr; i++) {
t = list[n - 1 - i];
if ( stricmp(list[i], t) > 0 ) {
strcpy(buffer, list[i]);
strcpy(list[i], t);
strcpy(t, buffer);
}
}
return;
}
@@ -148,6 +179,8 @@ void cf_sort_filenames( int n, char **list, int sort, file_list_info *info )
}
#if (0) // these aren't used anywhere now
// cf_compress - Do Run Length Compression on a block of data. Targa format.
//
// Usage:
@@ -317,6 +350,8 @@ int cf_decompress(char *out, char *in )
}
#endif // 0
// cfread() reads from a file and decompresses it
//
+325 -143
View File
@@ -9,9 +9,9 @@
/*
* $Logfile: /Freespace2/code/CFile/CfileSystem.cpp $
* $Revision: 2.17 $
* $Date: 2004-05-03 21:22:19 $
* $Author: Kazan $
* $Revision: 2.26 $
* $Date: 2005-05-12 17:49:10 $
* $Author: taylor $
*
* Functions to keep track of and find files that can exist
* on the harddrive, cd-rom, or in a pack file on either of those.
@@ -20,6 +20,35 @@
* all those locations, inherently enforcing precedence orders.
*
* $Log: not supported by cvs2svn $
* Revision 2.25 2005/01/30 12:50:08 taylor
* merge with Linux/OSX tree - p0130
*
* Revision 2.24 2004/11/21 11:27:31 taylor
* some 64-bit OS comaptibility fixes
*
* Revision 2.23 2004/10/31 21:28:38 taylor
* support new pilot code, Linux code tree merge, don't use same pilot directory for Inferno builds
*
* Revision 2.22 2004/07/26 20:47:25 Kazan
* remove MCD complete
*
* Revision 2.21 2004/07/17 09:26:00 taylor
* add CF_SORT_REVERSE to real sort routine, makes CF_SORT_TIME work again
*
* Revision 2.20 2004/07/12 16:32:42 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.19 2004/05/26 22:02:36 wmcoolmon
* Fixed cf_matches_spec; small bug was introduced.
*
* Revision 2.18 2004/05/26 21:02:26 wmcoolmon
* Added weapons_expl modular table, updated cfilesystem to work with modular tables, fixed loading order, fixed ship loading error messages
*
* Revision 2.17 2004/05/03 21:22:19 Kazan
* Abandon strdup() usage for mod list processing - it was acting odd and causing crashing on free()
* Fix condition where alt_tab_pause() would flipout and trigger failed assert if game minimizes during startup (like it does a lot during debug)
* Nav Point / Auto Pilot code (All disabled via #ifdefs)
*
* Revision 2.16 2004/05/01 21:47:43 Kazan
* bah! stupid me "NULL" not "null" - i hate when i do that
*
@@ -168,9 +197,13 @@
#include <winbase.h> /* needed for memory mapping of file functions */
#endif
#ifdef unix
#ifdef SCP_UNIX
#include <glob.h>
#include <sys/types.h>
#include <dirent.h>
#include <fnmatch.h>
#include <sys/stat.h>
#include <unistd.h>
#endif
#include "cmdline/cmdline.h"
@@ -178,9 +211,14 @@
#include "cfile/cfilesystem.h"
#include "localization/localize.h"
#define CF_ROOTTYPE_PATH 0
#define CF_ROOTTYPE_PACK 1
// for a defined and specifically set location to get/send pilot/campaign files
char *Pilot_file_path = NULL;
// Created by:
// specifying hard drive tree
// searching for pack files on hard drive // Found by searching all known paths
@@ -208,7 +246,8 @@ typedef struct cf_root_block {
static int Num_roots = 0;
static cf_root_block *Root_blocks[CF_MAX_ROOT_BLOCKS];
static int Num_path_roots = 0;
// Created by searching all roots in order. This means Files is then sorted by precedence.
typedef struct cf_file {
@@ -247,7 +286,7 @@ cf_file *cf_create_file()
int offset = Num_files % CF_NUM_FILES_PER_BLOCK;
if ( File_blocks[block] == NULL ) {
File_blocks[block] = (cf_file_block *)malloc( sizeof(cf_file_block) );
File_blocks[block] = (cf_file_block *)vm_malloc( sizeof(cf_file_block) );
Assert( File_blocks[block] != NULL);
}
@@ -278,7 +317,7 @@ cf_root *cf_create_root()
int offset = Num_roots % CF_NUM_ROOTS_PER_BLOCK;
if ( Root_blocks[block] == NULL ) {
Root_blocks[block] = (cf_root_block *)malloc( sizeof(cf_root_block) );
Root_blocks[block] = (cf_root_block *)vm_malloc( sizeof(cf_root_block) );
Assert(Root_blocks[block] != NULL);
}
@@ -299,10 +338,11 @@ int cf_get_packfile_count(cf_root *root)
for (i=CF_TYPE_ROOT; i<CF_MAX_PATH_TYPES; i++ ) {
strcpy( filespec, root->path );
if(strlen(Pathtypes[i].path)) {
strcat( filespec, Pathtypes[i].path );
if(strlen(Pathtypes[i].path)) {
strcat( filespec, Pathtypes[i].path );
if ( filespec[strlen(filespec)-1] != DIR_SEPARATOR_CHAR ) {
strcat( filespec, DIR_SEPARATOR_STR );
// }
}
}
#if defined _WIN32
@@ -323,7 +363,7 @@ int cf_get_packfile_count(cf_root *root)
_findclose( find_handle );
}
#elif defined unix
#elif defined SCP_UNIX
strcat( filespec, "*.[vV][pP]" );
glob_t globinfo;
@@ -378,7 +418,7 @@ void cf_build_pack_list( cf_root *root )
}
// allocate a temporary array of temporary roots so we can easily sort them
temp_roots_sort = (cf_root_sort*)malloc(sizeof(cf_root_sort) * temp_root_count);
temp_roots_sort = (cf_root_sort*)vm_malloc(sizeof(cf_root_sort) * temp_root_count);
if(temp_roots_sort == NULL){
Int3();
return;
@@ -391,7 +431,9 @@ void cf_build_pack_list( cf_root *root )
if(strlen(Pathtypes[i].path)) {
strcat( filespec, Pathtypes[i].path );
strcat( filespec, DIR_SEPARATOR_STR );
if ( filespec[strlen(filespec)-1] != DIR_SEPARATOR_CHAR ) {
strcat( filespec, DIR_SEPARATOR_STR );
}
}
@@ -431,7 +473,7 @@ void cf_build_pack_list( cf_root *root )
_findclose( find_handle );
}
#elif defined unix
#elif defined SCP_UNIX
strcat( filespec, "*.[vV][pP]" );
glob_t globinfo;
memset(&globinfo, 0, sizeof(globinfo));
@@ -478,17 +520,64 @@ void cf_build_pack_list( cf_root *root )
}
// free up the temp list
free(temp_roots_sort);
vm_free(temp_roots_sort);
}
void cf_build_root_list(char *cdrom_dir)
{
Num_roots = 0;
Num_path_roots = 0;
cf_root *root;
char str_temp[128], *cur_pos;
#ifdef SCP_UNIX
// =========================================================================
// now look for mods under the users HOME directory to use before system ones
if (Cmdline_mod) {
for (cur_pos=Cmdline_mod; strlen(cur_pos) != 0; cur_pos+= (strlen(cur_pos)+1))
{
memset(str_temp, 0, 128);
strcpy(str_temp, cur_pos);
strcat(str_temp, DIR_SEPARATOR_STR);
root = cf_create_root();
strcpy( root->path, Cfile_user_dir );
// do we already have a slash? as in the case of a root directory install
if(strlen(root->path) && (root->path[strlen(root->path)-1] != DIR_SEPARATOR_CHAR)){
strcat(root->path, DIR_SEPARATOR_STR); // put trailing backslash on for easier path construction
}
strcat(root->path, str_temp);
root->roottype = CF_ROOTTYPE_PATH;
cf_build_pack_list(root);
}
}
// =========================================================================
// =========================================================================
// set users HOME directory as default for loading and saving files
root = cf_create_root();
strcpy( root->path, Cfile_user_dir );
// do we already have a slash? as in the case of a root directory install
if(strlen(root->path) && (root->path[strlen(root->path)-1] != DIR_SEPARATOR_CHAR)){
strcat(root->path, DIR_SEPARATOR_STR); // put trailing backslash on for easier path construction
}
root->roottype = CF_ROOTTYPE_PATH;
// set the default player location to here
if ( Pilot_file_path == NULL )
Pilot_file_path = root->path;
// Next, check any VP files under the current directory.
cf_build_pack_list(root);
// =========================================================================
#endif
if(Cmdline_mod) {
// stackable Mod support -- Kazan
//This for statement is a work of art :D
@@ -496,13 +585,11 @@ void cf_build_root_list(char *cdrom_dir)
{
//strdup was not behaving reliably
//str_temp = strdup(cur_pos);
//str_temp = vm_strdup(cur_pos);
memset(str_temp, 0, 128);
strcpy(str_temp, cur_pos);
strcat(str_temp, DIR_SEPARATOR_STR);
root = cf_create_root();
@@ -532,9 +619,12 @@ void cf_build_root_list(char *cdrom_dir)
strcat(root->path, DIR_SEPARATOR_STR); // put trailing backslash on for easier path construction
}
root->roottype = CF_ROOTTYPE_PATH;
// set the default path for pilot files
if ( Pilot_file_path == NULL )
Pilot_file_path = root->path;
//======================================================
// Next, check any VP files under the current directory.
cf_build_pack_list(root);
@@ -583,11 +673,18 @@ void cf_search_root_path(int root_index)
for (i=CF_TYPE_ROOT; i<CF_MAX_PATH_TYPES; i++ ) {
// we don't want to add player files to the cache - taylor
if ( (i == CF_TYPE_SINGLE_PLAYERS) || (i == CF_TYPE_MULTI_PLAYERS) ) {
continue;
}
strcpy( search_path, root->path );
if(strlen(Pathtypes[i].path)) {
strcat( search_path, Pathtypes[i].path );
strcat( search_path, DIR_SEPARATOR_STR );
if ( search_path[strlen(search_path)-1] != DIR_SEPARATOR_CHAR ) {
strcat( search_path, DIR_SEPARATOR_STR );
}
}
#if defined _WIN32
@@ -626,37 +723,51 @@ void cf_search_root_path(int root_index)
_findclose( find_handle );
}
#elif defined unix
strcat( search_path, "*" );
glob_t globinfo;
memset(&globinfo, 0, sizeof(globinfo));
int status = glob(search_path, 0, NULL, &globinfo);
if (status == 0) {
for (unsigned int j = 0; j < globinfo.gl_pathc; j++) {
// Determine if this is a regular file
struct stat statbuf;
memset(&statbuf, 0, sizeof(statbuf));
stat(globinfo.gl_pathv[j], &statbuf);
if (S_ISREG(statbuf.st_mode)) {
char *ext = strchr(globinfo.gl_pathv[j], '.' );
#elif defined SCP_UNIX
DIR *dirp;
struct dirent *dir;
dirp = opendir (search_path);
if ( dirp ) {
while ((dir = readdir (dirp)) != NULL)
{
if (!fnmatch ("*.*", dir->d_name, 0))
{
char fn[MAX_PATH];
snprintf(fn, MAX_PATH-1, "%s%s", search_path, dir->d_name);
fn[MAX_PATH-1] = 0;
struct stat buf;
if (stat(fn, &buf) == -1) {
continue;
}
if (!S_ISREG(buf.st_mode)) {
continue;
}
char *ext = strchr( dir->d_name, '.' );
if ( ext ) {
if ( is_ext_in_list( Pathtypes[i].extensions, ext ) ) {
// Found a file!!!!
cf_file *file = cf_create_file();
strcpy( file->name_ext, globinfo.gl_pathv[j] );
strcpy( file->name_ext, dir->d_name );
file->root_index = root_index;
file->pathtype_index = i;
file->write_time = statbuf.st_mtime;
file->size = statbuf.st_size;
file->write_time = buf.st_mtime;
file->size = buf.st_size;
file->pack_offset = 0; // Mark as a non-packed file
//mprintf(( "Found file '%s'\n", file->name_ext ));
}
}
}
}
globfree(&globinfo);
closedir(dirp);
}
#endif
}
@@ -674,7 +785,7 @@ typedef struct VP_FILE {
int offset;
int size;
char filename[32];
time_t write_time;
_fs_time_t write_time;
} VP_FILE;
void cf_search_root_pack(int root_index)
@@ -695,6 +806,10 @@ void cf_search_root_pack(int root_index)
Assert( sizeof(VP_header) == 16 );
fread(&VP_header, 1, sizeof(VP_header), fp);
VP_header.version = INTEL_INT( VP_header.version );
VP_header.index_offset = INTEL_INT( VP_header.index_offset );
VP_header.num_files = INTEL_INT( VP_header.num_files );
// Read index info
fseek(fp, VP_header.index_offset, SEEK_SET);
@@ -709,6 +824,10 @@ void cf_search_root_pack(int root_index)
fread( &find, sizeof(VP_FILE), 1, fp );
find.offset = INTEL_INT( find.offset );
find.size = INTEL_INT( find.size );
find.write_time = INTEL_INT( find.write_time );
if ( find.size == 0 ) {
if ( !stricmp( find.filename, ".." )) {
int l = strlen(search_path);
@@ -718,8 +837,8 @@ void cf_search_root_pack(int root_index)
}
*p = 0;
} else {
if ( strlen(search_path) ) {
strcat( search_path, DIR_SEPARATOR_STR );
if ( strlen(search_path) && (search_path[strlen(search_path)-1] != DIR_SEPARATOR_CHAR) ) {
strcat( search_path, DIR_SEPARATOR_STR );
}
strcat( search_path, find.filename );
}
@@ -740,7 +859,7 @@ void cf_search_root_pack(int root_index)
strcpy( file->name_ext, find.filename );
file->root_index = root_index;
file->pathtype_index = j;
file->write_time = find.write_time;
file->write_time = (time_t)find.write_time;
file->size = find.size;
file->pack_offset = find.offset; // Mark as a packed file
//mprintf(( "Found pack file '%s'\n", file->name_ext ));
@@ -821,7 +940,7 @@ void cf_free_secondary_filelist()
// Free the root blocks
for (i=0; i<CF_MAX_ROOT_BLOCKS; i++ ) {
if ( Root_blocks[i] ) {
free( Root_blocks[i] );
vm_free( Root_blocks[i] );
Root_blocks[i] = NULL;
}
}
@@ -830,7 +949,7 @@ void cf_free_secondary_filelist()
// Init the file blocks
for (i=0; i<CF_MAX_FILE_BLOCKS; i++ ) {
if ( File_blocks[i] ) {
free( File_blocks[i] );
vm_free( File_blocks[i] );
File_blocks[i] = NULL;
}
}
@@ -859,18 +978,14 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
// of the file
// NOTE: full path should also include localization, if so desired
#ifdef SCP_UNIX
if ( strpbrk(filespec, "/") ) { // do we have a full path already?
#else
if ( strpbrk(filespec,"/\\:") ) { // do we have a full path already?
#endif
FILE *fp = fopen(filespec, "rb" );
if (fp) {
if ( size ) {
#if defined _WIN32
*size = filelength(fileno(fp));
#elif defined unix
struct stat statbuf;
fstat(fileno(fp), &statbuf);
*size = statbuf.st_size;
#endif
}
if ( size ) *size = filelength(fileno(fp));
if ( offset ) *offset = 0;
if ( pack_filename ) {
strcpy( pack_filename, filespec );
@@ -911,6 +1026,7 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
case CF_TYPE_MULTI_PLAYERS:
case CF_TYPE_MULTI_CACHE:
case CF_TYPE_MISSIONS:
case CF_TYPE_CACHE:
cfs_slow_search = 1;
break;
@@ -958,7 +1074,7 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
return 1;
}
}
#elif defined unix
#elif defined SCP_UNIX
FILE *fp = fopen(longname, "rb" );
if (fp) {
if ( size ) {
@@ -1004,7 +1120,9 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
strcpy( pack_filename, r->path );
if ( f->pack_offset < 1 ) {
strcat( pack_filename, Pathtypes[f->pathtype_index].path );
strcat( pack_filename, DIR_SEPARATOR_STR );
if ( pack_filename[strlen(pack_filename)-1] != DIR_SEPARATOR_CHAR ) {
strcat( pack_filename, DIR_SEPARATOR_STR );
}
strcat( pack_filename, f->name_ext );
}
}
@@ -1026,7 +1144,9 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
if(strlen(Pathtypes[f->pathtype_index].path)){
strcat( pack_filename, Pathtypes[f->pathtype_index].path );
strcat( pack_filename, DIR_SEPARATOR_STR );
if ( pack_filename[strlen(pack_filename)-1] != DIR_SEPARATOR_CHAR ) {
strcat( pack_filename, DIR_SEPARATOR_STR );
}
}
strcat( pack_filename, f->name_ext );
@@ -1046,17 +1166,35 @@ int cf_matches_spec(char *filespec, char *filename)
{
char *src_ext, *dst_ext;
src_ext = strchr(filespec, '.');
if (!src_ext)
return 1;
if (*src_ext == '*')
return 1;
src_ext = strrchr(filespec, '*');
if(!src_ext)
{
src_ext = strchr(filespec, '.');
if (!src_ext)
return 1;
}
else
{
src_ext++;
}
dst_ext = strchr(filename, '.');
if(strlen(filespec) > strlen(filename))
{
return 0;
}
dst_ext = filename + strlen(filename) - ((filespec + strlen(filespec)) - src_ext);
if (!dst_ext)
return 1;
return !stricmp(dst_ext, src_ext);
if(src_ext == filespec)
{
return !stricmp(dst_ext, src_ext);
}
else
{
return (!stricmp(dst_ext, src_ext) && !strnicmp(dst_ext, src_ext, src_ext - filespec));
}
}
int (*Get_file_list_filter)(char *filename) = NULL;
@@ -1089,7 +1227,7 @@ int cf_file_already_in_list( int num_files, char **list, char *filename )
int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort, file_list_info *info )
{
char *ptr;
int i, l, find_handle, num_files = 0, own_flag = 0;
int i, l, num_files = 0, own_flag = 0;
if (max < 1) {
Get_file_list_filter = NULL;
@@ -1100,16 +1238,18 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
Assert(list);
if (!info && (sort == CF_SORT_TIME)) {
info = (file_list_info *) malloc(sizeof(file_list_info) * max);
info = (file_list_info *) vm_malloc(sizeof(file_list_info) * max);
own_flag = 1;
}
char filespec[MAX_PATH_LEN];
#if defined _WIN32
cf_create_default_path_string( filespec, pathtype, filter );
#if defined _WIN32
_finddata_t find;
int find_handle;
find_handle = _findfirst( filespec, &find );
if (find_handle != -1) {
do {
@@ -1125,7 +1265,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
else
l = strlen(find.name);
list[num_files] = (char *)malloc(l + 1);
list[num_files] = (char *)vm_malloc(l + 1);
strncpy(list[num_files], find.name, l);
list[num_files][l] = 0;
if (info)
@@ -1140,41 +1280,53 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
_findclose( find_handle );
}
#elif defined unix
char base_filespec[MAX_PATH_LEN];
cf_create_default_path_string( base_filespec, pathtype );
int base_filespec_len = strlen(base_filespec);
glob_t globinfo;
memset(&globinfo, 0, sizeof(globinfo));
int status = glob(filespec, 0, NULL, &globinfo);
if (status == 0) {
for (unsigned int i = 0; i < globinfo.gl_pathc; i++) {
// Determine if this is a regular file
struct stat statbuf;
memset(&statbuf, 0, sizeof(statbuf));
stat(globinfo.gl_pathv[i], &statbuf);
if (S_ISREG(statbuf.st_mode)) {
if ( !Get_file_list_filter || (*Get_file_list_filter)(globinfo.gl_pathv[i]) ) {
char *found_file = globinfo.gl_pathv[i];
Assert(strncmp(found_file, base_filespec, base_filespec_len) == 0);
found_file += base_filespec_len;
ptr = strrchr(found_file, '.');
if (ptr)
l = ptr - found_file;
else
l = strlen(found_file);
list[num_files] = (char *)malloc(l + 1);
strncpy(list[num_files], found_file, l);
list[num_files][l] = 0;
if (info)
info[num_files].write_time = statbuf.st_mtime;
num_files++;
}
#elif defined SCP_UNIX
cf_create_default_path_string( filespec, pathtype, NULL );
DIR *dirp;
struct dirent *dir;
dirp = opendir (filespec);
if ( dirp ) {
while ((dir = readdir (dirp)) != NULL)
{
if (num_files >= max)
break;
if (fnmatch(filter, dir->d_name, 0) != 0)
continue;
char fn[MAX_PATH];
snprintf(fn, MAX_PATH-1, "%s/%s", filespec, dir->d_name);
fn[MAX_PATH-1] = 0;
struct stat buf;
if (stat(fn, &buf) == -1) {
continue;
}
if (!S_ISREG(buf.st_mode)) {
continue;
}
if ( !Get_file_list_filter || (*Get_file_list_filter)(dir->d_name) ) {
ptr = strrchr(dir->d_name, '.');
if (ptr)
l = ptr - dir->d_name;
else
l = strlen(dir->d_name);
list[num_files] = (char *)vm_malloc(l + 1);
strncpy(list[num_files], dir->d_name, l);
list[num_files][l] = 0;
if (info)
info[num_files].write_time = buf.st_mtime;
num_files++;
}
globfree(&globinfo);
}
closedir(dirp);
}
#endif
@@ -1189,7 +1341,6 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
}
if (num_files >= max)
break;
if ( !cf_matches_spec( filter,f->name_ext)) {
@@ -1210,7 +1361,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
else
l = strlen(f->name_ext);
list[num_files] = (char *)malloc(l + 1);
list[num_files] = (char *)vm_malloc(l + 1);
strncpy(list[num_files], f->name_ext, l);
list[num_files][l] = 0;
@@ -1230,7 +1381,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
}
if (own_flag) {
free(info);
vm_free(info);
}
Get_file_list_filter = NULL;
@@ -1281,18 +1432,20 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
}
if (!info && (sort == CF_SORT_TIME)) {
info = (file_list_info *) malloc(sizeof(file_list_info) * max);
own_flag = 1;
info = (file_list_info *) vm_malloc(sizeof(file_list_info) * max);
if ( info )
own_flag = 1;
}
char filespec[MAX_PATH_LEN];
// Search the default directories
#if defined _WIN32
cf_create_default_path_string( filespec, pathtype, filter );
mprintf(("cf_get_file_list_preallocated looking for type=%d, filter=\"%s\"\n",
pathtype, filter));
// Search the default directories
#if defined _WIN32
int find_handle;
_finddata_t find;
@@ -1325,41 +1478,51 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
_findclose( find_handle );
}
#elif defined unix
char base_filespec[MAX_PATH_LEN];
cf_create_default_path_string( base_filespec, pathtype );
int base_filespec_len = strlen(base_filespec);
glob_t globinfo;
memset(&globinfo, 0, sizeof(globinfo));
int status = glob(filespec, 0, NULL, &globinfo);
if (status == 0) {
for (unsigned int i = 0; i < globinfo.gl_pathc; i++) {
// Determine if this is a regular file
struct stat statbuf;
memset(&statbuf, 0, sizeof(statbuf));
stat(globinfo.gl_pathv[i], &statbuf);
if (S_ISREG(statbuf.st_mode)) {
if ( !Get_file_list_filter || (*Get_file_list_filter)(globinfo.gl_pathv[i]) ) {
char *found_file = globinfo.gl_pathv[i];
Assert(strncmp(found_file, base_filespec, base_filespec_len) == 0);
found_file += base_filespec_len;
#elif defined SCP_UNIX
cf_create_default_path_string( filespec, pathtype, NULL );
strncpy(arr[num_files], found_file, MAX_FILENAME_LEN - 1 );
char *ptr = strrchr(arr[num_files], '.');
if ( ptr ) {
*ptr = 0;
}
DIR *dirp;
struct dirent *dir;
if (info) {
info[num_files].write_time = statbuf.st_mtime;
}
num_files++;
dirp = opendir (filespec);
if ( dirp ) {
while ((dir = readdir (dirp)) != NULL)
{
if (num_files >= max)
break;
if (fnmatch(filter, dir->d_name, 0) != 0)
continue;
char fn[MAX_PATH];
snprintf(fn, MAX_PATH-1, "%s/%s", filespec, dir->d_name);
fn[MAX_PATH-1] = 0;
struct stat buf;
if (stat(fn, &buf) == -1) {
continue;
}
if (!S_ISREG(buf.st_mode)) {
continue;
}
if ( !Get_file_list_filter || (*Get_file_list_filter)(dir->d_name) ) {
strncpy(arr[num_files], dir->d_name, MAX_FILENAME_LEN - 1 );
char *ptr = strrchr(arr[num_files], '.');
if ( ptr ) {
*ptr = 0;
}
if (info) {
info[num_files].write_time = buf.st_mtime;
}
num_files++;
}
}
globfree(&globinfo);
closedir(dirp);
}
#endif
@@ -1411,7 +1574,7 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
}
if (own_flag) {
free(info);
vm_free(info);
}
Get_file_list_filter = NULL;
@@ -1429,7 +1592,11 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
// Output: path - Fully qualified pathname.
void cf_create_default_path_string( char *path, int pathtype, char *filename, bool localize )
{
if ( filename && strpbrk(filename,"/\\:") ) {
#ifdef SCP_UNIX
if ( filename && strpbrk(filename,"/") ) {
#else
if ( filename && strpbrk(filename,"/\\:") ) {
#endif
// Already has full path
strcpy( path, filename );
@@ -1443,14 +1610,30 @@ void cf_create_default_path_string( char *path, int pathtype, char *filename, bo
Assert(CF_TYPE_SPECIFIED(pathtype));
strcpy(path, root->path);
// force a specific directory to search for player files
if ( (pathtype == CF_TYPE_SINGLE_PLAYERS) || (pathtype == CF_TYPE_MULTI_PLAYERS) ) {
strcpy(path, Pilot_file_path);
} else {
strcpy(path, root->path);
}
strcat(path, Pathtypes[pathtype].path);
// Don't add slash for root directory
if (Pathtypes[pathtype].path[0] != '\0') {
strcat(path, DIR_SEPARATOR_STR);
if ( path[strlen(path)-1] != DIR_SEPARATOR_CHAR ) {
strcat(path, DIR_SEPARATOR_STR);
}
}
#ifdef INF_BUILD
// keep pilot files separated for an Inferno build since they aren't compatible
if ( pathtype == CF_TYPE_SINGLE_PLAYERS ) {
strcat(path, "inferno");
strcat(path, DIR_SEPARATOR_STR);
}
#endif
// add filename
if (filename) {
strcat(path, filename);
@@ -1475,4 +1658,3 @@ void cf_create_default_path_string( char *path, int pathtype, char *filename, bo
}
}
}
+9 -2
View File
@@ -9,8 +9,8 @@
/*
* $Logfile: /Freespace2/code/CFile/CfileSystem.h $
* $Revision: 2.1 $
* $Date: 2004-03-05 09:01:54 $
* $Revision: 2.3 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
* Functions to keep track of and find files that can exist
@@ -20,6 +20,13 @@
* all those locations, inherently enforcing precedence orders.
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2004/08/11 05:06:19 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.1 2004/03/05 09:01:54 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
+155 -14
View File
@@ -9,13 +9,20 @@
/*
* $Logfile: /Freespace2/code/Cfilearchiver/CfileArchiver.cpp $
* $Revision: 2.1 $
* $Date: 2003-11-16 09:42:37 $
* $Author: Goober5000 $
* $Revision: 2.3 $
* $Date: 2005-09-08 00:09:31 $
* $Author: taylor $
*
* Program to create an archive file for use with cfile stuff
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2005/01/30 12:50:08 taylor
* merge with Linux/OSX tree - p0130
*
* Revision 2.1 2003/11/16 09:42:37 Goober5000
* clarified and pruned debug spew messages
* --Goober5000
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
@@ -30,15 +37,28 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#include <direct.h>
#include <io.h>
#include <string.h>
#include <conio.h>
#else
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#endif
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
static int data_error;
static int no_dir;
unsigned int Total_size=16; // Start with size of header
unsigned int Num_files =0;
FILE * fp_out = NULL;
FILE * fp_out_hdr = NULL;
FILE *fp_out = NULL;
FILE *fp_out_hdr = NULL;
typedef struct vp_header {
char id[4];
@@ -82,7 +102,7 @@ int write_index(char *hf, char *df)
return 1;
}
void pack_file( char *filespec, char *filename, int filesize, time_t time_write )
void pack_file( char *filespec, char *filename, int filesize, _fs_time_t time_write )
{
char path[1024];
@@ -110,13 +130,15 @@ void pack_file( char *filespec, char *filename, int filesize, time_t time_write
fwrite( &Total_size, 1, 4, fp_out_hdr );
fwrite( &filesize, 1, 4, fp_out_hdr );
fwrite( &path, 1, 32, fp_out_hdr );
fwrite( &time_write, 1, sizeof(time_t), fp_out_hdr);
fwrite( &time_write, 1, sizeof(_fs_time_t), fp_out_hdr);
Total_size += filesize;
Num_files++;
printf( "Packing %s\\%s...", filespec, filename );
sprintf( path, "%s\\%s", filespec, filename );
printf( "Packing %s%s%s...", filespec, DIR_SEPARATOR_STR, filename );
sprintf( path, "%s%s%s", filespec, DIR_SEPARATOR_STR, filename );
FILE *fp = fopen( path, "rb" );
@@ -153,7 +175,7 @@ void add_directory( char * dirname)
int i = 0;
fwrite(&i, 1, 4, fp_out_hdr);
// strip out any directories that this dir is a subdir of
while ((tmpptr = strchr(pathptr, '\\')) != NULL) {
while ((tmpptr = strchr(pathptr, DIR_SEPARATOR_CHAR)) != NULL) {
pathptr = tmpptr+1;
}
fwrite(pathptr, 1, 32, fp_out_hdr);
@@ -163,8 +185,10 @@ void add_directory( char * dirname)
void pack_directory( char * filespec)
{
#ifdef _WIN32
int find_handle;
_finddata_t find;
#endif
char tmp[512];
char tmp1[512];
@@ -184,12 +208,21 @@ void pack_directory( char * filespec)
}
*/
char *ts;
// strip trailing slash
ts = filespec+(strlen(filespec)-1);
while(*ts == DIR_SEPARATOR_CHAR && ts > filespec)
*ts = '\0';
strcpy( tmp1, filespec );
add_directory(filespec);
strcat( tmp1, "\\*.*" );
strcat( tmp1, DIR_SEPARATOR_STR"*.*" );
printf( "In dir '%s'\n", tmp1 );
#ifdef _WIN32
find_handle = _findfirst( tmp1, &find );
if( find_handle != -1 ) {
if ( find.attrib & _A_SUBDIR ) {
@@ -217,10 +250,95 @@ void pack_directory( char * filespec)
}
}
}
#else
DIR *dirp;
struct dirent *dir;
dirp = opendir (filespec);
if ( dirp ) {
while ((dir = readdir(dirp)) != NULL) {
char fn[MAX_PATH];
snprintf(fn, MAX_PATH-1, "%s/%s", filespec, dir->d_name);
fn[MAX_PATH-1] = 0;
struct stat buf;
if (stat(fn, &buf) == -1) {
continue;
}
if ( (strcmp(dir->d_name, ".") == 0) || (strcmp(dir->d_name, "..") == 0) ) {
continue;
}
if (S_ISDIR(buf.st_mode)) {
strcpy( tmp, filespec );
strcat( tmp, "/" );
strcat( tmp, dir->d_name );
pack_directory(tmp);
} else {
pack_file( filespec, dir->d_name, buf.st_size, buf.st_mtime );
}
}
closedir(dirp);
} else {
printf("Error: Source directory does not exist!\n");
no_dir = 1;
}
#endif
add_directory("..");
}
int verify_directory( char *filespec )
{
char *ts;
char *dd;
// strip trailing '/'
ts = filespec+(strlen(filespec)-1);
while(*ts == DIR_SEPARATOR_CHAR && ts > filespec)
*ts = '\0';
// make sure last directory is named "data", ignoring case
dd = filespec+(strlen(filespec)-4);
if ( stricmp( dd, "data" ) )
data_error = 1;
return data_error;
}
void print_instructions()
{
printf( "Creates a vp archive out of a FreeSpace data tree.\n\n" );
printf( "Usage: cfilearchiver archive_name src_dir\n");
printf( "Example: cfilearchiver freespace /tmp/freespace/data\n\n");
printf( "Directory structure options:\n" );
printf( " Effects (.ani .pcx .neb .tga)\n" );
printf( " Fonts (.vf)\n" );
printf( " Hud (.ani .pcx .tga\n" );
printf( " Interface (.pcx .ani .tga)\n" );
printf( " Maps (.pcx .ani .tga)\n" );
printf( " Missions (.ntl .ssv), FS1(.fsm .fsc), FS2(.fs2 .fc2)\n" );
printf( " Models (.pof)\n" );
printf( " Music (.wav)\n" );
printf( " Sounds/8b22k (.wav)\n" );
printf( " Sounds/16b11k (.wav)\n" );
printf( " Tables (.tbl)\n" );
printf( " Voice/Briefing (.wav)\n" );
printf( " Voice/Command briefings (.wav)\n" );
printf( " Voice/Debriefing (.wav)\n" );
printf( " Voice/Personas (.wav)\n" );
printf( " Voice/Special (.wav)\n" );
printf( " Voice/Training (.wav)\n" );
exit(0);
}
// we end up #include'ing SDL.h which on Windows and Mac will redfine main() which is something
// that we don't want since we don't actually link against SDL, this solves the problem...
#ifdef main
#undef main
#endif
int main(int argc, char *argv[] )
{
@@ -228,12 +346,16 @@ int main(int argc, char *argv[] )
char *p;
if ( argc < 3 ) {
#ifdef _WIN32
printf( "Usage: %s archive_name src_dir\n", argv[0] );
printf( "Example: %s freespace c:\\freespace\\data\n", argv[0] );
printf( "Creates an archive named freespace out of the\nfreespace data tree\n" );
printf( "Press any key to exit...\n" );
getch();
return 1;
#else
print_instructions();
#endif
}
strcpy( archive, argv[1] );
@@ -248,24 +370,41 @@ int main(int argc, char *argv[] )
fp_out = fopen( archive_dat, "wb" );
if ( !fp_out ) {
printf( "out1: Couldn't open '%s'!\n", archive_dat );
printf( "Couldn't open '%s'!\n", archive_dat );
#ifdef _WIN32
printf( "Press any key to exit...\n" );
getch();
return 1;
#else
exit(1);
#endif
}
fp_out_hdr = fopen( archive_hdr, "wb" );
if ( !fp_out_hdr ) {
printf( "out2: Couldn't open '%s'!\n", archive_hdr );
printf( "Couldn't open '%s'!\n", archive_hdr );
#ifdef _WIN32
printf( "Press any key to exit...\n" );
getch();
return 1;
#else
exit(2);
#endif
}
if ( verify_directory( argv[2] ) != 0 ) {
printf("Warning! Last directory must be named \"data\" (not case sensitive)\n");
exit(3);
}
write_header();
pack_directory( argv[2] );
// in case the directory doesn't exist
if ( no_dir )
exit(4);
write_header();
fclose(fp_out);
@@ -275,8 +414,10 @@ int main(int argc, char *argv[] )
if (!write_index(archive_hdr, archive_dat)) {
printf("Error appending index!\n");
#ifdef _WIN32
printf("Press any key to exit...\n");
getch();
#endif
return 1;
}
@@ -0,0 +1,476 @@
/*
* Copyright (C) 2005 Taylor Richards
*
*/
/*
* $Logfile: /Freespace2/code/cfileextractor/cfileextractor.cpp $
* $Revision: 1.6 $
* $Date: 2005-09-08 05:04:15 $
* $Author: taylor $
*
* Cross-platform cmdline extractor for VP files
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/09/08 00:09:31 taylor
* fix building/linking of command line tools under Linux/OSX
* add tools as targets to OSX project file
*
* Revision 1.4 2005/05/24 20:52:10 taylor
* make sure that we recursively create directories for Linux/OSX
* replace older recursive mkdir method in cfileextractor with new method
*
* Revision 1.3 2005/05/24 03:12:27 taylor
* get command sanity check right, fixes lowercase on extract too
*
* Revision 1.2 2005/05/18 01:57:54 taylor
* a few help text adjustments and fix some compiler warnings
*
* Revision 1.1 2005/05/17 21:00:57 taylor
* Initial import of cfileextractor, still needs some work but does what it needs to
*
*
* $NoKeywords: $
*/
#include <vector>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <ctime>
#ifdef _WIN32
#include <direct.h>
#else
#include <unistd.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
// /////////////////////////////////////////////////////////////////////////////
//
// GLOBAL FUNCTIONS AND VARIABLES
//
// right out of pstypes.h but we don't want to use the INTEL_INT macro here
// since it would require SDL which isn't used on WIN32 platforms
#if BYTE_ORDER == BIG_ENDIAN
#define INT_SWAP(x) ( \
(x << 24) | \
(((ulong)x) >> 24) | \
((x & 0x0000ff00) << 8) | \
((x & 0x00ff0000) >> 8) \
)
#else
#define INT_SWAP(x) (x)
#endif
FILE *fp_in = NULL;
FILE *fp_out = NULL;
#define BLOCK_SIZE (1024*1024)
char tmp_data[BLOCK_SIZE]; // 1 MB
static int have_index = 0;
static int have_header = 0;
#define ERR_NO_FP_IN 0
#define ERR_NO_FP_OUT 1
#define ERR_INVALID_VP 2
#define ERR_NO_INDEX 3
#define ERR_NO_HEADER 4
typedef struct vp_header {
char id[4]; // 'VPVP'
int version;
int index_offset; // offset where the file index starts, also a total file data size count
int num_files; // number of files, including each step in the directory structure
} vp_header;
vp_header VP_Header;
typedef struct vp_fileinfo {
// stuff that is actually written to the VP
int offset; // offset of where this file is in the VP
int file_size; // size of file
char file_name[CF_MAX_FILENAME_LENGTH]; // filename
_fs_time_t write_time; // date/time in _fs_time_t type (a 32-bit version of time_t)
// not in the VP
char file_path[CF_MAX_PATHNAME_LENGTH]; // file path, generated here and not actually in the VP on a per file basis
vp_fileinfo() {
offset = 0;
file_size = 0;
file_name[0] = '\0';
file_path[0] = '\0';
write_time = 0;
}
~vp_fileinfo() {}
} vp_fileinfo;
std::vector<vp_fileinfo> VP_FileInfo;
// just like strlwr() but without actually including it here
void lowercase(char *s)
{
if (s == NULL)
return;
while (*s) {
*s = tolower(*s);
s++;
}
}
//
// /////////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////
//
// The useful stuff...
//
void print_error(int err)
{
switch (err) {
case ERR_NO_FP_IN:
printf("ERROR: The input file (fp_in) is NULL! Exiting...\n");
break;
case ERR_NO_FP_OUT:
printf("ERROR: The output file (fp_out) is NULL! Exiting...\n");
break;
case ERR_INVALID_VP:
printf("ERROR: The specified VP file is invalid! Exiting...\n");
break;
case ERR_NO_INDEX:
printf("ERROR: No file index is available! Exiting...\n");
break;
case ERR_NO_HEADER:
printf("ERROR: No file header is available! Exiting...\n");
break;
default:
break;
}
exit(1);
}
void read_header()
{
fseek(fp_in, 0, SEEK_SET);
fread(&VP_Header.id, 1, 4, fp_in);
fread(&VP_Header.version, 1, sizeof(int), fp_in);
fread(&VP_Header.index_offset, 1, sizeof(int), fp_in);
fread(&VP_Header.num_files, 1, sizeof(int), fp_in);
VP_Header.version = INT_SWAP(VP_Header.version);
VP_Header.index_offset = INT_SWAP(VP_Header.index_offset);
VP_Header.num_files = INT_SWAP(VP_Header.num_files);
// check for a valid id (VPVP)
if ( (VP_Header.id[0] != 'V') && (VP_Header.id[1] != 'P') && (VP_Header.id[2] != 'V') && (VP_Header.id[3] != 'P') )
print_error(ERR_INVALID_VP);
// the index_offset needs to be greater than the size of vp_header at the very least and there should be at least one file
if ( !(VP_Header.index_offset > (int)sizeof(vp_header)) || !(VP_Header.num_files > 1) )
print_error(ERR_INVALID_VP);
have_header = 1;
}
void read_index(int lc = 0)
{
if (fp_in == NULL)
print_error(ERR_NO_FP_IN);
else if (!have_header)
print_error(ERR_NO_HEADER);
int i;
char path[CF_MAX_PATHNAME_LENGTH];
fseek(fp_in, VP_Header.index_offset, SEEK_SET);
memset(path, 0, CF_MAX_PATHNAME_LENGTH);
for ( i = 0; i < VP_Header.num_files; i++) {
vp_fileinfo vpinfo;
fread(&vpinfo.offset, 1, sizeof(int), fp_in);
fread(&vpinfo.file_size, 1, sizeof(int), fp_in);
fread(&vpinfo.file_name, 1, CF_MAX_FILENAME_LENGTH, fp_in);
fread(&vpinfo.write_time, 1, sizeof(_fs_time_t), fp_in);
vpinfo.offset = INT_SWAP(vpinfo.offset);
vpinfo.file_size = INT_SWAP(vpinfo.file_size);
vpinfo.write_time = INT_SWAP(vpinfo.write_time);
// check if it's a directory and if so then create a path to use for files
if (vpinfo.file_size == 0) {
// if we get a ".." then drop down in the path
if (!strcmp(vpinfo.file_name, "..")) {
char *s = strrchr(path, DIR_SEPARATOR_CHAR);
if (s)
*s = '\0';
// skip, we don't want to add the ".." to the path
continue;
}
// don't add the very first directory separator character, easier to clean later
if (path[0] != 0)
strcat( path, DIR_SEPARATOR_STR );
// always make directory names lower case for ease of use
lowercase( vpinfo.file_name );
strcat( path, vpinfo.file_name );
} // it's a file then
else {
// lowercase the filename if wanted
if (lc == 1)
lowercase( vpinfo.file_name );
strcpy( vpinfo.file_path, path );
VP_FileInfo.push_back(vpinfo);
}
}
have_index = 1;
}
void extract_all_files(char *file)
{
if (fp_in == NULL)
print_error(ERR_NO_FP_IN);
else if (!have_header)
print_error(ERR_NO_HEADER);
else if (!have_index)
print_error(ERR_NO_INDEX);
int status, m_error, nbytes, nbytes_remaining;
char path[CF_MAX_PATHNAME_LENGTH+CF_MAX_FILENAME_LENGTH+1]; // path length + filename length + extra NULL
char *c;
printf("VP file extractor - version 0.01\n");
printf("\n");
printf("Extracting: %s...\n", file);
for (uint i = 0; i < VP_FileInfo.size(); i++) {
// save the file path to a temp location and recursively make the needed directories
sprintf(path, "%s%s", VP_FileInfo[i].file_path, DIR_SEPARATOR_STR);
c = &path[0];
while (c++) {
c = strchr(c, DIR_SEPARATOR_CHAR);
if (c) {
*c = '\0'; // NULL at DIR_SEP char
#ifdef _WIN32
status = _mkdir(path);
#else
status = mkdir(path, 0777);
#endif
m_error = errno;
if (status && (m_error != EEXIST) ) {
printf("Cannot mkdir %s: %s\n", VP_FileInfo[i].file_path, strerror(m_error));
continue;
}
*c = DIR_SEPARATOR_CHAR; // replace DIR_SEP char
}
}
// start writing out the file
fseek(fp_in, VP_FileInfo[i].offset, SEEK_SET);
sprintf(path, "%s%s%s", VP_FileInfo[i].file_path, DIR_SEPARATOR_STR, VP_FileInfo[i].file_name);
fp_out = fopen(path, "wb");
printf(" %s ... ", path);
if (fp_out == NULL) {
printf("can't create file!\n");
continue;
}
nbytes_remaining = VP_FileInfo[i].file_size;
while ( nbytes_remaining > 0 ) {
nbytes = fread( tmp_data, 1, MIN(BLOCK_SIZE, nbytes_remaining), fp_in );
if (nbytes > 0) {
fwrite( tmp_data, 1, nbytes, fp_out );
nbytes_remaining -= nbytes;
}
}
printf("done!\n");
fclose(fp_out);
fp_out = NULL;
}
printf("\n");
}
// TODO: the formatting of this is a bit loco but I don't care enough to make it better...
void list_all_files(char *file)
{
char out_time[20];
float one_k = 1024.0f;
float one_m = 1048576.0f;
char m;
float div_by;
time_t plat_time;
// if we don't have an index then bail
if (!have_index)
print_error(ERR_NO_INDEX);
printf("VP file extractor - version 0.01\n");
printf("\n");
printf("%s:\n", file);
printf("\n");
printf(" Name Size Offset Date/Time Path\n");
printf("-------------------------------------------------------------------------------\n");
for (uint i = 0; i < VP_FileInfo.size(); i++) {
plat_time = VP_FileInfo[i].write_time; // gets rid of some platform strangeness this way
strftime(out_time, 32, "%F %H:%M", localtime(&plat_time)); // YYYY-mm-dd HH:mm (ISO 8601 date format, 24-hr time)
if (VP_FileInfo[i].file_size > (int)one_m) {
m = 'M';
div_by = one_m;
} else {
m = 'K';
div_by = one_k;
}
int len = strlen( VP_FileInfo[i].file_name );
printf("%s %*.1f%c %10i %18s %3s%s\n", VP_FileInfo[i].file_name, 33 - len, (float)VP_FileInfo[i].file_size/div_by, m, VP_FileInfo[i].offset, out_time, DIR_SEPARATOR_STR, VP_FileInfo[i].file_path);
}
printf("\n");
// we use the vector size here since VP_Header.num_files would include each entry
// in the directory tree as well as individual files and that artificially inflates
// the number of files that we show or would extract
printf("Total files: %i\n", (int)VP_FileInfo.size());
// yeah, I'm just that cheap
if (VP_Header.index_offset > (int)one_m) {
m = 'M';
div_by = one_m;
} else {
m = 'K';
div_by = one_k;
}
printf("Total size: %.1f%c\n", (float)VP_Header.index_offset/div_by, m);
printf("\n");
}
void help()
{
printf("VP file extractor - version 0.5\n");
printf("\n");
printf("Usage: cfileextractor [-x | -l] [-L] <vp_filename>\n");
printf("\n");
printf(" Commands (only one at the time):\n");
printf(" -x | --extract Extract all files into current directory.\n");
printf(" -l | --list List all files in VP archive.\n");
printf(" -h | --help Show this help text.\n");
printf("\n");
printf(" Options:\n");
printf(" -L | --lowercase Force all filenames to be lower case.\n");
printf("\n");
printf(" (No command specified will list all files in the VP archive.)\n");
printf("\n");
}
// we end up #include'ing SDL.h which on Windows and Mac will redfine main() which is something
// that we don't want since we don't actually link against SDL, this solves the problem...
#ifdef main
#undef main
#endif
int main(int argc, char *argv[])
{
int extract = 0, lc = 0, list = 0;
if (argc < 2) {
help();
return 0;
}
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
help();
return 0;
}
// the last option should always be the VP file that we want
fp_in = fopen(argv[argc-1], "rb");
if (fp_in == NULL)
print_error(ERR_NO_FP_IN);
// if the header is invalid then read_header() should exit us out
read_header();
// TODO: add filter based extraction
for (int i = 1; i < argc-1; i++) {
if (!strcmp(argv[i], "-x") || !strcmp(argv[i], "--extract")) {
if (list) {
help();
exit(0);
}
extract = 1;
} else if (!strcmp(argv[i], "-L") || !strcmp(argv[i], "--lowercase")) {
lc = 1;
} else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--list")) {
if (extract) {
help();
exit(0);
}
list = 1;
} else {
help();
return 0;
}
}
// read the file index, make all filenames lowercase if wanted
read_index( lc );
if (extract) {
extract_all_files( argv[argc-1] );
return 0;
} else if (list) {
list_all_files( argv[argc-1] );
return 0;
} else {
// if only -L is specified or no command is specified then just list files
list_all_files( argv[argc-1] );
return 0;
}
return 0;
}
File diff suppressed because it is too large. Load diff
+103 -6
View File
@@ -11,11 +11,83 @@
/*
* $Logfile: /Freespace2/code/Cmdline/cmdline.h $
* $Revision: 2.54 $
* $Date: 2004-04-26 18:23:47 $
* $Author: Kazan $
* $Revision: 2.73 $
* $Date: 2005-07-25 05:24:16 $
* $Author: Goober5000 $
*
* $Log: not supported by cvs2svn $
* Revision 2.72 2005/07/13 02:50:49 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 2.71 2005/07/07 16:32:33 taylor
* compiler warning fixes
* add -noibx troubleshooting cmdline option to disable use of IBX files
* don't try to set thuster object number is only one thruster bank is specified (default method should go into affect)
*
* Revision 2.70 2005/06/29 18:46:13 taylor
* add option to not scale up movies to fit window/screen, default is to scale
* (arguably not a bug but I said I would get it in before 3.6.5 and forgot)
*
* Revision 2.69 2005/03/13 23:07:35 taylor
* enable 32-bit to 16-bit TGA conversion with -tga16 cmdline option (experimental)
* fix crash when upgrading from original campaign stats file to current
*
* Revision 2.68 2005/02/16 10:00:13 wmcoolmon
* "-ingame" command line option
*
* Revision 2.67 2005/01/30 12:50:08 taylor
* merge with Linux/OSX tree - p0130
*
* Revision 2.66 2005/01/29 16:30:46 phreak
* smart shield command line stuff. this will be changed in the future, but i want people to test it.
* -phreak
*
* Revision 2.65 2005/01/21 08:29:04 taylor
* add -rlm cmdline option to switch to local viewpoint lighting calculations (OGL only for now)
*
* Revision 2.64 2004/12/24 19:36:12 Goober5000
* resorted command-line options and added an option for WMC's ballistic gauge
* --Goober5000
*
* Revision 2.63 2004/11/23 19:29:13 taylor
* fix 2d warp in D3D, add cmdline option for 3d warp
*
* Revision 2.62 2004/09/10 13:51:20 et1
* Command line option for TBP for warp stuff, "-tbpwarpeffects"
*
* Revision 2.61 2004/08/11 05:06:19 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.60 2004/08/02 22:40:59 phreak
* added -orbradar to enable orb rendering for the radar
*
* Revision 2.59 2004/08/01 02:31:18 phreak
* -phreak command line changed to -dualscanlines
*
* Revision 2.58 2004/07/25 18:46:28 Kazan
* -fred_no_warn has become -no_warn and applies to both fred and fs2
* added new ai directive (last commit) and disabled afterburners while performing AIM_WAYPOINTS or AIM_FLY_TO_SHIP
* fixed player ship speed bug w/ player-use-ai, now stays in formation correctly and manages speed
* made -radar_reduce ignore itself if no parameter is given (ignoring launcher bug)
*
* Revision 2.57 2004/07/05 05:09:15 bobboau
* FVF code, only the data that is needed is sent off to the card,,
* OGL can take advantage of this if they want but it won't break
* anything if they don't. also state block code has been implemented,
* that's totaly internal to D3D no high level code is involved.
*
* Revision 2.56 2004/06/19 22:15:48 wmcoolmon
* Added -nomotion debris command line option; also re-ordered categories.
*
* Revision 2.55 2004/06/06 12:25:19 randomtiger
* Added new compression option -pcx32dds, build posted in RSB forum.
* Changed flag because of launcher bug, have fixed launcher bug, will distribute later.
* Also removed experimental flag from launcher flag list, stupid people were reporting bugs on unfinished code.
*
* Revision 2.54 2004/04/26 18:23:47 Kazan
* -no_fps_capping
*
* Revision 2.53 2004/04/26 00:23:26 taylor
* novbo and snd_preload cmdline options, fix moddir getting appended space
*
@@ -408,7 +480,6 @@
*
* $NoKeywords: $
*/
#ifndef FS_CMDLINE_HEADER_FILE
#define FS_CMDLINE_HEADER_FILE
@@ -454,13 +525,16 @@ extern int Cmdline_window;
extern char *Cmdline_almission; //DTP for autoload mission
extern int Cmdline_gf4fix; //DTP for Random tigers GF4fix.
extern int Cmdline_allslev;
extern int Cmdline_phreak;
extern int Cmdline_dualscanlines;
extern int Cmdline_dnoshowvid; //WMC Toggles movie playing support
extern int Cmdline_noscalevid; // disables fit-to-window for movies - taylor
extern char *Cmdline_mod; //DTP for mod support
extern int Cmdline_show_fps;//DTP moved here because it is the correct place for it to be.
extern int Cmdline_show_stats;
extern int Cmdline_safeloading;
extern int Cmdline_nospec;
extern int Cmdline_orb_radar;
extern int Cmdline_TBPWarpEffects; // TBP warp effects -Et1
extern int Cmdline_cache_ani;
extern int Cmdline_d3dmipmap;
@@ -480,6 +554,14 @@ extern int Cmdline_jpgtga;
extern int Cmdline_no_set_gamma;
extern int Cmdline_d3d_no_vsync;
extern int Cmdline_pcx32;
extern int Cmdline_pcx32dds;
extern int Cmdline_nomotiondebris;
extern int Cmdline_rlm;
extern int Cmdline_noibx;
#ifdef SCP_UNIX
extern int Cmdline_no_grab;
#endif
extern int Cmdline_noglow;
extern int Cmdline_timerbar;
@@ -490,19 +572,34 @@ extern int Cmdline_d3d_particle;
extern int Cmdline_ambient_factor;
extern int Cmdline_show_mem_usage;
extern int Cmdline_rt;
extern int Cmdline_ingamejoin;
extern char *Cmdline_start_mission;
extern int Cmdline_d3d_lesstmem;
extern int Cmdline_batch_3dunlit;
extern int Cmdline_2d_poof;
extern int Cmdline_3dwarp;
extern int Cmdline_FRED2_htl;
extern int CmdLine_FRED2_NoWarn;
extern int CmdLine_NoWarn;
extern int Cmdline_novbo;
extern int Cmdline_snd_preload;
extern int Cmdline_NoFPSCap;
extern float Cmdline_max_subdivide;
extern int Cmdline_alpha_env;
extern int Cmdline_env;
extern int Cmdline_decals;
extern int Cmdline_ballistic_gauge;
extern int Cmdline_smart_shields;
extern int Cmdline_tga16;
extern int Cmdline_wcsaga;
//extern char FreeSpace_Directory[]; // allievating a cfilesystem problem caused by fred -- Kazan
#endif
+17 -5
View File
@@ -9,13 +9,23 @@
/*
* $Logfile: /Freespace2/code/CMeasure/CMeasure.cpp $
* $Revision: 2.3 $
* $Date: 2004-03-05 09:01:57 $
* $Author: Goober5000 $
* $Revision: 2.6 $
* $Date: 2005-04-05 05:53:15 $
* $Author: taylor $
*
* Counter measures. Created by Mike Kulas, May 12, 1997.
*
* $Log: not supported by cvs2svn $
* Revision 2.5 2004/07/26 20:47:25 Kazan
* remove MCD complete
*
* Revision 2.4 2004/07/12 16:32:43 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.3 2004/03/05 09:01:57 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.2 2003/03/18 10:07:00 unknownplayer
* The big DX/main line merge. This has been uploaded to the main CVS since I can't manage to get it to upload to the DX branch. Apologies to all who may be affected adversely, but I'll work to debug it as fast as I can.
*
@@ -228,6 +238,8 @@
#include "math/staticrand.h"
#include "object/object.h"
cmeasure_info Cmeasure_info[MAX_CMEASURE_TYPES];
cmeasure Cmeasures[MAX_CMEASURES];
@@ -360,7 +372,7 @@ float Skill_level_cmeasure_life_scale[NUM_SKILL_LEVELS] = {3.0f, 2.0f, 1.5f, 1.2
// creates one countermeasure. A ship fires 1 of these per launch. rand_val is used
// in multiplayer. If -1, then create a random number. If non-negative, use this
// number for static_rand functions
int cmeasure_create( object * source_obj, vector * pos, int cm_type, int rand_val )
int cmeasure_create( object * source_obj, vec3d * pos, int cm_type, int rand_val )
{
int n, objnum, parent_objnum, arand;
object * obj;
@@ -430,7 +442,7 @@ int cmeasure_create( object * source_obj, vector * pos, int cm_type, int rand_va
Num_cmeasures++;
vector vel, rand_vec;
vec3d vel, rand_vec;
vm_vec_scale_add(&vel, &source_obj->phys_info.vel, &source_obj->orient.vec.fvec, -25.0f);
+14 -4
View File
@@ -9,13 +9,23 @@
/*
* $Logfile: /Freespace2/code/CMeasure/CMeasure.h $
* $Revision: 2.2 $
* $Date: 2004-03-05 09:01:57 $
* $Revision: 2.5 $
* $Date: 2005-07-13 02:50:50 $
* $Author: Goober5000 $
*
* Counter measures. Created by Mike Kulas, May 12, 1997.
*
* $Log: not supported by cvs2svn $
* Revision 2.4 2005/04/05 05:53:15 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.3 2004/08/11 05:06:19 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.2 2004/03/05 09:01:57 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.1 2002/08/01 01:41:04 penguin
* The big include file move
*
@@ -121,7 +131,7 @@
#include "globalincs/globals.h"
struct object;
struct vector;
struct vec3d;
#define MAX_CMEASURES 64
@@ -172,7 +182,7 @@ extern void cmeasure_render( object * obj );
extern void cmeasure_delete( object * obj );
extern void cmeasure_process_pre( object * obj, float frame_time);
extern void cmeasure_process_post( object * obj, float frame_time);
extern int cmeasure_create( object * source_obj, vector *pos, int cm_type, int rand_val = -1 );
extern int cmeasure_create( object * source_obj, vec3d *pos, int cm_type, int rand_val = -1 );
extern void cmeasure_select_next(object *objp);
#endif // _CMEASURE_H
+101 -45
View File
@@ -9,13 +9,54 @@
/*
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfig.cpp $
* $Revision: 2.5 $
* $Date: 2004-03-05 09:01:58 $
* $Revision: 2.17 $
* $Date: 2005-07-22 10:18:37 $
* $Author: Goober5000 $
*
* C module for keyboard, joystick and mouse configuration
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2005/07/13 02:50:50 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 2.15 2005/07/07 16:36:57 taylor
* various compiler warning fixes (some of these from dizzy)
*
* Revision 2.14 2005/07/02 19:42:14 taylor
* ton of non-standard resolution fixes
*
* Revision 2.13 2005/05/12 17:49:11 taylor
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
* fixes various problems and is past time to make the switch
*
* Revision 2.12 2005/04/28 05:29:28 wmcoolmon
* Removed FS2_DEMO defines that looked like they wouldn't cause the universe to collapse
*
* Revision 2.11 2005/04/17 05:38:28 taylor
* updated Linux joystick code that's a bit less insane speed wise
* remove ability to build without joystick support, no reason to keep it around
* fix unusable warning flag with libjpeg building
*
* Revision 2.10 2005/03/02 21:24:43 taylor
* more network/inferno goodness for Windows, takes care of a few warnings too
*
* Revision 2.9 2004/07/29 19:37:50 Kazan
* unbug the JS bug i caused --- kazan
*
* Revision 2.8 2004/07/26 20:47:26 Kazan
* remove MCD complete
*
* Revision 2.7 2004/07/25 00:31:28 Kazan
* i have absolutely nothing to say about that subject
*
* Revision 2.6 2004/07/12 16:32:43 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.5 2004/03/05 09:01:58 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.4 2003/11/11 02:15:43 Goober5000
* ubercommit - basically spelling and language fixes with some additional
* warnings disabled
@@ -324,6 +365,7 @@
*
*/
#include "freespace2/freespace.h"
#include "controlconfig/controlsconfig.h"
#include "gamesequence/gamesequence.h"
@@ -350,6 +392,8 @@
#include "hud/hud.h"
#endif
#define NUM_SYSTEM_KEYS 14
#define NUM_BUTTONS 19
#define NUM_TABS 4
@@ -718,6 +762,8 @@ int control_config_detect_axis()
int control_config_valid_action(int n)
{
//WMC - Invalid_demo_keys is never even filled!!
/*
#ifdef FS2_DEMO
int i;
@@ -725,7 +771,7 @@ int control_config_valid_action(int n)
if (n == Invalid_demo_keys[i])
return 0;
#endif
*/
return 1;
}
@@ -831,7 +877,13 @@ void control_config_list_prepare()
if ((Control_config[z].tab == Tab) && control_config_valid_action(z)) {
k = Control_config[z].key_id;
j = Control_config[z].joy_id;
Cc_lines[Num_cc_lines].label = XSTR(Control_config[z].text, CONTROL_CONFIG_XSTR + z);
if (Control_config[z].hasXSTR)
Cc_lines[Num_cc_lines].label = XSTR(Control_config[z].text, CONTROL_CONFIG_XSTR + z);
else
Cc_lines[Num_cc_lines].label = Control_config[z].text;
Cc_lines[Num_cc_lines].cc_index = z;
Cc_lines[Num_cc_lines++].y = y;
y += font_height + 2;
@@ -871,16 +923,16 @@ config_item_undo *get_undo_block(int size)
{
config_item_undo *ptr;
ptr = (config_item_undo *) malloc( sizeof(config_item_undo) );
ptr = (config_item_undo *) vm_malloc( sizeof(config_item_undo) );
Assert(ptr);
ptr->next = Config_item_undo;
Config_item_undo = ptr;
ptr->size = size;
if (size) {
ptr->index = (int *) malloc( sizeof(int) * size );
ptr->index = (int *) vm_malloc( sizeof(int) * size );
Assert(ptr->index);
ptr->list = (config_item *) malloc( sizeof(config_item) * size );
ptr->list = (config_item *) vm_malloc( sizeof(config_item) * size );
Assert(ptr->list);
} else {
@@ -902,11 +954,11 @@ void free_undo_block()
Config_item_undo = ptr->next;
if (ptr->size) {
free(ptr->list);
free(ptr->index);
vm_free(ptr->list);
vm_free(ptr->index);
}
free(ptr);
vm_free(ptr);
}
// undo the most recent binding changes
@@ -965,8 +1017,9 @@ void control_config_save_axis_undo(int axis)
config_item_undo *ptr;
config_item item;
memset( &item, 0, sizeof(config_item) );
item.joy_id = (short) Axis_map_to[axis];
item.used = 0;
item.used = Invert_axis[axis];
ptr = get_undo_block(1);
@@ -1082,6 +1135,8 @@ int control_config_clear_other()
ptr = get_undo_block(total);
for (i=j=0; i<NUM_JOY_AXIS_ACTIONS; i++)
if ((Axis_map_to[i] == Axis_map_to[z]) && (i != z)) {
memset( &item, 0, sizeof(config_item) );
item.joy_id = (short) Axis_map_to[i];
item.used = Invert_axis[i];
@@ -1170,15 +1225,12 @@ int control_config_clear_all()
return 0;
}
#ifndef NO_JOYSTICK
extern Joy_info joystick;
#endif
int control_config_axis_default(int axis)
{
Assert(axis >= 0);
#ifndef NO_JOYSTICK
if ( axis > 1 ) {
if (Axis_map_to_defaults[axis] < 0)
return -1;
@@ -1188,9 +1240,6 @@ int control_config_axis_default(int axis)
}
return Axis_map_to_defaults[axis];
#else
return -1;
#endif
}
int control_config_do_reset()
@@ -1225,6 +1274,8 @@ int control_config_do_reset()
for (i=0; i<NUM_JOY_AXIS_ACTIONS; i++)
if ((Axis_map_to[i] != control_config_axis_default(i)) || (Invert_axis[i] != Invert_axis_defaults[i])) {
memset( &item, 0, sizeof(config_item) );
item.joy_id = (short) Axis_map_to[i];
item.used = Invert_axis[i];
@@ -1562,7 +1613,7 @@ void control_config_init()
Control_config_backup[i] = Control_config[i];
common_set_interface_palette(NOX("ControlConfigPalette")); // set the interface palette
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Ui_window.set_mask_bmap(Conflict_background_bitmap_mask_fname[gr_screen.res]);
Ui_window.tooltip_handler = control_config_tooltip_handler;
@@ -1627,26 +1678,26 @@ void control_config_init()
control_config_conflict_check();
// setup strings
Joy_axis_action_text[0] = strdup(XSTR("Turn (Yaw) Axis", 1016));
Joy_axis_action_text[1] = strdup(XSTR("Pitch Axis", 1017));
Joy_axis_action_text[2] = strdup(XSTR("Bank Axis", 1018));
Joy_axis_action_text[3] = strdup(XSTR("Absolute Throttle Axis", 1019));
Joy_axis_action_text[4] = strdup(XSTR("Relative Throttle Axis", 1020));
Joy_axis_text[0] = strdup(XSTR("Joystick/Mouse X Axis", 1021));
Joy_axis_text[1] = strdup(XSTR("Joystick/Mouse Y Axis", 1022));
Joy_axis_text[2] = strdup(XSTR("Joystick Z Axis", 1023));
Joy_axis_text[3] = strdup(XSTR("Joystick rX Axis", 1024));
Joy_axis_text[4] = strdup(XSTR("Joystick rY Axis", 1025));
Joy_axis_text[5] = strdup(XSTR("Joystick rZ Axis", 1026));
Mouse_button_text[0] = strdup("");
Mouse_button_text[1] = strdup(XSTR("Left Button", 1027));
Mouse_button_text[2] = strdup(XSTR("Right Button", 1028));
Mouse_button_text[3] = strdup(XSTR("Mid Button", 1029));
Mouse_button_text[4] = strdup("");
Mouse_axis_text[0] = strdup(XSTR("L/R", 1030));
Mouse_axis_text[1] = strdup(XSTR("U/B", 1031));
Invert_text[0] = strdup(XSTR("N", 1032));
Invert_text[1] = strdup(XSTR("Y", 1033));
Joy_axis_action_text[0] = vm_strdup(XSTR("Turn (Yaw) Axis", 1016));
Joy_axis_action_text[1] = vm_strdup(XSTR("Pitch Axis", 1017));
Joy_axis_action_text[2] = vm_strdup(XSTR("Bank Axis", 1018));
Joy_axis_action_text[3] = vm_strdup(XSTR("Absolute Throttle Axis", 1019));
Joy_axis_action_text[4] = vm_strdup(XSTR("Relative Throttle Axis", 1020));
Joy_axis_text[0] = vm_strdup(XSTR("Joystick/Mouse X Axis", 1021));
Joy_axis_text[1] = vm_strdup(XSTR("Joystick/Mouse Y Axis", 1022));
Joy_axis_text[2] = vm_strdup(XSTR("Joystick Z Axis", 1023));
Joy_axis_text[3] = vm_strdup(XSTR("Joystick rX Axis", 1024));
Joy_axis_text[4] = vm_strdup(XSTR("Joystick rY Axis", 1025));
Joy_axis_text[5] = vm_strdup(XSTR("Joystick rZ Axis", 1026));
Mouse_button_text[0] = vm_strdup("");
Mouse_button_text[1] = vm_strdup(XSTR("Left Button", 1027));
Mouse_button_text[2] = vm_strdup(XSTR("Right Button", 1028));
Mouse_button_text[3] = vm_strdup(XSTR("Mid Button", 1029));
Mouse_button_text[4] = vm_strdup("");
Mouse_axis_text[0] = vm_strdup(XSTR("L/R", 1030));
Mouse_axis_text[1] = vm_strdup(XSTR("U/B", 1031));
Invert_text[0] = vm_strdup(XSTR("N", 1032));
Invert_text[1] = vm_strdup(XSTR("Y", 1033));
control_config_list_prepare();
}
@@ -1663,7 +1714,7 @@ void control_config_close()
help_overlay_unload(CONTROL_CONFIG_OVERLAY);
if (Background_bitmap){
bm_unload(Background_bitmap);
bm_release(Background_bitmap);
}
Ui_window.destroy();
@@ -1675,31 +1726,31 @@ void control_config_close()
// free strings
for(idx=0; idx<NUM_JOY_AXIS_ACTIONS; idx++){
if(Joy_axis_action_text[idx] != NULL){
free(Joy_axis_action_text[idx]);
vm_free(Joy_axis_action_text[idx]);
Joy_axis_action_text[idx] = NULL;
}
}
for(idx=0; idx<NUM_AXIS_TEXT; idx++){
if(Joy_axis_text[idx] != NULL){
free(Joy_axis_text[idx]);
vm_free(Joy_axis_text[idx]);
Joy_axis_text[idx] = NULL;
}
}
for(idx=0; idx<NUM_MOUSE_TEXT; idx++){
if(Mouse_button_text[idx] != NULL){
free(Mouse_button_text[idx]);
vm_free(Mouse_button_text[idx]);
Mouse_button_text[idx] = NULL;
}
}
for(idx=0; idx<NUM_MOUSE_AXIS_TEXT; idx++){
if(Mouse_axis_text[idx] != NULL){
free(Mouse_axis_text[idx]);
vm_free(Mouse_axis_text[idx]);
Mouse_axis_text[idx] = NULL;
}
}
for(idx=0; idx<NUM_INVERT_TEXT; idx++){
if(Invert_text[idx] != NULL){
free(Invert_text[idx]);
vm_free(Invert_text[idx]);
Invert_text[idx] = NULL;
}
}
@@ -2194,7 +2245,11 @@ void control_config_do_frame(float frametime)
gr_get_string_size(&w, NULL, str);
gr_printf(x - w / 2, y - font_height, str);
strcpy(buf, XSTR(Control_config[i].text, CONTROL_CONFIG_XSTR + i));
if (Control_config[i].hasXSTR)
strcpy(buf, XSTR(Control_config[i].text, CONTROL_CONFIG_XSTR + i));
else
strcpy(buf, Control_config[i].text);
gr_force_fit_string(buf, 255, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
gr_get_string_size(&w, NULL, buf);
gr_printf(x - w / 2, y, buf);
@@ -2466,6 +2521,7 @@ int check_control(int id, int key)
}
if ((Control_config[id].key_id == key) || joy_down_count(Control_config[id].joy_id, 1) || mouse_down_count(1 << Control_config[id].joy_id)) {
//mprintf(("Key used %d", key));
control_used(id);
return 1;
}
+30 -11
View File
@@ -9,13 +9,34 @@
/*
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfig.h $
* $Revision: 2.7 $
* $Date: 2004-05-03 21:22:19 $
* $Author: Kazan $
* $Revision: 2.13 $
* $Date: 2005-07-13 02:50:50 $
* $Author: Goober5000 $
*
* Header file for keyboard, joystick and mouse configuration
*
* $Log: not supported by cvs2svn $
* Revision 2.12 2005/07/13 02:30:52 Goober5000
* removed autopilot #define
* --Goober5000
*
* Revision 2.11 2005/03/03 06:05:27 wmcoolmon
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
*
* Revision 2.10 2005/01/16 22:39:08 wmcoolmon
* Added VM_TOPDOWN view; Added 2D mission mode, add 16384 to mission +Flags to use.
*
* Revision 2.9 2004/08/11 05:06:19 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.8 2004/07/25 00:31:28 Kazan
* i have absolutely nothing to say about that subject
*
* Revision 2.7 2004/05/03 21:22:19 Kazan
* Abandon strdup() usage for mod list processing - it was acting odd and causing crashing on free()
* Fix condition where alt_tab_pause() would flipout and trigger failed assert if game minimizes during startup (like it does a lot during debug)
* Nav Point / Auto Pilot code (All disabled via #ifdefs)
*
* Revision 2.6 2004/04/06 03:09:01 phreak
* added a control config option for the wireframe hud targetbox i enabled ages ago
*
@@ -317,6 +338,7 @@ typedef struct config_item {
short key_default; // default key bound to action
short joy_default; // default joystick button bound to action
char tab; // what tab (category) it belongs in
bool hasXSTR; // whether we should translate this with an XSTR
char *text; // describes the action in the config screen
char type; // manner control should be checked in
short key_id; // actual key bound to action
@@ -475,18 +497,15 @@ typedef struct config_item {
#define UP_SLIDE_THRUST 110
#define DOWN_SLIDE_THRUST 111
#define HUD_TARGETBOX_TOGGLE_WIREFRAME 112
#define VIEW_TOPDOWN 113
#define VIEW_TRACK_TARGET 114
#if defined(ENABLE_AUTO_PILOT)
//AutoPilot - Kazan
#define AUTO_PILOT_TOGGLE 113
#define NAV_CYCLE 114
#define AUTO_PILOT_TOGGLE 115
#define NAV_CYCLE 116
// this should be the total number of control action defines above (or last define + 1)
#define CCFG_MAX 115
#else
#define CCFG_MAX 113
#endif
#define CCFG_MAX 117
extern int Failed_key_index;
extern int Invert_heading;
@@ -9,13 +9,33 @@
/*
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfigCommon.cpp $
* $Revision: 2.6 $
* $Date: 2004-05-03 21:22:19 $
* $Author: Kazan $
* $Revision: 2.12 $
* $Date: 2005-07-13 02:30:52 $
* $Author: Goober5000 $
*
* C module for keyboard, joystick and mouse configuration common stuff (between Fred and FreeSpace)
*
* $Log: not supported by cvs2svn $
* Revision 2.11 2005/03/03 06:05:27 wmcoolmon
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
*
* Revision 2.10 2005/01/16 22:39:08 wmcoolmon
* Added VM_TOPDOWN view; Added 2D mission mode, add 16384 to mission +Flags to use.
*
* Revision 2.9 2004/07/26 20:47:26 Kazan
* remove MCD complete
*
* Revision 2.8 2004/07/25 00:31:28 Kazan
* i have absolutely nothing to say about that subject
*
* Revision 2.7 2004/07/12 16:32:43 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.6 2004/05/03 21:22:19 Kazan
* Abandon strdup() usage for mod list processing - it was acting odd and causing crashing on free()
* Fix condition where alt_tab_pause() would flipout and trigger failed assert if game minimizes during startup (like it does a lot during debug)
* Nav Point / Auto Pilot code (All disabled via #ifdefs)
*
* Revision 2.5 2004/04/06 03:09:01 phreak
* added a control config option for the wireframe hud targetbox i enabled ages ago
*
@@ -398,6 +418,7 @@
#include "io/joy.h"
#include "localization/localize.h"
#define TARGET_TAB 0
#define SHIP_TAB 1
#define WEAPON_TAB 2
@@ -420,155 +441,155 @@ int Invert_axis_defaults[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
//XSTR:OFF
config_item Control_config[CCFG_MAX + 1] = {
// targeting a ship
{ KEY_T, -1, TARGET_TAB, "Target Next Ship" },
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, "Target Previous Ship" },
{ KEY_H, 2, TARGET_TAB, "Target Next Closest Hostile Ship" },
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, "Target Previous Closest Hostile Ship" },
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, "Toggle Auto Targeting" },
{ KEY_F, -1, TARGET_TAB, "Target Next Closest Friendly Ship" },
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, "Target Previous Closest Friendly Ship" },
{ KEY_Y, 4, TARGET_TAB, "Target Ship in Reticle" },
{ KEY_G, -1, TARGET_TAB, "Target Target's Nearest Attacker" },
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, "Target Last Ship to Send Transmission" },
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, "Turn Off Auto-Targeting" },
{ KEY_T, -1, TARGET_TAB, true, "Target Next Ship" },
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, true, "Target Previous Ship" },
{ KEY_H, 2, TARGET_TAB, true, "Target Next Closest Hostile Ship" },
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, true, "Target Previous Closest Hostile Ship" },
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, true, "Toggle Auto Targeting" },
{ KEY_F, -1, TARGET_TAB, true, "Target Next Closest Friendly Ship" },
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, true, "Target Previous Closest Friendly Ship" },
{ KEY_Y, 4, TARGET_TAB, true, "Target Ship in Reticle" },
{ KEY_G, -1, TARGET_TAB, true, "Target Target's Nearest Attacker" },
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, true, "Target Last Ship to Send Transmission" },
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, true, "Turn Off Auto-Targeting" },
// targeting a ship's subsystem
{ KEY_V, -1, TARGET_TAB, "Target Subsystem in Reticle" },
{ KEY_S, -1, TARGET_TAB, "Target Next Subsystem" },
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, "Target Previous Subsystem" },
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, "Turn Off Auto-Targeting of Subsystems" },
{ KEY_V, -1, TARGET_TAB, true, "Target Subsystem in Reticle" },
{ KEY_S, -1, TARGET_TAB, true, "Target Next Subsystem" },
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, true, "Target Previous Subsystem" },
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, true, "Turn Off Auto-Targeting of Subsystems" },
// matching speed
{ KEY_M, -1, COMPUTER_TAB, "Match Target Speed" },
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, "Toggle Auto Speed Matching" },
{ KEY_M, -1, COMPUTER_TAB, true, "Match Target Speed" },
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, true, "Toggle Auto Speed Matching" },
// weapons
{ KEY_LCTRL, 0, WEAPON_TAB, "Fire Primary Weapon", CC_TYPE_CONTINUOUS },
{ KEY_SPACEBAR, 1, WEAPON_TAB, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS },
{ KEY_PERIOD, -1, WEAPON_TAB, "Cycle Forward Primary Weapon" },
{ KEY_COMMA, -1, WEAPON_TAB, "Cycle Backward Primary Weapon" },
{ KEY_DIVIDE, -1, WEAPON_TAB, "Cycle Secondary Weapon Bank" },
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, "Cycle Secondary Weapon Firing Rate" },
{ KEY_X, 3, WEAPON_TAB, "Launch Countermeasure" },
{ KEY_LCTRL, 0, WEAPON_TAB, true, "Fire Primary Weapon", CC_TYPE_CONTINUOUS },
{ KEY_SPACEBAR, 1, WEAPON_TAB, true, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS },
{ KEY_PERIOD, -1, WEAPON_TAB, true, "Cycle Forward Primary Weapon" },
{ KEY_COMMA, -1, WEAPON_TAB, true, "Cycle Backward Primary Weapon" },
{ KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Bank" },
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Firing Rate" },
{ KEY_X, 3, WEAPON_TAB, true, "Launch Countermeasure" },
// controls
{ KEY_A, -1, SHIP_TAB, "Forward Thrust", CC_TYPE_CONTINUOUS },
{ KEY_Z, -1, SHIP_TAB, "Reverse Thrust", CC_TYPE_CONTINUOUS },
{ KEY_PAD7, -1, SHIP_TAB, "Bank Left", CC_TYPE_CONTINUOUS },
{ KEY_PAD9, -1, SHIP_TAB, "Bank Right", CC_TYPE_CONTINUOUS },
{ KEY_PAD8, -1, SHIP_TAB, "Pitch Forward", CC_TYPE_CONTINUOUS },
{ KEY_PAD2, -1, SHIP_TAB, "Pitch Backward", CC_TYPE_CONTINUOUS },
{ KEY_PAD4, -1, SHIP_TAB, "Turn Left", CC_TYPE_CONTINUOUS },
{ KEY_PAD6, -1, SHIP_TAB, "Turn Right", CC_TYPE_CONTINUOUS },
{ KEY_A, -1, SHIP_TAB, true, "Forward Thrust", CC_TYPE_CONTINUOUS },
{ KEY_Z, -1, SHIP_TAB, true, "Reverse Thrust", CC_TYPE_CONTINUOUS },
{ KEY_PAD7, -1, SHIP_TAB, true, "Bank Left", CC_TYPE_CONTINUOUS },
{ KEY_PAD9, -1, SHIP_TAB, true, "Bank Right", CC_TYPE_CONTINUOUS },
{ KEY_PAD8, -1, SHIP_TAB, true, "Pitch Forward", CC_TYPE_CONTINUOUS },
{ KEY_PAD2, -1, SHIP_TAB, true, "Pitch Backward", CC_TYPE_CONTINUOUS },
{ KEY_PAD4, -1, SHIP_TAB, true, "Turn Left", CC_TYPE_CONTINUOUS },
{ KEY_PAD6, -1, SHIP_TAB, true, "Turn Right", CC_TYPE_CONTINUOUS },
// throttle controls
{ KEY_BACKSP, -1, SHIP_TAB, "Set Throttle to Zero" },
{ KEY_SLASH, -1, SHIP_TAB, "Set Throttle to Max" },
{ KEY_LBRACKET, -1, SHIP_TAB, "Set Throttle to One-Third" },
{ KEY_RBRACKET, -1, SHIP_TAB, "Set Throttle to Two-Thirds" },
{ KEY_EQUAL, -1, SHIP_TAB, "Increase Throttle 5 Percent" },
{ KEY_MINUS, -1, SHIP_TAB, "Decrease Throttle 5 Percent" },
{ KEY_BACKSP, -1, SHIP_TAB, true, "Set Throttle to Zero" },
{ KEY_SLASH, -1, SHIP_TAB, true, "Set Throttle to Max" },
{ KEY_LBRACKET, -1, SHIP_TAB, true, "Set Throttle to One-Third" },
{ KEY_RBRACKET, -1, SHIP_TAB, true, "Set Throttle to Two-Thirds" },
{ KEY_EQUAL, -1, SHIP_TAB, true, "Increase Throttle 5 Percent" },
{ KEY_MINUS, -1, SHIP_TAB, true, "Decrease Throttle 5 Percent" },
// squadmate messaging
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, "Attack My Target" },
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, "Disarm My Target" },
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, "Disable My Target" },
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, "Attack my Subsystem" },
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, "Capture My Target" },
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, "Engage Enemy" },
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, "Form on my Wing" },
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, "Ignore my Target" },
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, "Protect my Target" },
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, "Cover me" },
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, "Return to base" },
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, "Rearm me" },
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, true, "Attack My Target" },
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, true, "Disarm My Target" },
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, true, "Disable My Target" },
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, true, "Attack my Subsystem" },
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, true, "Capture My Target" },
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Engage Enemy" },
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, true, "Form on my Wing" },
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, true, "Ignore my Target" },
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, true, "Protect my Target" },
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, true, "Cover me" },
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, true, "Return to base" },
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, true, "Rearm me" },
{ KEY_R, 6, TARGET_TAB, "Target Closest Attacking Ship" },
{ KEY_R, 6, TARGET_TAB, true, "Target Closest Attacking Ship" },
// Views
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, "Chase View" },
{ KEY_PADPERIOD, -1, COMPUTER_TAB, "External View"},
{ KEY_PADENTER, -1, COMPUTER_TAB, "Toggle External Camera Lock"},
{ KEY_PAD0, -1, COMPUTER_TAB, "Free Look View", CC_TYPE_CONTINUOUS },
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, "Current Target View" },
{ KEY_PADPLUS, -1, COMPUTER_TAB, "Increase View Distance", CC_TYPE_CONTINUOUS },
{ KEY_PADMINUS, -1, COMPUTER_TAB, "Decrease View Distance", CC_TYPE_CONTINUOUS },
{ KEY_PAD5, -1, COMPUTER_TAB, "Center View", CC_TYPE_CONTINUOUS },
{ -1, 33, COMPUTER_TAB, "View Up", CC_TYPE_CONTINUOUS },
{ -1, 32, COMPUTER_TAB, "View Rear", CC_TYPE_CONTINUOUS },
{ -1, 34, COMPUTER_TAB, "View Left", CC_TYPE_CONTINUOUS },
{ -1, 35, COMPUTER_TAB, "View Right", CC_TYPE_CONTINUOUS },
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, true, "Chase View" },
{ KEY_PADPERIOD, -1, COMPUTER_TAB, true, "External View"},
{ KEY_PADENTER, -1, COMPUTER_TAB, true, "Toggle External Camera Lock"},
{ KEY_PAD0, -1, COMPUTER_TAB, true, "Free Look View", CC_TYPE_CONTINUOUS },
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, true, "Current Target View" },
{ KEY_PADPLUS, -1, COMPUTER_TAB, true, "Increase View Distance", CC_TYPE_CONTINUOUS },
{ KEY_PADMINUS, -1, COMPUTER_TAB, true, "Decrease View Distance", CC_TYPE_CONTINUOUS },
{ KEY_PAD5, -1, COMPUTER_TAB, true, "Center View", CC_TYPE_CONTINUOUS },
{ -1, 33, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS },
{ -1, 32, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS },
{ -1, 34, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS },
{ -1, 35, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS },
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, "Cycle Radar Range" },
{ KEY_C, -1, COMPUTER_TAB, "Communications Menu" },
{ -1, -1, -1, "Show Objectives" },
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, "Enter Subspace (End Mission)" },
{ KEY_J, -1, TARGET_TAB, "Target Target's Target" },
{ KEY_TAB, 5, SHIP_TAB, "Afterburner", CC_TYPE_CONTINUOUS },
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, true, "Cycle Radar Range" },
{ KEY_C, -1, COMPUTER_TAB, true, "Communications Menu" },
{ -1, -1, -1, true, "Show Objectives" },
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, true, "Enter Subspace (End Mission)" },
{ KEY_J, -1, TARGET_TAB, true, "Target Target's Target" },
{ KEY_TAB, 5, SHIP_TAB, true, "Afterburner", CC_TYPE_CONTINUOUS },
{ KEY_INSERT, -1, COMPUTER_TAB, "Increase Weapon Energy" },
{ KEY_DELETE, -1, COMPUTER_TAB, "Decrease Weapon Energy" },
{ KEY_HOME, -1, COMPUTER_TAB, "Increase Shield Energy" },
{ KEY_END, -1, COMPUTER_TAB, "Decrease Shield Energy" },
{ KEY_PAGEUP, -1, COMPUTER_TAB, "Increase Engine Energy" },
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, "Decrease Engine Energy" },
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, "Equalize Energy Settings" },
{ KEY_INSERT, -1, COMPUTER_TAB, true, "Increase Weapon Energy" },
{ KEY_DELETE, -1, COMPUTER_TAB, true, "Decrease Weapon Energy" },
{ KEY_HOME, -1, COMPUTER_TAB, true, "Increase Shield Energy" },
{ KEY_END, -1, COMPUTER_TAB, true, "Decrease Shield Energy" },
{ KEY_PAGEUP, -1, COMPUTER_TAB, true, "Increase Engine Energy" },
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, true, "Decrease Engine Energy" },
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, true, "Equalize Energy Settings" },
{ KEY_Q, 7, COMPUTER_TAB, "Equalize Shield" },
{ KEY_UP, -1, COMPUTER_TAB, "Augment Forward Shield" },
{ KEY_DOWN, -1, COMPUTER_TAB, "Augment Rear Shield" },
{ KEY_LEFT, -1, COMPUTER_TAB, "Augment Left Shield" },
{ KEY_RIGHT, -1, COMPUTER_TAB, "Augment Right Shield" },
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, "Transfer Energy Laser->Shield" },
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, "Transfer Energy Shield->Laser" },
{ -1, -1, -1, "Show Damage Popup Window" },
{ KEY_Q, 7, COMPUTER_TAB, true, "Equalize Shield" },
{ KEY_UP, -1, COMPUTER_TAB, true, "Augment Forward Shield" },
{ KEY_DOWN, -1, COMPUTER_TAB, true, "Augment Rear Shield" },
{ KEY_LEFT, -1, COMPUTER_TAB, true, "Augment Left Shield" },
{ KEY_RIGHT, -1, COMPUTER_TAB, true, "Augment Right Shield" },
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Laser->Shield" },
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Shield->Laser" },
{ -1, -1, -1, true, "Show Damage Popup Window" },
{ -1, -1, SHIP_TAB, "Bank When Pressed", CC_TYPE_CONTINUOUS },
{ -1, -1, -1, "Show NavMap" },
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, "Add or Remove Escort" },
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, "Clear Escort List" },
{ KEY_E, -1, TARGET_TAB, "Target Next Escort Ship" },
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, "Target Closest Repair Ship" },
{ -1, -1, SHIP_TAB, true, "Bank When Pressed", CC_TYPE_CONTINUOUS },
{ -1, -1, -1, true, "Show NavMap" },
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, true, "Add or Remove Escort" },
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Clear Escort List" },
{ KEY_E, -1, TARGET_TAB, true, "Target Next Escort Ship" },
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, true, "Target Closest Repair Ship" },
{ KEY_U, -1, TARGET_TAB, "Target Next Uninspected Cargo" },
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, "Target Previous Uninspected Cargo" },
{ KEY_N, -1, TARGET_TAB, "Target Newest Ship In Area" },
{ KEY_K, -1, TARGET_TAB, "Target Next Live Turret" },
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, "Target Previous Live Turret" },
{ KEY_U, -1, TARGET_TAB, true, "Target Next Uninspected Cargo" },
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, true, "Target Previous Uninspected Cargo" },
{ KEY_N, -1, TARGET_TAB, true, "Target Newest Ship In Area" },
{ KEY_K, -1, TARGET_TAB, true, "Target Next Live Turret" },
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, true, "Target Previous Live Turret" },
{ KEY_B, -1, TARGET_TAB, "Target Next Hostile Bomb or Bomber" },
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, "Target Previous Hostile Bomb or Bomber" },
{ KEY_B, -1, TARGET_TAB, true, "Target Next Hostile Bomb or Bomber" },
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber" },
// multiplayer messaging keys
{ KEY_1, -1, COMPUTER_TAB, "(Multiplayer) Message All", CC_TYPE_CONTINUOUS },
{ KEY_2, -1, COMPUTER_TAB, "(Multiplayer) Message Friendly", CC_TYPE_CONTINUOUS },
{ KEY_3, -1, COMPUTER_TAB, "(Multiplayer) Message Hostile", CC_TYPE_CONTINUOUS },
{ KEY_4, -1, COMPUTER_TAB, "(Multiplayer) Message Target", CC_TYPE_CONTINUOUS },
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, "(Multiplayer) Observer zoom to target"},
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All", CC_TYPE_CONTINUOUS },
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly", CC_TYPE_CONTINUOUS },
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile", CC_TYPE_CONTINUOUS },
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target", CC_TYPE_CONTINUOUS },
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, true, "(Multiplayer) Observer zoom to target"},
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, "Increase time compression" },
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, "Decrease time compression" },
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, true, "Increase time compression" },
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, true, "Decrease time compression" },
{ KEY_L, -1, COMPUTER_TAB, "Toggle high HUD contrast" },
{ KEY_L, -1, COMPUTER_TAB, true, "Toggle high HUD contrast" },
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, "(Multiplayer) Toggle network info"},
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, "(Multiplayer) Self destruct"},
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, true, "(Multiplayer) Toggle network info"},
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, true, "(Multiplayer) Self destruct"},
// Misc
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, "Toggle HUD"},
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, "Right Thrust", CC_TYPE_CONTINUOUS},
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, "Left Thrust", CC_TYPE_CONTINUOUS},
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, "Up Thrust", CC_TYPE_CONTINUOUS},
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, "Down Thrust", CC_TYPE_CONTINUOUS},
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, "Toggle HUD Wireframe Targetbox"},
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, true, "Toggle HUD"},
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, true, "Right Thrust", CC_TYPE_CONTINUOUS},
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, true, "Left Thrust", CC_TYPE_CONTINUOUS},
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, true, "Up Thrust", CC_TYPE_CONTINUOUS},
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, true, "Down Thrust", CC_TYPE_CONTINUOUS},
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, true, "Toggle HUD Wireframe Targetbox"},
{ -1, -1, COMPUTER_TAB, false, "Top-down View"},
{ -1, -1, COMPUTER_TAB, false, "Track targeted object", CC_TYPE_CONTINUOUS},
#if defined(ENABLE_AUTO_PILOT)
// Auto Navigation Systen
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, "Toggle Auto Pilot"},
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, "Cycle Nav Points"},
#endif
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, false, "Toggle Auto Pilot"},
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, false, "Cycle Nav Points"},
{ -1, -1, -1, "" }
{ -1, -1, -1, false, "" }
};
char *Scan_code_text_german[] = {
+13 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Cryptstring/cryptstring.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2005-09-08 00:09:32 $
* $Author: taylor $
*
* Applet for crypting strings.
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:04 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
@@ -33,6 +36,13 @@
#include <string.h>
#include "globalincs/crypt.h"
// we end up #include'ing SDL.h which on Windows and Mac will redfine main() which is something
// that we don't want since we don't actually link against SDL, this solves the problem...
#ifdef main
#undef main
#endif
int main(int argc, char **argv)
{
int i;
+30 -18
View File
@@ -9,16 +9,35 @@
/*
* $Logfile: /Freespace2/code/Cutscene/Cutscenes.cpp $
* $Revision: 2.11 $
* $Date: 2004-04-26 13:11:11 $
* $Revision: 2.17 $
* $Date: 2005-07-02 19:42:14 $
* $Author: taylor $
* $Revision: 2.11 $
* $Date: 2004-04-26 13:11:11 $
* $Revision: 2.17 $
* $Date: 2005-07-02 19:42:14 $
* $Author: taylor $
*
* Code for the cutscenes viewer screen
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2005/05/12 17:49:11 taylor
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
* fixes various problems and is past time to make the switch
*
* Revision 2.15 2005/02/23 04:51:55 taylor
* some bm_unload() -> bm_release() changes to save bmpman slots
*
* Revision 2.14 2005/01/31 23:27:51 taylor
* merge with Linux/OSX tree - p0131-2
*
* Revision 2.13 2004/07/26 20:47:26 Kazan
* remove MCD complete
*
* Revision 2.12 2004/07/12 16:32:43 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.11 2004/04/26 13:11:11 taylor
* mark view cutscenes ignoring extension and file case
*
* Revision 2.10 2004/03/05 09:01:58 Goober5000
* Uber pass at reducing #includes
* --Goober5000
@@ -219,6 +238,7 @@
#include "localization/localize.h"
#include "parse/parselo.h"
char *Cutscene_bitmap_name[GR_NUM_RESOLUTIONS] = {
"ViewFootage",
"2_ViewFootage"
@@ -236,7 +256,7 @@ cutscene_info Cutscenes[MAX_CUTSCENES];
//extern int All_movies_enabled; // If set, all movies may be viewed. Keyed off cheat code.
void cutsceen_close(){
for(int i = 0; i<MAX_CUTSCENES; i++)
if(Cutscenes[i].description)free(Cutscenes[i].description);
if(Cutscenes[i].description)vm_free(Cutscenes[i].description);
}
// initialization stuff for cutscenes
@@ -270,7 +290,7 @@ void cutscene_init()
stuff_string(buf, F_MULTITEXT, NULL);
drop_white_space(buf);
compact_multitext_string(buf);
Cutscenes[Num_cutscenes].description = strdup(buf);
Cutscenes[Num_cutscenes].description = vm_strdup(buf);
required_string("$cd:");
stuff_int( &Cutscenes[Num_cutscenes].cd );
@@ -289,7 +309,6 @@ void cutscene_init()
// returns -1 on failure.
int cutscenes_get_cd_num( char *filename )
{
#ifdef _WIN32
#if defined(OEM_BUILD)
return 0; // only 1 cd for OEM
#else
@@ -303,9 +322,6 @@ int cutscenes_get_cd_num( char *filename )
return -1;
#endif // defined(OEM_BUILD)
#else // !WIN32
return -1;
#endif // ifdef WIN32
}
// marks a cutscene as viewable
@@ -354,7 +370,7 @@ void cutscene_mark_viewable(char *filename)
static int Num_files;
static int Cutscene_list[MAX_CUTSCENES];
static int Stats_scroll_offset;
//static int Stats_scroll_offset; // not used - taylor
static int Selected_line = 0; // line that is currently selected for binding
static int Scroll_offset;
static int Background_bitmap;
@@ -442,7 +458,6 @@ static char *Text_lines[MAX_TEXT_LINES];
int cutscenes_validate_cd(char *mve_name, int prompt_for_cd)
{
#ifdef _WIN32
int cd_present = 0;
int cd_drive_num;
int cd_mve_is_on;
@@ -509,10 +524,7 @@ int cutscenes_validate_cd(char *mve_name, int prompt_for_cd)
}
return cd_present;
#else // !WIN32
return 0;
#endif // ifdef WIN32
return cd_present;
}
void cutscenes_screen_play()
@@ -650,7 +662,7 @@ void cutscenes_screen_init()
int i;
ui_button_info *b;
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Ui_window.set_mask_bmap(Cutscene_mask_name[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
@@ -703,7 +715,7 @@ void cutscenes_screen_init()
void cutscenes_screen_close()
{
if (Background_bitmap)
bm_unload(Background_bitmap);
bm_release(Background_bitmap);
Ui_window.destroy();
}
+9 -2
View File
@@ -9,13 +9,20 @@
/*
* $Logfile: /Freespace2/code/Cutscene/Cutscenes.h $
* $Revision: 2.2 $
* $Date: 2004-03-05 09:01:58 $
* $Revision: 2.4 $
* $Date: 2005-07-13 02:50:50 $
* $Author: Goober5000 $
*
* Code for the cutscenes viewer screen
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2004/08/11 05:06:20 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.2 2004/03/05 09:01:58 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.1 2002/08/01 01:41:04 penguin
* The big include file move
*
+46 -24
View File
@@ -9,22 +9,43 @@
/*
* $Logfile: /Freespace2/code/cutscene/movie.cpp $
* $Revision: 2.20 $
* $Date: 2004-04-26 13:09:20 $
* $Revision: 2.26 $
* $Date: 2005-05-12 17:37:48 $
* $Author: taylor $
*
* movie player code
*
* $Log: not supported by cvs2svn $
* Revision 2.25 2005/04/24 06:52:23 wmcoolmon
* Enabled movies in windowed mode; if this causes problems for people, they can always use -dnoshowvid
*
* Revision 2.24 2005/02/05 00:30:49 taylor
* fix a few things post merge
*
* Revision 2.23 2004/11/27 10:42:18 taylor
* this should get movies working again in D3D and help OGL too
*
* Revision 2.22 2004/07/26 20:47:26 Kazan
* remove MCD complete
*
* Revision 2.21 2004/07/12 16:32:43 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.20 2004/04/26 13:09:20 taylor
* cvs log header, mark cutscenes viewable for later, gr_flip() to fix OGL white flash
*
*
*
* $NoKeywords: $
*/
#ifdef _WIN32
#include <windows.h>
#include "movie.h"
#include "directx/dx8show.h"
#include "graphics/grd3dinternal.h"
#endif
#include "cutscene/movie.h"
#include "osapi/osapi.h"
#include "cmdline/cmdline.h"
#include "debugconsole/dbugfile.h"
@@ -32,21 +53,23 @@
#include "cutscene/cutscenes.h" // cutscene_mark_viewable()
#include "freespace2/freespace.h" // for Game_mode, etc.
// This module links freespace movie calls to the actual API calls the play the movie.
// This module handles all the different requires of OS and gfx API and finding the file to play
#ifdef _WIN32
void process_messages()
{
#ifdef _WIN32
MSG msg;
while(PeekMessage(&msg, (HWND) os_get_window(), 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
#endif
}
#include "graphics/grd3dinternal.h"
// filename - file to search for
// out_name - output, full path to file
@@ -101,16 +124,11 @@ bool movie_play(char *name)
cutscene_mark_viewable(name);
}
// reset the gr_* stuff before trying to play a movie
// fixes white flash in OGL and possibly other wierd stuff
gr_reset_clip();
gr_clear();
gr_flip();
extern int Is_standalone;
if(Is_standalone) return false;
if(Cmdline_dnoshowvid) return false;
if(Cmdline_window) return false;
//Commented this out since we have dnoshowvid -WMC
//if(Cmdline_window) return false;
char full_name[MAX_PATH];
int rc = 0;
@@ -124,6 +142,7 @@ bool movie_play(char *name)
DBUGFILE_OUTPUT_1("About to play: %s", full_name);
}
#ifdef _WIN32
process_messages();
// This is a bit of a hack but it works nicely
@@ -132,9 +151,14 @@ bool movie_play(char *name)
GlobalD3DVars::D3D_activate = 0;
GlobalD3DVars::lpD3DDevice->EndScene();
GlobalD3DVars::lpD3DDevice->Present(NULL,NULL,NULL,NULL);
d3d_lost_device();
// d3d_lost_device();
}
// reset the gr_* stuff before trying to play a movie
gr_flip(); // in the case of D3D this should recover the device
gr_clear();
gr_flip(); // need an extra flip here to cycle in the clear'd buffer
// This clears the screen
InvalidateRect((HWND) os_get_window(), NULL, TRUE);
PAINTSTRUCT paint_info;
@@ -217,7 +241,14 @@ bool movie_play(char *name)
// We finished playing the movie
CloseClip((HWND) os_get_window());
GlobalD3DVars::D3D_activate = 1;
if (gr_screen.mode == GR_DIRECT3D) {
GlobalD3DVars::D3D_activate = 1;
}
#else
STUB_FUNCTION;
#endif
return true;
}
@@ -229,12 +260,3 @@ bool movie_play_two(char *name1, char *name2)
return result1 && result2;
}
#else
// Stubs, preprocessor calls were making the win32 code more complex for no good reason.
// Using stubs instead.
bool movie_play(char *name) {return true;}
bool movie_play_two(char *name1, char *name2) {return true;}
#endif
+1
View File
@@ -1,3 +1,4 @@
#ifndef _MOVIE_HEADER_FILE
#define _MOVIE_HEADER_FILE
+154 -108
View File
@@ -1,142 +1,197 @@
#include "ddsutils/ddsutils.h"
#include "cfile/cfile.h"
int Texture_compression_enabled=0;
static int dds_read_header_internal(LPDDSURFACEDESC2 lpddsd, char *filename, int *width, int *height, int *bpp, int *compression_type, int *levels)
int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int *bpp, int *compression_type, int *levels, int *size)
{
char code[5];
DDSURFACEDESC2 dds_header;
int code = 0;
CFILE *ddsfile;
char real_name[MAX_FILENAME_LEN];
char *p;
int retval=DDS_ERROR_NONE;
int ct;
int bits=0;
int retval = DDS_ERROR_NONE;
int ct = DDS_UNCOMPRESSED;
int bits = 0;
int trash;
//this better not happen.. ever
Assert(filename!=NULL);
if (img_cfp == NULL) {
// this better not happen.. ever
Assert(filename != NULL);
//make sure there is an extension
strcpy(real_name, filename);
p=strchr(real_name, '.');
if (p) *p=0;
strcat(real_name, ".dds");
// make sure there is an extension
strcpy(real_name, filename);
char *p = strchr(real_name, '.');
if (p) { *p=0; }
strcat(real_name, ".dds");
memset(code,0,sizeof(code));
//try to open the file
ddsfile = cfopen(real_name, "rb");
// try to open the file
ddsfile = cfopen(real_name, "rb");
//file not found
if (!ddsfile)
{
return DDS_ERROR_INVALID_FILENAME;
// file not found
if (ddsfile == NULL)
return DDS_ERROR_INVALID_FILENAME;
} else {
ddsfile = img_cfp;
}
//read the code
cfread(code,1,4,ddsfile);
code[4]=0;
// read the code
code = cfread_int(ddsfile);
//check it
if (strncmp(code,DDS_FILECODE,4)!=0)
{
// check it
if (code != DDS_FILECODE)
return DDS_ERROR_BAD_HEADER;
// read header variables
dds_header.dwSize = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwSize );
dds_header.dwFlags = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwFlags );
dds_header.dwHeight = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwHeight );
dds_header.dwWidth = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwWidth );
dds_header.dwPitchOrLinearSize = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwPitchOrLinearSize );
dds_header.dwDepth = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwDepth);
dds_header.dwMipMapCount = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwMipMapCount );
// skip over the crap we don't care about
for (int i = 0; i < 11; i++)
trash = cfread_uint(ddsfile);
dds_header.ddpfPixelFormat.dwSize = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwSize );
dds_header.ddpfPixelFormat.dwFlags = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwFlags );
dds_header.ddpfPixelFormat.dwFourCC = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwFourCC );
dds_header.ddpfPixelFormat.dwRGBBitCount = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwRGBBitCount );
dds_header.ddpfPixelFormat.dwRBitMask = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwRBitMask );
dds_header.ddpfPixelFormat.dwGBitMask = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwGBitMask );
dds_header.ddpfPixelFormat.dwBBitMask = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwBBitMask );
dds_header.ddpfPixelFormat.dwRGBAlphaBitMask = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwRGBAlphaBitMask );
// calculate the type and size of the data
if (dds_header.ddpfPixelFormat.dwFlags & DDPF_FOURCC) {
// did I mention lately that I hate Microsoft?
// this is here to fix the situation where Microsoft doesn't follow their own docs
if ( dds_header.dwPitchOrLinearSize <= 0 ) {
if (dds_header.dwDepth == 0)
dds_header.dwDepth = 1;
// calculate the block size, mult by 8 for DXT1, 16 for DXT3 & 5
*size = ((dds_header.dwWidth + 3)/4) * ((dds_header.dwHeight + 3)/4) * ((dds_header.dwDepth + 3)/4) * ((dds_header.ddpfPixelFormat.dwFourCC == FOURCC_DXT1) ? 8 : 16);
} else {
*size = dds_header.dwMipMapCount > 1 ? dds_header.dwPitchOrLinearSize * 2 : dds_header.dwPitchOrLinearSize;
}
switch (dds_header.ddpfPixelFormat.dwFourCC) {
case FOURCC_DXT1:
bits=24;
ct=DDS_DXT1;
break;
case FOURCC_DXT3:
bits=32;
ct=DDS_DXT3;
break;
case FOURCC_DXT5:
bits=32;
ct=DDS_DXT5;
break;
// dxt2 and dxt4 aren't supported
case FOURCC_DXT2:
case FOURCC_DXT4:
retval = DDS_ERROR_INVALID_FORMAT;
ct = DDS_DXT_INVALID;
break;
// none of the above
default:
retval = DDS_ERROR_UNSUPPORTED;
ct = DDS_DXT_INVALID;
break;
}
} else if (dds_header.ddpfPixelFormat.dwFlags & DDPF_RGB) {
if (dds_header.dwDepth == 0)
dds_header.dwDepth = 1;
*size = dds_header.dwWidth * dds_header.dwHeight * dds_header.dwDepth * (dds_header.ddpfPixelFormat.dwRGBBitCount / 8);
bits = dds_header.ddpfPixelFormat.dwRGBBitCount;
ct = DDS_UNCOMPRESSED;
} else {
// it's not a readable format
retval = DDS_ERROR_UNSUPPORTED;
}
//read the header
cfread(lpddsd,sizeof(DDSURFACEDESC2),1,ddsfile);
// stuff important info
if (bpp)
*bpp = bits;
if (compression_type)
*compression_type = ct;
//stuff important info
if (width)
*width = lpddsd->dwWidth;
*width = dds_header.dwWidth;
if (height)
*height = lpddsd->dwHeight;
*height = dds_header.dwHeight;
if (levels)
*levels = lpddsd->dwMipMapCount;
*levels = dds_header.dwMipMapCount;
switch(lpddsd->ddpfPixelFormat.dwFourCC)
{
case FOURCC_DXT1:
bits=24;
ct=DDS_DXT1;
break;
case FOURCC_DXT3:
bits=32;
ct=DDS_DXT3;
break;
case FOURCC_DXT5:
bits=32;
ct=DDS_DXT5;
break;
//dxt2 and dxt4 aren't supported
case FOURCC_DXT2:
case FOURCC_DXT4:
retval=DDS_ERROR_INVALID_FORMAT;
ct=DDS_DXT_INVALID;
break;
//none of the above
default:
retval=DDS_ERROR_UNCOMPRESSED;
ct=DDS_DXT_INVALID;
break;
if (img_cfp == NULL) {
// close file and return
cfclose(ddsfile);
ddsfile = NULL;
}
if (bpp) *bpp=bits;
if (compression_type) *compression_type=ct;
//close file and return
cfclose(ddsfile);
return retval;
}
int dds_read_header(char *filename, int *width, int *height, int *bpp, int *compression_type, int *levels)
{
DDSURFACEDESC2 ddsd;
return dds_read_header_internal(&ddsd, filename, width, height, bpp, compression_type, levels);
}
//reads pixel info from a dds file
int dds_read_bitmap(char *filename, int *size, uint* data)
int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp)
{
int retval;
DDSURFACEDESC2 ddsd;
int w,h,ct,lvl,bpp;
int w,h,ct,lvl;
int size = 0, bits = 0;
CFILE *cfp;
ubyte* tmp;
char real_name[MAX_FILENAME_LEN];
//this must be set
Assert(size!=NULL);
//read the header -- if its at this stage, it should be legal.
retval=dds_read_header_internal(&ddsd, filename, &w, &h, &bpp, &ct, &lvl);
Assert(retval==DDS_ERROR_NONE);
// this better not happen.. ever
Assert(filename != NULL);
//get some more info from the surface
*size=ddsd.dwMipMapCount > 1 ? ddsd.dwLinearSize * 2 : ddsd.dwLinearSize;
// make sure there is an extension
strcpy(real_name, filename);
char *p = strchr(real_name, '.');
if (p) { *p = 0; }
strcat(real_name, ".dds");
//open it up and go to the data section
cfp=cfopen(filename,"rb");
cfseek(cfp,DDS_OFFSET, CF_SEEK_SET);
// open it up and go to the data section
cfp = cfopen(real_name, "rb");
//get the data
tmp=(ubyte*)malloc(*size);
if (!tmp)
{
cfclose(cfp);
return DDS_ERROR_NO_MEM; //barf
// just in case
if (cfp == NULL)
return DDS_ERROR_INVALID_FILENAME;
// read the header -- if its at this stage, it should be legal.
retval = dds_read_header(real_name, cfp, &w, &h, &bits, &ct, &lvl, &size);
Assert(retval == DDS_ERROR_NONE);
// this really shouldn't be needed but better safe than sorry
if (retval != DDS_ERROR_NONE) {
return retval;
}
cfread(tmp,1,*size,cfp);
cfseek(cfp, DDS_OFFSET, CF_SEEK_SET);
*data=(uint)tmp;
//we look done here
// read in the data
cfread(data, 1, size, cfp);
if (bpp)
*bpp = (ubyte)bits;
// we look done here
cfclose(cfp);
return DDS_ERROR_NONE;
}
@@ -160,8 +215,8 @@ const char *dds_error_string(int code)
case DDS_ERROR_INVALID_FORMAT:
return "File was compressed, but it was DXT2 or DXT4";
case DDS_ERROR_UNCOMPRESSED:
return "*.DDS files must be compressed and use DXT1, DXT3, or DXT5 compression";
case DDS_ERROR_UNSUPPORTED:
return "*.DDS files must be uncompressed or use DXT1, DXT3, or DXT5 compression";
default:
return "Abort, retry, fail?";
@@ -170,12 +225,3 @@ const char *dds_error_string(int code)
//get a warning otherwise
return "Abort, retry, fail?";
}
+18 -47
View File
@@ -5,17 +5,22 @@
#define __DDS_H
#include "globalincs/pstypes.h"
#ifdef _WIN32
#include "directx/vddraw.h"
#endif
struct CFILE;
#define DDS_ERROR_NONE 0 //everything went fine
#define DDS_ERROR_INVALID_FILENAME 1 //bad filename
#define DDS_ERROR_NO_MEM 2 //not enough mem to load
#define DDS_ERROR_UNCOMPRESSED 3 //not using dxtc compression
#define DDS_ERROR_UNSUPPORTED 3 //not a readable format
#define DDS_ERROR_INVALID_FORMAT 4 //can only use dxtc1, dxtc3, dxtc5
#define DDS_ERROR_BAD_HEADER 5 //header was not "DDS "
#define DDS_DXT_INVALID -1
#define DDS_UNCOMPRESSED 0
#define DDS_DXT1 1
#define DDS_DXT3 3
#define DDS_DXT5 5
@@ -33,7 +38,7 @@
#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4'))
#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5'))
#define DDS_FILECODE "DDS "
#define DDS_FILECODE 0x20534444 // "DDS " in file
#ifndef DUMMYUNIONNAMEN
#if defined(__cplusplus) || !defined(NONAMELESSUNION)
@@ -43,18 +48,12 @@
#endif
#endif
//these structures are the headers for a dds file
typedef struct _DDSCAPS2
{
DWORD dwCaps; // capabilities of surface wanted
DWORD dwCaps2;
DWORD dwCaps3;
union
{
DWORD dwCaps4;
DWORD dwVolumeDepth;
} DUMMYUNIONNAMEN(1);
DWORD dwCaps1;
DWORD dwCaps2;
DWORD Reserved[2];
} DDSCAPS2;
typedef struct _DDSURFACEDESC2
@@ -63,41 +62,13 @@ typedef struct _DDSURFACEDESC2
DWORD dwFlags; // determines what fields are valid
DWORD dwHeight; // height of surface to be created
DWORD dwWidth; // width of input surface
union
{
LONG lPitch; // distance to start of next line (return value only)
DWORD dwLinearSize; // Formless late-allocated optimized surface size
} DUMMYUNIONNAMEN(1);
union
{
DWORD dwBackBufferCount; // number of back buffers requested
DWORD dwDepth; // the depth if this is a volume texture
} DUMMYUNIONNAMEN(5);
union
{
DWORD dwMipMapCount; // number of mip-map levels requestde
// dwZBufferBitDepth removed, use ddpfPixelFormat one instead
DWORD dwRefreshRate; // refresh rate (used when display mode is described)
DWORD dwSrcVBHandle; // The source used in VB::Optimize
} DUMMYUNIONNAMEN(2);
DWORD dwAlphaBitDepth; // depth of alpha buffer requested
DWORD dwReserved; // reserved
LPVOID lpSurface; // pointer to the associated surface memory
union
{
DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use
DWORD dwEmptyFaceColor; // Physical color for empty cubemap faces
} DUMMYUNIONNAMEN(3);
DDCOLORKEY ddckCKDestBlt; // color key for destination blt use
DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use
DDCOLORKEY ddckCKSrcBlt; // color key for source blt use
union
{
DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface
DWORD dwFVF; // vertex format description of vertex buffers
} DUMMYUNIONNAMEN(4);
DWORD dwPitchOrLinearSize;
DWORD dwDepth;
DWORD dwMipMapCount;
DWORD dwReserved1[11];
DDPIXELFORMAT ddpfPixelFormat;
DDSCAPS2 ddsCaps; // direct draw surface capabilities
DWORD dwTextureStage; // stage in multitexture cascade
DWORD dwReserved2;
} DDSURFACEDESC2, FAR* LPDDSURFACEDESC2;
#define DDS_OFFSET 4+sizeof(DDSURFACEDESC2) //place where the data starts -- should be 128
@@ -105,11 +76,11 @@ typedef struct _DDSURFACEDESC2
//reads a dds header
//returns one of the error values
//'compression_type' comes back as one of the DDS_DXTC* defines
int dds_read_header(char *filename, int *width, int *height, int *bpp, int *compression_type, int *levels);
int dds_read_header(char *filename, CFILE *img_cfp = NULL, int *width = 0, int *height = 0, int *bpp = 0, int *compression_type = 0, int *levels = 0, int *size = 0);
//reads bitmap
//size of the data it stored in size
int dds_read_bitmap(char *filename, int *size, uint* data);
int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp = NULL);
//returns a string from a DDS error code
const char* dds_error_string(int code);
+73 -53
View File
@@ -9,13 +9,54 @@
/*
* $Logfile: /Freespace2/code/Debris/Debris.cpp $
* $Revision: 2.6 $
* $Date: 2004-03-31 05:42:26 $
* $Revision: 2.17 $
* $Date: 2005-07-22 10:18:37 $
* $Author: Goober5000 $
*
* Code for the pieces of exploding object debris.
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2005/07/13 02:50:51 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 2.15 2005/07/13 02:01:28 Goober5000
* fixed a bunch of "issues" caused by me with the species stuff
* --Goober5000
*
* Revision 2.14 2005/07/13 00:44:21 Goober5000
* improved species support and removed need for #define
* --Goober5000
*
* Revision 2.13 2005/04/05 05:53:15 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.12 2005/03/27 12:28:32 Goober5000
* clarified max hull/shield strength names and added ship guardian thresholds
* --Goober5000
*
* Revision 2.11 2005/03/02 21:24:43 taylor
* more network/inferno goodness for Windows, takes care of a few warnings too
*
* Revision 2.10 2005/01/30 09:27:39 Goober5000
* nitpicked some boolean tests, and fixed two small bugs
* --Goober5000
*
* Revision 2.9 2004/07/26 20:47:26 Kazan
* remove MCD complete
*
* Revision 2.8 2004/07/12 16:32:44 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.7 2004/07/01 01:52:20 phreak
* function pointer radar update.
* will enable us to make different radar styles that we can switch between
*
* Revision 2.6 2004/03/31 05:42:26 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 2.5 2004/03/05 09:01:59 Goober5000
* Uber pass at reducing #includes
* --Goober5000
@@ -238,11 +279,11 @@
* $NoKeywords: $
*/
#include "debris/debris.h"
#include "render/3d.h"
#include "fireball/fireballs.h"
#include "radar/radar.h"
#include "mission/missionparse.h" // For MAX_SPECIES_NAMES
#include "gamesnd/gamesnd.h"
#include "object/objectsnd.h"
#include "globalincs/linklist.h"
@@ -252,6 +293,7 @@
#include "io/timer.h"
#include "species_defs/species_defs.h"
#include "ship/ship.h"
#include "radar/radarsetup.h"
#ifndef NO_NETWORK
#include "network/multi.h"
@@ -259,6 +301,9 @@
#include "network/multiutil.h"
#endif
#define MAX_LIFE 10.0f
#define MIN_RADIUS_FOR_PERSISTANT_DEBRIS 50 // ship radius at which debris from it becomes persistant
#define DEBRIS_SOUND_DELAY 2000 // time to start debris sound after created
@@ -277,31 +322,10 @@ int Debris_model = -1;
int Debris_vaporize_model = -1;
int Debris_num_submodels = 0;
#if defined(MORE_SPECIES)
char Debris_texture_files[MAX_SPECIES][FILESPEC_LENGTH];
char Debris_texture_files[MAX_SPECIES_NAMES][MAX_DEBRIS_TNAME_LEN+1];
/*char * Debris_texture_files[MAX_SPECIES_NAMES] = {
NOX("debris01a"), // Terran
NOX("debris01b"), // Species B
NOX("debris01c"), // Shivan
NOX("debris01a"), // Ancient
NOX("debris01a"), // User1
NOX("debris01a"), // User2
NOX("debris01a"), // User3
NOX("debris01a"), // User4
};*/
#else
char * Debris_texture_files[MAX_SPECIES_NAMES] = {
NOX("debris01a"), // Terran
NOX("debris01b"), // Species B
NOX("debris01c"), // Shivan
};
#endif
int Debris_textures[MAX_SPECIES_NAMES];
int Debris_textures[MAX_SPECIES];
#define MAX_DEBRIS_DIST 10000.0f // Debris goes away if it's this far away.
#define DEBRIS_DISTANCE_CHECK_TIME (10*1000) // Check every 10 seconds.
@@ -374,7 +398,7 @@ void debris_page_in()
int i;
Debris_model = model_load( NOX("debris01.pof"), 0, NULL );
if (Debris_model>-1) {
if (Debris_model >= 0) {
polymodel * pm;
pm = model_get(Debris_model);
Debris_num_submodels = pm->n_models;
@@ -382,11 +406,7 @@ void debris_page_in()
Debris_vaporize_model = model_load( NOX("debris02.pof"), 0, NULL );
#if defined(MORE_SPECIES)
for (i=0; i<MAX_SPECIES_NAMES && i<True_NumSpecies; i++ ) {
#else
for (i=0; i<MAX_SPECIES_NAMES; i++ ) {
#endif
for (i=0; i<True_NumSpecies; i++ ) {
nprintf(( "Paging", "Paging in debris texture '%s'\n", Debris_texture_files[i] ));
Debris_textures[i] = bm_load( Debris_texture_files[i] );
if ( Debris_textures[i] < 0 ) {
@@ -421,7 +441,7 @@ void debris_render(object * obj)
Assert( db->flags & DEBRIS_USED );
// Swap in a different texture depending on the species
if ( (db->species > -1) && (db->species < MAX_SPECIES_NAMES) ) {
if ( (db->species > -1) && (db->species < MAX_SPECIES) ) {
pm = model_get( db->model_num );
@@ -587,7 +607,7 @@ void debris_process_post(object * obj, float frame_time)
int n, n_arcs = ((rand()>>5) % 3)+1; // Create 1-3 sparks
vector v1, v2, v3, v4;
vec3d v1, v2, v3, v4;
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
submodel_get_two_random_points( db->model_num, db->submodel_num, &v3, &v4 );
@@ -630,7 +650,7 @@ void debris_process_post(object * obj, float frame_time)
// rotate v2 out of local coordinates into world.
// Use v2 since it is used in every bolt. See above switch().
vector snd_pos;
vec3d snd_pos;
vm_vec_unrotate(&snd_pos, &v2, &obj->orient);
vm_vec_add2(&snd_pos, &obj->pos );
@@ -667,7 +687,7 @@ void debris_process_post(object * obj, float frame_time)
// Maybe move a vertex.... 20% of the time maybe?
int mr = myrand();
if ( mr < RAND_MAX/5 ) {
vector v1, v2;
vec3d v1, v2;
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
db->arc_pts[i][mr % 2] = v1;
}
@@ -703,7 +723,7 @@ int debris_find_oldest()
}
#define DEBRIS_ROTVEL_SCALE 5.0f
void calc_debris_physics_properties( physics_info *pi, vector *min, vector *max );
void calc_debris_physics_properties( physics_info *pi, vec3d *min, vec3d *max );
// ---------------------------------------------------------------------------------------
// debris_create()
//
@@ -711,7 +731,7 @@ void calc_debris_physics_properties( physics_info *pi, vector *min, vector *max
//
// exp_force: Explosion force, used to assign velocity to pieces.
// 1.0f assigns velocity like before. 2.0f assigns twice as much to non-inherited part of velocity
object *debris_create(object *source_obj, int model_num, int submodel_num, vector *pos, vector *exp_center, int hull_flag, float exp_force)
object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force)
{
int i, n, objnum, parent_objnum;
object *obj;
@@ -786,7 +806,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
for (i=0; i<MAX_DEBRIS_ARCS; i++ ) {
db->arc_timestamp[i] = timestamp(-1);
// vector arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
// vec3d arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
}
if ( db->is_hull ) {
@@ -843,13 +863,13 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
// -- No long need shield: bset_shield_strength(obj, 100.0f); // Hey! Set to some meaningful value!
if (source_obj->type == OBJ_SHIP) {
obj->hull_strength = Ships[source_obj->instance].ship_initial_hull_strength/8.0f;
obj->hull_strength = Ships[source_obj->instance].ship_max_hull_strength/8.0f;
} else
obj->hull_strength = 10.0f;
Num_debris_pieces++;
vector rotvel, radial_vel, to_center;
vec3d rotvel, radial_vel, to_center;
if ( exp_center )
vm_vec_sub( &to_center,pos, exp_center );
@@ -865,7 +885,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
// set up physics mass and I_inv for hull debris pieces
pm = model_get(model_num);
vector *min, *max;
vec3d *min, *max;
min = &pm->submodel[submodel_num].min;
max = &pm->submodel[submodel_num].max;
calc_debris_physics_properties( &obj->phys_info, min, max );
@@ -904,7 +924,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
// DA: here we need to vel_from_rot = w x to_center, where w is world is unrotated to world coords and offset is the
// displacement fromt the center of the parent object to the center of the debris piece
vector world_rotvel, vel_from_rotvel;
vec3d world_rotvel, vel_from_rotvel;
vm_vec_unrotate ( &world_rotvel, &source_obj->phys_info.rotvel, &source_obj->orient );
vm_vec_crossprod ( &vel_from_rotvel, &world_rotvel, &to_center );
vm_vec_scale ( &vel_from_rotvel, DEBRIS_ROTVEL_SCALE);
@@ -981,7 +1001,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
// Alas, poor debris_obj got whacked. Fortunately, we know who did it, where and how hard, so we
// can do something about it.
//
void debris_hit(object *debris_obj, object *other_obj, vector *hitpos, float damage)
void debris_hit(object *debris_obj, object *other_obj, vec3d *hitpos, float damage)
{
debris *debris_p = &Debris[debris_obj->instance];
@@ -993,7 +1013,7 @@ void debris_hit(object *debris_obj, object *other_obj, vector *hitpos, float dam
pe.pos = *hitpos; // Where the particles emit from
pe.vel = debris_obj->phys_info.vel; // Initial velocity of all the particles
vector tmp_norm;
vec3d tmp_norm;
vm_vec_sub( &tmp_norm, hitpos, &debris_obj->pos );
vm_vec_normalize_safe(&tmp_norm);
@@ -1047,7 +1067,7 @@ void debris_hit(object *debris_obj, object *other_obj, vector *hitpos, float dam
//
#pragma warning ( push )
#pragma warning ( disable : 4701 ) // possible use of variable without initialization
int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, collision_info_struct *debris_hit_info)
int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, collision_info_struct *debris_hit_info)
{
mc_info mc;
int num;
@@ -1088,7 +1108,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
object *heavy_obj = heavy;
object *light_obj = light;
vector zero, p0, p1;
vec3d zero, p0, p1;
vm_vec_zero(&zero);
vm_vec_sub(&p0, &light->last_pos, &heavy->last_pos);
vm_vec_sub(&p1, &light->pos, &heavy->pos);
@@ -1098,7 +1118,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
mc.p1 = &p1; // Point 2 of ray to check
// find the light object's position in the heavy object's reference frame at last frame and also in this frame.
vector p0_temp, p0_rotated;
vec3d p0_temp, p0_rotated;
// Collision detection from rotation enabled if at rotaion is less than 30 degree in frame
// This should account for all ships
@@ -1125,7 +1145,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
// copy important data
int copy_flags = mc.flags; // make a copy of start end positions of sphere in big ship RF
vector copy_p0, copy_p1;
vec3d copy_p0, copy_p1;
copy_p0 = *mc.p0;
copy_p1 = *mc.p1;
@@ -1196,7 +1216,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
}
// find position in submodel RF of light object at collison
vector int_light_pos, diff;
vec3d int_light_pos, diff;
vm_vec_sub(&diff, mc.p1, mc.p0);
vm_vec_scale_add(&int_light_pos, mc.p0, &diff, mc.hit_dist);
model_find_world_point(&debris_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_num, mc.hit_submodel, &heavy_obj->orient, &zero);
@@ -1228,7 +1248,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
}
// find position in submodel RF of light object at collison
vector diff;
vec3d diff;
vm_vec_sub(&diff, mc.p1, mc.p0);
vm_vec_scale_add(&debris_hit_info->light_collision_cm_pos, mc.p0, &diff, mc.hit_dist);
@@ -1260,7 +1280,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
}
// find position in submodel RF of light object at collison
vector diff;
vec3d diff;
vm_vec_sub(&diff, mc.p1, mc.p0);
vm_vec_scale_add(&debris_hit_info->light_collision_cm_pos, mc.p0, &diff, mc.hit_dist);
@@ -1310,7 +1330,7 @@ int debris_get_team(object *objp)
}
// fills in debris physics properties when created, specifically mass and moment of inertia
void calc_debris_physics_properties( physics_info *pi, vector *mins, vector *maxs )
void calc_debris_physics_properties( physics_info *pi, vec3d *mins, vec3d *maxs )
{
float dx, dy, dz, mass;
dx = maxs->xyz.x - mins->xyz.x;
+20 -11
View File
@@ -9,13 +9,26 @@
/*
* $Logfile: /Freespace2/code/Debris/Debris.h $
* $Revision: 2.1 $
* $Date: 2004-03-05 09:01:59 $
* $Revision: 2.5 $
* $Date: 2005-07-13 02:50:51 $
* $Author: Goober5000 $
*
* Code for the pieces of exploding object debris.
*
* $Log: not supported by cvs2svn $
* Revision 2.4 2005/04/28 05:29:29 wmcoolmon
* Removed FS2_DEMO defines that looked like they wouldn't cause the universe to collapse
*
* Revision 2.3 2005/04/05 05:53:15 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.2 2004/08/11 05:06:20 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.1 2004/03/05 09:01:59 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
@@ -170,7 +183,7 @@ typedef struct debris {
fix time_started; // time when debris was created
int next_distance_check; // timestamp to determine whether to delete this piece of debris.
vector arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
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
@@ -182,11 +195,7 @@ typedef struct debris {
#define DEBRIS_EXPIRE (1<<1) // debris can expire (ie hull chunks from small ships)
#ifdef FS2_DEMO
#define MAX_DEBRIS_PIECES 48
#else
#define MAX_DEBRIS_PIECES 64
#endif
#define MAX_DEBRIS_PIECES 64
extern debris Debris[MAX_DEBRIS_PIECES];
@@ -199,9 +208,9 @@ void debris_render( object * obj );
void debris_delete( object * obj );
void debris_process_pre( object * obj, float frame_time);
void debris_process_post( object * obj, float frame_time);
object *debris_create( object * source_obj, int model_num, int submodel_num, vector *pos, vector *exp_center, int hull_flag, float exp_force );
int debris_check_collision( object * obj, object * other_obj, vector * hitpos, collision_info_struct *debris_hit_info=NULL );
void debris_hit( object * debris_obj, object * other_obj, vector * hitpos, float damage );
object *debris_create( object * source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force );
int debris_check_collision( object * obj, object * other_obj, vec3d * hitpos, collision_info_struct *debris_hit_info=NULL );
void debris_hit( object * debris_obj, object * other_obj, vec3d * hitpos, float damage );
int debris_get_team(object *objp);
void debris_clear_expired_flag(debris *db);
+16 -5
View File
@@ -9,13 +9,23 @@
/*
* $Logfile: /Freespace2/code/DebugConsole/Console.cpp $
* $Revision: 2.3 $
* $Date: 2004-03-05 09:01:58 $
* $Author: Goober5000 $
* $Revision: 2.6 $
* $Date: 2005-04-25 00:07:22 $
* $Author: wmcoolmon $
*
* Routines for managing the debug console window.
*
* $Log: not supported by cvs2svn $
* Revision 2.5 2004/07/26 20:47:27 Kazan
* remove MCD complete
*
* Revision 2.4 2004/07/12 16:32:44 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.3 2004/03/05 09:01:58 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.2 2003/03/18 10:07:01 unknownplayer
* The big DX/main line merge. This has been uploaded to the main CVS since I can't manage to get it to upload to the DX branch. Apologies to all who may be affected adversely, but I'll work to debug it as fast as I can.
*
@@ -124,6 +134,7 @@
#include "osapi/osapi.h"
#include "debugconsole/dbugfile.h"
#define MAX_COMMANDS 300
static int Num_debug_commands = 0;
@@ -621,7 +632,7 @@ void debug_output( char c )
void dc_printf(char *format, ...)
{
char tmp[DCOLS*2];
char tmp[DCOLS*DROWS];
va_list args;
va_start(args, format);
@@ -629,7 +640,7 @@ void dc_printf(char *format, ...)
va_end(args);
char *p = tmp;
while( *p ) {
while( *p != '\0' ) {
debug_output(*p);
p++;
}
+2
View File
@@ -9,6 +9,8 @@
#include "dbugfile.h"
#pragma warning(disable:4711) // function selected for inlining
int dbugfile_counters[MAX_COUNTERS];
+1
View File
@@ -1,3 +1,4 @@
#ifndef _DBUGFILE_HEADER_
#define _DBUGFILE_HEADER_
+4 -3
View File
@@ -16,9 +16,11 @@
#ifdef _WIN32
#include <windows.h>
#include <winbase.h>
#endif
#include "timerbar.h"
#include "globalincs\pstypes.h"
#include "globalincs/pstypes.h"
// Internal structure for handling frame data
typedef struct
@@ -38,7 +40,7 @@ LARGE_INTEGER timerbar_ultimate_start_value;
LARGE_INTEGER timerbar_last_start_value;
// Data needed for push and pop functionality
const MAX_TB_STACK_SIZE = 100;
const int MAX_TB_STACK_SIZE = 100;
int timerbar_stack[MAX_TB_STACK_SIZE];
int timerbar_current_stack_layer = 0;
@@ -222,4 +224,3 @@ void timerbar_set_draw_func(void (*new_draw_func_ptr)(int colour, float x, float
draw_func_ptr = new_draw_func_ptr;
}
#endif
+13 -3
View File
@@ -8,11 +8,21 @@
/*
* $Logfile: /Freespace2/code/debugconsole/timerbar.h $
* $Revision: 1.8 $
* $Date: 2004-02-16 11:47:31 $
* $Author: randomtiger $
* $Revision: 1.10 $
* $Date: 2005-07-13 02:50:50 $
* $Author: Goober5000 $
*
* $Log: not supported by cvs2svn $
* Revision 1.9 2004/08/11 05:06:20 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 1.8 2004/02/16 11:47:31 randomtiger
* Removed a lot of files that we dont need anymore.
* Changed htl to be on by default, command now -nohtl
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
* Removed old dshow code and took away timerbar compile flag condition since it uses a runtime flag now.
*
* Revision 1.7 2003/11/19 20:37:23 randomtiger
* Almost fully working 32 bit pcx, use -pcx32 flag to activate.
* Made some commandline variables fit the naming standard.
File diff suppressed because it is too large. Load diff
+80 -51
View File
@@ -1,14 +1,24 @@
//header file for makeing decals-Bobboau
//header file for making decals-Bobboau
#ifndef _DECAL_H
#define _DECAL_H
#define MAX_DECAL_POLY 20
#include "object/object.h"
#define MAX_DECAL_POLY 40
#define MAX_DECAL_POLY_POINT 10
#define MAX_DECAL_DEFPOINTS 1000
#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
#include "globalincs/pstypes.h"
//#include "ship/ship.h"
#define DP_EOF 0
#define DP_DEFPOINTS 1
@@ -17,63 +27,82 @@
#define DP_SORTNORM 4
#define DP_BOUNDBOX 5
typedef struct decal_model{ //this will store a triangulated version of the ships polygons
struct{
int point[3]; //an index to the vert list-Bobboau
vector center; //the center of the poly
float radius; //the max radius of the poly
}poly[MAX_DECAL_POLY];
vector vert[MAX_DECAL_DEFPOINTS]; //the defpoints-Bobboau
int n_polys;
}decal_model;
struct decal;
struct decal_list;
struct decal_list_controle;
//extern decal_model d_model;
struct decal_poly{
vec3d norm[3];
vertex point[3];
decal_poly *next;
decal* parent;
int idx;
};
typedef struct decal{
struct{
int backfaced; //flag that this poly uses the backfaced texture
uv_pair uv[MAX_DECAL_POLY_POINT]; //uv coordanants
int point[MAX_DECAL_POLY_POINT]; //an index to the vert list-Bobboau
int n_poly;
vector norm; //the normal used for lighting
}poly[MAX_DECAL_POLY];
vector position;
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;
int submodel_parent; //the submodel this is part of
vector vert[1000]; //the defpoints-Bobboau
int frames; //number of frames in an animation
int fps; //frames per second
int starting_keyframe; //the frame that indicates the end of the inital nonlooped portion and the start of the middle looped part
int ending_keyframe; //the frame that indicates the end of the loopable portion and the start of the end part
int texture; //the texture to be used, first in animation
int backfaced_texture; //the texture to be used by backfaced polys, first in animation
int is_valid; //this means it is a good decal that should be rendered-Bobboau
int n_poly; //the number of polys
int timestamp; //this is when the decal was made-Bobboau
int lifetime; //this is how long the decal should be alive for-Bobboau
int importance; //this is for big things large beam marks and bomb craters should last longer than the odd laser impacts-Bobboau
int state; //1 starting, 2 looping(mostly for beams), 3 ending, 4 static
}decal;
};
typedef struct decal_point{
vector pnt;
matrix orient;
float radius;
}decal_point;
int decal_create(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture = -1);//makes the decal
#endif
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(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture);//makes the decal
int decal_create_sub(void *model_ptr);
/*
void clear_decals(decal_system *system);
int decal_is_in_face(int n, vertex vertlist[n]);//sees if a poly is inside a decal: 0 is yes, 1 is sort of, -1 is no
*/
#endif
+27 -9
View File
@@ -9,12 +9,28 @@
/*
* $Logfile: /Freespace2/code/Demo/Demo.cpp $
* $Revision: 2.3 $
* $Date: 2004-03-05 09:01:59 $
* $Author: Goober5000 $
* $Revision: 2.8 $
* $Date: 2005-05-12 17:49:11 $
* $Author: taylor $
*
*
* $Log: not supported by cvs2svn $
* Revision 2.7 2005/04/05 05:53:15 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.6 2005/01/31 23:27:52 taylor
* merge with Linux/OSX tree - p0131-2
*
* Revision 2.5 2004/07/26 20:47:27 Kazan
* remove MCD complete
*
* Revision 2.4 2004/07/12 16:32:45 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.3 2004/03/05 09:01:59 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.2 2002/08/01 01:41:04 penguin
* The big include file move
*
@@ -52,7 +68,7 @@
#include "demo/demo.h"
#include "ship/ship.h"
#include "Weapon/weapon.h"
#include "weapon/weapon.h"
#include "globalincs/linklist.h"
#include "freespace2/freespace.h"
#include "object/object.h"
@@ -64,6 +80,8 @@
#include "ship/shiphit.h"
#include "cfile/cfile.h"
// -----------------------------------------------------------------------------------------------------------------------------
// DEMO DEFINES/VARS
//
@@ -139,7 +157,7 @@ int Demo_error = DEMO_ERROR_NONE;
#define DEMO_BYTE(vl) do { DEMO_DATA(vl, sizeof(char)); } while(0)
#define DEMO_UBYTE(vl) do { DEMO_DATA(vl, sizeof(ubyte)); } while(0)
#define DEMO_FLOAT(vl) do { DEMO_DATA(vl, sizeof(float)); } while(0)
#define DEMO_VECTOR(vl) do { DEMO_DATA(vl, sizeof(vector)); } while(0)
#define DEMO_VECTOR(vl) do { DEMO_DATA(vl, sizeof(vec3d)); } while(0)
#define DEMO_MATRIX(vl) do { DEMO_DATA(vl, sizeof(matrix)); } while(0)
#define DEMO_STRING(vl) do { int stlen; if(Game_mode & GM_DEMO_RECORD){ stlen = strlen(vl); if(stlen <= 0){ break; } DEMO_DATA(stlen, sizeof(ushort)); DEMO_DATA(*vl, strlen(vl)); } else { ushort len = 0; DEMO_USHORT(len); DEMO_DATA(*vl, len); vl[len] = '\0'; } } while(0)
@@ -286,7 +304,7 @@ int demo_start_record(char *file)
char full_name[MAX_FILENAME_LEN] = "";
// try and allocate the buffer
Demo_buf = (char*)malloc(DEMO_BUF_SIZE);
Demo_buf = (char*)vm_malloc(DEMO_BUF_SIZE);
if(Demo_buf == NULL){
DEMO_ERROR(DEMO_ERROR_DISK_ACCESS);
return 0;
@@ -330,7 +348,7 @@ int demo_start_playback(char *file)
char full_name[MAX_FILENAME_LEN] = "";
// try and allocate the buffer
Demo_buf = (char*)malloc(DEMO_BUF_SIZE);
Demo_buf = (char*)vm_malloc(DEMO_BUF_SIZE);
if(Demo_buf == NULL){
DEMO_ERROR(DEMO_ERROR_DISK_ACCESS);
return 0;
@@ -380,7 +398,7 @@ void demo_close()
// free the buffer
if(Demo_buf != NULL){
free(Demo_buf);
vm_free(Demo_buf);
Demo_buf = NULL;
}
@@ -818,7 +836,7 @@ int demo_playback_seek_sub(int frame_size)
ushort obj_count = 0;
int obj_sig = 0;
ubyte team = 0;
vector obj_pos = vmd_zero_vector;
vec3d obj_pos = vmd_zero_vector;
matrix obj_orient = vmd_identity_matrix;
float obj_fthrust = 0;
int ship_index = 0;
+10 -3
View File
@@ -9,12 +9,18 @@
/*
* $Logfile: /Freespace2/code/Demo/Demo.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:21 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2005-07-13 02:50:51 $
* $Author: Goober5000 $
*
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2004/08/11 05:06:21 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.0 2002/06/03 04:02:21 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:04 mharris
* Initial checkin - converted filenames and includes to lower case
*
@@ -31,6 +37,7 @@
* $NoKeywords: $
*/
#ifndef _FS2_DEMO_SYSTEM_HEADER_FILE
#define _FS2_DEMO_SYSTEM_HEADER_FILE
+24 -7
View File
@@ -2,14 +2,15 @@
#include <stdio.h>
#include "osapi/osapi.h"
#include "dx8show.h"
#include "directx/dx8show.h"
#include "debugconsole/dbugfile.h"
#include "graphics/2d.h"
#include <commctrl.h>
#include <commdlg.h>
#include <tchar.h>
#include <atlbase.h>
//#include <atlbase.h> // No dependecy on ATL!!!
enum PLAYSTATE {Stopped, Paused, Running, Init};
@@ -93,7 +94,7 @@ BOOL IsAudioOnly()
HRESULT PlayMovieInWindow(HWND ghApp, LPTSTR szFile)
{
USES_CONVERSION;
// USES_CONVERSION;
WCHAR wFile[MAX_PATH];
HRESULT hr;
@@ -101,7 +102,8 @@ HRESULT PlayMovieInWindow(HWND ghApp, LPTSTR szFile)
UpdateWindow(ghApp);
// Convert filename to wide character string
wcscpy(wFile, T2W(szFile));
// wcscpy(wFile, T2W(szFile)); // requires ATL
swprintf(wFile, L"%S", szFile); // Uses libc to convert instead
// Get the interface for DirectShow's GraphBuilder
JIF(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
@@ -157,7 +159,8 @@ HRESULT PlayMovieInWindow(HWND ghApp, LPTSTR szFile)
return hr;
}
extern int Cmdline_window;
extern int Cmdline_noscalevid;
HRESULT InitVideoWindow(HWND ghApp, long video_w, long video_h)
{
HRESULT hr = S_OK;
@@ -168,11 +171,25 @@ HRESULT InitVideoWindow(HWND ghApp, long video_w, long video_h)
int screen_w = rect.right;
int screen_h = rect.bottom;
int video_rescale_w = (video_w * screen_w) / video_w;
int video_rescale_h = (video_rescale_w * video_h) / video_w;
int video_rescale_w;
int video_rescale_h;
if (Cmdline_noscalevid && (video_w < screen_w) && (video_h < screen_h)) {
video_rescale_w = video_w;
video_rescale_h = video_h;
} else {
video_rescale_w = (video_w * screen_w) / video_w;
video_rescale_h = (video_rescale_w * video_h) / video_w;
}
int extra_w = (screen_w - video_rescale_w) / 2;
int extra_h = (screen_h - video_rescale_h) / 2;
if (Cmdline_window)
{
rect.right += GetSystemMetrics(SM_CXFIXEDFRAME) * 2;
rect.bottom += 2 * GetSystemMetrics(SM_CYFIXEDFRAME) + GetSystemMetrics(SM_CYCAPTION);
}
if(SetWindowPos(ghApp, 0, 0, 0, rect.right, rect.bottom, SWP_NOMOVE | SWP_NOOWNERZORDER) == FALSE) {
+1
View File
@@ -1,3 +1,4 @@
#ifndef _DX8SHOW_HEADER_FILE
#define _DX8SHOW_HEADER_FILE
+1
View File
@@ -5,6 +5,7 @@
* File: async.h
* Content: AsyncData object include file
***************************************************************************/
#ifndef __ASYNC_INCLUDED__
#define __ASYNC_INCLUDED__
+1
View File
@@ -5,6 +5,7 @@
* File: dplobby.h
* Content: DirectPlayLobby include file
***************************************************************************/
#ifndef __DPLOBBY_INCLUDED__
#define __DPLOBBY_INCLUDED__
+1
View File
@@ -6,6 +6,7 @@
* Content: DirectXSetup, error codes and flags
***************************************************************************/
#ifndef __DSETUP_H__
#define __DSETUP_H__
+1
View File
@@ -7,6 +7,7 @@
*
**************************************************************************/
#ifndef __DSOUND_INCLUDED__
#define __DSOUND_INCLUDED__
+1
View File
@@ -7,6 +7,7 @@
*
***************************************************************************/
#ifndef __DVP_INCLUDED__
#define __DVP_INCLUDED__
#if defined( _WIN32 ) && !defined( _NO_COM )
@@ -9,13 +9,24 @@
/*
* $Logfile: /Freespace2/code/ExceptionHandler/ExceptionHandler.cpp $
* $Revision: 2.5 $
* $Date: 2004-03-31 05:42:26 $
* $Author: Goober5000 $
* $Revision: 2.8 $
* $Date: 2005-01-31 23:27:52 $
* $Author: taylor $
*
* Main file for dealing with exception handling
*
* $Log: not supported by cvs2svn $
* Revision 2.7 2004/07/26 20:47:27 Kazan
* remove MCD complete
*
* Revision 2.6 2004/07/12 16:32:45 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.5 2004/03/31 05:42:26 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 2.4 2004/03/06 23:28:22 bobboau
* fixed motion debris
* animated laser textures
@@ -65,9 +76,11 @@ information after crashes. See exceptionhandler.h for information
on how to hook it in.
*/
#ifdef _WIN32
#include <windows.h>
#pragma warning(disable:4711) // function selected for inlining
// --------------------
@@ -550,3 +563,5 @@ int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message)
return EXCEPTION_CONTINUE_SEARCH;
}
#endif // _WIN32
@@ -9,13 +9,23 @@
/*
* $Logfile: /Freespace2/code/ExceptionHandler/ExceptionHandler.h $
* $Revision: 2.1 $
* $Date: 2002-07-07 19:55:58 $
* $Author: penguin $
* $Revision: 2.4 $
* $Date: 2005-07-13 02:50:52 $
* $Author: Goober5000 $
*
* Header file for program exception handling
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2005/04/12 05:26:36 taylor
* many, many compiler warning and header fixes (Jens Granseuer)
* fix free on possible NULL in modelinterp.cpp (Jens Granseuer)
*
* Revision 2.2 2004/08/11 05:06:22 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.1 2002/07/07 19:55:58 penguin
* Back-port to MSVC
*
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
@@ -35,13 +45,12 @@
* $NoKeywords: $
*/
#ifdef _MSC_VER
#pragma once // Include this file only once
#endif
#ifndef __EXCEPTION_HANDLER_H
#define __EXCEPTION_HANDLER_H
// --------------------
//
// Defines
+102 -15
View File
@@ -9,13 +9,73 @@
/*
* $Logfile: /Freespace2/code/Fireball/FireBalls.cpp $
* $Revision: 2.12 $
* $Date: 2004-05-12 22:49:14 $
* $Author: phreak $
* $Revision: 2.26 $
* $Date: 2005-04-05 05:53:15 $
* $Author: taylor $
*
* Code to move, render and otherwise deal with fireballs.
*
* $Log: not supported by cvs2svn $
* Revision 2.25 2005/03/19 18:02:33 bobboau
* added new graphic functions for state blocks
* also added a class formanageing a new effect
*
* Revision 2.24 2005/03/14 03:24:25 taylor
* speedup grow/shrink time for the warp to avoid the big size skips
*
* Revision 2.23 2005/03/10 08:00:02 taylor
* change min/max to MIN/MAX to fix GCC problems
* add lab stuff to Makefile
* build unbreakage for everything that's not MSVC++ 6
* lots of warning fixes
* fix OpenGL rendering problem with ship insignias
* no Warnings() in non-debug mode for Linux (like Windows)
* some campaign savefile fixage to stop reverting everyones data
*
* Revision 2.22 2005/03/01 06:55:40 bobboau
* oh, hey look I've commited something :D
* animation system, weapon models detail box alt-tab bug, probly other stuff
*
* Revision 2.21 2005/02/23 05:05:39 taylor
* compiler warning fixes (for MSVC++ 6)
* have the warp effect only load as many LODs as will get used
* head off strange bug in release when corrupt soundtrack number gets used
* (will still Assert in debug)
* don't ever try and save a campaign savefile in multi or standalone modes
* first try at 32bit->16bit color conversion for TGA code (for TGA only ship textures)
*
* Revision 2.20 2005/01/30 09:27:39 Goober5000
* nitpicked some boolean tests, and fixed two small bugs
* --Goober5000
*
* Revision 2.19 2004/11/01 20:57:03 taylor
* make use of Knossos_warp_ani_used flag - thanks Goober5000
*
* Revision 2.18 2004/10/31 02:26:15 Goober5000
* whoops
* --Goober5000
*
* Revision 2.17 2004/10/31 02:04:33 Goober5000
* added Knossos_warp_ani_used flag for taylor
* --Goober5000
*
* Revision 2.16 2004/09/17 07:12:22 Goober5000
* changed around the logic for the 3D warp effect
* --Goober5000
*
* Revision 2.15 2004/08/23 04:32:39 Goober5000
* warp effect is back to FS2 default
* --Goober5000
*
* Revision 2.14 2004/07/26 20:47:28 Kazan
* remove MCD complete
*
* Revision 2.13 2004/07/12 16:32:45 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.12 2004/05/12 22:49:14 phreak
* renamed the warp model variable from 'wm' to 'Warp_model'
*
* Revision 2.11 2004/03/17 04:07:29 bobboau
* new fighter beam code
* fixed old after burner trails
@@ -388,14 +448,18 @@
#include "cmdline/cmdline.h"
#include "parse/parselo.h"
int Warp_model;
#define WARPHOLE_GROW_TIME (3.5f) // time for warphole to reach max size (also time to shrink to nothing once it begins to shrink)
int Warp_model;
int Knossos_warp_ani_used;
#define WARPHOLE_GROW_TIME (2.5f) // time for warphole to reach max size (also time to shrink to nothing once it begins to shrink)
#define MAX_FIREBALL_LOD 4
#define MAX_FIREBALLS 200
#define MAX_WARP_LOD 0
fireball Fireballs[MAX_FIREBALLS];
fireball_info Fireball_info[MAX_FIREBALL_TYPES];
@@ -405,6 +469,7 @@ int Num_fireballs = 0;
int fireballs_inited = 0;
int Warp_glow_bitmap = -1;
int Warp_ball_bitmap = -1;
#define FB_INDEX(fb) (fb-Fireballs)
@@ -524,6 +589,10 @@ void fireball_load_data()
fd = &Fireball_info[i];
for(idx=0; idx<fd->lod_count; idx++){
// we won't use a warp effect lod greater than MAX_WARP_LOD so don't load it either
if ( (i == FIREBALL_WARP_EFFECT) && (idx > MAX_WARP_LOD) )
continue;
fd->lod[idx].bitmap_id = bm_load_animation( fd->lod[idx].filename, &fd->lod[idx].num_frames, &fd->lod[idx].fps, 1 );
if ( fd->lod[idx].bitmap_id < 0 ) {
Error(LOCATION, "Could not load %s anim file\n", fd->lod[idx].filename);
@@ -534,6 +603,9 @@ void fireball_load_data()
if ( Warp_glow_bitmap == -1 ) {
Warp_glow_bitmap = bm_load( NOX("warpglow01") );
}
if ( Warp_ball_bitmap == -1 ) {
Warp_ball_bitmap = bm_load( NOX("warpball01") );
}
// polymodel Warp_pm;
@@ -564,6 +636,9 @@ void fireball_init()
Fireballs[i].objnum = -1;
}
// Goober5000 - reset Knossos warp flag
Knossos_warp_ani_used = 0;
mprintf(("loading warp model"));
Warp_model = -1;
Warp_model = model_load("warp.pof", 0, NULL, 0);
@@ -652,7 +727,7 @@ void fireball_render(object * obj)
// obj->alt_rad = rad;
warpin_render(obj, &obj->orient, &obj->pos, Fireballs[num].current_bitmap, rad, percent_life, obj->radius, (Fireballs[num].flags & FBF_WARP_FORCE_OLD) );
warpin_render(obj, &obj->orient, &obj->pos, Fireballs[num].current_bitmap, rad, percent_life, obj->radius, (Fireballs[num].flags & FBF_WARP_3D) );
}
break;
@@ -795,7 +870,7 @@ int fireball_free_one()
fb = &Fireballs[i];
// only remove the ones that aren't warp effects
if ( (fb->objnum>-1) && fireball_is_perishable(&Objects[fb->objnum]) ) {
if ( (fb->objnum >= 0) && fireball_is_perishable(&Objects[fb->objnum]) ) {
lifeleft = fb->total_time - fb->time_elapsed;
if ( (oldest_objnum < 0) || (lifeleft < oldest_lifeleft) ) {
@@ -911,11 +986,15 @@ float fireball_lifeleft_percent( object *obj )
fb = &Fireballs[num];
return (fb->total_time - fb->time_elapsed) / fb->total_time;
// Assert((fb->total_time - fb->time_elapsed) / fb->total_time >=0);
float p = (fb->total_time - fb->time_elapsed) / fb->total_time;
if (p < 0)p=0.0f;
return p;
}
// determine LOD to use
int fireball_get_lod(vector *pos, fireball_info *fd, float size)
int fireball_get_lod(vec3d *pos, fireball_info *fd, float size)
{
vertex v;
int x, y, w, h, bm_size;
@@ -944,7 +1023,7 @@ int fireball_get_lod(vector *pos, fireball_info *fd, float size)
// if vertex is behind, find size if in front, then drop down 1 LOD
if (v.codes & CC_BEHIND) {
float dist = vm_vec_dist_quick(&Eye_position, pos);
vector temp;
vec3d temp;
behind = 1;
vm_vec_scale_add(&temp, &Eye_position, &Eye_matrix.vec.fvec, dist);
@@ -993,11 +1072,11 @@ int fireball_get_lod(vector *pos, fireball_info *fd, float size)
}
// return the best lod
return min(ret_lod, fd->lod_count - 1);
return MIN(ret_lod, fd->lod_count - 1);
}
// Create a fireball, return object index.
int fireball_create( vector * pos, int fireball_type, int parent_obj, float size, int reverse, vector *velocity, float warp_lifetime, int ship_class, matrix *orient_override, int low_res, int extra_flags, int warp_open_sound, int warp_close_sound)
int fireball_create( vec3d * pos, int fireball_type, int parent_obj, float size, int reverse, vec3d *velocity, float warp_lifetime, int ship_class, matrix *orient_override, int low_res, int extra_flags, int warp_open_sound, int warp_close_sound)
{
int n, objnum, fb_lod;
object *obj;
@@ -1051,7 +1130,7 @@ int fireball_create( vector * pos, int fireball_type, int parent_obj, float size
// change lod if low res is desired
if (low_res) {
fb_lod++;
fb_lod = min(fb_lod, fd->lod_count - 1);
fb_lod = MIN(fb_lod, fd->lod_count - 1);
}
// if this is a warpout fireball, never go higher than LOD 1
@@ -1061,7 +1140,7 @@ int fireball_create( vector * pos, int fireball_type, int parent_obj, float size
fb_lod = 1;
}
*/
fb_lod = 0;
fb_lod = MAX_WARP_LOD;
}
fl = &fd->lod[fb_lod];
@@ -1191,7 +1270,15 @@ void fireballs_page_in()
for ( i = 0; i < MAX_FIREBALL_TYPES ; i++ ) {
fd = &Fireball_info[i];
for(idx=0; idx<fd->lod_count; idx++){
// if this is a Knossos ani, only load if Knossos_warp_ani_used is true
if ( (i == FIREBALL_KNOSSOS_EFFECT) && !Knossos_warp_ani_used)
continue;
for(idx=0; idx<fd->lod_count; idx++) {
// we won't use a warp effect lod greater than MAX_WARP_LOD so don't load it either
if ( (i == FIREBALL_WARP_EFFECT) && (idx > MAX_WARP_LOD) )
continue;
bm_page_in_texture( fd->lod[idx].bitmap_id, fd->lod[idx].num_frames );
}
}
+35 -6
View File
@@ -9,13 +9,38 @@
/*
* $Logfile: /Freespace2/code/Fireball/FireBalls.h $
* $Revision: 2.7 $
* $Date: 2004-05-12 22:49:13 $
* $Author: phreak $
* $Revision: 2.14 $
* $Date: 2005-07-13 02:50:52 $
* $Author: Goober5000 $
*
* Prototypes for fireball functions
*
* $Log: not supported by cvs2svn $
* Revision 2.13 2005/04/05 05:53:15 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.12 2005/03/19 18:02:33 bobboau
* added new graphic functions for state blocks
* also added a class formanageing a new effect
*
* Revision 2.11 2004/10/31 02:04:33 Goober5000
* added Knossos_warp_ani_used flag for taylor
* --Goober5000
*
* Revision 2.10 2004/09/17 07:12:22 Goober5000
* changed around the logic for the 3D warp effect
* --Goober5000
*
* Revision 2.9 2004/08/23 04:32:39 Goober5000
* warp effect is back to FS2 default
* --Goober5000
*
* Revision 2.8 2004/08/11 05:06:22 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.7 2004/05/12 22:49:13 phreak
* renamed the warp model variable from 'wm' to 'Warp_model'
*
* Revision 2.6 2004/03/17 04:07:29 bobboau
* new fighter beam code
* fixed old after burner trails
@@ -220,7 +245,7 @@ typedef struct fireball_info {
#define FBF_WARP_CLOSE_SOUND_PLAYED (1<<0)
#define FBF_WARP_CAPITAL_SIZE (1<<1)
#define FBF_WARP_CRUISER_SIZE (1<<2)
#define FBF_WARP_FORCE_OLD (1<<3) // Goober5000
#define FBF_WARP_3D (1<<3) // Goober5000
#define FBF_WARP_VIA_SEXP (1<<4) // Goober5000
typedef struct fireball {
@@ -246,7 +271,7 @@ void fireball_process_post(object * obj, float frame_time);
// reversed is for warp_in/out effects
// Velocity: If not NULL, the fireball will move at a constant velocity.
// warp_lifetime: If warp_lifetime > 0.0f then makes the explosion loop so it lasts this long. Only works for warp effect
int fireball_create(vector *pos, int fireball_type, int parent_obj, float size, int reversed=0, vector *velocity=NULL, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=NULL, int low_res=0, int extra_flags=0, int warp_open_sound=0, int warp_close_sound=0);
int fireball_create(vec3d *pos, int fireball_type, int parent_obj, float size, int reversed=0, vec3d *velocity=NULL, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=NULL, int low_res=0, int extra_flags=0, int warp_open_sound=0, int warp_close_sound=0);
void fireball_render_plane(int plane);
void fireball_close();
void fireball_level_close();
@@ -265,9 +290,13 @@ float fireball_lifeleft( object *obj );
float fireball_lifeleft_percent( object *obj );
// internal function to draw warp grid.
extern void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int force_old = 0 );
extern void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d = 0 );
extern int Warp_glow_bitmap; // Internal
extern int Warp_ball_bitmap; // Internal
extern int Warp_model;
// Goober5000
extern int Knossos_warp_ani_used;
#endif /* _FIREBALLS_H */
+154 -74
View File
@@ -9,13 +9,66 @@
/*
* $Logfile: /Freespace2/code/Fireball/WarpInEffect.cpp $
* $Revision: 2.15 $
* $Date: 2004-05-12 22:49:13 $
* $Author: phreak $
* $Revision: 2.30 $
* $Date: 2005-08-25 22:40:02 $
* $Author: taylor $
*
* Code for rendering the warp in effects for ships
*
* $Log: not supported by cvs2svn $
* Revision 2.29 2005/07/25 05:24:17 Goober5000
* cleaned up some command line and mission flag stuff
* --Goober5000
*
* Revision 2.28 2005/07/23 17:27:50 Goober5000
* remove Bobboau's extra warp thing
* --Goober5000
*
* Revision 2.27 2005/05/22 22:47:19 phreak
* compile warning fixage.
*
* Revision 2.26 2005/04/05 05:53:15 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.25 2005/03/25 06:57:33 wmcoolmon
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
*
* Revision 2.24 2005/03/19 18:02:33 bobboau
* added new graphic functions for state blocks
* also added a class formanageing a new effect
*
* Revision 2.23 2005/01/01 19:47:26 taylor
* make use of MR_NO_FOGGING to render models without fog
*
* Revision 2.22 2004/11/23 19:29:13 taylor
* fix 2d warp in D3D, add cmdline option for 3d warp
*
* Revision 2.21 2004/09/17 07:12:22 Goober5000
* changed around the logic for the 3D warp effect
* --Goober5000
*
* Revision 2.20 2004/08/23 04:32:39 Goober5000
* warp effect is back to FS2 default
* --Goober5000
*
* Revision 2.19 2004/07/26 20:47:28 Kazan
* remove MCD complete
*
* Revision 2.18 2004/07/17 09:29:13 taylor
* make old warpmap and new glow bitmap 3D unlit to render right in OGL
*
* Revision 2.17 2004/07/12 16:32:46 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.16 2004/07/05 05:09:18 bobboau
* FVF code, only the data that is needed is sent off to the card,,
* OGL can take advantage of this if they want but it won't break
* anything if they don't. also state block code has been implemented,
* that's totaly internal to D3D no high level code is involved.
*
* Revision 2.15 2004/05/12 22:49:13 phreak
* renamed the warp model variable from 'wm' to 'Warp_model'
*
* Revision 2.14 2004/05/08 01:08:48 Goober5000
* small fix
* --Goober5000
@@ -186,26 +239,31 @@
#include "render/3d.h"
#include "fireball/fireballs.h"
#include "mission/missionparse.h"
#include "Nebula/Neb.h"
#include "nebula/neb.h"
#include "globalincs/pstypes.h"
#include "model/model.h"
extern int Warp_model;
extern int Cmdline_nohtl;
extern int Cmdline_3dwarp;
DCF(norm,"normalize a zero length vector")
{
if ( Dc_command ) {
vector tmp = vmd_zero_vector;
vec3d tmp = vmd_zero_vector;
vm_vec_normalize(&tmp);
}
}
void draw_face( vertex *v1, vertex *v2, vertex *v3 )
{
vector norm;
vec3d norm;
vertex *vertlist[3];
vm_vec_perp(&norm,(vector *)&v1->x,(vector *)&v2->x,(vector *)&v3->x);
if ( vm_vec_dot(&norm,(vector *)&v1->x ) >= 0.0 ) {
vm_vec_perp(&norm,(vec3d *)&v1->x,(vec3d *)&v2->x,(vec3d *)&v3->x);
if ( vm_vec_dot(&norm,(vec3d *)&v1->x ) >= 0.0 ) {
vertlist[0] = v3;
vertlist[1] = v2;
vertlist[2] = v1;
@@ -215,7 +273,7 @@ void draw_face( vertex *v1, vertex *v2, vertex *v3 )
vertlist[2] = v3;
}
g3_draw_poly( 3, vertlist, TMAP_FLAG_TEXTURED );
g3_draw_poly( 3, vertlist, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT );
}
@@ -223,8 +281,10 @@ void draw_face( vertex *v1, vertex *v2, vertex *v3 )
#define wR_VERTICES() do { g3_rotate_vertex(verts[0], &bottom1); g3_rotate_vertex(verts[1], &bottom2); g3_rotate_vertex(verts[2], &top2); g3_rotate_vertex(verts[3], &top1); } while(0);
#define wP_VERTICES() do { for(idx=0; idx<4; idx++){ g3_project_vertex(verts[idx]); } } while(0);
void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int force_old)
void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d)
{
static flash_ball warp_ball(20, .1f,.25f, &vmd_z_vector, &vmd_zero_vector, 4.0f, 0.5f);
int i;
int saved_gr_zbuffering = gr_zbuffer_get();
@@ -234,35 +294,87 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
float Grid_depth = radius/2.5f;
vector center;
vec3d center;
vm_vec_scale_add( &center, pos, &orient->vec.fvec, -(max_radius/2.5f)/3.0f );
// Warp_Map = texture_bitmap_num;//sets the warp map, and thus sets the interp flag for this being a warpin effect
vector vecs[5];
vec3d vecs[5];
vertex verts[5];
if(Warp_model > -1 && !force_old && !(The_mission.flags & MISSION_FLAG_OLD_WARP_EFFECT)){
float model_Interp_scale_x = radius /20;
float model_Interp_scale_y = radius /20;
float model_Interp_scale_z = radius /20;
vecs[4] = center; //this is for the warp glow-Bobboau
verts[4].u = 0.5f; verts[4].v = 0.5f;
set_warp_globals(model_Interp_scale_x, model_Interp_scale_y, model_Interp_scale_z, texture_bitmap_num, (radius/max_radius) );
if (Cmdline_nohtl) {
g3_rotate_vertex( &verts[4], &vecs[4] );
} else {
g3_transfer_vertex( &verts[4], &vecs[4] );
}
if ( Warp_glow_bitmap != -1 ) {
gr_set_bitmap( Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, (The_mission.flags & MISSION_FLAG_FULLNEB)?(1.0f - neb2_get_fog_intensity(obj)):1.0f );
float r = radius;
int render_it;
#define OUT_PERCENT1 0.80f
#define OUT_PERCENT2 0.90f
#define IN_PERCENT1 0.10f
#define IN_PERCENT2 0.20f
if ( life_percent < IN_PERCENT1 ) {
// do nothing
render_it = 1;
} else if ( life_percent < IN_PERCENT2 ) {
r *= ( life_percent-IN_PERCENT1 ) / (IN_PERCENT2-IN_PERCENT1);
render_it = 1;
} else if ( life_percent < OUT_PERCENT1 ) {
// do nothing
render_it = 1;
} else if ( life_percent < OUT_PERCENT2 ) {
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2-OUT_PERCENT1);
render_it = 1;
} else {
// do nothing
render_it = 1;
}
if (render_it) {
int saved_gr_zbuffering = gr_zbuffer_get();
gr_zbuffer_set(GR_ZBUFF_READ);
// Add in noise
//float Noise[NOISE_NUM_FRAMES] = {
int noise_frame = fl2i(Missiontime/15.0f) % NOISE_NUM_FRAMES;
r *= (0.40f + Noise[noise_frame]*0.30f);
//Bobboau's warp thingie; this should be an option somewhere
//r += (float)pow((2.0f*life_percent) - 1.0f,24.0f)*max_radius*2.0f;
g3_draw_bitmap( &verts[4], 0, r, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT );
gr_zbuffer_set(saved_gr_zbuffering);
}
}
if((Warp_model >= 0) && (warp_3d || Cmdline_3dwarp))
{
float model_Interp_scale_xyz = radius / 20.0f;
set_warp_globals(model_Interp_scale_xyz, model_Interp_scale_xyz, model_Interp_scale_xyz, texture_bitmap_num, (radius/max_radius) );
float dist = vm_vec_dist_quick( pos, &Eye_position );
model_set_detail_level((int)(dist / (radius * 10.0f)));
gr_set_cull(0);
model_render( Warp_model, orient, pos, MR_NO_LIGHTING | MR_NORMAL);
model_render( Warp_model, orient, pos, MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING);
gr_set_cull(1);
// Warp_Map = -1;//un sets the warp map
model_Interp_scale_x = 1.0f;
model_Interp_scale_y = 1.0f;
model_Interp_scale_z = 1.0f;
set_warp_globals(model_Interp_scale_x, model_Interp_scale_y, model_Interp_scale_z, -1, -1.0f);
set_warp_globals(1.0f, 1.0f, 1.0f, -1, -1.0f);
/*
//this is that half done effect that was pissing people off-Bobboau
@@ -270,7 +382,7 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
gr_set_cull(0);
matrix m;
vector ray_dir;
vec3d ray_dir;
vm_vector_2_matrix(&m, &orient->vec.fvec, NULL, NULL);//this is the beam things that will come outof the point-Bobboau
float angle = ANG_TO_RAD(135.0f);
if(life_percent < 0.2f){
@@ -279,13 +391,13 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
for(int idx=0; idx<1; idx++){
vm_vec_random_cone(&ray_dir, &orient->vec.fvec, angle, &m);
mprintf(( "ray direction %f %f %f, orentation %f %f %f, angle %f\n",ray_dir.xyz.x, ray_dir.xyz.y, ray_dir.xyz.z, orient->vec.fvec.xyz.x, orient->vec.fvec.xyz.y, orient->vec.fvec.xyz.z, angle));
vector p_temp = *pos;
vec3d p_temp = *pos;
vm_vec_scale_add(&p_temp, pos, &ray_dir, (max_radius * 10 * frand_range(0.75f, 0.9f)));
mprintf(( "end %f %f %f",p_temp.xyz.x, p_temp.xyz.y, p_temp.xyz.z));
vertex h1[4]; // halves of a beam section
vertex *verts[4] = { &h1[0], &h1[1], &h1[2], &h1[3] };
vector top1, bottom1, top2, bottom2;
vec3d top1, bottom1, top2, bottom2;
beam_calc_facing_pts(&top1, &bottom1, &ray_dir, pos, 1.0f, 1.0f);
beam_calc_facing_pts(&top2, &bottom2, &ray_dir, &p_temp, 1.0f, 1.0f);
@@ -303,9 +415,6 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
gr_set_cull(1);
*/
vecs[4] = center; //this is for the warp glow-Bobboau
verts[4].u = 0.5f; verts[4].v = 0.5f;
g3_rotate_vertex( &verts[4], &vecs[4] );
}else{
gr_set_bitmap( texture_bitmap_num, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
@@ -336,59 +445,30 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
verts[4].u = 0.5f; verts[4].v = 0.5f;
for (i=0; i<5; i++ ) {
g3_rotate_vertex( &verts[i], &vecs[i] );
if (Cmdline_nohtl) {
g3_rotate_vertex( &verts[i], &vecs[i] );
} else {
g3_transfer_vertex( &verts[i], &vecs[i] );
}
}
gr_set_cull(0); // fixes rendering problem in D3D - taylor
draw_face( &verts[0], &verts[4], &verts[1] );
draw_face( &verts[1], &verts[4], &verts[2] );
draw_face( &verts[4], &verts[3], &verts[2] );
draw_face( &verts[0], &verts[3], &verts[4] );
}
if ( Warp_glow_bitmap != -1 ) {
gr_set_bitmap( Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, (The_mission.flags & MISSION_FLAG_FULLNEB)?(1.0f - neb2_get_fog_intensity(obj)):1.0f );
float r = radius;
int render_it;
#define OUT_PERCENT1 0.80f
#define OUT_PERCENT2 0.90f
#define IN_PERCENT1 0.10f
#define IN_PERCENT2 0.20f
if ( life_percent < IN_PERCENT1 ) {
// do nothing
render_it = 0;
} else if ( life_percent < IN_PERCENT2 ) {
r *= ( life_percent-IN_PERCENT1 ) / (IN_PERCENT2-IN_PERCENT1);
render_it = 1;
} else if ( life_percent < OUT_PERCENT1 ) {
// do nothing
render_it = 1;
} else if ( life_percent < OUT_PERCENT2 ) {
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2-OUT_PERCENT1);
render_it = 1;
} else {
// do nothing
render_it = 0;
}
if (render_it) {
int saved_gr_zbuffering = gr_zbuffer_get();
gr_zbuffer_set(GR_ZBUFF_READ);
// Add in noise
//float Noise[NOISE_NUM_FRAMES] = {
int noise_frame = fl2i(Missiontime/15.0f) % NOISE_NUM_FRAMES;
r *= (0.40f + Noise[noise_frame]*0.30f);
g3_draw_bitmap( &verts[4], 0,r, TMAP_FLAG_TEXTURED );
gr_zbuffer_set(saved_gr_zbuffering);
}
gr_set_cull(1);
}
if ( Warp_ball_bitmap > -1 ){
g3_start_instance_matrix(pos,orient, true);
gr_set_bitmap(Warp_ball_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.9999f);
float adg = (2.0f*life_percent) - 1.0f;
float pct= (float)(pow(adg,4.0f)-pow(adg,128.0f))*4.0f;
if(pct > 0.00001f)
warp_ball.render(max_radius*pct/2.0f,adg*adg,adg*adg*6.0f);
g3_done_instance(true);
}
gr_zbuffer_set( saved_gr_zbuffering );
}
File diff suppressed because it is too large. Load diff
+35 -6
View File
@@ -9,13 +9,28 @@
/*
* $Logfile: /Freespace2/code/FREESPACE2/FreeSpace.h $
* $Revision: 2.2 $
* $Date: 2004-04-07 03:31:53 $
* $Author: righteous1 $
* $Revision: 2.7 $
* $Date: 2005-07-13 02:50:52 $
* $Author: Goober5000 $
*
* FreeSpace, the game, not the project, header information.
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2005/06/03 06:39:26 taylor
* better audio pause/unpause support when game window loses focus or is minimized
*
* Revision 2.5 2005/03/03 06:05:27 wmcoolmon
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
*
* Revision 2.4 2004/10/31 21:31:34 taylor
* bump COUNT_ESTIMATE, reset time compression at the start of a mission, new pilot file support, add feature_disabled popup
*
* Revision 2.3 2004/08/11 05:06:22 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.2 2004/04/07 03:31:53 righteous1
* Updated to add alt_tab_pause() function to draw pause screen and discontinue sounds when the game is minimized. -R1
*
* Revision 2.1 2002/08/01 01:41:04 penguin
* The big include file move
*
@@ -189,6 +204,7 @@
// frametime/missiontime variables
extern fix Frametime;
extern float flRealframetime;
extern float flFrametime;
extern fix Missiontime;
@@ -203,6 +219,7 @@ extern int Game_mode;
extern int Game_do_state_should_skip;
// time compression
extern bool Time_compression_locked;
extern fix Game_time_compression;
// Set if subspace is active this level
@@ -266,6 +283,15 @@ int game_poll();
// function to read keyboard stuff
void game_process_keys();
// call this when you don't want the user changing time compression
void lock_time_compression(bool is_locked);
// call this to set time compression properly
void set_time_compression(float multiplier, float change_time = 0);
//call this to change the relative time compression (ie double it)
void change_time_compression(float multiplier);
// call this to set frametime properly (once per frame)
void game_set_frametime(int state);
@@ -344,6 +370,9 @@ int game_do_cd_mission_check(char *filename);
// Used to tell the player that a feature isn't available in the demo version of FreeSpace
void game_feature_not_in_demo_popup();
// Used to tell the player that a feature is disabled by build settings
void game_feature_disabled_popup();
// Return version string for demo or full version, depending on build.
void get_version_string(char *str);
@@ -356,9 +385,9 @@ int game_hacked_data();
// show the oem upsell screens (end of campaign, or close of game
void oem_upsell_show_screens();
// function to handle pausing the game when the game is minimized
// called from osapi.cpp
void alt_tab_pause();
// calls to be executed when the game is put in or restored from minimized or inactive state
void game_pause();
void game_unpause();
#endif // endif of #ifndef STAMPER_PROGRAM
#endif
+34 -9
View File
@@ -9,13 +9,33 @@
/*
* $Logfile: /Freespace2/code/Freespace2/LevelPaging.cpp $
* $Revision: 2.2 $
* $Date: 2004-03-05 09:02:01 $
* $Author: Goober5000 $
* $Revision: 2.8 $
* $Date: 2005-04-21 15:58:07 $
* $Author: taylor $
*
* Code to page in all the bitmaps at the beginning of a level.
*
* $Log: not supported by cvs2svn $
* Revision 2.7 2005/02/04 20:06:03 taylor
* merge with Linux/OSX tree - p0204-2
*
* Revision 2.6 2004/07/26 20:47:29 Kazan
* remove MCD complete
*
* Revision 2.5 2004/07/12 16:32:46 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.4 2004/07/01 01:53:00 phreak
* function pointer radar update.
* will enable us to make different radar styles that we can switch between
*
* Revision 2.3 2004/06/18 04:59:53 wmcoolmon
* Only used weapons paged in instead of all, fixed music box in FRED, sound quality settable with SoundSampleRate and SoundSampleBits registry values
*
* Revision 2.2 2004/03/05 09:02:01 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.1 2002/08/01 01:41:04 penguin
* The big include file move
*
@@ -62,13 +82,14 @@
#include "freespace2/freespace.h"
#include "freespace2/levelpaging.h"
// All the page in functions
extern void ship_page_in();
extern void debris_page_in();
extern void particle_page_in();
extern void stars_page_in();
extern void hud_page_in();
extern void radar_page_in();
extern void (*radar_page_in)();
extern void weapons_page_in();
extern void fireballs_page_in();
extern void shockwave_page_in();
@@ -77,20 +98,23 @@ extern void asteroid_page_in();
extern void training_mission_page_in();
extern void neb2_page_in();
extern void message_pagein_mission_messages();
extern void model_page_in_stop();
// Pages in all the texutures for the currently
// loaded mission. Call game_busy() occasionally...
void level_page_in()
{
mprintf(( "Beginning level bitmap paging...\n" ));
if(!(Game_mode & GM_STANDALONE_SERVER)){
bm_page_in_start();
}
// moved to freespace.cpp on 2005/04/18 - taylor
// mprintf(( "Beginning level bitmap paging...\n" ));
//
// if(!(Game_mode & GM_STANDALONE_SERVER)){
// bm_page_in_start();
// }
// Most important ones first
ship_page_in();
//Must be called after paging in ships
weapons_page_in();
fireballs_page_in();
particle_page_in();
@@ -110,6 +134,7 @@ void level_page_in()
}
if(!(Game_mode & GM_STANDALONE_SERVER)){
model_page_in_stop(); // free any loaded models that aren't used
bm_page_in_stop();
}
+9 -3
View File
@@ -9,13 +9,19 @@
/*
* $Logfile: /Freespace2/code/FREESPACE2/LevelPaging.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:22 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2005-07-13 02:50:52 $
* $Author: Goober5000 $
*
* Code to page in all the bitmaps at the beginning of a level.
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2004/08/11 05:06:22 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
+64 -15
View File
@@ -10,12 +10,45 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/Client.cpp $
* $Revision: 1.13 $
* $Date: 2004-03-07 23:07:20 $
* $Author: Kazan $
* $Revision: 1.21 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
*
* $Log: not supported by cvs2svn $
* Revision 1.20 2005/03/02 21:18:18 taylor
* better support for Inferno builds (in PreProcDefines.h now, no networking support)
* make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
* revert a timeout in Client.h back to the original value before Linux merge
*
* Revision 1.19 2005/02/23 13:17:04 taylor
* few more compiler warning fixes (didn't mean to commit iostream.h change)
* lower warning level to 3 to stop MSVC6 from complaining about C++ headers
*
* Revision 1.18 2005/02/23 05:05:37 taylor
* compiler warning fixes (for MSVC++ 6)
* have the warp effect only load as many LODs as will get used
* head off strange bug in release when corrupt soundtrack number gets used
* (will still Assert in debug)
* don't ever try and save a campaign savefile in multi or standalone modes
* first try at 32bit->16bit color conversion for TGA code (for TGA only ship textures)
*
* Revision 1.17 2005/02/04 20:06:03 taylor
* merge with Linux/OSX tree - p0204-2
*
* Revision 1.16 2004/11/21 16:07:22 Kazan
* dumbbugfix
*
* Revision 1.15 2004/11/18 00:05:36 Goober5000
* #pragma'd a bunch of warnings
* --Goober5000
*
* Revision 1.14 2004/05/25 00:21:39 wmcoolmon
* Updated to use <iostream> instead of <iostream.h>
*
* Revision 1.13 2004/03/07 23:07:20 Kazan
* [Incomplete] Readd of Software renderer so Standalone server works
*
* Revision 1.12 2004/03/05 09:01:56 Goober5000
* Uber pass at reducing #includes
* --Goober5000
@@ -51,15 +84,29 @@
*
*/
#include "Client.h"
//#include "protocol.h"
#include "udpsocket.h"
#include <iostream.h>
#ifndef NO_NETWORK
// 4711 = function selected for automatic inline expansion
#pragma warning(disable: 4711)
#include <iostream>
#include <time.h>
#include "fs2open_pxo/Client.h"
//#include "fs2open_pxo/protocol.h"
#include "fs2open_pxo/udpsocket.h"
#include "network/multi_log.h"
#include "playerman/player.h"
#include "ship/ship.h"
PXO_Socket FS2OpenPXO_Socket;
// NOTE: CLK_TCK is depreciated but available for compatibility, use CLOCKS_PER_SEC instead
#ifndef CLK_TCK
#define CLK_TCK CLOCKS_PER_SEC
#endif
#define PXO_ADDINT(n) *((int *)cur) = (n); cur += sizeof(int);
#define PXO_ADDSTRING(x, y) memcpy(cur, x, y); cur += y;
@@ -84,7 +131,7 @@ int CheckSingleMission(const char* mission, unsigned int crc32, UDP_Socket &Sock
if (Socket.SendPacket((char *) &checkpack, sizeof(fs2open_file_check_single), sender, port) == -1)
return NULL;
return -1;
fs2open_fcheck_reply c_reply;
@@ -168,7 +215,7 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
// send Packet
if (Socket.SendPacket(PacketBuffer, packet_size, sender, port) == -1)
return NULL;
return -1;
fs2open_pilot_updatereply u_reply;
@@ -216,7 +263,7 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
// send Packet
if (Socket.SendPacket((char *)&prq_packet, sizeof(fs2open_get_pilot), sender, port) == -1)
return NULL;
return -1;
char PacketBuffer[16384]; // 16K should be enough i think..... I HOPE!
fs2open_pilot_reply *p_reply = (fs2open_pilot_reply *) PacketBuffer;
@@ -408,7 +455,7 @@ int Fs2OpenPXO_Login(const char* username, const char* password, UDP_Socket &Soc
if (Socket.SendPacket((char *) &loginpckt, sizeof(loginpckt), sender, port) == -1)
{
cout << "Error Sending Packet" << endl;
std::cout << "Error Sending Packet" << std::endl;
}
// await reply
@@ -457,8 +504,8 @@ void SendHeartBeat(const char* masterserver, int targetport, UDP_Socket &Socket,
hbpack.players = (short) players;
hbpack.port = port;
Socket.SendPacket((char *) &hbpack, sizeof(serverlist_hb_packet), std::string(masterserver), targetport);
std::string ms = masterserver;
Socket.SendPacket((char *) &hbpack, (int)sizeof(serverlist_hb_packet), ms, targetport);
}
@@ -541,7 +588,7 @@ int Ping(const char* target)
UDP_Socket Socket(FS2OPEN_CLIENT_PORT);
if (!Socket.InitSocket())
{
cout << "Initialization Error!" << endl;
std::cout << "Initialization Error!" << std::endl;
exit(1);
}
@@ -557,4 +604,6 @@ int Ping(const char* target)
Socket.GetPacket((char *)&rping, sizeof(fs2open_pingreply), rctp);
return int( float(time(0) - rping.time)/2.0 );
}
}
#endif // !NO_NETWORK
+45 -41
View File
@@ -10,12 +10,31 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/Client.h $
* $Revision: 1.14 $
* $Date: 2004-03-31 05:42:26 $
* $Revision: 1.19 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
*
* $Log: not supported by cvs2svn $
* Revision 1.18 2005/03/02 21:18:18 taylor
* better support for Inferno builds (in PreProcDefines.h now, no networking support)
* make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
* revert a timeout in Client.h back to the original value before Linux merge
*
* Revision 1.17 2005/02/04 20:06:03 taylor
* merge with Linux/OSX tree - p0204-2
*
* Revision 1.16 2004/08/11 05:06:23 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 1.15 2004/07/07 21:00:06 Kazan
* FS2NetD: C2S Ping/Pong, C2S Ping/Pong, Global IP Banlist, Global Network Messages
*
* Revision 1.14 2004/03/31 05:42:26 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 1.13 2004/03/09 00:02:16 Kazan
* more fs2netd stuff
*
@@ -49,6 +68,11 @@
*
*/
#if !defined(__pxo_client_h_)
#define __pxo_client_h_
#pragma warning(disable:4018) // signed/unsigned mismatch
#pragma warning(disable:4100) // unreferenced formal parameter
#pragma warning(disable:4511) // copy constructor could not be generated
@@ -56,18 +80,20 @@
#pragma warning(disable:4663) // new template specification syntax
#pragma warning(disable:4710) // function not inlined
#if !defined(__pxo_client_h_)
#define __pxo_client_h_
#define MAX_SERVERS 512
#include "protocol.h"
#include "fs2open_pxo/protocol.h"
#if !defined(PXO_TCP)
#include "udpsocket.h"
#include "fs2open_pxo/udpsocket.h"
typedef UDP_Socket PXO_Socket;
#else
#include "TCP_Socket.h"
#include "fs2open_pxo/TCP_Socket.h"
typedef TCP_Socket PXO_Socket;
#endif
extern PXO_Socket FS2OpenPXO_Socket;
struct player;
struct net_server
@@ -83,43 +109,21 @@ struct net_server
int port;
};
int SendPlayerData(int SID, const char* player_name, const char* user, player *pl, const char* masterserver, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
int GetPlayerData(int SID, const char* player_name, player *pl, const char* masterserver, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, bool CanCreate=false, int timeout=15);
int CheckSingleMission(const char* mission, unsigned int crc32, PXO_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
#if !defined(PXO_TCP)
// ********************************************************************************************************
// UDP Version of PXO
// ********************************************************************************************************
// Variants of the above functions with persistant connections
int SendPlayerData(int SID, const char* player_name, const char* user, player *pl, const char* masterserver, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
int GetPlayerData(int SID, const char* player_name, player *pl, const char* masterserver, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, bool CanCreate=false, int timeout=15);
int CheckSingleMission(const char* mission, unsigned int crc32, UDP_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
net_server* GetServerList(const char* masterserver, int &numServersFound, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
int Ping(const char* target, UDP_Socket &Socket);
void SendHeartBeat(const char* masterserver, int targetport, UDP_Socket &Socket, const char* myName, const char* MisName, const char* title, int flags, int port, int players)
int Fs2OpenPXO_Login(const char* username, const char* password, UDP_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
net_server* GetServerList(const char* masterserver, int &numServersFound, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
int Ping(const char* target, PXO_Socket &Socket);
void SendHeartBeat(const char* masterserver, int targetport, PXO_Socket &Socket, const char* myName, const char* MisName, const char* title, int flags, int port, int players);
int Fs2OpenPXO_Login(const char* username, const char* password, PXO_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
int GetPingReply(PXO_Socket &Socket);
void SendPingReply(PXO_Socket &Socket, int tstamp);
fs2open_banmask* GetBanList(int &numBanMasks, PXO_Socket &Socket, int timeout=15);
// longer timeouts - mySQL operations
file_record* GetTablesList(int &numTables, const char *masterserver, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
file_record* GetMissionsList(int &numMissions, const char *masterserver, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
#else
// ********************************************************************************************************
// TCP Version of PXO
// ********************************************************************************************************
int SendPlayerData(int SID, const char* player_name, const char* user, player *pl, const char* masterserver, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
int GetPlayerData(int SID, const char* player_name, player *pl, const char* masterserver, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, bool CanCreate=false, int timeout=15);
int CheckSingleMission(const char* mission, unsigned int crc32, TCP_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
net_server* GetServerList(const char* masterserver, int &numServersFound, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
int Ping(const char* target, TCP_Socket &Socket);
void SendHeartBeat(const char* masterserver, int targetport, TCP_Socket &Socket, const char* myName, const char* MisName, const char* title, int flags, int port, int players);
int Fs2OpenPXO_Login(const char* username, const char* password, TCP_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
int GetPingReply(TCP_Socket &Socket);
// longer timeouts - mySQL operations
file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
#endif
file_record* GetTablesList(int &numTables, const char *masterserver, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
file_record* GetMissionsList(int &numMissions, const char *masterserver, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
#endif
+258 -75
View File
@@ -11,11 +11,76 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/TCP_Client.cpp $
* $Revision: 1.15 $
* $Date: 2004-03-31 05:42:26 $
* $Revision: 1.31 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
* $Log: not supported by cvs2svn $
* Revision 1.30 2005/06/29 18:49:37 taylor
* various FS2NetD fixes:
* - replace timer stuff with something that more accurately works cross-platform and without being affected by load
* - better sanity checking for the server list
* - working Linux compatibility that's not dog slow
* - when calling DataReady() make sure that the data is properly valid
* - fix messed up cvs merge cleanup from the Linux merge which did nasty things
*
* Revision 1.29 2005/06/21 00:13:47 taylor
* add some better error checking/handling for when GetServerList messes up
*
* Revision 1.28 2005/05/08 20:28:57 wmcoolmon
* Dynamically allocated medals
*
* Revision 1.27 2005/03/08 03:50:25 Goober5000
* edited for language ;)
* --Goober5000
*
* Revision 1.26 2005/03/02 21:18:18 taylor
* better support for Inferno builds (in PreProcDefines.h now, no networking support)
* make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
* revert a timeout in Client.h back to the original value before Linux merge
*
* Revision 1.25 2005/02/23 13:17:04 taylor
* few more compiler warning fixes (didn't mean to commit iostream.h change)
* lower warning level to 3 to stop MSVC6 from complaining about C++ headers
*
* Revision 1.24 2005/02/23 05:05:37 taylor
* compiler warning fixes (for MSVC++ 6)
* have the warp effect only load as many LODs as will get used
* head off strange bug in release when corrupt soundtrack number gets used
* (will still Assert in debug)
* don't ever try and save a campaign savefile in multi or standalone modes
* first try at 32bit->16bit color conversion for TGA code (for TGA only ship textures)
*
* Revision 1.23 2005/02/04 20:06:03 taylor
* merge with Linux/OSX tree - p0204-2
*
* Revision 1.22 2004/11/18 00:05:36 Goober5000
* #pragma'd a bunch of warnings
* --Goober5000
*
* Revision 1.21 2004/07/26 20:47:29 Kazan
* remove MCD complete
*
* Revision 1.20 2004/07/12 16:32:46 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 1.19 2004/07/09 22:05:32 Kazan
* fs2netd 1.0 RC5 full support - Rank and Medal updates
*
* Revision 1.18 2004/07/07 21:00:06 Kazan
* FS2NetD: C2S Ping/Pong, C2S Ping/Pong, Global IP Banlist, Global Network Messages
*
* Revision 1.17 2004/07/06 23:45:34 Kazan
* minor multi fix
*
* Revision 1.16 2004/05/25 00:21:39 wmcoolmon
* Updated to use <iostream> instead of <iostream.h>
*
* Revision 1.15 2004/03/31 05:42:26 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 1.14 2004/03/09 17:59:01 Kazan
* Disabled multithreaded TCP_Socket in favor of safer single threaded
* FS2NetD doesn't kill the game on connection failure now - just gives warning message and effectively dsiables itself until they try to connect again
@@ -62,7 +127,7 @@
*
* Revision 1.3 2003/10/13 05:57:47 Kazan
* Removed a bunch of Useless *_printf()s in the rendering pipeline that were just slowing stuff down
* Commented out the "warning null vector in vector normalize" crap since we don't give a rats arse
* Commented out the "warning null vector in vector normalize" crap
* Added "beam no whack" flag for beams - said beams NEVER whack
* Some reliability updates in FS2NetD
*
@@ -70,19 +135,25 @@
*
*/
#ifndef NO_NETWORK
// 4018 = signed/unsigned mismatch
// 4663 = new template specification syntax
// 4245 = signed/unsigned mismatch in conversion of const value
#pragma warning(disable: 4663 4018 4663 4245)
// 4711 = function selected for automatic inline expansion
#pragma warning(disable: 4663 4018 4663 4245 4711)
#include "Client.h"
#include "protocol.h"
#include "TCP_Socket.h"
#include <iostream.h>
#include <iostream>
#include "fs2open_pxo/Client.h"
#include "fs2open_pxo/protocol.h"
#include "fs2open_pxo/TCP_Socket.h"
#include "network/multi_log.h"
#include "playerman/player.h"
#include "ship/ship.h"
#include <time.h>
#include "network/multi_log.h"
#include "io/timer.h"
#define PXO_ADDINT(n) *((int *)cur) = (n); cur += sizeof(int);
@@ -98,8 +169,7 @@ int CheckSingleMission(const char* mission, unsigned int crc32, TCP_Socket &Sock
// Clear any old dead crap data
Socket.IgnorePackets();
timeout = timeout * CLK_TCK;
int starttime = clock();
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
std::string sender = masterserver;
@@ -113,12 +183,12 @@ int CheckSingleMission(const char* mission, unsigned int crc32, TCP_Socket &Sock
if (Socket.SendData((char *) &checkpack, sizeof(fs2open_file_check_single)) == -1)
return NULL;
return -1;
fs2open_fcheck_reply c_reply;
while ((clock() - starttime) <= timeout)
while ( timer_get_fixed_seconds() <= end_time )
{
if (Socket.DataReady() && Socket.GetData((char *) &c_reply, sizeof(fs2open_fcheck_reply)) != -1)
@@ -148,25 +218,23 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
// Clear any old dead crap data
Socket.IgnorePackets();
timeout = timeout * CLK_TCK;
int starttime = clock();
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
std::string sender = masterserver;
char PacketBuffer[16384]; // 16K should be enough i think..... I HOPE!
memset(PacketBuffer,0, 16384);
// char *cur = PacketBuffer;
fs2open_pilot_update *p_update = (fs2open_pilot_update *) PacketBuffer;
fs2open_ship_typekill *type_kills = (fs2open_ship_typekill *) (PacketBuffer + (sizeof(fs2open_pilot_update) - sizeof(fs2open_ship_typekill *)));
fs2open_ship_typekill *type_kills = (fs2open_ship_typekill *) (PacketBuffer + 204);
int *medals = (int*)(PacketBuffer + 204 + (sizeof(fs2open_ship_typekill) * MAX_SHIP_TYPES));
p_update->pid = PCKT_PILOT_UPDATE;
p_update->pid = PCKT_PILOT_UPDATE2;
p_update->sid = SID;
strncpy(p_update->name, player_name, 65);
@@ -186,29 +254,38 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
p_update->SecHits = pl->stats.s_shots_hit;
p_update->SecFHits = pl->stats.s_bonehead_hits;
p_update->ship_types = MAX_SHIP_TYPES;
p_update->num_medals = MAX_MEDALS;
p_update->rank = pl->stats.rank;
for (int i = 0; i < MAX_SHIP_TYPES; i++)
int i;
for (i = 0; i < MAX_SHIP_TYPES; i++)
{
strncpy(type_kills[i].name, Ship_info[i].name, 32);
type_kills[i].kills = pl->stats.kills[i];
}
for (i = 0; i < MAX_MEDALS; i++)
{
medals[i] = pl->stats.medals[i];
}
int packet_size = 194; // size of all the ints only
int packet_size = 204; // size of all the ints only
packet_size += sizeof(fs2open_ship_typekill) * MAX_SHIP_TYPES; // add the size of the ship_kills array
packet_size += sizeof(int) * MAX_MEDALS; // add the size of the ship_kills array
// send Packet
if (Socket.SendData(PacketBuffer, packet_size) == -1)
return NULL;
return -1;
fs2open_pilot_updatereply u_reply;
while ((clock() - starttime) <= timeout)
while ( timer_get_fixed_seconds() <= end_time )
{
if (Socket.DataReady() && Socket.GetData((char *) &u_reply, sizeof(fs2open_pilot_updatereply)) != -1)
if (Socket.DataReady() && (Socket.GetData((char *) &u_reply, sizeof(fs2open_pilot_updatereply)) != -1))
{
if (u_reply.pid != PCKT_PILOT_UREPLY) // ignore packet
@@ -238,10 +315,8 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
fs2open_get_pilot prq_packet;
timeout = timeout * CLK_TCK;
memset((char *) &prq_packet, 0, sizeof(fs2open_get_pilot));
prq_packet.pid = PCKT_PILOT_GET;
prq_packet.pid = PCKT_PILOT_GET2;
prq_packet.sid = SID;
strncpy(prq_packet.pilotname, player_name, 64);
prq_packet.create = CanCreate;
@@ -250,23 +325,23 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
// send Packet
if (Socket.SendData((char *)&prq_packet, sizeof(fs2open_get_pilot)) == -1)
return NULL;
return -1;
char PacketBuffer[16384]; // 16K should be enough i think..... I HOPE!
fs2open_pilot_reply *p_reply = (fs2open_pilot_reply *) PacketBuffer;
memset(PacketBuffer, 0, 16384);
fs2open_ship_typekill *type_kills = (fs2open_ship_typekill *) (PacketBuffer + sizeof(fs2open_pilot_reply) - sizeof(fs2open_ship_typekill *));
fs2open_ship_typekill *type_kills = (fs2open_ship_typekill *) (PacketBuffer + 72);
int *medals = NULL; //(int*)(PacketBuffer+72+(sizeof(fs2open_ship_typekill) * pilotrep.ship_types));
int CheckSize = sizeof(fs2open_pilot_reply) - sizeof(fs2open_ship_typekill *) - 2; //2 for the weird stinking msvc stuff
int CheckSize = 72, i;
int recvsize = 0, rs2;
Sleep(2); // give them a second
int starttime = clock();
while ((clock() - starttime) <= timeout)
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
while ( timer_get_fixed_seconds() <= end_time )
{
if (Socket.DataReady() && (recvsize = Socket.GetData((char *) &PacketBuffer, 16384)) != -1)
if (Socket.DataReady() && ((recvsize = Socket.GetData((char *) &PacketBuffer, 16384)) != -1))
{
if (p_reply->pid != PCKT_PILOT_REPLY) // ignore packet
@@ -274,10 +349,13 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
continue;
}
CheckSize += sizeof(fs2open_ship_typekill) * p_reply->ship_types;
if (p_reply->replytype == 0)
CheckSize += (sizeof(fs2open_ship_typekill) * p_reply->ship_types) + (sizeof(int) * p_reply->num_medals);
else
CheckSize = 8;
ml_printf("Precompletion Pilot Update: CheckSize = %d, recvsize = %d", CheckSize, recvsize);
while (CheckSize - recvsize > 0 && (clock() - starttime) <= timeout)
while (CheckSize - recvsize > 0 && timer_get_fixed_seconds() <= end_time)
{
if (Socket.DataReady())
{
@@ -289,13 +367,14 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
ml_printf("PostCompletion Tables Get: CheckSize = %u, recvsize = %u", CheckSize, recvsize);
// if we timed out
if ((clock() - starttime) >= timeout)
if ( timer_get_fixed_seconds() >= end_time )
{
ml_printf("Pilot Update completetion timed out");
break;
}
medals = (int*)(PacketBuffer+72+(sizeof(fs2open_ship_typekill) * p_reply->ship_types));
if (p_reply->replytype > 1)
@@ -315,6 +394,7 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
pl->stats.s_shots_fired = p_reply->SecShots;
pl->stats.s_shots_hit = p_reply->SecHits;
pl->stats.s_bonehead_hits = p_reply->SecFHits;
pl->stats.rank = p_reply->rank;
if (p_reply->ship_types == 0)
@@ -322,12 +402,22 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
else
{
// i should really assert p_reply->ship_types == MAX_SHIP_TYPES
for (int i = 0; i < MAX_SHIP_TYPES && p_reply->ship_types; i++)
for (i = 0; i < MAX_SHIP_TYPES && p_reply->ship_types; i++)
{
pl->stats.kills[i] = type_kills[i].kills;
}
}
if (p_reply->num_medals == 0)
memset(pl->stats.medals, 0, sizeof(int) * MAX_MEDALS);
else
{
// i should really assert p_reply->ship_types == MAX_SHIP_TYPES
for (i = 0; i < MAX_MEDALS && p_reply->num_medals; i++)
{
pl->stats.medals[i] = medals[i];
}
}
// ignored on load... fs2 doesn't need this
// type_kills[index].name[65] = Ship_info[index].name[32]
@@ -342,7 +432,85 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
return -1;
}
//**************************************************************************************************************************************************
fs2open_banmask* GetBanList(int &numBanMasks, TCP_Socket &Socket, int timeout)
{
// Clear any old dead crap data
Socket.IgnorePackets();
fs2open_banlist_request br_packet;
br_packet.pid = PCKT_BANLIST_RQST;
br_packet.reserved = 0;
//std::string sender = masterserver;
// send Packet
if (Socket.SendData((char *)&br_packet, sizeof(fs2open_banlist_request)) == -1)
return NULL;
char PacketBuffer[16384]; // 16K should be enough i think..... I HOPE!
fs2open_banlist_reply *banreply_ptr = (fs2open_banlist_reply *) PacketBuffer;
fs2open_banmask *masks = NULL;
numBanMasks = 0;
Sleep(1); //lets give them a second
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
int recvsize = 0, rs2;
int CheckSize = sizeof(int) * 2;
while ( timer_get_fixed_seconds() <= end_time )
{
if (Socket.DataReady() && ((recvsize = Socket.GetData(PacketBuffer, 16384)) != -1))
{
if (banreply_ptr->pid != PCKT_BANLIST_RPLY)
{
continue; // skip and ignore this packet
}
CheckSize += banreply_ptr->num_ban_masks * sizeof(fs2open_banmask);
ml_printf("Precompletion Table Get: CheckSize = %d, recvsize = %d", CheckSize, recvsize);
while (CheckSize - recvsize > 0 && timer_get_fixed_seconds() <= end_time)
{
if (Socket.DataReady())
{
rs2 = Socket.GetData(PacketBuffer+recvsize, 16384-recvsize);
ml_printf("Banlist Completetion: Got Additional %u bytes", rs2);
recvsize += rs2;
}
}
ml_printf("PostCompletion Banlist Get: CheckSize = %u, recvsize = %u", CheckSize, recvsize);
if ( timer_get_fixed_seconds() >= end_time )
{
ml_printf("Banlist Transfer completetion timed out");
break;
}
masks = new fs2open_banmask[banreply_ptr->num_ban_masks];
memcpy(masks, PacketBuffer + 8, sizeof(fs2open_banmask) * banreply_ptr->num_ban_masks); // packet buffer will be two ints then the array;
numBanMasks = banreply_ptr->num_ban_masks;
return masks;
}
}
return NULL;
}
//**************************************************************************************************************************************************
@@ -355,8 +523,6 @@ file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket
fs2open_file_check fc_packet;
fc_packet.pid = PCKT_TABLES_RQST;
timeout = timeout * CLK_TCK;
std::string sender = masterserver;
// send Packet
@@ -370,15 +536,14 @@ file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket
numTables = 0;
Sleep(2); //lets give them a second
int starttime = clock();
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
int recvsize = 0, rs2;
int CheckSize = sizeof(int) * 2;
while ((clock() - starttime) <= timeout)
while ( timer_get_fixed_seconds() <= end_time )
{
if (Socket.DataReady() && (recvsize = Socket.GetData(PacketBuffer, 16384)) != -1)
if (Socket.DataReady() && ((recvsize = Socket.GetData(PacketBuffer, 16384)) != -1))
{
if (misreply_ptr->pid != PCKT_TABLES_REPLY)
{
@@ -389,7 +554,7 @@ file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket
CheckSize += misreply_ptr->num_files * sizeof(file_record);
ml_printf("Precompletion Table Get: CheckSize = %d, recvsize = %d", CheckSize, recvsize);
while (CheckSize - recvsize > 0 && (clock() - starttime) <= timeout)
while (CheckSize - recvsize > 0 && timer_get_fixed_seconds() <= end_time)
{
if (Socket.DataReady())
{
@@ -400,7 +565,7 @@ file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket
}
ml_printf("PostCompletion Tables Get: CheckSize = %u, recvsize = %u", CheckSize, recvsize);
if ((clock() - starttime) >= timeout)
if ( timer_get_fixed_seconds() >= end_time )
{
ml_printf("Tables Transfer completetion timed out");
break;
@@ -444,7 +609,6 @@ file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Soc
fs2open_file_check fc_packet;
fc_packet.pid = PCKT_MISSIONS_RQST;
timeout = timeout * CLK_TCK;
std::string sender = masterserver;
@@ -461,15 +625,16 @@ file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Soc
numMissions = 0;
//int depth = 0;
Sleep(2); // lets give it a second
int starttime = clock();
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
int recvsize = 0, rs2;
int CheckSize = sizeof(int) * 2;
while ((clock() - starttime) <= timeout)
while ( timer_get_fixed_seconds() <= end_time )
{
if (Socket.DataReady() && (recvsize = Socket.GetData(PacketBuffer, 16384)) != -1)
if (Socket.DataReady() && ((recvsize = Socket.GetData(PacketBuffer, 16384)) != -1))
{
if (misreply_ptr->pid != PCKT_MISSIONS_REPLY)
@@ -480,7 +645,7 @@ file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Soc
CheckSize += misreply_ptr->num_files * sizeof(file_record);
ml_printf("Precompletion Missions Get: CheckSize = %d, recvsize = %d", CheckSize, recvsize);
while (CheckSize - recvsize > 0 && (clock() - starttime) <= timeout)
while (CheckSize - recvsize > 0 && timer_get_fixed_seconds() <= end_time)
{
if (Socket.DataReady())
{
@@ -491,7 +656,7 @@ file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Soc
}
ml_printf("PostCompletion Missions Get: CheckSize = %u, recvsize = %u", CheckSize, recvsize);
if ((clock() - starttime) >= timeout)
if ( timer_get_fixed_seconds() >= end_time )
{
ml_printf("Missions Transfer completetion timed out");
break;
@@ -531,9 +696,6 @@ int Fs2OpenPXO_Login(const char* username, const char* password, TCP_Socket &Soc
// Clear any old dead crap data
Socket.IgnorePackets();
timeout = timeout * CLK_TCK;
int starttime = clock();
std::string sender = masterserver;
// create and send login packet
@@ -546,13 +708,16 @@ int Fs2OpenPXO_Login(const char* username, const char* password, TCP_Socket &Soc
if (Socket.SendData((char *) &loginpckt, sizeof(loginpckt)) == -1)
{
cout << "Error Sending Packet" << endl;
std::cout << "Error Sending Packet" << std::endl;
return -1;
}
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
// await reply
fs2open_pxo_lreply loginreply;
while ((clock() - starttime) <= timeout)
while ( timer_get_fixed_seconds() <= end_time )
{
if (Socket.DataReady() && Socket.GetData((char *)&loginreply, sizeof(fs2open_pxo_lreply)) != -1)
@@ -563,7 +728,9 @@ int Fs2OpenPXO_Login(const char* username, const char* password, TCP_Socket &Soc
}
if (loginreply.login_status == false)
{
return -1;
}
else
return loginreply.sid;
}
@@ -613,10 +780,7 @@ net_server* GetServerList(const char* masterserver, int &numServersFound, TCP_So
numServersFound = 0;
timeout = timeout * CLK_TCK;
int starttime = clock();
// ---------- Prepair and send request packet ------------
serverlist_request_packet rpack;
rpack.pid = PCKT_SLIST_REQUEST;
@@ -630,28 +794,32 @@ net_server* GetServerList(const char* masterserver, int &numServersFound, TCP_So
// ---------- Receive Reply ------------
serverlist_reply_packet NewServer;
net_server *retlist, templist[MAX_SERVERS];
net_server *retlist = NULL, templist[MAX_SERVERS];
while ((clock() - starttime) <= timeout)
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
while ( timer_get_fixed_seconds() <= end_time )
{
if (Socket.DataReady() && Socket.GetData((char *)&NewServer, sizeof(serverlist_reply_packet)) != -1)
if (Socket.DataReady() && Socket.GetData((char *)&NewServer, sizeof(serverlist_reply_packet)) == sizeof(serverlist_reply_packet))
{
if (!strcmp(NewServer.name, "TERM") && NewServer.flags == 0 && NewServer.players == 0)
{
starttime = 0;
break;
}
memcpy((char *)&templist[numServersFound], (char *)&NewServer, sizeof(serverlist_reply_packet));
numServersFound++;
}
if (numServersFound >= MAX_SERVERS) {
numServersFound = MAX_SERVERS;
break;
}
}
}
if (!numServersFound)
return NULL;
// ---------- Prepair and return list ------------
retlist = new net_server[numServersFound];
@@ -699,4 +867,19 @@ int GetPingReply(TCP_Socket &Socket)
Socket.GetData((char *)&rping, sizeof(fs2open_pingreply));
return int( float(clock() - rping.time)/2.0 );
}
}
//**************************************************************************************************************************************************
void SendPingReply(TCP_Socket &Socket, int tstamp)
{
fs2open_pingreply rping;
rping.pid = PCKT_PINGREPLY;
rping.time = tstamp;
Socket.SendData((char*)&rping, sizeof(rping));
}
#endif // !NO_NETWORK
+69 -11
View File
@@ -10,12 +10,43 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/TCP_Socket.cpp $
* $Revision: 1.9 $
* $Date: 2004-03-31 05:42:26 $
* $Revision: 1.16 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
*
* $Log: not supported by cvs2svn $
* Revision 1.15 2005/06/29 18:49:37 taylor
* various FS2NetD fixes:
* - replace timer stuff with something that more accurately works cross-platform and without being affected by load
* - better sanity checking for the server list
* - working Linux compatibility that's not dog slow
* - when calling DataReady() make sure that the data is properly valid
* - fix messed up cvs merge cleanup from the Linux merge which did nasty things
*
* Revision 1.14 2005/03/02 21:18:18 taylor
* better support for Inferno builds (in PreProcDefines.h now, no networking support)
* make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
* revert a timeout in Client.h back to the original value before Linux merge
*
* Revision 1.13 2005/02/04 20:06:03 taylor
* merge with Linux/OSX tree - p0204-2
*
* Revision 1.12 2004/11/18 00:05:36 Goober5000
* #pragma'd a bunch of warnings
* --Goober5000
*
* Revision 1.11 2004/07/26 20:47:29 Kazan
* remove MCD complete
*
* Revision 1.10 2004/07/12 16:32:46 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 1.9 2004/03/31 05:42:26 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 1.8 2004/03/09 17:59:01 Kazan
* Disabled multithreaded TCP_Socket in favor of safer single threaded
* FS2NetD doesn't kill the game on connection failure now - just gives warning message and effectively dsiables itself until they try to connect again
@@ -47,16 +78,30 @@
*
*/
#pragma warning(disable:4100) // unreferenced formal parameter
#pragma warning(disable:4511) // copy constructor could not be generated
#pragma warning(disable:4512) // assignment operator could not be generated
#pragma warning(disable:4711) // function selected for inlining
#include "TCP_Socket.h"
#ifndef NO_NETWORK
// 4100 = unreferenced formal parameter
// 4511 = copy constructor could not be generated
// 4512 = assignment operator could not be generated
// 4711 = function selected for inlining
#pragma warning(disable:4100 4511 4512 4711)
#include <iostream>
#ifdef SCP_UNIX
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#include "fs2open_pxo/TCP_Socket.h"
//#include <process.h>
//#include <iostream.h>
using namespace std;
//**************************************************************************
// TCP_Socket Implementation
//**************************************************************************
@@ -187,7 +232,7 @@ bool TCP_Socket::InitSocket(std::string rem_host, int rem_port)
if (connect(mySocket, (sockaddr *)&adr_inet, sizeof(sockaddr_in)) == -1)
{
cout << "Couldn't Connect to Remote system" << endl;
return fasle;
return false;
}
}
#endif
@@ -214,12 +259,16 @@ bool TCP_Socket::DataReady()
FD_ZERO(&recvs);
FD_SET(mySocket, &recvs);
#ifndef SCP_UNIX
int status = select(1, &recvs, NULL, NULL, &wait);
#else
int status = select(mySocket+1, &recvs, NULL, NULL, &wait);
#endif
#if defined(FS2_TCP_RMultithread)
return (status != 0 && status != SOCKET_ERROR) || this->MT_DataReady();
#else
return (status != 0 && status != SOCKET_ERROR);
return (status != 0 && status != SOCKET_ERROR && FD_ISSET(mySocket, &recvs));
#endif
}
@@ -251,7 +300,11 @@ bool TCP_Socket::OOBDataReady()
FD_ZERO(&recvs);
FD_SET(mySocket, &recvs);
#ifndef SCP_UNIX
int status = select(1, NULL, NULL, &recvs, &wait);
#else
int status = select(mySocket+1, NULL, NULL, &recvs, &wait);
#endif
return (status != 0 && status != SOCKET_ERROR);
}
@@ -363,8 +416,12 @@ STYPE TCP_Socket::AcceptConnections()
{
sockaddr_in adr_client;
int len = sizeof(sockaddr_in);
#ifndef SCP_UNIX
STYPE client = accept(mySocket, (sockaddr *) &adr_client, &len);
#else
STYPE client = accept(mySocket, (sockaddr *) &adr_client, (socklen_t*)&len);
#endif
return client; // some sort of error
}
@@ -409,3 +466,4 @@ bool TCP_Socket::AcceptConnections(sproc server_process)
#endif
#endif // !NO_NETWORK
+41 -30
View File
@@ -11,12 +11,34 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/TCP_Socket.h $
* $Revision: 1.6 $
* $Date: 2004-03-31 05:42:26 $
* $Revision: 1.11 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
*
* $Log: not supported by cvs2svn $
* Revision 1.10 2005/06/29 18:49:37 taylor
* various FS2NetD fixes:
* - replace timer stuff with something that more accurately works cross-platform and without being affected by load
* - better sanity checking for the server list
* - working Linux compatibility that's not dog slow
* - when calling DataReady() make sure that the data is properly valid
* - fix messed up cvs merge cleanup from the Linux merge which did nasty things
*
* Revision 1.9 2005/06/21 00:12:11 taylor
* add virtual destructor so that GCC4 can shut up
*
* Revision 1.8 2005/02/04 20:06:03 taylor
* merge with Linux/OSX tree - p0204-2
*
* Revision 1.7 2004/08/11 05:06:23 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 1.6 2004/03/31 05:42:26 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 1.5 2004/03/09 17:59:01 Kazan
* Disabled multithreaded TCP_Socket in favor of safer single threaded
* FS2NetD doesn't kill the game on connection failure now - just gives warning message and effectively dsiables itself until they try to connect again
@@ -31,6 +53,9 @@
*
*/
#if !defined(__TCP_SOCKET_H_)
#define __TCP_SOCKET_H_
// Enable Multithread
//#define MT_TCP_Socket
@@ -48,42 +73,25 @@
//#include <winsock2.h>
#if !defined(STYPE)
#define STYPE SOCKET
#else
#include <cstdio>
#include <stdlib.h>
#include <unistd.h>
#include <cerrno>
#include <string>
#endif
#include "globalincs/pstypes.h" // make sure _cdecl is defined correctly on *nix
#if !defined(CLOSEFUNC)
#define CLOSEFUNC closesocket
#endif
#else
// Unix Version
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string>
#if !defined(STYPE)
#define STYPE int
#define STYPE SOCKET
#endif
#if !defined(CLOSEFUNC)
#define CLOSEFUNC close
#endif
#endif
#if !defined(__TCP_SOCKET_H_)
#define __TCP_SOCKET_H_
// From UDP_Socket
int startWinsock();
@@ -99,6 +107,7 @@ class Generic_Socket
public:
Generic_Socket() : Initialized(false), port(0) {}
virtual ~Generic_Socket() {}
bool isInitialized() { return Initialized; }
void Close() { CLOSEFUNC(mySocket); Initialized = false; }
@@ -143,8 +152,9 @@ class TCP_Socket : public Generic_Socket
#endif
public:
TCP_Socket(int aport = 0, bool WillbeServer = false) : ServerMode(WillbeServer), Generic_Socket() { port = aport; }
~TCP_Socket()
// TCP_Socket(int aport = 0, bool WillbeServer = false) : ServerMode(WillbeServer), Generic_Socket() { port = aport; }
TCP_Socket(int aport = 0, bool WillbeServer = false) { ServerMode = WillbeServer; Generic_Socket::SetPort(aport); }
virtual ~TCP_Socket()
{
#if defined(FS2_TCP_RMultithread)
@@ -207,4 +217,5 @@ class TCP_Socket : public Generic_Socket
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#endif
#endif // __TCP_SOCKET_H_
+93 -6
View File
@@ -10,12 +10,29 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/protocol.h $
* $Revision: 1.11 $
* $Date: 2004-03-31 05:42:26 $
* $Revision: 1.16 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
*
* $Log: not supported by cvs2svn $
* Revision 1.15 2005/02/04 20:06:03 taylor
* merge with Linux/OSX tree - p0204-2
*
* Revision 1.14 2004/08/11 05:06:23 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 1.13 2004/07/09 22:05:32 Kazan
* fs2netd 1.0 RC5 full support - Rank and Medal updates
*
* Revision 1.12 2004/07/07 21:00:06 Kazan
* FS2NetD: C2S Ping/Pong, C2S Ping/Pong, Global IP Banlist, Global Network Messages
*
* Revision 1.11 2004/03/31 05:42:26 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 1.10 2004/03/07 23:07:20 Kazan
* [Incomplete] Readd of Software renderer so Standalone server works
*
@@ -39,6 +56,9 @@
#if !defined(__pxo_protocol_h_)
#define __pxo_protocol_h_
#include "globalincs/pstypes.h" // for _fs_time_t
#pragma warning(disable:4663) // new template specification syntax
#define PXO_PROTO_VER "1.2"
@@ -65,6 +85,17 @@
#define PCKT_MISSION_CHECK 0xF
#define PCKT_MCHECK_REPLY 0x10
#define PCKT_BANLIST_RQST 0x11
#define PCKT_BANLIST_RPLY 0x12
// this only goes from the server out
#define PCKT_NETOWRK_WALL 0x13
// more advanced version of this packet
// different ID's for backward compat
#define PCKT_PILOT_UPDATE2 0x14
#define PCKT_PILOT_GET2 0x15
#define FS2OPEN_PXO_PORT 12000
#define FS2OPEN_CLIENT_PORT FS2OPEN_PXO_PORT + 1
@@ -184,6 +215,7 @@ struct fs2open_pxo_missreply
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// ----- Pilot Management -----
@@ -191,6 +223,7 @@ struct fs2open_pxo_missreply
struct fs2open_get_pilot
{
int pid; // 0x9 ( PCKT_PILOT_GET )
// 0x15 (PCKT_PILOT_GET2)
int sid; // session id returned upon login
char pilotname[65];
bool create; // create pilot
@@ -226,7 +259,18 @@ struct fs2open_pilot_reply
unsigned int SecFHits;
unsigned int ship_types;
// if request was a PCKT_PILOT_GET2
int rank;
int num_medals;
// ----------------------
fs2open_ship_typekill *type_kills;
// if request was a PCKT_PILOT_GET2
int *medals;
// ----------------------
};
@@ -234,7 +278,8 @@ struct fs2open_pilot_reply
struct fs2open_pilot_update
{
int pid; // 0x0B (PCKT_PILOT_UPDATE)
int sid; // session id
// 0x14 (PCKT_PILOT_UPDATE2)
int sid; //session id
char name[65];
char user[65];
@@ -253,10 +298,22 @@ struct fs2open_pilot_update
unsigned int SecShots;
unsigned int SecHits;
unsigned int SecFHits;
unsigned int ship_types;
fs2open_ship_typekill *type_kills;
unsigned int ship_types;
// if PCKT_PILOT_UPDATE2
int rank;
int num_medals;
// ----------------------
// added with update2.. but always been there TYVM MSVC
short reserved; // realign to 4-byte boundry --- MSVC does this automagically.. let's force it
fs2open_ship_typekill *type_kills;
// if PCKT_PILOT_UPDATE2
int *medals;
// ----------------------
};
@@ -268,6 +325,7 @@ struct fs2open_pilot_updatereply
};
// ---------------- Generic Ping -----------------
// ping time is in ticks returned by clock()
@@ -283,5 +341,34 @@ struct fs2open_pingreply
int time;
};
// ---------------- Banlist Packets -----------------
struct fs2open_banlist_request
{
int pid; // 0x11 (PCKT_BANLIST_RQST)
int reserved;
};
struct fs2open_banmask
{
char ip_mask[16]; // up to 15 chars (123.123.123.123) and a NULL
};
struct fs2open_banlist_reply
{
int pid; // 0x12 (PCKT_BANLIST_RPLY)
int num_ban_masks;
fs2open_banmask* masks;
};
// ---------------- Global Message Packet -----------------
struct fs2open_network_wall
{
int pid; // 0x13 (PCKT_NETOWRK_WALL)
char message[252];
};
#endif
+49 -14
View File
@@ -10,12 +10,31 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/udpsocket.cpp $
* $Revision: 1.5 $
* $Date: 2004-03-31 05:42:26 $
* $Revision: 1.10 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
*
* $Log: not supported by cvs2svn $
* Revision 1.9 2005/03/02 21:18:18 taylor
* better support for Inferno builds (in PreProcDefines.h now, no networking support)
* make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
* revert a timeout in Client.h back to the original value before Linux merge
*
* Revision 1.8 2005/02/04 20:06:03 taylor
* merge with Linux/OSX tree - p0204-2
*
* Revision 1.7 2004/07/26 20:47:29 Kazan
* remove MCD complete
*
* Revision 1.6 2004/07/12 16:32:46 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 1.5 2004/03/31 05:42:26 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 1.4 2004/02/21 00:59:43 Kazan
* FS2NETD License Comments
*
@@ -31,10 +50,27 @@
*
*/
#ifndef NO_NETWORK
#pragma warning(disable:4710) // function not inlined
#pragma warning(disable:4711) // function inlined
#include "udpsocket.h"
#include <iostream>
#ifdef SCP_UNIX
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#include "fs2open_pxo/udpsocket.h"
using namespace std;
#if defined(WIN32)
//*******************************************************************************
@@ -83,14 +119,14 @@ bool UDP_Socket::InitSocket()
this->socket = ::socket(AF_INET, SOCK_DGRAM, 0);
if (this->socket == -1)
{
Out << "Couldn't Get Socket (" << strerror(errno) << ")" << endl;
cout << "Couldn't Get Socket (" << strerror(errno) << ")" << endl;
return false;
}
if (bind(this->socket, (sockaddr *)&adr_inet, sizeof(adr_inet)) == -1)
{
Out << "Couldn't Bind Socket" << endl;
cout << "Couldn't Bind Socket" << endl;
return false;
}
@@ -118,25 +154,23 @@ int UDP_Socket::GetPacket(char *buffer, int blen, std::string &from)
int recvbytes = -1;
int from_size = sizeof(from_addr);
#if defined(WIN32)
timeval wait;
wait.tv_sec = 0;
wait.tv_usec = 1;
fd_set recvs;
recvs.fd_count = 1;
recvs.fd_array[0] = this->socket;
FD_ZERO(&recvs);
FD_SET(this->socket, &recvs);
int status = select(NULL, &recvs, NULL, NULL, &wait);
int status = select(-1, &recvs, NULL, NULL, &wait);
if (status != 0 && status != SOCKET_ERROR)
#if defined(WIN32)
recvbytes = recvfrom(this->socket, buffer, blen, 0, (sockaddr *)&from_addr, &from_size);
#else
// +#@$++#@$+ +#@$++#@$+ CRITICAL FIX REQURED +#@$++#@$+ +#@$++#@$+
// FIX THIS FOR IT NOT TO BLOCK LIKE I DID ON WINDOWS!
// +#@$++#@$+ +#@$++#@$+ CRITICAL FIX REQURED +#@$++#@$+ +#@$++#@$+
recvbytes = recvfrom(this->socket, buffer, blen, 0, (sockaddr *)&from_addr, (socklen_t *)&from_size);
recvbytes = recvfrom(this->socket, buffer, blen, 0, (sockaddr *)&from_addr, (socklen_t *)&from_size);
#endif
from = inet_ntoa(from_addr.sin_addr);
return recvbytes;
@@ -163,3 +197,4 @@ int UDP_Socket::SendPacket(char *buffer, int plen, std::string &to, int toport)
return sent;
}
#endif // !NO_NETWORK
+23 -13
View File
@@ -10,12 +10,23 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/udpsocket.h $
* $Revision: 1.4 $
* $Date: 2004-03-31 05:42:26 $
* $Revision: 1.7 $
* $Date: 2005-07-13 02:50:49 $
* $Author: Goober5000 $
*
*
* $Log: not supported by cvs2svn $
* Revision 1.6 2005/02/04 20:06:03 taylor
* merge with Linux/OSX tree - p0204-2
*
* Revision 1.5 2004/08/11 05:06:23 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 1.4 2004/03/31 05:42:26 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 1.3 2004/02/21 00:59:43 Kazan
* FS2NETD License Comments
*
@@ -29,8 +40,7 @@
#if !defined(__protocol_h_)
#define __protocol_h_
#if defined(WIN32)
// Windows Version
#ifdef _WIN32
#include <windows.h>
#pragma warning(push, 2) // ignore all those warnings for Microsoft stuff
@@ -42,19 +52,19 @@
#define CLOSEFUNC closesocket
#else
// Unix Version
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <cerrno>
#endif
#include <string>
#define STYPE int
#define CLOSEFUNC close
#include "globalincs/pstypes.h"
#define CLOSEFUNC closesocket
#if !defined(STYPE)
#define STYPE SOCKET
#endif
class UDP_Socket
+33 -10
View File
@@ -9,13 +9,35 @@
/*
* $Logfile: /Freespace2/code/GameHelp/ContextHelp.cpp $
* $Revision: 2.4 $
* $Date: 2004-03-08 22:02:38 $
* $Author: Kazan $
* $Revision: 2.11 $
* $Date: 2005-07-18 03:44:00 $
* $Author: taylor $
*
* Functions to drive the context-sensitive help
*
* $Log: not supported by cvs2svn $
* Revision 2.10 2005/05/12 17:49:11 taylor
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
* fixes various problems and is past time to make the switch
*
* Revision 2.9 2005/04/24 02:39:36 wmcoolmon
* Context help fixing goodness
*
* Revision 2.8 2005/04/05 05:53:16 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
* Revision 2.7 2005/01/29 08:05:31 wmcoolmon
* Update to work with optimized shader func
*
* Revision 2.6 2004/07/26 20:47:30 Kazan
* remove MCD complete
*
* Revision 2.5 2004/07/12 16:32:47 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.4 2004/03/08 22:02:38 Kazan
* Lobby GUI screen restored
*
* Revision 2.3 2004/03/05 09:01:58 Goober5000
* Uber pass at reducing #includes
* --Goober5000
@@ -132,6 +154,7 @@
#include "globalincs/systemvars.h"
////////////////////////////////////////////////////////////////////
// private function prototypes / structs
////////////////////////////////////////////////////////////////////
@@ -145,8 +168,8 @@ typedef struct {
} help_line;
typedef struct {
vector vtx[HELP_MAX_PLINE_VERTICES];
vector *pvtx[HELP_MAX_PLINE_VERTICES];
vec3d vtx[HELP_MAX_PLINE_VERTICES];
vec3d *pvtx[HELP_MAX_PLINE_VERTICES];
int vtxcount;
} help_pline;
@@ -271,15 +294,15 @@ void help_overlay_reset_all()
// Set up Grey_shader, which is used game-wide to grey out background when using help overlays
void create_grey_shader()
{
float tmp,c;
/*float tmp,c;
tmp = 0.4f/3.0f;
// The c matrix brightens everything a bit.
// c = 0.125f;
c = 0.110f;
c = 0.110f;*/
gr_create_shader( &Grey_shader, tmp, tmp, tmp, c );
gr_create_shader( &Grey_shader, 34, 34, 34, 168 );
}
// called at game startup to init all help related data
@@ -293,7 +316,7 @@ void context_help_init()
void context_help_grey_screen()
{
gr_set_shader(&Grey_shader);
gr_shade(0,0,gr_screen.clip_width, gr_screen.clip_height);
gr_shade(0,0,gr_screen.clip_width, gr_screen.clip_height, false);
}
// launch_context_help() will switch to a context sensitive help state
@@ -569,7 +592,7 @@ void parse_helptbl()
// get string (always use the GR_640 one)
stuff_string(buf, F_MESSAGE, NULL);
help_overlaylist[overlay_id].textlist[GR_640][currcount].string = strdup(buf);
help_overlaylist[overlay_id].textlist[GR_640][currcount].string = vm_strdup(buf);
//mprintf(("Found text %d on overlay %d - location (%d,%d) @ 640x480 :: location (%d,%d) @ 1024x768\n", currcount, overlay_id, help_overlaylist[overlay_id].textlist[GR_640][currcount].x_coord, help_overlaylist[overlay_id].textlist[GR_640][currcount].y_coord, help_overlaylist[overlay_id].textlist[GR_1024][currcount].x_coord, help_overlaylist[overlay_id].textlist[GR_1024][currcount].x_coord));
help_overlaylist[overlay_id].textcount++;
+20 -5
View File
@@ -9,13 +9,26 @@
/*
* $Logfile: /Freespace2/code/GameHelp/GameplayHelp.cpp $
* $Revision: 2.3 $
* $Date: 2004-03-05 09:01:58 $
* $Author: Goober5000 $
* $Revision: 2.7 $
* $Date: 2005-07-02 19:42:14 $
* $Author: taylor $
*
* Module for displaying in-game help
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2005/02/23 04:51:56 taylor
* some bm_unload() -> bm_release() changes to save bmpman slots
*
* Revision 2.5 2004/07/26 20:47:30 Kazan
* remove MCD complete
*
* Revision 2.4 2004/07/12 16:32:47 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.3 2004/03/05 09:01:58 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.2 2003/03/18 10:07:02 unknownplayer
* The big DX/main line merge. This has been uploaded to the main CVS since I can't manage to get it to upload to the DX branch. Apologies to all who may be affected adversely, but I'll work to debug it as fast as I can.
*
@@ -141,6 +154,8 @@
#include "weapon/beam.h"
#include "sound/audiostr.h"
// text positioning constats
#define TITLE_Y 35
#define Y_START 70
@@ -325,7 +340,7 @@ void gameplay_help_init()
}
common_set_interface_palette("InterfacePalette"); // set the interface palette
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Ui_window.set_mask_bmap(Game_help_mask_filename[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
@@ -948,7 +963,7 @@ void gameplay_help_close()
{
if ( Gameplay_help_inited ) {
if (Background_bitmap >= 0) {
bm_unload(Background_bitmap);
bm_release(Background_bitmap);
}
Ui_window.destroy();
+9 -3
View File
@@ -9,13 +9,19 @@
/*
* $Logfile: /Freespace2/code/GameHelp/GameplayHelp.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:22 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2005-07-13 02:50:50 $
* $Author: Goober5000 $
*
* Header for displaying in-game help
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2004/08/11 05:06:23 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:07 mharris
* Initial checkin - converted filenames and includes to lower case
*
+23 -3
View File
@@ -9,13 +9,27 @@
/*
* $Logfile: /Freespace2/code/GameSequence/GameSequence.cpp $
* $Revision: 2.3 $
* $Date: 2004-05-03 21:22:20 $
* $Author: Kazan $
* $Revision: 2.7 $
* $Date: 2005-03-25 06:57:33 $
* $Author: wmcoolmon $
*
* File to control Game Sequencing
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2005/03/03 06:05:27 wmcoolmon
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
*
* Revision 2.5 2004/07/26 20:47:30 Kazan
* remove MCD complete
*
* Revision 2.4 2004/07/12 16:32:47 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.3 2004/05/03 21:22:20 Kazan
* Abandon strdup() usage for mod list processing - it was acting odd and causing crashing on free()
* Fix condition where alt_tab_pause() would flipout and trigger failed assert if game minimizes during startup (like it does a lot during debug)
* Nav Point / Auto Pilot code (All disabled via #ifdefs)
*
* Revision 2.2 2004/03/05 09:02:03 Goober5000
* Uber pass at reducing #includes
* --Goober5000
@@ -253,6 +267,8 @@
#include "gamesequence/gamesequence.h"
#include "globalincs/pstypes.h"
// local defines
#define MAX_GAMESEQ_EVENTS 20 // maximum number of events on the game sequencing queue
#define GS_STACK_SIZE 10 // maximum number of stacked states
@@ -350,6 +366,8 @@ char *GS_event_text[] =
"GS_EVENT_RED_ALERT",
"GS_EVENT_SIMULATOR_ROOM",
"GS_EVENT_EMD_CAMPAIGN",
"GS_EVENT_LAB",
"GS_EVENT_STORYBOOK", //75
};
//XSTR:ON
@@ -416,6 +434,8 @@ char *GS_state_text[] =
"GS_STATE_CMD_BRIEF",
"GS_STATE_RED_ALERT",
"GS_STATE_END_OF_CAMPAIGN",
"GS_STATE_FRED_CONCEPT",
"GS_STATE_STORYBOOK",
};
//XSTR:ON
+21 -3
View File
@@ -9,13 +9,27 @@
/*
* $Logfile: /Freespace2/code/GameSequence/GameSequence.h $
* $Revision: 2.4 $
* $Date: 2004-05-03 21:22:20 $
* $Author: Kazan $
* $Revision: 2.8 $
* $Date: 2005-07-13 02:50:53 $
* $Author: Goober5000 $
*
* Header file for Game Sequencing items
*
* $Log: not supported by cvs2svn $
* Revision 2.7 2005/03/25 06:57:33 wmcoolmon
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
*
* Revision 2.6 2005/03/03 06:05:27 wmcoolmon
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
*
* Revision 2.5 2004/08/11 05:06:23 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.4 2004/05/03 21:22:20 Kazan
* Abandon strdup() usage for mod list processing - it was acting odd and causing crashing on free()
* Fix condition where alt_tab_pause() would flipout and trigger failed assert if game minimizes during startup (like it does a lot during debug)
* Nav Point / Auto Pilot code (All disabled via #ifdefs)
*
* Revision 2.3 2004/03/08 22:02:38 Kazan
* Lobby GUI screen restored
*
@@ -411,6 +425,8 @@
#define GS_EVENT_LOOP_BRIEF 61 // campaign loop brief
#define GS_EVENT_CAMPAIGN_CHEAT 62 // skip to a mission in a campaign
#define GS_EVENT_NET_CHAT 63 // #Kazan# - Go to net chat for Fs2NetD
#define GS_EVENT_LAB 64 // WMC - I-FRED concept
#define GS_EVENT_STORYBOOK 65 // WMC - the storybook
// IMPORTANT: When you add a new event, update the initialization for GS_event_text[]
// which is done in GameSequence.cpp
@@ -471,6 +487,8 @@ extern char *GS_event_text[]; // text description for the GS_EVENT_* #defines a
#define GS_STATE_END_DEMO 48 // end of demo campaign (upsell then main menu)
#define GS_STATE_LOOP_BRIEF 49
#define GS_STATE_NET_CHAT 50 // #Kazan# - state for the pxo chat readded by penguin
#define GS_STATE_LAB 51
#define GS_STATE_STORYBOOK 52
// IMPORTANT: When you add a new state, update the initialization for GS_state_text[]
// which is done in GameSequence.cpp
+216 -111
View File
@@ -9,13 +9,66 @@
/*
* $Logfile: /Freespace2/code/Gamesnd/EventMusic.cpp $
* $Revision: 2.9 $
* $Date: 2004-03-05 09:02:00 $
* $Revision: 2.23 $
* $Date: 2005-08-24 07:20:36 $
* $Author: Goober5000 $
*
* C module for high-level control of event driven music
*
* $Log: not supported by cvs2svn $
* Revision 2.22 2005/07/20 02:37:32 taylor
* move the "none.wav" init to event_music_init() so it only runs through once (fixes no mission music when modular tbls are used)
*
* Revision 2.21 2005/06/30 01:48:52 Goober5000
* * NOX'd none.wav
* * changed comparisons on none.wav to only look at the first four letters in case
* we don't have an extension or in case some weirdo decides to put none.ogg
* * simulated speech pre-empts "beeps" in in-game messages
* --Goober5000
*
* Revision 2.20 2005/04/25 00:22:34 wmcoolmon
* Added parse_sound; replaced Assert() with an if() (The latter may not be a good idea, but it keeps missions from being un-debuggable)
*
* Revision 2.19 2005/03/27 12:28:32 Goober5000
* clarified max hull/shield strength names and added ship guardian thresholds
* --Goober5000
*
* Revision 2.18 2005/02/23 05:05:39 taylor
* compiler warning fixes (for MSVC++ 6)
* have the warp effect only load as many LODs as will get used
* head off strange bug in release when corrupt soundtrack number gets used
* (will still Assert in debug)
* don't ever try and save a campaign savefile in multi or standalone modes
* first try at 32bit->16bit color conversion for TGA code (for TGA only ship textures)
*
* Revision 2.17 2005/01/18 01:14:17 wmcoolmon
* OGG fixes, ship selection fixes
*
* Revision 2.16 2004/12/25 16:42:59 wmcoolmon
* Fix to modular tables workaround with Fs2NetD
*
* Revision 2.15 2004/12/11 09:03:08 wmcoolmon
* Changed music modular table ending to *-mus.tbm, in case a miscellaneous modular table is needed.
*
* Revision 2.14 2004/07/26 20:47:30 Kazan
* remove MCD complete
*
* Revision 2.13 2004/07/17 09:26:00 taylor
* add CF_SORT_REVERSE to real sort routine, makes CF_SORT_TIME work again
*
* Revision 2.12 2004/07/12 16:32:47 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.11 2004/06/18 04:59:54 wmcoolmon
* Only used weapons paged in instead of all, fixed music box in FRED, sound quality settable with SoundSampleRate and SoundSampleBits registry values
*
* Revision 2.10 2004/05/28 23:37:30 wmcoolmon
* Modular music tables
*
* Revision 2.9 2004/03/05 09:02:00 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.8 2004/02/08 03:35:08 Goober5000
* fixed a small bug in FS1-compatible music
* --Goober5000
@@ -160,6 +213,8 @@
#include "localization/localize.h"
#include "parse/parselo.h"
#pragma optimize("", off)
#define DEFAULT_MASTER_EVENT_MUSIC_VOLUME 0.5f
@@ -186,7 +241,7 @@ typedef struct tagSNDPATTERN {
int handle; // handle to open audio stream
int force_pattern; // flag to indicate that we want to not continue loop, but go to next_pattern
int can_force; // whether this pattern can be interrupted
int bytes_per_measure; // number of bytes in a measure
int samples_per_measure; // number of bytes in a measure
float num_measures; // number of measures in wave file
} SNDPATTERN;
@@ -220,7 +275,7 @@ static int Current_soundtrack_fs1_style;
float Pattern_num_measures[MAX_SOUNDTRACKS][MAX_PATTERNS];
// stores the number of bytes per measure (data from music.tbl)
int Pattern_bytes_per_measure[MAX_SOUNDTRACKS][MAX_PATTERNS];
int Pattern_samples_per_measure[MAX_SOUNDTRACKS][MAX_PATTERNS];
char* Pattern_names[MAX_PATTERNS] =
{
@@ -381,19 +436,51 @@ int maybe_get_next_nrml_no_cycle(int pattern)
//
void event_music_init()
{
if ( snd_is_inited() == FALSE ) {
Event_music_enabled = FALSE;
return;
if(!Fred_running)
{
if ( snd_is_inited() == FALSE ) {
Event_music_enabled = FALSE;
return;
}
if ( Cmdline_freespace_no_music ) {
return;
}
if ( Event_music_inited == TRUE )
return;
}
if ( Cmdline_freespace_no_music ) {
return;
int i, j;
//MUST be called before parsing stuffzors.
Num_music_files = 0;
Num_soundtracks = 0; // Global
event_music_reset_choices();
// Goober5000 - clear all the filenames, so we're compatible with the extra NRMLs in FS1 music
for (i = 0; i < MAX_SOUNDTRACKS; i++)
{
for (j = 0; j < MAX_PATTERNS; j++)
{
strcpy(Soundtracks[i].pattern_fnames[j], NOX("none.wav"));
}
}
if ( Event_music_inited == TRUE )
return;
//Do teh parsing
event_music_parse_musictbl("music.tbl", false);
event_music_parse_musictbl();
char tbl_file_arr[MAX_TBL_PARTS][MAX_FILENAME_LEN];
char *tbl_file_names[MAX_TBL_PARTS];
int num_files = cf_get_file_list_preallocated(MAX_TBL_PARTS, tbl_file_arr, tbl_file_names, CF_TYPE_TABLES, "*-mus.tbm", CF_SORT_REVERSE);
for(i = 0; i < num_files; i++)
{
//HACK HACK HACK
modular_tables_loaded = true;
strcat(tbl_file_names[i], ".tbm");
event_music_parse_musictbl(tbl_file_names[i], true);
}
Event_music_inited = TRUE;
Event_music_begun = FALSE;
}
@@ -444,8 +531,8 @@ void event_music_force_switch()
// AL 06-24-99: maybe switch to battle 2 if hull is less than 70%
if (Player_obj != NULL && Player_ship != NULL) {
Assert(Player_ship->ship_info_index >= 0);
Assert(Player_ship->ship_initial_hull_strength != 0);
float integrity = Player_obj->hull_strength / Player_ship->ship_initial_hull_strength;
Assert(Player_ship->ship_max_hull_strength != 0);
float integrity = Player_obj->hull_strength / Player_ship->ship_max_hull_strength;
if (integrity < HULL_VALUE_TO_PLAY_INTENSE_BATTLE_MUSIC) {
new_pattern = SONG_BTTL_2;
}
@@ -465,7 +552,7 @@ void event_music_force_switch()
Assert(new_pattern >= 0 && new_pattern < MAX_PATTERNS);
audiostream_play(Patterns[new_pattern].handle, Master_event_music_volume, 0); // no looping
audiostream_set_byte_cutoff(Patterns[new_pattern].handle, fl2i(Patterns[new_pattern].num_measures * Patterns[new_pattern].bytes_per_measure) );
audiostream_set_sample_cutoff(Patterns[new_pattern].handle, fl2i(Patterns[new_pattern].num_measures * Patterns[new_pattern].samples_per_measure) );
Patterns[Current_pattern].next_pattern = Patterns[Current_pattern].default_next_pattern;
Patterns[Current_pattern].force_pattern = FALSE;
nprintf(("EVENTMUSIC", "EVENTMUSIC => switching to %s from %s\n", Pattern_names[new_pattern], Pattern_names[Current_pattern]));
@@ -494,10 +581,11 @@ void event_music_do_frame()
if ( timestamp_elapsed(Pattern_timer_id) ) {
Pattern_timer_id = 0;
Event_music_begun = TRUE;
if ( Current_pattern != -1 ) {
Assert(Patterns[Current_pattern].handle >= 0 );
if ( Current_pattern != -1 && Patterns[Current_pattern].handle >= 0) {
//WMC - removed in favor of if
//Assert(Patterns[Current_pattern].handle >= 0 );
audiostream_play(Patterns[Current_pattern].handle, Master_event_music_volume, 0); // no looping
audiostream_set_byte_cutoff(Patterns[Current_pattern].handle, fl2i(Patterns[Current_pattern].num_measures * Patterns[Current_pattern].bytes_per_measure) );
audiostream_set_sample_cutoff(Patterns[Current_pattern].handle, fl2i(Patterns[Current_pattern].num_measures * Patterns[Current_pattern].samples_per_measure) );
}
}
@@ -519,7 +607,7 @@ void event_music_do_frame()
pat->loop_for--;
if ( pat->loop_for > 0 ) {
audiostream_play(pat->handle, Master_event_music_volume, 0); // no looping
audiostream_set_byte_cutoff(Patterns[Current_pattern].handle, fl2i(Patterns[Current_pattern].num_measures * Patterns[Current_pattern].bytes_per_measure) );
audiostream_set_sample_cutoff(Patterns[Current_pattern].handle, fl2i(Patterns[Current_pattern].num_measures * Patterns[Current_pattern].samples_per_measure) );
}
else {
event_music_force_switch();
@@ -527,10 +615,10 @@ void event_music_do_frame()
}
// Third case: switching to a different track by interruption
else if ( (pat->force_pattern == TRUE && pat->can_force == TRUE) ) {
int bytes_streamed = audiostream_get_bytes_committed(pat->handle);
int measures_played = bytes_streamed / pat->bytes_per_measure;
int samples_streamed = audiostream_get_samples_committed(pat->handle);
int measures_played = samples_streamed / pat->samples_per_measure;
if ( measures_played < pat->num_measures ) {
audiostream_set_byte_cutoff(pat->handle, pat->bytes_per_measure * (measures_played+1) );
audiostream_set_sample_cutoff(pat->handle, pat->samples_per_measure * (measures_played+1) );
pat->force_pattern = FALSE;
pat->loop_for = 0;
}
@@ -625,6 +713,10 @@ void event_music_level_init(int force_soundtrack)
}
Assert(Current_soundtrack_num >= 0 && Current_soundtrack_num < Num_soundtracks);
if (Current_soundtrack_num < 0 || Current_soundtrack_num > Num_soundtracks)
return;
strack = &Soundtracks[Current_soundtrack_num];
// open the pattern files, and get ready to play them
@@ -634,7 +726,7 @@ void event_music_level_init(int force_soundtrack)
// the NRML_2 and NRML_3 at the end of the pattern array kept getting spurious music
// tracks because their patterns weren't -1
for ( i = 0; i < MAX_PATTERNS; i++ ) {
if ( !stricmp(NOX("none.wav"), strack->pattern_fnames[i]) ) {
if ( !strnicmp(strack->pattern_fnames[i], NOX("none.wav"), 4) ) {
Patterns[i].handle = -1;
continue;
}
@@ -652,7 +744,7 @@ void event_music_level_init(int force_soundtrack)
Patterns[i].default_loop_for = Pattern_loop_for[i];
Patterns[i].force_pattern = FALSE;
Patterns[i].can_force = Pattern_can_force[i];
Patterns[i].bytes_per_measure = Pattern_bytes_per_measure[Current_soundtrack_num][i];
Patterns[i].samples_per_measure = Pattern_samples_per_measure[Current_soundtrack_num][i];
Patterns[i].num_measures = Pattern_num_measures[Current_soundtrack_num][i];
}
@@ -665,7 +757,7 @@ void event_music_level_init(int force_soundtrack)
Check_for_battle_music = 0;
// Goober5000 - is this FS1 style?
Current_soundtrack_fs1_style = stristr(Soundtracks[Current_soundtrack_num].name, "fs1") ? 1 : 0;
Current_soundtrack_fs1_style = stristr(Soundtracks[Current_soundtrack_num].name, "FS1") ? 1 : 0;
if ( Event_music_level_inited ) {
if ( force_soundtrack != -1 ) {
@@ -843,8 +935,8 @@ int event_music_enemy_arrival()
bool play_intense_battle_music = false;
if (Player_obj != NULL && Player_ship != NULL) {
Assert(Player_ship->ship_info_index >= 0);
Assert(Player_ship->ship_initial_hull_strength != 0);
float integrity = Player_obj->hull_strength / Player_ship->ship_initial_hull_strength;
Assert(Player_ship->ship_max_hull_strength != 0);
float integrity = Player_obj->hull_strength / Player_ship->ship_max_hull_strength;
if (integrity < HULL_VALUE_TO_PLAY_INTENSE_BATTLE_MUSIC) {
play_intense_battle_music = true;
}
@@ -948,7 +1040,7 @@ int event_music_friendly_arrival()
// arrival music pattern, and this is it
Assert(Patterns[SONG_AARV_1].handle >= 0 );
audiostream_play(Patterns[SONG_AARV_1].handle, Master_event_music_volume, 0); // no looping
audiostream_set_byte_cutoff(Patterns[SONG_AARV_1].handle, fl2i(Patterns[SONG_AARV_1].num_measures * Patterns[SONG_AARV_1].bytes_per_measure) );
audiostream_set_sample_cutoff(Patterns[SONG_AARV_1].handle, fl2i(Patterns[SONG_AARV_1].num_measures * Patterns[SONG_AARV_1].samples_per_measure) );
}
}
@@ -1132,110 +1224,123 @@ int event_music_player_respawn_as_observer()
return 0;
}
void parse_soundtrack()
{
char fname[MAX_FILENAME_LEN];
char line_buf[128];
int num_patterns = 0;
required_string("#Soundtrack Start");
required_string("$SoundTrack Name:");
stuff_string(Soundtracks[Num_soundtracks].name, F_NAME, NULL);
while (required_string_either("#SoundTrack End","$Name:")) {
Assert( num_patterns < MAX_PATTERNS );
required_string("$Name:");
stuff_string(line_buf, F_NAME, NULL);
// line_buf holds 3 fields: filename, num measures, bytes per measure
char *token;
int count = 0;
token = strtok( line_buf, NOX(" ,\t"));
strcpy(fname, token);
while ( token != NULL ) {
token = strtok( NULL, NOX(" ,\t") );
if ( token == NULL ) {
Assert(count == 2 );
break;
}
if ( count == 0 ) {
Pattern_num_measures[Num_soundtracks][num_patterns] = (float)atof(token);
} else {
Pattern_samples_per_measure[Num_soundtracks][num_patterns] = atoi(token);
}
count++;
} // end while
// convert from samples per measure to bytes per measure
strcpy(Soundtracks[Num_soundtracks].pattern_fnames[num_patterns], fname);
num_patterns++;
}
required_string("#SoundTrack End");
Soundtracks[Num_soundtracks].num_patterns = num_patterns;
Num_soundtracks++;
}
void parse_menumusic()
{
char fname[MAX_FILENAME_LEN];
required_string("$Name:");
stuff_string(fname, F_PATHNAME, NULL);
Assert( strlen(fname) < (NAME_LENGTH-1) );
strcpy( Spooled_music[Num_music_files].name, fname );
required_string("$Filename:");
stuff_string(fname, F_PATHNAME, NULL);
if ( strnicmp(fname, NOX("none.wav"), 4) ) {
Assert( strlen(fname) < (MAX_FILENAME_LEN-1) );
strcpy( Spooled_music[Num_music_files].filename, fname );
}
Num_music_files++;
}
// -------------------------------------------------------------------------------------------------
// event_music_parse_musictbl() will parse the music.tbl file, and set up the Mission_songs[]
// array
//
void event_music_parse_musictbl()
void event_music_parse_musictbl(char* longname, bool is_chunk)
{
char fname[MAX_FILENAME_LEN];
char line_buf[128];
int rval, i, j;
int rval;
int num_patterns = 0;
// Goober5000 - clear all the filenames, so we're compatible with the extra NRMLs in FS1 music
for (i = 0; i < MAX_SOUNDTRACKS; i++)
{
for (j = 0; j < MAX_PATTERNS; j++)
{
strcpy(Soundtracks[i].pattern_fnames[j], "none.wav");
}
}
Num_music_files = 0;
Num_soundtracks = 0; // Global
event_music_reset_choices();
if ((rval = setjmp(parse_abort)) != 0) {
Error(LOCATION, "Unable to parse music.tbl! Code = %i.\n", rval);
Error(LOCATION, "Unable to parse %sl! Code = %i.\n", longname, rval);
} else {
// open localization
lcl_ext_open();
read_file_text("music.tbl");
read_file_text(longname);
reset_parse();
// Loop through all the sound-tracks
while (required_string_either("#Menu Music Start","#SoundTrack Start")) {
Assert(Num_soundtracks < MAX_SOUNDTRACKS);
required_string("#SoundTrack Start");
required_string("$SoundTrack Name:");
stuff_string(Soundtracks[Num_soundtracks].name, F_NAME, NULL);
while (required_string_either("#SoundTrack End","$Name:")) {
Assert( num_patterns < MAX_PATTERNS );
required_string("$Name:");
stuff_string(line_buf, F_NAME, NULL);
// line_buf holds 3 fields: filename, num measures, bytes per measure
char *token;
int count = 0;
token = strtok( line_buf, NOX(" ,\t"));
strcpy(fname, token);
while ( token != NULL ) {
token = strtok( NULL, NOX(" ,\t") );
if ( token == NULL ) {
Assert(count == 2 );
break;
}
if ( count == 0 ) {
Pattern_num_measures[Num_soundtracks][num_patterns] = (float)atof(token);
} else {
Pattern_bytes_per_measure[Num_soundtracks][num_patterns] = atoi(token);
}
count++;
} // end while
// convert from samples per measure to bytes per measure
Pattern_bytes_per_measure[Num_soundtracks][num_patterns] *= 2;
strcpy(Soundtracks[Num_soundtracks].pattern_fnames[num_patterns], fname);
num_patterns++;
if(!is_chunk)
{
// Loop through all the sound-tracks
while (required_string_either("#Menu Music Start","#SoundTrack Start")) {
Assert(Num_soundtracks < MAX_SOUNDTRACKS);
parse_soundtrack();
}
required_string("#SoundTrack End");
Soundtracks[Num_soundtracks].num_patterns = num_patterns;
Num_soundtracks++;
num_patterns = 0;
// Parse the menu music section
required_string("#Menu Music Start");
while (required_string_either("#Menu Music End","$Name:")) {
Assert( Num_music_files < MAX_SPOOLED_MUSIC );
parse_menumusic();
}
required_string("#Menu Music End");
}
// Parse the menu music section
required_string("#Menu Music Start");
while (required_string_either("#Menu Music End","$Name:")) {
Assert( Num_music_files < MAX_SPOOLED_MUSIC );
required_string("$Name:");
stuff_string(fname, F_PATHNAME, NULL);
Assert( strlen(fname) < (NAME_LENGTH-1) );
strcpy( Spooled_music[Num_music_files].name, fname );
required_string("$Filename:");
stuff_string(fname, F_PATHNAME, NULL);
if ( stricmp(fname, NOX("none.wav")) ) {
Assert( strlen(fname) < (MAX_FILENAME_LEN-1) );
strcpy( Spooled_music[Num_music_files].filename, fname );
else
{
// Loop through all the sound-tracks
while (required_string_either("#Menu Music Start","#SoundTrack Start")) {
Assert(Num_soundtracks < MAX_SOUNDTRACKS);
parse_soundtrack();
}
Num_music_files++;
// Parse the menu music section
if(optional_string("#Menu Music Start"))
{
while (required_string_either("#Menu Music End","$Name:")) {
Assert( Num_music_files < MAX_SPOOLED_MUSIC );
parse_menumusic();
}
required_string("#Menu Music End");
}
}
required_string("#Menu Music End");
// close localization
lcl_ext_close();
}
@@ -1417,7 +1522,7 @@ void event_music_unpause()
Assert( Current_pattern >= 0 && Current_pattern < MAX_PATTERNS );
if ( audiostream_is_paused(Patterns[Current_pattern].handle) == TRUE ) {
audiostream_play(Patterns[Current_pattern].handle, Master_event_music_volume, 0); // no looping
audiostream_set_byte_cutoff(Patterns[Current_pattern].handle, fl2i(Patterns[Current_pattern].num_measures * Patterns[Current_pattern].bytes_per_measure) );
audiostream_set_sample_cutoff(Patterns[Current_pattern].handle, fl2i(Patterns[Current_pattern].num_measures * Patterns[Current_pattern].samples_per_measure) );
}
}
+18 -5
View File
@@ -9,13 +9,26 @@
/*
* $Logfile: /Freespace2/code/Gamesnd/EventMusic.h $
* $Revision: 2.6 $
* $Date: 2004-03-05 09:02:00 $
* $Revision: 2.10 $
* $Date: 2005-07-13 02:50:51 $
* $Author: Goober5000 $
*
* Header file for high-level control of event driven music
*
* $Log: not supported by cvs2svn $
* Revision 2.9 2005/01/31 23:27:52 taylor
* merge with Linux/OSX tree - p0131-2
*
* Revision 2.8 2004/08/11 05:06:23 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.7 2004/05/28 23:37:30 wmcoolmon
* Modular music tables
*
* Revision 2.6 2004/03/05 09:02:00 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.5 2003/08/25 04:46:53 Goober5000
* added extra code to enable playing of FS1 music tracks
* --Goober5000
@@ -229,7 +242,7 @@ void event_music_enable();
void event_music_pause();
void event_music_unpause();
void event_music_set_volume_all(float volume);
void event_music_parse_musictbl();
void event_music_parse_musictbl(char* longname, bool is_chunk);
void event_music_change_pattern(int new_pattern);
int event_music_return_current_pattern();
void event_music_first_pattern();
@@ -256,8 +269,8 @@ void event_music_hostile_ship_destroyed();
#else
// Goober5000 - for NO_SOUND
#define maybe_get_next_nrml_no_cycle(int pattern) (0)
#define maybe_cycle_nrml(int pattern) (0)
#define maybe_get_next_nrml_no_cycle(pattern) (0)
#define maybe_cycle_nrml(pattern) (0)
#define event_music_init()
#define event_music_close()
+228 -34
View File
@@ -9,13 +9,77 @@
/*
* $Logfile: /Freespace2/code/Gamesnd/GameSnd.cpp $
* $Revision: 2.5 $
* $Date: 2004-04-26 00:25:08 $
* $Revision: 2.21 $
* $Date: 2005-09-16 08:11:39 $
* $Author: taylor $
*
* Routines to keep track of which sound files go where
*
* $Log: not supported by cvs2svn $
* Revision 2.20 2005/07/13 02:01:28 Goober5000
* fixed a bunch of "issues" caused by me with the species stuff
* --Goober5000
*
* Revision 2.19 2005/07/13 00:44:22 Goober5000
* improved species support and removed need for #define
* --Goober5000
*
* Revision 2.18 2005/06/30 01:48:52 Goober5000
* * NOX'd none.wav
* * changed comparisons on none.wav to only look at the first four letters in case
* we don't have an extension or in case some weirdo decides to put none.ogg
* * simulated speech pre-empts "beeps" in in-game messages
* --Goober5000
*
* Revision 2.17 2005/06/30 00:48:02 Goober5000
* if game_busy() is in gamesnd_preload_common_sounds() then it should
* also be in gamesnd_load_gameplay_sounds() I would expect
* --Goober5000
*
* Revision 2.16 2005/06/29 18:50:13 taylor
* little cleanup and error checking
*
* Revision 2.15 2005/06/19 02:29:54 taylor
* MIN Num_iface_sounds fix
*
* Revision 2.14 2005/06/07 06:34:30 wmcoolmon
* Hopefully this fixes something :)
*
* Revision 2.13 2005/06/01 09:35:42 taylor
* make sure that newly created entries are properly initialized
*
* Revision 2.12 2005/05/12 17:49:11 taylor
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
* fixes various problems and is past time to make the switch
*
* Revision 2.11 2005/04/25 00:22:34 wmcoolmon
* Added parse_sound; replaced Assert() with an if() (The latter may not be a good idea, but it keeps missions from being un-debuggable)
*
* Revision 2.10 2005/04/21 15:58:08 taylor
* initial changes to mission loading and status in debug builds
* - move bmpman page in init to an earlier stage to avoid unloading sexp loaded images
* - small changes to progress reports in debug builds so that it's easier to tell what's slow
* - initialize the loading screen before mission_parse() so that we'll be about to get a more accurate load time
* fix memory leak in gamesnd (yes, I made a mistake ;))
* make sure we unload models on game shutdown too
*
* Revision 2.9 2005/03/30 02:32:40 wmcoolmon
* Made it so *Snd fields in ships.tbl and weapons.tbl take the sound name
* as well as its index (ie "L_sidearm.wav" instead of "76")
*
* Revision 2.8 2005/03/24 23:31:46 taylor
* make sounds.tbl dynamic
* "filename" will never be larger than 33 chars so having it 260 is a waste (freespace.cpp)
*
* Revision 2.7 2004/07/26 20:47:30 Kazan
* remove MCD complete
*
* Revision 2.6 2004/07/12 16:32:47 Kazan
* MCD - define _MCD_CHECK to use memory tracking
*
* Revision 2.5 2004/04/26 00:25:08 taylor
* don't preload every sound (fixes some slowdowns), snd_preload option support
*
* Revision 2.4 2004/04/03 02:55:49 bobboau
* commiting recent minor bug fixes
*
@@ -188,15 +252,21 @@
#include "species_defs/species_defs.h"
#include "parse/parselo.h"
// Global array that holds data about the gameplay sound effects.
game_snd Snds[MAX_GAME_SOUNDS];
// Global array that holds data about the interface sound effects.
game_snd Snds_iface[MAX_INTERFACE_SOUNDS];
int Snds_iface_handle[MAX_INTERFACE_SOUNDS];
int Num_game_sounds = 0;
game_snd *Snds = NULL;
int Num_iface_sounds = 0;
game_snd *Snds_iface = NULL;
int *Snds_iface_handle = NULL;
#define GAME_SND 0
#define IFACE_SND 1
void gamesnd_add_sound_slot(int type, int num);
// flyby sounds - 2 for each species (fighter and bomber flybys)
game_snd Snds_flyby[MAX_SPECIES_NAMES][2];
game_snd Snds_flyby[MAX_SPECIES][2];
void gamesnd_play_iface(int n)
@@ -207,6 +277,46 @@ void gamesnd_play_iface(int n)
Snds_iface_handle[n] = snd_play(&Snds_iface[n]);
}
int gamesnd_get_by_name(char* name)
{
for(int i = 0; i < Num_game_sounds; i++)
{
if(!stricmp(Snds[i].filename, name))
{
return i;
}
}
return -1;
}
//Takes a tag, a sound index destination, and the object name being parsed
//tag and object_name are mostly so that we can debug stuff
//This also means you shouldn't use optional_string or required_string,
//just make sure the destination sound index can handle -1 if things
//don't work out.
void parse_sound(char* tag, int *idx_dest, char* object_name)
{
char buf[MAX_FILENAME_LEN];
int idx;
(*idx_dest) = -1;
if(optional_string(tag))
{
stuff_string(buf, F_NAME, NULL, MAX_FILENAME_LEN);
idx = gamesnd_get_by_name(buf);
if(idx != -1)
(*idx_dest) = idx;
else
(*idx_dest) = atoi(buf);
//Ensure sound is in range
if((*idx_dest) < -1 || (*idx_dest) >= Num_game_sounds)
{
Warning(LOCATION, "%s sound index out of range on '%s'. Must be between 0 and %d. Forcing to -1 (Nonexistant sound).\n", tag, object_name, Num_game_sounds);
}
}
}
// load in sounds that we expect will get played
//
// The method currently used is to load all those sounds that have the hardware flag
@@ -217,9 +327,9 @@ void gamesnd_preload_common_sounds()
int i;
game_snd *gs;
for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) {
for ( i = 0; i < Num_game_sounds; i++ ) {
gs = &Snds[i];
if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) {
if ( gs->filename[0] != 0 && strnicmp(gs->filename, NOX("none.wav"), 4) ) {
if ( gs->preload ) {
gs->id = snd_load(gs);
}
@@ -238,13 +348,14 @@ void gamesnd_load_gameplay_sounds()
int i;
game_snd *gs;
for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) {
for ( i = 0; i < Num_game_sounds; i++ ) {
gs = &Snds[i];
if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) {
if ( gs->filename[0] != 0 && strnicmp(gs->filename, NOX("none.wav"), 4) ) {
if ( !gs->preload ) { // don't try to load anything that's already preloaded
gs->id = snd_load(gs);
}
}
game_busy(); // Animate loading cursor... does nothing if loading screen not active.
}
}
@@ -258,7 +369,7 @@ void gamesnd_unload_gameplay_sounds()
int i;
game_snd *gs;
for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) {
for ( i = 0; i < Num_game_sounds; i++ ) {
gs = &Snds[i];
if ( gs->id != -1 ) {
snd_unload( gs->id );
@@ -277,9 +388,9 @@ void gamesnd_load_interface_sounds()
int i;
game_snd *gs;
for ( i = 0; i < MAX_INTERFACE_SOUNDS; i++ ) {
for ( i = 0; i < Num_iface_sounds; i++ ) {
gs = &Snds_iface[i];
if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) {
if ( gs->filename[0] != 0 && strnicmp(gs->filename, NOX("none.wav"), 4) ) {
gs->id = snd_load(gs);
}
}
@@ -295,7 +406,7 @@ void gamesnd_unload_interface_sounds()
int i;
game_snd *gs;
for ( i = 0; i < MAX_INTERFACE_SOUNDS; i++ ) {
for ( i = 0; i < Num_iface_sounds; i++ ) {
gs = &Snds_iface[i];
if ( gs->id != -1 ) {
snd_unload( gs->id );
@@ -330,6 +441,9 @@ void gamesnd_parse_line(game_snd *gs, char *tag)
gs->flags |= GAME_SND_USE_DS3D;
stuff_int(&gs->min);
stuff_int(&gs->max);
} else {
gs->min = 0;
gs->max = 0;
}
advance_to_eoln(NULL);
}
@@ -360,26 +474,27 @@ void gamesnd_parse_soundstbl()
// Parse the gameplay sounds section
required_string("#Game Sounds Start");
while (required_string_either("#Game Sounds End","$Name:")) {
Assert( num_game_sounds < MAX_GAME_SOUNDS);
Assert( num_game_sounds < Num_game_sounds);
gamesnd_parse_line( &Snds[num_game_sounds], "$Name:" );
num_game_sounds++;
gamesnd_add_sound_slot( GAME_SND, num_game_sounds );
}
required_string("#Game Sounds End");
// Parse the interface sounds section
required_string("#Interface Sounds Start");
while (required_string_either("#Interface Sounds End","$Name:")) {
Assert( num_iface_sounds < MAX_INTERFACE_SOUNDS);
Assert( num_iface_sounds < Num_iface_sounds);
gamesnd_parse_line(&Snds_iface[num_iface_sounds], "$Name:");
num_iface_sounds++;
gamesnd_add_sound_slot( IFACE_SND, num_iface_sounds );
}
required_string("#Interface Sounds End");
// parse flyby sound section
required_string("#Flyby Sounds Start");
#if defined(MORE_SPECIES)
char cstrtemp[SPECIES_NAME_MAXLEN+3];
char cstrtemp[NAME_LENGTH+3];
for (int i = 0; i < True_NumSpecies; i++)
{
@@ -387,18 +502,6 @@ void gamesnd_parse_soundstbl()
gamesnd_parse_line(&Snds_flyby[i][0], cstrtemp);
gamesnd_parse_line(&Snds_flyby[i][1], cstrtemp);
}
#else
// read 2 terran sounds
gamesnd_parse_line(&Snds_flyby[SPECIES_TERRAN][0], "$Terran:");
gamesnd_parse_line(&Snds_flyby[SPECIES_TERRAN][1], "$Terran:");
// 2 vasudan sounds
gamesnd_parse_line(&Snds_flyby[SPECIES_VASUDAN][0], "$Vasudan:");
gamesnd_parse_line(&Snds_flyby[SPECIES_VASUDAN][1], "$Vasudan:");
gamesnd_parse_line(&Snds_flyby[SPECIES_SHIVAN][0], "$Shivan:");
gamesnd_parse_line(&Snds_flyby[SPECIES_SHIVAN][1], "$Shivan:");
#endif
required_string("#Flyby Sounds End");
@@ -427,18 +530,57 @@ void gamesnd_init_sounds()
{
int i;
if (Snds == NULL) {
Snds = (game_snd *) vm_malloc (sizeof(game_snd) * MIN_GAME_SOUNDS);
Verify( Snds != NULL );
Num_game_sounds = MIN_GAME_SOUNDS;
}
Assert( Num_game_sounds > 0 );
// init the gameplay sounds
for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) {
for ( i = 0; i < Num_game_sounds; i++ ) {
gamesnd_init_struct(&Snds[i]);
}
if (Snds_iface == NULL) {
Snds_iface = (game_snd *) vm_malloc (sizeof(game_snd) * MIN_INTERFACE_SOUNDS);
Verify( Snds_iface != NULL );
Num_iface_sounds = MIN_INTERFACE_SOUNDS;
Assert( Snds_iface_handle == NULL );
Snds_iface_handle = (int *) vm_malloc (sizeof(int) * Num_iface_sounds);
Verify( Snds_iface_handle != NULL );
}
Assert( Num_iface_sounds > 0 );
// init the interface sounds
for ( i = 0; i < MAX_INTERFACE_SOUNDS; i++ ) {
for ( i = 0; i < Num_iface_sounds; i++ ) {
gamesnd_init_struct(&Snds_iface[i]);
Snds_iface_handle[i] = -1;
}
}
// close out gamesnd, ONLY CALL FROM game_shutdown()!!!!
void gamesnd_close()
{
if (Snds != NULL) {
vm_free(Snds);
Snds = NULL;
}
if (Snds_iface != NULL) {
vm_free(Snds_iface);
Snds_iface = NULL;
}
if (Snds_iface_handle != NULL) {
vm_free(Snds_iface_handle);
Snds_iface_handle = NULL;
}
}
// callback function for the UI code to call when the mouse first goes over a button.
void common_play_highlight_sound()
{
@@ -449,3 +591,55 @@ void gamesnd_play_error_beep()
{
gamesnd_play_iface(SND_GENERAL_FAIL);
}
void gamesnd_add_sound_slot(int type, int num)
{
const int increase_by = 5;
int i;
switch (type) {
case GAME_SND:
{
Assert( Snds != NULL );
Assert( num < (Num_game_sounds + increase_by) );
if (num >= Num_game_sounds) {
Snds = (game_snd *) vm_realloc (Snds, sizeof(game_snd) * (Num_game_sounds + increase_by));
Verify( Snds != NULL );
Num_game_sounds += increase_by;
// default all new entries
for (i = (Num_game_sounds - increase_by - 1); i < Num_game_sounds; i++) {
gamesnd_init_struct(&Snds[i]);
}
}
}
break;
case IFACE_SND:
{
Assert( Snds_iface != NULL );
Assert( num < (Num_game_sounds + increase_by) );
if (num >= Num_iface_sounds) {
Snds_iface = (game_snd *) vm_realloc (Snds_iface, sizeof(game_snd) * (Num_iface_sounds + increase_by));
Verify( Snds_iface != NULL );
Num_iface_sounds += increase_by;
Assert( Snds_iface_handle != NULL );
Snds_iface_handle = (int *) vm_realloc (Snds_iface_handle, sizeof(int) * Num_iface_sounds);
Verify( Snds_iface_handle != NULL );
// default all new entries
for (i = (Num_iface_sounds - increase_by - 1); i < Num_iface_sounds; i++) {
gamesnd_init_struct(&Snds_iface[i]);
Snds_iface_handle[i] = -1;
}
}
}
break;
default:
Int3();
}
}
+52 -17
View File
@@ -9,13 +9,45 @@
/*
* $Logfile: /Freespace2/code/Gamesnd/GameSnd.h $
* $Revision: 2.5 $
* $Date: 2004-03-12 16:23:49 $
* $Author: phreak $
* $Revision: 2.13 $
* $Date: 2005-07-13 02:50:51 $
* $Author: Goober5000 $
*
* Routines to keep track of which sound files go where
*
* $Log: not supported by cvs2svn $
* Revision 2.12 2005/07/13 00:44:22 Goober5000
* improved species support and removed need for #define
* --Goober5000
*
* Revision 2.11 2005/06/29 18:50:13 taylor
* little cleanup and error checking
*
* Revision 2.10 2005/04/25 00:22:34 wmcoolmon
* Added parse_sound; replaced Assert() with an if() (The latter may not be a good idea, but it keeps missions from being un-debuggable)
*
* Revision 2.9 2005/04/21 15:58:08 taylor
* initial changes to mission loading and status in debug builds
* - move bmpman page in init to an earlier stage to avoid unloading sexp loaded images
* - small changes to progress reports in debug builds so that it's easier to tell what's slow
* - initialize the loading screen before mission_parse() so that we'll be about to get a more accurate load time
* fix memory leak in gamesnd (yes, I made a mistake ;))
* make sure we unload models on game shutdown too
*
* Revision 2.8 2005/03/30 02:32:40 wmcoolmon
* Made it so *Snd fields in ships.tbl and weapons.tbl take the sound name
* as well as its index (ie "L_sidearm.wav" instead of "76")
*
* Revision 2.7 2005/03/24 23:31:46 taylor
* make sounds.tbl dynamic
* "filename" will never be larger than 33 chars so having it 260 is a waste (freespace.cpp)
*
* Revision 2.6 2004/08/11 05:06:23 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
* Revision 2.5 2004/03/12 16:23:49 phreak
* bumped MAX_GAME_SOUNDS to 400 if INF_BUILD is defined
*
* Revision 2.4 2003/03/20 22:58:43 Goober5000
* moved ballistic primary reload sounds to indexes 171 and 172
*
@@ -343,16 +375,15 @@
void gamesnd_parse_soundstbl(); // Loads in general game sounds from sounds.tbl
void gamesnd_init_sounds(); // initializes the Snds[] and Snds_iface[] array
void gamesnd_close(); // close out gamesnd... only call from game_shutdown()!
void gamesnd_load_gameplay_sounds();
void gamesnd_unload_gameplay_sounds();
void gamesnd_load_interface_sounds();
void gamesnd_unload_interface_sounds();
void gamesnd_preload_common_sounds();
void gamesnd_play_iface(int n);
void gamesnd_play_error_beep();
void common_play_highlight_sound(); // called from interface code
int gamesnd_get_by_name(char* name);
#else
@@ -365,28 +396,32 @@ void common_play_highlight_sound(); // called from interface code
#define gamesnd_preload_common_sounds()
#define gamesnd_play_iface(n) ((void)(n))
#define gamesnd_play_error_beep()
#define gamesnd_get_by_name(n) (-1)
#endif // ifndef NO_SOUND
//This should handle NO_SOUND just fine since it doesn't directly access lowlevel code
//Does all parsing for a sound
void parse_sound(char* tag, int *idx_dest, char* object_name);
// this is a callback, so it needs to be a real function
void common_play_highlight_sound();
#endif // ifndef NO_SOUND
// match original values by default, grow from this
#define MIN_GAME_SOUNDS 200
#define MIN_INTERFACE_SOUNDS 70
// Misc_sounds[] holds handles for misc sounds in the game (list appears in sounds.tbl)
#ifdef INF_BUILD
#define MAX_GAME_SOUNDS 400
#else
#define MAX_GAME_SOUNDS 200
#endif
extern int Num_game_sounds;
extern int Num_iface_sounds;
#define MAX_INTERFACE_SOUNDS 70
#define MAX_SPECIES_FLYBY_SOUNDS 4 // 4 different possible flybys for species
extern game_snd Snds[MAX_GAME_SOUNDS];
extern game_snd Snds_iface[MAX_INTERFACE_SOUNDS];
extern game_snd *Snds;
extern game_snd *Snds_iface;
// flyby sounds - 2 for each species (fighter and bomber flybys)
extern game_snd Snds_flyby[MAX_SPECIES_NAMES][2];
extern game_snd Snds_flyby[MAX_SPECIES][2];
// symbolic names for misc. game sounds. The order here must match the order in
+2
View File
@@ -10,6 +10,8 @@
#include "graphics/2d.h"
#include "globalincs/alphacolors.h"
// -----------------------------------------------------------------------------------
// ALPHA DEFINES/VARS
//
Loaded 100 of 703 files, more files were not shown because too many files have changed in this diff. Show more